Mindaugas
Mindaugas

Reputation: 11

HTML5 <audio> tags donesn't work on Firefox and Internet Explorer

I have this radio stream player code. It words perfectly on Chrome and iOS Safari, but it won't work on Firefox and Internet Explorer 11.

It's a bit of my index.php file:

<script type="text/javascript"
src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script>
function changeImage() {
    var image = document.getElementById('myImage');
    if (image.src.match("pause")) {
        image.src = "play.png";
       document.getElementById('sound1').pause();
    } else {
        image.src = "pause.png";
       document.getElementById('sound1').play();
    }
}
</script>

When you enter the page, the image is "play.png" by default. When you press on it it changes to "pause.png" and the music starts playing.

And here's this script in html:

<audio id="sound1" src="http://radiostation.com:8000/stream" type="audio/mpeg"></audio>
    <img id="myImage" onclick="changeImage();" src="play.png" style="position: absolute; top: 130px; left: 23px;">

The problem is only on playing the stream, the image changes on all browsers. Would be grateful for any any help. Thanks :)

Upvotes: 1

Views: 252

Answers (1)

Jaromanda X
Jaromanda X

Reputation: 1

Firefox and Internet explorer do not support audio/aacp content, which is the format of that stream

For this stream you could use /stream2 which is audio/mpeg which is more widely supported amongst browsers

NOTE - developer version of firefox DOES support audio/aacp - so things may change in about 6 to 12 weeks

Upvotes: 2

Related Questions