开发者

Javascript mp3 audio data

开发者 https://www.devze.com 2023-04-09 12:37 出处:网络
Say i have a HTML5tag. Is there any possible way for Javascript on the page to get the current speaker output, and then graph it to produce a volume bar that got larger when the music got louder and s

Say i have a HTML5 tag. Is there any possible way for Javascript on the page to get the current speaker output, and then graph it to produce a volume bar that got larger when the music got louder and smaller when the music got quieter? I don't care if it works in IE or not. If this is not possible, would it be possible to extract that data out of the mp3 file and hope it lines up? I REALLY don't want to use flash.

Edit: I was inspire开发者_如何学编程d by this. Unfortunately it uses hard-coded values which wont work for me.


Short answer, yes it's possible. Check out the esteemed Mr. Doob's example. Sadly, looks like the explanatory blog post is down.

Mozilla has a custom extension, but Doob's example is working in WebKit...


The JS Audio Data API will let you do this with an html5 audio tag, or audio that is played from javascript. See https://wiki.mozilla.org/Audio_Data_API for details and examples. I don't know offhand what the status of this API is in current browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号