Skip to content Skip to sidebar Skip to footer

How To Play Live Aac Stream On Android With Html5 Audio Element

I am trying to embed an html5 audio tag in a page to allow playing a live AAC+ stream coming from an Icecast server. According to the media formats developer's guide, Android suppo

Solution 1:

From the lack of responses to the contrary, I have to conclude that the answer to the original question is, "No, it is not possible to use the HTML5 audio tag to play a live AAC+ stream from an Icecast server".

I am posting an answer to share what I ended up doing.

My first inclination was simply to set up a second Icecast stream using MP3 instead of AAC. This will work, but you must be willing to accept the buffering delay that Android's audio player introduces with MP3 streams. Unfortunately, at 64 kpbs Android makes you wait for over 40 seconds before it will start playing the MP3 stream. Admittedly, 64 kpbs is not very good quality for MP3, but even at 128 kbps the buffering takes over 20 seconds, enough for listeners to conclude that the stream is down. So MP3 is not an option for us.

My eventual solution was to ask our CDN to add a Wowza application that pulls from the AAC+ Icecast stream and transmuxes it using HLS.

Now my audio tag looks like this:

<audiocontrols="controls"><sourcesrc="http://www.example.com/wowza/stream.m3u8"/><sourcesrc="http://www.example.com/audio/aac"/></audio>

Note that I had to list the HLS source first, because otherwise the Android device will actually pick the Icecast stream and try to play it, which it can't (you'd think it would know enough not to do that).

So in the end Android does play a live AAC+ stream with no delay, as long as it is delivered via HLS, and not directly from Icecast. I must say I was very disappointed with Android, both its lack of support for direct Icecast AAC+ and for its poor handling of live MP3 streams, especially since the competition (iOS) handles everything you throw at it without blinking.

Post a Comment for "How To Play Live Aac Stream On Android With Html5 Audio Element"