shaka-player
Version:
DASH/EME video player library
1,650 lines (1,648 loc) • 207 kB
JavaScript
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Generated externs. DO NOT EDIT!
* @externs
* @suppress {constantProperty, duplicate} To prevent compiler
* errors with the namespace being declared both here and by
* goog.provide in the library.
*/
/** @namespace */
window.shaka = {};
/** @const */
shaka.abr = {};
/** @const */
shaka.ads = {};
/** @const */
shaka.cast = {};
/** @const */
shaka.cea = {};
/** @const */
shaka.config = {};
/** @const */
shaka.dash = {};
/** @const */
shaka.drm = {};
/** @const */
shaka.hls = {};
/** @const */
shaka.lcevc = {};
/** @const */
shaka.media = {};
/** @const */
shaka.media.SegmentPrefetch = {};
/** @const */
shaka.mss = {};
/** @const */
shaka.net = {};
/** @const */
shaka.offline = {};
/** @const */
shaka.text = {};
/** @const */
shaka.transmuxer = {};
/** @const */
shaka.ui = {};
/** @const */
shaka.util = {};
/** @const */
shaka.util.CmcdManager = {};
/**
* @summary Create an Event work-alike object based on the provided dictionary.
* The event should contain all of the same properties from the dict.
* @extends {Event}
*/
shaka.util.FakeEvent = class {
/**
* @param {string} type
* @param {Map<string, Object>=} dict
*/
constructor(type, dict) {}
};
/**
* An interface to standardize how objects release internal references
* synchronously. If an object needs to asynchronously release references, then
* it should use 'shaka.util.IDestroyable'.
* @interface
*/
shaka.util.IReleasable = class {
/**
* Request that this object release all internal references.
*/
release() {}
};
/**
* @summary A work-alike for EventTarget. Only DOM elements may be true
* EventTargets, but this can be used as a base class to provide event dispatch
* to non-DOM classes. Only FakeEvents should be dispatched.
* @implements {EventTarget}
* @implements {shaka.util.IReleasable}
*/
shaka.util.FakeEventTarget = class {
/** */
constructor() {}
/**
* Add an event listener to this object.
* @param {string} type The event type to listen for.
* @param {shaka.util.FakeEventTarget.ListenerType} listener The callback or
* listener object to invoke.
* @param {(!AddEventListenerOptions|boolean)=} options Ignored.
* @override
*/
addEventListener(type, listener, options) {}
/**
* Add an event listener to this object that is invoked for all events types
* the object fires.
* @param {shaka.util.FakeEventTarget.ListenerType} listener The callback or
* listener object to invoke.
*/
listenToAllEvents(listener) {}
/**
* Remove an event listener from this object.
* @param {string} type The event type for which you wish to remove a
* listener.
* @param {shaka.util.FakeEventTarget.ListenerType} listener The callback or
* listener object to remove.
* @param {(EventListenerOptions|boolean)=} options Ignored.
* @override
*/
removeEventListener(type, listener, options) {}
/**
* Dispatch an event from this object.
* @param {!Event} event The event to be dispatched from this object.
* @return {boolean} True if the default action was prevented.
* @override
*/
dispatchEvent(event) {}
/**
* @override
*/
release() {}
};
/**
* These are the listener types defined in the closure extern for EventTarget.
* @typedef {EventListener|function(!Event):*}
*/
shaka.util.FakeEventTarget.ListenerType;
/**
* @summary A set of BufferSource utility functions.
*/
shaka.util.BufferUtils = class {
/**
* Compare two buffers for equality. For buffers of different types, this
* compares the underlying buffers as binary data.
* @param {?BufferSource} arr1
* @param {?BufferSource} arr2
* @return {boolean}
* @suppress {strictMissingProperties}
*/
static equal(arr1, arr2) {}
/**
* Gets an ArrayBuffer that contains the data from the given TypedArray. Note
* this will allocate a new ArrayBuffer if the object is a partial view of
* the data.
* @param {!BufferSource} view
* @return {!ArrayBuffer}
*/
static toArrayBuffer(view) {}
/**
* Creates a new Uint8Array view on the same buffer. This clamps the values
* to be within the same view (i.e. you can't use this to move past the end
* of the view, even if the underlying buffer is larger). However, you can
* pass a negative offset to access the data before the view.
* @param {BufferSource} data
* @param {number=} offset The offset from the beginning of this data's view
* to start the new view at.
* @param {number=} length The byte length of the new view.
* @return {!Uint8Array}
*/
static toUint8(data, offset, length) {}
/**
* Creates a new Uint16Array view on the same buffer. This clamps the values
* to be within the same view (i.e. you can't use this to move past the end
* of the view, even if the underlying buffer is larger). However, you can
* pass a negative offset to access the data before the view.
* @param {BufferSource} data
* @param {number=} offset The offset from the beginning of this data's view
* to start the new view at.
* @param {number=} length The byte length of the new view.
* @return {!Uint16Array}
*/
static toUint16(data, offset, length) {}
/**
* Creates a DataView over the given buffer.
* @see toUint8
* @param {BufferSource} buffer
* @param {number=} offset
* @param {number=} length
* @return {!DataView}
*/
static toDataView(buffer, offset, length) {}
};
/**
* @summary
* Describes an error that happened.
* @description
* This uses numerical codes to describe
* which error happened.
* Some error are caused by errors from the browser. In these cases, the error
* object is provided as part of the <code>data</code> field. System codes come
* from the browser and may or may not be documented. Here are some places
* where the errors may be documented:
* <ul>
* <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
* <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
* <li><a href="https://hresult.info">Edge/PlayReady errors</a>
* </ul>
* @implements {shaka.extern.Error}
* @extends {Error}
*/
shaka.util.Error = class {
/**
* @param {shaka.util.Error.Severity} severity
* @param {shaka.util.Error.Category} category
* @param {shaka.util.Error.Code} code
* @param {...*} varArgs
*/
constructor(severity, category, code, ...varArgs) {}
};
/**
* @override
*/
shaka.util.Error.prototype.severity;
/**
* @override
*/
shaka.util.Error.prototype.category;
/**
* @override
*/
shaka.util.Error.prototype.code;
/**
* @override
*/
shaka.util.Error.prototype.data;
/**
* @override
*/
shaka.util.Error.prototype.handled;
/**
* @enum {number}
*/
shaka.util.Error.Severity = {
'RECOVERABLE': 1,
'CRITICAL': 2
};
/**
* @enum {number}
*/
shaka.util.Error.Category = {
'NETWORK': 1,
'TEXT': 2,
'MEDIA': 3,
'MANIFEST': 4,
'STREAMING': 5,
'DRM': 6,
'PLAYER': 7,
'CAST': 8,
'STORAGE': 9,
'ADS': 10
};
/**
* @enum {number}
*/
shaka.util.Error.Code = {
'UNSUPPORTED_SCHEME': 1000,
'BAD_HTTP_STATUS': 1001,
'HTTP_ERROR': 1002,
'TIMEOUT': 1003,
'MALFORMED_DATA_URI': 1004,
'REQUEST_FILTER_ERROR': 1006,
'RESPONSE_FILTER_ERROR': 1007,
'MALFORMED_TEST_URI': 1008,
'UNEXPECTED_TEST_REQUEST': 1009,
'ATTEMPTS_EXHAUSTED': 1010,
'SEGMENT_MISSING': 1011,
'INVALID_TEXT_HEADER': 2000,
'INVALID_TEXT_CUE': 2001,
'UNABLE_TO_DETECT_ENCODING': 2003,
'BAD_ENCODING': 2004,
'INVALID_XML': 2005,
'INVALID_MP4_TTML': 2007,
'INVALID_MP4_VTT': 2008,
'UNABLE_TO_EXTRACT_CUE_START_TIME': 2009,
'INVALID_MP4_CEA': 2010,
'TEXT_COULD_NOT_GUESS_MIME_TYPE': 2011,
'CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS': 2012,
'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
'MISSING_TEXT_PLUGIN': 2014,
'CHAPTERS_TRACK_FAILED': 2015,
'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
'BUFFER_READ_OUT_OF_BOUNDS': 3000,
'JS_INTEGER_OVERFLOW': 3001,
'EBML_OVERFLOW': 3002,
'EBML_BAD_FLOATING_POINT_SIZE': 3003,
'MP4_SIDX_WRONG_BOX_TYPE': 3004,
'MP4_SIDX_INVALID_TIMESCALE': 3005,
'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
'WEBM_CUES_ELEMENT_MISSING': 3007,
'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
'WEBM_INFO_ELEMENT_MISSING': 3010,
'WEBM_DURATION_ELEMENT_MISSING': 3011,
'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
'MEDIA_SOURCE_OPERATION_FAILED': 3014,
'MEDIA_SOURCE_OPERATION_THREW': 3015,
'VIDEO_ERROR': 3016,
'QUOTA_EXCEEDED_ERROR': 3017,
'TRANSMUXING_FAILED': 3018,
'CONTENT_TRANSFORMATION_FAILED': 3019,
'MSS_MISSING_DATA_FOR_TRANSMUXING': 3020,
'MSS_TRANSMUXING_FAILED': 3022,
'TRANSMUXING_NO_VIDEO_DATA': 3023,
'STREAMING_NOT_ALLOWED': 3024,
'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
'DASH_INVALID_XML': 4001,
'DASH_NO_SEGMENT_INFO': 4002,
'DASH_EMPTY_ADAPTATION_SET': 4003,
'DASH_EMPTY_PERIOD': 4004,
'DASH_WEBM_MISSING_INIT': 4005,
'DASH_UNSUPPORTED_CONTAINER': 4006,
'DASH_PSSH_BAD_ENCODING': 4007,
'DASH_NO_COMMON_KEY_SYSTEM': 4008,
'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
'DASH_CONFLICTING_KEY_IDS': 4010,
'RESTRICTIONS_CANNOT_BE_MET': 4012,
'HLS_PLAYLIST_HEADER_MISSING': 4015,
'INVALID_HLS_TAG': 4016,
'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
'HLS_REQUIRED_TAG_MISSING': 4024,
'HLS_COULD_NOT_GUESS_CODECS': 4025,
'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
'DASH_XLINK_DEPTH_LIMIT': 4028,
'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
'NO_VARIANTS': 4036,
'PERIOD_FLATTENING_FAILED': 4037,
'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,
'HLS_VARIABLE_NOT_FOUND': 4039,
'HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED': 4040,
'HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED': 4041,
'NO_WEB_CRYPTO_API': 4042,
'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM': 4045,
'MSS_INVALID_XML': 4046,
'MSS_LIVE_CONTENT_NOT_SUPPORTED': 4047,
'AES_128_INVALID_IV_LENGTH': 4048,
'AES_128_INVALID_KEY_LENGTH': 4049,
'DASH_CONFLICTING_AES_128': 4050,
'DASH_UNSUPPORTED_AES_128': 4051,
'DASH_INVALID_PATCH': 4052,
'HLS_EMPTY_MEDIA_PLAYLIST': 4053,
'DASH_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED': 4054,
'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
'FAILED_TO_CREATE_CDM': 6002,
'FAILED_TO_ATTACH_TO_VIDEO': 6003,
'INVALID_SERVER_CERTIFICATE': 6004,
'FAILED_TO_CREATE_SESSION': 6005,
'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
'LICENSE_REQUEST_FAILED': 6007,
'LICENSE_RESPONSE_REJECTED': 6008,
'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
'NO_LICENSE_SERVER_GIVEN': 6012,
'OFFLINE_SESSION_REMOVED': 6013,
'EXPIRED': 6014,
'SERVER_CERTIFICATE_REQUIRED': 6015,
'INIT_DATA_TRANSFORM_ERROR': 6016,
'SERVER_CERTIFICATE_REQUEST_FAILED': 6017,
'MIN_HDCP_VERSION_NOT_MATCH': 6018,
'ERROR_CHECKING_HDCP_VERSION': 6019,
'MISSING_EME_SUPPORT': 6020,
'LOAD_INTERRUPTED': 7000,
'OPERATION_ABORTED': 7001,
'NO_VIDEO_ELEMENT': 7002,
'OBJECT_DESTROYED': 7003,
'CONTENT_NOT_LOADED': 7004,
'SRC_EQUALS_PRELOAD_NOT_SUPPORTED': 7005,
'PRELOAD_DESTROYED': 7006,
'CAST_API_UNAVAILABLE': 8000,
'NO_CAST_RECEIVERS': 8001,
'ALREADY_CASTING': 8002,
'UNEXPECTED_CAST_ERROR': 8003,
'CAST_CANCELED_BY_USER': 8004,
'CAST_CONNECTION_TIMED_OUT': 8005,
'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
'STORAGE_NOT_SUPPORTED': 9000,
'INDEXED_DB_ERROR': 9001,
'DEPRECATED_OPERATION_ABORTED': 9002,
'REQUESTED_ITEM_NOT_FOUND': 9003,
'MALFORMED_OFFLINE_URI': 9004,
'CANNOT_STORE_LIVE_OFFLINE': 9005,
'NO_INIT_DATA_FOR_OFFLINE': 9007,
'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
'KEY_NOT_FOUND': 9012,
'MISSING_STORAGE_CELL': 9013,
'STORAGE_LIMIT_REACHED': 9014,
'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
'MODIFY_OPERATION_NOT_SUPPORTED': 9016,
'INDEXED_DB_INIT_TIMED_OUT': 9017,
'CS_IMA_SDK_MISSING': 10000,
'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
'SS_IMA_SDK_MISSING': 10002,
'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004,
'MT_AD_MANAGER_NOT_INITIALIZED': 10005,
'INTERSTITIAL_AD_MANAGER_NOT_INITIALIZED': 10006,
'VAST_INVALID_XML': 10007
};
/**
* A timer allows a single function to be executed at a later time or at
* regular intervals.
* @final
*/
shaka.util.Timer = class {
/**
* Create a new timer. A timer is committed to a single callback function.
* While there is no technical reason to do this, it is far easier to
* understand and use timers when they are connected to one functional idea.
* @param {function()} onTick
*/
constructor(onTick) {}
/**
* Have the timer call |onTick| now.
* @return {!shaka.util.Timer}
*/
tickNow() {}
/**
* Have the timer call |onTick| after |seconds| has elapsed unless |stop| is
* called first.
* @param {number} seconds
* @return {!shaka.util.Timer}
*/
tickAfter(seconds) {}
/**
* Have the timer call |onTick| every |seconds| until |stop| is called.
* @param {number} seconds
* @return {!shaka.util.Timer}
*/
tickEvery(seconds) {}
/**
* Stop the timer and clear the previous behaviour. The timer is still usable
* after calling |stop|.
*/
stop() {}
};
/**
* @namespace shaka.util.StringUtils
* @summary A set of string utility functions.
*/
shaka.util.StringUtils = class {
/**
* Creates a string from the given buffer as UTF-8 encoding.
* @param {?BufferSource} data
* @return {string}
*/
static fromUTF8(data) {}
/**
* Creates a string from the given buffer as UTF-16 encoding.
* @param {?BufferSource} data
* @param {boolean} littleEndian
true to read little endian, false to read big.
* @param {boolean=} noThrow true to avoid throwing in cases where we may
* expect invalid input. If noThrow is true and the data has an odd
* length,it will be truncated.
* @return {string}
*/
static fromUTF16(data, littleEndian, noThrow) {}
/**
* Creates a string from the given buffer, auto-detecting the encoding that is
* being used. If it cannot detect the encoding, it will throw an exception.
* @param {?BufferSource} data
* @return {string}
*/
static fromBytesAutoDetect(data) {}
/**
* Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
* @param {string} str
* @return {!ArrayBuffer}
*/
static toUTF8(str) {}
/**
* Creates a ArrayBuffer from the given string, converting to UTF-16 encoding.
* @param {string} str
* @param {boolean} littleEndian
* @return {!ArrayBuffer}
*/
static toUTF16(str, littleEndian) {}
/**
* Resets the fromCharCode method's implementation.
* For debug use.
*/
static resetFromCharCode() {}
};
/**
* @summary A set of Uint8Array utility functions.
*/
shaka.util.Uint8ArrayUtils = class {
/**
* Convert a buffer to a base64 string. The output will be standard
* alphabet as opposed to base64url safe alphabet.
* @param {BufferSource} data
* @return {string}
*/
static toStandardBase64(data) {}
/**
* Convert a buffer to a base64 string. The output will always use the
* alternate encoding/alphabet also known as "base64url".
* @param {BufferSource} data
* @param {boolean=} padding If true, pad the output with equals signs.
* Defaults to true.
* @return {string}
*/
static toBase64(data, padding) {}
/**
* Convert a base64 string to a Uint8Array. Accepts either the standard
* alphabet or the alternate "base64url" alphabet.
* @param {string} str
* @return {!Uint8Array}
*/
static fromBase64(str) {}
/**
* Convert a hex string to a Uint8Array.
* @param {string} str
* @return {!Uint8Array}
*/
static fromHex(str) {}
/**
* Convert a buffer to a hex string.
* @param {BufferSource} data
* @return {string}
*/
static toHex(data) {}
/**
* Concatenate buffers.
* @param {...BufferSource} varArgs
* @return {!Uint8Array}
*/
static concat(...varArgs) {}
};
/**
* @summary A set of language utility functions.
* @final
*/
shaka.util.LanguageUtils = class {
/**
* Check if |locale1| and |locale2| are locale-compatible.
* Locale-compatible is defined as all components in each locale match. Since
* we only respect the language and region components, we only check that
* the language and region components match.
* Examples:
* Locale A | Locale B | Locale Compatible
* ---------------------------------------
* en-US | en-US | true
* en | en-US | false
* en-US | en-CA | false
* @param {string} locale1
* @param {string} locale2
* @return {boolean}
*/
static areLocaleCompatible(locale1, locale2) {}
/**
* Check if |locale1| and |locale2| are language-compatible.
* Language compatible is when the language component of each locale matches.
* This means that no matter what region they have (or don't have) as long as
* the language components match, they are language-compatible.
* Examples:
* Locale A | Locale B | Language-Compatible
* -----------------------------------------
* en-US | en-US | true
* en-US | en | true
* en-US | en-CA | true
* en-CA | fr-CA | false
* @param {string} locale1
* @param {string} locale2
* @return {boolean}
*/
static areLanguageCompatible(locale1, locale2) {}
/**
* Check if |possibleParent| is the parent locale of |possibleChild|. Because
* we do not support dialects, the parent-child relationship is a lot simpler.
* In a parent child relationship:
* - The parent and child have the same language-component
* - The parent has no region-component
* - The child has a region-component
* Example:
* Locale A | Locale B | Is A The parent of B?
* --------------------------------------------
* en-US | en-US | no
* en-US | en | no
* en | en-US | yes
* en | en | no
* en | fr | no
* @param {string} possibleParent
* @param {string} possibleChild
* @return {boolean}
*/
static isParentOf(possibleParent, possibleChild) {}
/**
* Check if |localeA| shares the same parent with |localeB|. Since we don't
* support dialect, we will only look at language and region. For two locales
* to be siblings:
* - Both must have language-components
* - Both must have region-components
* - Both must have the same language-component
* Example:
* Locale A | Locale B | Siblings?
* --------------------------------------------
* en-US | en-US | yes
* en-US | en-CA | yes
* en-US | en | no
* en | en-US | no
* en | en | no
* en | fr | no
* @param {string} localeA
* @param {string} localeB
* @return {boolean}
*/
static isSiblingOf(localeA, localeB) {}
/**
* Normalize a locale. This will take a locale and canonicalize it to a state
* that we are prepared to work with.
* We only support with:
* - language
* - language-REGION
* If given a dialect, we will discard it. We will convert any 3-character
* codes to 2-character codes. We will force language codes to lowercase and
* region codes to uppercase.
* @param {string} locale
* @return {string}
*/
static normalize(locale) {}
/**
* Check if two language codes are siblings. Language codes are siblings if
* they share the same base language while neither one is the base language.
* For example, "en-US" and "en-CA" are siblings but "en-US" and "en" are not
* siblings.
* @param {string} a
* @param {string} b
* @return {boolean}
*/
static areSiblings(a, b) {}
/**
* Compute a numerical relatedness for language codes. Language codes with a
* higher relatedness are a better match. Unrelated language codes have a
* relatedness score of 0.
* @param {string} target
* @param {string} candidate
* @return {number}
*/
static relatedness(target, candidate) {}
/**
* Get the normalized base language for a language code.
* @param {string} lang
* @return {string}
*/
static getBase(lang) {}
/**
* Get the normalized language of the given text stream. Will return 'und' if
* a language is not found on the text stream.
* This should always be used to get the language from a text stream.
* @param {shaka.extern.Stream} stream
* @return {string}
*/
static getLocaleForText(stream) {}
/**
* Get the normalized locale for the given variant. This will look through
* the variant to find the locale that represents the content in the variant.
* This will return 'und' if no language can be found.
* This should always be used to get the locale from a variant.
* @param {shaka.extern.Variant} variant
* @return {string}
*/
static getLocaleForVariant(variant) {}
/**
* Find the locale in |searchSpace| that comes closest to |target|. If no
* locale is found to be close to |target|, then |null| will be returned.
* @param {string} target
* @param {!Iterable<string>} searchSpace
* @return {?string}
*/
static findClosestLocale(target, searchSpace) {}
};
/**
* Localization system provided by the shaka ui library.
* It can be used to store the various localized forms of
* strings that are expected to be displayed to the user.
* If a string is not available, it will return the localized
* form in the closest related locale.
* @final
*/
shaka.ui.Localization = class extends shaka.util.FakeEventTarget {
/**
* @param {string} fallbackLocale
* The fallback locale that should be used. It will be assumed that this
* locale should have entries for just about every request.
*/
constructor(fallbackLocale) {}
/**
* @override
*/
release() {}
/**
* Request the localization system to change which locale it serves. If any of
* of the preferred locales cannot be found, the localization system will fire
* an event identifying which locales it does not know. The localization
* system will then continue to operate using the closest matches it has.
* @param {!Iterable<string>} locales
* The locale codes for the requested locales in order of preference.
*/
changeLocale(locales) {}
/**
* Insert a set of localizations for a single locale. This will amend the
* existing localizations for the given locale.
* @param {string} locale
* The locale that the localizations should be added to.
* @param {!Map<string, string>} localizations
* A mapping of id to localized text that should used to modify the internal
* collection of localizations.
* @param {shaka.ui.Localization.ConflictResolution=} conflictResolution
* The strategy used to resolve conflicts when the id of an existing entry
* matches the id of a new entry. Default to |USE_NEW|, where the new
* entry will replace the old entry.
* @return {!shaka.ui.Localization}
* Returns |this| so that calls can be chained.
*/
insert(locale, localizations, conflictResolution) {}
/**
* Set the value under each key in |dictionary| to the resolved value.
* Convenient for apps with some kind of data binding system.
* Equivalent to:
* for (const key of dictionary.keys()) {
* dictionary.set(key, localization.resolve(key));
* }
* @param {!Map<string, string>} dictionary
*/
resolveDictionary(dictionary) {}
/**
* Request the localized string under the given id. If there is no localized
* version of the string, then the fallback localization will be given
* ("en" version). If there is no fallback localization, a non-null empty
* string will be returned.
* @param {string} id The id for the localization entry.
* @return {string}
*/
resolve(id) {}
/**
* The locales currently used. An empty set means "no preference".
* @return {!Set<string>}
*/
getCurrentLocales() {}
};
/**
* An enum for how the localization system should resolve conflicts between old
* translations and new translations.
* @enum {number}
*/
shaka.ui.Localization.ConflictResolution = {
'USE_OLD': 0,
'USE_NEW': 1
};
/**
* The event name for when locales were requested, but we could not find any
* entries for them. The localization system will continue to use the closest
* matches it has.
* @const {string}
*/
shaka.ui.Localization.UNKNOWN_LOCALES;
/**
* The event name for when an entry could not be found in the preferred locale,
* related locales, or the fallback locale.
* @const {string}
*/
shaka.ui.Localization.UNKNOWN_LOCALIZATION;
/**
* The event name for when entries are missing from the user's preferred
* locale, but we were able to find an entry in a related locale or the fallback
* locale.
* @const {string}
*/
shaka.ui.Localization.MISSING_LOCALIZATIONS;
/**
* The event name for when a new locale has been requested and any previously
* resolved values should be updated.
* @const {string}
*/
shaka.ui.Localization.LOCALE_CHANGED;
/**
* The event name for when |insert| was called and it changed entries that could
* affect previously resolved values.
* @const {string}
*/
shaka.ui.Localization.LOCALE_UPDATED;
/**
* @summary
* An EventManager maintains a collection of "event
* bindings" between event targets and event listeners.
* @implements {shaka.util.IReleasable}
*/
shaka.util.EventManager = class {
/** */
constructor() {}
/**
* Detaches all event listeners.
* @override
*/
release() {}
/**
* Attaches an event listener to an event target.
* @param {EventTarget} target The event target.
* @param {string} type The event type.
* @param {shaka.util.EventManager.ListenerType} listener The event listener.
* @param {(boolean|!AddEventListenerOptions)=} options An object that
* specifies characteristics about the event listener.
* The passive option, if true, indicates that this function will never
* call preventDefault(), which improves scrolling performance.
*/
listen(target, type, listener, options) {}
/**
* Attaches an event listener to an event target. The listener will be
* removed when the first instance of the event is fired.
* @param {EventTarget} target The event target.
* @param {string} type The event type.
* @param {shaka.util.EventManager.ListenerType} listener The event listener.
* @param {(boolean|!AddEventListenerOptions)=} options An object that
* specifies characteristics about the event listener.
* The passive option, if true, indicates that this function will never
* call preventDefault(), which improves scrolling performance.
*/
listenOnce(target, type, listener, options) {}
/**
* Detaches an event listener from an event target.
* @param {EventTarget} target The event target.
* @param {string} type The event type.
* @param {shaka.util.EventManager.ListenerType=} listener The event listener.
*/
unlisten(target, type, listener) {}
/**
* Detaches all event listeners from all targets.
*/
removeAll() {}
};
/**
* @typedef {function(!Event)}
*/
shaka.util.EventManager.ListenerType;
/**
* @enum {number}
*/
shaka.config.AutoShowText = {
'NEVER': 0,
'ALWAYS': 1,
'IF_PREFERRED_TEXT_LANGUAGE': 2,
'IF_SUBTITLES_MAY_BE_NEEDED': 3
};
/**
* @summary
* lcevcDec - (MPEG-5 Part 2 LCEVC - Decoder) provides
* all the operations related to the enhancement and rendering
* of LCEVC enabled streams and on to a canvas.
* @implements {shaka.util.IReleasable}
*/
shaka.lcevc.Dec = class {
/**
* @param {HTMLVideoElement} media The video element that will be attached to
* LCEVC Decoder for input.
* @param {HTMLCanvasElement} canvas The canvas element that will be attached
* to LCEVC Decoder to render the enhanced frames.
* @param {shaka.extern.LcevcConfiguration} lcevcConfig LCEVC configuration
* object to initialize the LCEVC Decoder.
* @param {boolean} isDualTrack
*/
constructor(media, canvas, lcevcConfig, isDualTrack) {}
/**
* Close LCEVC Decoder.
* @override
*/
release() {}
};
/**
* The IClosedCaptionParser defines the interface to provide all operations for
* parsing the closed captions embedded in Dash videos streams.
* TODO: Remove this interface and move method definitions
* directly to ClosedCaptionParser.
* @interface
*/
shaka.media.IClosedCaptionParser = class {
};
/**
* Closed Caption Parser provides all operations for parsing the closed captions
* embedded in Dash videos streams.
* @implements {shaka.media.IClosedCaptionParser}
* @final
*/
shaka.media.ClosedCaptionParser = class {
/**
* @param {string} mimeType
*/
constructor(mimeType) {}
/**
* @param {string} mimeType
* @param {!shaka.extern.CeaParserPlugin} plugin
*/
static registerParser(mimeType, plugin) {}
/**
* @param {string} mimeType
*/
static unregisterParser(mimeType) {}
/**
* @param {string} mimeType
* @return {?shaka.extern.CeaParserPlugin}
*/
static findParser(mimeType) {}
/**
* @param {!shaka.extern.CaptionDecoderPlugin} plugin
*/
static registerDecoder(plugin) {}
/**
*/
static unregisterDecoder() {}
/**
* @return {?shaka.extern.CaptionDecoderPlugin}
*/
static findDecoder() {}
};
/**
*/
shaka.text.CueRegion = class {
/** */
constructor() {}
};
/**
* Region identifier.
* @type {string}
*/
shaka.text.CueRegion.prototype.id;
/**
* The X offset to start the rendering area in viewportAnchorUnits of the
* video width.
* @type {number}
*/
shaka.text.CueRegion.prototype.viewportAnchorX;
/**
* The X offset to start the rendering area in viewportAnchorUnits of the
* video height.
* @type {number}
*/
shaka.text.CueRegion.prototype.viewportAnchorY;
/**
* The X offset to start the rendering area in percentage (0-100) of this
* region width.
* @type {number}
*/
shaka.text.CueRegion.prototype.regionAnchorX;
/**
* The Y offset to start the rendering area in percentage (0-100) of the
* region height.
* @type {number}
*/
shaka.text.CueRegion.prototype.regionAnchorY;
/**
* The width of the rendering area in widthUnits.
* @type {number}
*/
shaka.text.CueRegion.prototype.width;
/**
* The width of the rendering area in heightUnits.
* @type {number}
*/
shaka.text.CueRegion.prototype.height;
/**
* The units (percentage, pixels or lines) the region height is in.
* @type {shaka.text.CueRegion.units}
*/
shaka.text.CueRegion.prototype.heightUnits;
/**
* The units (percentage or pixels) the region width is in.
* @type {shaka.text.CueRegion.units}
*/
shaka.text.CueRegion.prototype.widthUnits;
/**
* The units (percentage or pixels) the region viewportAnchors are in.
* @type {shaka.text.CueRegion.units}
*/
shaka.text.CueRegion.prototype.viewportAnchorUnits;
/**
* If scroll=UP, it means that cues in the region will be added to the
* bottom of the region and will push any already displayed cues in the
* region up. Otherwise (scroll=NONE) cues will stay fixed at the location
* they were first painted in.
* @type {shaka.text.CueRegion.scrollMode}
*/
shaka.text.CueRegion.prototype.scroll;
/**
* @enum {number}
*/
shaka.text.CueRegion.units = {
'PX': 0,
'PERCENTAGE': 1,
'LINES': 2
};
/**
* @enum {string}
*/
shaka.text.CueRegion.scrollMode = {
'NONE': '',
'UP': 'up'
};
/**
*/
shaka.text.Cue = class {
/**
* @param {number} startTime
* @param {number} endTime
* @param {string} payload
*/
constructor(startTime, endTime, payload) {}
/**
* Create a copy of the cue with the same properties.
* @return {!shaka.text.Cue}
* @suppress {checkTypes} since we must use [] and "in" with a struct type.
*/
clone() {}
/**
* Check if two Cues have all the same values in all properties.
* @param {!shaka.text.Cue} cue1
* @param {!shaka.text.Cue} cue2
* @return {boolean}
* @suppress {checkTypes} since we must use [] and "in" with a struct type.
*/
static equal(cue1, cue2) {}
/**
* Parses cue payload, searches for styling entities and, if needed,
* modifies original payload and creates nested cues to better represent
* styling found in payload. All changes are done in-place.
* @param {!shaka.text.Cue} cue
* @param {!Map<string, !shaka.text.Cue>=} styles
*/
static parseCuePayload(cue, styles) {}
};
/**
* The start time of the cue in seconds, relative to the start of the
* presentation.
* @type {number}
*/
shaka.text.Cue.prototype.startTime;
/**
* The end time of the cue in seconds, relative to the start of the
* presentation.
* @type {number}
*/
shaka.text.Cue.prototype.endTime;
/**
* The text payload of the cue. If nestedCues is non-empty, this should be
* empty. Top-level block containers should have no payload of their own.
* @type {string}
*/
shaka.text.Cue.prototype.payload;
/**
* The region to render the cue into. Only supported on top-level cues,
* because nested cues are inline elements.
* @type {shaka.text.CueRegion}
*/
shaka.text.Cue.prototype.region;
/**
* The indent (in percent) of the cue box in the direction defined by the
* writing direction.
* @type {?number}
*/
shaka.text.Cue.prototype.position;
/**
* Position alignment of the cue.
* @type {shaka.text.Cue.positionAlign}
*/
shaka.text.Cue.prototype.positionAlign;
/**
* Size of the cue box (in percents), where 0 means "auto".
* @type {number}
*/
shaka.text.Cue.prototype.size;
/**
* Alignment of the text inside the cue box.
* @type {shaka.text.Cue.textAlign}
*/
shaka.text.Cue.prototype.textAlign;
/**
* Text direction of the cue.
* @type {shaka.text.Cue.direction}
*/
shaka.text.Cue.prototype.direction;
/**
* Text writing mode of the cue.
* @type {shaka.text.Cue.writingMode}
*/
shaka.text.Cue.prototype.writingMode;
/**
* The way to interpret line field. (Either as an integer line number or
* percentage from the display box).
* @type {shaka.text.Cue.lineInterpretation}
*/
shaka.text.Cue.prototype.lineInterpretation;
/**
* The offset from the display box in either number of lines or
* percentage depending on the value of lineInterpretation.
* @type {?number}
*/
shaka.text.Cue.prototype.line;
/**
* Separation between line areas inside the cue box in px or em
* (e.g. '100px'/'100em'). If not specified, this should be no less than
* the largest font size applied to the text in the cue.
* @type {string}.
*/
shaka.text.Cue.prototype.lineHeight;
/**
* Line alignment of the cue box.
* Start alignment means the cue box’s top side (for horizontal cues), left
* side (for vertical growing right), or right side (for vertical growing
* left) is aligned at the line.
* Center alignment means the cue box is centered at the line.
* End alignment The cue box’s bottom side (for horizontal cues), right side
* (for vertical growing right), or left side (for vertical growing left) is
* aligned at the line.
* @type {shaka.text.Cue.lineAlign}
*/
shaka.text.Cue.prototype.lineAlign;
/**
* Vertical alignments of the cues within their extents.
* 'BEFORE' means displaying the captions at the top of the text display
* container box, 'CENTER' means in the middle, 'AFTER' means at the bottom.
* @type {shaka.text.Cue.displayAlign}
*/
shaka.text.Cue.prototype.displayAlign;
/**
* Text color as a CSS color, e.g. "#FFFFFF" or "white".
* @type {string}
*/
shaka.text.Cue.prototype.color;
/**
* Text background color as a CSS color, e.g. "#FFFFFF" or "white".
* @type {string}
*/
shaka.text.Cue.prototype.backgroundColor;
/**
* The URL of the background image, e.g. "data:[mime type];base64,[data]".
* @type {string}
*/
shaka.text.Cue.prototype.backgroundImage;
/**
* The border around this cue as a CSS border.
* @type {string}
*/
shaka.text.Cue.prototype.border;
/**
* Text font size in px or em (e.g. '100px'/'100em').
* @type {string}
*/
shaka.text.Cue.prototype.fontSize;
/**
* Text font weight. Either normal or bold.
* @type {shaka.text.Cue.fontWeight}
*/
shaka.text.Cue.prototype.fontWeight;
/**
* Text font style. Normal, italic or oblique.
* @type {shaka.text.Cue.fontStyle}
*/
shaka.text.Cue.prototype.fontStyle;
/**
* Text font family.
* @type {string}
*/
shaka.text.Cue.prototype.fontFamily;
/**
* Text letter spacing as a CSS letter-spacing value.
* @type {string}
*/
shaka.text.Cue.prototype.letterSpacing;
/**
* Text line padding as a CSS line-padding value.
* @type {string}
*/
shaka.text.Cue.prototype.linePadding;
/**
* Opacity of the cue element, from 0-1.
* @type {number}
*/
shaka.text.Cue.prototype.opacity;
/**
* Text combine upright as a CSS text-combine-upright value.
* @type {string}
*/
shaka.text.Cue.prototype.textCombineUpright;
/**
* Text decoration. A combination of underline, overline
* and line through. Empty array means no decoration.
* @type {!Array<!shaka.text.Cue.textDecoration>}
*/
shaka.text.Cue.prototype.textDecoration;
/**
* Text shadow color as a CSS text-shadow value.
* @type {string}
*/
shaka.text.Cue.prototype.textShadow;
/**
* Text stroke color as a CSS color, e.g. "#FFFFFF" or "white".
* @type {string}
*/
shaka.text.Cue.prototype.textStrokeColor;
/**
* Text stroke width as a CSS stroke-width value.
* @type {string}
*/
shaka.text.Cue.prototype.textStrokeWidth;
/**
* Whether or not line wrapping should be applied to the cue.
* @type {boolean}
*/
shaka.text.Cue.prototype.wrapLine;
/**
* Id of the cue.
* @type {string}
*/
shaka.text.Cue.prototype.id;
/**
* Nested cues, which should be laid out horizontally in one block.
* Top-level cues are blocks, and nested cues are inline elements.
* Cues can be nested arbitrarily deeply.
* @type {!Array<!shaka.text.Cue>}
*/
shaka.text.Cue.prototype.nestedCues;
/**
* If true, this represents a container element that is "above" the main
* cues. For example, the <body> and <div> tags that contain the <p> tags
* in a TTML file. This controls the flow of the final cues; any nested cues
* within an "isContainer" cue will be laid out as separate lines.
* @type {boolean}
*/
shaka.text.Cue.prototype.isContainer;
/**
* Whether or not the cue only acts as a line break between two nested cues.
* Should only appear in nested cues.
* @type {boolean}
*/
shaka.text.Cue.prototype.lineBreak;
/**
* Used to indicate the type of ruby tag that should be used when rendering
* the cue. Valid values: ruby, rp, rt.
* @type {?string}
*/
shaka.text.Cue.prototype.rubyTag;
/**
* The number of horizontal and vertical cells into which the Root Container
* Region area is divided.
* @type {{ columns: number, rows: number }}
*/
shaka.text.Cue.prototype.cellResolution;
/**
* @enum {string}
*/
shaka.text.Cue.positionAlign = {
'LEFT': 'line-left',
'RIGHT': 'line-right',
'CENTER': 'center',
'AUTO': 'auto'
};
/**
* @enum {string}
*/
shaka.text.Cue.textAlign = {
'LEFT': 'left',
'RIGHT': 'right',
'CENTER': 'center',
'START': 'start',
'END': 'end'
};
/**
* Vertical alignments of the cues within their extents.
* 'BEFORE' means displaying at the top of the captions container box, 'CENTER'
* means in the middle, 'AFTER' means at the bottom.
* @enum {string}
*/
shaka.text.Cue.displayAlign = {
'BEFORE': 'before',
'CENTER': 'center',
'AFTER': 'after'
};
/**
* @enum {string}
*/
shaka.text.Cue.direction = {
'HORIZONTAL_LEFT_TO_RIGHT': 'ltr',
'HORIZONTAL_RIGHT_TO_LEFT': 'rtl'
};
/**
* @enum {string}
*/
shaka.text.Cue.writingMode = {
'HORIZONTAL_TOP_TO_BOTTOM': 'horizontal-tb',
'VERTICAL_LEFT_TO_RIGHT': 'vertical-lr',
'VERTICAL_RIGHT_TO_LEFT': 'vertical-rl'
};
/**
* @enum {number}
*/
shaka.text.Cue.lineInterpretation = {
'LINE_NUMBER': 0,
'PERCENTAGE': 1
};
/**
* @enum {string}
*/
shaka.text.Cue.lineAlign = {
'CENTER': 'center',
'START': 'start',
'END': 'end'
};
/**
* Default text color according to
* https://w3c.github.io/webvtt/#default-text-color
* @enum {string}
*/
shaka.text.Cue.defaultTextColor = {
'white': 'white',
'lime': 'lime',
'cyan': 'cyan',
'red': 'red',
'yellow': 'yellow',
'magenta': 'magenta',
'blue': 'blue',
'black': 'black'
};
/**
* Default text background color according to
* https://w3c.github.io/webvtt/#default-text-background
* @enum {string}
*/
shaka.text.Cue.defaultTextBackgroundColor = {
'bg_white': 'white',
'bg_lime': 'lime',
'bg_cyan': 'cyan',
'bg_red': 'red',
'bg_yellow': 'yellow',
'bg_magenta': 'magenta',
'bg_blue': 'blue',
'bg_black': 'black'
};
/**
* In CSS font weight can be a number, where 400 is normal and 700 is bold.
* Use these values for the enum for consistency.
* @enum {number}
*/
shaka.text.Cue.fontWeight = {
'NORMAL': 400,
'BOLD': 700
};
/**
* @enum {string}
*/
shaka.text.Cue.fontStyle = {
'NORMAL': 'normal',
'ITALIC': 'italic',
'OBLIQUE': 'oblique'
};
/**
* @enum {string}
*/
shaka.text.Cue.textDecoration = {
'UNDERLINE': 'underline',
'LINE_THROUGH': 'lineThrough',
'OVERLINE': 'overline'
};
/**
* An interface to standardize how objects are destroyed.
* @interface
*/
shaka.util.IDestroyable = class {
/**
* Request that this object be destroyed, releasing all resources and shutting
* down all operations. Returns a Promise which is resolved when destruction
* is complete. This Promise should never be rejected.
* @return {!Promise}
*/
destroy() {}
};
/**
* @summary Manages transmuxer plugins.
* @implements {shaka.util.IDestroyable}
*/
shaka.transmuxer.TransmuxerEngine = class {
/**
* @override
*/
destroy() {}
/**
* @param {string} mimeType
* @param {!shaka.extern.TransmuxerPlugin} plugin
* @param {number} priority
*/
static registerTransmuxer(mimeType, plugin, priority) {}
/**
* @param {string} mimeType
* @param {number} priority
*/
static unregisterTransmuxer(mimeType, priority) {}
/**
* @param {string} mimeType
* @param {string=} contentType
* @return {?shaka.extern.TransmuxerPlugin}
*/
static findTransmuxer(mimeType, contentType) {}
};
/**
* Priority level for transmuxer plugins.
* If multiple plugins are provided for the same mime type, only the
* highest-priority one is used.
* @enum {number}
*/
shaka.transmuxer.TransmuxerEngine.PluginPriority = {
'FALLBACK': 1,
'PREFERRED_SECONDARY': 2,
'PREFERRED': 3,
'APPLICATION': 4
};
/**
* @summary A set of utility functions for dealing with MIME types.
*/
shaka.util.MimeUtils = class {
/**
* Takes a MIME type and optional codecs string and produces the full MIME
* type. Also remove the codecs for raw formats.
* @param {string} mimeType
* @param {string=} codecs
* @return {string}
*/
static getFullType(mimeType, codecs) {}
/**
* Takes a MIME type and optional codecs string and produces the full MIME
* type.
* @param {string} mimeType
* @param {string=} codecs
* @return {string}
*/
static getFullTypeWithAllCodecs(mimeType, codecs) {}
};
/**
* @summary Manages text parsers and cues.
* @implements {shaka.util.IDestroyable}
*/
shaka.text.TextEngine = class {
/** @param {shaka.extern.TextDisplayer} displayer */
constructor(displayer) {}
/**
* @param {string} mimeType
* @param {!shaka.extern.TextParserPlugin} plugin
*/
static registerParser(mimeType, plugin) {}
/**
* @param {string} mimeType
*/
static unregisterParser(mimeType) {}
/**
* @return {?shaka.extern.TextParserPlugin}
*/
static findParser(mimeType) {}
/**
* @override
*/
destroy() {}
};
/**
* @summary A set of utility functions for dealing with Streams and Manifests.
*/
shaka.util.StreamUtils = class {
/**
* @param {shaka.extern.Variant} variant
* @param {shaka.extern.Restrictions} restrictions
* Configured restrictions from the user.
* @param {shaka.extern.Resolution} maxHwRes
* The maximum resolution the hardware can handle.
* This is applied separately from user restrictions because the setting
* should not be easily replaced by the user's configuration.
* @return {boolean}
*/
static meetsRestrictions(variant, restrictions, maxHwRes) {}
};
/**
* @summary
* <p>
* This defines the default ABR manager for the Player. An instance of this
* class is used when no ABR manager is given.
* </p>
* <p>
* The behavior of this class is to take throughput samples using
* segmentDownloaded to estimate the current network bandwidth. Then it will
* use that to choose the streams that best fit the current bandwidth. It will
* always pick the highest bandwidth variant it thinks can be played.
* </p>
* <p>
* After initial choices are made, this class will call switchCallback() when
* there is a better choice. switchCallback() will not be called more than once
* per ({@link shaka.abr.SimpleAbrManager.SWITCH_INTERVAL_MS}).
* </p>
* @implements {shaka.extern.AbrManager}
* @implements {shaka.util.IReleasable}
*/
shaka.abr.SimpleAbrManager = class {
/** */
constructor() {}
/**
* @override
*/
stop() {}
/**
* @override
*/
release() {}
/**
* @override
*/
init(switchCallback) {}
/**
* @return {shaka.extern.Variant}
* @override
*/
chooseVariant() {}
/**
* @override
*/
enable() {}
/**
* @override
*/
disable() {}
/**
* @param {number} deltaTimeMs The duration, in milliseconds, that the request
* took to complete.
* @param {number} numBytes The total number of bytes transferred.
* @param {boolean} allowSwitch Indicate if the segment is allowed to switch
* to another stream.
* @param {shaka.extern.Request=} request
* A reference to the request
* @override
*/
segmentDownloaded(deltaTimeMs, numBytes, allowSwitch, request) {}
/**
* @override
*/
trySuggestStreams() {}
/**
* @override
*/
getBandwidthEstimate() {}
/**
* @override
*/
setVariants(variants) {}
/**
* @override
*/
playbackRateChanged(rate) {}
/**
* @override
*/
setMediaElement(mediaElement) {}
/**
* @override
*/
setCmsdManager(cmsdManager) {}
/**
* @override
*/
configure(config) {}
};
/**
* @enum {string}
*/
shaka.config.CrossBoundaryStrategy = {
'KEEP': 'keep',
'RESET': 'reset',
'RESET_TO_ENCRYPTED': 'reset_to_encrypted',
'RESET_ON_ENCRYPTION_CHANGE': 'RESET_ON_ENCRYPTION_CHANGE'
};
/**
* A utility to wrap abortable operations. Note that these are not cancelable.
* Cancellation implies undoing what has been done so far, whereas aborting only
* means that further work is stopped.
* @implements {shaka.extern.IAbortableOperation<T>}
* @template T
*/
shaka.util.AbortableOperation = class {
/**
* @param {!Promise<T>} promise
* A Promise which represents the underlying operation. It is resolved when
* the operation is complete, and rejected if the operation fails or is
* aborted. Aborted operations should be rejected with a shaka.util.Error
* object using the error code OPERATION_ABORTED.
* @param {function():!Promise} onAbort
* Will be called by this object to abort the underlying operation.
* This is not cancellation, and will not necessarily result in any work
* being undone. abort() should return a Promise which is resolved when the
* underlying operation has been aborted. The returned Promise should never
* be rejected.
*/
constructor(promise, onAbort) {}
/**
* @return {boolean} True if the operation has been aborted.
*/
aborted() {}
/**
* @param {!shaka.util.Error} error
* @return {!shaka.util.AbortableOperation} An operation which has already
* failed with the error given by the caller.
*/
static failed(error) {}
/**
* @return {!shaka.util.AbortableOperation} An operation which has already
* failed with the error OPERATION_ABORTED.
*/
static aborted() {}
/**
* @param {U} value
* @return {!shaka.util.AbortableOperation.<U>} An operation which has already
* completed with the given value.
* @template U
*/
static completed(value) {}
/**
* @param {!Promise<U>} promise
* @return {!shaka.util.AbortableOperation.<U>} An operation which cannot be
* aborted. It will be completed when the given Promise is resolved, or
* will be failed when the given Promise is rejected.
* @template U
*/
static notAbortable(promise) {}
/**
* @override
*/
abort() {}
/**
* @param {!Array<!shaka.util.AbortableOperation>} operations
* @return {!shaka.util.AbortableOperation} An operation which is resolved
* when all operations are successful and fails when any operation fails.
* For this operation, abort() aborts all given operations.
*/
static all(operations) {}
/**
* @override
*/
finally(onFinal) {