Skip to content

Instantly share code, notes, and snippets.

@Adrian1907
Last active October 17, 2017 07:53
Show Gist options
  • Select an option

  • Save Adrian1907/b99e4cda740ec23626022c344045950a to your computer and use it in GitHub Desktop.

Select an option

Save Adrian1907/b99e4cda740ec23626022c344045950a to your computer and use it in GitHub Desktop.
Youtube iframe video trick
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<iframe allowfullscreen src="https://www.youtube.com/embed/XMD6xBIXSWo" srcdoc="
<style>*::selection{background:none;}body{margin:0;position:absolute;top:0;bottom:0;width:100%;overflow:hidden;}
img{width:100%;height:100%;object-fit:cover;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}svg{position:absolute;top:calc(50% - 24px);left: calc(50% - 34px)}.playfill{fill:#212121;fill-opacity:0.8;transition:.1s cubic-bezier(0.0,0.0,0.2,1);}body:hover .playfill{fill:red;fill-opacity:1;}.gradient-top{width:100%;height:98px;position:absolute;top:0;background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==) repeat-x;}
</style>
<body>
<a href='https://www.youtube.com/embed/XMD6xBIXSWo?autoplay=1'>
<span class='gradient-top'></span>
<img src='https://img.youtube.com/vi/XMD6xBIXSWo/hqdefault.jpg'>
<svg xmlns='http://www.w3.org/2000/svg' width='68px' height='48px' viewBox='0 0 68 48'>
<path class='playfill' d='M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z'/>
<path d='M 45,24 27,14 27,34' fill='white'/>
</svg>
</a>
</body>">
</iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment