- new LiveTracker(player, optionsopt)
- Methods
- atLiveEdge() → {boolean}
- behindLiveEdge() → {boolean}
- dispose()
- handleDurationchange()
- handleFirstTimeupdate()
- handlePlay()
- handleSeeked()
- handleVisibilityChange()
- isLive() → {boolean}
- isTracking()
- liveCurrentTime() → {number}
- liveWindow() → {number}
- nextSeekedFromUser()
- pastSeekEnd() → {number}
- reset_()
- seekableEnd() → {number}
- seekableStart() → {number}
- seekToLiveEdge()
- startTracking()
- stopTracking()
- toggleTracking()
- trackLive_()
new LiveTracker(player, optionsopt)
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 20](https://docs.videojs.com/live-tracker.js.html#line20)
Creates an instance of this class.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
player | Player | The | ||||||||||||||||
options | Object | <optional> | The key/value store of player options. Properties
|
Methods
atLiveEdge() → {boolean}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 330](https://docs.videojs.com/live-tracker.js.html#line330)
Determines if currentTime is at the live edge and won’t fall behind on each seekableendchange
Returns:
boolean -
Wether playback is at the live edge
behindLiveEdge() → {boolean}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 368](https://docs.videojs.com/live-tracker.js.html#line368)
If we are currently behind the live edge, aka currentTime will be behind on a seekableendchange
Returns:
boolean -
If we are behind the live edge
dispose()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 395](https://docs.videojs.com/live-tracker.js.html#line395)
Dispose of liveTracker
handleDurationchange()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 131](https://docs.videojs.com/live-tracker.js.html#line131)
handle a durationchange event on the player and start/stop tracking accordingly.
handleFirstTimeupdate()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 182](https://docs.videojs.com/live-tracker.js.html#line182)
handle the first timeupdate on the player if it wasn’t already playing when live tracker started tracking.
handlePlay()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 203](https://docs.videojs.com/live-tracker.js.html#line203)
handle the first play on the player, and make sure that we seek right to the live edge.
handleSeeked()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 191](https://docs.videojs.com/live-tracker.js.html#line191)
Keep track of what time a seek starts, and listen for seeked to find where a seek ends.
handleVisibilityChange()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 72](https://docs.videojs.com/live-tracker.js.html#line72)
toggle tracking based on document visiblility
isLive() → {boolean}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 319](https://docs.videojs.com/live-tracker.js.html#line319)
Determines if the player is live, only checks if this component is tracking live playback or not
Returns:
boolean -
Wether liveTracker is tracking
isTracking()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 375](https://docs.videojs.com/live-tracker.js.html#line375)
Wether live tracker is currently tracking or not.
liveCurrentTime() → {number}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 340](https://docs.videojs.com/live-tracker.js.html#line340)
get what we expect the live current time to be
Returns:
number -
The expected live current time
liveWindow() → {number}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 301](https://docs.videojs.com/live-tracker.js.html#line301)
Get the live time window aka the amount of time between seekable start and live current time.
Returns:
number -
The amount of seconds that are seekable in the live video.
nextSeekedFromUser()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 235](https://docs.videojs.com/live-tracker.js.html#line235)
The next seeked event is from the user. Meaning that any seek
2s behind live will be considered behind live for real and liveTolerance will be ignored.
pastSeekEnd() → {number}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 351](https://docs.videojs.com/live-tracker.js.html#line351)
The number of seconds that have occured after seekable end changed. This will be reset to 0 once seekable end changes.
Returns:
number -
Seconds past the current seekable end
reset_()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 211](https://docs.videojs.com/live-tracker.js.html#line211)
Stop tracking, and set all internal variables to their initial value.
seekableEnd() → {number}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 257](https://docs.videojs.com/live-tracker.js.html#line257)
A helper to get the player seekable end so that we don’t have to null check everywhere
Returns:
number -
The furthest seekable end or Infinity.
seekableStart() → {number}
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 278](https://docs.videojs.com/live-tracker.js.html#line278)
A helper to get the player seekable start so that we don’t have to null check everywhere
Returns:
number -
The earliest seekable start or 0.
seekToLiveEdge()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 382](https://docs.videojs.com/live-tracker.js.html#line382)
Seek to the live edge if we are behind the live edge
startTracking()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 153](https://docs.videojs.com/live-tracker.js.html#line153)
start tracking live playback
stopTracking()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 242](https://docs.videojs.com/live-tracker.js.html#line242)
stop tracking live playback
toggleTracking()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 138](https://docs.videojs.com/live-tracker.js.html#line138)
start/stop tracking
trackLive_()
[live-tracker.js](https://docs.videojs.com/live-tracker.js.html)
, [line 88](https://docs.videojs.com/live-tracker.js.html#line88)
all the functionality for tracking when seek end changes and for tracking how far past seek end we should be