Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to disable "Watch on Youtube" link?

Tags:

youtube-api

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).

like image 347
user428900 Avatar asked May 19 '13 19:05

user428900


People also ask

Can you remove watch on YouTube?

You can remove the Watch on YouTube button by removing the video control bar with the controls parameter. Like the modestbranding parameter, the controls parameter needs to be appended to the end of the URL in the HTML code.

How do I hide watch later and share on YouTube?

At this time, however, it is still possible to disable the "Watch Later" and "Share" buttons on the top right of the video player. Simply put, the plugin does it by forcing the no cookie version of YouTube's embedded player to be loaded.


2 Answers

It is possible, just add &modestbranding=1 to your embed code.

Watch this: https://www.youtube.com/watch?v=4NFgV_Et9gY

e.g.

<object width="800" height="450" data="http://www.youtube.com/v/@Model.YoutubeId&rel=0&modestbranding=1"></object>

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.

like image 105
Cătălin Rădoi Avatar answered Oct 01 '22 03:10

Cătălin Rădoi


I found a working solution with no drawbacks:

<iframe
        width="640"
        height="390"
        src="https://www.youtube.com/embed/VgC4b9K-gYU"
        sandbox="allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation">
</iframe>

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.

like image 39
BlakkM9 Avatar answered Oct 01 '22 05:10

BlakkM9