Class: shaka.media.MediaSourcePlayhead

Constructor

new MediaSourcePlayhead(mediaElementnon-null, manifest, config, startTimenullable, onSeek)

Parameters:
Name Type Attributes Description
mediaElement HTMLMediaElement
manifest shaka.extern.Manifest
config shaka.extern.StreamingConfiguration
startTime number <nullable>
The playhead's initial position in seconds. If null, defaults to the start of the presentation for VOD and the live-edge for live.
onSeek function Called when the user agent seeks to a time within the presentation timeline.
Implements:
Source:

Members

lastCorrectiveSeek_ :number

Type:
  • number
Source:

minBufferTime_ :number

Type:
  • number
Source:

minSeekRange_ :number

The seek range must be at least this number of seconds long. If it is smaller than this, change it to be this big so we don't repeatedly seek to keep within a zero-width window. This is 3s long, to account for the weaker hardware on platforms like Chromecast.
Type:
  • number
Source:

onSeek_ :function()

Type:
  • function()
Source:

Methods

clampSeekToDuration_(time) → {number}

Clamp seek times and playback start times so that we never seek to the presentation duration. Seeking to or starting at duration does not work consistently across browsers.
Parameters:
Name Type Description
time number
Source:
See:
Returns:
The adjusted seek time.
Type
number

clampTime_(time) → {number}

Clamps the given time to the seek range.
Parameters:
Name Type Description
time number The time in seconds.
Source:
Returns:
The clamped time in seconds.
Type
number

createStallDetector_(mediaElementnon-null, config) → {shaka.media.StallDetector}

Create and configure a stall detector using the player's streaming configuration settings. If the player is configured to have no stall detector, this will return |null|.
Parameters:
Name Type Description
mediaElement HTMLMediaElement
config shaka.extern.StreamingConfiguration
Source:
Returns:
Type
shaka.media.StallDetector

getStartTime_(startTimenullable) → {number}

Gets the playhead's initial position in seconds.
Parameters:
Name Type Attributes Description
startTime number <nullable>
Source:
Returns:
Type
number

getTime() → {number}

Get the current playhead position. The position will be restricted to valid time ranges.
Implements:
Source:
Returns:
Type
number

notifyOfBufferingChange()

Notify the playhead that the buffered ranges have changed.
Implements:
Source:

onPollWindow_()

Called on a recurring timer to keep the playhead from falling outside the availability window.
Source:

onSeeking_()

Handles when a seek happens on the video.
Source:

release()

Request that this object release all internal references.
Inherited From:
Implements:
Source:

reposition_(currentTime) → {number}

Computes a new playhead position that's within the presentation timeline.
Parameters:
Name Type Description
currentTime number
Source:
Returns:
The time to reposition the playhead to.
Type
number

setStartTime(startTime)

Set the start time. If the content has already started playback, this will be ignored.
Parameters:
Name Type Description
startTime number
Implements:
Source: