有没有可能用参数隐藏YouTube的大红色播放按钮? [英] Is it possible to hide youtube's big red play button with a parameter?

查看:783
本文介绍了有没有可能用参数隐藏YouTube的大红色播放按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用的代码的快速示例创建了我的YouTube iframe:

  player = new YT。 Player('[PLAYER ID]',{
height:'300',
width:'480',
videoId:'[VIDEO ID]',
playerVars:{ 'controls':0,'showinfo':0},
});

到目前为止,它的运行效果很好,它无需控件或信息条即可加载视频, m'手动'使用javascript播放视频。



问题是,现在不需要播放视频即刻显示的大红色播放按钮。





有什么办法可以解决这个问题吗?我查看了文档,找不到一个合适的参数让我隐藏它。

这是不可能的。因此,隐藏播放按钮的唯一方法是将视频图像放在可从YouTube获取的视频之上,如下所示。
每个YouTube视频都有4个生成的图像。它们的格式可以预见如下:

  http://img.youtube.com/vi/<insert-youtube-video -id-here> /0.jpg 
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http:// img .youtube.com / vi /< insert-youtube-video-id-here> /2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here> ; /3.jpg

但是一旦添加叠加层,点击屏幕而不是控制将不会播放视频,为此添加播放视频的以下jQuery

  jQuery('#overlay')。click(function (){
jQuery(this).hide();
jQuery('#youtube_id')。get(0).playVideo();
});


Quick example of the code I'm using at the moment to create my YouTube iframe:

player = new YT.Player('[PLAYER ID]', {
  height: '300',
  width: '480',
  videoId: '[VIDEO ID]',
  playerVars: { 'controls': 0, 'showinfo': 0 },
});

It's all working great so far, it's loading the video fine without controls or the info strip and I'm 'manually' playing the video using javascript.

The problem is that there's now no need for the big red 'play' button that is momentarily displayed as the video's starting.

Is there any way I can get rid of this? I've looked through the documentation and can't find a suitable parameter that would allow me to hide it.

解决方案

I found it not possible. So the only way to hide Play button is to place video image above the video which can be fetched from youtube as follow. Each YouTube video has 4 generated images. They are predictably formatted as follows:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg

But once you add the overlay, clicking on the screen instead of control will not play the video, To do this add the following jQuery which plays the video

jQuery('#overlay').click(function(){
  jQuery(this).hide();
  jQuery('#youtube_id').get(0).playVideo();
});

这篇关于有没有可能用参数隐藏YouTube的大红色播放按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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