本文介绍了Youtube Javascript API - 禁用相关视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,这似乎记录不清,或者我在文档中看不到它。我基本上不需要使用JavaScript API的相关视频(?rel = 0 )。

Right, this seems to be poorly documented or I can't see it in the documentation. I basically want no related videos (?rel=0) using the JavaScript API.

$players[$vidIdPlaceholderRef] = new YT.Player('player_' + $vidIdPlaceholderRef, {
    height: '550',
    width: '840',
    videoId: $vidId
});

就是我所拥有的。

我也尝试过:

$players[$vidIdPlaceholderRef] = new YT.Player('player_' + $vidIdPlaceholderRef, {
    height: '550',
    width: '840',
    videoId: $vidId + '?rel=0',
    rel : 0
});

没有运气。有没有人知道可以添加的选项(尝试 rel:0 没有运气)

with no luck. Does any one know of an option which can be added (tried rel : 0 with no luck )

推荐答案

rel是一个玩家参数,如下所示:

"rel" is a player parameter, as specified here:

添加播放器参数对于iframe播放器,您需要指定第二个构造函数参数的playerVars属性(在撰写本文时,记录为,以及)

To add player parameters to iframe players, you need to specify the playerVars property of the second constructor argument (at the time of writing this is documented here, and on the IFrame API documentation page)

例如

new YT.Player('playerid', {
    height: '550',
    width: '840',
    videoID: 'video_id',
    playerVars: {rel: 0, showinfo: 0, ecver: 2}
});

这篇关于Youtube Javascript API - 禁用相关视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 05:38