问题描述
我目前用于创建 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 的红色大播放按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!