Types and interfaces which are used outside the library.
- Source:
Type Definitions
-
AbrConfiguration
-
Type:
- {manager: shakaExtern.AbrManager, enabled: boolean, defaultBandwidthEstimate: number}
Properties:
Name Type Description managershakaExtern.AbrManager The AbrManager instance. enabledboolean If true, enable adaptation by the current AbrManager. Defaults to true. defaultBandwidthEstimatenumber The default bandwidth estimate to use if there is not enough data, in bit/sec. - Source:
-
AdvancedDrmConfiguration
-
Type:
- {distinctiveIdentifierRequired: boolean, persistentStateRequired: boolean, videoRobustness: string, audioRobustness: string, serverCertificate: Uint8Array}
Properties:
Name Type Description distinctiveIdentifierRequiredboolean Defaults to false.
True if the application requires the key system to support distinctive identifiers.persistentStateRequiredboolean Defaults to false.
True if the application requires the key system to support persistent state, e.g., for persistent license storage.videoRobustnessstring A key-system-specific string that specifies a required security level for video. Defaults to '', i.e., no specific robustness required. audioRobustnessstring A key-system-specific string that specifies a required security level for audio. Defaults to '', i.e., no specific robustness required. serverCertificateUint8Array Defaults to null, i.e., 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:
-
CreateSegmentIndexFunction
-
Creates a SegmentIndex; returns a Promise that resolves after the SegmentIndex has been created.
Type:
- function(): !Promise
- Source:
-
DashContentProtectionCallback
-
Type:
- function(!Element): Array.<shakaExtern.DrmInfo>
-
DashManifestConfiguration
-
Type:
- {customScheme: shakaExtern.DashContentProtectionCallback}
Properties:
Name Type Description customSchemeshakaExtern.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. - Source:
-
DrmConfiguration
-
Type:
- {retryParameters: shakaExtern.RetryParameters, servers: !Object.<string, string>, clearKeys: !Object.<string, string>, advanced: Object.<string, shakaExtern.AdvancedDrmConfiguration>}
Properties:
Name Type Description retryParametersshakaExtern.RetryParameters Retry parameters for license requests. serversObject.<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'}.clearKeysObject.<string, string> Forces the use of the Clear Key CDM. A map of key IDs (hex) to keys (hex). advancedObject.<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>}
Properties:
Name Type Description keySystemstring Required.
The key system, e.g., "com.widevine.alpha".licenseServerUristring Filled in by DRM config if missing.
The license server URI.distinctiveIdentifierRequiredboolean Defaults to false. Can be filled in by advanced DRM config.
True if the application requires the key system to support distinctive identifiers.persistentStateRequiredboolean 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.audioRobustnessstring 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.videoRobustnessstring 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.serverCertificateUint8Array 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.initDataArray.<!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.- 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}
Properties:
Name Type Description initDataUint8Array Initialization data in the format indicated by initDataType. initDataTypestring A string to indicate what format initData is in. - 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 streams. Periods group their streams by type (e.g., 'audio', 'video', or 'text') and logical content, and each individual group defines a StreamSet.
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 content. The player can automatically switch between streams which have the same logical content to adapt to network conditions.
Type:
- {presentationTimeline: !shaka.media.PresentationTimeline, periods: !Array.<!shakaExtern.Period>, minBufferTime: number}
Properties:
Name Type Description presentationTimelineshaka.media.PresentationTimeline Required.
The presentation timeline.periodsArray.<!shakaExtern.Period> Required.
The presentation's Periods. There must be at least one Period.minBufferTimenumber 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:
- {retryParameters: shakaExtern.RetryParameters, dash: shakaExtern.DashManifestConfiguration}
Properties:
Name Type Description retryParametersshakaExtern.RetryParameters Retry parameters for manifest requests. dashshakaExtern.DashManifestConfiguration Advanced parameters used by the DASH manifest parser. - Source:
-
Period
-
A Period object contains the Streams for part of the presentation.
Type:
- {startTime: number, streamSets: !Array.<shakaExtern.StreamSet>}
Properties:
Name Type Description startTimenumber 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.streamSetsArray.<shakaExtern.StreamSet> Required.
The Period's StreamSets. There must be at least one StreamSet.- Source:
-
PlayerConfiguration
-
Type:
- {drm: shakaExtern.DrmConfiguration, manifest: shakaExtern.ManifestConfiguration, streaming: shakaExtern.StreamingConfiguration, abr: shakaExtern.AbrConfiguration, preferredAudioLanguage: string, preferredTextLanguage: string}
Properties:
Name Type Description drmshakaExtern.DrmConfiguration DRM configuration and settings. manifestshakaExtern.ManifestConfiguration Manifest configuration and settings. streamingshakaExtern.StreamingConfiguration Streaming configuration and settings. abrshakaExtern.AbrConfiguration ABR configuration and settings. preferredAudioLanguagestring The preferred language to use for audio tracks. If not given it will use the 'main' track. Changing this during playback will cause the language selection algorithm to run again, and may change the active audio track. preferredTextLanguagestring 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 cause the language selection algorithm to run again, and may change the active text track. - 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 urisArray.<string> An array of URIs to attempt. They will be tried in the order they are given. methodstring The HTTP method to use for the request. bodyArrayBuffer The body of the request. headersObject.<string, string> A mapping of headers for the request. e.g.: {'HEADER': 'VALUE'} allowCrossSiteCredentialsboolean Make requests with credentials. This will allow cookies in cross-site requests. See http://goo.gl/YBRKPe. retryParametersshakaExtern.RetryParameters An object used to define how often to make retries. - 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>}
Properties:
Name Type Description uristring The URI which was loaded. Request filters and server redirects can cause this to be different from the original request URIs. dataArrayBuffer The body of the response. headersObject.<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. - Source:
-
RetryParameters
-
Parameters for retrying requests.
Type:
- {maxAttempts: number, baseDelay: number, backoffFactor: number, fuzzFactor: number, timeout: number}
Properties:
Name Type Description maxAttemptsnumber The maximum number of times the request should be attempted. baseDelaynumber The delay before the first retry, in milliseconds. backoffFactornumber The multiplier for successive retry delays. fuzzFactornumber 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." timeoutnumber The request timeout, in milliseconds. Zero means "unlimited". - 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, playTime: number, bufferingTime: number, switchHistory: !Array.<shakaExtern.StreamChoice>}
Properties:
Name Type Description widthnumber The width of the current video track. heightnumber The height of the current video track. streamBandwidthnumber The bandwidth required for the current streams (total, in bit/sec). decodedFramesnumber The total number of frames decoded by the Player. This may be NaN if this is not supported by the browser. droppedFramesnumber The total number of frames dropped by the Player. This may be NaN if this is not supported by the browser. estimatedBandwidthnumber The current estimated network bandwidth (in bit/sec). playTimenumber The total time spent in a playing state in seconds. bufferingTimenumber The total time spent in a buffering state in seconds. switchHistoryArray.<shakaExtern.StreamChoice> A history of the stream changes. - Source:
-
Stream
-
A Stream object describes a single stream (segmented media data).
Type:
- {id: number, createSegmentIndex: shakaExtern.CreateSegmentIndexFunction, findSegmentPosition: shakaExtern.FindSegmentPositionFunction, getSegmentReference: shakaExtern.GetSegmentReferenceFunction, initSegmentReference: shaka.media.InitSegmentReference, presentationTimeOffset: (number|undefined), mimeType: string, codecs: string, bandwidth: (number|undefined), width: (number|undefined), height: (number|undefined), kind: (string|undefined), keyId: ?string}
Properties:
Name Type Attributes Description idnumber Required.
A unique ID among all Stream objects within the same Manifest.createSegmentIndexshakaExtern.CreateSegmentIndexFunction Required.
Creates the Stream's SegmentIndex (asynchronously).findSegmentPositionshakaExtern.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.getSegmentReferenceshakaExtern.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.initSegmentReferenceshaka.media.InitSegmentReference The Stream's initialization segment metadata, or null if the segments are self-initializing. presentationTimeOffsetnumber | 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).mimeTypestring Required.
The Stream's MIME type, e.g., 'audio/mp4', 'video/webm', or 'text/vtt'.codecsstring 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/rfc6381bandwidthnumber | undefined Audio and video streams only.
The stream's required bandwidth in bits per second.widthnumber | undefined Video streams only.
The stream's width in pixels.heightnumber | undefined Video streams only.
The stream's height in pixels.kindstring | undefined Text streams only.
The kind of text stream. For example, 'captions' or 'subtitles'.keyIdstring <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.- Source:
- See:
-
StreamChoice
-
Type:
- {timestamp: number, id: number, type: string, fromAdaptation: boolean}
Properties:
Name Type Description timestampnumber The timestamp the choice was made, in seconds since 1970 (i.e. Date.now() / 1000). idnumber The id of the stream that was chosen. typestring The type of stream chosen ('audio', 'text', or 'video') fromAdaptationboolean True if the choice was made by AbrManager for adaptation; false if it was made by the application through selectTrack. - Source:
-
StreamingConfiguration
-
The StreamingEngine's configuration options.
Type:
- {retryParameters: shakaExtern.RetryParameters, rebufferingGoal: number, bufferingGoal: number, bufferBehind: number}
Properties:
Name Type Description retryParametersshakaExtern.RetryParameters Retry parameters for segment requests. rebufferingGoalnumber 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). bufferingGoalnumber 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. bufferBehindnumber 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. - Source:
-
StreamSet
-
A StreamSet object contains a set of Streams which have the same type, container/format, and logical content. A StreamSet's type and container/format define its MIME type.
Type:
- {language: string, type: string, primary: boolean, drmInfos: Array.<!shakaExtern.DrmInfo>, streams: !Array.<!shakaExtern.Stream>}
Properties:
Name Type Description languagestring Defaults to '' (i.e., unknown).
The Streams' language, specified as a language code.
See https://tools.ietf.org/html/rfc5646
See http://www.iso.org/iso/home/standards/language_codes.htmtypestring Required.
The Streams' type, e.g., 'audio', 'video', or 'text'.primaryboolean Defaults to false.
True indicates that the player should use this StreamSet over others of the same type in the same Period. However, the player may use another StreamSet to meet application preferences, or to achieve better MIME type or DRM compatibility among other StreamSets.drmInfosArray.<!shakaExtern.DrmInfo> Defaults to [] (i.e., no DRM).
An array of DrmInfo objects which describe DRM schemes are compatible with the content.streamsArray.<!shakaExtern.Stream> Required.
The StreamSets's Streams. There must be at least one Stream.- Source:
-
SupportType
-
An object detailing browser support for various features.
Type:
- {manifest: Object.<string, boolean>, media: Object.<string, boolean>, drm: Object.<string, boolean>, supported: boolean}
Properties:
Name Type Description manifestObject.<string, boolean> A map of supported manifest types. The keys are manifest MIME types and file extensions. mediaObject.<string, boolean> A map of supported media types. The keys are media MIME types. drmObject.<string, boolean> A map of DRM support. The keys are well-known key system IDs. supportedboolean True if the library is usable at all. - 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 the Stream type.
Type:
- {id: number, active: boolean, type: string, bandwidth: number, language: string, kind: ?string, width: ?number, height: ?number}
Properties:
Name Type Attributes Description idnumber The unique ID of the track. activeboolean If true, this is the track is being streamed (another track may be visible/audible in the buffer). typestring The type of track, one of 'audio', 'text', or 'video'. bandwidthnumber The bandwidth required to play the track, in bits/sec. languagestring The language of the track, or '' for video tracks. This is the exact value provided in the manifest; it may need to be normalized. kindstring <nullable>
(only for text tracks) The kind of text track, either 'captions' or 'subtitles'. widthnumber <nullable>
(only for video tracks) The width of the track in pixels. heightnumber <nullable>
(only for video tracks) The height of the track in pixels. - Source: