简体   繁体   中英

Play icecast with mp3 by html5

I have web base radio station which stream music by icecast server with mp3 codex.

http://live.liveradio.ir:8000/airtime_128 I can play it by VLC and other Player application.

Now I wanna play it in browser by HTML5.How can I do it?

Well here's my answer. You can do it, but due to the lack of an audio standard for browsers, you're going to have different results. The basic way to do it is to use the <audio> tag and then point the source to your stream URL. However, MP3 presents complications. Chrome and Safari are the only ones that fully support HTML5/MP3 streaming. IE has been iffy if my research holds true. Firefox and Opera won't support it at all.

My suggestion would be to create two streams, one in MP3 and one in OGG, with a Flash backup. Then you can code your HTML to detect the browser and go from there.

Another option is to use the <video> tag. See these two links for more info on that:

https://github.com/dz0ny/AudioJS Not really using <video> but it's a fork of VideoJS. Look at that as well. Some people have been able to stream only audio with it.

http://www.wowza.com/forums/showthread.php?14071-Streaming-to-HTML5-audio-tag

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM