I need to hide related videos after watching the video. I set rel=0
, but it is not working. I am using this page for testing. The rel
checkbox value doesn't affect on shown related videos after watching video.
It doesn't work in google chrome. In mozilla firefox it properly works.
Checked this both with Chrome and Opera, it works.
https://jsfiddle.net/o8ztczn6/
No related video is shown on finishing.
This is because you are most likely signed in on your Chrome browser, but not your Firefox browser.
&rel=0
only works when not signed in. However, you can get around this by using the enhanced privacy mode:https://www.youtube-nocookie.com/embed/[id]?rel=0
Here i found a Solution. stopVideo on player state changed to ENDING
Here is a fiddle demo: https://jsfiddle.net/Aishan/znabhuo2/ Hope that helps!!
Mine wasn't working because the code spit out from the dev page https://developers.google.com/youtube/youtube_player_demo
was incomplete and missing the closing tag!
As of September 25, 2018, you are not be able to disable related videos. Instead, if the rel parameter is set to 0, related videos will come from the same channel as the video that was just played. YouTube API
YouTube changed the
rel=0
parameter as of September 2018 so that it no longer fully disables related videos.However, you can work around this using the YouTube Player API to show custom HTML instead of related videos.
Here is some example code that displays a custom "replay" button over the video once it completes, hiding the related videos:
For the minified code along with further description, details and instructions, view my blog post on the subject.