In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how vue uses wavesurfer.js to solve audio visualization playback problem". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "how vue uses wavesurfer.js to solve audio visualization playback problem" can help you solve the problem.
The effect image is as follows:
1. Install wavesurfernpm install wavesurfer.js2. Import import WaveSurfer from 'wavesurfer.js' on the page
Note: I didn't use the timeline, so I didn't introduce it, if I need to reintroduce it.
Import Timeline from 'wavesurfer.js/dist/plugin/wavesurfer.timeline.js'3. Play / pause import WaveSurfer from "wavesurfer.js" on source code; / / import Timeline from "wavesurfer.js/dist/plugin/wavesurfer.timeline.js"; export default {name: "Details", data () {return {wavesurfer: null,} }, mounted () {this.$nextTick () = > {this.wavesurfer = WaveSurfer.create ({container: this.$refs.waveform, / / waveColor:'# 409EFFF, barWidth: 1, cursorColor: "black", progressColor: "blue", backend: "MediaElement", / / mediaControls: false, audioRate: "1" / / use the Timeline plug-in}) / / Special reminder: require (relative path) is required here, otherwise an error this.wavesurfer.load (require (".. / mp3/living.mp3")) will be reported. Methods: {playMusic () {/ / "play / pause" button click trigger event, click to play if paused, click to pause this.wavesurfer.playPause.bind (this.wavesurfer) (),}; .mixin-components-container {width: 100%! important; # f0f2f5; padding: 30px; / * min-height: calc (100vh-84px) * /}. El-card__body {height: 70px! important; padding: 0 auto! important;.card {height: 70px Note:
This plug-in is really too hanging, the official document is too powerful, on the link: https://wavesurfer-js.org/
I used several methods:
4.1.
This.wavesurfer.play (0212); specify the start time and end time in seconds, starting in 0 seconds and ending in 212 seconds
4.2.
This.wavesurfer.on ("pause", () = > {console.log ('I paused')})
Monitoring pause
4.3.
This.wavesurfer.load (require (".. / mp3/living.mp3"); read the Mp3 file in the directory path, you can test with this.wavesurfer.load ('xxx.mp3')); read the network address, if you have an interface, this is the end of the content on "how vue uses wavesurfer.js to solve the audio visual playback problem". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.