I’m trying to load a video onto my page using Youtube API.
Youtube specifies that you can enable ‘modest branding’ (ie. removing youtube logos) by appending the parameter ‘&modestbranding=1’ to the embed url.
The problem I’m having is that the new youtube API embeds the video using javascript eg:
player = new YT.Player('player', {
height: videoHeight,
width: videoWidth,
videoId: videoID,
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
This then generates the relevant iframe script, however I’d like to be able to specify modest branding within these parameters. I tried adding an extra parameter:
modestbranding: 1
and
modestbranding: '1'
but neither seems to have any effect.
I realise that one option would be to grab the embed url from the final rendered script and then append the parameter onto the src:
<iframe frameborder="0" allowfullscreen="" id="player" title="YouTube video player" height="368" width="640" src="http://www.youtube.com/embed/<id>?enablejsapi=1"></iframe>
However I would’ve thought youtube would somehow allow to specify the parameter rather than having to use some dirty hack.
Anyone know how I can do this?
modestbrandingis a player var and thus should be added with the `playerVars’ attribute. Details can be found on the developer docs.https://developers.google.com/youtube/iframe_api_reference
Here’s an example on how to include
modestedbrandingor other player vars.