Add a visibility observer to monitor the player.Signature:
addObserver(step: number, callback: VisibilityObserverCallback): VisibilityObserver;
|step||The step between every threshold. This number is in the range of ]0, 1].|
|callback||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.