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

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

问题描述

我目前用于创建 YouTube iframe 的代码的快速示例:

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 },
});

到目前为止一切都很好,它在没有控件或信息条的情况下可以很好地加载视频,我正在使用 javascript手动"播放视频.

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.

推荐答案

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

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

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

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天全站免登陆