As I am rebuilding the BlaatSchaap site, I want to keep it
up to modern standards. So, I am using HTML5 for it.
If you look at it’s DOCTYPE you will notice it is HTML5.

You might also know that I have run a radio station in the

I think I have been experimenting with this in the past
and ran into issues too.

The problem, the HTML5 audio tag is very suitable for
playing audio files, but it fails for audio streams.

Chrome connects to the IceCast server correctly, and when
I tell it to display controls, it claims to be playing, but no audio
is produced.

Firefox 3.6 fails totally and will only display a ‘loading’ symbol
when the controls are enabled.
Firefox 4.0 beta8 nightly build will behave like Chrome, and
be playing ‘on screen’ without producing sound.

The only browser that appears to be successful playing the
IceCast2 stream is Opera. For this test I’ve used the
release version 10.63. Even though it plays, there are some
issues related to the fact that the javascript API for the audio
tag assumes it handles files, with a fixed size, rather then an
endless stream.

The first issue is, there is no stop() function. Only play() and
pause(). This results in, it will continue streaming when one
‘pauses’ the playback. This is to be expected when one
pauses the playback rather then stops it. One solution to
this issue is to write and delete the audio tag from Javascript.


</p> <div id="player" style="display: block;">test</div> <p>


<br /> function Play(){<br /> document.getElementById(&#8220;player&#8221;).innerHTML=&#8217;playing<audio width="300" height="32" autoplay="autoplay"><source src="" type="&quot;audio/ogg;" /><source src="" /></audio>&#8216;;<br /> }<br /> function Stop(){<br /> document.getElementById(&#8220;player&#8221;).innerHTML=&#8221;stopped&#8221;;<br /> }<br />

By deleting the audio tag this way, it will stop the connection to the server too. But there is still an issue. The stream is still buffered. When once starts the stream again, by rewriting the audio tag into the html document, it will start playing the buffer it had been playing before, and so, plays a few seconds of old content before it resumes the current live stream.

It seems the audio tag is not suitable to play radio streams. So far, the only reliable way to play radio streams, semi-platform independant, is using a Java based ogg player: Jorbis ( which I have been using on my site before. But still…. it depends on Java being installed.

« »