Class: shaka.extern

Classes

IUIElement
IUIRangeElement
IUISettingsMenu

Interfaces

AbrManager
Cue
CueRegion
EmeSessionStorageCell
Error
IAbortableOperation
ManifestParser
StorageCell
StorageMechanism
TextDisplayer
TextParser

Type Definitions

AbrConfiguration

Type:
  • {enabled: boolean, defaultBandwidthEstimate: number, restrictions: shaka.extern.Restrictions, switchInterval: number, bandwidthUpgradeTarget: number, bandwidthDowngradeTarget: number}
Properties:
Name Type Description
enabled boolean If true, enable adaptation by the current AbrManager. Defaults to true.
defaultBandwidthEstimate number The default bandwidth estimate to use if there is not enough data, in bit/sec.
restrictions shaka.extern.Restrictions The restrictions to apply to ABR decisions. These are "soft" restrictions. Any track that fails to meet these restrictions will not be selected automatically, but will still appear in the track list and can still be selected via selectVariantTrack(). If no tracks meet these restrictions, AbrManager should not fail, but choose a low-res or low-bandwidth variant instead. It is the responsibiliy of AbrManager implementations to follow these rules and implement this behavior.
switchInterval number The minimum amount of time that must pass between switches, in seconds. This keeps us from changing too often and annoying the user.
bandwidthUpgradeTarget number The fraction of the estimated bandwidth which we should try to use when upgrading.
bandwidthDowngradeTarget number The largest fraction of the estimated bandwidth we should use. We should downgrade to avoid this.
Source:

AdvancedDrmConfiguration

Type:
  • {distinctiveIdentifierRequired: boolean, persistentStateRequired: boolean, videoRobustness: string, audioRobustness: string, serverCertificate: Uint8Array, individualizationServer: string}
Properties:
Name Type Description
distinctiveIdentifierRequired boolean Defaults to false.
True if the application requires the key system to support distinctive identifiers.
persistentStateRequired boolean Defaults to false.
True if the application requires the key system to support persistent state, e.g., for persistent license storage.
videoRobustness string A key-system-specific string that specifies a required security level for video. Defaults to '', i.e., no specific robustness required.
audioRobustness string A key-system-specific string that specifies a required security level for audio. Defaults to '', i.e., no specific robustness required.
serverCertificate Uint8Array Defaults to null.
An empty certificate (byteLength==0) will be treated as null.
A certificate will be requested from the license server if required.
A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
individualizationServer string The server that handles an 'individualiation-request'. If the server isn't given, it will default to the license server.
Source:

BufferedInfo

Contains information about the current buffered ranges.
Type:
Properties:
Name Type Description
total Array.<shaka.extern.BufferedRange> The combined audio/video buffered ranges, reported by video.buffered.
audio Array.<shaka.extern.BufferedRange> The buffered ranges for audio content.
video Array.<shaka.extern.BufferedRange> The buffered ranges for video content.
text Array.<shaka.extern.BufferedRange> The buffered ranges for text content.
Source:

BufferedRange

Contains the times of a range of buffered content.
Type:
  • {start: number, end: number}
Properties:
Name Type Description
start number The start time of the range, in seconds.
end number The end time of the range, in seconds.
Source:

CreateSegmentIndexFunction

Creates a SegmentIndex; returns a Promise that resolves after the SegmentIndex has been created.
Type:
  • function(): !Promise
Source:

DashContentProtectionCallback

Type:
Source:
See:

DashManifestConfiguration

Type:
  • {customScheme: shaka.extern.DashContentProtectionCallback, clockSyncUri: string, ignoreDrmInfo: boolean, xlinkFailGracefully: boolean, defaultPresentationDelay: number, ignoreMinBufferTime: boolean, autoCorrectDrift: boolean, ignoreSuggestedPresentationDelay: boolean, ignoreEmptyAdaptationSet: boolean}
Properties:
Name Type Description
customScheme shaka.extern.DashContentProtectionCallback If given, invoked by a DASH manifest parser to interpret custom or non-standard DRM schemes found in the manifest. The argument is a ContentProtection node. Return null if not recognized.
clockSyncUri string A default clock sync URI to be used with live streams which do not contain any clock sync information. The Date header from this URI will be used to determine the current time.
ignoreDrmInfo boolean If true will cause DASH parser to ignore DRM information specified by the manifest and treat it as if it signaled no particular key system and contained no init data. Defaults to false if not provided.
xlinkFailGracefully boolean If true, xlink-related errors will result in a fallback to the tag's existing contents. If false, xlink-related errors will be propagated to the application and will result in a playback failure. Defaults to false if not provided.
defaultPresentationDelay number A default presentationDelay if suggestedPresentationDelay is missing in the MPEG DASH manifest. This has to be bigger than minBufferTime * 1.5.
ignoreMinBufferTime boolean If true will cause DASH parser to ignore minBufferTime from manifest. It allows player config to take precedence over manifest for rebufferingGoal. Defaults to false if not provided.
autoCorrectDrift boolean If true, ignore the availabilityStartTime in the manifest and instead use the segments to determine the live edge. This allows us to play streams that have a lot of drift. If false, we can't play content where the manifest specifies segments in the future. Defaults to true.
ignoreSuggestedPresentationDelay boolean If true will cause DASH parser to ignore suggestedPresentationDelay from manifest. Defaults to false if not provided.
ignoreEmptyAdaptationSet boolean If true will cause DASH parser to ignore empty AdaptationSet from manifest. Defaults to false if not provided.
Source:

DrmConfiguration

Type:
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for license requests.
servers Object.<string, string> Required for all but the clear key CDM.
A dictionary which maps key system IDs to their license servers. For example, {'com.widevine.alpha': 'https://example.com/drm'}.
clearKeys Object.<string, string> Forces the use of the Clear Key CDM. A map of key IDs (hex) to keys (hex).
delayLicenseRequestUntilPlayed boolean Defaults to false.
True to configure drm to delay sending a license request until a user actually starts playing content.
advanced Object.<string, shaka.extern.AdvancedDrmConfiguration> Optional.
A dictionary which maps key system IDs to advanced DRM configuration for those key systems.
initDataTransform function | undefined Optional.
If given, this function is called with the init data from the manifest/media and should return the (possibly transformed) init data to pass to the browser.
fairPlayTransform boolean Optional.
Temporary, for v2.5.x only.
If true, transform the FairPlay license request/response according to the FairPlay examples; if false, don't transform. Defaults to true. Starting in v3.0 this will go away and we will never provide default license request/response transforms.
updateExpirationTime number Defaults to 1.
The frequency in seconds with which to check the expiration of a session.
Source:

DrmInfo

DRM configuration for a single key system.
Type:
  • {keySystem: string, licenseServerUri: string, distinctiveIdentifierRequired: boolean, persistentStateRequired: boolean, audioRobustness: string, videoRobustness: string, serverCertificate: Uint8Array, initData: Array.<!shaka.extern.InitDataOverride>, keyIds: Array.<string>}
Properties:
Name Type Description
keySystem string Required.
The key system, e.g., "com.widevine.alpha".
licenseServerUri string Filled in by DRM config if missing.
The license server URI.
distinctiveIdentifierRequired boolean Defaults to false. Can be filled in by advanced DRM config.
True if the application requires the key system to support distinctive identifiers.
persistentStateRequired boolean Defaults to false. Can be filled in by advanced DRM config.
True if the application requires the key system to support persistent state, e.g., for persistent license storage.
audioRobustness string Defaults to '', e.g., no specific robustness required. Can be filled in by advanced DRM config.
A key-system-specific string that specifies a required security level.
videoRobustness string Defaults to '', e.g., no specific robustness required. Can be filled in by advanced DRM config.
A key-system-specific string that specifies a required security level.
serverCertificate Uint8Array Defaults to null, e.g., certificate will be requested from the license server if required. Can be filled in by advanced DRM config.
A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
initData Array.<!shaka.extern.InitDataOverride> Defaults to [], e.g., no override.
A list of initialization data which override any initialization data found in the content. See also shaka.extern.InitDataOverride.
keyIds Array.<string> Defaults to []
If not empty, contains the default key IDs for this key system, as lowercase hex strings.
Source:

DrmSupportType

Type:
  • {persistentState: boolean}
Properties:
Name Type Description
persistentState boolean Whether this key system supports persistent state.
Source:

EmeSessionDB

Type:
  • {sessionId: string, keySystem: string, licenseUri: string, serverCertificate: Uint8Array, audioCapabilities: !Array.<MediaKeySystemMediaCapability>, videoCapabilities: !Array.<MediaKeySystemMediaCapability>}
Properties:
Name Type Description
sessionId string The EME session ID.
keySystem string The EME key system string the session belongs to.
licenseUri string The URI for the license server.
serverCertificate Uint8Array A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
audioCapabilities Array.<MediaKeySystemMediacapability> The EME audio capabilities used to create the session.
videoCapabilities Array.<MediaKeySystemMediacapability> The EME video capabilities used to create the session.
Source:

EmsgInfo

Contains information about an EMSG MP4 box.
Type:
  • {schemeIdUri: string, value: string, startTime: number, endTime: number, timescale: number, presentationTimeDelta: number, eventDuration: number, id: number, messageData: Uint8Array}
Properties:
Name Type Description
schemeIdUri string Identifies the message scheme.
value string Specifies the value for the event.
startTime number The time that the event starts (in presentation time).
endTime number The time that the event ends (in presentation time).
timescale number Provides the timescale, in ticks per second.
presentationTimeDelta number The offset that the event starts, relative to the start of the segment this is contained in (in units of timescale).
eventDuration number The duration of the event (in units of timescale).
id number A field identifying this instance of the message.
messageData Uint8Array Body of the message.
Source:

FindSegmentPositionFunction

Finds the position of the segment for the given time, in seconds, relative to the start of a particular Period; returns null if the position of the segment could not be determined. Note: the position of a segment is unique only among segments within the same Period.
Type:
  • function(number): ?number
Source:

GetSegmentReferenceFunction

Gets the SegmentReference for the segment at the given position; returns null if no such SegmentReference exists. Note: the position of a segment is unique only among segments within the same Period.
Type:
  • function(number): shaka.media.SegmentReference
Source:

HlsManifestConfiguration

Type:
  • {ignoreTextStreamFailures: boolean, useFullSegmentsForStartTime: boolean}
Properties:
Name Type Description
ignoreTextStreamFailures boolean If true, ignore any errors in a text stream and filter out those streams.
useFullSegmentsForStartTime boolean If true, force HlsParser to use a full segment request for determining start time in case the server does not support partial requests
Source:

InitDataOverride

Explicit initialization data, which override any initialization data in the content. The initDataType values and the formats that they correspond to are specified here.
Type:
  • {initData: !Uint8Array, initDataType: string, keyId: ?string}
Properties:
Name Type Attributes Description
initData Uint8Array Initialization data in the format indicated by initDataType.
initDataType string A string to indicate what format initData is in.
keyId string <nullable>
The key Id that corresponds to this initData.
Source:

LanguageRole

Type:
  • {language: string, role: string}
Properties:
Name Type Description
language string The language code for the stream.
role string The role name for the stream. If the stream has no role, role will be ''.
Source:

Manifest

A Manifest object describes a collection of streams (segmented audio, video, or text data) that share a common timeline. We call the collection of streams "the presentation" and their timeline "the presentation timeline". A Manifest describes one of two types of presentations: live and video-on-demand.

A live presentation begins at some point in time and either continues indefinitely or ends when the presentation stops broadcasting. For a live presentation, wall-clock time maps onto the presentation timeline, and the current wall-clock time maps to the live-edge (AKA "the current presentation time"). In contrast, a video-on-demand presentation exists entirely independent of wall-clock time.

The presentation timeline is divided into one or more Periods, and each of these Periods contains its own collection of Variants and text streams. A variant is a combination of an audio and a video streams that can be played together.

A stream has the same logical content as another stream if the only difference between the two is their quality. For example, an SD video stream and an HD video stream that depict the same scene have the same logical content; whereas an English audio stream and a French audio stream have different logical contents. The player can automatically switch between streams which have the same logical content to adapt to network conditions.

