开发者

JavaScript for MP3 playback

开发者 https://www.devze.com 2022-12-08 22:32 出处:网络
Is there a JavaScript library av开发者_StackOverflow中文版ailable that can playback an MP3 or related music file?The JavaScript would be fed the MP3 from the server and stream it back over the browser

Is there a JavaScript library av开发者_StackOverflow中文版ailable that can playback an MP3 or related music file? The JavaScript would be fed the MP3 from the server and stream it back over the browser.


Here it is: soundmanager2

It works by exploiting flash, but it's a full javascript experience.


On FF3 you can use the audio tag... but it does not support MP3 (only ogg). On Chrome it might work with mp3. Safari should work as Chrome. Opera should also work, but I am unsure which codecs/formats it can play. Guess what does IE support? :)

IMHO, you should resort to playing MP3 using flash.


You'll probably end up using some flash-based media player, that you can can control via javascript using swfobject.


Probably your best bet here would be to use the Flash Player. There are many other ways, involving various plugins (Quicktime, WMP, Real), but Flash probably will give you the greatest coverage.

EDIT:

A pure Javascript solution is simply not possible, probably due to licensing constraints of the mp3 format.


No.
As others wrote, you cannot do that in a portable way, particularly on IE, which would need some plugin to play sounds.
JavaScript isn't really suited to manipulate binary data, anyway, and is quite limited to access computer's hardware, so it has to ask the browser, if possible, to do the job itself.

0

精彩评论

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