I have a flash player programmed by a different team. Now I have 1 project where I need to re program that player into HTML5. All functions of the flash player looks doable. I am just not sure how to show the animation when audio is being played. Eg. When beats get high, the animation shows up more when there is a bit silence the animation show up less. Could anybody please help me?
To get an idea, here is the attached screenshot:
With SoundManager2 you can easily access waveform data and make a graphical display with it:
someSoundObject.whileplaying = function() {
// Move 256 absolutely-positioned 1x1-pixel DIVs, for example (ugly, but works)
var gPixels = document.getElementById('graphPixels').getElementsByTagName('div');
var gScale = 32; // draw -32 to +32px from "zero" (i.e., center Y-axis point)
for (var i=0; i<256; i++) {
graphPixels[i].style.top = (gScale+Math.ceil(this.waveformData.left[i]*-gScale))+'px';
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.