youtube iframe api parameter rel=0 doesn't work

youtube rel=0 not working 2019
youtube embed hide controls
youtube api stop video
youtube embed hide title 2019
youtube embed autoplay
youtube api playvideo
youtube api seekto
related videos youtube

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.

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 Embedded Players and Player Parameters, YouTube changed the rel=0 parameter as of September 2018 so that it no longer However, you can work around this using the YouTube Player API to show  Follow the IFrame Player API instructions to insert a video player in your web page or application after the Player API's JavaScript code has loaded. The second parameter in the constructor for the video player is an object that specifies player options. Within that object, the playerVars property identifies player parameters.

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:

    #playerWrap {
        display: inline-block;
        position: relative;
    #playerWrap.shown::after {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        cursor: pointer;
        background-color: black;
        background-repeat: no-repeat;
        background-position: center; 
        background-size: 64px 64px;
        background-image: url(data:image/svg+xml;utf8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB2aWV3Qm94PSIwIDAgNTEwIDUxMCI+PHBhdGggZD0iTTI1NSAxMDJWMEwxMjcuNSAxMjcuNSAyNTUgMjU1VjE1M2M4NC4xNSAwIDE1MyA2OC44NSAxNTMgMTUzcy02OC44NSAxNTMtMTUzIDE1My0xNTMtNjguODUtMTUzLTE1M0g1MWMwIDExMi4yIDkxLjggMjA0IDIwNCAyMDRzMjA0LTkxLjggMjA0LTIwNC05MS44LTIwNC0yMDQtMjA0eiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==);
    <div id="playerWrap">
            width="640" height="360"
  var playerFrame = document.currentScript.previousElementSibling.children[0].children[0];

  var tag = document.createElement('script');
  tag.src = "";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  var player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player(playerFrame, {
      videoId: 'M7lc1UVf-VE',
      events: {
        'onStateChange': onPlayerStateChange

  function onPlayerStateChange(event) {
    if ( == YT.PlayerState.ENDED) {

  document.getElementById("playerWrap").addEventListener("click", function() {

For the minified code along with further description, details and instructions, view my blog post on the subject.

How to remove the related videos at end of YouTube embedded , YouTube changes option for embedding without related videos at the end. I understand that you just add “?rel=0” to the end of the embed code URL and If the parameter's value is set to 0, then the player does not show  Attach parameters to the Youtube iframe URL to modify its behaviour. We can make some changes to an embedded Youtube video's behavior just by attaching parameters to the end of the Youtube URL inside the iframe. The following for example causes the video to automatically play when it's loaded:

If you want to hide related video then you should call "player.stopVideo()" when player state is ended "PlayerState.ENDED".

PS: Sorry, english is not my first language.

Can't Stop YouTube Related Videos, to disable the related videos at the end too. I'm using the IFrame API as the title suggests. I have been following the guide in the API Reference. It works for me however I have found a few warnings that occur and would like to solve them. Th

As stated by Irina Kovalchuk above, as of September 25, 2018, you are not be able to disable related videos.

But I found a workaround:

setInterval(function () {
    if (player.getCurrentTime() >= player.getDuration()-1) {
}, 100);

as soon as video reaches to end move seek pointer to start. It won't give time to show related videos. This workaround is suitable if you want to play video in loop

Youtube ?rel=0 tag no longer working, It is no longer possible to fully disable related videos using rel=0 . The behavior for the rel parameter is changing on or after September 25, 2018. The effect YouTube Player API Release Notes - August 23, 2018. This option Your browser does not currently recognize any of the video formats available. I tried to use the YouTube player demo to generate the code necessary for my video to autoplay and loop itself. But only the autoplay works, it doesn't loop, and the demo-video doesn't work either.

Mine wasn't working because the code spit out from the dev page

was incomplete and missing the closing tag!

How To Hide Related Videos In YouTube Embeds (in 2020 , In doing this, that added a small parameter “rel=0” parameter to the As the embed API of WordPress doesn't currently recognize the use of  The Loading a video player section has been updated to point out that when inserting the <iframe> element that will contain the YouTube player, the IFrame API replaces the element specified in the constructor for the YouTube player. This documentation change does not reflect a change in the API and is intended solely to clarify existing behavior.

How to disable related videos on YouTube embeds (No longer , According to the update, if your YouTube videos are embedded on your To manually insert the rel=0 parameter, first get your embed code from Your browser does not currently recognize any of the video formats available. August 23, 2018. Note: This is a deprecation announcement for the showinfo parameter. In addition, the behavior for the rel parameter is changing. Titles, channel information, and related videos are an important part of YouTube’s core user experience, and these changes help to make the YouTube viewing experience consistent across different platforms.

This YouTube Update Could Be Affecting Your Embedded Videos!, This means that people using YouTube to embed videos on their website things) won't pop up at the end of your video, as long as you have rel=0 at Instead, if the rel parameter is set to 0 , related videos will come from the  Bei diesem Parameter handelt es sich um eine zusätzliche Sicherheitsmaßnahme für die IFrame API, die nur für IFrame-Einbettungen unterstützt wird. Wenn du die IFrame API verwendest, indem du den enablejsapi -Parameterwert auf 1 setzt, solltest du immer deine Domain als origin -Parameterwert angeben.

YouTube No Longer Allows You To Turn Off "Related Videos" When , Add ?rel=0 after the video URL in the code and this will remove the sugeested ads. For example: <iframe width  Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

  • Appears it is "changing" to only control whether related videos are from the same site or not. Weird.
  • @caneta I've given the link on YouTube API in my answer.
  • Sorry @IrinaKovalchuk, my Chrome browser took my italian locale and automatically show me the italian page which is not updated...forcing the browser to english (chrome://settings/languages), I could see the updated documentation and the sentence "Note: This parameter is deprecated and will be ignored after September 25, 2018." showed up.
  • should it be or ? the former does not work for me.
  • I am unable to get this to work with enhanced privacy mode:
  • I've just check it in google chrome (Version 63.0.3239.132 (Official Build) (64-bit)) and related videos are shown. Take a look at the screenshot
  • @Viktor Here is what I got with Google Chrome Play finished, Google Chrome Version 63.0.3239.132 (Official Build) (64-bit) Exactly the same as yours.
  • I noticed that related videos are shown when i'm signed in YouTube account. So rel=0 doesn't work for google chrome and mozilla firefox when i'm signed in. If I signed out no related videos is shown on finishing. So another question. How i can hide related videos for signed in users.