Type:
Properties:
Name Type Description
presentationTimeline shaka.media.PresentationTimeline Required.
The presentation timeline.
periods Array.<!shaka.extern.Period> Required.
The presentation's Periods. There must be at least one Period.
offlineSessionIds Array.<string> Defaults to [].
An array of EME sessions to load for offline playback.
minBufferTime number Defaults to 0.
The minimum number of seconds of content that must be buffered before playback can begin. Can be overridden by a higher value from the Player configuration.
Source:

ManifestConfiguration

Type:
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for manifest requests.
availabilityWindowOverride number A number, in seconds, that overrides the availability window in the manifest, or NaN if the default value should be used. This is enforced by the manifest parser, so custom manifest parsers should take care to honor this parameter.
disableAudio boolean If true, the audio tracks are ignored. Defaults to false.
disableVideo boolean If true, the video tracks are ignored. Defaults to false.
disableText boolean If true, the text tracks are ignored. Defaults to false.
dash shaka.extern.DashManifestConfiguration Advanced parameters used by the DASH manifest parser.
hls shaka.extern.HlsManifestConfiguration Advanced parameters used by the HLS manifest parser.
Source:

ManifestDB

Type:
  • {originalManifestUri: string, duration: number, size: number, expiration: number, periods: !Array.<shaka.extern.PeriodDB>, sessionIds: !Array.<string>, drmInfo: ?shaka.extern.DrmInfo, appMetadata: Object}
Properties:
Name Type Attributes Description
originalManifestUri string The URI that the manifest was originally loaded from.
duration number The total duration of the media, in seconds.
size number The total size of all stored segments, in bytes.
expiration number The license expiration, in milliseconds; or Infinity if not applicable. Note that upon JSON serialization, Infinity becomes null, and must be converted back upon loading from storage.
periods Array.<shaka.extern.PeriodDB> The Periods that are stored.
sessionIds Array.<string> The DRM offline session IDs for the media.
drmInfo shaka.extern.DrmInfo <nullable>
The DRM info used to initialize EME.
appMetadata Object A metadata object passed from the application.
Source:

ManifestDBV1

Type:
  • {key: number, originalManifestUri: string, duration: number, size: number, expiration: number, periods: !Array.<shaka.extern.PeriodDBV1>, sessionIds: !Array.<string>, drmInfo: ?shaka.extern.DrmInfo, appMetadata: Object}
Properties:
Name Type Attributes Description
key number A unique key to identify this item.
originalManifestUri string The URI that the manifest was originally loaded from.
duration number The total duration of the media, in seconds.
size number The total size of all stored segments, in bytes.
expiration number The license expiration, in milliseconds; or Infinity if not applicable. Note that upon JSON serialization, Infinity becomes null, and must be converted back upon loading from storage.
periods Array.<shaka.extern.PeriodDBV1> The Periods that are stored.
sessionIds Array.<string> The DRM offline session IDs for the media.
drmInfo shaka.extern.DrmInfo <nullable>
The DRM info used to initialize EME.
appMetadata Object A metadata object passed from the application.
Source:

OfflineConfiguration

Type:
Properties:
Name Type Description
trackSelectionCallback function Called inside store() to determine which tracks to save from a manifest. It is passed an array of Tracks from the manifest and it should return an array of the tracks to store. This is called for each Period in the manifest (in order).
progressCallback function Called inside store() to give progress info back to the app. It is given the current manifest being stored and the progress of it being stored.
usePersistentLicense boolean If true, store protected content with a persistent license so that no network is required to view. If false, store protected content without a persistent license. A network will be required to retrieve a temporary license to view. Defaults to true.
Source:

OfflineSupport

Type:
  • {basic: boolean, encrypted: !Object.<string, boolean>}
Properties:
Name Type Description
basic boolean True if offline is usable at all.
encrypted Object.<string, boolean> A map of key system name to whether it supports offline playback.
Source:

ParsedBox

Type:
Properties:
Name Type Attributes Description
parser shaka.util.Mp4Parser The parser that parsed this box. The parser can be used to parse child boxes where the configuration of the current parser is needed to parsed other boxes.
partialOkay boolean If true, allows reading partial payloads from some boxes. If the goal is a child box, we can sometimes find it without enough data to find all child boxes. This property allows the partialOkay flag from parse() to be propagated through methods like children().
start number The start of this box (before the header) in the original buffer. This start position is the absolute position.
size number The size of this box (including the header).
version number <nullable>
The version for a full box, null for basic boxes.
flags number <nullable>
The flags for a full box, null for basic boxes.
reader shaka.util.DataViewReader The reader for this box is only for this box. Reading or not reading to the end will have no affect on the parser reading other sibling boxes.
has64BitSize boolean If true, the box header had a 64-bit size field. This affects the offsets of other fields.
Source:

Period

A Period object contains the Streams for part of the presentation.
Type:
Properties:
Name Type Description
startTime number Required.
The Period's start time, in seconds, relative to the start of the presentation. The first Period must begin at the start of the presentation. The Period ends immediately before the next Period's start time or exactly at the end of the presentation timeline. Periods which begin after the end of the presentation timeline are ignored.
variants Array.<shaka.extern.Variant> Required.
The Period's Variants. There must be at least one Variant.
textStreams Array.<shaka.extern.Stream> Required.
The Period's text streams.
Source:

PeriodDB

Type:
Properties:
Name Type Description
startTime number The start time of the period, in seconds.
streams Array.<shaka.extern.StreamDB> The streams that define the Period.
Source:

PeriodDBV1

Type:
Properties:
Name Type Description
startTime number The start time of the period, in seconds.
streams Array.<shaka.extern.StreamDBV1> The streams that define the Period.
Source:

PlayerConfiguration

Type:
Properties:
Name Type Description
drm shaka.extern.DrmConfiguration DRM configuration and settings.
manifest shaka.extern.ManifestConfiguration Manifest configuration and settings.
streaming shaka.extern.StreamingConfiguration Streaming configuration and settings.
abrFactory shaka.extern.AbrManager.Factory A factory to construct an abr manager.
abr shaka.extern.AbrConfiguration ABR configuration and settings.
offline shaka.extern.OfflineConfiguration Offline configuration and settings.
preferredAudioLanguage string The preferred language to use for audio tracks. If not given it will use the 'main' track. Changing this during playback will not affect the current playback.
preferredTextLanguage string The preferred language to use for text tracks. If a matching text track is found, and the selected audio and text tracks have different languages, the text track will be shown. Changing this during playback will not affect the current playback.
preferredVariantRole string The preferred role to use for variants.
preferredTextRole string The preferred role to use for text tracks.
preferredAudioChannelCount number The preferred number of audio channels.
restrictions shaka.extern.Restrictions The application restrictions to apply to the tracks. These are "hard" restrictions. Any track that fails to meet these restrictions will not appear in the track list. If no tracks meet these restrictions, playback will fail.
playRangeStart number Optional playback and seek start time in seconds. Defaults to 0 if not provided.
playRangeEnd number Optional playback and seek end time in seconds. Defaults to the end of the presentation if not provided.
textDisplayFactory shaka.extern.TextDisplayer.Factory A factory to construct text displayer. Note that, if this is changed during playback, it will cause the text tracks to be reloaded.
Source:

ProgressUpdated

A callback function to handle progress event through networking engine in player. The first argument is a number for duration in milliseconds, that the request took to complete. The second argument is the total number of bytes downloaded during that time. The third argument is the number of bytes remaining to be loaded in a segment.
Type:
  • function(number, number, number)
Source:

Request

Defines a network request. This is passed to one or more request filters that may alter the request, then it is passed to a scheme plugin which performs the actual operation.
Type:
  • {uris: !Array.<string>, method: string, body: ArrayBuffer, headers: !Object.<string, string>, allowCrossSiteCredentials: boolean, retryParameters: !shaka.extern.RetryParameters, licenseRequestType: ?string, sessionId: ?string}
Properties:
Name Type Attributes Description
uris Array.<string> An array of URIs to attempt. They will be tried in the order they are given.
method string The HTTP method to use for the request.
body ArrayBuffer The body of the request.
headers Object.<string, string> A mapping of headers for the request. e.g.: {'HEADER': 'VALUE'}
allowCrossSiteCredentials boolean Make requests with credentials. This will allow cookies in cross-site requests. See https://bit.ly/CorsCred.
retryParameters shaka.extern.RetryParameters An object used to define how often to make retries.
licenseRequestType string <nullable>
If this is a LICENSE request, this field contains the type of license request it is (not the type of license). This is the |messageType| field of the EME message. For example, this could be 'license-request' or 'license-renewal'.
sessionId string <nullable>
If this is a LICENSE request, this field contains the session ID of the EME session that made the request.
Source:

RequestFilter

Defines a filter for requests. This filter takes the request and modifies it before it is sent to the scheme plugin. A request filter can run asynchronously by returning a promise; in this case, the request will not be sent until the promise is resolved.
Type:
Source:

Response

Defines a response object. This includes the response data and header info. This is given back from the scheme plugin. This is passed to a response filter before being returned from the request call.
Type:
  • {uri: string, data: ArrayBuffer, headers: !Object.<string, string>, timeMs: (number|undefined), fromCache: (boolean|undefined)}
Properties:
Name Type Description
uri string The URI which was loaded. Request filters and server redirects can cause this to be different from the original request URIs.
originalUri string The original URI passed to the browser for networking. This is before any redirects, but after request filters are executed.
data ArrayBuffer The body of the response.
headers Object.<string, string> A map of response headers, if supported by the underlying protocol. All keys should be lowercased. For HTTP/HTTPS, may not be available cross-origin.
timeMs number | undefined Optional. The time it took to get the response, in miliseconds. If not given, NetworkingEngine will calculate it using Date.now.
fromCache boolean | undefined Optional. If true, this response was from a cache and should be ignored for bandwidth estimation.
Source:

ResponseFilter

Defines a filter for responses. This filter takes the response and modifies it before it is returned. A response filter can run asynchronously by returning a promise.
Type:
Source:

RestrictionInfo

Type:
  • {hasAppRestrictions: boolean, missingKeys: !Array.<string>, restrictedKeyStatuses: !Array.<string>}
Properties:
Name Type Description
hasAppRestrictions boolean Whether there are streams that are restricted due to app-provided restrictions.
missingKeys Array.<string> The key IDs that were missing.
restrictedKeyStatuses Array.<string> The restricted EME key statuses that the streams had. For example, 'output-restricted' would mean streams couldn't play due to restrictions on the output device (e.g. HDCP).
Source:

Restrictions

An object describing application restrictions on what tracks can play. All restrictions must be fulfilled for a track to be playable/selectable. The restrictions system behaves somewhat differently at the ABR level and the player level, so please refer to the documentation for those specific settings.
Type:
  • {minWidth: number, maxWidth: number, minHeight: number, maxHeight: number, minPixels: number, maxPixels: number, minFrameRate: number, maxFrameRate: number, minBandwidth: number, maxBandwidth: number}
Properties:
Name Type Description
minWidth number The minimum width of a video track, in pixels.
maxWidth number The maximum width of a video track, in pixels.
minHeight number The minimum height of a video track, in pixels.
maxHeight number The maximum height of a video track, in pixels.
minPixels number The minimum number of total pixels in a video track (i.e. width * height).
maxPixels number The maximum number of total pixels in a video track (i.e. width * height).
minFrameRate number The minimum framerate of a variant track.
maxFrameRate number The maximum framerate of a variant track.
minBandwidth number The minimum bandwidth of a variant track, in bit/sec.
maxBandwidth number The maximum bandwidth of a variant track, in bit/sec.
Source:
See:

RetryParameters

Parameters for retrying requests.
Type:
  • {maxAttempts: number, baseDelay: number, backoffFactor: number, fuzzFactor: number, timeout: number}
Properties:
Name Type Description
maxAttempts number The maximum number of times the request should be attempted.
baseDelay number The delay before the first retry, in milliseconds.
backoffFactor number The multiplier for successive retry delays.
fuzzFactor number The maximum amount of fuzz to apply to each retry delay. For example, 0.5 means "between 50% below and 50% above the retry delay."
timeout number The request timeout, in milliseconds. Zero means "unlimited".
Source:
Tutorials:

