本文介绍了Html5 音频标签闪退的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何为 html5 音频标签实现 Flash 回退?例如我有这个音频标签
由于并非所有浏览器都支持 .mp3 文件,我如何启用或创建 Flash 回退
解决方案 这是一个很好的代码片段,它有一个很好地实现的 Flash 回调:
<audio id="audioplayer" 预加载控制循环样式="width:424px;"><source src="audio.mp3"><source src="audio.caf">音频><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"});}
这是我找到它的参考文献:让 HTML5 音频标签和 Flash 回退与所有人完美配合浏览器
希望有帮助!
How do you implement a flash fallback for an html5 audio tag? for example I have this audio tag
<div class = "div.jp-audio"><audio class ="audio-player" name= "audio-player" src="song.mp3" ></audio></div>
How do I enable or create a flash fall back since not all browsers support .mp3 files
解决方案 Here is a good code snippet that has a nicely-implemented Flash callback:
<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>
Here is the ref where I found it:Getting HTML5 Audio Tag and Flash Fallback to Work Nicely With All Browsers
Hope it Helps!
这篇关于Html5 音频标签闪退的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
07-25 16:44