【发布时间】:2016-01-08 09:42:32
【问题描述】:
我有这个广播流播放器代码。它在 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;">
问题仅在于播放流时,所有浏览器上的图像都会发生变化。将不胜感激任何帮助。谢谢:)
【问题讨论】:
-
http://radiostation.com:8000/stream- 显然是一个虚拟名称,对 - 知道发送的实际音频类型会有所帮助 -
对不起,是radijas.tau.lt:8000/stream,格式是.m3u文件。希望这会有所帮助!
标签: javascript html internet-explorer firefox html5-audio