Open xiaoxiaodexueyin opened 7 years ago
Hi there,
Sorry this isn't better documented - the waveformData
bits rely on using Flash 9 under the hood, which SM2 by default has moved away from given that Flash is being officially retired in a few years.
There are also a number of cross-domain / security restrictions on accessing this data from Flash - but if you do want to try it, you can play around with preferFlash: true
and flashVersion: 9
to get SM2 to use Flash 9 under the hood for audio playback.
Live demo here - note that you will need to unblock and allow the Flash plugin to run immediately on page load (basically), otherwise it will fall back to HTML5 and no visualizations will work during playback. http://www.schillmania.com/projects/soundmanager2/demo/360-player/canvas-visualization.html#hifi=1
These days, support for this data should be pretty reliable from HTML5 via the Web Audio API; I'll make a note to revisit it. In previous years, support was quite buggy between Firefox, Safari, Chrome and non-existent in IE.
i read the api, it said when whileplaying() fired can get the waveformData, but i write on the console, it returned null.
could you please tell me how to use the waveformdata? or any function can help me to get the audio's waveform data array when i have load it fully? because i need to draw the audio wave with canvas.....
thanks!