web api instance property
VTTRegion: viewportAnchorX property
The viewportAnchorX property of the VTTRegion interface represents the x-coordinate of the viewport anchor, as a percentage of the video’s width.
Value
A number, in the range 0 to 100 inclusive, representing the x-coordinate of the viewport anchor as a percentage of the video’s width. The default is 0.
Exceptions
IndexSizeErrorDOMException- : Thrown when set to a value that is negative or greater than
100.
- : Thrown when set to a value that is negative or greater than
Examples
In the following example, a new VTTRegion is created, then the value of viewportAnchorX is set to 25. The value is then printed to the console.
const region = new VTTRegion();
region.viewportAnchorX = 25; // Place the region 25% from the left edge of the video
console.log(region.viewportAnchorX);
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.