Youtube Javascript API - disable related videos

2019-01-21 06:18发布

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

is what I have in place.

I have also tried:

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

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

7条回答
家丑人穷心不美
2楼-- · 2019-01-21 07:12

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

查看更多
登录 后发表回答