Youtube disable related videos

混江龙づ霸主 提交于 2020-04-15 09:43:09

问题


I'm using Youtube iframe API to add a video to my page, but it's showing related videos when the video is about to end even though i have set the 'rel' parameter to 0.

Here is the concerned part of my code:

function onYouTubeIframeAPIReady() {
    player = new YT.Player('homeplayer', {
        height: '1070',
        width: '1920',
        videoId: videoID,
        playerVars: {
                'controls': 0,
                'loop': 1,
                'modestbranding': 1,
                'rel': 0,
                'showinfo': 0,
                'playlist': videoID
        },
        events: {
            'onReady': onPlayerReady
        }
    });
}

Maybe this question has already been asked but i can't find a solution as youtube api has been updated multiple times.


回答1:


The functionality of the rel parameter has changed; in August of 2018, YouTube deprecated it and in September of 2018 they modified the player API so you can no longer hide related videos. Rather, if you set rel to 0, the embedded player will only show related videos from the channel that the just-played video is from. If you omit rel, then the embedded player will show related videos from anywhere on YouTube. There is no longer any way to remove related videos altogether.

See https://developers.google.com/youtube/player_parameters#release_notes_08_23_2018 for more details.



来源:https://stackoverflow.com/questions/53617320/youtube-disable-related-videos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!