对于不支持它的浏览器,我有以下带有音频标签的 html5 文档和对 Flash 的回退:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<body>
<audio autoplay controls preload="auto" autobuffer>
<source src="trumpet.ogg" type="audio/ogg">
<source src="trumpet.mp3" type="audio/mp3">
<source src="trumpet.wav" type="audio/wav">
<source src="trumpet.m4a" type="audio/aac">
<!-- Flash fallback -->
<object width="1" height="1" type="application/x-shockwave-flash" data="player.swf">
<param name="movie" value="player.swf">
<param name="flashvars" value="file=trumpet.mp3">
</object>
</audio>
</body>
</html>
所有文件都由服务返回,并在 http 标头中具有正确的 MIME 类型。该解决方案适用于除 Internet Explorer 9 和 10 之外的所有浏览器(兼容模式除外,因为 Flash 文件将在那里播放)。
在这两个浏览器中,我可以看到播放器控件带有一条错误消息,上面写着“错误:不支持的音频类型或无效的文件路径”。我试图改变源标签的顺序,但找不到解决方案让它播放它们中的任何一个。
有没有人暗示要检查什么或这里出了什么问题?
请参阅http://l.urff.at/html5audioexample以了解上述标记的实际效果。
提前感谢您提供任何有用的提示或提示!:)