YouTube无Chrome/JavaScript API Player全屏按钮 [英] YouTube Chromeless/JavaScript API Player Full-Screen Button

查看:114
本文介绍了YouTube无Chrome/JavaScript API Player全屏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了chromeless播放器,到目前为止,诸如播放,暂停,更改视频,静音,取消静音之类的必要控件似乎都可以通过JavaScript正常运行.现在,我需要通过JavaScript将无边框播放器发送到全屏"模式.

I have implemented chromeless player and so far the necessary controls such as play, pause, change video, mute, unmute all appear to work fine through JavaScript. I now need to send the chromeless player to "Full Screen" mode via JavaScript.

JavaScript API播放器包括全屏按钮,但无铬播放器不包括;实际上; chromeless播放器不应包含ANY按钮.因此,我需要通过JavaScript设置全屏模式,但找不到为此提供任何记录的方法.知道这是否可行吗?

The JavaScript API player includes the full screen button but the chromeless player does NOT; infact; the chromeless player is not supposed to contain ANY button. I therefore need to set full screen mode via JavaScript but could not find any documented method for this. Any idea if this is possible or not?

仅供参考,我正在使用SWFObject嵌入播放器.

FYI, I am using SWFObject to embed the player.

参考文献:

  • YouTube JavaScript API Player Reference
  • YouTube Chromeless Player Example

推荐答案

播放器对象上有一个player.setSize(width:Number,height:Number)方法.为我工作.

There is a player.setSize(width:Number, height:Number) method on the player object.Have you used that.I am using ActionScript though and setSize is working for me.

查看文档 您不必在JavaScript中使用此方法,因为当嵌入代码中的包含元素的height和width属性被修改时,播放器会自动调整大小."

我不是JavaScript专家,但我建议...您可以将播放器放在div标签中 然后点击全屏"按钮或图标,将那个div的大小重置为"100%",我认为播放器会自动增加到该大小

Looking at the documentation 'You should not have to use this method in JavaScript as the player will automatically resize when the containing elements in the embed code have their height and width properties modified.'

I am not a javascript expert but i would suggest...you can put the player in a div tag and on click the 'fullscreen' button or icon you reset the size of that div to '100%' and i think the player would automatically increase to that size

希望这会有所帮助.

这篇关于YouTube无Chrome/JavaScript API Player全屏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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