SchemePlugin

Defines a plugin that handles a specific scheme. The functions accepts four parameters, uri string, request, request type, and a progressUpdated function. The progressUpdated function can be ignored by plugins that do not have this information, but it will always be provided by NetworkingEngine.
Type:
Source:

SegmentDataDB

Type:
  • {data: !ArrayBuffer}
Properties:
Name Type Description
data ArrayBuffer The data contents of the segment.
Source:

SegmentDataDBV1

Type:
  • {key: number, data: !ArrayBuffer}
Properties:
Name Type Description
key number A unique key to identify this item.
data ArrayBuffer The data contents of the segment.
Source:

SegmentDB

Type:
  • {startTime: number, endTime: number, dataKey: number}
Properties:
Name Type Description
startTime number The start time of the segment, in seconds from the start of the Period.
endTime number The end time of the segment, in seconds from the start of the Period.
dataKey number The key to the data in storage.
Source:

SegmentDBV1

Type:
  • {startTime: number, endTime: number, uri: string}
Properties:
Name Type Description
startTime number The start time of the segment, in seconds from the start of the Period.
endTime number The end time of the segment, in seconds from the start of the Period.
uri string The offline URI of the segment.
Source:

StateChange

Type:
  • {timestamp: number, state: string, duration: number}
Properties:
Name Type Description
timestamp number The timestamp the state was entered, in seconds since 1970 (i.e. Date.now() / 1000).
state string The state the player entered. This could be 'buffering', 'playing', 'paused', or 'ended'.
duration number The number of seconds the player was in this state. If this is the last entry in the list, the player is still in this state, so the duration will continue to increase.
Source:

Stats

Contains statistics and information about the current state of the player. This is meant for applications that want to log quality-of-experience (QoE) or other stats. These values will reset when load() is called again.
Type:
  • {width: number, height: number, streamBandwidth: number, decodedFrames: number, droppedFrames: number, corruptedFrames: number, estimatedBandwidth: number, loadLatency: number, playTime: number, pauseTime: number, bufferingTime: number, licenseTime: number, switchHistory: !Array.<shaka.extern.TrackChoice>, stateHistory: !Array.<shaka.extern.StateChange>}
Properties:
Name Type Description
width number The width of the current video track.
height number The height of the current video track.
streamBandwidth number The bandwidth required for the current streams (total, in bit/sec).
decodedFrames number The total number of frames decoded by the Player. This may be NaN if this is not supported by the browser.
droppedFrames number The total number of frames dropped by the Player. This may be NaN if this is not supported by the browser.
corruptedFrames number The total number of corrupted frames dropped by the browser. This may be NaN if this is not supported by the browser.
estimatedBandwidth number The current estimated network bandwidth (in bit/sec).
loadLatency number This is the number of seconds it took for the video element to have enough data to begin playback. This is measured from the time load() is called to the time the 'loadeddata' event is fired by the media element.
playTime number The total time spent in a playing state in seconds.
pauseTime number The total time spent in a paused state in seconds.
bufferingTime number The total time spent in a buffering state in seconds.
licenseTime number The time spent on license requests during this session in seconds, or NaN.
switchHistory Array.<shaka.extern.TrackChoice> A history of the stream changes.
stateHistory Array.<shaka.extern.StateChange> A history of the state changes.
Source:

StoredContent

Type:
  • {offlineUri: ?string, originalManifestUri: string, duration: number, size: number, expiration: number, tracks: !Array.<shaka.extern.Track>, appMetadata: Object}
Properties:
Name Type Attributes Description
offlineUri string <nullable>
An offline URI to access the content. This can be passed directly to Player. If the uri is null, it means that the content has not finished downloading and is not ready to play.
originalManifestUri string The original manifest URI of the content stored.
duration number The duration of the content, in seconds.
size number The size of the content, in bytes.
expiration number The time that the encrypted license expires, in milliseconds. If the media is clear or the license never expires, this will equal Infinity.
tracks Array.<shaka.extern.Track> The tracks that are stored. This only lists those found in the first Period.
appMetadata Object The metadata passed to store().
Source:

Stream

A Stream object describes a single stream (segmented media data).
Type:
Properties:
Name Type Attributes Description
id number Required.
A unique ID among all Stream objects within the same Manifest.
originalId string <nullable>
Optional.
The original ID, if any, that appeared in the manifest. For example, in DASH, this is the "id" attribute of the Representation element. In HLS, this is the "NAME" attribute.
createSegmentIndex shaka.extern.CreateSegmentIndexFunction Required.
Creates the Stream's SegmentIndex (asynchronously).
findSegmentPosition shaka.extern.FindSegmentPositionFunction Required.
Finds the position of the segment for the given time. The caller must call createSegmentIndex() and wait until the returned Promise resolves before calling this function.
getSegmentReference shaka.extern.GetSegmentReferenceFunction Required.
Gets the SegmentReference for the segment at the given position. The caller must call createSegmentIndex() and wait until the returned Promise resolves before calling this function.
initSegmentReference shaka.media.InitSegmentReference The Stream's initialization segment metadata, or null if the segments are self-initializing.
presentationTimeOffset number | undefined Defaults to 0.
The amount of time, in seconds, that the stream's presentation timestamps are offset from the start of the Stream's Period, i.e., this value should equal the first presentation timestamp of the first frame/sample in the period.

For example, for MP4 based streams, this value should equal the first segment's tfdt box's 'baseMediaDecodeTime' field (after it has been converted to seconds).
mimeType string Required.
The Stream's MIME type, e.g., 'audio/mp4', 'video/webm', or 'text/vtt'.
codecs string Defaults to '' (i.e., unknown / not needed).
The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be compatible with the Stream's MIME type.
See https://tools.ietf.org/html/rfc6381
frameRate number | undefined Video streams only.
The Stream's framerate in frames per second
pixelAspectRatio string | undefined Video streams only.
The Stream's pixel aspect ratio
bandwidth number | undefined Audio and video streams only.
The stream's required bandwidth in bits per second.
width number | undefined Video streams only.
The stream's width in pixels.
height number | undefined Video streams only.
The stream's height in pixels.
kind string | undefined Text streams only.
The kind of text stream. For example, 'caption' or 'subtitle'.
encrypted boolean Defaults to false.
True if the stream is encrypted.
keyId string <nullable>
Defaults to null (i.e., unencrypted or key ID unknown).
The stream's key ID as a lowercase hex string. This key ID identifies the encryption key that the browser (key system) can use to decrypt the stream.
language string The Stream's language, specified as a language code.
Audio stream's language must be identical to the language of the containing Variant.
label string <nullable>
The Stream's label, unique text that should describe the audio/text track.
type string Required.
Content type (e.g. 'video', 'audio' or 'text')
primary boolean Defaults to false.
True indicates that the player should prefer this Stream over others in the same Period. The player may still use another Stream to meet application preferences.
trickModeVideo shaka.extern.Stream <nullable>
Video streams only.
An alternate video stream to use for trick mode playback.
emsgSchemeIdUris Array.<string> <nullable>
Defaults to empty.
Array of registered emsg box scheme_id_uri that should result in Player events.
roles Array.<string> The roles of the stream as they appear on the manifest, e.g. 'main', 'caption', or 'commentary'.
channelsCount number <nullable>
The channel count information for the audio stream.
audioSamplingRate number <nullable>
Specifies the maximum sampling rate of the content.
closedCaptions Map.<string, string> A map containing the description of closed captions, with the caption channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code as the value. If the channel number is not provided by the description, we'll set an 0-based index as the key. Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
Source:
See:

StreamDB

Type:
  • {id: number, originalId: ?string, primary: boolean, presentationTimeOffset: number, contentType: string, mimeType: string, codecs: string, frameRate: (number|undefined), pixelAspectRatio: (string|undefined), kind: (string|undefined), language: string, label: ?string, width: ?number, height: ?number, initSegmentKey: ?number, encrypted: boolean, keyId: ?string, segments: !Array.<shaka.extern.SegmentDB>, variantIds: !Array.<number>}
Properties:
Name Type Attributes Description
id number The unique id of the stream.
originalId string <nullable>
The original ID, if any, that appeared in the manifest. For example, in DASH, this is the "id" attribute of the Representation element.
primary boolean Whether the stream set was primary.
presentationTimeOffset number The presentation time offset of the stream, in seconds.
contentType string The type of the stream, 'audio', 'text', or 'video'.
mimeType string The MIME type of the stream.
codecs string The codecs of the stream.
frameRate number | undefined The Stream's framerate in frames per second.
pixelAspectRatio string | undefined The Stream's pixel aspect ratio
kind string | undefined The kind of text stream; undefined for audio/video.
language string The language of the stream; '' for video.
label string <nullable>
The label of the stream; '' for video.
width number <nullable>
The width of the stream; null for audio/text.
height number <nullable>
The height of the stream; null for audio/text.
initSegmentKey number <nullable>
The storage key where the init segment is found; null if no init segment.
encrypted boolean Whether this stream is encrypted.
keyId string <nullable>
The key ID this stream is encrypted with.
segments Array.<shaka.extern.SegmentDB> An array of segments that make up the stream.
variantIds Array.<number> An array of ids of variants the stream is a part of.
Source:

StreamDBV1

Type:
  • {id: number, primary: boolean, presentationTimeOffset: number, contentType: string, mimeType: string, codecs: string, frameRate: (number|undefined), kind: (string|undefined), language: string, label: ?string, width: ?number, height: ?number, initSegmentUri: ?string, encrypted: boolean, keyId: ?string, segments: !Array.<shaka.extern.SegmentDBV1>, variantIds: !Array.<number>}
Properties:
Name Type Attributes Description
id number The unique id of the stream.
primary boolean Whether the stream set was primary.
presentationTimeOffset number The presentation time offset of the stream, in seconds. Note that this is the inverse of the timestampOffset as defined in the manifest types.
contentType string The type of the stream, 'audio', 'text', or 'video'.
mimeType string The MIME type of the stream.
codecs string The codecs of the stream.
frameRate number | undefined The Stream's framerate in frames per second.
kind string | undefined The kind of text stream; undefined for audio/video.
language string The language of the stream; '' for video.
label string <nullable>
The label of the stream; '' for video.
width number <nullable>
The width of the stream; null for audio/text.
height number <nullable>
The height of the stream; null for audio/text.
initSegmentUri number <nullable>
The offline URI where the init segment is found; null if no init segment.
encrypted boolean Whether this stream is encrypted.
keyId string <nullable>
The key ID this stream is encrypted with.
segments Array.<shaka.extern.SegmentDBV1> An array of segments that make up the stream.
variantIds Array.<number> An array of ids of variants the stream is a part of.
Source:

StreamingConfiguration

