关于HTML5音频标签,我有两个问题。考虑以下代码段:
<!DOCTYPE html>
<html>
<body>
<a href="#">woot</a>
<audio controls >
<source src="\path\acdc.ogg" type="audio/ogg">
<source src="\path\file.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
</body>
</html>
type
属性,还是它们足够聪明以获取文件并查看它们是否可以播放? 我正在考虑文件实际上是mp3的实例,但是源
type
属性表示它是ogg。
最佳答案
在这里看看:https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element
基本上,浏览器会选择它可以支持的第一种类型。同样重要的是要知道,不仅需要在type
元素上具有source
属性,而且文件本身应该从服务器以正确的content-type
标题发送。
关于html - 具有多个来源的HTML5音频标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27823612/