const element = document.querySelector('.yt-iframe-mask');
// Cover the iframe completely
element.style.position = 'absolute';
element.style.inset = 0;
// Optional, so the effect is visible. Remove.
element.style.background = 'rgba(0, 127, 0, .5)';
const width = element.clientWidth;
const height = element.clientHeight;
// The holes for the Play Button and other UI elements (winding ↩️)
const holes = [
getRectangleHole(0, 0, 290, 60), // Video Title
getRectangleHole(470, 5, 80, 60), // Copy link
getRectangleHole(240, 130, 80, 55), // Play Button
getRectangleHole(420, 263, 140, 47), // Watch on YT/play bar
]
// The actual SVG that contains the holes (winding ↪️)
const path = `M 0 0 v${height} h${width} V0 H0 ${holes.join(' ')} Z`;
// Punch the hole
element.style.clipPath = `path('${path}')`;
// Returns a rectangle path at x, y with width w and height h. Wound clockwise (↩️).
function getRectangleHole(x, y, w, h) {
return `M ${x} ${y} h${w} v${h} h${-w} v${-h}`
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.