The StreamingEngine's configuration options.
Type:
  • {retryParameters: shaka.extern.RetryParameters, failureCallback: function(!shaka.util.Error), rebufferingGoal: number, bufferingGoal: number, bufferBehind: number, ignoreTextStreamFailures: boolean, alwaysStreamText: boolean, startAtSegmentBoundary: boolean, smallGapLimit: number, jumpLargeGaps: boolean, durationBackoff: number, forceTransmuxTS: boolean, safeSeekOffset: number, stallEnabled: boolean, stallThreshold: number, stallSkip: number, useNativeHlsOnSafari: boolean}
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for segment requests.
failureCallback function A callback to decide what to do on a streaming failure. Default behavior is to retry on live streams and not on VOD.
rebufferingGoal number The minimum number of seconds of content that the StreamingEngine must buffer before it can begin playback or can continue playback after it has entered into a buffering state (i.e., after it has depleted one more more of its buffers).
bufferingGoal number The number of seconds of content that the StreamingEngine will attempt to buffer ahead of the playhead. This value must be greater than or equal to the rebuffering goal.
bufferBehind number The maximum number of seconds of content that the StreamingEngine will keep in buffer behind the playhead when it appends a new media segment. The StreamingEngine will evict content to meet this limit.
ignoreTextStreamFailures boolean If true, the player will ignore text stream failures and continue playing other streams.
alwaysStreamText boolean If true, always stream text tracks, regardless of whether or not they are shown. This is necessary when using the browser's built-in controls, which are not capable of signaling display state changes back to Shaka Player. Defaults to false.
startAtSegmentBoundary boolean If true, adjust the start time backwards so it is at the start of a segment. This affects both explicit start times and calculated start time for live streams. This can put us further from the live edge. Defaults to false.
smallGapLimit number The limit (in seconds) for a gap in the media to be considered "small". Small gaps are jumped automatically without events. Large gaps result in a Player event and can be jumped.
jumpLargeGaps boolean If true, jump large gaps in addition to small gaps. A largegap event will be raised first. Then, if the app doesn't call preventDefault() on the event, the Player will jump the gap. If false, then the event will be raised, but the gap will not be jumped.
durationBackoff number By default, we will not allow seeking to exactly the duration of a presentation. This field is the number of seconds before duration we will seek to when the user tries to seek to or start playback at the duration. To disable this behavior, the config can be set to 0. We recommend using the default value unless you have a good reason not to.
forceTransmuxTS boolean If this is true, we will transmux TS content even if not strictly necessary for the assets to be played. Shaka Player currently only supports CEA 708 captions by transmuxing, so this value is necessary for enabling them on platforms with native TS support like Edge or Chromecast. This value defaults to false.
safeSeekOffset number The amount of seconds that should be added when repositioning the playhead after falling out of the availability window or seek. This gives the player more time to buffer before falling outside again, but increases the forward jump in the stream skipping more content. This is helpful for lower bandwidth scenarios. Defaults to 5 if not provided.
stallEnabled boolean When set to true, the stall detector logic will run. If the playhead stops moving for stallThreshold seconds, the player will either seek or pause/play to resolve the stall, depending on the value of stallSkip.
stallThreshold number The maximum number of seconds that may elapse without the playhead moving (when playback is expected) before it will be labeled as a stall.
stallSkip number The number of seconds that the player will skip forward when a stall has been detected. If 0, the player will pause and immediately play instead of seeking. A value of 0 is recommended and provided as default on TV platforms (WebOS, Tizen, Chromecast, etc).
useNativeHlsOnSafari boolean Desktop Safari has both MediaSource and their native HLS implementation. Depending on the application's needs, it may prefer one over the other. Examples: FairPlay is only supported via Safari's native HLS, but it doesn't have an API for selecting specific tracks.
Source:

SupportType

An object detailing browser support for various features.
Type:
Properties:
Name Type Description
manifest Object.<string, boolean> A map of supported manifest types. The keys are manifest MIME types and file extensions.
media Object.<string, boolean> A map of supported media types. The keys are media MIME types.
drm Object.<string, ?shaka.extern.DrmSupportType> A map of supported key systems. The keys are the key system names. The value is null if it is not supported. Key systems not probed will not be in this dictionary.
Source:

TextParserPlugin

Type:
  • function(new:shaka.extern.TextParser)
Source:

TimelineRegionInfo

Contains information about a region of the timeline that will cause an event to be raised when the playhead enters or exits it. In DASH this is the EventStream element.
Type:
  • {schemeIdUri: string, value: string, startTime: number, endTime: number, id: string, eventElement: Element}
Properties:
Name Type Description
schemeIdUri string Identifies the message scheme.
value string Specifies the value for the region.
startTime number The presentation time (in seconds) that the region should start.
endTime number The presentation time (in seconds) that the region should end.
id string Specifies an identifier for this instance of the region.
eventElement Element The XML element that defines the Event.
Source:

Track

An object describing a media track. This object should be treated as read-only as changing any values does not have any effect. This is the public view of an audio/video paring (variant type) or text track (text type).
Type:
  • {id: number, active: boolean, type: string, bandwidth: number, language: string, label: ?string, kind: ?string, width: ?number, height: ?number, frameRate: ?number, pixelAspectRatio: ?string, mimeType: ?string, codecs: ?string, audioCodec: ?string, videoCodec: ?string, primary: boolean, roles: !Array.<string>, audioRoles: Array.<string>, videoId: ?number, audioId: ?number, channelsCount: ?number, audioSamplingRate: ?number, audioBandwidth: ?number, videoBandwidth: ?number, originalVideoId: ?string, originalAudioId: ?string, originalTextId: ?string}
Properties:
Name Type Attributes Description
id number The unique ID of the track.
active boolean If true, this is the track being streamed (another track may be visible/audible in the buffer).
type string The type of track, either 'variant' or 'text'.
bandwidth number The bandwidth required to play the track, in bits/sec.
language string The language of the track, or 'und' if not given. This is the exact value provided in the manifest; it may need to be normalized.
label string <nullable>
The track label, which is unique text that should describe the track.
kind string <nullable>
(only for text tracks) The kind of text track, either 'caption' or 'subtitle'.
width number <nullable>
The video width provided in the manifest, if present.
height number <nullable>
The video height provided in the manifest, if present.
frameRate number <nullable>
The video framerate provided in the manifest, if present.
pixelAspectRatio string <nullable>
The video pixel aspect ratio provided in the manifest, if present.
mimeType string <nullable>
The MIME type of the content provided in the manifest.
codecs string <nullable>
The audio/video codecs string provided in the manifest, if present.
audioCodec string <nullable>
The audio codecs string provided in the manifest, if present.
videoCodec string <nullable>
The video codecs string provided in the manifest, if present.
primary boolean True indicates that this in the primary language for the content. This flag is based on signals from the manifest. This can be a useful hint about which language should be the default, and indicates which track Shaka will use when the user's language preference cannot be satisfied.
roles Array.<string> The roles of the track, e.g. 'main', 'caption', or 'commentary'.
audioRoles Array.<string> The roles of the audio in the track, e.g. 'main' or 'commentary'. Will be null for text tracks or variant tracks without audio.
videoId number <nullable>
(only for variant tracks) The video stream id.
audioId number <nullable>
(only for variant tracks) The audio stream id.
channelsCount number <nullable>
The count of the audio track channels.
audioSamplingRate number <nullable>
Specifies the maximum sampling rate of the content.
audioBandwidth number <nullable>
(only for variant tracks) The audio stream's bandwidth if known.
videoBandwidth number <nullable>
(only for variant tracks) The video stream's bandwidth if known.
originalVideoId string <nullable>
(variant tracks only) The original ID of the video part of the track, if any, as it appeared in the original manifest.
originalAudioId string <nullable>
(variant tracks only) The original ID of the audio part of the track, if any, as it appeared in the original manifest.
originalTextId string <nullable>
(text tracks only) The original ID of the text track, if any, as it appeared in the original manifest.
Source:

TrackChoice

Type:
  • {timestamp: number, id: number, type: string, fromAdaptation: boolean, bandwidth: ?number}
Properties:
Name Type Attributes Description
timestamp number The timestamp the choice was made, in seconds since 1970 (i.e. Date.now() / 1000).
id number The id of the track that was chosen.
type string The type of track chosen ('variant' or 'text').
fromAdaptation boolean true if the choice was made by AbrManager for adaptation; false if it was made by the application through selectTrack.
bandwidth number <nullable>
The bandwidth of the chosen track (null for text).
Source:

TrackList

Type:
Source:

UIConfiguration

The UI's configuration options.
Type:
  • {controlPanelElements: !Array.<string>, overflowMenuButtons: !Array.<string>, addSeekBar: boolean, addBigPlayButton: boolean, castReceiverAppId: string, clearBufferOnQualityChange: boolean, showUnbufferedStart: boolean, seekBarColors: shaka.extern.UISeekBarColors, volumeBarColors: shaka.extern.UIVolumeBarColors, trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat, fadeDelay: number, doubleClickForFullscreen: boolean, enableKeyboardPlaybackControls: boolean, enableFullscreenOnRotation: boolean}
Properties:
Name Type Description
controlPanelElements Array.<string> The ordered list of control panel elements of the UI.
overflowMenuButtons Array.<string> The ordered list of the overflow menu buttons.
addSeekBar boolean Whether or not a seek bar should be part of the UI.
addBigPlayButton boolean Whether or not a big play button in the center of the video should be part of the UI.
castReceiverAppId string Receiver app id to use for the Chromecast support.
clearBufferOnQualityChange boolean Only applicable if the resolution selection is part of the UI. Whether buffer should be cleared when changing resolution via UI. Clearing buffer would result in immidiate change of quality, but playback may flicker/stall for a sec as the content in new resolution is being buffered. Not clearing the buffer will mean we play the content in the previously selected resolution that we already have buffered before switching to the new resolution.
showUnbufferedStart boolean If true, color any unbuffered region at the start of the seek bar as unbuffered (using the "base" color). If false, color any unbuffered region at the start of the seek bar as played (using the "played" color).
A value of false matches the default behavior of Chrome's native controls and Shaka Player v3.0+.
A value of true matches the default behavior of Shaka Player v2.5.
Defaults to true in v2.5. Will default to false in v3.0+.
seekBarColors shaka.extern.UISeekBarColors The CSS colors applied to the seek bar. This allows you to override the colors used in the linear gradient constructed in JavaScript, since you cannot easily do this in pure CSS.
volumeBarColors shaka.extern.UIVolumeBarColors The CSS colors applied to the volume bar. This allows you to override the colors used in the linear gradient constructed in JavaScript, since you cannot do this in pure CSS.
trackLabelFormat shaka.ui.Overlay.TrackLabelFormat An enum that determines what is shown in the labels for text track and audio variant selection. LANGUAGE means that only the language of the item is shown. ROLE means that only the role of the item is shown. LANGUAGE_ROLE means both are shown, or just language if there is no role. Defaults to LANGUAGE.
fadeDelay number The delay (in seconds) before fading out the controls once the user stops interacting with them. We recommend setting this to 3 on your cast receiver UI. Defaults to 0.
doubleClickForFullscreen boolean Whether or not double-clicking on the UI should cause it to enter fullscreen. Defaults to true.
enableKeyboardPlaybackControls boolean Whether or not playback controls via keyboard is enabled, such as seek forward, seek backward, jump to the beginning/end of the video. Defaults to true.
enableFullscreenOnRotation boolean Whether or not to enter/exit fullscreen mode when the screen is rotated. Defaults to true.
Source:

UISeekBarColors

Type:
  • {base: string, buffered: string, played: string}
Properties:
Name Type Description
base string The CSS background color applied to the base of the seek bar, on top of which the buffer level and playback position are shown.
buffered string The CSS background color applied to the portion of the seek bar showing what has been buffered ahead of the playback position.
played string The CSS background color applied to the portion of the seek bar showing what has been played already.
Source:

UIVolumeBarColors

Type:
  • {base: string, level: string}
Properties:
Name Type Description
base string The CSS background color applied to the base of the volume bar, on top of which the volume level is shown.
level string The CSS background color applied to the portion of the volume bar showing the volume level.
Source:

Variant

A Variant describes a combination of an audio and video streams which could be played together. It's possible to have a video/audio only variant.
Type:
Properties:
Name Type Attributes Description
id number Required.
A unique ID among all Variant objects within the same Manifest.
language string Defaults to '' (i.e., unknown).
The Variant's language, specified as a language code.
See https://tools.ietf.org/html/rfc5646
See http://www.iso.org/iso/home/standards/language_codes.htm
primary boolean Defaults to false.
True indicates that the player should use this Variant over others in the same Period. The player may still use another Variant to meet application preferences.
audio shaka.extern.Stream <nullable>
The audio stream of the variant.
video shaka.extern.Stream <nullable>
The video stream of the variant.
bandwidth number The variant's required bandwidth in bits per second.
drmInfos Array.<!shaka.extern.DrmInfo> Defaults to [] (i.e., no DRM).
An array of DrmInfo objects which describe DRM schemes are compatible with the content.
allowedByApplication boolean Defaults to true.
Set by the Player to indicate whether the variant is allowed to be played by the application.
allowedByKeySystem boolean Defaults to true.
Set by the Player to indicate whether the variant is allowed to be played by the key system.
Source:

Classes

IUIElement
IUIRangeElement
IUISettingsMenu

Interfaces

