new LiveTracker(player, options)
Creates an instance of this class.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
player |
Player |
The |
||||||||||||
options |
Object |
optional
The key/value store of player options.
|
Methods
-
atLiveEdge(){boolean}
-
Determines if currentTime is at the live edge and won't fall behind on each seekableendchange
Returns:
Type Description boolean Whether playback is at the live edge -
behindLiveEdge(){boolean}
-
If we are currently behind the live edge, aka currentTime will be behind on a seekableendchange
Returns:
Type Description boolean If we are behind the live edge -
dispose()
-
Dispose of liveTracker
-
handleDurationchange()
-
handle a durationchange event on the player and start/stop tracking accordingly.
-
handleFirstTimeupdate()
-
handle the first timeupdate on the player if it wasn't already playing when live tracker started tracking.
-
handlePlay()
-
handle the first play on the player, and make sure that we seek right to the live edge.
-
handleSeeked()
-
Keep track of what time a seek starts, and listen for seeked to find where a seek ends.
-
isLive(){boolean}
-
Determines if the player is live, only checks if this component is tracking live playback or not
Returns:
Type Description boolean Whether liveTracker is tracking -
isTracking()
-
Whether live tracker is currently tracking or not.
-
liveCurrentTime(){number}
-
get what we expect the live current time to be
Returns:
Type Description number The expected live current time -
liveWindow(){number}
-
Get the live time window aka the amount of time between seekable start and live current time.
Returns:
Type Description number The amount of seconds that are seekable in the live video. -
nextSeekedFromUser()
-
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}
-
The number of seconds that have occurred after seekable end changed. This will be reset to 0 once seekable end changes.
Returns:
Type Description number Seconds past the current seekable end -
reset_()
-
Stop tracking, and set all internal variables to their initial value.
-
seekableEnd(){number}
-
A helper to get the player seekable end so that we don't have to null check everywhere
Returns:
Type Description number The furthest seekable end or Infinity. -
seekableStart(){number}
-
A helper to get the player seekable start so that we don't have to null check everywhere
Returns:
Type Description number The earliest seekable start or 0. -
seekToLiveEdge()
-
Seek to the live edge if we are behind the live edge
-
startTracking()
-
start tracking live playback
-
stopTracking()
-
stop tracking live playback
-
toggleTracking()
-
start/stop tracking
-
trackLive_()
-
all the functionality for tracking when seek end changes and for tracking how far past seek end we should be