Using html audio with IE: MEDIA12899: AUDIO/VIDEO: Unknown MIME type

妖精的绣舞 提交于 2019-12-05 06:14:50
maja

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.

Take a look at the table on this site:

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats

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

(Source: How can I add multiple sources to an HTML5 audio tag, programmatically?)

Edit: It's worth to note, that you have the same problems with audio, video and fonts.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!