为什么这个HTML5音频特定的javascript不能在Internet Explorer 9中工作?
Why doens't this HTML5 audio-specific javascript work in Internet Explorer 9?
我有以下HTML5音频特定的javascript,它在除IE9以外的所有浏览器中都非常适合我(见下面的代码)。有人知道为什么吗?我是否可以重新编写脚本,使其在IE9中也能工作?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
JavaScript: $(document).ready(function(){
$("#play-bt").click(function(){
$("#audio-player")[0].play();
$("#message").text("Music started");
})
$("#pause-bt").click(function(){
$("#audio-player")[0].pause();
$("#message").text("Music paused");
})
$("#stop-bt").click(function(){
$("#audio-player")[0].pause();
$("#audio-player")[0].currentTime = 0;
$("#message").text("Music Stopped");
})
$("#mute-bt").click(function(){
if ($("#audio-player")[0].muted == true) {
$("#audio-player")[0].muted = false;
$("#message").text("Music Un-Muted");
} else {
$("#audio-player")[0].muted = true;
$("#message").text("Music Muted");
}
})
})
HTML: <audio id="audio-player" name="audio-player">
<source src="http://www.colorshoutconcepts.com/wp-content/uploads/2011/12/uf_orange_and_blue.ogg" type="audio/ogg" />
<source src="http://www.colorshoutconcepts.com/wp-content/uploads/2011/12/uf_orange_and_blue.mp3" type="audio/mpeg" />
</audio>
<div id="message"></div>
<a id="play-bt" href="#">Play music</a> | <a id="pause-bt" href="#">Pause music</a> | <a id="stop-bt" href="#">Stop music</a> | <a id="mute-bt" href="#">Mute</a>
编辑:我应该怎么回复这个帖子?我不停地点击"添加评论"&"回答你的问题"链接,…但是什么也没发生。
我遇到的问题是,当我点击任何链接时,我得到javascript错误:
SCRIPT438:对象不支持属性或方法'play'
我指定MP3和OGG文件——这两种文件都是支持的音频格式,…而IE9只是吐出这些javascript错误。
SOLVED:事实证明,我必须添加开头&关闭HTML, HEAD, &BODY标记到我正在测试的html文档。换句话说……当我将页面创建为适当的HTML5文档时,它实际上在IE9中运行良好。
Mp3工作,IE的问题是播放。wav和。ogg
适用于IE9 - Chrome - Safari和firefox
var snd = new Audio("/pop.mp3");
snd.play();
IE9确实支持audio
标签,但是您需要提供一个IE9可以解码的音频流。在MP4容器中尝试MP3或AAC。
来源:http://msdn.microsoft.com/en-us/ie/hh410106 _HTML5_video_audio
更多来源:http://msdn.microsoft.com/sv-se/library/ff975061.aspx
编辑:你的编辑告诉我你正在使用MP3音频流。这应该行得通。请提供更多的信息。F12控制台有错误信息吗?相关文章:
- 视频HTML没有'无法在Internet Explorer 11上工作
- Internet Explorer缺少占位符支持,特别是密码字段
- Internet Explorer中的文本换行错误
- 为什么我在Internet Explorer上看不到html元素
- internet explorer 8兼容模式下的Youtube api错误
- 当浏览器控制台未打开时,为什么要求会导致Internet Explorer 9超时
- Internet Explorer 8. Events
- jQuery表单验证适用于Mozilla和Internet Explorer,但不适用于Chrome或Safari
- element.dataset in Internet Explorer
- Facebook FB.init”;访问被拒绝”;在Internet Explorer 11中
- JavaScript不适用于internet explorer和Firefox,但适用于谷歌
- 在Internet Explorer中,向所选内容添加选项不起作用
- 在Internet Explorer中从二进制文件打开PDF
- elementproblem internet explorer
- 我可以使用哪些方法在Internet Explorer中禁用Alt+*X*
- 如何在Internet Explorer中使用javascript设置cookie
- 只有当alert()在带有AJAX的internet explorer中使用时,Javascript才会更新UI
- sharepoint站点的internet explorer中出现Javascript错误
- Internet Explorer重新加载IFrame
- Internet Explorer Internet Failure HTTP Status Codes