Class: shakaExtern

Types and interfaces which are used outside the library.

Interfaces

AbrManager
Cue
CueRegion
Error
IAbortableOperation
ManifestParser
StorageCell
StorageMechanism
TextDisplayer
TextParser

Type Definitions

AbrConfiguration

Type:
  • {enabled: boolean, defaultBandwidthEstimate: number, restrictions: shakaExtern.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 shakaExtern.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}
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.
Source:

BufferedInfo

Contains information about the current buffered ranges.
Type:
Properties:
Name Type Description
total Array.<shakaExtern.BufferedRange> The combined audio/video buffered ranges, reported by |video.buffered|.
audio Array.<shakaExtern.BufferedRange> The buffered ranges for audio content.
video Array.<shakaExtern.BufferedRange> The buffered ranges for video content.
text Array.<shakaExtern.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:
Properties:
Name Type Description
customScheme shakaExtern.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.
Source:

DrmConfiguration

Type:
Properties:
Name Type Description
retryParameters shakaExtern.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': 'http://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, shakaExtern.AdvancedDrmConfiguration> Optional.
A dictionary which maps key system IDs to advanced DRM configuration for those key systems.
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.<!shakaExtern.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.<!shakaExtern.InitDataOverride> Defaults to [], e.g., no override.
A list of initialization data which override any initialization data found in the content. See also shakaExtern.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:

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:

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.<!shakaExtern.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 shakaExtern.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.
dash shakaExtern.DashManifestConfiguration Advanced parameters used by the DASH manifest parser.
Source:

ManifestDB

Type:
  • {originalManifestUri: string, duration: number, size: number, expiration: number, periods: !Array.<shakaExtern.PeriodDB>, sessionIds: !Array.<string>, drmInfo: ?shakaExtern.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.
periods Array.<shakaExtern.PeriodDB> The Periods that are stored.
sessionIds Array.<string> The DRM offline session IDs for the media.
drmInfo shakaExtern.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.
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.<shakaExtern.Variant> Required.
The Period's Variants. There must be at least one Variant.
textStreams Array.<shakaExtern.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.<shakaExtern.StreamDB> The streams that define the Period.
Source:

PlayerConfiguration

Type:
Properties:
Name Type Description
drm shakaExtern.DrmConfiguration DRM configuration and settings.
manifest shakaExtern.ManifestConfiguration Manifest configuration and settings.
streaming shakaExtern.StreamingConfiguration Streaming configuration and settings.
abrFactory shakaExtern.AbrManager.Factory A factory to construct an abr manager.
abr shakaExtern.AbrConfiguration ABR 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 shakaExtern.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 shakaExtern.TextDisplayer.Factory A factory to construct text displayer.
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: !shakaExtern.RetryParameters}
Properties:
Name Type 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 http://goo.gl/YBRKPe.
retryParameters shakaExtern.RetryParameters An object used to define how often to make retries.
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.
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:

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, 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).
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.
Type:
Source:

SegmentDataDB

Type:
  • {data: !ArrayBuffer}
Properties:
Name Type Description
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:

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, estimatedBandwidth: number, loadLatency: number, playTime: number, bufferingTime: number, switchHistory: !Array.<shakaExtern.TrackChoice>, stateHistory: !Array.<shakaExtern.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.
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.
bufferingTime number The total time spent in a buffering state in seconds.
switchHistory Array.<shakaExtern.TrackChoice> A history of the stream changes.
stateHistory Array.<shakaExtern.StateChange> A history of the state changes.
Source:

StoredContent

Type:
  • {offlineUri: ?string, originalManifestUri: string, duration: number, size: number, expiration: number, tracks: !Array.<shakaExtern.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.<shakaExtern.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.
createSegmentIndex shakaExtern.CreateSegmentIndexFunction Required.
Creates the Stream's SegmentIndex (asynchronously).
findSegmentPosition shakaExtern.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 shakaExtern.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
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 shakaExtern.Stream <nullable>
Video streams only.
An alternate video stream to use for trick mode playback.
containsEmsgBoxes boolean Defaults to false.
Whether the stream contains embedded 'emsg' boxes 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.
Source:
See:

StreamDB

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, initSegmentKey: ?number, encrypted: boolean, keyId: ?string, segments: !Array.<shakaExtern.SegmentDB>, 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.
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.
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.<shakaExtern.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:

StreamingConfiguration

The StreamingEngine's configuration options.
Type:
  • {retryParameters: shakaExtern.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}
Properties:
Name Type Description
retryParameters shakaExtern.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. The 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.
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, ?shakaExtern.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:shakaExtern.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, mimeType: ?string, codecs: ?string, audioCodec: ?string, videoCodec: ?string, primary: boolean, roles: !Array.<string>, videoId: ?number, audioId: ?number, channelsCount: ?number, audioBandwidth: ?number, videoBandwidth: ?number}
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.
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'.
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.
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.
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:

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 shakaExtern.Stream <nullable>
The audio stream of the variant.
video shakaExtern.Stream <nullable>
The video stream of the variant.
bandwidth number The variant's required bandwidth in bits per second.
drmInfos Array.<!shakaExtern.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: