Constructor
new HttpVideoSource(mediaUrl, textUrl, drmInfoConfig)
Creates an HttpVideoSource.
Parameters:
Name | Type | Description |
---|---|---|
mediaUrl |
string | The media URL. |
textUrl |
string | The text URL, or empty string if no subtitles. |
drmInfoConfig |
shaka.player.DrmInfo.Config | A DrmInfo Config object, an empty object indicates unencrypted content. |
- Implements:
- Extends:
- Source:
Members
-
(private) drmInfo_ :shaka.player.DrmInfo
-
Type:
- Source:
-
(private, non-null) listeners_ :shaka.util.MultiMap.<shaka.util.FakeEventTarget.ListenerType>
-
Type:
- Inherited From:
- Source:
-
(private) mediaUrl_ :string
-
Type:
- string
- Source:
-
(protected) parent :shaka.util.FakeEventTarget
-
Type:
- Inherited From:
- Source:
-
(private) textTrack_ :HTMLTrackElement
-
Type:
- HTMLTrackElement
- Source:
-
(private) textUrl_ :string
-
Type:
- string
- Source:
Methods
-
addEventListener(type, listener, opt_capturingopt)
-
Add an event listener to this object.
Parameters:
Name Type Attributes Description type
string The event type to listen for. listener
shaka.util.FakeEventTarget.ListenerType The callback or listener object to invoke. opt_capturing
boolean <optional>
True to listen during the capturing phase, false to listen during the bubbling phase. Note that FakeEventTarget does not support the capturing phase from the standard event model. - Inherited From:
- Source:
-
attach(player, videonon-null) → (non-null) {Promise}
-
Attaches the video source to the specified video element. This allows the Player to avoid setting the video's |src| attribute until it is ready. Should not be called until load() has been resolved. Should only be called once.
Parameters:
Name Type Description player
shaka.player.Player The associated Player, which may be used for event bubbling and stats. video
HTMLVideoElement The video element. - Implements:
- Source:
Returns:
- Type
- Promise
-
configure(confignon-null)
-
Configures the VideoSource options. Options are set via key-value pairs.
Parameters:
Name Type Description config
Object.<string, *> A configuration object, which contains the configuration options as key-value pairs. All fields should have already been validated. - Implements:
- Source:
-
destroy()
-
Destroys the video source.
- Implements:
- Source:
-
dispatchEvent(eventnon-null) → {boolean}
-
Dispatch an event from this object.
Parameters:
Name Type Description event
Event The event to be dispatched from this object. - Inherited From:
- Source:
Returns:
True if the default action was prevented.- Type
- boolean
-
enableTextTrack(enabled)
-
Enable or disable the text track. Has no effect if called before load() resolves.
Parameters:
Name Type Description enabled
boolean - Implements:
- Source:
-
getAudioTracks() → (non-null) {Array.<!shaka.player.AudioTrack>}
-
Gets the available audio tracks.
- Implements:
- Source:
Returns:
- Type
- Array.<!shaka.player.AudioTrack>
-
getBufferingGoal() → {number}
-
Gets the video source's buffering goal, which is the amount of content, in seconds, that the video source requires to be buffered for smooth playback.
- Implements:
- Source:
Returns:
The buffering goal.- Type
- number
-
getConfigurations() → (non-null) {Array.<!shaka.media.StreamConfig>}
-
Get a list of configurations supported by the video source. Should not be called before load() resolves.
- Implements:
- Source:
Returns:
A non-empty array.- Type
- Array.<!shaka.media.StreamConfig>
-
getSessionIds() → (non-null) {Array.<string>}
-
Gets the available session IDs.
- Implements:
- Source:
Returns:
- Type
- Array.<string>
-
getTextTracks() → (non-null) {Array.<!shaka.player.TextTrack>}
-
Gets the available text tracks.
- Implements:
- Source:
Returns:
- Type
- Array.<!shaka.player.TextTrack>
-
getVideoTracks() → (non-null) {Array.<!shaka.player.VideoTrack>}
-
Gets the available video tracks.
- Implements:
- Source:
Returns:
- Type
- Array.<!shaka.player.VideoTrack>
-
isLive() → {boolean}
-
Determines if the stream is live. Should not be called before load() resolves.
- Implements:
- Source:
Returns:
True if the stream is live.- Type
- boolean
-
isOffline() → {boolean}
-
Determines if the stream is used for offline playback.
- Implements:
- Source:
Returns:
True if the stream is stored or being stored.- Type
- boolean
-
load() → (non-null) {Promise}
-
Load any intermediate source material (manifest, etc.) Should only be called once.
- Implements:
- Source:
Returns:
- Type
- Promise
-
onKeyStatusesChange(keyStatusByKeyIdnon-null)
-
Notifies the video source that one or more content encryption keys have changed their status.
Parameters:
Name Type Description keyStatusByKeyId
Object.<string, string> A map from key ID, as a hex string, to key status. Each key status is a MediaKeyStatus value. - Implements:
- Source:
-
(private) recursiveDispatch_(eventnon-null) → {boolean}
-
Dispatches an event recursively without changing its original target.
Parameters:
Name Type Description event
Event - Inherited From:
- Source:
Returns:
True if the default action was prevented.- Type
- boolean
-
removeEventListener(type, listener, opt_capturingopt)
-
Remove an event listener from this object.
Parameters:
Name Type Attributes Description type
string The event type for which you wish to remove a listener. listener
shaka.util.FakeEventTarget.ListenerType The callback or listener object to remove. opt_capturing
boolean <optional>
True to remove a listener for the capturing phase, false to remove a listener for the bubbling phase. Note that FakeEventTarget does not support the capturing phase from the standard event model. - Inherited From:
- Source:
-
selectAudioTrack(id, clearBuffer, opt_clearBufferOffsetopt) → {boolean}
-
Select an audio track by ID.
Parameters:
Name Type Attributes Description id
number The |id| field of the desired AudioTrack object. clearBuffer
boolean If true, removes the previous stream's content before switching to the new stream. opt_clearBufferOffset
number <optional>
if |clearBuffer| and |opt_clearBufferOffset| are truthy, clear the stream buffer from the given offset (relative to the audio's current time) to the end of the stream. - Implements:
- Source:
Returns:
True on success; otherwise, return false if the specified AudioTrack does not exist or if an audio stream does not exist.- Type
- boolean
-
selectConfigurations(configsnon-null)
-
Select the streams to use based on the given configurations. Should not be called before load() resolves. Should not be called after attach() has been resolved.
Parameters:
Name Type Description configs
shaka.util.MultiMap.<!shaka.media.StreamConfig> The keys are content types, such as 'audio', 'video', or 'text'. The implementation may ignore the keys if they are not helpful. - Implements:
- Source:
-
selectTextTrack(id, clearBuffer) → {boolean}
-
Select a text track by ID.
Parameters:
Name Type Description id
number The |id| field of the desired TextTrack object. clearBuffer
boolean If true, removes the previous stream's content before switching to the new stream. - Implements:
- Source:
Returns:
True on success; otherwise, return false if the specified TextTrack does not exist or if a text stream does not exist.- Type
- boolean
-
selectVideoTrack(id, clearBuffer, opt_clearBufferOffsetopt) → {boolean}
-
Select a video track by ID.
Parameters:
Name Type Attributes Description id
number The |id| field of the desired VideoTrack object. clearBuffer
boolean If true, removes the previous stream's content before switching to the new stream. opt_clearBufferOffset
number <optional>
if |clearBuffer| and |opt_clearBufferOffset| are truthy, clear the stream buffer from the given offset (relative to the video's current time) to the end of the stream. - Implements:
- Source:
Returns:
True on success; otherwise, return false if the specified VideoTrack does not exist or if a video stream does not exist.- Type
- boolean
-
setPlaybackStartTime(startTimenullable)
-
Sets the desired time (in seconds) to begin playback from.
Parameters:
Name Type Attributes Description startTime
number <nullable>
- Implements:
- Source: