Here’s a self-contained JavaScript bookmarklet that will toggle a live, blurred “ambient fill” behind any YouTube video—whether in the small player, theater mode, or native fullscreen.
How it works:
- Grabs the
<video> element on the page
- Creates a full-window
<canvas> behind it
- Every frame, draws the video scaled up to cover the whole window, with a heavy
ctx.filter = 'blur(40px)' to smooth out the edges
- Listens for resize + fullscreen changes so that your blur canvas always follows the video (even in true fullscreen)
- On second click it cleans up completely, restoring the page
1. Source Code (readable)
// Wrap everything in an IIFE so we don’t leak variables
;(function(){
// If already running, destroy and exit
if(window.__ambGlow){
window.__ambGlow.destroy();
return;
}
// Find the YouTube video element
const video = document.querySelector('video');
if(!video){ alert('No found on this page!'); return; }
// Create our full-screen canvas
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
Object.assign(canvas.style, {
position: 'fixed',
top: '0',
left: '0',
width: '100%',
height: '100%',
zIndex: '9998',
pointerEvents: 'none'
});
document.body.appendChild(canvas);
// Keep canvas sized to the window
function onResize(){
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', onResize);
onResize();
// Main draw loop
let rafID;
function drawFrame(){
if(video.videoWidth && video.videoHeight){
const vw = video.videoWidth;
const vh = video.videoHeight;
// Scale so it covers the entire canvas (and a bit extra for better feathering)
const scale = Math.max(canvas.width/vw, canvas.height/vh) * 1.2;
ctx.filter = 'blur(40px)';
ctx.clearRect(0,0,canvas.width,canvas.height);
// Center the scaled video so it fills & crops equally
ctx.drawImage(
video,
-(vw*scale - canvas.width)/2,
-(vh*scale - canvas.height)/2,
vw*scale,
vh*scale
);
}
rafID = requestAnimationFrame(drawFrame);
}
drawFrame();
// Handle native fullscreen: move the canvas into the fullscreen element
function onFullScreenChange(){
const fsEl = document.fullscreenElement;
if(fsEl) fsEl.appendChild(canvas);
else document.body.appendChild(canvas);
}
document.addEventListener('fullscreenchange', onFullScreenChange);
// Expose a destroy method so we can toggle off
window.__ambGlow = {
destroy(){
cancelAnimationFrame(rafID);
window.removeEventListener('resize', onResize);
document.removeEventListener('fullscreenchange', onFullScreenChange);
canvas.remove();
delete window.__ambGlow;
}
};
})();
2. Minified Bookmarklet
- Create a new bookmark in your browser.
- As the URL, paste the following single line:
javascript:(function(){if(window.__ambGlow){window.__ambGlow.destroy();return;}const video=document.querySelector('video');if(!video){alert('No <video> found on this page!');return;}const canvas=document.createElement('canvas'),ctx=canvas.getContext('2d');Object.assign(canvas.style,{position:'fixed',top:'0',left:'0',width:'100%',height:'100%',zIndex:'9998',pointerEvents:'none'});document.body.appendChild(canvas);function onResize(){canvas.width=window.innerWidth;canvas.height=window.innerHeight;}window.addEventListener('resize',onResize);onResize();let rafID;function drawFrame(){if(video.videoWidth&&video.videoHeight){const vw=video.videoWidth,vh=video.videoHeight,scale=Math.max(canvas.width/vw,canvas.height/vh)*1.2;ctx.filter='blur(40px)';ctx.clearRect(0,0,canvas.width,canvas.height);ctx.drawImage(video,-(vw*scale-canvas.width)/2,-(vh*scale-canvas.height)/2,vw*scale,vh*scale);}rafID=requestAnimationFrame(drawFrame);}drawFrame();function onFullScreenChange(){const fsEl=document.fullscreenElement;if(fsEl)fsEl.appendChild(canvas);else document.body.appendChild(canvas);}document.addEventListener('fullscreenchange',onFullScreenChange);window.__ambGlow={destroy:function(){cancelAnimationFrame(rafID);window.removeEventListener('resize',onResize);document.removeEventListener('fullscreenchange',onFullScreenChange);canvas.remove();delete window.__ambGlow;}};})();
3. Usage
- Go to YouTube and start playing any video.
- Click the bookmarklet once → the live ambient blur kicks in.
- Click it again → everything is removed, back to normal.
Enjoy your immersive ultrawide experience—and no more static OLED burn-in risk! 🎥✨