Readonly
ratioThe ratio of pixels of the player that are within the viewport.
Readonly
visibleWhether the Visibility.ratio of visible pixels is exceeded.
The threshold that the ratio must exceed for the player to be visible.
- This number is in the range of [0, 1].
Add a visibility observer to monitor the player.
The step between every threshold. This number is in the range of ]0, 1].
The callback to be triggered every time a threshold is crossed.
A new visibility observer.
- The callback is triggered every time the ratio of visible pixels crosses a threshold, and receives the ratio of visible pixels as first argument.
- The list of thresholds is evenly distributed between 0 and 1, with the distance between every two consecutive thresholds determined by the given step.
Remove a visibility observer.
The observer will stop monitoring player visibility, and will no longer trigger its callback.
The observer to remove.
The visibility API.