HTML5<音频>标记donesn'不能在Firefox和Internet Explorer上工作

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

本文关键字:Firefox Internet 工作 Explorer 音频 lt gt 标记 HTML5 donesn 不能      更新时间:2023-09-26

我有这个无线电流播放器代码。它在Chrome和iOS Safari上运行良好,但在Firefox和Internet Explorer 11上不起作用。

这有点像我的index.php文件:

<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>

当您进入页面时,默认情况下图像为"play.png"。当你按下它时,它会变为"pause.png",音乐就会开始播放。

这是这个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;">

问题仅在于播放流,所有浏览器上的图像都会发生变化。如果有任何帮助,我们将不胜感激。感谢:)

Firefox和Internet explorer不支持音频/aacp内容,这是该流的格式

对于这个流,你可以使用/stream2,它是音频/mpeg,在浏览器中得到了更广泛的支持

注意-firefox的开发者版本确实支持音频/aacp,所以可能在6到12周内发生变化

相关文章: