I need such a thing in my recent project, but I have searched the internet and there is no suitable player with a waveform.
Once found a very close solution, and finally cannot be used:
- Media Player. if the machine is installed with a later version of Media Player, it can display the waveform. The advantage is that the client generally does not need to download it (because WMP in Windows is called. DLL), the disadvantage is that if it is a lower version of Media Player, it will not be able to display the waveform, and even if it is a higher version, sometimes it will not display the waveform, the reason is unknown...
- Flash Player. There are many examples on the Internet, but most of the waveforms are fake, that is, a jittery animation... In addition, the style is not suitable for use.
Finally, I made one myself, which is very simple. Only one video area is used to display the waveform, and three interfaces are provided: Play, pause, and stop.
0-512 pixels are left-channel waveforms, and 256-512 are right-channel waveforms. If pixels are exceeded, the waveforms start from the beginning.
The implementation principle is mainly to use soundmixer. computespectrum in as3, and then draw a Curve Based on the stage size.
The disadvantage is that it does not support WAV. I tried to use a flash player WAV library, but the memory overhead is too large. If you need to play wav, you can use FFMPEG to convert it to MP3.
SWF
Simple interface: Play: playaudio, pause: pauseaudio, stop: stopaudio
Flash music player with Waveforms