gpt4 book ai didi

flash - HTML5 音频标签 flash 回退

转载 作者:太空狗 更新时间:2023-10-29 13:45:49 24 4
gpt4 key购买 nike

如何为 html5 音频标签实现 flash 回退?例如我有这个音频标签

<div class = "div.jp-audio"><audio  class ="audio-player" name= "audio-player" src="song.mp3" ></audio></div>

由于并非所有浏览器都支持 .mp3 文件,我该如何启用或创建 Flash 回退

最佳答案

这是一个很好的代码片段,它有一个很好实现的 Flash 回调:

<audio id="audioplayer" preload controls loop style="width:424px;">
<source src="audio.mp3">
<source src="audio.caf">
</audio>
<script type="text/javascript">
var audioTag = document.createElement('audio');
if (!(!!(audioTag.canPlayType) && ("no" != audioTag.canPlayType("audio/mpeg")) && ("" != audioTag.canPlayType("audio/mpeg")))) {
AudioPlayer.embed("audioplayer", {soundFile: "audio.mp3"});
}
</script>

这是我找到它的引用: Getting HTML5 Audio Tag and Flash Fallback to Work Nicely With All Browsers

希望对您有所帮助!

关于flash - HTML5 音频标签 flash 回退,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11681856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com