开发者

Javascript play sound

开发者 https://www.devze.com 2023-03-14 04:03 出处:网络
I want to know is there any play to play s开发者_开发技巧ame wmv or mp3 from javascript, that will work for all the browsers?

I want to know is there any play to play s开发者_开发技巧ame wmv or mp3 from javascript, that will work for all the browsers? I had a look at HTML5 audio tag, but seems i need to add there .ogg, .mp3,.wav files to support all the browsers, though i need to have only one audio file.

Any idea?

Many Thanks, Hrayr


If you want the best cross-browser support, you should provide more than one encoding. It's very simple to generate the other versions using a free encoding tool like Audacity. Then, provide at least an mp3 and an ogg version of the resource (I wouldn't bother with wav) as this will cover all the browsers that support html5 audio. Then, if you want to provide a fallback option, like flash, you can cover all those users of non-html5 browsers who have the flash plug-in installed. You can use something like mediaelementjs to simplify the process of providing a unified player.


There probably is a way: http://jsmad.org/. It is a pure javascript mp3 decoder.

0

精彩评论

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