I have setup an IceCast2 server which is capable of streaming ogg or mp3, both at 192 kbps.
In the html I use:
<audio controls autoplay>
<source src="http://site.com:8000/mount1.ogg" type="audio/ogg">
<source src="http://site.com:8000/mount2.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
But in Chrome 22 / Firefox 13 every time a new song begins, the player stops playback. In IE10 it continues playing without any problem. I'm thinking this might have something to do with the fact that Chrome and Firefox use the ogg source while IE uses mp3. It seems there is also a problem with Opera 12 when playing 192 kbps (music is heard saccadated), I switched to 128 and then it worked fluently.
Anyone know a fix for this?
Thanks for your help!
Posting this as a temporary hack until someone gives a better answer.
In Chrome MEDIA_ERR_DECODE
is thrown when the playback stops, while in Firefox it just stops without any error.
I changed the src
to currentSrc
and then called play()
in onerror
and onended
event, but the sound is sometimes interrupted before resuming play. There must be a better way.
/* jQuery - run on document ready */
$(function ()
{
var audioElement = $('#audioPlayer')[0];
audioElement.onended = audioElement.onerror = function()
{
audioElement.src = audioElement.currentSrc;
audioElement.play();
};
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With