The main player object for Shaka Player.
Constructor
new Player(mediaElementopt, videoContaineropt, dependencyInjectoropt)
The main player object for Shaka Player.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
mediaElement |
HTMLMediaElement
|
<optional>
|
|
When provided, the player will attach to mediaElement ,
similar to calling attach . When not provided, the player
will remain detached. |
videoContainer |
HTMLElement
|
<optional>
|
null
|
The videoContainer to construct UITextDisplayer |
dependencyInjector |
function
|
<optional>
|
|
Optional callback
which is called to inject mocks into the Player. Used for testing. |
- Implements:
- Source:
Members
LoadMode :number
In order to know what method of loading the player used for some content, we
have this enum. It lets us know if content has not been loaded, loaded with
media source, or loaded with src equals.
This enum has a low resolution, because it is only meant to express the
outer limits of the various states that the player is in. For example, when
someone calls a public method on player, it should not matter if they have
initialized drm engine, it should only matter if they finished loading
content.
Type:
Properties:
Name |
Value |
Type |
Description |
DESTROYED |
0
|
number
|
|
NOT_LOADED |
1
|
number
|
|
MEDIA_SOURCE |
2
|
number
|
|
SRC_EQUALS |
3
|
number
|
|
- Source:
supportPlugins_ :Object.<string, function(): *>
Type:
-
Object.<string, function(): *>
- Source:
TextTrackLabel :string
Type:
- Source:
TYPICAL_BUFFERING_THRESHOLD_ :number
The typical buffering threshold. When we have less than this buffered (in
seconds), we enter a buffering state. This specific value is based on manual
testing and evaluation across a variety of platforms.
To make the buffering logic work in all cases, this "typical" threshold will
be overridden if the rebufferingGoal configuration is too low.
Type:
- Source:
version :string
A version number taken from git at compile time.
Type:
- Source:
The factory that was used to create the abrManager_ instance.
Type:
- Source:
For listeners scoped to the lifetime of the ad manager.
Type:
- Source:
assetUri_ :string
Type:
- Source:
For listeners scoped to the lifetime of the media element attachment.
Type:
- Source:
cleanupOnUnload_ :Array.<function(): (!Promise|undefined)>
Type:
-
Array.<function(): (!Promise|undefined)>
- Source:
completionPercent_ :number
Type:
- Source:
currentTargetLatency_ :number
Type:
- Source:
currentTextForced_ :boolean
Type:
- Source:
currentTextLanguage_ :string
Type:
- Source:
currentTextRole_ :string
Type:
- Source:
fullyLoaded_ :boolean
Type:
- Source:
For listeners scoped to the lifetime of the Player instance.
Type:
- Source:
isTextVisible_ :boolean
Since we may not always have a text displayer created (e.g. before |load|
is called), we need to track what text visibility SHOULD be so that we
can ensure that when we create the text displayer. When we create our
text displayer, we will use this to show (or not show) text as per the
user's requests.
Type:
- Source:
The TextDisplayerFactory that was last used to make a text displayer.
Stored so that we can tell if a new type of text displayer is desired.
Type:
- Source:
lcevcCanvas_ :HTMLCanvasElement
Type:
- Source:
For listeners scoped to the lifetime of the loaded content.
Type:
- Source:
mimeType_ :string
Type:
- Source:
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:
- Source:
operationId_ :number
Incremented whenever a top-level operation (load, attach, etc) is
performed.
Used to determine if a load operation has been interrupted.
Type:
- Source:
The playhead observers are used to monitor the position of the playhead
and some other source of data (e.g. buffered content), and raise events.
Type:
- Source:
This is our control over the playback rate of the media element. This
provides the missing functionality that we need to provide trick play,
for example a negative playback rate.
Type:
- Source:
preloadDueAdManagerVideoEnded_ :boolean
Type:
- Source:
rebufferingCount_ :number
Type:
- Source:
startTime_ :number
Type:
- Source:
targetLatencyReached_ :number
Type:
- Source:
For listeners scoped to the lifetime of the loaded content.
Type:
- Source:
video_ :HTMLVideoElement
Type:
- Source:
video_ :HTMLVideoElement
Type:
- Source:
video_ :HTMLVideoElement
Type:
- Source:
videoContainer_ :HTMLElement
Type:
- Source:
Methods
applyPlayRange_(timeline, playRangeStart, playRangeEnd)
Applies playRangeStart and playRangeEnd to the given timeline. This will
only affect non-live content.
Parameters:
- Source:
getLanguagesFrom_(tracksnon-null) → {Set.<string>}
Get the normalized languages for a group of tracks.
Parameters:
- Source:
Returns:
-
Type
-
Set.<string>
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
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.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
promptsOkay |
boolean
|
<optional>
|
true
|
|
- Source:
- See:
-
Returns:
-
Type
-
Promise.<shaka.extern.SupportType>
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:
setAdManagerFactory(factorynon-null)
Set a factory to create an ad manager during player construction time.
This method needs to be called bafore instantiating the Player class.
Parameters:
- Source:
activateChaptersTrack_(tracknullable)
Set the mode on a chapters track so that it loads.
Parameters:
Name |
Type |
Attributes |
Description |
track |
TextTrack
|
<nullable>
|
|
- Source:
Adds the basic media listeners
Parameters:
- Source:
addChaptersTrack(uri, language, mimeTypeopt) → {Promise.<shaka.extern.Track>}
Adds the given chapters track to the loaded manifest. load()
must resolve before calling. The presentation must have a duration.
This returns the created track.
Parameters:
Name |
Type |
Attributes |
Description |
uri |
string
|
|
|
language |
string
|
|
|
mimeType |
string
|
<optional>
|
|
- Source:
Returns:
-
Type
-
Promise.<shaka.extern.Track>
addFont(name, url)
Load a new font on the page. If the font was already loaded, it does
nothing.
Parameters:
Name |
Type |
Description |
name |
string
|
|
url |
string
|
|
- Source:
addSrcTrackElement_(uri, language, kind, mimeType, label, adCuePointsnon-null) → {Promise.<!HTMLTrackElement>}
Parameters:
Name |
Type |
Description |
uri |
string
|
|
language |
string
|
|
kind |
string
|
|
mimeType |
string
|
|
label |
string
|
|
adCuePoints |
Array.<!shaka.extern.AdCuePoint>
|
|
- Source:
Returns:
-
Type
-
Promise.<!HTMLTrackElement>
addTextStreamToSwitchHistory_(textStream, fromAdaptation)
Parameters:
- Source:
addTextTrackAsync(uri, language, kind, mimeTypeopt, codecopt, labelopt, forcedopt) → {Promise.<shaka.extern.Track>}
Adds the given text track to the loaded manifest. load()
must
resolve before calling. The presentation must have a duration.
This returns the created track, which can immediately be selected by the
application. The track will not be automatically selected.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
uri |
string
|
|
|
|
language |
string
|
|
|
|
kind |
string
|
|
|
|
mimeType |
string
|
<optional>
|
|
|
codec |
string
|
<optional>
|
|
|
label |
string
|
<optional>
|
|
|
forced |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise.<shaka.extern.Track>
addThumbnailsTrack(uri, mimeTypeopt) → {Promise.<shaka.extern.Track>}
Adds the given thumbnails track to the loaded manifest.
load()
must resolve before calling. The presentation must
have a duration.
This returns the created track, which can immediately be used by the
application.
Parameters:
Name |
Type |
Attributes |
Description |
uri |
string
|
|
|
mimeType |
string
|
<optional>
|
|
- Source:
Returns:
-
Type
-
Promise.<shaka.extern.Track>
addVariantToSwitchHistory_(variant, fromAdaptation)
Parameters:
- Source:
adjustStartTime_(initialVariant, time) → {Promise.<number>}
Parameters:
- Source:
Returns:
-
Type
-
Promise.<number>
applyConfig_()
Apply config changes.
- Source:
atomicOperationAcquireMutex_(mutexIdentifier) → {Promise.<boolean>}
Tries to acquire the mutex, and then returns if the operation should end
early due to someone else starting a mutex-acquiring operation.
Meant for operations that can't be interrupted midway through (e.g.
everything but load).
Parameters:
Name |
Type |
Description |
mutexIdentifier |
string
|
|
- Source:
Returns:
endEarly If false, the calling context will
need to release the mutex.
-
Type
-
Promise.<boolean>
attach(mediaElementnon-null, initializeMediaSourceopt) → {Promise}
Attaches the player to a media element.
If the player was already attached to a media element, first detaches from
that media element.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
mediaElement |
HTMLMediaElement
|
|
|
|
initializeMediaSource |
boolean
|
<optional>
|
true
|
|
- Source:
Returns:
-
Type
-
Promise
attachCanvas(canvas)
Calling attachCanvas
will tell the player to set canvas
element for LCEVC decoding.
Parameters:
Name |
Type |
Description |
canvas |
HTMLCanvasElement
|
|
- Source:
cancelTrickPlay()
Cancel trick-play. If the player has not loaded content or is still loading
content this will be a no-op.
- Source:
checkVariants_()
Checks to re-enable variants that were temporarily disabled due to network
errors. If any variants are enabled this way, a new variant may be chosen
for playback.
- Source:
Choose a text stream from all possible text streams while taking into
account user preference.
- Source:
Returns:
-
Type
-
shaka.extern.Stream
Chooses a variant from all possible variants while taking into account
restrictions, preferences, and ABR.
On error, this dispatches an error event and returns null.
- Source:
Returns:
-
Type
-
shaka.extern.Variant
chooseVariantAndSwitch_(clearBufferopt, safeMarginopt)
Chooses a new Variant. If the new variant differs from the old one, it
adds the new one to the switch history and switches to it.
Called after a config change, a key status event, or an explicit language
change.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
clearBuffer |
boolean
|
<optional>
|
true
|
Optional clear buffer or not when
switch to new variant
Defaults to true if not provided |
safeMargin |
number
|
<optional>
|
0
|
Optional amount of buffer (in seconds) to
retain when clearing the buffer.
Defaults to 0 if not provided. Ignored if clearBuffer is false. |
- Source:
closeLcevcDec_()
Close a shaka.lcevc.Dec object if present and hide the canvas.
- Source:
Changes configuration settings on the Player. This checks the names of
keys and the types of values to avoid coding errors. If there are errors,
this logs them to the console and returns false. Correct fields are still
applied even if there are other errors. You can pass an explicit
undefined
value to restore the default value. This has two
modes of operation:
First, this can be passed a single "plain" object. This object should
follow the shaka.extern.PlayerConfiguration object. Not all fields
need to be set; unset fields retain their old values.
Second, this can be passed two arguments. The first is the name of the key
to set. This should be a '.' separated path to the key. For example,
'streaming.alwaysStreamText'
. The second argument is the
value to set.
Parameters:
Name |
Type |
Attributes |
Description |
config |
string
|
Object
|
|
This should either be a field name or an
object. |
value |
*
|
<optional>
|
In the second mode, this is the value to set. |
- Source:
Returns:
True if the passed config object was valid, false if
there were invalid entries.
-
Type
-
boolean
convertToWebVTT_(buffer, mimeType, adCuePointsnon-null) → {string}
Converts an input string to a WebVTT format string.
Parameters:
- Source:
Returns:
-
Type
-
string
Create an error for when we purposely interrupt a load operation.
- Source:
Returns:
-
Type
-
shaka.util.Error
createCmcd_()
Create a new CMCD manager.
- Source:
createCmsd_()
Create a new CMSD manager.
- Source:
Create a new DrmEngine instance. This may be replaced by tests to create
fake instances. Configuration and initialization will be handled after
|createDrmEngine|.
Parameters:
- Source:
Returns:
-
Type
-
shaka.media.DrmEngine
createLcevcDec_(config)
Create a shaka.lcevc.Dec object
Parameters:
- Source:
Create a new media source engine. This will ONLY be replaced by tests as a
way to inject fake media source engine instances.
Parameters:
- Source:
Returns:
-
Type
-
shaka.media.MediaSourceEngine
Creates a new instance of NetworkingEngine. This can be replaced by tests
to create fake instances instead.
Parameters:
Name |
Type |
Attributes |
Description |
getPreloadManager |
function
|
<optional>
|
|
- Source:
Returns:
-
Type
-
shaka.net.NetworkingEngine
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
Create the observers for MSE playback. These observers are responsible for
notifying the app and player of specific events during MSE playback.
Parameters:
Name |
Type |
Description |
startTime |
number
|
|
- Source:
Returns:
-
Type
-
shaka.media.PlayheadObserverManager
Creates a new instance of StreamingEngine. This can be replaced by tests
to create fake instances instead.
- Source:
Returns:
-
Type
-
shaka.media.StreamingEngine
createTextDisplayer_()
- Source:
defaultStreamingFailureCallback_(errornon-null)
Parameters:
- Source:
delayDispatchEvent_(eventnon-null)
Fire an event, but wait a little bit so that the immediate execution can
complete before the event is handled.
Parameters:
- Source:
destroy() → {Promise}
After destruction, a Player object cannot be used again.
- Implements:
- Source:
Returns:
-
Type
-
Promise
destroyAllPreloads()
Calls |destroy| on each PreloadManager object this player has created.
- Source:
detach(keepAdManageropt) → {Promise}
Detach the player from the current media element. Leaves the player in a
state where it cannot play media, until it has been attached to something
else.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
keepAdManager |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise
detachAndSavePreload(keepAdManageropt, saveLivePositionopt) → {Promise.<?shaka.media.PreloadManager>}
Detach the player from the current media element, if any, and returns a
PreloadManager that contains the loaded manifest of that asset, if any.
Allows for the asset to be re-loaded by this player faster, in the future.
When in src= mode, this detach but does not make a PreloadManager.
Leaves the player in a state where it cannot play media, until it has been
attached to something else.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
keepAdManager |
boolean
|
<optional>
|
false
|
|
saveLivePosition |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.media.PreloadManager>
disableStream(stream, disableTime) → {boolean}
Temporarily disable all variants containing |stream|
Parameters:
- Source:
Returns:
-
Type
-
boolean
Construct and fire a Player.Metadata event
Parameters:
Name |
Type |
Attributes |
Description |
startTime |
number
|
|
|
endTime |
number
|
<nullable>
|
|
metadataType |
string
|
|
|
payload |
shaka.extern.MetadataFrame
|
|
|
- Source:
Get the drm info used to initialize EME. If EME is not being used, this
will return null
. If the player is idle or has not initialized
EME yet, this will return null
.
- Source:
Returns:
-
Type
-
shaka.extern.DrmInfo
enableNativeTrack_(tracknon-null)
Parameters:
Name |
Type |
Description |
track |
TextTrack
|
|
- Source:
Returns a shaka.ads.AdManager instance, responsible for Dynamic
Ad Insertion functionality.
- Source:
Returns:
-
Type
-
shaka.extern.IAdManager
getAllThumbnails(trackId) → {Promise.<?Array.<!shaka.extern.Thumbnail>>}
Returns Thumbnail objects for each thumbnail for a given image track ID.
If the player has not loaded content, this will return a null.
Parameters:
Name |
Type |
Description |
trackId |
number
|
|
- Source:
Returns:
-
Type
-
Promise.<?Array.<!shaka.extern.Thumbnail>>
getAssetUri() → {string}
Get the uri to the asset that the player has loaded. If the player has not
loaded content, this will return null
.
- Source:
Returns:
-
Type
-
string
getAudioLanguages() → {Array.<string>}
Return a list of audio languages available. If the player has not loaded
any content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<string>
Return a list of audio language-role combinations available. If the
player has not loaded any content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<shaka.extern.LanguageRole>
Get information about what the player has buffered. If the player has not
loaded content or is currently loading content, the buffered content will
be empty.
- Source:
Returns:
-
Type
-
shaka.extern.BufferedInfo
getBufferFullness() → {number}
Returns the ratio of video length buffered compared to buffering Goal
- Source:
Returns:
-
Type
-
number
This returns the list of chapters.
Parameters:
Name |
Type |
Description |
language |
string
|
|
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Chapter>
getChaptersTracks_() → {Array.<TextTrack>}
Get the TextTracks with the 'chapters' kind.
- Source:
Returns:
-
Type
-
Array.<TextTrack>
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:
-
Type
-
shaka.extern.PlayerConfiguration
Get the drm engine.
This method should only be used for testing. Applications SHOULD NOT
use this in production.
- Source:
Returns:
-
Type
-
shaka.media.DrmEngine
getExpiration() → {number}
Get the next known expiration time for any EME session. If the session
never expires, this will return Infinity
. If there are no EME
sessions, this will return Infinity
. If the player has not
loaded content, this will return Infinity
.
- Source:
Returns:
-
Type
-
number
Gets information about the currently fetched video, audio, and text.
In the case of a multi-codec or multi-mimeType manifest, this can let you
determine the exact codecs and mimeTypes being fetched at the moment.
- Source:
Returns:
-
Type
-
shaka.extern.PlaybackInfo
getFilteredTextTracks_() → {Array.<TextTrack>}
Ignore the TextTracks with the 'metadata' or 'chapters' kind, or the one
generated by the SimpleTextDisplayer.
- Source:
Returns:
-
Type
-
Array.<TextTrack>
Return a list of image tracks that can be switched to.
If the player has not loaded content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Track>
getKeyStatuses() → {Object.<string, string>}
Gets a map of EME key ID to the current key status.
- Source:
Returns:
-
Type
-
Object.<string, string>
Get the manifest that the player has loaded. If the player has not loaded
any content, this will return null
.
NOTE: This structure is NOT covered by semantic versioning compatibility
guarantees. It may change at any time!
This is marked as deprecated to warn Closure Compiler users at compile-time
to avoid using this method.
- Deprecated:
- Source:
Returns:
-
Type
-
shaka.extern.Manifest
Get the type of manifest parser that the player is using. If the player has
not loaded any content, this will return null
.
- Source:
Returns:
-
Type
-
shaka.extern.ManifestParser.Factory
getManifestType() → {string}
Get the current manifest type.
- Source:
Returns:
-
Type
-
string
Get the media element that the player is currently using to play loaded
content. If the player has not loaded content, this will return
null
.
- Source:
Returns:
-
Type
-
HTMLMediaElement
Get the TextTracks with the 'metadata' kind.
- Source:
Returns:
-
Type
-
Array.<TextTrack>
- Source:
Returns:
A reference to the Player's networking
engine. Applications may use this to make requests through Shaka's
networking plugins.
-
Type
-
shaka.net.NetworkingEngine
getNonDefaultConfiguration() → {Object}
Return a copy of the current non default configuration. Modifications of
the returned value will not affect the Player's active configuration.
You must call player.configure()
to make changes.
- Source:
Returns:
-
Type
-
Object
getPlaybackRate() → {number}
Get the playback rate of what is playing right now. If we are using trick
play, this will return the trick play rate.
If no content is playing, this will return 0.
If content is buffering, this will return the expected playback rate once
the video starts playing.
If the player has not loaded content, this will return a playback rate of
0.
- Source:
Returns:
-
Type
-
number
getPlayheadTimeAsDate() → {Date}
Get the current playhead position as a date.
- Source:
Returns:
-
Type
-
Date
getPresentationStartTimeAsDate() → {Date}
Get the presentation start time as a date.
- Source:
Returns:
-
Type
-
Date
getSegmentAvailabilityDuration() → {number}
Get the presentation segment availability duration. This should only be
called when the player has loaded a live stream. If the player has not
loaded a live stream, this will return null
.
- Source:
Returns:
-
Type
-
number
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:
-
Type
-
shaka.extern.PlayerConfiguration
Get statistics for the current playback session. If the player is not
playing content, this will return an empty stats object.
- Source:
Returns:
-
Type
-
shaka.extern.Stats
getTextData_(uri, netEnginenon-null, retryParams) → {Promise.<BufferSource>}
Parameters:
- Source:
Returns:
-
Type
-
Promise.<BufferSource>
getTextLanguages() → {Array.<string>}
Return a list of text languages available. If the player has not loaded
any content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<string>
Return a list of text language-role combinations available. If the player
has not loaded any content, this will be return an empty list.
- Source:
Returns:
-
Type
-
Array.<shaka.extern.LanguageRole>
getTextMimetype_(uri) → {Promise.<string>}
Parameters:
Name |
Type |
Description |
uri |
string
|
|
- Source:
Returns:
-
Type
-
Promise.<string>
Return a list of text tracks that can be switched to.
If the player has not loaded content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Track>
Return a Thumbnail object from a image track Id and time.
If the player has not loaded content, this will return a null.
Parameters:
Name |
Type |
Description |
trackId |
number
|
|
time |
number
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.extern.Thumbnail>
Return a list of variant tracks that can be switched to.
If the player has not loaded content, this will return an empty list.
- Source:
Returns:
-
Type
-
Array.<shaka.extern.Track>
goToLive()
Go to live in a live stream.
- Source:
guessMimeType_(assetUri) → {Promise.<?string>}
Determines the mimeType of the given asset, if we are not told that inside
the loading process.
Parameters:
Name |
Type |
Description |
assetUri |
string
|
|
- Source:
Returns:
mimeType
-
Type
-
Promise.<?string>
Initializes the media source engine.
- Source:
Returns:
-
Type
-
Promise
initializeSrcEqualsDrmInner_(mimeType) → {Promise}
Initializes the DRM engine for use by src equals.
Parameters:
Name |
Type |
Description |
mimeType |
string
|
|
- Source:
Returns:
-
Type
-
Promise
isAudioOnly() → {boolean}
Check if the manifest contains only audio-only content. If the player has
not loaded content, this will return
false
.
The player does not support content that contain more than one type of
variants (i.e. mixing audio-only, video-only, audio-video). Content will be
filtered to only contain one type of variant.
- Source:
Returns:
-
Type
-
boolean
isBufferedToEndMS_() → {boolean}
Assuming the player is playing content with media source, check if the
player has buffered enough content to make it to the end of the
presentation.
- Source:
Returns:
-
Type
-
boolean
isBufferedToEndSrc_() → {boolean}
Assuming the player is playing content with src=, check if the player has
buffered enough content to make it to the end of the presentation.
- Source:
Returns:
-
Type
-
boolean
isBuffering() → {boolean}
Check if the player is currently in a buffering state (has too little
content to play smoothly). If the player has not loaded content, this will
return false
.
- Source:
Returns:
-
Type
-
boolean
isFullyLoaded() → {boolean}
Indicates if the player has fully loaded the stream.
- Source:
Returns:
-
Type
-
boolean
isInProgress() → {boolean}
Get if the player is playing in-progress content. If the player has not
loaded content, this will return false
.
- Source:
Returns:
-
Type
-
boolean
isLive() → {boolean}
Get if the player is playing live content. If the player has not loaded
content, this will return false
.
- Source:
Returns:
-
Type
-
boolean
isRemotePlayback() → {boolean}
Indicate if we are using remote playback.
- Source:
Returns:
-
Type
-
boolean
isTextTrackVisible() → {boolean}
Check if the text displayer is enabled.
- Source:
Returns:
-
Type
-
boolean
keySystem() → {string}
Get the key system currently used by EME. If EME is not being used, this
will return an empty string. If the player has not loaded content, this
will return an empty string.
- Source:
Returns:
-
Type
-
string
load(assetUriOrPreloader, startTimeopt, nullable, mimeTypeopt, nullable) → {Promise}
Loads a new stream.
If another stream was already playing, first unloads that stream.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
assetUriOrPreloader |
string
|
shaka.media.PreloadManager
|
|
|
|
startTime |
number
|
<optional>
<nullable>
|
null
|
When startTime is null or
undefined , playback will start at the default start time (0
for VOD and liveEdge for LIVE). |
mimeType |
string
|
<optional>
<nullable>
|
|
|
- Source:
Returns:
-
Type
-
Promise
loadInner_(startTimeOfLoad, prefetchedVariantnullable, segmentPrefetchByIdnon-null) → {Promise}
Starts loading the content described by the parsed manifest.
Parameters:
- Source:
Returns:
-
Type
-
Promise
makeManifestAudioOnly_()
Modifies the current manifest so that it is audio-only.
- Source:
makePreloadManager_(assetUri, startTimenullable, mimeTypenullable, allowPrefetchopt, disableVideoopt, allowMakeAbrManageropt) → {Promise.<!shaka.media.PreloadManager>}
Parameters:
Name |
Type |
Attributes |
Default |
Description |
assetUri |
string
|
|
|
|
startTime |
number
|
<nullable>
|
|
|
mimeType |
string
|
<nullable>
|
|
|
allowPrefetch |
boolean
|
<optional>
|
true
|
|
disableVideo |
boolean
|
<optional>
|
false
|
|
allowMakeAbrManager |
boolean
|
<optional>
|
true
|
|
- Source:
Returns:
-
Type
-
Promise.<!shaka.media.PreloadManager>
makeStateChangeEvent_(nodeName)
Makes a fires an event corresponding to entering a state of the loading
process.
Parameters:
Name |
Type |
Description |
nodeName |
string
|
|
- Source:
makeTextStreamsForClosedCaptions_(manifestnon-null)
For CEA closed captions embedded in the video streams, create dummy text
stream. This can be safely called again on existing manifests, for
manifest updates.
Parameters:
- Source:
onAbrStatusChanged_()
- Source:
onAdaptation_(fromnullable, to)
Dispatches an 'adaptation' event.
Parameters:
- Source:
onError_(errornon-null)
Parameters:
- Source:
onKeyStatus_(keyStatusMapnon-null)
Parameters:
Name |
Type |
Description |
keyStatusMap |
Object.<string, string>
|
A map of hex key IDs to
statuses. |
- Source:
onManifestUpdate_()
Callback from StreamingEngine.
- Source:
When notified of a media quality change we need to emit a
MediaQualityChange event to the app.
Parameters:
Name |
Type |
Default |
Description |
mediaQuality |
shaka.extern.MediaQualityInfo
|
|
|
position |
number
|
|
|
audioTrackChanged |
boolean
|
false
|
This is to specify whether this should
trigger a MediaQualityChangedEvent or an AudioTrackChangedEvent. Defaults
to false to trigger MediaQualityChangedEvent. |
- Source:
onRateChange_()
A callback for when the playback rate changes. We need to watch the
playback rate so that if the playback rate on the media element changes
(that was not caused by our play rate controller) we can notify the
controller so that it can stay in-sync with the change.
- Source:
onRegionEvent_(eventNamenon-null, region, eventTargetopt)
When we fire region events, we need to copy the information out of the
region to break the connection with the player's internal data. We do the
copy here because this is the transition point between the player and the
app.
Parameters:
- Source:
onSeek_()
Callback from Playhead.
- Source:
onSegmentAppended_(start, end, contentType, isMuxed)
Callback from StreamingEngine.
Parameters:
- Source:
onTextChanged_()
Dispatches a 'textchanged' event.
- Source:
onTextTrackVisibility_()
- Source:
onTimeUpdate_()
Callback for liveSync and vodDynamicPlaybackRate
- Source:
onTracksChanged_()
Dispatches a 'trackschanged' event.
- Source:
onVariantChanged_(fromnullable, to)
Dispatches a 'variantchanged' event.
Parameters:
- Source:
onVideoError_(eventnon-null)
Parameters:
Name |
Type |
Description |
event |
Event
|
|
- Source:
onVideoProgress_()
Callback for video progress events
- Source:
parseTilesLayout_(tilesLayout) → {?{ columns: number, rows: number}}
Parses a tiles layout.
Parameters:
Name |
Type |
Description |
tilesLayout |
string
|
undefined
|
|
- Source:
Returns:
-
Type
-
?{ columns: number, rows: number}
pollBufferState_()
This method is called periodically to check what the buffering observer
says so that we can update the rest of the buffering behaviours.
- Source:
preload(assetUri, startTimeopt, nullable, mimeTypeopt, nullable) → {Promise.<?shaka.media.PreloadManager>}
Starts to preload a given asset, and returns a PreloadManager object that
represents that preloading process.
The PreloadManager will load the manifest for that asset, as well as the
initialization segment. It will not preload anything more than that;
this feature is intended for reducing start-time latency, not for fully
downloading assets before playing them (for that, use
|shaka.offline.Storage|).
You can pass that PreloadManager object in to the |load| method on this
Player instance to finish loading that particular asset, or you can call
the |destroy| method on the manager if the preload is no longer necessary.
If this returns null rather than a PreloadManager, that indicates that the
asset must be played with src=, which cannot be preloaded.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
assetUri |
string
|
|
|
|
startTime |
number
|
<optional>
<nullable>
|
null
|
When startTime is null or
undefined , playback will start at the default start time (0
for VOD and liveEdge for LIVE). |
mimeType |
string
|
<optional>
<nullable>
|
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.media.PreloadManager>
preloadInner_(assetUri, startTimenullable, mimeTypeopt, nullable, standardLoadopt) → {Promise.<?shaka.media.PreloadManager>}
Parameters:
Name |
Type |
Attributes |
Default |
Description |
assetUri |
string
|
|
|
|
startTime |
number
|
<nullable>
|
|
|
mimeType |
string
|
<optional>
<nullable>
|
|
|
standardLoad |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.media.PreloadManager>
Parameters:
Name |
Type |
Attributes |
Description |
metadata |
Array.<shaka.extern.ID3Metadata>
|
|
|
offset |
number
|
|
|
segmentEndTime |
number
|
<nullable>
|
|
- Source:
We're looking for metadata tracks to process id3 tags. One of the uses is
for ad info on LIVE streams
Parameters:
Name |
Type |
Description |
track |
TextTrack
|
|
- Source:
releaseAllMutexes()
Releases all of the mutexes of the player. Meant for use by the tests.
- Source:
resetConfiguration()
Reset configuration to default.
- Source:
restoreDisabledVariants_(updateAbrManager)
Parameters:
Name |
Type |
Default |
Description |
updateAbrManager |
boolean
|
true
|
|
- Source:
retryStreaming(retryDelaySecondsopt) → {boolean}
Retry streaming after a streaming failure has occurred. When the player has
not loaded content or is loading content, this will be a no-op and will
return
false
.
If the player has loaded content, and streaming has not seen an error, this
will return false
.
If the player has loaded content, and streaming seen an error, but the
could not resume streaming, this will return false
.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
retryDelaySeconds |
number
|
<optional>
|
0.1
|
|
- Source:
Returns:
-
Type
-
boolean
Parameters:
Name |
Type |
Attributes |
Default |
Description |
saveLivePosition |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.media.PreloadManager>
seekRange() → {{start: number, end: number}}
Get the range of time (in seconds) that seeking is allowed. If the player
has not loaded content and the manifest is HLS, this will return a range
from 0 to 0.
- Source:
Returns:
-
Type
-
{start: number, end: number}
selectAudioLanguage(language, roleopt, channelsCountopt, safeMarginopt, codecopt)
Sets the current audio language and current variant role to the selected
language, role and channel count, and chooses a new variant if need be.
If the player has not loaded any content, this will be a no-op.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
language |
string
|
|
|
|
role |
string
|
<optional>
|
|
|
channelsCount |
number
|
<optional>
|
0
|
|
safeMargin |
number
|
<optional>
|
0
|
|
codec |
string
|
<optional>
|
|
|
- Source:
selectTextLanguage(language, roleopt, forcedopt)
Sets the current text language and current text role to the selected
language and role, and chooses a new variant if need be. If the player has
not loaded any content, this will be a no-op.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
language |
string
|
|
|
|
role |
string
|
<optional>
|
|
|
forced |
boolean
|
<optional>
|
false
|
|
- Source:
selectTextTrack(track)
Select a specific text track.
track
should come from a call to
getTextTracks
. If the track is not found, this will be a
no-op. If the player has not loaded content, this will be a no-op.
Note that AdaptationEvents
are not fired for manual track
selections.
Parameters:
- Source:
selectVariantsByLabel(label, clearBufferopt, safeMarginopt)
Select variant tracks that have a given label. This assumes the
label uniquely identifies an audio stream, so all the variants
are expected to have the same variant.audio.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
label |
string
|
|
|
|
clearBuffer |
boolean
|
<optional>
|
true
|
Optional clear buffer or not when
switch to new variant
Defaults to true if not provided |
safeMargin |
number
|
<optional>
|
0
|
Optional amount of buffer (in seconds) to
retain when clearing the buffer.
Defaults to 0 if not provided. Ignored if clearBuffer is false. |
- Source:
selectVariantTrack(track, clearBufferopt, safeMarginopt)
Select a specific variant track to play.
track
should come
from a call to
getVariantTracks
. If
track
cannot
be found, this will be a no-op. If the player has not loaded content, this
will be a no-op.
Changing variants will take effect once the currently buffered content has
been played. To force the change to happen sooner, use
clearBuffer
with safeMargin
. Setting
clearBuffer
to true
will clear all buffered
content after safeMargin
, allowing the new variant to start
playing sooner.
Note that AdaptationEvents
are not fired for manual track
selections.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
track |
shaka.extern.Track
|
|
|
|
clearBuffer |
boolean
|
<optional>
|
false
|
|
safeMargin |
number
|
<optional>
|
0
|
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:
setInitialTextState_()
Decide during startup if text should be streamed/shown.
- Source:
setMaxHardwareResolution(width, height)
Set the maximum resolution that the platform's hardware can handle.
Parameters:
Name |
Type |
Description |
width |
number
|
|
height |
number
|
|
- Source:
setTextDisplayerLanguage_()
- Source:
setTextTrackVisibility(isVisible)
Enable or disable the text displayer. If the player is in an unloaded
state, the request will be applied next time content is loaded.
Parameters:
Name |
Type |
Description |
isVisible |
boolean
|
|
- Source:
setupLcevc_(confignullable)
Setup shaka.lcevc.Dec object
Parameters:
- Source:
setupPreferredAudioOnSrc_()
This method setup the preferred audio using src=..
- Source:
setupPreferredTextOnSrc_()
This method setup the preferred text using src=.
- Source:
setVideoContainer(videoContainer)
Set the videoContainer to construct UITextDisplayer.
Parameters:
Name |
Type |
Description |
videoContainer |
HTMLElement
|
|
- Source:
shouldInitiallyShowText_(audioStreamnullable, textStream) → {boolean}
Check if we should show text on screen automatically.
Parameters:
- Source:
Returns:
-
Type
-
boolean
shouldStreamText_() → {boolean}
- Source:
Returns:
true if we should stream text right now.
-
Type
-
boolean
shouldUseSrcEquals_(assetUri, mimeTypeopt, nullable) → {boolean}
Determines if we should use src equals, based on the the mimeType (if
known), the URI, and platform information.
Parameters:
Name |
Type |
Attributes |
Description |
assetUri |
string
|
|
|
mimeType |
string
|
<optional>
<nullable>
|
|
- Source:
Returns:
|true| if the content should be loaded with src=, |false| if the content
should be loaded with MediaSource.
-
Type
-
boolean
srcEqualsInner_(startTimeOfLoad, mimeType) → {Promise}
Passes the asset URI along to the media element, so it can be played src
equals style.
Parameters:
Name |
Type |
Description |
startTimeOfLoad |
number
|
|
mimeType |
string
|
|
- Source:
Returns:
-
Type
-
Promise
startBufferManagement_(mediaElementnon-null, rebufferingGoal)
Initialize and start the buffering system (observer and timer) so that we
can monitor our buffer lead during playback.
Parameters:
- Source:
switch_(variant, clearBufferopt, safeMarginopt)
Callback from AbrManager.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
variant |
shaka.extern.Variant
|
|
|
|
clearBuffer |
boolean
|
<optional>
|
false
|
|
safeMargin |
number
|
<optional>
|
0
|
Optional amount of buffer (in seconds) to
retain when clearing the buffer.
Defaults to 0 if not provided. Ignored if clearBuffer is false. |
- Source:
switchHtml5Track_(track)
Parameters:
Name |
Type |
Description |
track |
AudioTrack
|
|
- Source:
switchVariant_(variant, fromAdaptation, clearBuffer, safeMargin, forceopt)
Parameters:
Name |
Type |
Attributes |
Default |
Description |
variant |
shaka.extern.Variant
|
|
|
|
fromAdaptation |
boolean
|
|
|
|
clearBuffer |
boolean
|
|
|
|
safeMargin |
number
|
|
|
|
force |
boolean
|
<optional>
|
false
|
|
- Source:
trickPlay(rate, useTrickPlayTrackopt)
Enable trick play to skip through content without playing by repeatedly
seeking. For example, a rate of 2.5 would result in 2.5 seconds of content
being skipped every second. A negative rate will result in moving
backwards.
If the player has not loaded content or is still loading content this will
be a no-op. Wait until load
has completed before calling.
Trick play will be canceled automatically if the playhead hits the
beginning or end of the seekable range for the content.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
rate |
number
|
|
|
|
useTrickPlayTrack |
boolean
|
<optional>
|
true
|
|
- Source:
unload(initializeMediaSourceopt, keepAdManageropt) → {Promise}
Unloads the currently playing stream, if any.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
initializeMediaSource |
boolean
|
<optional>
|
true
|
|
keepAdManager |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise
unloadAndSavePreload(initializeMediaSourceopt, keepAdManageropt) → {Promise.<?shaka.media.PreloadManager>}
Unloads the currently playing stream, if any, and returns a PreloadManager
that contains the loaded manifest of that asset, if any.
Allows for the asset to be re-loaded by this player faster, in the future.
When in src= mode, this unloads but does not make a PreloadManager.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
initializeMediaSource |
boolean
|
<optional>
|
true
|
|
keepAdManager |
boolean
|
<optional>
|
false
|
|
- Source:
Returns:
-
Type
-
Promise.<?shaka.media.PreloadManager>
updateAbrManagerVariants_() → {boolean}
Update AbrManager with variants while taking into account restrictions,
preferences, and ABR.
On error, this dispatches an error event and returns false.
- Source:
Returns:
True if successful.
-
Type
-
boolean
updateBufferingSettings_(rebufferingGoal)
Updates the buffering thresholds based on the new rebuffering goal.
Parameters:
Name |
Type |
Description |
rebufferingGoal |
number
|
|
- Source:
updateBufferState_()
Update the buffering state to be either "we are buffering" or "we are not
buffering", firing events to the app as needed.
- Source:
updateStartTime(startTime)
Provides a way to update the stream start position during the media loading
process. Can for example be called from the manifestparsed
event handler to update the start position based on information in the
manifest.
Parameters:
Name |
Type |
Description |
startTime |
number
|
|
- Source:
updateStateHistory_()
Try updating the state history. If the player has not finished
initializing, this will be a no-op.
- Source:
videoErrorToShakaError_(printAllErrorsopt) → {shaka.util.Error}
Turn the media element's error object into a Shaka Player error object.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
printAllErrors |
boolean
|
<optional>
|
true
|
|
- Source:
Returns:
-
Type
-
shaka.util.Error
Events
AbrStatusChangedEvent
Fired when the state of abr has been changed.
(Enabled or disabled).
Properties:
Name |
Type |
Description |
type |
string
|
'abrstatuschanged' |
newStatus |
boolean
|
The new status of the application. True for 'is enabled' and
false otherwise. |
- Source:
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:
- Source:
AudioTrackChangedEvent
Fired when the audio track changes at the playhead.
That may be caused by a user requesting to chang audio tracks.
Properties:
Name |
Type |
Description |
type |
string
|
'audiotrackchanged' |
mediaQuality |
shaka.extern.MediaQualityInfo
|
Information about media quality at the playhead position. |
position |
number
|
The playhead position. |
- 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:
Complete
Fires when the content completes playing.
Only for VoD.
Properties:
Name |
Type |
Description |
type |
string
|
'complete' |
- Source:
DownloadFailed
Fired when a download has failed, for any reason.
'downloadfailed'
Properties:
- Source:
Fired when the networking engine has received the headers for
a download, but before the body has been downloaded.
If the HTTP plugin being used does not track this information, this event
will default to being fired when the body is received, instead.
Properties:
- Source:
DrmSessionUpdateEvent
Fired when the CDM has accepted the license response.
Properties:
Name |
Type |
Description |
type |
string
|
'drmsessionupdate' |
- Source:
EmsgEvent
Fired when an emsg box is found in a segment.
If the application calls preventDefault() on this event, further parsing
will not happen, and no 'metadata' event will be raised for ID3 payloads.
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:
FirstQuartile
Fires when the content playhead crosses first quartile.
Only for VoD.
Properties:
Name |
Type |
Description |
type |
string
|
'firstquartile' |
- Source:
GapJumpedEvent
Fired when the GapJumpingController jumps over a gap in the
buffered ranges.
An app may want to look at getStats()
to see what happened.
Properties:
Name |
Type |
Description |
type |
string
|
'gapjumped' |
- Source:
KeyStatusChanged
Fired when the key status changed.
Properties:
Name |
Type |
Description |
type |
string
|
'keystatuschanged' |
- Source:
LoadedEvent
Fired when the player ends the load.
Properties:
Name |
Type |
Description |
type |
string
|
'loaded' |
- Source:
LoadingEvent
Fired when the player begins loading. The start of loading is
defined as when the user has communicated intent to load content (i.e.
Player.load
has been called).
Properties:
Name |
Type |
Description |
type |
string
|
'loading' |
- Source:
ManifestParsedEvent
Fired after the manifest has been parsed, but before anything
else happens. The manifest may contain streams that will be filtered out,
at this stage of the loading process.
Properties:
Name |
Type |
Description |
type |
string
|
'manifestparsed' |
- Source:
ManifestUpdatedEvent
Fired after the manifest has been updated (live streams).
Properties:
Name |
Type |
Description |
type |
string
|
'manifestupdated' |
isLive |
boolean
|
True when the playlist is live. Useful to detect transition from live
to static playlist.. |
- Source:
Fired when the media quality changes at the playhead.
That may be caused by an adaptation change or a DASH period transition.
Separate events are emitted for audio and video contentTypes.
Properties:
Name |
Type |
Description |
type |
string
|
'mediaqualitychanged' |
mediaQuality |
shaka.extern.MediaQualityInfo
|
Information about media quality at the playhead position. |
position |
number
|
The playhead position. |
- Source:
Fired when MediaSource has been successfully recovered
after occurrence of video error.
Properties:
Name |
Type |
Description |
type |
string
|
'mediasourcerecovered' |
- Source:
Triggers after metadata associated with the stream is found.
Usually they are metadata of type ID3.
Properties:
Name |
Type |
Attributes |
Description |
type |
string
|
|
'metadata' |
startTime |
number
|
|
The time that describes the beginning of the range of the metadata to
which the cue applies. |
endTime |
number
|
<nullable>
|
The time that describes the end of the range of the metadata to which
the cue applies. |
metadataType |
string
|
|
Type of metadata. Eg: 'org.id3' or 'com.apple.quicktime.HLS' |
payload |
shaka.extern.MetadataFrame
|
|
The metadata itself |
- Source:
Midpoint
Fires when the content playhead crosses midpoint.
Only for VoD.
Properties:
Name |
Type |
Description |
type |
string
|
'midpoint' |
- Source:
NoSpatialVideoInfoEvent
Fired when the video no longer has spatial video information.
For it to be fired, the shaka.Player.SpatialVideoInfoEvent event must
have been previously fired.
Properties:
Name |
Type |
Description |
type |
string
|
'nospatialvideoinfo' |
- Source:
ProducerReferenceTimeEvent
Fired when the content includes ProducerReferenceTime (PRFT)
info.
Properties:
- Source:
RateChangeEvent
Fired when the video's playback rate changes.
This allows the PlayRateController to update it's internal rate field,
before the UI updates playback button with the newest playback rate.
Properties:
Name |
Type |
Description |
type |
string
|
'ratechange' |
- Source:
SegmentAppended
Fired when a segment is appended to the media element.
Properties:
Name |
Type |
Description |
type |
string
|
'segmentappended' |
start |
number
|
The start time of the segment. |
end |
number
|
The end time of the segment. |
contentType |
string
|
The content type of the segment. E.g. 'video', 'audio', or 'text'. |
isMuxed |
boolean
|
Indicates if the segment is muxed (audio + video). |
- Source:
SessionDataEvent
Fired when the manifest parser find info about session data.
Specification: https://tools.ietf.org/html/rfc8216#section-4.3.4.4
Properties:
Name |
Type |
Description |
type |
string
|
'sessiondata' |
id |
string
|
The id of the session data. |
uri |
string
|
The uri with the session data info. |
language |
string
|
The language of the session data. |
value |
string
|
The value of the session data. |
- Source:
SpatialVideoInfoEvent
Fired when the video has spatial video info. If a previous
event was fired, this include the new info.
Properties:
- Source:
StallDetectedEvent
Fired when a stall in playback is detected by the StallDetector.
Not all stalls are caused by gaps in the buffered ranges.
An app may want to look at getStats()
to see what happened.
Properties:
Name |
Type |
Description |
type |
string
|
'stalldetected' |
- Source:
Started
Fires when the content starts playing.
Only for VoD.
Properties:
Name |
Type |
Description |
type |
string
|
'started' |
- Source:
StateChanged
Fired when player state is changed.
Properties:
Name |
Type |
Description |
type |
string
|
'statechanged' |
newstate |
string
|
The new state. |
- Source:
StateChangeEvent
Fired when the player changes load states.
Properties:
Name |
Type |
Description |
type |
string
|
'onstatechange' |
state |
string
|
The name of the state that the player just entered. |
- 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:
TextChangedEvent
Fired when a call from the application caused a text stream
change. Can be triggered by calls to selectTextTrack()
or
selectTextLanguage()
.
An app may want to look at getStats()
or
getTextTracks()
to see what happened.
Properties:
Name |
Type |
Description |
type |
string
|
'textchanged' |
- Source:
TextTrackVisibilityEvent
Fired when text track visibility changes.
An app may want to look at getStats()
or
getVariantTracks()
to see what happened.
Properties:
Name |
Type |
Description |
type |
string
|
'texttrackvisibility' |
- Source:
ThirdQuartile
Fires when the content playhead crosses third quartile.
Only for VoD.
Properties:
Name |
Type |
Description |
type |
string
|
'thirdquartile' |
- Source:
TimelineRegionAddedEvent
Fired when a media timeline region is added.
Properties:
- Source:
TimelineRegionEnterEvent
Fired when the playhead enters a timeline region.
Properties:
- Source:
TimelineRegionExitEvent
Fired when the playhead exits a timeline region.
Properties:
- Source:
TracksChangedEvent
Fired when the list of tracks changes. For example, this will
happen when new tracks are added/removed or when track restrictions change.
An app may want to look at getVariantTracks()
to see what
happened.
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:
VariantChangedEvent
Fired when a call from the application caused a variant change.
Can be triggered by calls to selectVariantTrack()
or
selectAudioLanguage()
. Does not fire when an automatic
adaptation causes a variant change.
An app may want to look at getStats()
or
getVariantTracks()
to see what happened.
Properties:
- Source: