Created
May 5, 2023 15:58
-
-
Save ThaUnknown/a6c32192c25f8596ab33dc28cd44fb13 to your computer and use it in GitHub Desktop.
Desynchronized canvas rendering under video element when no DOM updates are happening
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<meta http-equiv='X-UA-Compatible' content='IE=edge'> | |
<title>Page Title</title> | |
<meta name='viewport' content='width=device-width, initial-scale=1'> | |
<style> | |
canvas { | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
</style> | |
<script type="module" defer> | |
const ctx = canvas.getContext('2d', { desynchronized: true }) | |
ctx.fillStyle = '#f00' | |
ctx.fillRect(0, 0, 100, 100) | |
</script> | |
</head> | |
<body> | |
<video src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4#t=100" controls id="video"></video> | |
<canvas id="canvas" width="100" height="100"></canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment