MDN self-hosted library · e01.org
VTTRegion / notebook

VTTRegion

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const region = new VTTRegion();
region.width = 50; // Set the region to 50% of the video's width
region.lines = 4; // Render cues in 4 lines
region.viewportAnchorX = 25; // Place the region 25% from the left edge of the video
const cue = new VTTCue(2, 3, "Cool text to be displayed");
cue.region = region; // This cue will be drawn only within this region.