The VTTRegion interface of the WebVTT API describes a portion of the video to render a VTTCue onto.
VTTRegion()Creates a new VTTRegion object instance.
VTTRegion.idA string that identifies the region.
VTTRegion.widthRepresents the width of the region, as a percentage of the video's width.
VTTRegion.linesRepresents the height of the region, in number of lines.
VTTRegion.regionAnchorXRepresents the region anchor X offset, as a percentage of the region's width.
VTTRegion.regionAnchorYRepresents the region anchor Y offset, as a percentage of the region's height.
VTTRegion.viewportAnchorXRepresents the viewport anchor X offset, as a percentage of the video's width.
VTTRegion.viewportAnchorYRepresents the viewport anchor Y offset, as a percentage of the video's height.
VTTRegion.scrollAn enumerated value indicating how existing cues in the region move when a new cue is added.
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.