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 )
Here is a Quick solution:
What it does it, it looks for the iframe in your document. If it finds iframe, it grabs the src of the iframe, finds the
?
mark and then replaces?
by?rel=0&
. Here the goal is to outrel=0
No need to code through the API,now its easily can be done by
You tube embed button -> Show more -> tickout the option 'Show suggested videos when the video finishes'
The accepted solution was not working for me. What does work is:
1) Putting the iframe in html that includes the rel parameter
2) Using the javascript API to attach to that existing player
demo fiddle: http://jsfiddle.net/bf7zQ/195/
If you're using SWFObject, you simply need to do something like this:
Just add
rel=0
to the end of your url."rel" is a player parameter, as specified here:
https://developers.google.com/youtube/player_parameters#rel
To add player parameters to iframe players, you need to specify the playerVars property of the second constructor argument (at the time of writing this is documented here, and on the IFrame API documentation page)
e.g.
The behavior of the rel player parameter has changed.
From documentation,
So, it's no longer possible to disable related videos. Instead
playerVars: {rel:0}
will change the behavior of the player and shows suggestion from specified channel.