JWplayer 图像后备,如果没有 html5 或 flash 支持?

发布于 2024-12-09 16:10:07 字数 426 浏览 0 评论 0原文

我正在使用 JWPlayer 来提供带有 Flash 回退功能的 html5 视频。

如果既没有 html5 也没有 flash 支持,我还希望有一个图像后备,但我不知道如何做到这一点。

我的代码如下:

modes:  [
   { type: "html5", },
   { type: "flash", src="http://www.mysite.com/jwplayer/player.swf"}
],

levels: [
   { file: "myvideo.mp4" }, // H.264 version
   { file: "myvideo.webm" }, // WebM version
   { file: "myvideo.ogg" } // Ogg Theroa version
],

有什么想法吗?谢谢

I'm using JWPlayer to serve an html5 video with a flash fallback.

I'd also like to have an image fallback if there is neither html5 nor flash support but I can't see how to do this.

My code is as follows:

modes:  [
   { type: "html5", },
   { type: "flash", src="http://www.mysite.com/jwplayer/player.swf"}
],

levels: [
   { file: "myvideo.mp4" }, // H.264 version
   { file: "myvideo.webm" }, // WebM version
   { file: "myvideo.ogg" } // Ogg Theroa version
],

Any ideas? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那小子欠揍 2024-12-16 16:10:07

您可以使用两个实用程序函数来检查 HTML5 和 Flash。您可以在 中找到它们来源(复制并粘贴网址:http://developer.longtailvideo.com /trac/browser/trunk/js/src/utils/jwplayer.utils.js?rev=1311):

/**
 * Detects whether the browser can handle HTML5 video. 
 * Using this as a proxy for detecting all HTML5 features needed for the JW HTML5 Player.  Do we need more granularity?
 */
jwplayer.utils.hasHTML5 = function() {
    return !!document.createElement('video').canPlayType;
};

/**
 * Detects whether or not the current player has flash capabilities
 * TODO: Add minimum flash version constraint: 9.0.115
 */
jwplayer.utils.hasFlash = function() {
    return (typeof navigator.plugins != "undefined" && typeof navigator.plugins['Shockwave Flash'] != "undefined") || (typeof window.ActiveXObject != "undefined");
};

There are two utils functions you can use to check for HTML5 and Flash. You can find them here in the source (copy & paste the url: http://developer.longtailvideo.com/trac/browser/trunk/js/src/utils/jwplayer.utils.js?rev=1311):

/**
 * Detects whether the browser can handle HTML5 video. 
 * Using this as a proxy for detecting all HTML5 features needed for the JW HTML5 Player.  Do we need more granularity?
 */
jwplayer.utils.hasHTML5 = function() {
    return !!document.createElement('video').canPlayType;
};

/**
 * Detects whether or not the current player has flash capabilities
 * TODO: Add minimum flash version constraint: 9.0.115
 */
jwplayer.utils.hasFlash = function() {
    return (typeof navigator.plugins != "undefined" && typeof navigator.plugins['Shockwave Flash'] != "undefined") || (typeof window.ActiveXObject != "undefined");
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文