I am building an app where I am embedding videos and specific sections of video clips. For example, it looks like this
<iframe width="640" height="360" src="https://www.youtube.com/embed/pftnJbQjSBA&modestbranding=1&showinfo=0&autoplay=1&controls=0&modestbranding=1&disablekb=1&rel=0&start=10&end=20" frameborder="0"></iframe>
Is it possible to disable "Watch on youtube" link so the user doesn't end up navigating elsewhere. Just to be clear, I only want to control the flow while the video is being watched (i.e not trying to interfere with ads or YouTube logo).
It is possible, just add
&modestbranding=1
to your embed code.Watch this: https://www.youtube.com/watch?v=4NFgV_Et9gY
e.g.
Note that a small YouTube text label will still display in the upper-right corner of a paused video when the user's mouse pointer hovers over the player.
Learn more about YouTube's iFrame Player API.
Using
controls=0
you can disable the whole control bar. Usingautohide=1
the control bar will automatically hide after the video starts.I don't think there is an option to just disable the "Watch on YT" link. But you could disable the whole control bar and add the required control buttons yourself.
I found a working solution with no drawbacks:
the key is the sandbox attribute. You just need to restrict popups and now the video just stops when you click on the youtube logo.
It is not possible to remove
Watch on Youtube
link on control bar. But after you hiding control bar usingcontrols=0
you can usemodestbranding=1
to remove the Youtube watermark and link on bottom right corner.But still you have a link with the video title on the top of the video. Might be in auto hide state. If you want to remove that use
showinfo=0
. But after doing this the Youtube watermark and link on the bottom right corner will appear.You can't hide that link by default. However using flash parameters you can disable the link from navigating away. Use
allownetworking="internal"
. But be aware that it will disable every link facilities of the player.Tutorial and demo: http://www.techtweaker.com/disable-links-on-embedded-youtube-video-code-hack/