AbrManager
Cue
CueRegion
EmeSessionStorageCell
Error
IAbortableOperation
ManifestParser
StorageCell
StorageMechanism
TextDisplayer
TextParser

Type Definitions

AbrConfiguration

Type:
  • {enabled: boolean, defaultBandwidthEstimate: number, restrictions: shaka.extern.Restrictions, switchInterval: number, bandwidthUpgradeTarget: number, bandwidthDowngradeTarget: number}
Properties:
Name Type Description
enabled boolean If true, enable adaptation by the current AbrManager. Defaults to true.
defaultBandwidthEstimate number The default bandwidth estimate to use if there is not enough data, in bit/sec.
restrictions shaka.extern.Restrictions The restrictions to apply to ABR decisions. These are "soft" restrictions. Any track that fails to meet these restrictions will not be selected automatically, but will still appear in the track list and can still be selected via selectVariantTrack(). If no tracks meet these restrictions, AbrManager should not fail, but choose a low-res or low-bandwidth variant instead. It is the responsibiliy of AbrManager implementations to follow these rules and implement this behavior.
switchInterval number The minimum amount of time that must pass between switches, in seconds. This keeps us from changing too often and annoying the user.
bandwidthUpgradeTarget number The fraction of the estimated bandwidth which we should try to use when upgrading.
bandwidthDowngradeTarget number The largest fraction of the estimated bandwidth we should use. We should downgrade to avoid this.
Source:

AdvancedDrmConfiguration

Type:
  • {distinctiveIdentifierRequired: boolean, persistentStateRequired: boolean, videoRobustness: string, audioRobustness: string, serverCertificate: Uint8Array, individualizationServer: string}
Properties:
Name Type Description
distinctiveIdentifierRequired boolean Defaults to false.
True if the application requires the key system to support distinctive identifiers.
persistentStateRequired boolean Defaults to false.
True if the application requires the key system to support persistent state, e.g., for persistent license storage.
videoRobustness string A key-system-specific string that specifies a required security level for video. Defaults to '', i.e., no specific robustness required.
audioRobustness string A key-system-specific string that specifies a required security level for audio. Defaults to '', i.e., no specific robustness required.
serverCertificate Uint8Array Defaults to null.
An empty certificate (byteLength==0) will be treated as null.
A certificate will be requested from the license server if required.
A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
individualizationServer string The server that handles an 'individualiation-request'. If the server isn't given, it will default to the license server.
Source:

BufferedInfo

Contains information about the current buffered ranges.
Type:
Properties:
Name Type Description
total Array.<shaka.extern.BufferedRange> The combined audio/video buffered ranges, reported by video.buffered.
audio Array.<shaka.extern.BufferedRange> The buffered ranges for audio content.
video Array.<shaka.extern.BufferedRange> The buffered ranges for video content.
text Array.<shaka.extern.BufferedRange> The buffered ranges for text content.
Source:

BufferedRange

Contains the times of a range of buffered content.
Type:
  • {start: number, end: number}
Properties:
Name Type Description
start number The start time of the range, in seconds.
end number The end time of the range, in seconds.
Source:

CreateSegmentIndexFunction

Creates a SegmentIndex; returns a Promise that resolves after the SegmentIndex has been created.
Type:
  • function(): !Promise
Source:

DashContentProtectionCallback

Type:
Source:
See:

DashManifestConfiguration

Type:
  • {customScheme: shaka.extern.DashContentProtectionCallback, clockSyncUri: string, ignoreDrmInfo: boolean, xlinkFailGracefully: boolean, defaultPresentationDelay: number, ignoreMinBufferTime: boolean, autoCorrectDrift: boolean, ignoreSuggestedPresentationDelay: boolean, ignoreEmptyAdaptationSet: boolean}
Properties:
Name Type Description
customScheme shaka.extern.DashContentProtectionCallback If given, invoked by a DASH manifest parser to interpret custom or non-standard DRM schemes found in the manifest. The argument is a ContentProtection node. Return null if not recognized.
clockSyncUri string A default clock sync URI to be used with live streams which do not contain any clock sync information. The Date header from this URI will be used to determine the current time.
ignoreDrmInfo boolean If true will cause DASH parser to ignore DRM information specified by the manifest and treat it as if it signaled no particular key system and contained no init data. Defaults to false if not provided.
xlinkFailGracefully boolean If true, xlink-related errors will result in a fallback to the tag's existing contents. If false, xlink-related errors will be propagated to the application and will result in a playback failure. Defaults to false if not provided.
defaultPresentationDelay number A default presentationDelay if suggestedPresentationDelay is missing in the MPEG DASH manifest. This has to be bigger than minBufferTime * 1.5.
ignoreMinBufferTime boolean If true will cause DASH parser to ignore minBufferTime from manifest. It allows player config to take precedence over manifest for rebufferingGoal. Defaults to false if not provided.
autoCorrectDrift boolean If true, ignore the availabilityStartTime in the manifest and instead use the segments to determine the live edge. This allows us to play streams that have a lot of drift. If false, we can't play content where the manifest specifies segments in the future. Defaults to true.
ignoreSuggestedPresentationDelay boolean If true will cause DASH parser to ignore suggestedPresentationDelay from manifest. Defaults to false if not provided.
ignoreEmptyAdaptationSet boolean If true will cause DASH parser to ignore empty AdaptationSet from manifest. Defaults to false if not provided.
Source:

DrmConfiguration

Type:
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for license requests.
servers Object.<string, string> Required for all but the clear key CDM.
A dictionary which maps key system IDs to their license servers. For example, {'com.widevine.alpha': 'https://example.com/drm'}.
clearKeys Object.<string, string> Forces the use of the Clear Key CDM. A map of key IDs (hex) to keys (hex).
delayLicenseRequestUntilPlayed boolean Defaults to false.
True to configure drm to delay sending a license request until a user actually starts playing content.
advanced Object.<string, shaka.extern.AdvancedDrmConfiguration> Optional.
A dictionary which maps key system IDs to advanced DRM configuration for those key systems.
initDataTransform function | undefined Optional.
If given, this function is called with the init data from the manifest/media and should return the (possibly transformed) init data to pass to the browser.
fairPlayTransform boolean Optional.
Temporary, for v2.5.x only.
If true, transform the FairPlay license request/response according to the FairPlay examples; if false, don't transform. Defaults to true. Starting in v3.0 this will go away and we will never provide default license request/response transforms.
updateExpirationTime number Defaults to 1.
The frequency in seconds with which to check the expiration of a session.
Source:

DrmInfo

DRM configuration for a single key system.
Type:
  • {keySystem: string, licenseServerUri: string, distinctiveIdentifierRequired: boolean, persistentStateRequired: boolean, audioRobustness: string, videoRobustness: string, serverCertificate: Uint8Array, initData: Array.<!shaka.extern.InitDataOverride>, keyIds: Array.<string>}
Properties:
Name Type Description
keySystem string Required.
The key system, e.g., "com.widevine.alpha".
licenseServerUri string Filled in by DRM config if missing.
The license server URI.
distinctiveIdentifierRequired boolean Defaults to false. Can be filled in by advanced DRM config.
True if the application requires the key system to support distinctive identifiers.
persistentStateRequired boolean Defaults to false. Can be filled in by advanced DRM config.
True if the application requires the key system to support persistent state, e.g., for persistent license storage.
audioRobustness string Defaults to '', e.g., no specific robustness required. Can be filled in by advanced DRM config.
A key-system-specific string that specifies a required security level.
videoRobustness string Defaults to '', e.g., no specific robustness required. Can be filled in by advanced DRM config.
A key-system-specific string that specifies a required security level.
serverCertificate Uint8Array Defaults to null, e.g., certificate will be requested from the license server if required. Can be filled in by advanced DRM config.
A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
initData Array.<!shaka.extern.InitDataOverride> Defaults to [], e.g., no override.
A list of initialization data which override any initialization data found in the content. See also shaka.extern.InitDataOverride.
keyIds Array.<string> Defaults to []
If not empty, contains the default key IDs for this key system, as lowercase hex strings.
Source:

DrmSupportType

Type:
  • {persistentState: boolean}
Properties:
Name Type Description
persistentState boolean Whether this key system supports persistent state.
Source:

EmeSessionDB

Type:
  • {sessionId: string, keySystem: string, licenseUri: string, serverCertificate: Uint8Array, audioCapabilities: !Array.<MediaKeySystemMediaCapability>, videoCapabilities: !Array.<MediaKeySystemMediaCapability>}
Properties:
Name Type Description
sessionId string The EME session ID.
keySystem string The EME key system string the session belongs to.
licenseUri string The URI for the license server.
serverCertificate Uint8Array A key-system-specific server certificate used to encrypt license requests. Its use is optional and is meant as an optimization to avoid a round-trip to request a certificate.
audioCapabilities Array.<MediaKeySystemMediacapability> The EME audio capabilities used to create the session.
videoCapabilities Array.<MediaKeySystemMediacapability> The EME video capabilities used to create the session.
Source:

EmsgInfo

Contains information about an EMSG MP4 box.
Type:
  • {schemeIdUri: string, value: string, startTime: number, endTime: number, timescale: number, presentationTimeDelta: number, eventDuration: number, id: number, messageData: Uint8Array}
Properties:
Name Type Description
schemeIdUri string Identifies the message scheme.
value string Specifies the value for the event.
startTime number The time that the event starts (in presentation time).
endTime number The time that the event ends (in presentation time).
timescale number Provides the timescale, in ticks per second.
presentationTimeDelta number The offset that the event starts, relative to the start of the segment this is contained in (in units of timescale).
eventDuration number The duration of the event (in units of timescale).
id number A field identifying this instance of the message.
messageData Uint8Array Body of the message.
Source:

FindSegmentPositionFunction

Finds the position of the segment for the given time, in seconds, relative to the start of a particular Period; returns null if the position of the segment could not be determined. Note: the position of a segment is unique only among segments within the same Period.
Type:
  • function(number): ?number
Source:

GetSegmentReferenceFunction

Gets the SegmentReference for the segment at the given position; returns null if no such SegmentReference exists. Note: the position of a segment is unique only among segments within the same Period.
Type:
  • function(number): shaka.media.SegmentReference
Source:

HlsManifestConfiguration

Type:
  • {ignoreTextStreamFailures: boolean, useFullSegmentsForStartTime: boolean}
Properties:
Name Type Description
ignoreTextStreamFailures boolean If true, ignore any errors in a text stream and filter out those streams.
useFullSegmentsForStartTime boolean If true, force HlsParser to use a full segment request for determining start time in case the server does not support partial requests
Source:

InitDataOverride

Explicit initialization data, which override any initialization data in the content. The initDataType values and the formats that they correspond to are specified here.
Type:
  • {initData: !Uint8Array, initDataType: string, keyId: ?string}
Properties:
Name Type Attributes Description
initData Uint8Array Initialization data in the format indicated by initDataType.
initDataType string A string to indicate what format initData is in.
keyId string <nullable>
The key Id that corresponds to this initData.
Source:

LanguageRole

Type:
  • {language: string, role: string}
Properties:
Name Type Description
language string The language code for the stream.
role string The role name for the stream. If the stream has no role, role will be ''.
Source:

Manifest

A Manifest object describes a collection of streams (segmented audio, video, or text data) that share a common timeline. We call the collection of streams "the presentation" and their timeline "the presentation timeline". A Manifest describes one of two types of presentations: live and video-on-demand.

A live presentation begins at some point in time and either continues indefinitely or ends when the presentation stops broadcasting. For a live presentation, wall-clock time maps onto the presentation timeline, and the current wall-clock time maps to the live-edge (AKA "the current presentation time"). In contrast, a video-on-demand presentation exists entirely independent of wall-clock time.

The presentation timeline is divided into one or more Periods, and each of these Periods contains its own collection of Variants and text streams. A variant is a combination of an audio and a video streams that can be played together.

A stream has the same logical content as another stream if the only difference between the two is their quality. For example, an SD video stream and an HD video stream that depict the same scene have the same logical content; whereas an English audio stream and a French audio stream have different logical contents. The player can automatically switch between streams which have the same logical content to adapt to network conditions.

