So far, I tried a few combinations. I found a way to hide all the links to YouTube, and the Share link.
You might want to play around with the width and height values, to suit your video. But if you change them, you'll have to check for the links around the edges, because if you are off a little, the Share link might be clickable for 1px at the edge or something.
<div style="height:351px; width:625px; overflow: hidden;">
<iframe height="351" width="625"
src="https://www.youtube.com/embed/XXXXXXXX?theme=dark&autoplay=1&keyboard=1&autohide=2&cc_load_policy=1&modestbranding=1&fs=0&showinfo=0&rel=0&iv_load_policy=3&mute=0&loop=0"
sandbox="allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation"
style="height:471px; background:#000000; bottom: 61px; position: relative;"
frameborder="0">
</iframe>
</div>
I used the Youtube Embed Code Generator, and combined that with the code here: How To Disable YouTube Title Links From Embedded Videos.
- The
sandbox
attribute prevents clicking the YouTube links from working.
- Using
autoplay=1
in the URL prevents the "Watch on YouTube" link from showing.
- If you don't actually want the video to autoplay, JS can be added that stops the video playback after it loads. Something like this Disable HTML5 autoplay browser extension. This worked to both hide the link and stop autoplay.
- The
style
attribute hides the "top bar" links/channel and Share buttons. If you don't care about that, you don't need it. Clicking the Share buttons can provide a way for users to navigate elsewhere, though.
- The
style
attribute also, in this example, hides the controls at the bottom. To show the controls, use style="height:400px;
instead. However, this will leave a black bar along the bottom of the video, and cut off the top of the video.