Class: shaka.media.VideoWrapper

Constructor

new VideoWrapper(videonon-null, onSeek, startTime)

Creates a new VideoWrapper that manages setting current time and playback rate. This handles seeks before content is loaded and ensuring the video time is set properly. This doesn't handle repositioning within the presentation window.
Parameters:
Name Type Description
video HTMLMediaElement
onSeek function() Called when the video seeks.
startTime number The time to start at.
Implements:
Source:

Members

(private) buffering_ :boolean

Type:
  • boolean
Source:

(private, nullable) onSeek_ :?function()

Type:
  • ?function()
Source:

(private) playbackRate_ :number

Type:
  • number
Source:

(private) startTime_ :number

Type:
  • number
Source:

(private) trickPlayTimer_ :shaka.util.Timer

Type:
Source:

Methods

(export) destroy() → (non-null) {Promise}

Request that this object be destroyed, releasing all resources and shutting down all operations. Returns a Promise which is resolved when destruction is complete. This Promise should never be rejected.
Implements:
Source:
Returns:
Type
Promise

getPlaybackRate() → {number}

Gets the current effective playback rate. This may be negative even if the browser does not directly support rewinding.
Source:
Returns:
Type
number

getTime() → {number}

Gets the video's current (logical) position.
Source:
Returns:
Type
number

(private) movePlayhead_(currentTime, targetTime)

Moves the playhead to the target time, triggering a call to onSeeking_().
Parameters:
Name Type Description
currentTime number
targetTime number
Source:

(private) onLoadedMetadata_()

Handles a 'loadedmetadata' event.
Source:

(private) onRateChange_()

Handles a 'ratechange' event.
Source:

(private) onSeekingToStartTime_()

Handles the 'seeking' event from the initial jump to the start time (if there is one).
Source:

setBuffering(buffering)

Stops the playhead for buffering, or resumes the playhead after buffering.
Parameters:
Name Type Description
buffering boolean True to stop the playhead; false to allow it to continue.
Source:

setPlaybackRate(rate)

Sets the playback rate.
Parameters:
Name Type Description
rate number
Source:

setTime(time)

Sets the current time of the video.
Parameters:
Name Type Description
time number
Source: