问题描述
HTML是以下内容:
Html is following:
audio id="audioCap" preload="auto"> type="audio/wav"</audio>
记者:
$('#audioCap')[0].play();
和设置SRC如下:
$('#audioCap').attr('src', 'http://blabla/captcha/captcha.wav?' + response);
,其中反应是一个id。
where response is an id.
这与除IE版本的所有浏览器(9-10-11),这也应该work.I'm得到效果很好。我做了一个研究,发现它应该是一个服务器的配置问题。我抓获的调试工具的网络数据,并检查响应头。内容类型显示为音频/ WAV这是真的。我不知道还有什么可以导致此错误。
This works well with all browsers except IE versions(9-10-11) which should also work.I'm getting "MEDIA12899: AUDIO/VIDEO: Unknown MIME type". I made a research and found out that it should be a server configuration problem. I captured the network data with the debug tools and checked the response headers. Content-Type is shown as audio/wav which is true. I don't know what else could cause this error.
推荐答案
不幸的是,它因为Internet Explorer不支持 WAV
-files。
Unfortunately, its because Internet Explorer doesn't support wav
-Files.
为了获得跨浏览器兼容,你需要提供相同的音频文件在几个不同的格式。
In order to get cross-browser compatibility, you'll need to provide the same audio-file in several different formats.
拿本网站一看表:
https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
为了支持IE,你需要添加一个 MP3
或 MP4
-format。
In order to support IE, you need to add an mp3
or mp4
-format.
要为当前浏览器正确的格式,你可以使用这样的:
To provide the correct format for the current Browser, you can use something like this:
var source= document.createElement('source');
if (audio.canPlayType('audio/mpeg;')) {
source.type= 'audio/mpeg';
source.src= 'audio/song.mp3';
} else {
source.type= 'audio/wav';
source.src= 'audio/song.wav';
}
audio.appendChild(source);
的(来源:How我可以添加多个数据源到HTML5音频标签编程?)的
编辑:这是值得大家注意的,那你有音频,视频和字体相同的问题。
It's worth to note, that you have the same problems with audio, video and fonts.
这篇关于使用HTML音频与IE浏览器:MEDIA12899:AUDIO / VIDEO:未知的MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!