Type:
Properties:
Name Type Description
presentationTimeline shaka.media.PresentationTimeline Required.
The presentation timeline.
periods Array.<!shaka.extern.Period> Required.
The presentation's Periods. There must be at least one Period.
offlineSessionIds Array.<string> Defaults to [].
An array of EME sessions to load for offline playback.
minBufferTime number Defaults to 0.
The minimum number of seconds of content that must be buffered before playback can begin. Can be overridden by a higher value from the Player configuration.
Source:

ManifestConfiguration

Type:
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for manifest requests.
availabilityWindowOverride number A number, in seconds, that overrides the availability window in the manifest, or NaN if the default value should be used. This is enforced by the manifest parser, so custom manifest parsers should take care to honor this parameter.
disableAudio boolean If true, the audio tracks are ignored. Defaults to false.
disableVideo boolean If true, the video tracks are ignored. Defaults to false.
disableText boolean If true, the text tracks are ignored. Defaults to false.
dash shaka.extern.DashManifestConfiguration Advanced parameters used by the DASH manifest parser.
hls shaka.extern.HlsManifestConfiguration Advanced parameters used by the HLS manifest parser.
Source:

ManifestDB

Type:
  • {originalManifestUri: string, duration: number, size: number, expiration: number, periods: !Array.<shaka.extern.PeriodDB>, sessionIds: !Array.<string>, drmInfo: ?shaka.extern.DrmInfo, appMetadata: Object}
Properties:
Name Type Attributes Description
originalManifestUri string The URI that the manifest was originally loaded from.
duration number The total duration of the media, in seconds.
size number The total size of all stored segments, in bytes.
expiration number The license expiration, in milliseconds; or Infinity if not applicable. Note that upon JSON serialization, Infinity becomes null, and must be converted back upon loading from storage.
periods Array.<shaka.extern.PeriodDB> The Periods that are stored.
sessionIds Array.<string> The DRM offline session IDs for the media.
drmInfo shaka.extern.DrmInfo <nullable>
The DRM info used to initialize EME.
appMetadata Object A metadata object passed from the application.
Source:

ManifestDBV1

Type:
  • {key: number, originalManifestUri: string, duration: number, size: number, expiration: number, periods: !Array.<shaka.extern.PeriodDBV1>, sessionIds: !Array.<string>, drmInfo: ?shaka.extern.DrmInfo, appMetadata: Object}
Properties:
Name Type Attributes Description
key number A unique key to identify this item.
originalManifestUri string The URI that the manifest was originally loaded from.
duration number The total duration of the media, in seconds.
size number The total size of all stored segments, in bytes.
expiration number The license expiration, in milliseconds; or Infinity if not applicable. Note that upon JSON serialization, Infinity becomes null, and must be converted back upon loading from storage.
periods Array.<shaka.extern.PeriodDBV1> The Periods that are stored.
sessionIds Array.<string> The DRM offline session IDs for the media.
drmInfo shaka.extern.DrmInfo <nullable>
The DRM info used to initialize EME.
appMetadata Object A metadata object passed from the application.
Source:

OfflineConfiguration

Type:
Properties:
Name Type Description
trackSelectionCallback function Called inside store() to determine which tracks to save from a manifest. It is passed an array of Tracks from the manifest and it should return an array of the tracks to store. This is called for each Period in the manifest (in order).
progressCallback function Called inside store() to give progress info back to the app. It is given the current manifest being stored and the progress of it being stored.
usePersistentLicense boolean If true, store protected content with a persistent license so that no network is required to view. If false, store protected content without a persistent license. A network will be required to retrieve a temporary license to view. Defaults to true.
Source:

OfflineSupport

Type:
  • {basic: boolean, encrypted: !Object.<string, boolean>}
Properties:
Name Type Description
basic boolean True if offline is usable at all.
encrypted Object.<string, boolean> A map of key system name to whether it supports offline playback.
Source:

ParsedBox

Type:
Properties:
Name Type Attributes Description
parser shaka.util.Mp4Parser The parser that parsed this box. The parser can be used to parse child boxes where the configuration of the current parser is needed to parsed other boxes.
partialOkay boolean If true, allows reading partial payloads from some boxes. If the goal is a child box, we can sometimes find it without enough data to find all child boxes. This property allows the partialOkay flag from parse() to be propagated through methods like children().
start number The start of this box (before the header) in the original buffer. This start position is the absolute position.
size number The size of this box (including the header).
version number <nullable>
The version for a full box, null for basic boxes.
flags number <nullable>
The flags for a full box, null for basic boxes.
reader shaka.util.DataViewReader The reader for this box is only for this box. Reading or not reading to the end will have no affect on the parser reading other sibling boxes.
has64BitSize boolean If true, the box header had a 64-bit size field. This affects the offsets of other fields.
Source:

Period

A Period object contains the Streams for part of the presentation.
Type:
Properties:
Name Type Description
startTime number Required.
The Period's start time, in seconds, relative to the start of the presentation. The first Period must begin at the start of the presentation. The Period ends immediately before the next Period's start time or exactly at the end of the presentation timeline. Periods which begin after the end of the presentation timeline are ignored.
variants Array.<shaka.extern.Variant> Required.
The Period's Variants. There must be at least one Variant.
textStreams Array.<shaka.extern.Stream> Required.
The Period's text streams.
Source:

PeriodDB

Type:
Properties:
Name Type Description
startTime number The start time of the period, in seconds.
streams Array.<shaka.extern.StreamDB> The streams that define the Period.
Source:

PeriodDBV1

Type:
Properties:
Name Type Description
startTime number The start time of the period, in seconds.
streams Array.<shaka.extern.StreamDBV1> The streams that define the Period.
Source:

PlayerConfiguration

Type:
Properties:
Name Type Description
drm shaka.extern.DrmConfiguration DRM configuration and settings.
manifest shaka.extern.ManifestConfiguration Manifest configuration and settings.
streaming shaka.extern.StreamingConfiguration Streaming configuration and settings.
abrFactory shaka.extern.AbrManager.Factory A factory to construct an abr manager.
abr shaka.extern.AbrConfiguration ABR configuration and settings.
offline shaka.extern.OfflineConfiguration Offline configuration and settings.
preferredAudioLanguage string The preferred language to use for audio tracks. If not given it will use the 'main' track. Changing this during playback will not affect the current playback.
preferredTextLanguage string The preferred language to use for text tracks. If a matching text track is found, and the selected audio and text tracks have different languages, the text track will be shown. Changing this during playback will not affect the current playback.
preferredVariantRole string The preferred role to use for variants.
preferredTextRole string The preferred role to use for text tracks.
preferredAudioChannelCount number The preferred number of audio channels.
restrictions shaka.extern.Restrictions The application restrictions to apply to the tracks. These are "hard" restrictions. Any track that fails to meet these restrictions will not appear in the track list. If no tracks meet these restrictions, playback will fail.
playRangeStart number Optional playback and seek start time in seconds. Defaults to 0 if not provided.
playRangeEnd number Optional playback and seek end time in seconds. Defaults to the end of the presentation if not provided.
textDisplayFactory shaka.extern.TextDisplayer.Factory A factory to construct text displayer. Note that, if this is changed during playback, it will cause the text tracks to be reloaded.
Source:

ProgressUpdated

A callback function to handle progress event through networking engine in player. The first argument is a number for duration in milliseconds, that the request took to complete. The second argument is the total number of bytes downloaded during that time. The third argument is the number of bytes remaining to be loaded in a segment.
Type:
  • function(number, number, number)
Source:

Request

Defines a network request. This is passed to one or more request filters that may alter the request, then it is passed to a scheme plugin which performs the actual operation.
Type:
  • {uris: !Array.<string>, method: string, body: ArrayBuffer, headers: !Object.<string, string>, allowCrossSiteCredentials: boolean, retryParameters: !shaka.extern.RetryParameters, licenseRequestType: ?string, sessionId: ?string}
Properties:
Name Type Attributes Description
uris Array.<string> An array of URIs to attempt. They will be tried in the order they are given.
method string The HTTP method to use for the request.
body ArrayBuffer The body of the request.
headers Object.<string, string> A mapping of headers for the request. e.g.: {'HEADER': 'VALUE'}
allowCrossSiteCredentials boolean Make requests with credentials. This will allow cookies in cross-site requests. See https://bit.ly/CorsCred.
retryParameters shaka.extern.RetryParameters An object used to define how often to make retries.
licenseRequestType string <nullable>
If this is a LICENSE request, this field contains the type of license request it is (not the type of license). This is the |messageType| field of the EME message. For example, this could be 'license-request' or 'license-renewal'.
sessionId string <nullable>
If this is a LICENSE request, this field contains the session ID of the EME session that made the request.
Source:

RequestFilter

Defines a filter for requests. This filter takes the request and modifies it before it is sent to the scheme plugin. A request filter can run asynchronously by returning a promise; in this case, the request will not be sent until the promise is resolved.
Type:
Source:

Response

Defines a response object. This includes the response data and header info. This is given back from the scheme plugin. This is passed to a response filter before being returned from the request call.
Type:
  • {uri: string, data: ArrayBuffer, headers: !Object.<string, string>, timeMs: (number|undefined), fromCache: (boolean|undefined)}
Properties:
Name Type Description
uri string The URI which was loaded. Request filters and server redirects can cause this to be different from the original request URIs.
originalUri string The original URI passed to the browser for networking. This is before any redirects, but after request filters are executed.
data ArrayBuffer The body of the response.
headers Object.<string, string> A map of response headers, if supported by the underlying protocol. All keys should be lowercased. For HTTP/HTTPS, may not be available cross-origin.
timeMs number | undefined Optional. The time it took to get the response, in miliseconds. If not given, NetworkingEngine will calculate it using Date.now.
fromCache boolean | undefined Optional. If true, this response was from a cache and should be ignored for bandwidth estimation.
Source:

ResponseFilter

Defines a filter for responses. This filter takes the response and modifies it before it is returned. A response filter can run asynchronously by returning a promise.
Type:
Source:

RestrictionInfo

Type:
  • {hasAppRestrictions: boolean, missingKeys: !Array.<string>, restrictedKeyStatuses: !Array.<string>}
Properties:
Name Type Description
hasAppRestrictions boolean Whether there are streams that are restricted due to app-provided restrictions.
missingKeys Array.<string> The key IDs that were missing.
restrictedKeyStatuses Array.<string> The restricted EME key statuses that the streams had. For example, 'output-restricted' would mean streams couldn't play due to restrictions on the output device (e.g. HDCP).
Source:

Restrictions

An object describing application restrictions on what tracks can play. All restrictions must be fulfilled for a track to be playable/selectable. The restrictions system behaves somewhat differently at the ABR level and the player level, so please refer to the documentation for those specific settings.
Type:
  • {minWidth: number, maxWidth: number, minHeight: number, maxHeight: number, minPixels: number, maxPixels: number, minFrameRate: number, maxFrameRate: number, minBandwidth: number, maxBandwidth: number}
Properties:
Name Type Description
minWidth number The minimum width of a video track, in pixels.
maxWidth number The maximum width of a video track, in pixels.
minHeight number The minimum height of a video track, in pixels.
maxHeight number The maximum height of a video track, in pixels.
minPixels number The minimum number of total pixels in a video track (i.e. width * height).
maxPixels number The maximum number of total pixels in a video track (i.e. width * height).
minFrameRate number The minimum framerate of a variant track.
maxFrameRate number The maximum framerate of a variant track.
minBandwidth number The minimum bandwidth of a variant track, in bit/sec.
maxBandwidth number The maximum bandwidth of a variant track, in bit/sec.
Source:
See:

RetryParameters

Parameters for retrying requests.
Type:
  • {maxAttempts: number, baseDelay: number, backoffFactor: number, fuzzFactor: number, timeout: number}
Properties:
Name Type Description
maxAttempts number The maximum number of times the request should be attempted.
baseDelay number The delay before the first retry, in milliseconds.
backoffFactor number The multiplier for successive retry delays.
fuzzFactor number The maximum amount of fuzz to apply to each retry delay. For example, 0.5 means "between 50% below and 50% above the retry delay."
timeout number The request timeout, in milliseconds. Zero means "unlimited".
Source:
Tutorials:

SchemePlugin

Defines a plugin that handles a specific scheme. The functions accepts four parameters, uri string, request, request type, and a progressUpdated function. The progressUpdated function can be ignored by plugins that do not have this information, but it will always be provided by NetworkingEngine.
Type:
Source:

SegmentDataDB

Type:
  • {data: !ArrayBuffer}
Properties:
Name Type Description
data ArrayBuffer The data contents of the segment.
Source:

SegmentDataDBV1

Type:
  • {key: number, data: !ArrayBuffer}
Properties:
Name Type Description
key number A unique key to identify this item.
data ArrayBuffer The data contents of the segment.
Source:

SegmentDB

Type:
  • {startTime: number, endTime: number, dataKey: number}
Properties:
Name Type Description
startTime number The start time of the segment, in seconds from the start of the Period.
endTime number The end time of the segment, in seconds from the start of the Period.
dataKey number The key to the data in storage.
Source:

SegmentDBV1

Type:
  • {startTime: number, endTime: number, uri: string}
Properties:
Name Type Description
startTime number The start time of the segment, in seconds from the start of the Period.
endTime number The end time of the segment, in seconds from the start of the Period.
uri string The offline URI of the segment.
Source:

StateChange

Type:
  • {timestamp: number, state: string, duration: number}
Properties:
Name Type Description
timestamp number The timestamp the state was entered, in seconds since 1970 (i.e. Date.now() / 1000).
state string The state the player entered. This could be 'buffering', 'playing', 'paused', or 'ended'.
duration number The number of seconds the player was in this state. If this is the last entry in the list, the player is still in this state, so the duration will continue to increase.
Source:

Stats

Contains statistics and information about the current state of the player. This is meant for applications that want to log quality-of-experience (QoE) or other stats. These values will reset when load() is called again.
Type:
  • {width: number, height: number, streamBandwidth: number, decodedFrames: number, droppedFrames: number, corruptedFrames: number, estimatedBandwidth: number, loadLatency: number, playTime: number, pauseTime: number, bufferingTime: number, licenseTime: number, switchHistory: !Array.<shaka.extern.TrackChoice>, stateHistory: !Array.<shaka.extern.StateChange>}
Properties:
Name Type Description
width number The width of the current video track.
height number The height of the current video track.
streamBandwidth number The bandwidth required for the current streams (total, in bit/sec).
decodedFrames number The total number of frames decoded by the Player. This may be NaN if this is not supported by the browser.
droppedFrames number The total number of frames dropped by the Player. This may be NaN if this is not supported by the browser.
corruptedFrames number The total number of corrupted frames dropped by the browser. This may be NaN if this is not supported by the browser.
estimatedBandwidth number The current estimated network bandwidth (in bit/sec).
loadLatency number This is the number of seconds it took for the video element to have enough data to begin playback. This is measured from the time load() is called to the time the 'loadeddata' event is fired by the media element.
playTime number The total time spent in a playing state in seconds.
pauseTime number The total time spent in a paused state in seconds.
bufferingTime number The total time spent in a buffering state in seconds.
licenseTime number The time spent on license requests during this session in seconds, or NaN.
switchHistory Array.<shaka.extern.TrackChoice> A history of the stream changes.
stateHistory Array.<shaka.extern.StateChange> A history of the state changes.
Source:

StoredContent

Type:
  • {offlineUri: ?string, originalManifestUri: string, duration: number, size: number, expiration: number, tracks: !Array.<shaka.extern.Track>, appMetadata: Object}
Properties:
Name Type Attributes Description
offlineUri string <nullable>
An offline URI to access the content. This can be passed directly to Player. If the uri is null, it means that the content has not finished downloading and is not ready to play.
originalManifestUri string The original manifest URI of the content stored.
duration number The duration of the content, in seconds.
size number The size of the content, in bytes.
expiration number The time that the encrypted license expires, in milliseconds. If the media is clear or the license never expires, this will equal Infinity.
tracks Array.<shaka.extern.Track> The tracks that are stored. This only lists those found in the first Period.
appMetadata Object The metadata passed to store().
Source:

Stream

A Stream object describes a single stream (segmented media data).
Type:
Properties:
Name Type Attributes Description
id number Required.
A unique ID among all Stream objects within the same Manifest.
originalId string <nullable>
Optional.
The original ID, if any, that appeared in the manifest. For example, in DASH, this is the "id" attribute of the Representation element. In HLS, this is the "NAME" attribute.
createSegmentIndex shaka.extern.CreateSegmentIndexFunction Required.
Creates the Stream's SegmentIndex (asynchronously).
findSegmentPosition shaka.extern.FindSegmentPositionFunction Required.
Finds the position of the segment for the given time. The caller must call createSegmentIndex() and wait until the returned Promise resolves before calling this function.
getSegmentReference shaka.extern.GetSegmentReferenceFunction Required.
Gets the SegmentReference for the segment at the given position. The caller must call createSegmentIndex() and wait until the returned Promise resolves before calling this function.
initSegmentReference shaka.media.InitSegmentReference The Stream's initialization segment metadata, or null if the segments are self-initializing.
presentationTimeOffset number | undefined Defaults to 0.
The amount of time, in seconds, that the stream's presentation timestamps are offset from the start of the Stream's Period, i.e., this value should equal the first presentation timestamp of the first frame/sample in the period.

For example, for MP4 based streams, this value should equal the first segment's tfdt box's 'baseMediaDecodeTime' field (after it has been converted to seconds).
mimeType string Required.
The Stream's MIME type, e.g., 'audio/mp4', 'video/webm', or 'text/vtt'.
codecs string Defaults to '' (i.e., unknown / not needed).
The Stream's codecs, e.g., 'avc1.4d4015' or 'vp9', which must be compatible with the Stream's MIME type.
See https://tools.ietf.org/html/rfc6381
frameRate number | undefined Video streams only.
The Stream's framerate in frames per second
pixelAspectRatio string | undefined Video streams only.
The Stream's pixel aspect ratio
bandwidth number | undefined Audio and video streams only.
The stream's required bandwidth in bits per second.
width number | undefined Video streams only.
The stream's width in pixels.
height number | undefined Video streams only.
The stream's height in pixels.
kind string | undefined Text streams only.
The kind of text stream. For example, 'caption' or 'subtitle'.
encrypted boolean Defaults to false.
True if the stream is encrypted.
keyId string <nullable>
Defaults to null (i.e., unencrypted or key ID unknown).
The stream's key ID as a lowercase hex string. This key ID identifies the encryption key that the browser (key system) can use to decrypt the stream.
language string The Stream's language, specified as a language code.
Audio stream's language must be identical to the language of the containing Variant.
label string <nullable>
The Stream's label, unique text that should describe the audio/text track.
type string Required.
Content type (e.g. 'video', 'audio' or 'text')
primary boolean Defaults to false.
True indicates that the player should prefer this Stream over others in the same Period. The player may still use another Stream to meet application preferences.
trickModeVideo shaka.extern.Stream <nullable>
Video streams only.
An alternate video stream to use for trick mode playback.
emsgSchemeIdUris Array.<string> <nullable>
Defaults to empty.
Array of registered emsg box scheme_id_uri that should result in Player events.
roles Array.<string> The roles of the stream as they appear on the manifest, e.g. 'main', 'caption', or 'commentary'.
channelsCount number <nullable>
The channel count information for the audio stream.
audioSamplingRate number <nullable>
Specifies the maximum sampling rate of the content.
closedCaptions Map.<string, string> A map containing the description of closed captions, with the caption channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code as the value. If the channel number is not provided by the description, we'll set an 0-based index as the key. Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
Source:
See:

StreamDB

Type:
  • {id: number, originalId: ?string, primary: boolean, presentationTimeOffset: number, contentType: string, mimeType: string, codecs: string, frameRate: (number|undefined), pixelAspectRatio: (string|undefined), kind: (string|undefined), language: string, label: ?string, width: ?number, height: ?number, initSegmentKey: ?number, encrypted: boolean, keyId: ?string, segments: !Array.<shaka.extern.SegmentDB>, variantIds: !Array.<number>}
Properties:
Name Type Attributes Description
id number The unique id of the stream.
originalId string <nullable>
The original ID, if any, that appeared in the manifest. For example, in DASH, this is the "id" attribute of the Representation element.
primary boolean Whether the stream set was primary.
presentationTimeOffset number The presentation time offset of the stream, in seconds.
contentType string The type of the stream, 'audio', 'text', or 'video'.
mimeType string The MIME type of the stream.
codecs string The codecs of the stream.
frameRate number | undefined The Stream's framerate in frames per second.
pixelAspectRatio string | undefined The Stream's pixel aspect ratio
kind string | undefined The kind of text stream; undefined for audio/video.
language string The language of the stream; '' for video.
label string <nullable>
The label of the stream; '' for video.
width number <nullable>
The width of the stream; null for audio/text.
height number <nullable>
The height of the stream; null for audio/text.
initSegmentKey number <nullable>
The storage key where the init segment is found; null if no init segment.
encrypted boolean Whether this stream is encrypted.
keyId string <nullable>
The key ID this stream is encrypted with.
segments Array.<shaka.extern.SegmentDB> An array of segments that make up the stream.
variantIds Array.<number> An array of ids of variants the stream is a part of.
Source:

StreamDBV1

Type:
  • {id: number, primary: boolean, presentationTimeOffset: number, contentType: string, mimeType: string, codecs: string, frameRate: (number|undefined), kind: (string|undefined), language: string, label: ?string, width: ?number, height: ?number, initSegmentUri: ?string, encrypted: boolean, keyId: ?string, segments: !Array.<shaka.extern.SegmentDBV1>, variantIds: !Array.<number>}
Properties:
Name Type Attributes Description
id number The unique id of the stream.
primary boolean Whether the stream set was primary.
presentationTimeOffset number The presentation time offset of the stream, in seconds. Note that this is the inverse of the timestampOffset as defined in the manifest types.
contentType string The type of the stream, 'audio', 'text', or 'video'.
mimeType string The MIME type of the stream.
codecs string The codecs of the stream.
frameRate number | undefined The Stream's framerate in frames per second.
kind string | undefined The kind of text stream; undefined for audio/video.
language string The language of the stream; '' for video.
label string <nullable>
The label of the stream; '' for video.
width number <nullable>
The width of the stream; null for audio/text.
height number <nullable>
The height of the stream; null for audio/text.
initSegmentUri number <nullable>
The offline URI where the init segment is found; null if no init segment.
encrypted boolean Whether this stream is encrypted.
keyId string <nullable>
The key ID this stream is encrypted with.
segments Array.<shaka.extern.SegmentDBV1> An array of segments that make up the stream.
variantIds Array.<number> An array of ids of variants the stream is a part of.
Source:

StreamingConfiguration

The StreamingEngine's configuration options.
Type:
  • {retryParameters: shaka.extern.RetryParameters, failureCallback: function(!shaka.util.Error), rebufferingGoal: number, bufferingGoal: number, bufferBehind: number, ignoreTextStreamFailures: boolean, alwaysStreamText: boolean, startAtSegmentBoundary: boolean, smallGapLimit: number, jumpLargeGaps: boolean, durationBackoff: number, forceTransmuxTS: boolean, safeSeekOffset: number, stallEnabled: boolean, stallThreshold: number, stallSkip: number, useNativeHlsOnSafari: boolean}
Properties:
Name Type Description
retryParameters shaka.extern.RetryParameters Retry parameters for segment requests.
failureCallback function A callback to decide what to do on a streaming failure. Default behavior is to retry on live streams and not on VOD.
rebufferingGoal number The minimum number of seconds of content that the StreamingEngine must buffer before it can begin playback or can continue playback after it has entered into a buffering state (i.e., after it has depleted one more more of its buffers).
bufferingGoal number The number of seconds of content that the StreamingEngine will attempt to buffer ahead of the playhead. This value must be greater than or equal to the rebuffering goal.
bufferBehind number The maximum number of seconds of content that the StreamingEngine will keep in buffer behind the playhead when it appends a new media segment. The StreamingEngine will evict content to meet this limit.
ignoreTextStreamFailures boolean If true, the player will ignore text stream failures and continue playing other streams.
alwaysStreamText boolean If true, always stream text tracks, regardless of whether or not they are shown. This is necessary when using the browser's built-in controls, which are not capable of signaling display state changes back to Shaka Player. Defaults to false.
startAtSegmentBoundary boolean If true, adjust the start time backwards so it is at the start of a segment. This affects both explicit start times and calculated start time for live streams. This can put us further from the live edge. Defaults to false.
smallGapLimit number The limit (in seconds) for a gap in the media to be considered "small". Small gaps are jumped automatically without events. Large gaps result in a Player event and can be jumped.
jumpLargeGaps boolean If true, jump large gaps in addition to small gaps. A largegap event will be raised first. Then, if the app doesn't call preventDefault() on the event, the Player will jump the gap. If false, then the event will be raised, but the gap will not be jumped.
durationBackoff number By default, we will not allow seeking to exactly the duration of a presentation. This field is the number of seconds before duration we will seek to when the user tries to seek to or start playback at the duration. To disable this behavior, the config can be set to 0. We recommend using the default value unless you have a good reason not to.
forceTransmuxTS boolean If this is true, we will transmux TS content even if not strictly necessary for the assets to be played. Shaka Player currently only supports CEA 708 captions by transmuxing, so this value is necessary for enabling them on platforms with native TS support like Edge or Chromecast. This value defaults to false.
safeSeekOffset number The amount of seconds that should be added when repositioning the playhead after falling out of the availability window or seek. This gives the player more time to buffer before falling outside again, but increases the forward jump in the stream skipping more content. This is helpful for lower bandwidth scenarios. Defaults to 5 if not provided.
stallEnabled boolean When set to true, the stall detector logic will run. If the playhead stops moving for stallThreshold seconds, the player will either seek or pause/play to resolve the stall, depending on the value of stallSkip.
stallThreshold number The maximum number of seconds that may elapse without the playhead moving (when playback is expected) before it will be labeled as a stall.
stallSkip number The number of seconds that the player will skip forward when a stall has been detected. If 0, the player will pause and immediately play instead of seeking. A value of 0 is recommended and provided as default on TV platforms (WebOS, Tizen, Chromecast, etc).
useNativeHlsOnSafari boolean Desktop Safari has both MediaSource and their native HLS implementation. Depending on the application's needs, it may prefer one over the other. Examples: FairPlay is only supported via Safari's native HLS, but it doesn't have an API for selecting specific tracks.
Source:

SupportType

An object detailing browser support for various features.
Type:
Properties:
Name Type Description
manifest Object.<string, boolean> A map of supported manifest types. The keys are manifest MIME types and file extensions.
media Object.<string, boolean> A map of supported media types. The keys are media MIME types.
drm Object.<string, ?shaka.extern.DrmSupportType> A map of supported key systems. The keys are the key system names. The value is null if it is not supported. Key systems not probed will not be in this dictionary.
Source:

TextParserPlugin

Type:
  • function(new:shaka.extern.TextParser)
Source:

TimelineRegionInfo

Contains information about a region of the timeline that will cause an event to be raised when the playhead enters or exits it. In DASH this is the EventStream element.
Type:
  • {schemeIdUri: string, value: string, startTime: number, endTime: number, id: string, eventElement: Element}
Properties:
Name Type Description
schemeIdUri string Identifies the message scheme.
value string Specifies the value for the region.
startTime number The presentation time (in seconds) that the region should start.
endTime number The presentation time (in seconds) that the region should end.
id string Specifies an identifier for this instance of the region.
eventElement Element The XML element that defines the Event.
Source:

Track

An object describing a media track. This object should be treated as read-only as changing any values does not have any effect. This is the public view of an audio/video paring (variant type) or text track (text type).
Type:
  • {id: number, active: boolean, type: string, bandwidth: number, language: string, label: ?string, kind: ?string, width: ?number, height: ?number, frameRate: ?number, pixelAspectRatio: ?string, mimeType: ?string, codecs: ?string, audioCodec: ?string, videoCodec: ?string, primary: boolean, roles: !Array.<string>, audioRoles: Array.<string>, videoId: ?number, audioId: ?number, channelsCount: ?number, audioSamplingRate: ?number, audioBandwidth: ?number, videoBandwidth: ?number, originalVideoId: ?string, originalAudioId: ?string, originalTextId: ?string}
Properties:
Name Type Attributes Description
id number The unique ID of the track.
active boolean If true, this is the track being streamed (another track may be visible/audible in the buffer).
type string The type of track, either 'variant' or 'text'.
bandwidth number The bandwidth required to play the track, in bits/sec.
language string The language of the track, or 'und' if not given. This is the exact value provided in the manifest; it may need to be normalized.
label string <nullable>
The track label, which is unique text that should describe the track.
kind string <nullable>
(only for text tracks) The kind of text track, either 'caption' or 'subtitle'.
width number <nullable>
The video width provided in the manifest, if present.
height number <nullable>
The video height provided in the manifest, if present.
frameRate number <nullable>
The video framerate provided in the manifest, if present.
pixelAspectRatio string <nullable>
The video pixel aspect ratio provided in the manifest, if present.
mimeType string <nullable>
The MIME type of the content provided in the manifest.
codecs string <nullable>
The audio/video codecs string provided in the manifest, if present.
audioCodec string <nullable>
The audio codecs string provided in the manifest, if present.
videoCodec string <nullable>
The video codecs string provided in the manifest, if present.
primary boolean True indicates that this in the primary language for the content. This flag is based on signals from the manifest. This can be a useful hint about which language should be the default, and indicates which track Shaka will use when the user's language preference cannot be satisfied.
roles Array.<string> The roles of the track, e.g. 'main', 'caption', or 'commentary'.
audioRoles Array.<string> The roles of the audio in the track, e.g. 'main' or 'commentary'. Will be null for text tracks or variant tracks without audio.
videoId number <nullable>
(only for variant tracks) The video stream id.
audioId number <nullable>
(only for variant tracks) The audio stream id.
channelsCount number <nullable>
The count of the audio track channels.
audioSamplingRate number <nullable>
Specifies the maximum sampling rate of the content.
audioBandwidth number <nullable>
(only for variant tracks) The audio stream's bandwidth if known.
videoBandwidth number <nullable>
(only for variant tracks) The video stream's bandwidth if known.
originalVideoId string <nullable>
(variant tracks only) The original ID of the video part of the track, if any, as it appeared in the original manifest.
originalAudioId string <nullable>
(variant tracks only) The original ID of the audio part of the track, if any, as it appeared in the original manifest.
originalTextId string <nullable>
(text tracks only) The original ID of the text track, if any, as it appeared in the original manifest.
Source:

TrackChoice

Type:
  • {timestamp: number, id: number, type: string, fromAdaptation: boolean, bandwidth: ?number}
Properties:
Name Type Attributes Description
timestamp number The timestamp the choice was made, in seconds since 1970 (i.e. Date.now() / 1000).
id number The id of the track that was chosen.
type string The type of track chosen ('variant' or 'text').
fromAdaptation boolean true if the choice was made by AbrManager for adaptation; false if it was made by the application through selectTrack.
bandwidth number <nullable>
The bandwidth of the chosen track (null for text).
Source:

TrackList

Type:
Source:

UIConfiguration

The UI's configuration options.
Type:
  • {controlPanelElements: !Array.<string>, overflowMenuButtons: !Array.<string>, addSeekBar: boolean, addBigPlayButton: boolean, castReceiverAppId: string, clearBufferOnQualityChange: boolean, showUnbufferedStart: boolean, seekBarColors: shaka.extern.UISeekBarColors, volumeBarColors: shaka.extern.UIVolumeBarColors, trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat, fadeDelay: number, doubleClickForFullscreen: boolean, enableKeyboardPlaybackControls: boolean, enableFullscreenOnRotation: boolean}
Properties:
Name Type Description
controlPanelElements Array.<string> The ordered list of control panel elements of the UI.
overflowMenuButtons Array.<string> The ordered list of the overflow menu buttons.
addSeekBar boolean Whether or not a seek bar should be part of the UI.
addBigPlayButton boolean Whether or not a big play button in the center of the video should be part of the UI.
castReceiverAppId string Receiver app id to use for the Chromecast support.
clearBufferOnQualityChange boolean Only applicable if the resolution selection is part of the UI. Whether buffer should be cleared when changing resolution via UI. Clearing buffer would result in immidiate change of quality, but playback may flicker/stall for a sec as the content in new resolution is being buffered. Not clearing the buffer will mean we play the content in the previously selected resolution that we already have buffered before switching to the new resolution.
showUnbufferedStart boolean If true, color any unbuffered region at the start of the seek bar as unbuffered (using the "base" color). If false, color any unbuffered region at the start of the seek bar as played (using the "played" color).
A value of false matches the default behavior of Chrome's native controls and Shaka Player v3.0+.
A value of true matches the default behavior of Shaka Player v2.5.
Defaults to true in v2.5. Will default to false in v3.0+.
seekBarColors shaka.extern.UISeekBarColors The CSS colors applied to the seek bar. This allows you to override the colors used in the linear gradient constructed in JavaScript, since you cannot easily do this in pure CSS.
volumeBarColors shaka.extern.UIVolumeBarColors The CSS colors applied to the volume bar. This allows you to override the colors used in the linear gradient constructed in JavaScript, since you cannot do this in pure CSS.
trackLabelFormat shaka.ui.Overlay.TrackLabelFormat An enum that determines what is shown in the labels for text track and audio variant selection. LANGUAGE means that only the language of the item is shown. ROLE means that only the role of the item is shown. LANGUAGE_ROLE means both are shown, or just language if there is no role. Defaults to LANGUAGE.
fadeDelay number The delay (in seconds) before fading out the controls once the user stops interacting with them. We recommend setting this to 3 on your cast receiver UI. Defaults to 0.
doubleClickForFullscreen boolean Whether or not double-clicking on the UI should cause it to enter fullscreen. Defaults to true.
enableKeyboardPlaybackControls boolean Whether or not playback controls via keyboard is enabled, such as seek forward, seek backward, jump to the beginning/end of the video. Defaults to true.
enableFullscreenOnRotation boolean Whether or not to enter/exit fullscreen mode when the screen is rotated. Defaults to true.
Source:

UISeekBarColors

Type:
  • {base: string, buffered: string, played: string}
Properties:
Name Type Description
base string The CSS background color applied to the base of the seek bar, on top of which the buffer level and playback position are shown.
buffered string The CSS background color applied to the portion of the seek bar showing what has been buffered ahead of the playback position.
played string The CSS background color applied to the portion of the seek bar showing what has been played already.
Source:

UIVolumeBarColors

Type:
  • {base: string, level: string}
Properties:
Name Type Description
base string The CSS background color applied to the base of the volume bar, on top of which the volume level is shown.
level string The CSS background color applied to the portion of the volume bar showing the volume level.
Source:

Variant

A Variant describes a combination of an audio and video streams which could be played together. It's possible to have a video/audio only variant.
Type:
Properties:
Name Type Attributes Description
id number Required.
A unique ID among all Variant objects within the same Manifest.
language string Defaults to '' (i.e., unknown).
The Variant's language, specified as a language code.
See https://tools.ietf.org/html/rfc5646
See http://www.iso.org/iso/home/standards/language_codes.htm
primary boolean Defaults to false.
True indicates that the player should use this Variant over others in the same Period. The player may still use another Variant to meet application preferences.
audio shaka.extern.Stream <nullable>
The audio stream of the variant.
video shaka.extern.Stream <nullable>
The video stream of the variant.
bandwidth number The variant's required bandwidth in bits per second.
drmInfos Array.<!shaka.extern.DrmInfo> Defaults to [] (i.e., no DRM).
An array of DrmInfo objects which describe DRM schemes are compatible with the content.
allowedByApplication boolean Defaults to true.
Set by the Player to indicate whether the variant is allowed to be played by the application.
allowedByKeySystem boolean Defaults to true.
Set by the Player to indicate whether the variant is allowed to be played by the key system.
Source: