-
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. |
- Implementations:
- Source:
Returns:
-
Type
-
Promise
-
-
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. |
- Implementations:
- Source:
Example
videoSouce.configure({'streamBufferSize': 20});
-
destroy()
-
Destroys the video source.
- Implementations:
- Source:
-
enableTextTrack(enabled)
-
Enable or disable the text track.
Has no effect if called before load() resolves.
Parameters:
Name |
Type |
Description |
enabled |
boolean
|
|
- Implementations:
- Source:
-
-
Gets the available audio tracks.
- Implementations:
- 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.
- Implementations:
- Source:
Returns:
The buffering goal.
-
Type
-
number
-
-
Get a list of configurations supported by the video source.
Should not be called before load() resolves.
- Implementations:
- Source:
Returns:
A non-empty array.
-
Type
-
Array.<!shaka.media.StreamConfig>
-
getSessionIds() → (non-null) {Array.<string>}
-
Gets the available session IDs.
- Implementations:
- Source:
Returns:
-
Type
-
Array.<string>
-
-
Gets the available text tracks.
- Implementations:
- Source:
Returns:
-
Type
-
Array.<!shaka.player.TextTrack>
-
-
Gets the available video tracks.
- Implementations:
- Source:
Returns:
-
Type
-
Array.<!shaka.player.VideoTrack>
-
isLive() → {boolean}
-
Determines if the stream is live.
Should not be called before load() resolves.
- Implementations:
- Source:
Returns:
True if the stream is live.
-
Type
-
boolean
-
isOffline() → {boolean}
-
Determines if the stream is used for offline playback.
- Implementations:
- 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.
- Implementations:
- 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. |
- Implementations:
- 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. |
- Implementations:
- 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:
- Implementations:
- 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. |
- Implementations:
- 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. |
- Implementations:
- 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>
|
|
- Implementations:
- Source: