VTTRegion: viewportAnchorY property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Want more support for this feature? Tell us why.

The viewportAnchorY property of the VTTRegion interface represents the y-coordinate of the viewport anchor, as a percentage of the video's height.

Value

A number, in the range 0 to 100 inclusive, representing the y-coordinate of the viewport anchor as a percentage of the video's height. The default is 100.

Exceptions

IndexSizeError DOMException

Thrown when set to a value that is negative or greater than 100.

Examples

In the following example, a new VTTRegion is created, then the value of viewportAnchorY is set to 75. The value is then printed to the console.

js
const region = new VTTRegion();
region.viewportAnchorY = 75; // Place the region 75% from the top edge of the video
console.log(region.viewportAnchorY);

Specifications

Specification
WebVTT: The Web Video Text Tracks Format
# dom-vttregion-viewportanchory

Browser compatibility