Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to only remove the "watch later" and "share" buttons from youtube iframe embed player

People also ask

Can you embed just part of a YouTube video?

You just have to replace the Video ID, the start time (in seconds), the end time (in seconds), the height of the player (in pixels) and the width in the DIV tag as per your needs.

How do I embed a YouTube video without branding on YouTube?

You can add ? modestbranding=1 to your url. That will remove the logo. This parameter lets you use a YouTube player that does not show a YouTube logo.


Using YouTube embed's privacy-enhanced mode (youtube-nocookie), it will hide "Watch later" button, but not "Share" button.

<iframe width="854" height="480" src="https://www.youtube-nocookie.com/embed/cPVgwz5aN1o" frameborder="0" allowfullscreen></iframe>

This parameter is deprecated and will be ignored after September 25, 2018.

showinfo=0 it's not support anymore


As an example, this is what you're trying to do:

document.getElementsByTagName('iframe')[0].contentWindow.getElementsByClassName('ytp-watch-later-button')[0].style.display = 'none';

But, short answer, there is no simple way to do this, because YouTube is on a different domain:

'Not possible from client side . A javascript error will be raised "Error: Permission denied to access property "document"" since the Iframe is not part of your domaine...' https://stackoverflow.com/a/30545122/2488877

Though, you might find an answer suitable to your needs if you're tech-savvy in the answers to the question above.


Add this line after link

https://www.youtube.com/embed/c5cHjtspa7M?mode=opaque&amp;rel=0&amp;autohide=1&amp;showinfo=0&amp;wmode=transparent

It will disable the share and watch later option


I don't think it is possible with the iframe method. My reasons for thinking that is:

  • It is not an option listed on their parameters page
  • I found this thread where a member of their team said it was not possible at the time (2012), and they had no plans to add the ability.

You could probably achieve something similar by turning showinfo off, and using the other methods to grab the video title.