HTML5视频,如果没有.ogv文件则回退到flash [英] HTML5 video, fallback to flash if no .ogv file
本文介绍了HTML5视频,如果没有.ogv文件则回退到flash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果不存在必要的文件类型,如何回退到Flash视频播放器。
How can I fallback to a flash video player if the necessary file type is not present.
例如此代码:
<video controls width="500">
<source src="<?= $mov ?>" type="video/mp4" />
<embed src="http://blip.tv/play/gcMVgcmBAgA%2Em4v" type="application/x-shockwave-flash" width="1024" height="798" allowscriptaccess="always" allowfullscreen="true"></embed>
</video>
不包含.ogv文件,因此在Firefox中会显示空的视频播放器。
Does not include an .ogv file, so in Firefox, an empty video player is displayed.
即使浏览器支持html5视频标签,我怎么能回到Flash播放器?
How can I fall back to a Flash player even if the html5 video tag is supported in the browswer?
推荐答案
您可以使用JavaScript来检测它:
You can use JavaScript to detect it:
(function (video) {
if (!video.canPlayType || !video.canPlayType('video/mp4')) {
// Flash fallback
}
}(document.createElement('video')));
这篇关于HTML5视频,如果没有.ogv文件则回退到flash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文