hide “more videos” within youtube iframe when stop

2019-04-09 03:51发布

How to hide the "more videos" section in Youtube iframes, when the user stops the video?

Example:

<iframe width="750" height="420" src="https://www.youtube/embed/cZnsLVArIt8?rel=0&iv_load_policy=3" frameborder="0" allowfullscreen></iframe>

enter image description here

I cant find any solution here: https://developers.google.com/youtube/player_parameters

1条回答
成全新的幸福
2楼-- · 2019-04-09 04:09

As per https://developers.google.com/youtube/player_parameters#release_notes_08_23_2018

The behavior for the rel parameter is changing on or after September 25, 2018. The effect of the change is that you will not be able to disable related videos. However, you will have the option of specifying that the related videos shown in the player should be from the same channel as the video that was just played.

To be more specific: Prior to the change, if the parameter's value is set to 0, then the player does not show related videos. After the change, if the rel parameter is set to 0, the player will show related videos that are from the same channel as the video that was just played.

It seems that it is youtubes intention to not give the ability to disable related videos functionality.

jquery way seems to not work either due to CORS, as would be css I guess.

$(".media-youtube-player").contents().find(".ytp-pause-overlay").remove();

causing blocked a frame with origin "xxx" from accessing a cross-origin frame.

Not sure if there is a way doing this, unless youtube allows it again. Want to disable this too so any help is appreciated.

查看更多
登录 后发表回答