检测客户端是否使用 HTML5 Youtube 播放器 [英] Detect if client using HTML5 Youtube player

查看:30
本文介绍了检测客户端是否使用 HTML5 Youtube 播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有嵌入式 YouTube 播放器的页面上,是否可以判断正在使用哪个版本的播放器(HTML5 或 Flash)?

On a page with an embedded YouTube player, is it possible to tell which version of the player is being used (HTML5 or Flash)?

推荐答案

事实证明,您可以检查播放器上某些属性是否存在.最明显的可能是 cueVideoByFlashvars,所以你可以这样做:

It turns out you can check for the existence/absence of certain properties on the player. The most obvious one is perhaps cueVideoByFlashvars, so you can do:

<代码>var isHtml5Player = !player.cueVideoByFlashvars;

正如 Jeff 提到的那样,不得不依赖它并不好,因为它随时可能发生变化.

As Jeff mentions it's not great to have to rely on this as it could change at any time.

这篇关于检测客户端是否使用 HTML5 Youtube 播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