UNPKG

shaka-player

Version:
1,690 lines (1,688 loc) 139 kB
/*! @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.cea = {}; /** @const */ shaka.config = {}; /** @const */ shaka.dash = {}; /** @const */ shaka.drm = {}; /** @const */ shaka.lcevc = {}; /** @const */ shaka.media = {}; /** @const */ shaka.media.SegmentPrefetch = {}; /** @const */ shaka.net = {}; /** @const */ shaka.text = {}; /** @const */ shaka.transmuxer = {}; /** @const */ shaka.util = {}; /** @const */ shaka.util.CmcdManager = {}; /** * 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 * 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 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 * 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 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) {} }; /** * @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) {} }; /** * @summary DataViewReader abstracts a DataView object. */ shaka.util.DataViewReader = class { /** * @param {BufferSource} data * @param {shaka.util.DataViewReader.Endianness} endianness The endianness. */ constructor(data, endianness) {} /** * @return {boolean} True if the reader has more data, false otherwise. */ hasMoreData() {} /** * Gets the current byte position. * @return {number} */ getPosition() {} /** * Gets the byte length of the DataView. * @return {number} */ getLength() {} /** * Reads an unsigned 8 bit integer, and advances the reader. * @return {number} The integer. */ readUint8() {} /** * Reads an unsigned 16 bit integer, and advances the reader. * @return {number} The integer. */ readUint16() {} /** * Reads an unsigned 32 bit integer, and advances the reader. * @return {number} The integer. */ readUint32() {} /** * Reads a signed 32 bit integer, and advances the reader. * @return {number} The integer. */ readInt32() {} /** * Reads an unsigned 64 bit integer, and advances the reader. * @return {number} The integer. */ readUint64() {} /** * Reads the specified number of raw bytes. * @param {number} bytes The number of bytes to read. * @return {!Uint8Array} */ readBytes(bytes) {} /** * Skips the specified number of bytes. * @param {number} bytes The number of bytes to skip. */ skip(bytes) {} /** * Rewinds the specified number of bytes. * @param {number} bytes The number of bytes to rewind. */ rewind(bytes) {} /** * Seeks to a specified position. * @param {number} position The desired byte position within the DataView. */ seek(position) {} /** * Keeps reading until it reaches a byte that equals to zero. The text is * assumed to be UTF-8. * @return {string} */ readTerminatedString() {} }; /** * Endianness. * @enum {number} */ shaka.util.DataViewReader.Endianness = { 'BIG_ENDIAN': 0, 'LITTLE_ENDIAN': 1 }; /** * CEA-X08 captions decoder. * @implements {shaka.extern.ICaptionDecoder} */ shaka.cea.CeaDecoder = class { /** */ constructor() {} }; /** */ shaka.util.Mp4Parser = class { /** */ constructor() {} /** * Declare a box type as a Box. * @param {string} type * @param {!shaka.util.Mp4Parser.CallbackType} definition * @return {!shaka.util.Mp4Parser} */ box(type, definition) {} /** * Declare a box type as a Full Box. * @param {string} type * @param {!shaka.util.Mp4Parser.CallbackType} definition * @return {!shaka.util.Mp4Parser} */ fullBox(type, definition) {} /** * Stop parsing. Useful for extracting information from partial segments and * avoiding an out-of-bounds error once you find what you are looking for. */ stop() {} /** * Parse the given data using the added callbacks. * @param {!BufferSource} data * @param {boolean=} partialOkay If true, allow 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. * @param {boolean=} stopOnPartial If true, stop reading if an incomplete * box is detected. */ parse(data, partialOkay, stopOnPartial) {} /** * Parse the next box on the current level. * @param {number} absStart The absolute start position in the original * byte array. * @param {!shaka.util.DataViewReader} reader * @param {boolean=} partialOkay If true, allow 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. * @param {boolean=} stopOnPartial If true, stop reading if an incomplete * box is detected. */ parseNext(absStart, reader, partialOkay, stopOnPartial) {} /** * A callback that tells the Mp4 parser to treat the body of a box as a series * of boxes. The number of boxes is limited by the size of the parent box. * @param {!shaka.extern.ParsedBox} box */ static children(box) {} /** * A callback that tells the Mp4 parser to treat the body of a box as a sample * description. A sample description box has a fixed number of children. The * number of children is represented by a 4 byte unsigned integer. Each child * is a box. * @param {!shaka.extern.ParsedBox} box */ static sampleDescription(box) {} /** * A callback that tells the Mp4 parser to treat the body of a box as a visual * sample entry. A visual sample entry has some fixed-sized fields * describing the video codec parameters, followed by an arbitrary number of * appended children. Each child is a box. * @param {!shaka.extern.ParsedBox} box */ static visualSampleEntry(box) {} /** * A callback that tells the Mp4 parser to treat the body of a box as a audio * sample entry. A audio sample entry has some fixed-sized fields * describing the audio codec parameters, followed by an arbitrary number of * appended children. Each child is a box. * @param {!shaka.extern.ParsedBox} box */ static audioSampleEntry(box) {} /** * Create a callback that tells the Mp4 parser to treat the body of a box as a * binary blob and to parse the body's contents using the provided callback. * @param {function(!Uint8Array)} callback * @return {!shaka.util.Mp4Parser.CallbackType} */ static allData(callback) {} /** * Convert an integer type from a box into an ascii string name. * Useful for debugging. * @param {number} type The type of the box, a uint32. * @return {string} */ static typeToString(type) {} /** * Find the header size of the box. * Useful for modifying boxes in place or finding the exact offset of a field. * @param {shaka.extern.ParsedBox} box * @return {number} */ static headerSize(box) {} }; /** * @typedef {function(!shaka.extern.ParsedBox)} */ shaka.util.Mp4Parser.CallbackType; /** * MPEG4 stream parser used for extracting 708 closed captions data. * @implements {shaka.extern.ICeaParser} */ shaka.cea.Mp4CeaParser = class { /** */ constructor() {} }; /** * @summary * Parser for exponential Golomb codes, a variable-bit width number encoding * scheme used by h264. * Based on https://github.com/videojs/mux.js/blob/main/lib/utils/exp-golomb.js */ shaka.util.ExpGolomb = class { /** * @param {!Uint8Array} data * @param {boolean=} convertEbsp2rbsp */ constructor(data, convertEbsp2rbsp) {} }; /** * @summary A set of Id3Utils utility functions. */ shaka.util.Id3Utils = class { /** * Returns an array of ID3 frames found in all the ID3 tags in the id3Data * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags * @return {!Array<shaka.extern.MetadataFrame>} */ static getID3Frames(id3Data) {} /** * Returns any adjacent ID3 tags found in data starting at offset, as one * block of data * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags * @param {number=} offset - The offset at which to start searching * @return {!Uint8Array} */ static getID3Data(id3Data, offset) {} }; /** * @see https://en.wikipedia.org/wiki/MPEG_transport_stream */ shaka.util.TsParser = class { /** */ constructor() {} /** * Clear previous data */ clearData() {} /** * Parse the given data * @param {Uint8Array} data * @return {!shaka.util.TsParser} */ parse(data) {} /** * Parse AVC Nalus * The code is based on hls.js * Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts * @param {shaka.extern.MPEG_PES} pes * @param {?shaka.extern.MPEG_PES=} nextPes * @return {!Array<shaka.extern.VideoNalu>} */ parseAvcNalus(pes, nextPes) {} /** * Parse AVC and HVC Nalus * The code is based on hls.js * Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts * @param {shaka.extern.MPEG_PES} pes * @param {{nalu: ?shaka.extern.VideoNalu, state: ?number}} lastInfo * @return {!Array<shaka.extern.VideoNalu>} */ parseNalus(pes, lastInfo) {} /** * Return the ID3 metadata * @return {!Array<shaka.extern.ID3Metadata>} */ getMetadata() {} /** * Return the audio data * @return {!Array<shaka.extern.MPEG_PES>} */ getAudioData() {} /** * Return the video data * @param {boolean=} naluProcessing * @return {!Array<shaka.extern.MPEG_PES>} */ getVideoData(naluProcessing) {} /** * Return the start time for the audio and video * @param {string} contentType * @return {?number} */ getStartTime(contentType) {} /** * Return the audio and video codecs * @return {{audio: ?string, video: ?string}} */ getCodecs() {} /** * Return the video data * @return {!Array<shaka.extern.VideoNalu>} */ getVideoNalus() {} /** * Return the video resolution * @return {{height: ?string, width: ?string}