1

我已经看到很多关于如何实现跨浏览器音频播放的 javascript 答案,但我更愿意使用 HTML5 的多个 src 标签

<audio>
    <source src="demo.mp3" type="audio/mp3"> 
    <source src="demo.ogg" type="audio/ogg"> 
    <!-- If no support at all. -->
    HTML5 audio not supported 
</audio>

我正在使用 rails 助手标签,但看不到如何定义多个来源

audio_tag("demo.ogg", :id => "soundDemo")

我试过 audio_tag("demo.ogg", :src => "demo.mp3", :id => "soundDemo") 但这不起作用。

有谁知道可行的语法吗?谢谢

4

1 回答 1

0

这是一个迟到的回复,但我今天遇到了这个问题,这个链接应该回答你的问题!

https://github.com/rails/rails/pull/4661#issuecomment-8407652

基本上这是不可能的,但将在未来的稳定版本中包含第一个参数作为源数组。

于 2012-09-09T18:34:53.090 回答