Constructor
(export) new Player(videoopt, dependencyInjectoropt)
Construct a Player.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
video |
HTMLMediaElement |
<optional> |
If provided, this is equivalent to calling attach(video, true) immediately after construction. |
dependencyInjector |
function(shaka.Player)= |
<optional> |
Optional callback which is called to inject mocks into the Player. Used for testing. |
- Implements:
- Extends:
- Source:
Extends
Members
(private, static, constant, non-null) restrictedStatuses_ :Array.<string>
These are the EME key statuses that represent restricted playback.
'usable', 'released', 'output-downscaled', 'status-pending' are statuses
of the usable keys. 'expired' status is being handled separately in
DrmEngine.
Type:
- Array.<string>
- Source:
(private, static, non-null) supportPlugins_ :Object.<string, function(): *>
Type:
- Object.<string, function(): *>
- Source:
(export, static, constant) version :string
A version number taken from git at compile time.
Type:
- string
- Source:
(private, non-null) activeStreams_ :shaka.media.ActiveStreamMap
A mapping of which streams are/were active in each period. Used when the
current period (the one containing playhead) differs from the active
period (the one being streamed in by streaming engine).
Type:
- Source:
(private) deferredVariantClearBufferSafeMargin_ :number
Type:
- number
- Source:
dispatchTarget :EventTarget
The target of all dispatched events. Defaults to |this|.
Type:
- EventTarget
- Inherited From:
- Source:
(private, non-null) listeners_ :shaka.util.MultiMap.<shaka.util.FakeEventTarget.ListenerType>
Type:
- Inherited From:
- Source:
(private, non-null) loadingTextStreamIds_ :Array.<number>
Type:
- Array.<number>
- Source:
(private) maxHwRes_ :{width: number, height: number}
Type:
- {width: number, height: number}
- Source:
(private) nextExternalStreamId_ :number
Contains an ID for use with creating streams. The manifest parser should
start with small IDs, so this starts with a large one.
Type:
- number
- Source:
(private, non-null) pendingTimelineRegions_ :Array.<shaka.extern.TimelineRegionInfo>
If regions are added before we have a playhead observer, we need to cache
them until the playhead observer has been created.
Type:
- Array.<shaka.extern.TimelineRegionInfo>
- Source:
(private) textVisibility_ :boolean
Only holds the visibility setting until a textDisplayer_ is created.
Type:
- boolean
- Source:
Methods
(private, static) applyPlayRange_(timeline, playRangeStart, playRangeEnd, isLive)
Applys playRangeStart and playRangeEnd to the given timeline.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
shaka.media.PresentationTimeline | |
playRangeStart |
number | |
playRangeEnd |
number | |
isLive |
boolean |
- Source:
(export, static) isBrowserSupported() → {boolean}
Return whether the browser provides basic support. If this returns false,
Shaka Player cannot be used at all. In this case, do not construct a Player
instance and do not use the library.
- Source:
Returns:
- Type
- boolean
(export, static) probeSupport() → (non-null) {Promise.<shaka.extern.SupportType>}
Probes the browser to determine what features are supported. This makes a
number of requests to EME/MSE/etc which may result in user prompts. This
should only be used for diagnostics.
NOTE: This may show a request to the user for permission.
- Source:
- See:
Returns:
- Type
- Promise.<shaka.extern.SupportType>
(export, static) registerSupportPlugin(name, callback)
Registers a plugin callback that will be called with support(). The
callback will return the value that will be stored in the return value from
support().
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
callback |
function():* |
- Source:
(export) addEventListener(type, listener, optionsopt)
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. | |
options |
AddEventListenerOptions | boolean |
<optional> |
Ignored. |
- Inherited From:
- Source:
(private) addTextStreamToSwitchHistory_(textStream, fromAdaptation)
Parameters:
Name | Type | Description |
---|---|---|
textStream |
shaka.extern.Stream | |
fromAdaptation |
boolean |
- Source:
(export) addTextTrack(uri, language, kind, mime, codecopt, labelopt) → (non-null) {Promise.<shaka.extern.Track>}
Adds the given text track to the current Period. load() must resolve before
calling. The current Period or the presentation must have a duration. This
returns a Promise that will resolve with the track that was created, when
that track can be switched to.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
uri |
string | ||
language |
string | ||
kind |
string | ||
mime |
string | ||
codec |
string |
<optional> |
|
label |
string |
<optional> |
- Source:
Returns:
- Type
- Promise.<shaka.extern.Track>
(private) addVariantToSwitchHistory_(variant, fromAdaptation)
Parameters:
Name | Type | Description |
---|---|---|
variant |
shaka.extern.Variant | |
fromAdaptation |
boolean |
- Source:
(private) adjustStartTime_(time) → {number}
Parameters:
Name | Type | Description |
---|---|---|
time |
number |
- Source:
Returns:
- Type
- number
(private) assertCorrectActiveStreams_()
Verifies that the active streams according to the player match those in
StreamingEngine.
- Source:
(export) attach(videonon-null, initializeMediaSourceopt) → (non-null) {Promise}
Attach the Player to a media element (audio or video tag).
If the Player is already attached to a media element, the previous element
will first be detached.
After calling attach, the media element is owned by the Player and should not
be used for other purposes until detach or destroy() are called.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
video |
HTMLMediaElement | ||
initializeMediaSource |
boolean |
<optional> |
If true, start initializing MediaSource right away. This can improve load() latency for MediaSource-based playbacks. Defaults to true. |
- Source:
Returns:
If initializeMediaSource is false, the Promise is resolved
as soon as the Player has released any previous media element and taken
ownership of the new one. If initializeMediaSource is true, the Promise
resolves after MediaSource has been subsequently initialized on the new
media element.
- Type
- Promise
(private) cancelLoad_() → (non-null) {Promise}
- Source:
Returns:
- Type
- Promise
(private) canSwitch_()
Callback from StreamingEngine, invoked when the period is set up.
- Source:
(private) checkRestrictedVariants_(variantsnon-null)
Checks the given variants and if they are all restricted, throw an
appropriate exception.
Parameters:
Name | Type | Description |
---|---|---|
variants |
Array.<shaka.extern.Variant> |
- Source:
(private) chooseCodecsAndFilterManifest_()
In case of multiple usable codecs, choose one based on lowest average
bandwidth and filter out the rest.
- Source:
(private) chooseStreamsAndSwitch_(periodnon-null)
Chooses streams from the given Period and switches to them.
Called after a config change, a new text stream, a key status event, or an
explicit language change.
Parameters:
Name | Type | Description |
---|---|---|
period |
shaka.extern.Period |
- Source:
(private) chooseVariant_(period, variantsnon-null) → (nullable) {shaka.extern.Variant}
Chooses a variant through the ABR manager.
On error, this dispatches an error event and returns null.
Parameters:
Name | Type | Description |
---|---|---|
period |
shaka.extern.Period | |
variants |
Array.<shaka.extern.Variant> |
- Source:
Returns:
- Type
- shaka.extern.Variant
(private) configOverrides_() → (non-null) {Object}
- Source:
Returns:
- Type
- Object
(export) configure(config, valueopt) → {boolean}
Configure the Player instance.
The config object passed in need not be complete. It will be merged with
the existing Player configuration.
Config keys and types will be checked. If any problems with the config
object are found, errors will be reported through logs and this returns
false. If there are errors, valid config objects are still set.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
string | Object | This should either be a field name or an object following the form of shaka.extern.PlayerConfiguration, where you may omit any field you do not wish to change. | |
value |
* |
<optional> |
This should be provided if the previous parameter was a string field name. |
- Source:
Returns:
True if the passed config object was valid, false if there
were invalid entries.
- Type
- boolean
(private) convertToConfigObject_(fieldName, value) → (non-null) {Object}
Convert config from ('fieldName', value) format to a partial
shaka.extern.PlayerConfiguration object.
E. g. from ('manifest.retryParameters.maxAttempts', 1) to
{ manifest: { retryParameters: { maxAttempts: 1 }}}.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | |
value |
* |
- Source:
Returns:
- Type
- Object
createDrmEngine() → (non-null) {shaka.media.DrmEngine}
Creates a new instance of DrmEngine. This can be replaced by tests to
create fake instances instead.
- Source:
Returns:
createMediaSourceEngine() → (non-null) {shaka.media.MediaSourceEngine}
Creates a new instance of MediaSourceEngine. This can be replaced by tests
to create fake instances instead.
- Source:
Returns:
createNetworkingEngine() → (non-null) {shaka.net.NetworkingEngine}
Creates a new instance of NetworkingEngine. This can be replaced by tests
to create fake instances instead.
- Source:
Returns:
createPlayhead(startTimenullable) → (non-null) {shaka.media.Playhead}
Creates a new instance of Playhead. This can be replaced by tests to create
fake instances instead.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
startTime |
number |
<nullable> |
- Source:
Returns:
- Type
- shaka.media.Playhead
createPlayheadObserver() → (non-null) {shaka.media.PlayheadObserver}
Creates a new instance of PlayheadOvserver. This can be replaced by tests to
create fake instances instead.
- Source:
Returns:
createStreamingEngine() → (non-null) {shaka.media.StreamingEngine}
Creates a new instance of StreamingEngine. This can be replaced by tests
to create fake instances instead.
- Source:
Returns:
(private) defaultStreamingFailureCallback_(errornon-null)
Parameters:
Name | Type | Description |
---|---|---|
error |
shaka.util.Error |
- Source:
(export) destroy() → (non-null) {Promise}
After destruction, a Player object cannot be used again.
- Implements:
- Source:
Returns:
- Type
- Promise
(private) destroyStreaming_() → (non-null) {Promise}
Destroy members responsible for streaming.
- Source:
Returns:
- Type
- Promise
(export) detach() → (non-null) {Promise}
Detaches the Player from the media element (audio or video tag).
After calling detach and waiting for the Promise to be resolved, the media
element is no longer owned by the Player and may be used for other purposes.
- Source:
Returns:
Resolved when the Player has released any previous media
element.
- Type
- Promise
(export) 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
(export) drmInfo() → (nullable) {shaka.extern.DrmInfo}
Get the DrmInfo used to initialize EME. This returns null when not using
EME.
- Source:
Returns:
- Type
- shaka.extern.DrmInfo
(private) filterAllPeriods_(periodsnon-null)
Filters a list of periods.
Parameters:
Name | Type | Description |
---|---|---|
periods |
Array.<!shaka.extern.Period> |
- Source:
(private) filterManifestForAVVariants_()
When there is a variant with video and audio, filter out all variants which
lack one or the other.
This is to avoid problems where we choose audio-only variants because they
have lower bandwidth, when there are variants with video available.
- Source:
(private) filterNewPeriod_(period)
Filters a new period.
Parameters:
Name | Type | Description |
---|---|---|
period |
shaka.extern.Period |
- Source:
(export) getAssetUri() → (nullable) {string}
- Source:
Returns:
If an asset is loaded, returns the asset URI given in
the last call to load(). Otherwise, returns null.
- Type
- string
(export) getAudioLanguages() → (non-null) {Array.<string>}
Return a list of audio languages available for the current Period.
- Source:
Returns:
- Type
- Array.<string>
(export) getAudioLanguagesAndRoles() → (non-null) {Array.<shaka.extern.LanguageRole>}
Return a list of audio language-role combinations available for the current
Period.
- Source:
Returns:
- Type
- Array.<shaka.extern.LanguageRole>
(export) getBufferedInfo() → {shaka.extern.BufferedInfo}
Return the information about the current buffered ranges.
- Source:
Returns:
(export) getConfiguration() → {shaka.extern.PlayerConfiguration}
Return a copy of the current configuration. Modifications of the returned
value will not affect the Player's active configuration. You must call
player.configure() to make changes.
- Source:
Returns:
(export) getExpiration() → {number}
The next known expiration time for any EME session. If the sessions never
expire, or there are no EME sessions, this returns Infinity.
- Source:
Returns:
- Type
- number
(private) getLanguagesAndRoles_(streamsnon-null) → (non-null) {Array.<shaka.extern.LanguageRole>}
Given a list of streams, return a list of language-role combinations
available for them.
Parameters:
Name | Type | Description |
---|---|---|
streams |
Array.<?shaka.extern.Stream> |
- Source:
Returns:
- Type
- Array.<shaka.extern.LanguageRole>
(export) getManifest() → (nullable) {shaka.extern.Manifest}
Return the manifest information if it's loaded. Otherwise, return null.
- Source:
Returns:
(export) getManifestUri() → (nullable) {string}
- Source:
Returns:
If a manifest is loaded, returns the manifest URI given in
the last call to load(). Otherwise, returns null.
- Type
- string
(export) getMediaElement() → {HTMLMediaElement}
- Source:
Returns:
A reference to the HTML Media Element passed
to the constructor or to attach().
- Type
- HTMLMediaElement
(export) getNetworkingEngine() → {shaka.net.NetworkingEngine}
- Source:
Returns:
A reference to the Player's networking
engine. Applications may use this to make requests through Shaka's
networking plugins.
(private) getParser_(assetUri, mimeTypenullable) → (non-null) {Promise.<shaka.extern.ManifestParser>}
Get a parser for the asset located at |assetUri|.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
assetUri |
string | ||
mimeType |
string |
<nullable> |
When not null, the mimeType will be used to find the best manifest parser for the given asset. |
- Source:
Returns:
- Type
- Promise.<shaka.extern.ManifestParser>
(export) getPlaybackRate() → {number}
Gets the current effective playback rate. If using trick play, it will
return the current trick play rate; otherwise, it will return the video
playback rate.
- Source:
Returns:
- Type
- number
(export) getPlayheadTimeAsDate() → {Date}
Returns current playhead time as a Date.
- Source:
Returns:
- Type
- Date
(export) getPresentationStartTimeAsDate() → {Date}
Returns the presentation start time as a Date.
- Source:
Returns:
- Type
- Date
getSharedConfiguration() → {shaka.extern.PlayerConfiguration}
Return a reference to the current configuration. Modifications to the
returned value will affect the Player's active configuration. This method
is not exported as sharing configuration with external objects is not
supported.
- Source:
Returns:
(export) getStats() → {shaka.extern.Stats}
Return playback and adaptation stats.
- Source:
Returns:
- Type
- shaka.extern.Stats
(export) getTextLanguages() → (non-null) {Array.<string>}
Return a list of text languages available for the current Period.
- Source:
Returns:
- Type
- Array.<string>
(export) getTextLanguagesAndRoles() → (non-null) {Array.<shaka.extern.LanguageRole>}
Return a list of text language-role combinations available for the current
Period.
- Source:
Returns:
- Type
- Array.<shaka.extern.LanguageRole>
(export) getTextTracks() → (non-null) {Array.<shaka.extern.Track>}
Return a list of text tracks available for the current
Period. If there are multiple Periods, then you must seek to the Period
before being able to switch.
- Source:
Returns:
- Type
- Array.<shaka.extern.Track>
(export) getVariantTracks() → (non-null) {Array.<shaka.extern.Track>}
Return a list of variant tracks available for the current
Period. If there are multiple Periods, then you must seek to the Period
before being able to switch.
- Source:
Returns:
- Type
- Array.<shaka.extern.Track>
(export) isAudioOnly() → {boolean}
- Source:
Returns:
True for audio-only content. False otherwise.
- Type
- boolean
(export) isBuffering() → {boolean}
- Source:
Returns:
True if the Player is in a buffering state.
- Type
- boolean
(export) isInProgress() → {boolean}
- Source:
Returns:
True if the current stream is in-progress VOD.
False otherwise.
- Type
- boolean
(export) isLive() → {boolean}
- Source:
Returns:
True if the current stream is live. False otherwise.
- Type
- boolean
(export) isTextTrackVisible() → {boolean}
- Source:
Returns:
True if the current text track is visible.
- Type
- boolean
(export) keySystem() → {string}
Get the key system currently being used by EME. This returns the empty
string if not using EME.
- Source:
Returns:
- Type
- string
(export) load(assetUri, startTimeopt, nullable, mimeType) → (non-null) {Promise}
Load a manifest.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
assetUri |
string | ||
startTime |
number |
<optional> <nullable> |
Optional start time, in seconds, to begin playback. Defaults to 0 for VOD and to the live edge for live. Set a positive number to start with a certain offset the beginning. Set a negative number to start with a certain offset from the end. This is intended for use with live streams, to start at a fixed offset from the live edge. |
mimeType |
string | shaka.extern.ManifestParser.Factory | The mime type for the content |manifestUri| points to or a manifest parser factory to override auto-detection or use an unregistered parser. Passing a manifest parser factory is deprecated and will be removed. |
- Source:
Returns:
Resolved when the manifest has been loaded and playback
has begun; rejected when an error occurs or the call was interrupted by
destroy(), unload() or another call to load().
- Type
- Promise
(private) loadManifest_() → (non-null) {Promise.<shaka.extern.Manifest>}
Use the current state of the player and load the asset as a manifest. This
requires that |this.networkingEngine_|, |this.assetUri_|, and |this.parser_|
to have already been set.
- Source:
Returns:
Resolves with the manifest.
- Type
- Promise.<shaka.extern.Manifest>
(private) onAdaptation_() → (non-null) {Promise}
Dispatches an 'adaptation' event.
- Source:
Returns:
- Type
- Promise
(private) onBuffering_(buffering)
Callback from PlayheadObserver.
Parameters:
Name | Type | Description |
---|---|---|
buffering |
boolean |
- Source:
(private) onChooseStreams_(periodnon-null) → {shaka.media.StreamingEngine.ChosenStreams}
Callback from StreamingEngine, invoked when a period starts.
Parameters:
Name | Type | Description |
---|---|---|
period |
shaka.extern.Period |
- Source:
Returns:
An object containing the
chosen variant and text stream.
(private) onEvent_(eventnon-null)
Parameters:
Name | Type | Description |
---|---|---|
event |
Event |
- Source:
(private) onExpirationUpdated_(keyId, expiration)
Callback from DrmEngine
Parameters:
Name | Type | Description |
---|---|---|
keyId |
string | |
expiration |
number |
- Source:
(private) onKeyStatus_(keyStatusMapnon-null)
Parameters:
Name | Type | Description |
---|---|---|
keyStatusMap |
Object.<string, string> | A map of hex key IDs to statuses. |
- Source:
(private) onTextTrackVisibility_()
- Source:
(private) onTracksChanged_() → (non-null) {Promise}
Dispatches a 'trackschanged' event.
- Source:
Returns:
- Type
- Promise
(private) onVideoError_(eventnon-null)
Parameters:
Name | Type | Description |
---|---|---|
event |
Event |
- Source:
(export) removeEventListener(type, listener, optionsopt)
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. | |
options |
EventListenerOptions | boolean |
<optional> |
Ignored. |
- Inherited From:
- Source:
(export) retryStreaming() → {boolean}
Retry streaming after a failure. Does nothing if not in a failure state.
- Source:
Returns:
False if unable to retry.
- Type
- boolean
(export) seekRange() → {{start: number, end: number}}
Get the seekable range for the current stream.
- Source:
Returns:
- Type
- {start: number, end: number}
(export) selectAudioLanguage(language, roleopt)
Sets currentAudioLanguage and currentVariantRole to the selected
language and role, and chooses a new variant if need be.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
language |
string | ||
role |
string |
<optional> |
- Source:
(export) selectEmbeddedTextTrack()
Use the embedded text for the current stream, if present.
CEA 608/708 captions data is embedded inside the video stream.
- Source:
(export) selectTextLanguage(language, roleopt)
Sets currentTextLanguage and currentTextRole to the selected
language and role, and chooses a new text stream if need be.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
language |
string | ||
role |
string |
<optional> |
- Source:
(export) selectTextTrack(track)
Select a specific text track. Note that AdaptationEvents are not
fired for manual track selections.
Parameters:
Name | Type | Description |
---|---|---|
track |
shaka.extern.Track |
- Source:
(export) selectVariantTrack(track, clearBufferopt, safeMarginopt)
Select a specific track. Note that AdaptationEvents are not fired for manual
track selections.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
track |
shaka.extern.Track | ||
clearBuffer |
boolean |
<optional> |
|
safeMargin |
number |
<optional> |
Optional amount of buffer (in seconds) to retain when clearing the buffer. Useful for switching variant quickly without causing a buffering event. Defaults to 0 if not provided. Ignored if clearBuffer is false. Can cause hiccups on some browsers if chosen too small, e.g. The amount of two segments is a fair minimum to consider as safeMargin value. |
- Source:
(export) setMaxHardwareResolution(width, height)
Set the maximum resolution that the platform's hardware can handle.
This will be called automatically by shaka.cast.CastReceiver to enforce
limitations of the Chromecast hardware.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | |
height |
number |
- Source:
(export) setTextTrackVisibility(on)
Set the visibility of the current text track, if any.
Parameters:
Name | Type | Description |
---|---|---|
on |
boolean |
- Source:
(private) streamText_() → {boolean}
- Source:
Returns:
true if we should stream text right now.
- Type
- boolean
(private) switch_(variant, clearBufferopt, safeMarginopt)
Callback from AbrManager.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
variant |
shaka.extern.Variant | ||
clearBuffer |
boolean |
<optional> |
|
safeMargin |
number |
<optional> |
Optional amount of buffer (in seconds) to retain when clearing the buffer. Defaults to 0 if not provided. Ignored if clearBuffer is false. |
- Source:
(private) switchTextStream_(textStream)
Switches to the given text stream, deferring if needed.
Parameters:
Name | Type | Description |
---|---|---|
textStream |
shaka.extern.Stream |
- Source:
(private) switchVariant_(variant, clearBufferopt, safeMarginopt)
Switches to the given variant, deferring if needed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
variant |
shaka.extern.Variant | ||
clearBuffer |
boolean |
<optional> |
|
safeMargin |
number |
<optional> |
- Source:
(export) trickPlay(rate)
Skip through the content without playing. Simulated using repeated seeks.
Trick play will be canceled automatically if the playhead hits the beginning
or end of the seekable range for the content.
Parameters:
Name | Type | Description |
---|---|---|
rate |
number | The playback rate to simulate. For example, a rate of 2.5 would result in 2.5 seconds of content being skipped every second. To trick-play backward, use a negative rate. |
- Source:
(export) unload(reinitializeMediaSourceopt) → (non-null) {Promise}
Unload the current manifest and make the Player available for re-use.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reinitializeMediaSource |
boolean |
<optional> |
If true, start reinitializing MediaSource right away. This can improve load() latency for MediaSource-based playbacks. Defaults to true. |
- Source:
Returns:
If reinitializeMediaSource is false, the Promise is
resolved as soon as streaming has stopped and the previous content, if any,
has been unloaded. If reinitializeMediaSource is true or undefined, the
Promise resolves after MediaSource has been subsequently reinitialized.
- Type
- Promise
(private) updateActiveStreams_(streamnon-null)
Parameters:
Name | Type | Description |
---|---|---|
stream |
shaka.extern.Stream |
- Source:
(private) updateState_()
Called from potential initiators of state changes, or before returning stats
to the user.
This method decides if state has actually changed, updates the last entry,
and adds a new one if needed.
- Source:
(private) updateTimeStats_()
- Source:
(export) usingEmbeddedTextTrack() → {boolean}
- Source:
Returns:
True if we are using any embedded text tracks present.
- Type
- boolean
(private) waitNextTick_() → (non-null) {Promise}
Return a promise that will delay the next next action to the next
interpreter cycle.
- Source:
Returns:
- Type
- Promise
Events
AdaptationEvent
Fired when an automatic adaptation causes the active tracks
to change. Does not fire when the application calls selectVariantTrack()
selectTextTrack(), selectAudioLanguage() or selectTextLanguage().
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'adaptation' |
- Source:
BufferingEvent
Fired when the player's buffering state changes.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'buffering' |
buffering |
boolean | True when the Player enters the buffering state. False when the Player leaves the buffering state. |
- Source:
DrmSessionUpdateEvent
Fired when the CDM has accepted the license response.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'drmsessionupdate' |
- Source:
EmsgEvent
Fired when a non-typical emsg is found in a segment.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'emsg' |
detail |
shaka.extern.EmsgInfo | An object which contains the content of the emsg box. |
- Source:
ErrorEvent
Fired when a playback error occurs.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'error' |
detail |
shaka.util.Error | An object which contains details on the error. The error's 'category' and 'code' properties will identify the specific error that occurred. In an uncompiled build, you can also use the 'message' and 'stack' properties to debug. |
- Source:
ExpirationUpdatedEvent
Fired when there is a change in the expiration times of an
EME session.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'expirationupdated' |
- Source:
LargeGapEvent
Fired when the playhead enters a large gap. If
|config.streaming.jumpLargeGaps| is set, the default action of this event
is to jump the gap; this can be prevented by calling preventDefault() on
the event object.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'largegap' |
currentTime |
number | The current time of the playhead. |
gapSize |
number | The size of the gap, in seconds. |
- Source:
LoadingEvent
Fired when the player begins loading.
Used by the Cast receiver to determine idle state.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'loading' |
- Source:
StreamingEvent
Fired after the manifest has been parsed and track information
is available, but before streams have been chosen and before any segments
have been fetched. You may use this event to configure the player based on
information found in the manifest.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'streaming' |
- Source:
TextTrackVisibilityEvent
Fired when text track visibility changes.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'texttrackvisibility' |
- Source:
TimelineRegionAddedEvent
Fired when a media timeline region is added.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'timelineregionadded' |
detail |
shaka.extern.TimelineRegionInfo | An object which contains a description of the region. |
- Source:
TimelineRegionEnterEvent
Fired when the playhead enters a timeline region.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'timelineregionenter' |
detail |
shaka.extern.TimelineRegionInfo | An object which contains a description of the region. |
- Source:
TimelineRegionExitEvent
Fired when the playhead exits a timeline region.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'timelineregionexit' |
detail |
shaka.extern.TimelineRegionInfo | An object which contains a description of the region. |
- Source:
TracksChangedEvent
Fired when the list of tracks changes. For example, this will
happen when changing periods or when track restrictions change.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'trackschanged' |
- Source:
UnloadingEvent
Fired when the player unloads or fails to load.
Used by the Cast receiver to determine idle state.
Properties:
Name | Type | Description |
---|---|---|
type |
string | 'unloading' |
- Source: