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AK,WACH,OAAOtC,KAAK8zF,kBAAkB7nC,gBAChC,GAMC,CACDxtD,IAAK,UACL6D,IAAK,WACH,OAAOtC,KAAK8zF,kBAAkB73D,OAChC,GAOC,CACDx9B,IAAK,aACL6D,IAAK,WACH,OAAOtC,KAAK8zF,kBAAkBr3D,UAChC,GAKC,CACDh+B,IAAK,gBACL6D,IAAK,WACH,OAAOtC,KAAK8zF,kBAAkBx3D,aAChC,GAKC,CACD79B,IAAK,QACL6D,IAAK,WACH,OAAOtC,KAAK8zF,kBAAkBl2D,KAChC,GAKC,CACDn/B,IAAK,iBACL6D,IAAK,WACH,OAAOtC,KAAKgoF,iBAAiB55C,cAC/B,IACE,CAAC,CACH3vC,IAAK,UACL6D,IAIA,WACE,MAAO,QACT,GACC,CACD7D,IAAK,SACL6D,IAAK,WACH,OAAO4D,CACT,GACC,CACDzH,IAAK,aACL6D,IAAK,WACH,OAAO6D,CACT,GACC,CACD1H,IAAK,eACL6D,IAAK,WACH,OAAO8D,CACT,GAKC,CACD3H,IAAK,gBACL6D,IAAK,WACH,OAAKkxF,EAAIZ,cAGFY,EAAIZ,cAFFjD,EAGX,EAKAptF,IAAK,SAAaqwF,GAChBY,EAAIZ,cAAgBA,CACtB,KAEKY,CACT,CAvyBuB,GA0yBvB,OAFAA,GAAIZ,mBAAgB,EAEbY,EAER,CA74lBiFwC,EA84lBjF,CAh5lBD,EAg5lBG,E","sources":["webpack://sakurairo-scripts/./node_modules/.pnpm/hls.js@1.4.12/node_modules/hls.js/dist/hls.light.js"],"sourcesContent":["(function __HLS_WORKER_BUNDLE__(__IN_WORKER__){\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Hls = factory());\n})(this, (function () { 'use strict';\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n }\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n }\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n _setPrototypeOf(subClass, superClass);\n }\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n }\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n }\n function _construct(Parent, args, Class) {\n if (_isNativeReflectConstruct()) {\n _construct = Reflect.construct.bind();\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) _setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n }\n function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n }\n function _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !_isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return _construct(Class, arguments, _getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return _setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n }\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n }\n function _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n }\n\n function getDefaultExportFromCjs (x) {\n \treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n }\n\n var urlToolkit = {exports: {}};\n\n (function (module, exports) {\n \t// see https://tools.ietf.org/html/rfc1808\n\n \t(function (root) {\n \t var URL_REGEX =\n \t /^(?=((?:[a-zA-Z0-9+\\-.]+:)?))\\1(?=((?:\\/\\/[^\\/?#]*)?))\\2(?=((?:(?:[^?#\\/]*\\/)*[^;?#\\/]*)?))\\3((?:;[^?#]*)?)(\\?[^#]*)?(#[^]*)?$/;\n \t var FIRST_SEGMENT_REGEX = /^(?=([^\\/?#]*))\\1([^]*)$/;\n \t var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n \t var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n\n \t var URLToolkit = {\n \t // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n \t // E.g\n \t // With opts.alwaysNormalize = false (default, spec compliant)\n \t // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n \t // With opts.alwaysNormalize = true (not spec compliant)\n \t // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n \t buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n \t opts = opts || {};\n \t // remove any remaining space and CRLF\n \t baseURL = baseURL.trim();\n \t relativeURL = relativeURL.trim();\n \t if (!relativeURL) {\n \t // 2a) If the embedded URL is entirely empty, it inherits the\n \t // entire base URL (i.e., is set equal to the base URL)\n \t // and we are done.\n \t if (!opts.alwaysNormalize) {\n \t return baseURL;\n \t }\n \t var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n \t if (!basePartsForNormalise) {\n \t throw new Error('Error trying to parse base URL.');\n \t }\n \t basePartsForNormalise.path = URLToolkit.normalizePath(\n \t basePartsForNormalise.path\n \t );\n \t return URLToolkit.buildURLFromParts(basePartsForNormalise);\n \t }\n \t var relativeParts = URLToolkit.parseURL(relativeURL);\n \t if (!relativeParts) {\n \t throw new Error('Error trying to parse relative URL.');\n \t }\n \t if (relativeParts.scheme) {\n \t // 2b) If the embedded URL starts with a scheme name, it is\n \t // interpreted as an absolute URL and we are done.\n \t if (!opts.alwaysNormalize) {\n \t return relativeURL;\n \t }\n \t relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n \t return URLToolkit.buildURLFromParts(relativeParts);\n \t }\n \t var baseParts = URLToolkit.parseURL(baseURL);\n \t if (!baseParts) {\n \t throw new Error('Error trying to parse base URL.');\n \t }\n \t if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n \t // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n \t // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n \t var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n \t baseParts.netLoc = pathParts[1];\n \t baseParts.path = pathParts[2];\n \t }\n \t if (baseParts.netLoc && !baseParts.path) {\n \t baseParts.path = '/';\n \t }\n \t var builtParts = {\n \t // 2c) Otherwise, the embedded URL inherits the scheme of\n \t // the base URL.\n \t scheme: baseParts.scheme,\n \t netLoc: relativeParts.netLoc,\n \t path: null,\n \t params: relativeParts.params,\n \t query: relativeParts.query,\n \t fragment: relativeParts.fragment,\n \t };\n \t if (!relativeParts.netLoc) {\n \t // 3) If the embedded URL's <net_loc> is non-empty, we skip to\n \t // Step 7. Otherwise, the embedded URL inherits the <net_loc>\n \t // (if any) of the base URL.\n \t builtParts.netLoc = baseParts.netLoc;\n \t // 4) If the embedded URL path is preceded by a slash \"/\", the\n \t // path is not relative and we skip to Step 7.\n \t if (relativeParts.path[0] !== '/') {\n \t if (!relativeParts.path) {\n \t // 5) If the embedded URL path is empty (and not preceded by a\n \t // slash), then the embedded URL inherits the base URL path\n \t builtParts.path = baseParts.path;\n \t // 5a) if the embedded URL's <params> is non-empty, we skip to\n \t // step 7; otherwise, it inherits the <params> of the base\n \t // URL (if any) and\n \t if (!relativeParts.params) {\n \t builtParts.params = baseParts.params;\n \t // 5b) if the embedded URL's <query> is non-empty, we skip to\n \t // step 7; otherwise, it inherits the <query> of the base\n \t // URL (if any) and we skip to step 7.\n \t if (!relativeParts.query) {\n \t builtParts.query = baseParts.query;\n \t }\n \t }\n \t } else {\n \t // 6) The last segment of the base URL's path (anything\n \t // following the rightmost slash \"/\", or the entire path if no\n \t // slash is present) is removed and the embedded URL's path is\n \t // appended in its place.\n \t var baseURLPath = baseParts.path;\n \t var newPath =\n \t baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) +\n \t relativeParts.path;\n \t builtParts.path = URLToolkit.normalizePath(newPath);\n \t }\n \t }\n \t }\n \t if (builtParts.path === null) {\n \t builtParts.path = opts.alwaysNormalize\n \t ? URLToolkit.normalizePath(relativeParts.path)\n \t : relativeParts.path;\n \t }\n \t return URLToolkit.buildURLFromParts(builtParts);\n \t },\n \t parseURL: function (url) {\n \t var parts = URL_REGEX.exec(url);\n \t if (!parts) {\n \t return null;\n \t }\n \t return {\n \t scheme: parts[1] || '',\n \t netLoc: parts[2] || '',\n \t path: parts[3] || '',\n \t params: parts[4] || '',\n \t query: parts[5] || '',\n \t fragment: parts[6] || '',\n \t };\n \t },\n \t normalizePath: function (path) {\n \t // The following operations are\n \t // then applied, in order, to the new path:\n \t // 6a) All occurrences of \"./\", where \".\" is a complete path\n \t // segment, are removed.\n \t // 6b) If the path ends with \".\" as a complete path segment,\n \t // that \".\" is removed.\n \t path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n \t // 6c) All occurrences of \"<segment>/../\", where <segment> is a\n \t // complete path segment not equal to \"..\", are removed.\n \t // Removal of these path segments is performed iteratively,\n \t // removing the leftmost matching pattern on each iteration,\n \t // until no matching pattern remains.\n \t // 6d) If the path ends with \"<segment>/..\", where <segment> is a\n \t // complete path segment not equal to \"..\", that\n \t // \"<segment>/..\" is removed.\n \t while (\n \t path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length\n \t ) {}\n \t return path.split('').reverse().join('');\n \t },\n \t buildURLFromParts: function (parts) {\n \t return (\n \t parts.scheme +\n \t parts.netLoc +\n \t parts.path +\n \t parts.params +\n \t parts.query +\n \t parts.fragment\n \t );\n \t },\n \t };\n\n \t module.exports = URLToolkit;\n \t})(); \n } (urlToolkit));\n\n var urlToolkitExports = urlToolkit.exports;\n\n var isFiniteNumber = Number.isFinite || function (value) {\n return typeof value === 'number' && isFinite(value);\n };\n\n var Events = /*#__PURE__*/function (Events) {\n Events[\"MEDIA_ATTACHING\"] = \"hlsMediaAttaching\";\n Events[\"MEDIA_ATTACHED\"] = \"hlsMediaAttached\";\n Events[\"MEDIA_DETACHING\"] = \"hlsMediaDetaching\";\n Events[\"MEDIA_DETACHED\"] = \"hlsMediaDetached\";\n Events[\"BUFFER_RESET\"] = \"hlsBufferReset\";\n Events[\"BUFFER_CODECS\"] = \"hlsBufferCodecs\";\n Events[\"BUFFER_CREATED\"] = \"hlsBufferCreated\";\n Events[\"BUFFER_APPENDING\"] = \"hlsBufferAppending\";\n Events[\"BUFFER_APPENDED\"] = \"hlsBufferAppended\";\n Events[\"BUFFER_EOS\"] = \"hlsBufferEos\";\n Events[\"BUFFER_FLUSHING\"] = \"hlsBufferFlushing\";\n Events[\"BUFFER_FLUSHED\"] = \"hlsBufferFlushed\";\n Events[\"MANIFEST_LOADING\"] = \"hlsManifestLoading\";\n Events[\"MANIFEST_LOADED\"] = \"hlsManifestLoaded\";\n Events[\"MANIFEST_PARSED\"] = \"hlsManifestParsed\";\n Events[\"LEVEL_SWITCHING\"] = \"hlsLevelSwitching\";\n Events[\"LEVEL_SWITCHED\"] = \"hlsLevelSwitched\";\n Events[\"LEVEL_LOADING\"] = \"hlsLevelLoading\";\n Events[\"LEVEL_LOADED\"] = \"hlsLevelLoaded\";\n Events[\"LEVEL_UPDATED\"] = \"hlsLevelUpdated\";\n Events[\"LEVEL_PTS_UPDATED\"] = \"hlsLevelPtsUpdated\";\n Events[\"LEVELS_UPDATED\"] = \"hlsLevelsUpdated\";\n Events[\"AUDIO_TRACKS_UPDATED\"] = \"hlsAudioTracksUpdated\";\n Events[\"AUDIO_TRACK_SWITCHING\"] = \"hlsAudioTrackSwitching\";\n Events[\"AUDIO_TRACK_SWITCHED\"] = \"hlsAudioTrackSwitched\";\n Events[\"AUDIO_TRACK_LOADING\"] = \"hlsAudioTrackLoading\";\n Events[\"AUDIO_TRACK_LOADED\"] = \"hlsAudioTrackLoaded\";\n Events[\"SUBTITLE_TRACKS_UPDATED\"] = \"hlsSubtitleTracksUpdated\";\n Events[\"SUBTITLE_TRACKS_CLEARED\"] = \"hlsSubtitleTracksCleared\";\n Events[\"SUBTITLE_TRACK_SWITCH\"] = \"hlsSubtitleTrackSwitch\";\n Events[\"SUBTITLE_TRACK_LOADING\"] = \"hlsSubtitleTrackLoading\";\n Events[\"SUBTITLE_TRACK_LOADED\"] = \"hlsSubtitleTrackLoaded\";\n Events[\"SUBTITLE_FRAG_PROCESSED\"] = \"hlsSubtitleFragProcessed\";\n Events[\"CUES_PARSED\"] = \"hlsCuesParsed\";\n Events[\"NON_NATIVE_TEXT_TRACKS_FOUND\"] = \"hlsNonNativeTextTracksFound\";\n Events[\"INIT_PTS_FOUND\"] = \"hlsInitPtsFound\";\n Events[\"FRAG_LOADING\"] = \"hlsFragLoading\";\n Events[\"FRAG_LOAD_EMERGENCY_ABORTED\"] = \"hlsFragLoadEmergencyAborted\";\n Events[\"FRAG_LOADED\"] = \"hlsFragLoaded\";\n Events[\"FRAG_DECRYPTED\"] = \"hlsFragDecrypted\";\n Events[\"FRAG_PARSING_INIT_SEGMENT\"] = \"hlsFragParsingInitSegment\";\n Events[\"FRAG_PARSING_USERDATA\"] = \"hlsFragParsingUserdata\";\n Events[\"FRAG_PARSING_METADATA\"] = \"hlsFragParsingMetadata\";\n Events[\"FRAG_PARSED\"] = \"hlsFragParsed\";\n Events[\"FRAG_BUFFERED\"] = \"hlsFragBuffered\";\n Events[\"FRAG_CHANGED\"] = \"hlsFragChanged\";\n Events[\"FPS_DROP\"] = \"hlsFpsDrop\";\n Events[\"FPS_DROP_LEVEL_CAPPING\"] = \"hlsFpsDropLevelCapping\";\n Events[\"ERROR\"] = \"hlsError\";\n Events[\"DESTROYING\"] = \"hlsDestroying\";\n Events[\"KEY_LOADING\"] = \"hlsKeyLoading\";\n Events[\"KEY_LOADED\"] = \"hlsKeyLoaded\";\n Events[\"LIVE_BACK_BUFFER_REACHED\"] = \"hlsLiveBackBufferReached\";\n Events[\"BACK_BUFFER_REACHED\"] = \"hlsBackBufferReached\";\n return Events;\n }({});\n\n /**\n * Defines each Event type and payload by Event name. Used in {@link hls.js#HlsEventEmitter} to strongly type the event listener API.\n */\n\n var ErrorTypes = /*#__PURE__*/function (ErrorTypes) {\n ErrorTypes[\"NETWORK_ERROR\"] = \"networkError\";\n ErrorTypes[\"MEDIA_ERROR\"] = \"mediaError\";\n ErrorTypes[\"KEY_SYSTEM_ERROR\"] = \"keySystemError\";\n ErrorTypes[\"MUX_ERROR\"] = \"muxError\";\n ErrorTypes[\"OTHER_ERROR\"] = \"otherError\";\n return ErrorTypes;\n }({});\n var ErrorDetails = /*#__PURE__*/function (ErrorDetails) {\n ErrorDetails[\"KEY_SYSTEM_NO_KEYS\"] = \"keySystemNoKeys\";\n ErrorDetails[\"KEY_SYSTEM_NO_ACCESS\"] = \"keySystemNoAccess\";\n ErrorDetails[\"KEY_SYSTEM_NO_SESSION\"] = \"keySystemNoSession\";\n ErrorDetails[\"KEY_SYSTEM_NO_CONFIGURED_LICENSE\"] = \"keySystemNoConfiguredLicense\";\n ErrorDetails[\"KEY_SYSTEM_LICENSE_REQUEST_FAILED\"] = \"keySystemLicenseRequestFailed\";\n ErrorDetails[\"KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED\"] = \"keySystemServerCertificateRequestFailed\";\n ErrorDetails[\"KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED\"] = \"keySystemServerCertificateUpdateFailed\";\n ErrorDetails[\"KEY_SYSTEM_SESSION_UPDATE_FAILED\"] = \"keySystemSessionUpdateFailed\";\n ErrorDetails[\"KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED\"] = \"keySystemStatusOutputRestricted\";\n ErrorDetails[\"KEY_SYSTEM_STATUS_INTERNAL_ERROR\"] = \"keySystemStatusInternalError\";\n ErrorDetails[\"MANIFEST_LOAD_ERROR\"] = \"manifestLoadError\";\n ErrorDetails[\"MANIFEST_LOAD_TIMEOUT\"] = \"manifestLoadTimeOut\";\n ErrorDetails[\"MANIFEST_PARSING_ERROR\"] = \"manifestParsingError\";\n ErrorDetails[\"MANIFEST_INCOMPATIBLE_CODECS_ERROR\"] = \"manifestIncompatibleCodecsError\";\n ErrorDetails[\"LEVEL_EMPTY_ERROR\"] = \"levelEmptyError\";\n ErrorDetails[\"LEVEL_LOAD_ERROR\"] = \"levelLoadError\";\n ErrorDetails[\"LEVEL_LOAD_TIMEOUT\"] = \"levelLoadTimeOut\";\n ErrorDetails[\"LEVEL_PARSING_ERROR\"] = \"levelParsingError\";\n ErrorDetails[\"LEVEL_SWITCH_ERROR\"] = \"levelSwitchError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_ERROR\"] = \"audioTrackLoadError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_TIMEOUT\"] = \"audioTrackLoadTimeOut\";\n ErrorDetails[\"SUBTITLE_LOAD_ERROR\"] = \"subtitleTrackLoadError\";\n ErrorDetails[\"SUBTITLE_TRACK_LOAD_TIMEOUT\"] = \"subtitleTrackLoadTimeOut\";\n ErrorDetails[\"FRAG_LOAD_ERROR\"] = \"fragLoadError\";\n ErrorDetails[\"FRAG_LOAD_TIMEOUT\"] = \"fragLoadTimeOut\";\n ErrorDetails[\"FRAG_DECRYPT_ERROR\"] = \"fragDecryptError\";\n ErrorDetails[\"FRAG_PARSING_ERROR\"] = \"fragParsingError\";\n ErrorDetails[\"FRAG_GAP\"] = \"fragGap\";\n ErrorDetails[\"REMUX_ALLOC_ERROR\"] = \"remuxAllocError\";\n ErrorDetails[\"KEY_LOAD_ERROR\"] = \"keyLoadError\";\n ErrorDetails[\"KEY_LOAD_TIMEOUT\"] = \"keyLoadTimeOut\";\n ErrorDetails[\"BUFFER_ADD_CODEC_ERROR\"] = \"bufferAddCodecError\";\n ErrorDetails[\"BUFFER_INCOMPATIBLE_CODECS_ERROR\"] = \"bufferIncompatibleCodecsError\";\n ErrorDetails[\"BUFFER_APPEND_ERROR\"] = \"bufferAppendError\";\n ErrorDetails[\"BUFFER_APPENDING_ERROR\"] = \"bufferAppendingError\";\n ErrorDetails[\"BUFFER_STALLED_ERROR\"] = \"bufferStalledError\";\n ErrorDetails[\"BUFFER_FULL_ERROR\"] = \"bufferFullError\";\n ErrorDetails[\"BUFFER_SEEK_OVER_HOLE\"] = \"bufferSeekOverHole\";\n ErrorDetails[\"BUFFER_NUDGE_ON_STALL\"] = \"bufferNudgeOnStall\";\n ErrorDetails[\"INTERNAL_EXCEPTION\"] = \"internalException\";\n ErrorDetails[\"INTERNAL_ABORTED\"] = \"aborted\";\n ErrorDetails[\"UNKNOWN\"] = \"unknown\";\n return ErrorDetails;\n }({});\n\n var noop = function noop() {};\n var fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n };\n var exportedLogger = fakeLogger;\n\n // let lastCallTime;\n // function formatMsgWithTimeInfo(type, msg) {\n // const now = Date.now();\n // const diff = lastCallTime ? '+' + (now - lastCallTime) : '0';\n // lastCallTime = now;\n // msg = (new Date(now)).toISOString() + ' | [' + type + '] > ' + msg + ' ( ' + diff + ' ms )';\n // return msg;\n // }\n\n function consolePrintFn(type) {\n var func = self.console[type];\n if (func) {\n return func.bind(self.console, \"[\" + type + \"] >\");\n }\n return noop;\n }\n function exportLoggerFunctions(debugConfig) {\n for (var _len = arguments.length, functions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n functions[_key - 1] = arguments[_key];\n }\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n }\n function enableLogs(debugConfig, id) {\n // check that console is available\n if (self.console && debugConfig === true || typeof debugConfig === 'object') {\n exportLoggerFunctions(debugConfig,\n // Remove out from list here to hard-disable a log-level\n // 'trace',\n 'debug', 'log', 'info', 'warn', 'error');\n // Some browsers don't allow to use bind on console object anyway\n // fallback to default if needed\n try {\n exportedLogger.log(\"Debug logs enabled for \\\"\" + id + \"\\\" in hls.js version \" + \"1.4.12\");\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n } else {\n exportedLogger = fakeLogger;\n }\n }\n var logger = exportedLogger;\n\n var DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/;\n var ATTR_LIST_REGEX = /(.+?)=(\".*?\"|.*?)(?:,|$)/g;\n\n // adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\n var AttrList = /*#__PURE__*/function () {\n function AttrList(attrs) {\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n if (attr.substring(0, 2) === 'X-') {\n this.clientAttrs = this.clientAttrs || [];\n this.clientAttrs.push(attr);\n }\n this[attr] = attrs[attr];\n }\n }\n }\n var _proto = AttrList.prototype;\n _proto.decimalInteger = function decimalInteger(attrName) {\n var intValue = parseInt(this[attrName], 10);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n };\n _proto.hexadecimalInteger = function hexadecimalInteger(attrName) {\n if (this[attrName]) {\n var stringValue = (this[attrName] || '0x').slice(2);\n stringValue = (stringValue.length & 1 ? '0' : '') + stringValue;\n var value = new Uint8Array(stringValue.length / 2);\n for (var i = 0; i < stringValue.length / 2; i++) {\n value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16);\n }\n return value;\n } else {\n return null;\n }\n };\n _proto.hexadecimalIntegerAsNumber = function hexadecimalIntegerAsNumber(attrName) {\n var intValue = parseInt(this[attrName], 16);\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n return intValue;\n };\n _proto.decimalFloatingPoint = function decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n };\n _proto.optionalFloat = function optionalFloat(attrName, defaultValue) {\n var value = this[attrName];\n return value ? parseFloat(value) : defaultValue;\n };\n _proto.enumeratedString = function enumeratedString(attrName) {\n return this[attrName];\n };\n _proto.bool = function bool(attrName) {\n return this[attrName] === 'YES';\n };\n _proto.decimalResolution = function decimalResolution(attrName) {\n var res = DECIMAL_RESOLUTION_REGEX.exec(this[attrName]);\n if (res === null) {\n return undefined;\n }\n return {\n width: parseInt(res[1], 10),\n height: parseInt(res[2], 10)\n };\n };\n AttrList.parseAttrList = function parseAttrList(input) {\n var match;\n var attrs = {};\n var quote = '\"';\n ATTR_LIST_REGEX.lastIndex = 0;\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2];\n if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) {\n value = value.slice(1, -1);\n }\n var name = match[1].trim();\n attrs[name] = value;\n }\n return attrs;\n };\n return AttrList;\n }();\n\n // Avoid exporting const enum so that these values can be inlined\n\n function isDateRangeCueAttribute(attrName) {\n return attrName !== \"ID\" && attrName !== \"CLASS\" && attrName !== \"START-DATE\" && attrName !== \"DURATION\" && attrName !== \"END-DATE\" && attrName !== \"END-ON-NEXT\";\n }\n function isSCTE35Attribute(attrName) {\n return attrName === \"SCTE35-OUT\" || attrName === \"SCTE35-IN\";\n }\n var DateRange = /*#__PURE__*/function () {\n function DateRange(dateRangeAttr, dateRangeWithSameId) {\n this.attr = void 0;\n this._startDate = void 0;\n this._endDate = void 0;\n this._badValueForSameId = void 0;\n if (dateRangeWithSameId) {\n var previousAttr = dateRangeWithSameId.attr;\n for (var key in previousAttr) {\n if (Object.prototype.hasOwnProperty.call(dateRangeAttr, key) && dateRangeAttr[key] !== previousAttr[key]) {\n logger.warn(\"DATERANGE tag attribute: \\\"\" + key + \"\\\" does not match for tags with ID: \\\"\" + dateRangeAttr.ID + \"\\\"\");\n this._badValueForSameId = key;\n break;\n }\n }\n // Merge DateRange tags with the same ID\n dateRangeAttr = _extends(new AttrList({}), previousAttr, dateRangeAttr);\n }\n this.attr = dateRangeAttr;\n this._startDate = new Date(dateRangeAttr[\"START-DATE\"]);\n if (\"END-DATE\" in this.attr) {\n var endDate = new Date(this.attr[\"END-DATE\"]);\n if (isFiniteNumber(endDate.getTime())) {\n this._endDate = endDate;\n }\n }\n }\n _createClass(DateRange, [{\n key: \"id\",\n get: function get() {\n return this.attr.ID;\n }\n }, {\n key: \"class\",\n get: function get() {\n return this.attr.CLASS;\n }\n }, {\n key: \"startDate\",\n get: function get() {\n return this._startDate;\n }\n }, {\n key: \"endDate\",\n get: function get() {\n if (this._endDate) {\n return this._endDate;\n }\n var duration = this.duration;\n if (duration !== null) {\n return new Date(this._startDate.getTime() + duration * 1000);\n }\n return null;\n }\n }, {\n key: \"duration\",\n get: function get() {\n if (\"DURATION\" in this.attr) {\n var duration = this.attr.decimalFloatingPoint(\"DURATION\");\n if (isFiniteNumber(duration)) {\n return duration;\n }\n } else if (this._endDate) {\n return (this._endDate.getTime() - this._startDate.getTime()) / 1000;\n }\n return null;\n }\n }, {\n key: \"plannedDuration\",\n get: function get() {\n if (\"PLANNED-DURATION\" in this.attr) {\n return this.attr.decimalFloatingPoint(\"PLANNED-DURATION\");\n }\n return null;\n }\n }, {\n key: \"endOnNext\",\n get: function get() {\n return this.attr.bool(\"END-ON-NEXT\");\n }\n }, {\n key: \"isValid\",\n get: function get() {\n return !!this.id && !this._badValueForSameId && isFiniteNumber(this.startDate.getTime()) && (this.duration === null || this.duration >= 0) && (!this.endOnNext || !!this.class);\n }\n }]);\n return DateRange;\n }();\n\n var LoadStats = function LoadStats() {\n this.aborted = false;\n this.loaded = 0;\n this.retry = 0;\n this.total = 0;\n this.chunkCount = 0;\n this.bwEstimate = 0;\n this.loading = {\n start: 0,\n first: 0,\n end: 0\n };\n this.parsing = {\n start: 0,\n end: 0\n };\n this.buffering = {\n start: 0,\n first: 0,\n end: 0\n };\n };\n\n var ElementaryStreamTypes = {\n AUDIO: \"audio\",\n VIDEO: \"video\",\n AUDIOVIDEO: \"audiovideo\"\n };\n var BaseSegment = /*#__PURE__*/function () {\n // baseurl is the URL to the playlist\n\n // relurl is the portion of the URL that comes from inside the playlist.\n\n // Holds the types of data this fragment supports\n\n function BaseSegment(baseurl) {\n var _this$elementaryStrea;\n this._byteRange = null;\n this._url = null;\n this.baseurl = void 0;\n this.relurl = void 0;\n this.elementaryStreams = (_this$elementaryStrea = {}, _this$elementaryStrea[ElementaryStreamTypes.AUDIO] = null, _this$elementaryStrea[ElementaryStreamTypes.VIDEO] = null, _this$elementaryStrea[ElementaryStreamTypes.AUDIOVIDEO] = null, _this$elementaryStrea);\n this.baseurl = baseurl;\n }\n\n // setByteRange converts a EXT-X-BYTERANGE attribute into a two element array\n var _proto = BaseSegment.prototype;\n _proto.setByteRange = function setByteRange(value, previous) {\n var params = value.split('@', 2);\n var byteRange = [];\n if (params.length === 1) {\n byteRange[0] = previous ? previous.byteRangeEndOffset : 0;\n } else {\n byteRange[0] = parseInt(params[1]);\n }\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n this._byteRange = byteRange;\n };\n _createClass(BaseSegment, [{\n key: \"byteRange\",\n get: function get() {\n if (!this._byteRange) {\n return [];\n }\n return this._byteRange;\n }\n }, {\n key: \"byteRangeStartOffset\",\n get: function get() {\n return this.byteRange[0];\n }\n }, {\n key: \"byteRangeEndOffset\",\n get: function get() {\n return this.byteRange[1];\n }\n }, {\n key: \"url\",\n get: function get() {\n if (!this._url && this.baseurl && this.relurl) {\n this._url = urlToolkitExports.buildAbsoluteURL(this.baseurl, this.relurl, {\n alwaysNormalize: true\n });\n }\n return this._url || '';\n },\n set: function set(value) {\n this._url = value;\n }\n }]);\n return BaseSegment;\n }();\n\n /**\n * Object representing parsed data from an HLS Segment. Found in {@link hls.js#LevelDetails.fragments}.\n */\n var Fragment = /*#__PURE__*/function (_BaseSegment) {\n _inheritsLoose(Fragment, _BaseSegment);\n // EXTINF has to be present for a m3u8 to be considered valid\n\n // sn notates the sequence number for a segment, and if set to a string can be 'initSegment'\n\n // levelkeys are the EXT-X-KEY tags that apply to this segment for decryption\n // core difference from the private field _decryptdata is the lack of the initialized IV\n // _decryptdata will set the IV for this segment based on the segment number in the fragment\n\n // A string representing the fragment type\n\n // A reference to the loader. Set while the fragment is loading, and removed afterwards. Used to abort fragment loading\n\n // A reference to the key loader. Set while the key is loading, and removed afterwards. Used to abort key loading\n\n // The level/track index to which the fragment belongs\n\n // The continuity counter of the fragment\n\n // The starting Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.\n\n // The ending Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.\n\n // The starting Decode Time Stamp (DTS) of the fragment. Set after transmux complete.\n\n // The ending Decode Time Stamp (DTS) of the fragment. Set after transmux complete.\n\n // The start time of the fragment, as listed in the manifest. Updated after transmux complete.\n\n // Set by `updateFragPTSDTS` in level-helper\n\n // The maximum starting Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.\n\n // The minimum ending Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.\n\n // Load/parse timing information\n\n // A flag indicating whether the segment was downloaded in order to test bitrate, and was not buffered\n\n // #EXTINF segment title\n\n // The Media Initialization Section for this segment\n\n // Fragment is the last fragment in the media playlist\n\n // Fragment is marked by an EXT-X-GAP tag indicating that it does not contain media data and should not be loaded\n\n function Fragment(type, baseurl) {\n var _this;\n _this = _BaseSegment.call(this, baseurl) || this;\n _this._decryptdata = null;\n _this.rawProgramDateTime = null;\n _this.programDateTime = null;\n _this.tagList = [];\n _this.duration = 0;\n _this.sn = 0;\n _this.levelkeys = void 0;\n _this.type = void 0;\n _this.loader = null;\n _this.keyLoader = null;\n _this.level = -1;\n _this.cc = 0;\n _this.startPTS = void 0;\n _this.endPTS = void 0;\n _this.startDTS = void 0;\n _this.endDTS = void 0;\n _this.start = 0;\n _this.deltaPTS = void 0;\n _this.maxStartPTS = void 0;\n _this.minEndPTS = void 0;\n _this.stats = new LoadStats();\n _this.urlId = 0;\n _this.data = void 0;\n _this.bitrateTest = false;\n _this.title = null;\n _this.initSegment = null;\n _this.endList = void 0;\n _this.gap = void 0;\n _this.type = type;\n return _this;\n }\n var _proto2 = Fragment.prototype;\n _proto2.setKeyFormat = function setKeyFormat(keyFormat) {\n if (this.levelkeys) {\n var _key = this.levelkeys[keyFormat];\n if (_key && !this._decryptdata) {\n this._decryptdata = _key.getDecryptData(this.sn);\n }\n }\n };\n _proto2.abortRequests = function abortRequests() {\n var _this$loader, _this$keyLoader;\n (_this$loader = this.loader) == null ? void 0 : _this$loader.abort();\n (_this$keyLoader = this.keyLoader) == null ? void 0 : _this$keyLoader.abort();\n };\n _proto2.setElementaryStreamInfo = function setElementaryStreamInfo(type, startPTS, endPTS, startDTS, endDTS, partial) {\n if (partial === void 0) {\n partial = false;\n }\n var elementaryStreams = this.elementaryStreams;\n var info = elementaryStreams[type];\n if (!info) {\n elementaryStreams[type] = {\n startPTS: startPTS,\n endPTS: endPTS,\n startDTS: startDTS,\n endDTS: endDTS,\n partial: partial\n };\n return;\n }\n info.startPTS = Math.min(info.startPTS, startPTS);\n info.endPTS = Math.max(info.endPTS, endPTS);\n info.startDTS = Math.min(info.startDTS, startDTS);\n info.endDTS = Math.max(info.endDTS, endDTS);\n };\n _proto2.clearElementaryStreamInfo = function clearElementaryStreamInfo() {\n var elementaryStreams = this.elementaryStreams;\n elementaryStreams[ElementaryStreamTypes.AUDIO] = null;\n elementaryStreams[ElementaryStreamTypes.VIDEO] = null;\n elementaryStreams[ElementaryStreamTypes.AUDIOVIDEO] = null;\n };\n _createClass(Fragment, [{\n key: \"decryptdata\",\n get: function get() {\n var levelkeys = this.levelkeys;\n if (!levelkeys && !this._decryptdata) {\n return null;\n }\n if (!this._decryptdata && this.levelkeys && !this.levelkeys.NONE) {\n var _key2 = this.levelkeys.identity;\n if (_key2) {\n this._decryptdata = _key2.getDecryptData(this.sn);\n } else {\n var keyFormats = Object.keys(this.levelkeys);\n if (keyFormats.length === 1) {\n return this._decryptdata = this.levelkeys[keyFormats[0]].getDecryptData(this.sn);\n }\n }\n }\n return this._decryptdata;\n }\n }, {\n key: \"end\",\n get: function get() {\n return this.start + this.duration;\n }\n }, {\n key: \"endProgramDateTime\",\n get: function get() {\n if (this.programDateTime === null) {\n return null;\n }\n if (!isFiniteNumber(this.programDateTime)) {\n return null;\n }\n var duration = !isFiniteNumber(this.duration) ? 0 : this.duration;\n return this.programDateTime + duration * 1000;\n }\n }, {\n key: \"encrypted\",\n get: function get() {\n var _this$_decryptdata;\n // At the m3u8-parser level we need to add support for manifest signalled keyformats\n // when we want the fragment to start reporting that it is encrypted.\n // Currently, keyFormat will only be set for identity keys\n if ((_this$_decryptdata = this._decryptdata) != null && _this$_decryptdata.encrypted) {\n return true;\n } else if (this.levelkeys) {\n var keyFormats = Object.keys(this.levelkeys);\n var len = keyFormats.length;\n if (len > 1 || len === 1 && this.levelkeys[keyFormats[0]].encrypted) {\n return true;\n }\n }\n return false;\n }\n }]);\n return Fragment;\n }(BaseSegment);\n\n /**\n * Object representing parsed data from an HLS Partial Segment. Found in {@link hls.js#LevelDetails.partList}.\n */\n var Part = /*#__PURE__*/function (_BaseSegment2) {\n _inheritsLoose(Part, _BaseSegment2);\n function Part(partAttrs, frag, baseurl, index, previous) {\n var _this2;\n _this2 = _BaseSegment2.call(this, baseurl) || this;\n _this2.fragOffset = 0;\n _this2.duration = 0;\n _this2.gap = false;\n _this2.independent = false;\n _this2.relurl = void 0;\n _this2.fragment = void 0;\n _this2.index = void 0;\n _this2.stats = new LoadStats();\n _this2.duration = partAttrs.decimalFloatingPoint('DURATION');\n _this2.gap = partAttrs.bool('GAP');\n _this2.independent = partAttrs.bool('INDEPENDENT');\n _this2.relurl = partAttrs.enumeratedString('URI');\n _this2.fragment = frag;\n _this2.index = index;\n var byteRange = partAttrs.enumeratedString('BYTERANGE');\n if (byteRange) {\n _this2.setByteRange(byteRange, previous);\n }\n if (previous) {\n _this2.fragOffset = previous.fragOffset + previous.duration;\n }\n return _this2;\n }\n _createClass(Part, [{\n key: \"start\",\n get: function get() {\n return this.fragment.start + this.fragOffset;\n }\n }, {\n key: \"end\",\n get: function get() {\n return this.start + this.duration;\n }\n }, {\n key: \"loaded\",\n get: function get() {\n var elementaryStreams = this.elementaryStreams;\n return !!(elementaryStreams.audio || elementaryStreams.video || elementaryStreams.audiovideo);\n }\n }]);\n return Part;\n }(BaseSegment);\n\n var DEFAULT_TARGET_DURATION = 10;\n\n /**\n * Object representing parsed data from an HLS Media Playlist. Found in {@link hls.js#Level.details}.\n */\n var LevelDetails = /*#__PURE__*/function () {\n // Manifest reload synchronization\n\n function LevelDetails(baseUrl) {\n this.PTSKnown = false;\n this.alignedSliding = false;\n this.averagetargetduration = void 0;\n this.endCC = 0;\n this.endSN = 0;\n this.fragments = void 0;\n this.fragmentHint = void 0;\n this.partList = null;\n this.dateRanges = void 0;\n this.live = true;\n this.ageHeader = 0;\n this.advancedDateTime = void 0;\n this.updated = true;\n this.advanced = true;\n this.availabilityDelay = void 0;\n this.misses = 0;\n this.startCC = 0;\n this.startSN = 0;\n this.startTimeOffset = null;\n this.targetduration = 0;\n this.totalduration = 0;\n this.type = null;\n this.url = void 0;\n this.m3u8 = '';\n this.version = null;\n this.canBlockReload = false;\n this.canSkipUntil = 0;\n this.canSkipDateRanges = false;\n this.skippedSegments = 0;\n this.recentlyRemovedDateranges = void 0;\n this.partHoldBack = 0;\n this.holdBack = 0;\n this.partTarget = 0;\n this.preloadHint = void 0;\n this.renditionReports = void 0;\n this.tuneInGoal = 0;\n this.deltaUpdateFailed = void 0;\n this.driftStartTime = 0;\n this.driftEndTime = 0;\n this.driftStart = 0;\n this.driftEnd = 0;\n this.encryptedFragments = void 0;\n this.playlistParsingError = null;\n this.variableList = null;\n this.hasVariableRefs = false;\n this.fragments = [];\n this.encryptedFragments = [];\n this.dateRanges = {};\n this.url = baseUrl;\n }\n var _proto = LevelDetails.prototype;\n _proto.reloaded = function reloaded(previous) {\n if (!previous) {\n this.advanced = true;\n this.updated = true;\n return;\n }\n var partSnDiff = this.lastPartSn - previous.lastPartSn;\n var partIndexDiff = this.lastPartIndex - previous.lastPartIndex;\n this.updated = this.endSN !== previous.endSN || !!partIndexDiff || !!partSnDiff || !this.live;\n this.advanced = this.endSN > previous.endSN || partSnDiff > 0 || partSnDiff === 0 && partIndexDiff > 0;\n if (this.updated || this.advanced) {\n this.misses = Math.floor(previous.misses * 0.6);\n } else {\n this.misses = previous.misses + 1;\n }\n this.availabilityDelay = previous.availabilityDelay;\n };\n _createClass(LevelDetails, [{\n key: \"hasProgramDateTime\",\n get: function get() {\n if (this.fragments.length) {\n return isFiniteNumber(this.fragments[this.fragments.length - 1].programDateTime);\n }\n return false;\n }\n }, {\n key: \"levelTargetDuration\",\n get: function get() {\n return this.averagetargetduration || this.targetduration || DEFAULT_TARGET_DURATION;\n }\n }, {\n key: \"drift\",\n get: function get() {\n var runTime = this.driftEndTime - this.driftStartTime;\n if (runTime > 0) {\n var runDuration = this.driftEnd - this.driftStart;\n return runDuration * 1000 / runTime;\n }\n return 1;\n }\n }, {\n key: \"edge\",\n get: function get() {\n return this.partEnd || this.fragmentEnd;\n }\n }, {\n key: \"partEnd\",\n get: function get() {\n var _this$partList;\n if ((_this$partList = this.partList) != null && _this$partList.length) {\n return this.partList[this.partList.length - 1].end;\n }\n return this.fragmentEnd;\n }\n }, {\n key: \"fragmentEnd\",\n get: function get() {\n var _this$fragments;\n if ((_this$fragments = this.fragments) != null && _this$fragments.length) {\n return this.fragments[this.fragments.length - 1].end;\n }\n return 0;\n }\n }, {\n key: \"age\",\n get: function get() {\n if (this.advancedDateTime) {\n return Math.max(Date.now() - this.advancedDateTime, 0) / 1000;\n }\n return 0;\n }\n }, {\n key: \"lastPartIndex\",\n get: function get() {\n var _this$partList2;\n if ((_this$partList2 = this.partList) != null && _this$partList2.length) {\n return this.partList[this.partList.length - 1].index;\n }\n return -1;\n }\n }, {\n key: \"lastPartSn\",\n get: function get() {\n var _this$partList3;\n if ((_this$partList3 = this.partList) != null && _this$partList3.length) {\n return this.partList[this.partList.length - 1].fragment.sn;\n }\n return this.endSN;\n }\n }]);\n return LevelDetails;\n }();\n\n // This file is inserted as a shim for modules which we do not want to include into the distro.\n // This replacement is done in the \"alias\" plugin of the rollup config.\n var empty = undefined;\n var Cues = /*@__PURE__*/getDefaultExportFromCjs(empty);\n\n function sliceUint8(array, start, end) {\n // @ts-expect-error This polyfills IE11 usage of Uint8Array slice.\n // It always exists in the TypeScript definition so fails, but it fails at runtime on IE11.\n return Uint8Array.prototype.slice ? array.slice(start, end) : new Uint8Array(Array.prototype.slice.call(array, start, end));\n }\n\n // breaking up those two types in order to clarify what is happening in the decoding path.\n\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param data - The data to search\n * @param offset - The offset at which to start searching\n */\n var isHeader$2 = function isHeader(data, offset) {\n /*\n * http://id3.org/id3v2.3.0\n * [0] = 'I'\n * [1] = 'D'\n * [2] = '3'\n * [3,4] = {Version}\n * [5] = {Flags}\n * [6-9] = {ID3 Size}\n *\n * An ID3v2 tag can be detected with the following pattern:\n * $49 44 33 yy yy xx zz zz zz zz\n * Where yy is less than $FF, xx is the 'flags' byte and zz is less than $80\n */\n if (offset + 10 <= data.length) {\n // look for 'ID3' identifier\n if (data[offset] === 0x49 && data[offset + 1] === 0x44 && data[offset + 2] === 0x33) {\n // check version is within range\n if (data[offset + 3] < 0xff && data[offset + 4] < 0xff) {\n // check size is within range\n if (data[offset + 6] < 0x80 && data[offset + 7] < 0x80 && data[offset + 8] < 0x80 && data[offset + 9] < 0x80) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param data - The data to search\n * @param offset - The offset at which to start searching\n */\n var isFooter = function isFooter(data, offset) {\n /*\n * The footer is a copy of the header, but with a different identifier\n */\n if (offset + 10 <= data.length) {\n // look for '3DI' identifier\n if (data[offset] === 0x33 && data[offset + 1] === 0x44 && data[offset + 2] === 0x49) {\n // check version is within range\n if (data[offset + 3] < 0xff && data[offset + 4] < 0xff) {\n // check size is within range\n if (data[offset + 6] < 0x80 && data[offset + 7] < 0x80 && data[offset + 8] < 0x80 && data[offset + 9] < 0x80) {\n return true;\n }\n }\n }\n }\n return false;\n };\n\n /**\n * Returns any adjacent ID3 tags found in data starting at offset, as one block of data\n * @param data - The data to search in\n * @param offset - The offset at which to start searching\n * @returns the block of data containing any ID3 tags found\n * or *undefined* if no header is found at the starting offset\n */\n var getID3Data = function getID3Data(data, offset) {\n var front = offset;\n var length = 0;\n while (isHeader$2(data, offset)) {\n // ID3 header is 10 bytes\n length += 10;\n var size = readSize(data, offset + 6);\n length += size;\n if (isFooter(data, offset + 10)) {\n // ID3 footer is 10 bytes\n length += 10;\n }\n offset += length;\n }\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n return undefined;\n };\n var readSize = function readSize(data, offset) {\n var size = 0;\n size = (data[offset] & 0x7f) << 21;\n size |= (data[offset + 1] & 0x7f) << 14;\n size |= (data[offset + 2] & 0x7f) << 7;\n size |= data[offset + 3] & 0x7f;\n return size;\n };\n var canParse$2 = function canParse(data, offset) {\n return isHeader$2(data, offset) && readSize(data, offset + 6) + 10 <= data.length - offset;\n };\n\n /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param data - Block of data containing one or more ID3 tags\n */\n var getTimeStamp = function getTimeStamp(data) {\n var frames = getID3Frames(data);\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if (isTimeStampFrame(frame)) {\n return readTimeStamp(frame);\n }\n }\n return undefined;\n };\n\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n */\n var isTimeStampFrame = function isTimeStampFrame(frame) {\n return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';\n };\n var getFrameData = function getFrameData(data) {\n /*\n Frame ID $xx xx xx xx (four characters)\n Size $xx xx xx xx\n Flags $xx xx\n */\n var type = String.fromCharCode(data[0], data[1], data[2], data[3]);\n var size = readSize(data, 4);\n\n // skip frame id, size, and flags\n var offset = 10;\n return {\n type: type,\n size: size,\n data: data.subarray(offset, offset + size)\n };\n };\n\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param id3Data - The ID3 data containing one or more ID3 tags\n */\n var getID3Frames = function getID3Frames(id3Data) {\n var offset = 0;\n var frames = [];\n while (isHeader$2(id3Data, offset)) {\n var size = readSize(id3Data, offset + 6);\n // skip past ID3 header\n offset += 10;\n var end = offset + size;\n // loop through frames in the ID3 tag\n while (offset + 8 < end) {\n var frameData = getFrameData(id3Data.subarray(offset));\n var frame = decodeFrame(frameData);\n if (frame) {\n frames.push(frame);\n }\n\n // skip frame header and frame data\n offset += frameData.size + 10;\n }\n if (isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n return frames;\n };\n var decodeFrame = function decodeFrame(frame) {\n if (frame.type === 'PRIV') {\n return decodePrivFrame(frame);\n } else if (frame.type[0] === 'W') {\n return decodeURLFrame(frame);\n }\n return decodeTextFrame(frame);\n };\n var decodePrivFrame = function decodePrivFrame(frame) {\n /*\n Format: <text string>\\0<binary data>\n */\n if (frame.size < 2) {\n return undefined;\n }\n var owner = utf8ArrayToStr(frame.data, true);\n var privateData = new Uint8Array(frame.data.subarray(owner.length + 1));\n return {\n key: frame.type,\n info: owner,\n data: privateData.buffer\n };\n };\n var decodeTextFrame = function decodeTextFrame(frame) {\n if (frame.size < 2) {\n return undefined;\n }\n if (frame.type === 'TXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{Value}\n */\n var index = 1;\n var description = utf8ArrayToStr(frame.data.subarray(index), true);\n index += description.length + 1;\n var value = utf8ArrayToStr(frame.data.subarray(index));\n return {\n key: frame.type,\n info: description,\n data: value\n };\n }\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = utf8ArrayToStr(frame.data.subarray(1));\n return {\n key: frame.type,\n data: text\n };\n };\n var decodeURLFrame = function decodeURLFrame(frame) {\n if (frame.type === 'WXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{URL}\n */\n if (frame.size < 2) {\n return undefined;\n }\n var index = 1;\n var description = utf8ArrayToStr(frame.data.subarray(index), true);\n index += description.length + 1;\n var value = utf8ArrayToStr(frame.data.subarray(index));\n return {\n key: frame.type,\n info: description,\n data: value\n };\n }\n /*\n Format:\n [0-?] = {URL}\n */\n var url = utf8ArrayToStr(frame.data);\n return {\n key: frame.type,\n data: url\n };\n };\n var readTimeStamp = function readTimeStamp(timeStampFrame) {\n if (timeStampFrame.data.byteLength === 8) {\n var data = new Uint8Array(timeStampFrame.data);\n // timestamp is 33 bit expressed as a big-endian eight-octet number,\n // with the upper 31 bits set to zero.\n var pts33Bit = data[3] & 0x1;\n var timestamp = (data[4] << 23) + (data[5] << 15) + (data[6] << 7) + data[7];\n timestamp /= 45;\n if (pts33Bit) {\n timestamp += 47721858.84;\n } // 2^32 / 90\n\n return Math.round(timestamp);\n }\n return undefined;\n };\n\n // http://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript/22373197\n // http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt\n /* utf.js - UTF-8 <=> UTF-16 convertion\n *\n * Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>\n * Version: 1.0\n * LastModified: Dec 25 1999\n * This library is free. You can redistribute it and/or modify it.\n */\n var utf8ArrayToStr = function utf8ArrayToStr(array, exitOnNull) {\n if (exitOnNull === void 0) {\n exitOnNull = false;\n }\n var decoder = getTextDecoder();\n if (decoder) {\n var decoded = decoder.decode(array);\n if (exitOnNull) {\n // grab up to the first null\n var idx = decoded.indexOf('\\0');\n return idx !== -1 ? decoded.substring(0, idx) : decoded;\n }\n\n // remove any null characters\n return decoded.replace(/\\0/g, '');\n }\n var len = array.length;\n var c;\n var char2;\n var char3;\n var out = '';\n var i = 0;\n while (i < len) {\n c = array[i++];\n if (c === 0x00 && exitOnNull) {\n return out;\n } else if (c === 0x00 || c === 0x03) {\n // If the character is 3 (END_OF_TEXT) or 0 (NULL) then skip it\n continue;\n }\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c);\n break;\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++];\n out += String.fromCharCode((c & 0x1f) << 6 | char2 & 0x3f);\n break;\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++];\n char3 = array[i++];\n out += String.fromCharCode((c & 0x0f) << 12 | (char2 & 0x3f) << 6 | (char3 & 0x3f) << 0);\n break;\n }\n }\n return out;\n };\n var decoder;\n function getTextDecoder() {\n if (!decoder && typeof self.TextDecoder !== 'undefined') {\n decoder = new self.TextDecoder('utf-8');\n }\n return decoder;\n }\n\n /**\n * hex dump helper class\n */\n\n var Hex = {\n hexDump: function hexDump(array) {\n var str = '';\n for (var i = 0; i < array.length; i++) {\n var h = array[i].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n str += h;\n }\n return str;\n }\n };\n\n var UINT32_MAX$1 = Math.pow(2, 32) - 1;\n var push = [].push;\n\n // We are using fixed track IDs for driving the MP4 remuxer\n // instead of following the TS PIDs.\n // There is no reason not to do this and some browsers/SourceBuffer-demuxers\n // may not like if there are TrackID \"switches\"\n // See https://github.com/video-dev/hls.js/issues/1331\n // Here we are mapping our internal track types to constant MP4 track IDs\n // With MSE currently one can only have one track of each, and we are muxing\n // whatever video/audio rendition in them.\n var RemuxerTrackIdConfig = {\n video: 1,\n audio: 2,\n id3: 3,\n text: 4\n };\n function bin2str(data) {\n return String.fromCharCode.apply(null, data);\n }\n function readUint16(buffer, offset) {\n var val = buffer[offset] << 8 | buffer[offset + 1];\n return val < 0 ? 65536 + val : val;\n }\n function readUint32(buffer, offset) {\n var val = readSint32(buffer, offset);\n return val < 0 ? 4294967296 + val : val;\n }\n function readSint32(buffer, offset) {\n return buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];\n }\n function writeUint32(buffer, offset, value) {\n buffer[offset] = value >> 24;\n buffer[offset + 1] = value >> 16 & 0xff;\n buffer[offset + 2] = value >> 8 & 0xff;\n buffer[offset + 3] = value & 0xff;\n }\n\n // Find the data for a box specified by its path\n function findBox(data, path) {\n var results = [];\n if (!path.length) {\n // short-circuit the search for empty paths\n return results;\n }\n var end = data.byteLength;\n for (var i = 0; i < end;) {\n var size = readUint32(data, i);\n var type = bin2str(data.subarray(i + 4, i + 8));\n var endbox = size > 1 ? i + size : end;\n if (type === path[0]) {\n if (path.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push(data.subarray(i + 8, endbox));\n } else {\n // recursively search for the next box along the path\n var subresults = findBox(data.subarray(i + 8, endbox), path.slice(1));\n if (subresults.length) {\n push.apply(results, subresults);\n }\n }\n }\n i = endbox;\n }\n\n // we've finished searching all of data\n return results;\n }\n function parseSegmentIndex(sidx) {\n var references = [];\n var version = sidx[0];\n\n // set initial offset, we skip the reference ID (not needed)\n var index = 8;\n var timescale = readUint32(sidx, index);\n index += 4;\n\n // TODO: parse earliestPresentationTime and firstOffset\n // usually zero in our case\n var earliestPresentationTime = 0;\n var firstOffset = 0;\n if (version === 0) {\n index += 8;\n } else {\n index += 16;\n }\n\n // skip reserved\n index += 2;\n var startByte = sidx.length + firstOffset;\n var referencesCount = readUint16(sidx, index);\n index += 2;\n for (var i = 0; i < referencesCount; i++) {\n var referenceIndex = index;\n var referenceInfo = readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n var referenceSize = referenceInfo & 0x7fffffff;\n var referenceType = (referenceInfo & 0x80000000) >>> 31;\n if (referenceType === 1) {\n logger.warn('SIDX has hierarchical references (not supported)');\n return null;\n }\n var subsegmentDuration = readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n references.push({\n referenceSize: referenceSize,\n subsegmentDuration: subsegmentDuration,\n // unscaled\n info: {\n duration: subsegmentDuration / timescale,\n start: startByte,\n end: startByte + referenceSize - 1\n }\n });\n startByte += referenceSize;\n\n // Skipping 1 bit for |startsWithSap|, 3 bits for |sapType|, and 28 bits\n // for |sapDelta|.\n referenceIndex += 4;\n\n // skip to next ref\n index = referenceIndex;\n }\n return {\n earliestPresentationTime: earliestPresentationTime,\n timescale: timescale,\n version: version,\n referencesCount: referencesCount,\n references: references\n };\n }\n\n /**\n * Parses an MP4 initialization segment and extracts stream type and\n * timescale values for any declared tracks. Timescale values indicate the\n * number of clock ticks per second to assume for time-based values\n * elsewhere in the MP4.\n *\n * To determine the start time of an MP4, you need two pieces of\n * information: the timescale unit and the earliest base media decode\n * time. Multiple timescales can be specified within an MP4 but the\n * base media decode time is always expressed in the timescale from\n * the media header box for the track:\n * ```\n * moov > trak > mdia > mdhd.timescale\n * moov > trak > mdia > hdlr\n * ```\n * @param initSegment the bytes of the init segment\n * @returns a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n\n function parseInitSegment(initSegment) {\n var result = [];\n var traks = findBox(initSegment, ['moov', 'trak']);\n for (var i = 0; i < traks.length; i++) {\n var trak = traks[i];\n var tkhd = findBox(trak, ['tkhd'])[0];\n if (tkhd) {\n var version = tkhd[0];\n var _index = version === 0 ? 12 : 20;\n var trackId = readUint32(tkhd, _index);\n var mdhd = findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n version = mdhd[0];\n _index = version === 0 ? 12 : 20;\n var timescale = readUint32(mdhd, _index);\n var hdlr = findBox(trak, ['mdia', 'hdlr'])[0];\n if (hdlr) {\n var hdlrType = bin2str(hdlr.subarray(8, 12));\n var type = {\n soun: ElementaryStreamTypes.AUDIO,\n vide: ElementaryStreamTypes.VIDEO\n }[hdlrType];\n if (type) {\n // Parse codec details\n var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];\n var codec = void 0;\n if (stsd) {\n codec = bin2str(stsd.subarray(12, 16));\n // TODO: Parse codec details to be able to build MIME type.\n // stsd.start += 8;\n // const codecBox = findBox(stsd, [codec])[0];\n // if (codecBox) {\n // TODO: Codec parsing support for avc1, mp4a, hevc, av01...\n // }\n }\n\n result[trackId] = {\n timescale: timescale,\n type: type\n };\n result[type] = {\n timescale: timescale,\n id: trackId,\n codec: codec\n };\n }\n }\n }\n }\n }\n var trex = findBox(initSegment, ['moov', 'mvex', 'trex']);\n trex.forEach(function (trex) {\n var trackId = readUint32(trex, 4);\n var track = result[trackId];\n if (track) {\n track.default = {\n duration: readUint32(trex, 12),\n flags: readUint32(trex, 20)\n };\n }\n });\n return result;\n }\n function patchEncyptionData(initSegment, decryptdata) {\n if (!initSegment || !decryptdata) {\n return initSegment;\n }\n var keyId = decryptdata.keyId;\n if (keyId && decryptdata.isCommonEncryption) {\n var traks = findBox(initSegment, ['moov', 'trak']);\n traks.forEach(function (trak) {\n var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];\n\n // skip the sample entry count\n var sampleEntries = stsd.subarray(8);\n var encBoxes = findBox(sampleEntries, ['enca']);\n var isAudio = encBoxes.length > 0;\n if (!isAudio) {\n encBoxes = findBox(sampleEntries, ['encv']);\n }\n encBoxes.forEach(function (enc) {\n var encBoxChildren = isAudio ? enc.subarray(28) : enc.subarray(78);\n var sinfBoxes = findBox(encBoxChildren, ['sinf']);\n sinfBoxes.forEach(function (sinf) {\n var tenc = parseSinf(sinf);\n if (tenc) {\n // Look for default key id (keyID offset is always 8 within the tenc box):\n var tencKeyId = tenc.subarray(8, 24);\n if (!tencKeyId.some(function (b) {\n return b !== 0;\n })) {\n logger.log(\"[eme] Patching keyId in 'enc\" + (isAudio ? 'a' : 'v') + \">sinf>>tenc' box: \" + Hex.hexDump(tencKeyId) + \" -> \" + Hex.hexDump(keyId));\n tenc.set(keyId, 8);\n }\n }\n });\n });\n });\n }\n return initSegment;\n }\n function parseSinf(sinf) {\n var schm = findBox(sinf, ['schm'])[0];\n if (schm) {\n var scheme = bin2str(schm.subarray(4, 8));\n if (scheme === 'cbcs' || scheme === 'cenc') {\n return findBox(sinf, ['schi', 'tenc'])[0];\n }\n }\n logger.error(\"[eme] missing 'schm' box\");\n return null;\n }\n\n /**\n * Determine the base media decode start time, in seconds, for an MP4\n * fragment. If multiple fragments are specified, the earliest time is\n * returned.\n *\n * The base media decode time can be parsed from track fragment\n * metadata:\n * ```\n * moof > traf > tfdt.baseMediaDecodeTime\n * ```\n * It requires the timescale value from the mdhd to interpret.\n *\n * @param initData - a hash of track type to timescale values\n * @param fmp4 - the bytes of the mp4 fragment\n * @returns the earliest base media decode start time for the\n * fragment, in seconds\n */\n function getStartDTS(initData, fmp4) {\n // we need info from two children of each track fragment box\n return findBox(fmp4, ['moof', 'traf']).reduce(function (result, traf) {\n var tfdt = findBox(traf, ['tfdt'])[0];\n var version = tfdt[0];\n var start = findBox(traf, ['tfhd']).reduce(function (result, tfhd) {\n // get the track id from the tfhd\n var id = readUint32(tfhd, 4);\n var track = initData[id];\n if (track) {\n var baseTime = readUint32(tfdt, 4);\n if (version === 1) {\n // If value is too large, assume signed 64-bit. Negative track fragment decode times are invalid, but they exist in the wild.\n // This prevents large values from being used for initPTS, which can cause playlist sync issues.\n // https://github.com/video-dev/hls.js/issues/5303\n if (baseTime === UINT32_MAX$1) {\n logger.warn(\"[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time\");\n return result;\n }\n baseTime *= UINT32_MAX$1 + 1;\n baseTime += readUint32(tfdt, 8);\n }\n // assume a 90kHz clock if no timescale was specified\n var scale = track.timescale || 90e3;\n // convert base time to seconds\n var startTime = baseTime / scale;\n if (isFinite(startTime) && (result === null || startTime < result)) {\n return startTime;\n }\n }\n return result;\n }, null);\n if (start !== null && isFinite(start) && (result === null || start < result)) {\n return start;\n }\n return result;\n }, null);\n }\n\n /*\n For Reference:\n aligned(8) class TrackFragmentHeaderBox\n extends FullBox(‘tfhd’, 0, tf_flags){\n unsigned int(32) track_ID;\n // all the following are optional fields\n unsigned int(64) base_data_offset;\n unsigned int(32) sample_description_index;\n unsigned int(32) default_sample_duration;\n unsigned int(32) default_sample_size;\n unsigned int(32) default_sample_flags\n }\n */\n function getDuration(data, initData) {\n var rawDuration = 0;\n var videoDuration = 0;\n var audioDuration = 0;\n var trafs = findBox(data, ['moof', 'traf']);\n for (var i = 0; i < trafs.length; i++) {\n var traf = trafs[i];\n // There is only one tfhd & trun per traf\n // This is true for CMAF style content, and we should perhaps check the ftyp\n // and only look for a single trun then, but for ISOBMFF we should check\n // for multiple track runs.\n var tfhd = findBox(traf, ['tfhd'])[0];\n // get the track id from the tfhd\n var id = readUint32(tfhd, 4);\n var track = initData[id];\n if (!track) {\n continue;\n }\n var trackDefault = track.default;\n var tfhdFlags = readUint32(tfhd, 0) | (trackDefault == null ? void 0 : trackDefault.flags);\n var sampleDuration = trackDefault == null ? void 0 : trackDefault.duration;\n if (tfhdFlags & 0x000008) {\n // 0x000008 indicates the presence of the default_sample_duration field\n if (tfhdFlags & 0x000002) {\n // 0x000002 indicates the presence of the sample_description_index field, which precedes default_sample_duration\n // If present, the default_sample_duration exists at byte offset 12\n sampleDuration = readUint32(tfhd, 12);\n } else {\n // Otherwise, the duration is at byte offset 8\n sampleDuration = readUint32(tfhd, 8);\n }\n }\n // assume a 90kHz clock if no timescale was specified\n var timescale = track.timescale || 90e3;\n var truns = findBox(traf, ['trun']);\n for (var j = 0; j < truns.length; j++) {\n rawDuration = computeRawDurationFromSamples(truns[j]);\n if (!rawDuration && sampleDuration) {\n var sampleCount = readUint32(truns[j], 4);\n rawDuration = sampleDuration * sampleCount;\n }\n if (track.type === ElementaryStreamTypes.VIDEO) {\n videoDuration += rawDuration / timescale;\n } else if (track.type === ElementaryStreamTypes.AUDIO) {\n audioDuration += rawDuration / timescale;\n }\n }\n }\n if (videoDuration === 0 && audioDuration === 0) {\n // If duration samples are not available in the traf use sidx subsegment_duration\n var sidxDuration = 0;\n var sidxs = findBox(data, ['sidx']);\n for (var _i = 0; _i < sidxs.length; _i++) {\n var sidx = parseSegmentIndex(sidxs[_i]);\n if (sidx != null && sidx.references) {\n sidxDuration += sidx.references.reduce(function (dur, ref) {\n return dur + ref.info.duration || 0;\n }, 0);\n }\n }\n return sidxDuration;\n }\n if (videoDuration) {\n return videoDuration;\n }\n return audioDuration;\n }\n\n /*\n For Reference:\n aligned(8) class TrackRunBox\n extends FullBox(‘trun’, version, tr_flags) {\n unsigned int(32) sample_count;\n // the following are optional fields\n signed int(32) data_offset;\n unsigned int(32) first_sample_flags;\n // all fields in the following array are optional\n {\n unsigned int(32) sample_duration;\n unsigned int(32) sample_size;\n unsigned int(32) sample_flags\n if (version == 0)\n { unsigned int(32)\n else\n { signed int(32)\n }[ sample_count ]\n }\n */\n function computeRawDurationFromSamples(trun) {\n var flags = readUint32(trun, 0);\n // Flags are at offset 0, non-optional sample_count is at offset 4. Therefore we start 8 bytes in.\n // Each field is an int32, which is 4 bytes\n var offset = 8;\n // data-offset-present flag\n if (flags & 0x000001) {\n offset += 4;\n }\n // first-sample-flags-present flag\n if (flags & 0x000004) {\n offset += 4;\n }\n var duration = 0;\n var sampleCount = readUint32(trun, 4);\n for (var i = 0; i < sampleCount; i++) {\n // sample-duration-present flag\n if (flags & 0x000100) {\n var sampleDuration = readUint32(trun, offset);\n duration += sampleDuration;\n offset += 4;\n }\n // sample-size-present flag\n if (flags & 0x000200) {\n offset += 4;\n }\n // sample-flags-present flag\n if (flags & 0x000400) {\n offset += 4;\n }\n // sample-composition-time-offsets-present flag\n if (flags & 0x000800) {\n offset += 4;\n }\n }\n return duration;\n }\n function offsetStartDTS(initData, fmp4, timeOffset) {\n findBox(fmp4, ['moof', 'traf']).forEach(function (traf) {\n findBox(traf, ['tfhd']).forEach(function (tfhd) {\n // get the track id from the tfhd\n var id = readUint32(tfhd, 4);\n var track = initData[id];\n if (!track) {\n return;\n }\n // assume a 90kHz clock if no timescale was specified\n var timescale = track.timescale || 90e3;\n // get the base media decode time from the tfdt\n findBox(traf, ['tfdt']).forEach(function (tfdt) {\n var version = tfdt[0];\n var baseMediaDecodeTime = readUint32(tfdt, 4);\n if (version === 0) {\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n writeUint32(tfdt, 4, baseMediaDecodeTime);\n } else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX$1 + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX$1 + 1));\n writeUint32(tfdt, 4, upper);\n writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n }\n\n // TODO: Check if the last moof+mdat pair is part of the valid range\n function segmentValidRange(data) {\n var segmentedRange = {\n valid: null,\n remainder: null\n };\n var moofs = findBox(data, ['moof']);\n if (!moofs) {\n return segmentedRange;\n } else if (moofs.length < 2) {\n segmentedRange.remainder = data;\n return segmentedRange;\n }\n var last = moofs[moofs.length - 1];\n // Offset by 8 bytes; findBox offsets the start by as much\n segmentedRange.valid = sliceUint8(data, 0, last.byteOffset - 8);\n segmentedRange.remainder = sliceUint8(data, last.byteOffset - 8);\n return segmentedRange;\n }\n function appendUint8Array(data1, data2) {\n var temp = new Uint8Array(data1.length + data2.length);\n temp.set(data1);\n temp.set(data2, data1.length);\n return temp;\n }\n function parseSamples(timeOffset, track) {\n var seiSamples = [];\n var videoData = track.samples;\n var timescale = track.timescale;\n var trackId = track.id;\n var isHEVCFlavor = false;\n var moofs = findBox(videoData, ['moof']);\n moofs.map(function (moof) {\n var moofOffset = moof.byteOffset - 8;\n var trafs = findBox(moof, ['traf']);\n trafs.map(function (traf) {\n // get the base media decode time from the tfdt\n var baseTime = findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt[0];\n var result = readUint32(tfdt, 4);\n if (version === 1) {\n result *= Math.pow(2, 32);\n result += readUint32(tfdt, 8);\n }\n return result / timescale;\n })[0];\n if (baseTime !== undefined) {\n timeOffset = baseTime;\n }\n return findBox(traf, ['tfhd']).map(function (tfhd) {\n var id = readUint32(tfhd, 4);\n var tfhdFlags = readUint32(tfhd, 0) & 0xffffff;\n var baseDataOffsetPresent = (tfhdFlags & 0x000001) !== 0;\n var sampleDescriptionIndexPresent = (tfhdFlags & 0x000002) !== 0;\n var defaultSampleDurationPresent = (tfhdFlags & 0x000008) !== 0;\n var defaultSampleDuration = 0;\n var defaultSampleSizePresent = (tfhdFlags & 0x000010) !== 0;\n var defaultSampleSize = 0;\n var defaultSampleFlagsPresent = (tfhdFlags & 0x000020) !== 0;\n var tfhdOffset = 8;\n if (id === trackId) {\n if (baseDataOffsetPresent) {\n tfhdOffset += 8;\n }\n if (sampleDescriptionIndexPresent) {\n tfhdOffset += 4;\n }\n if (defaultSampleDurationPresent) {\n defaultSampleDuration = readUint32(tfhd, tfhdOffset);\n tfhdOffset += 4;\n }\n if (defaultSampleSizePresent) {\n defaultSampleSize = readUint32(tfhd, tfhdOffset);\n tfhdOffset += 4;\n }\n if (defaultSampleFlagsPresent) {\n tfhdOffset += 4;\n }\n if (track.type === 'video') {\n isHEVCFlavor = isHEVC(track.codec);\n }\n findBox(traf, ['trun']).map(function (trun) {\n var version = trun[0];\n var flags = readUint32(trun, 0) & 0xffffff;\n var dataOffsetPresent = (flags & 0x000001) !== 0;\n var dataOffset = 0;\n var firstSampleFlagsPresent = (flags & 0x000004) !== 0;\n var sampleDurationPresent = (flags & 0x000100) !== 0;\n var sampleDuration = 0;\n var sampleSizePresent = (flags & 0x000200) !== 0;\n var sampleSize = 0;\n var sampleFlagsPresent = (flags & 0x000400) !== 0;\n var sampleCompositionOffsetsPresent = (flags & 0x000800) !== 0;\n var compositionOffset = 0;\n var sampleCount = readUint32(trun, 4);\n var trunOffset = 8; // past version, flags, and sample count\n\n if (dataOffsetPresent) {\n dataOffset = readUint32(trun, trunOffset);\n trunOffset += 4;\n }\n if (firstSampleFlagsPresent) {\n trunOffset += 4;\n }\n var sampleOffset = dataOffset + moofOffset;\n for (var ix = 0; ix < sampleCount; ix++) {\n if (sampleDurationPresent) {\n sampleDuration = readUint32(trun, trunOffset);\n trunOffset += 4;\n } else {\n sampleDuration = defaultSampleDuration;\n }\n if (sampleSizePresent) {\n sampleSize = readUint32(trun, trunOffset);\n trunOffset += 4;\n } else {\n sampleSize = defaultSampleSize;\n }\n if (sampleFlagsPresent) {\n trunOffset += 4;\n }\n if (sampleCompositionOffsetsPresent) {\n if (version === 0) {\n compositionOffset = readUint32(trun, trunOffset);\n } else {\n compositionOffset = readSint32(trun, trunOffset);\n }\n trunOffset += 4;\n }\n if (track.type === ElementaryStreamTypes.VIDEO) {\n var naluTotalSize = 0;\n while (naluTotalSize < sampleSize) {\n var naluSize = readUint32(videoData, sampleOffset);\n sampleOffset += 4;\n if (isSEIMessage(isHEVCFlavor, videoData[sampleOffset])) {\n var data = videoData.subarray(sampleOffset, sampleOffset + naluSize);\n parseSEIMessageFromNALu(data, isHEVCFlavor ? 2 : 1, timeOffset + compositionOffset / timescale, seiSamples);\n }\n sampleOffset += naluSize;\n naluTotalSize += naluSize + 4;\n }\n }\n timeOffset += sampleDuration / timescale;\n }\n });\n }\n });\n });\n });\n return seiSamples;\n }\n function isHEVC(codec) {\n if (!codec) {\n return false;\n }\n var delimit = codec.indexOf('.');\n var baseCodec = delimit < 0 ? codec : codec.substring(0, delimit);\n return baseCodec === 'hvc1' || baseCodec === 'hev1' ||\n // Dolby Vision\n baseCodec === 'dvh1' || baseCodec === 'dvhe';\n }\n function isSEIMessage(isHEVCFlavor, naluHeader) {\n if (isHEVCFlavor) {\n var naluType = naluHeader >> 1 & 0x3f;\n return naluType === 39 || naluType === 40;\n } else {\n var _naluType = naluHeader & 0x1f;\n return _naluType === 6;\n }\n }\n function parseSEIMessageFromNALu(unescapedData, headerSize, pts, samples) {\n var data = discardEPB(unescapedData);\n var seiPtr = 0;\n // skip nal header\n seiPtr += headerSize;\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n while (seiPtr < data.length) {\n payloadType = 0;\n do {\n if (seiPtr >= data.length) {\n break;\n }\n b = data[seiPtr++];\n payloadType += b;\n } while (b === 0xff);\n\n // Parse payload size.\n payloadSize = 0;\n do {\n if (seiPtr >= data.length) {\n break;\n }\n b = data[seiPtr++];\n payloadSize += b;\n } while (b === 0xff);\n var leftOver = data.length - seiPtr;\n if (!endOfCaptions && payloadType === 4 && seiPtr < data.length) {\n endOfCaptions = true;\n var countryCode = data[seiPtr++];\n if (countryCode === 181) {\n var providerCode = readUint16(data, seiPtr);\n seiPtr += 2;\n if (providerCode === 49) {\n var userStructure = readUint32(data, seiPtr);\n seiPtr += 4;\n if (userStructure === 0x47413934) {\n var userDataType = data[seiPtr++];\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3) {\n var firstByte = data[seiPtr++];\n var totalCCs = 0x1f & firstByte;\n var enabled = 0x40 & firstByte;\n var totalBytes = enabled ? 2 + totalCCs * 3 : 0;\n var byteArray = new Uint8Array(totalBytes);\n if (enabled) {\n byteArray[0] = firstByte;\n for (var i = 1; i < totalBytes; i++) {\n byteArray[i] = data[seiPtr++];\n }\n }\n samples.push({\n type: userDataType,\n payloadType: payloadType,\n pts: pts,\n bytes: byteArray\n });\n }\n }\n }\n }\n } else if (payloadType === 5 && payloadSize < leftOver) {\n endOfCaptions = true;\n if (payloadSize > 16) {\n var uuidStrArray = [];\n for (var _i2 = 0; _i2 < 16; _i2++) {\n var _b = data[seiPtr++].toString(16);\n uuidStrArray.push(_b.length == 1 ? '0' + _b : _b);\n if (_i2 === 3 || _i2 === 5 || _i2 === 7 || _i2 === 9) {\n uuidStrArray.push('-');\n }\n }\n var length = payloadSize - 16;\n var userDataBytes = new Uint8Array(length);\n for (var _i3 = 0; _i3 < length; _i3++) {\n userDataBytes[_i3] = data[seiPtr++];\n }\n samples.push({\n payloadType: payloadType,\n pts: pts,\n uuid: uuidStrArray.join(''),\n userData: utf8ArrayToStr(userDataBytes),\n userDataBytes: userDataBytes\n });\n }\n } else if (payloadSize < leftOver) {\n seiPtr += payloadSize;\n } else if (payloadSize > leftOver) {\n break;\n }\n }\n }\n\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n function discardEPB(data) {\n var length = data.byteLength;\n var EPBPositions = [];\n var i = 1;\n\n // Find all `Emulation Prevention Bytes`\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n EPBPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n }\n\n // If no Emulation Prevention Bytes were found just return the original\n // array\n if (EPBPositions.length === 0) {\n return data;\n }\n\n // Create a new array to hold the NAL unit data\n var newLength = length - EPBPositions.length;\n var newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === EPBPositions[0]) {\n // Skip this byte\n sourceIndex++;\n // Remove this position index\n EPBPositions.shift();\n }\n newData[i] = data[sourceIndex];\n }\n return newData;\n }\n function parseEmsg(data) {\n var version = data[0];\n var schemeIdUri = '';\n var value = '';\n var timeScale = 0;\n var presentationTimeDelta = 0;\n var presentationTime = 0;\n var eventDuration = 0;\n var id = 0;\n var offset = 0;\n if (version === 0) {\n while (bin2str(data.subarray(offset, offset + 1)) !== '\\0') {\n schemeIdUri += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n }\n schemeIdUri += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n while (bin2str(data.subarray(offset, offset + 1)) !== '\\0') {\n value += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n }\n value += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n timeScale = readUint32(data, 12);\n presentationTimeDelta = readUint32(data, 16);\n eventDuration = readUint32(data, 20);\n id = readUint32(data, 24);\n offset = 28;\n } else if (version === 1) {\n offset += 4;\n timeScale = readUint32(data, offset);\n offset += 4;\n var leftPresentationTime = readUint32(data, offset);\n offset += 4;\n var rightPresentationTime = readUint32(data, offset);\n offset += 4;\n presentationTime = Math.pow(2, 32) * leftPresentationTime + rightPresentationTime;\n if (!Number.isSafeInteger(presentationTime)) {\n presentationTime = Number.MAX_SAFE_INTEGER;\n logger.warn('Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box');\n }\n eventDuration = readUint32(data, offset);\n offset += 4;\n id = readUint32(data, offset);\n offset += 4;\n while (bin2str(data.subarray(offset, offset + 1)) !== '\\0') {\n schemeIdUri += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n }\n schemeIdUri += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n while (bin2str(data.subarray(offset, offset + 1)) !== '\\0') {\n value += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n }\n value += bin2str(data.subarray(offset, offset + 1));\n offset += 1;\n }\n var payload = data.subarray(offset, data.byteLength);\n return {\n schemeIdUri: schemeIdUri,\n value: value,\n timeScale: timeScale,\n presentationTime: presentationTime,\n presentationTimeDelta: presentationTimeDelta,\n eventDuration: eventDuration,\n id: id,\n payload: payload\n };\n }\n\n var LevelKey = /*#__PURE__*/function () {\n LevelKey.clearKeyUriToKeyIdMap = function clearKeyUriToKeyIdMap() {\n };\n function LevelKey(method, uri, format, formatversions, iv) {\n if (formatversions === void 0) {\n formatversions = [1];\n }\n if (iv === void 0) {\n iv = null;\n }\n this.uri = void 0;\n this.method = void 0;\n this.keyFormat = void 0;\n this.keyFormatVersions = void 0;\n this.encrypted = void 0;\n this.isCommonEncryption = void 0;\n this.iv = null;\n this.key = null;\n this.keyId = null;\n this.pssh = null;\n this.method = method;\n this.uri = uri;\n this.keyFormat = format;\n this.keyFormatVersions = formatversions;\n this.iv = iv;\n this.encrypted = method ? method !== 'NONE' : false;\n this.isCommonEncryption = this.encrypted && method !== 'AES-128';\n }\n var _proto = LevelKey.prototype;\n _proto.isSupported = function isSupported() {\n // If it's Segment encryption or No encryption, just select that key system\n if (this.method) {\n if (this.method === 'AES-128' || this.method === 'NONE') {\n return true;\n }\n if (this.keyFormat === 'identity') {\n // Maintain support for clear SAMPLE-AES with MPEG-3 TS\n return this.method === 'SAMPLE-AES';\n }\n }\n return false;\n };\n _proto.getDecryptData = function getDecryptData(sn) {\n if (!this.encrypted || !this.uri) {\n return null;\n }\n if (this.method === 'AES-128' && this.uri && !this.iv) {\n if (typeof sn !== 'number') {\n // We are fetching decryption data for a initialization segment\n // If the segment was encrypted with AES-128\n // It must have an IV defined. We cannot substitute the Segment Number in.\n if (this.method === 'AES-128' && !this.iv) {\n logger.warn(\"missing IV for initialization segment with method=\\\"\" + this.method + \"\\\" - compliance issue\");\n }\n // Explicitly set sn to resulting value from implicit conversions 'initSegment' values for IV generation.\n sn = 0;\n }\n var iv = createInitializationVector(sn);\n var decryptdata = new LevelKey(this.method, this.uri, 'identity', this.keyFormatVersions, iv);\n return decryptdata;\n }\n {\n return this;\n }\n };\n return LevelKey;\n }();\n function createInitializationVector(segmentNumber) {\n var uint8View = new Uint8Array(16);\n for (var i = 12; i < 16; i++) {\n uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff;\n }\n return uint8View;\n }\n\n /**\n * MediaSource helper\n */\n\n function getMediaSource() {\n if (typeof self === 'undefined') return undefined;\n return self.MediaSource || self.WebKitMediaSource;\n }\n\n // from http://mp4ra.org/codecs.html\n var sampleEntryCodesISO = {\n audio: {\n a3ds: true,\n 'ac-3': true,\n 'ac-4': true,\n alac: true,\n alaw: true,\n dra1: true,\n 'dts+': true,\n 'dts-': true,\n dtsc: true,\n dtse: true,\n dtsh: true,\n 'ec-3': true,\n enca: true,\n g719: true,\n g726: true,\n m4ae: true,\n mha1: true,\n mha2: true,\n mhm1: true,\n mhm2: true,\n mlpa: true,\n mp4a: true,\n 'raw ': true,\n Opus: true,\n opus: true,\n // browsers expect this to be lowercase despite MP4RA says 'Opus'\n samr: true,\n sawb: true,\n sawp: true,\n sevc: true,\n sqcp: true,\n ssmv: true,\n twos: true,\n ulaw: true\n },\n video: {\n avc1: true,\n avc2: true,\n avc3: true,\n avc4: true,\n avcp: true,\n av01: true,\n drac: true,\n dva1: true,\n dvav: true,\n dvh1: true,\n dvhe: true,\n encv: true,\n hev1: true,\n hvc1: true,\n mjp2: true,\n mp4v: true,\n mvc1: true,\n mvc2: true,\n mvc3: true,\n mvc4: true,\n resv: true,\n rv60: true,\n s263: true,\n svc1: true,\n svc2: true,\n 'vc-1': true,\n vp08: true,\n vp09: true\n },\n text: {\n stpp: true,\n wvtt: true\n }\n };\n var MediaSource$2 = getMediaSource();\n function isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n }\n function isCodecSupportedInMp4(codec, type) {\n var _MediaSource$isTypeSu;\n return (_MediaSource$isTypeSu = MediaSource$2 == null ? void 0 : MediaSource$2.isTypeSupported((type || 'video') + \"/mp4;codecs=\\\"\" + codec + \"\\\"\")) != null ? _MediaSource$isTypeSu : false;\n }\n\n var MASTER_PLAYLIST_REGEX = /#EXT-X-STREAM-INF:([^\\r\\n]*)(?:[\\r\\n](?:#[^\\r\\n]*)?)*([^\\r\\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\\r\\n]*)[\\r\\n]+/g;\n var MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\n var IS_MEDIA_PLAYLIST = /^#EXT(?:INF|-X-TARGETDURATION):/m; // Handle empty Media Playlist (first EXTINF not signaled, but TARGETDURATION present)\n\n var LEVEL_PLAYLIST_REGEX_FAST = new RegExp([/#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source,\n // duration (#EXTINF:<duration>,<title>), group 1 => duration, group 2 => title\n /(?!#) *(\\S[\\S ]*)/.source,\n // segment URI, group 3 => the URI (note newline is not eaten)\n /#EXT-X-BYTERANGE:*(.+)/.source,\n // next segment's byterange, group 4 => range spec (x@y)\n /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,\n // next segment's program date/time group 5 => the datetime spec\n /#.*/.source // All other non-segment oriented tags will match with all groups empty\n ].join('|'), 'g');\n var LEVEL_PLAYLIST_REGEX_SLOW = new RegExp([/#(EXTM3U)/.source, /#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source, /#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\\d+)/.source, /#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source, /(#)([^:]*):(.*)/.source, /(#)(.*)(?:.*)\\r?\\n?/.source].join('|'));\n var M3U8Parser = /*#__PURE__*/function () {\n function M3U8Parser() {}\n M3U8Parser.findGroup = function findGroup(groups, mediaGroupId) {\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n if (group.id === mediaGroupId) {\n return group;\n }\n }\n };\n M3U8Parser.convertAVC1ToAVCOTI = function convertAVC1ToAVCOTI(codec) {\n // Convert avc1 codec string from RFC-4281 to RFC-6381 for MediaSource.isTypeSupported\n var avcdata = codec.split('.');\n if (avcdata.length > 2) {\n var result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).slice(-4);\n return result;\n }\n return codec;\n };\n M3U8Parser.resolve = function resolve(url, baseUrl) {\n return urlToolkitExports.buildAbsoluteURL(baseUrl, url, {\n alwaysNormalize: true\n });\n };\n M3U8Parser.isMediaPlaylist = function isMediaPlaylist(str) {\n return IS_MEDIA_PLAYLIST.test(str);\n };\n M3U8Parser.parseMasterPlaylist = function parseMasterPlaylist(string, baseurl) {\n var hasVariableRefs = false;\n var parsed = {\n contentSteering: null,\n levels: [],\n playlistParsingError: null,\n sessionData: null,\n sessionKeys: null,\n startTimeOffset: null,\n variableList: null,\n hasVariableRefs: hasVariableRefs\n };\n var levelsWithKnownCodecs = [];\n MASTER_PLAYLIST_REGEX.lastIndex = 0;\n var result;\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n if (result[1]) {\n var _level$unknownCodecs;\n // '#EXT-X-STREAM-INF' is found, parse level tag in group 1\n var attrs = new AttrList(result[1]);\n var uri = result[2];\n var level = {\n attrs: attrs,\n bitrate: attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH'),\n name: attrs.NAME,\n url: M3U8Parser.resolve(uri, baseurl)\n };\n var resolution = attrs.decimalResolution('RESOLUTION');\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n setCodecs((attrs.CODECS || '').split(/[ ,]+/).filter(function (c) {\n return c;\n }), level);\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);\n }\n if (!((_level$unknownCodecs = level.unknownCodecs) != null && _level$unknownCodecs.length)) {\n levelsWithKnownCodecs.push(level);\n }\n parsed.levels.push(level);\n } else if (result[3]) {\n var tag = result[3];\n var attributes = result[4];\n switch (tag) {\n case 'SESSION-DATA':\n {\n // #EXT-X-SESSION-DATA\n var sessionAttrs = new AttrList(attributes);\n var dataId = sessionAttrs['DATA-ID'];\n if (dataId) {\n if (parsed.sessionData === null) {\n parsed.sessionData = {};\n }\n parsed.sessionData[dataId] = sessionAttrs;\n }\n break;\n }\n case 'SESSION-KEY':\n {\n // #EXT-X-SESSION-KEY\n var sessionKey = parseKey(attributes, baseurl);\n if (sessionKey.encrypted && sessionKey.isSupported()) {\n if (parsed.sessionKeys === null) {\n parsed.sessionKeys = [];\n }\n parsed.sessionKeys.push(sessionKey);\n } else {\n logger.warn(\"[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: \\\"\" + attributes + \"\\\"\");\n }\n break;\n }\n case 'DEFINE':\n {\n break;\n }\n case 'CONTENT-STEERING':\n {\n // #EXT-X-CONTENT-STEERING\n var contentSteeringAttributes = new AttrList(attributes);\n parsed.contentSteering = {\n uri: M3U8Parser.resolve(contentSteeringAttributes['SERVER-URI'], baseurl),\n pathwayId: contentSteeringAttributes['PATHWAY-ID'] || '.'\n };\n break;\n }\n case 'START':\n {\n // #EXT-X-START\n parsed.startTimeOffset = parseStartTimeOffset(attributes);\n break;\n }\n }\n }\n }\n // Filter out levels with unknown codecs if it does not remove all levels\n var stripUnknownCodecLevels = levelsWithKnownCodecs.length > 0 && levelsWithKnownCodecs.length < parsed.levels.length;\n parsed.levels = stripUnknownCodecLevels ? levelsWithKnownCodecs : parsed.levels;\n if (parsed.levels.length === 0) {\n parsed.playlistParsingError = new Error('no levels found in manifest');\n }\n return parsed;\n };\n M3U8Parser.parseMasterPlaylistMedia = function parseMasterPlaylistMedia(string, baseurl, parsed) {\n var result;\n var results = {};\n var levels = parsed.levels;\n var groupsByType = {\n AUDIO: levels.map(function (level) {\n return {\n id: level.attrs.AUDIO,\n audioCodec: level.audioCodec\n };\n }),\n SUBTITLES: levels.map(function (level) {\n return {\n id: level.attrs.SUBTITLES,\n textCodec: level.textCodec\n };\n }),\n 'CLOSED-CAPTIONS': []\n };\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var attrs = new AttrList(result[1]);\n var type = attrs.TYPE;\n if (type) {\n var groups = groupsByType[type];\n var medias = results[type] || [];\n results[type] = medias;\n var media = {\n attrs: attrs,\n bitrate: 0,\n id: id++,\n groupId: attrs['GROUP-ID'] || '',\n instreamId: attrs['INSTREAM-ID'],\n name: attrs.NAME || attrs.LANGUAGE || '',\n type: type,\n default: attrs.bool('DEFAULT'),\n autoselect: attrs.bool('AUTOSELECT'),\n forced: attrs.bool('FORCED'),\n lang: attrs.LANGUAGE,\n url: attrs.URI ? M3U8Parser.resolve(attrs.URI, baseurl) : ''\n };\n if (groups != null && groups.length) {\n // If there are audio or text groups signalled in the manifest, let's look for a matching codec string for this track\n // If we don't find the track signalled, lets use the first audio groups codec we have\n // Acting as a best guess\n var groupCodec = M3U8Parser.findGroup(groups, media.groupId) || groups[0];\n assignCodec(media, groupCodec, 'audioCodec');\n assignCodec(media, groupCodec, 'textCodec');\n }\n medias.push(media);\n }\n }\n return results;\n };\n M3U8Parser.parseLevelPlaylist = function parseLevelPlaylist(string, baseurl, id, type, levelUrlId, multivariantVariableList) {\n var level = new LevelDetails(baseurl);\n var fragments = level.fragments;\n // The most recent init segment seen (applies to all subsequent segments)\n var currentInitSegment = null;\n var currentSN = 0;\n var currentPart = 0;\n var totalduration = 0;\n var discontinuityCounter = 0;\n var prevFrag = null;\n var frag = new Fragment(type, baseurl);\n var result;\n var i;\n var levelkeys;\n var firstPdtIndex = -1;\n var createNextFrag = false;\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n level.m3u8 = string;\n level.hasVariableRefs = false;\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\n if (createNextFrag) {\n createNextFrag = false;\n frag = new Fragment(type, baseurl);\n // setup the next fragment for part loading\n frag.start = totalduration;\n frag.sn = currentSN;\n frag.cc = discontinuityCounter;\n frag.level = id;\n if (currentInitSegment) {\n frag.initSegment = currentInitSegment;\n frag.rawProgramDateTime = currentInitSegment.rawProgramDateTime;\n currentInitSegment.rawProgramDateTime = null;\n }\n }\n var duration = result[1];\n if (duration) {\n // INF\n frag.duration = parseFloat(duration);\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var title = (' ' + result[2]).slice(1);\n frag.title = title || null;\n frag.tagList.push(title ? ['INF', duration, title] : ['INF', duration]);\n } else if (result[3]) {\n // url\n if (isFiniteNumber(frag.duration)) {\n frag.start = totalduration;\n if (levelkeys) {\n setFragLevelKeys(frag, levelkeys, level);\n }\n frag.sn = currentSN;\n frag.level = id;\n frag.cc = discontinuityCounter;\n frag.urlId = levelUrlId;\n fragments.push(frag);\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var uri = (' ' + result[3]).slice(1);\n frag.relurl = uri;\n assignProgramDateTime(frag, prevFrag);\n prevFrag = frag;\n totalduration += frag.duration;\n currentSN++;\n currentPart = 0;\n createNextFrag = true;\n }\n } else if (result[4]) {\n // X-BYTERANGE\n var data = (' ' + result[4]).slice(1);\n if (prevFrag) {\n frag.setByteRange(data, prevFrag);\n } else {\n frag.setByteRange(data);\n }\n } else if (result[5]) {\n // PROGRAM-DATE-TIME\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n frag.rawProgramDateTime = (' ' + result[5]).slice(1);\n frag.tagList.push(['PROGRAM-DATE-TIME', frag.rawProgramDateTime]);\n if (firstPdtIndex === -1) {\n firstPdtIndex = fragments.length;\n }\n } else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n if (!result) {\n logger.warn('No matches on slow regex match for level playlist!');\n continue;\n }\n for (i = 1; i < result.length; i++) {\n if (typeof result[i] !== 'undefined') {\n break;\n }\n }\n\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var tag = (' ' + result[i]).slice(1);\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = result[i + 2] ? (' ' + result[i + 2]).slice(1) : '';\n switch (tag) {\n case 'PLAYLIST-TYPE':\n level.type = value1.toUpperCase();\n break;\n case 'MEDIA-SEQUENCE':\n currentSN = level.startSN = parseInt(value1);\n break;\n case 'SKIP':\n {\n var skipAttrs = new AttrList(value1);\n var skippedSegments = skipAttrs.decimalInteger('SKIPPED-SEGMENTS');\n if (isFiniteNumber(skippedSegments)) {\n level.skippedSegments = skippedSegments;\n // This will result in fragments[] containing undefined values, which we will fill in with `mergeDetails`\n for (var _i = skippedSegments; _i--;) {\n fragments.unshift(null);\n }\n currentSN += skippedSegments;\n }\n var recentlyRemovedDateranges = skipAttrs.enumeratedString('RECENTLY-REMOVED-DATERANGES');\n if (recentlyRemovedDateranges) {\n level.recentlyRemovedDateranges = recentlyRemovedDateranges.split('\\t');\n }\n break;\n }\n case 'TARGETDURATION':\n level.targetduration = Math.max(parseInt(value1), 1);\n break;\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n case 'EXTM3U':\n break;\n case 'ENDLIST':\n level.live = false;\n break;\n case '#':\n if (value1 || value2) {\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n }\n break;\n case 'DISCONTINUITY':\n discontinuityCounter++;\n frag.tagList.push(['DIS']);\n break;\n case 'GAP':\n frag.gap = true;\n frag.tagList.push([tag]);\n break;\n case 'BITRATE':\n frag.tagList.push([tag, value1]);\n break;\n case 'DATERANGE':\n {\n var dateRangeAttr = new AttrList(value1);\n var dateRange = new DateRange(dateRangeAttr, level.dateRanges[dateRangeAttr.ID]);\n if (dateRange.isValid || level.skippedSegments) {\n level.dateRanges[dateRange.id] = dateRange;\n } else {\n logger.warn(\"Ignoring invalid DATERANGE tag: \\\"\" + value1 + \"\\\"\");\n }\n // Add to fragment tag list for backwards compatibility (< v1.2.0)\n frag.tagList.push(['EXT-X-DATERANGE', value1]);\n break;\n }\n case 'DEFINE':\n {\n break;\n }\n case 'DISCONTINUITY-SEQUENCE':\n discontinuityCounter = parseInt(value1);\n break;\n case 'KEY':\n {\n var levelKey = parseKey(value1, baseurl);\n if (levelKey.isSupported()) {\n if (levelKey.method === 'NONE') {\n levelkeys = undefined;\n break;\n }\n if (!levelkeys) {\n levelkeys = {};\n }\n if (levelkeys[levelKey.keyFormat]) {\n levelkeys = _extends({}, levelkeys);\n }\n levelkeys[levelKey.keyFormat] = levelKey;\n } else {\n logger.warn(\"[Keys] Ignoring invalid EXT-X-KEY tag: \\\"\" + value1 + \"\\\"\");\n }\n break;\n }\n case 'START':\n level.startTimeOffset = parseStartTimeOffset(value1);\n break;\n case 'MAP':\n {\n var mapAttrs = new AttrList(value1);\n if (frag.duration) {\n // Initial segment tag is after segment duration tag.\n // #EXTINF: 6.0\n // #EXT-X-MAP:URI=\"init.mp4\n var init = new Fragment(type, baseurl);\n setInitSegment(init, mapAttrs, id, levelkeys);\n currentInitSegment = init;\n frag.initSegment = currentInitSegment;\n if (currentInitSegment.rawProgramDateTime && !frag.rawProgramDateTime) {\n frag.rawProgramDateTime = currentInitSegment.rawProgramDateTime;\n }\n } else {\n // Initial segment tag is before segment duration tag\n setInitSegment(frag, mapAttrs, id, levelkeys);\n currentInitSegment = frag;\n createNextFrag = true;\n }\n break;\n }\n case 'SERVER-CONTROL':\n {\n var serverControlAttrs = new AttrList(value1);\n level.canBlockReload = serverControlAttrs.bool('CAN-BLOCK-RELOAD');\n level.canSkipUntil = serverControlAttrs.optionalFloat('CAN-SKIP-UNTIL', 0);\n level.canSkipDateRanges = level.canSkipUntil > 0 && serverControlAttrs.bool('CAN-SKIP-DATERANGES');\n level.partHoldBack = serverControlAttrs.optionalFloat('PART-HOLD-BACK', 0);\n level.holdBack = serverControlAttrs.optionalFloat('HOLD-BACK', 0);\n break;\n }\n case 'PART-INF':\n {\n var partInfAttrs = new AttrList(value1);\n level.partTarget = partInfAttrs.decimalFloatingPoint('PART-TARGET');\n break;\n }\n case 'PART':\n {\n var partList = level.partList;\n if (!partList) {\n partList = level.partList = [];\n }\n var previousFragmentPart = currentPart > 0 ? partList[partList.length - 1] : undefined;\n var index = currentPart++;\n var partAttrs = new AttrList(value1);\n var part = new Part(partAttrs, frag, baseurl, index, previousFragmentPart);\n partList.push(part);\n frag.duration += part.duration;\n break;\n }\n case 'PRELOAD-HINT':\n {\n var preloadHintAttrs = new AttrList(value1);\n level.preloadHint = preloadHintAttrs;\n break;\n }\n case 'RENDITION-REPORT':\n {\n var renditionReportAttrs = new AttrList(value1);\n level.renditionReports = level.renditionReports || [];\n level.renditionReports.push(renditionReportAttrs);\n break;\n }\n default:\n logger.warn(\"line parsed but not handled: \" + result);\n break;\n }\n }\n }\n if (prevFrag && !prevFrag.relurl) {\n fragments.pop();\n totalduration -= prevFrag.duration;\n if (level.partList) {\n level.fragmentHint = prevFrag;\n }\n } else if (level.partList) {\n assignProgramDateTime(frag, prevFrag);\n frag.cc = discontinuityCounter;\n level.fragmentHint = frag;\n if (levelkeys) {\n setFragLevelKeys(frag, levelkeys, level);\n }\n }\n var fragmentLength = fragments.length;\n var firstFragment = fragments[0];\n var lastFragment = fragments[fragmentLength - 1];\n totalduration += level.skippedSegments * level.targetduration;\n if (totalduration > 0 && fragmentLength && lastFragment) {\n level.averagetargetduration = totalduration / fragmentLength;\n var lastSn = lastFragment.sn;\n level.endSN = lastSn !== 'initSegment' ? lastSn : 0;\n if (!level.live) {\n lastFragment.endList = true;\n }\n if (firstFragment) {\n level.startCC = firstFragment.cc;\n }\n } else {\n level.endSN = 0;\n level.startCC = 0;\n }\n if (level.fragmentHint) {\n totalduration += level.fragmentHint.duration;\n }\n level.totalduration = totalduration;\n level.endCC = discontinuityCounter;\n\n /**\n * Backfill any missing PDT values\n * \"If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after\n * one or more Media Segment URIs, the client SHOULD extrapolate\n * backward from that tag (using EXTINF durations and/or media\n * timestamps) to associate dates with those segments.\"\n * We have already extrapolated forward, but all fragments up to the first instance of PDT do not have their PDTs\n * computed.\n */\n if (firstPdtIndex > 0) {\n backfillProgramDateTimes(fragments, firstPdtIndex);\n }\n return level;\n };\n return M3U8Parser;\n }();\n function parseKey(keyTagAttributes, baseurl, parsed) {\n var _keyAttrs$METHOD, _keyAttrs$KEYFORMAT;\n // https://tools.ietf.org/html/rfc8216#section-4.3.2.4\n var keyAttrs = new AttrList(keyTagAttributes);\n var decryptmethod = (_keyAttrs$METHOD = keyAttrs.METHOD) != null ? _keyAttrs$METHOD : '';\n var decrypturi = keyAttrs.URI;\n var decryptiv = keyAttrs.hexadecimalInteger('IV');\n var decryptkeyformatversions = keyAttrs.KEYFORMATVERSIONS;\n // From RFC: This attribute is OPTIONAL; its absence indicates an implicit value of \"identity\".\n var decryptkeyformat = (_keyAttrs$KEYFORMAT = keyAttrs.KEYFORMAT) != null ? _keyAttrs$KEYFORMAT : 'identity';\n if (decrypturi && keyAttrs.IV && !decryptiv) {\n logger.error(\"Invalid IV: \" + keyAttrs.IV);\n }\n // If decrypturi is a URI with a scheme, then baseurl will be ignored\n // No uri is allowed when METHOD is NONE\n var resolvedUri = decrypturi ? M3U8Parser.resolve(decrypturi, baseurl) : '';\n var keyFormatVersions = (decryptkeyformatversions ? decryptkeyformatversions : '1').split('/').map(Number).filter(Number.isFinite);\n return new LevelKey(decryptmethod, resolvedUri, decryptkeyformat, keyFormatVersions, decryptiv);\n }\n function parseStartTimeOffset(startAttributes) {\n var startAttrs = new AttrList(startAttributes);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET');\n if (isFiniteNumber(startTimeOffset)) {\n return startTimeOffset;\n }\n return null;\n }\n function setCodecs(codecs, level) {\n ['video', 'audio', 'text'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) {\n return isCodecType(codec, type);\n });\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + \"Codec\"] = preferred.length > 0 ? preferred[0] : filtered[0];\n\n // remove from list\n codecs = codecs.filter(function (codec) {\n return filtered.indexOf(codec) === -1;\n });\n }\n });\n level.unknownCodecs = codecs;\n }\n function assignCodec(media, groupItem, codecProperty) {\n var codecValue = groupItem[codecProperty];\n if (codecValue) {\n media[codecProperty] = codecValue;\n }\n }\n function backfillProgramDateTimes(fragments, firstPdtIndex) {\n var fragPrev = fragments[firstPdtIndex];\n for (var i = firstPdtIndex; i--;) {\n var frag = fragments[i];\n // Exit on delta-playlist skipped segments\n if (!frag) {\n return;\n }\n frag.programDateTime = fragPrev.programDateTime - frag.duration * 1000;\n fragPrev = frag;\n }\n }\n function assignProgramDateTime(frag, prevFrag) {\n if (frag.rawProgramDateTime) {\n frag.programDateTime = Date.parse(frag.rawProgramDateTime);\n } else if (prevFrag != null && prevFrag.programDateTime) {\n frag.programDateTime = prevFrag.endProgramDateTime;\n }\n if (!isFiniteNumber(frag.programDateTime)) {\n frag.programDateTime = null;\n frag.rawProgramDateTime = null;\n }\n }\n function setInitSegment(frag, mapAttrs, id, levelkeys) {\n frag.relurl = mapAttrs.URI;\n if (mapAttrs.BYTERANGE) {\n frag.setByteRange(mapAttrs.BYTERANGE);\n }\n frag.level = id;\n frag.sn = 'initSegment';\n if (levelkeys) {\n frag.levelkeys = levelkeys;\n }\n frag.initSegment = null;\n }\n function setFragLevelKeys(frag, levelkeys, level) {\n frag.levelkeys = levelkeys;\n var encryptedFragments = level.encryptedFragments;\n if ((!encryptedFragments.length || encryptedFragments[encryptedFragments.length - 1].levelkeys !== levelkeys) && Object.keys(levelkeys).some(function (format) {\n return levelkeys[format].isCommonEncryption;\n })) {\n encryptedFragments.push(frag);\n }\n }\n\n var PlaylistContextType = {\n MANIFEST: \"manifest\",\n LEVEL: \"level\",\n AUDIO_TRACK: \"audioTrack\",\n SUBTITLE_TRACK: \"subtitleTrack\"\n };\n var PlaylistLevelType = {\n MAIN: \"main\",\n AUDIO: \"audio\",\n SUBTITLE: \"subtitle\"\n };\n\n function mapContextToLevelType(context) {\n var type = context.type;\n switch (type) {\n case PlaylistContextType.AUDIO_TRACK:\n return PlaylistLevelType.AUDIO;\n case PlaylistContextType.SUBTITLE_TRACK:\n return PlaylistLevelType.SUBTITLE;\n default:\n return PlaylistLevelType.MAIN;\n }\n }\n function getResponseUrl(response, context) {\n var url = response.url;\n // responseURL not supported on some browsers (it is used to detect URL redirection)\n // data-uri mode also not supported (but no need to detect redirection)\n if (url === undefined || url.indexOf('data:') === 0) {\n // fallback to initial URL\n url = context.url;\n }\n return url;\n }\n var PlaylistLoader = /*#__PURE__*/function () {\n function PlaylistLoader(hls) {\n this.hls = void 0;\n this.loaders = Object.create(null);\n this.variableList = null;\n this.hls = hls;\n this.registerListeners();\n }\n var _proto = PlaylistLoader.prototype;\n _proto.startLoad = function startLoad(startPosition) {};\n _proto.stopLoad = function stopLoad() {\n this.destroyInternalLoaders();\n };\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.LEVEL_LOADING, this.onLevelLoading, this);\n hls.on(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);\n hls.on(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.LEVEL_LOADING, this.onLevelLoading, this);\n hls.off(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);\n hls.off(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);\n }\n\n /**\n * Returns defaults or configured loader-type overloads (pLoader and loader config params)\n */;\n _proto.createInternalLoader = function createInternalLoader(context) {\n var config = this.hls.config;\n var PLoader = config.pLoader;\n var Loader = config.loader;\n var InternalLoader = PLoader || Loader;\n var loader = new InternalLoader(config);\n this.loaders[context.type] = loader;\n return loader;\n };\n _proto.getInternalLoader = function getInternalLoader(context) {\n return this.loaders[context.type];\n };\n _proto.resetInternalLoader = function resetInternalLoader(contextType) {\n if (this.loaders[contextType]) {\n delete this.loaders[contextType];\n }\n }\n\n /**\n * Call `destroy` on all internal loader instances mapped (one per context type)\n */;\n _proto.destroyInternalLoaders = function destroyInternalLoaders() {\n for (var contextType in this.loaders) {\n var loader = this.loaders[contextType];\n if (loader) {\n loader.destroy();\n }\n this.resetInternalLoader(contextType);\n }\n };\n _proto.destroy = function destroy() {\n this.variableList = null;\n this.unregisterListeners();\n this.destroyInternalLoaders();\n };\n _proto.onManifestLoading = function onManifestLoading(event, data) {\n var url = data.url;\n this.variableList = null;\n this.load({\n id: null,\n level: 0,\n responseType: 'text',\n type: PlaylistContextType.MANIFEST,\n url: url,\n deliveryDirectives: null\n });\n };\n _proto.onLevelLoading = function onLevelLoading(event, data) {\n var id = data.id,\n level = data.level,\n url = data.url,\n deliveryDirectives = data.deliveryDirectives;\n this.load({\n id: id,\n level: level,\n responseType: 'text',\n type: PlaylistContextType.LEVEL,\n url: url,\n deliveryDirectives: deliveryDirectives\n });\n };\n _proto.onAudioTrackLoading = function onAudioTrackLoading(event, data) {\n var id = data.id,\n groupId = data.groupId,\n url = data.url,\n deliveryDirectives = data.deliveryDirectives;\n this.load({\n id: id,\n groupId: groupId,\n level: null,\n responseType: 'text',\n type: PlaylistContextType.AUDIO_TRACK,\n url: url,\n deliveryDirectives: deliveryDirectives\n });\n };\n _proto.onSubtitleTrackLoading = function onSubtitleTrackLoading(event, data) {\n var id = data.id,\n groupId = data.groupId,\n url = data.url,\n deliveryDirectives = data.deliveryDirectives;\n this.load({\n id: id,\n groupId: groupId,\n level: null,\n responseType: 'text',\n type: PlaylistContextType.SUBTITLE_TRACK,\n url: url,\n deliveryDirectives: deliveryDirectives\n });\n };\n _proto.load = function load(context) {\n var _context$deliveryDire,\n _this = this;\n var config = this.hls.config;\n\n // logger.debug(`[playlist-loader]: Loading playlist of type ${context.type}, level: ${context.level}, id: ${context.id}`);\n\n // Check if a loader for this context already exists\n var loader = this.getInternalLoader(context);\n if (loader) {\n var loaderContext = loader.context;\n if (loaderContext && loaderContext.url === context.url) {\n // same URL can't overlap\n logger.trace('[playlist-loader]: playlist request ongoing');\n return;\n }\n logger.log(\"[playlist-loader]: aborting previous loader for type: \" + context.type);\n loader.abort();\n }\n\n // apply different configs for retries depending on\n // context (manifest, level, audio/subs playlist)\n var loadPolicy;\n if (context.type === PlaylistContextType.MANIFEST) {\n loadPolicy = config.manifestLoadPolicy.default;\n } else {\n loadPolicy = _extends({}, config.playlistLoadPolicy.default, {\n timeoutRetry: null,\n errorRetry: null\n });\n }\n loader = this.createInternalLoader(context);\n\n // Override level/track timeout for LL-HLS requests\n // (the default of 10000ms is counter productive to blocking playlist reload requests)\n if ((_context$deliveryDire = context.deliveryDirectives) != null && _context$deliveryDire.part) {\n var levelDetails;\n if (context.type === PlaylistContextType.LEVEL && context.level !== null) {\n levelDetails = this.hls.levels[context.level].details;\n } else if (context.type === PlaylistContextType.AUDIO_TRACK && context.id !== null) {\n levelDetails = this.hls.audioTracks[context.id].details;\n } else if (context.type === PlaylistContextType.SUBTITLE_TRACK && context.id !== null) {\n levelDetails = this.hls.subtitleTracks[context.id].details;\n }\n if (levelDetails) {\n var partTarget = levelDetails.partTarget;\n var targetDuration = levelDetails.targetduration;\n if (partTarget && targetDuration) {\n var maxLowLatencyPlaylistRefresh = Math.max(partTarget * 3, targetDuration * 0.8) * 1000;\n loadPolicy = _extends({}, loadPolicy, {\n maxTimeToFirstByteMs: Math.min(maxLowLatencyPlaylistRefresh, loadPolicy.maxTimeToFirstByteMs),\n maxLoadTimeMs: Math.min(maxLowLatencyPlaylistRefresh, loadPolicy.maxTimeToFirstByteMs)\n });\n }\n }\n }\n var legacyRetryCompatibility = loadPolicy.errorRetry || loadPolicy.timeoutRetry || {};\n var loaderConfig = {\n loadPolicy: loadPolicy,\n timeout: loadPolicy.maxLoadTimeMs,\n maxRetry: legacyRetryCompatibility.maxNumRetry || 0,\n retryDelay: legacyRetryCompatibility.retryDelayMs || 0,\n maxRetryDelay: legacyRetryCompatibility.maxRetryDelayMs || 0\n };\n var loaderCallbacks = {\n onSuccess: function onSuccess(response, stats, context, networkDetails) {\n var loader = _this.getInternalLoader(context);\n _this.resetInternalLoader(context.type);\n var string = response.data;\n\n // Validate if it is an M3U8 at all\n if (string.indexOf('#EXTM3U') !== 0) {\n _this.handleManifestParsingError(response, context, new Error('no EXTM3U delimiter'), networkDetails || null, stats);\n return;\n }\n stats.parsing.start = performance.now();\n if (M3U8Parser.isMediaPlaylist(string)) {\n _this.handleTrackOrLevelPlaylist(response, stats, context, networkDetails || null, loader);\n } else {\n _this.handleMasterPlaylist(response, stats, context, networkDetails);\n }\n },\n onError: function onError(response, context, networkDetails, stats) {\n _this.handleNetworkError(context, networkDetails, false, response, stats);\n },\n onTimeout: function onTimeout(stats, context, networkDetails) {\n _this.handleNetworkError(context, networkDetails, true, undefined, stats);\n }\n };\n\n // logger.debug(`[playlist-loader]: Calling internal loader delegate for URL: ${context.url}`);\n\n loader.load(context, loaderConfig, loaderCallbacks);\n };\n _proto.handleMasterPlaylist = function handleMasterPlaylist(response, stats, context, networkDetails) {\n var hls = this.hls;\n var string = response.data;\n var url = getResponseUrl(response, context);\n var parsedResult = M3U8Parser.parseMasterPlaylist(string, url);\n if (parsedResult.playlistParsingError) {\n this.handleManifestParsingError(response, context, parsedResult.playlistParsingError, networkDetails, stats);\n return;\n }\n var contentSteering = parsedResult.contentSteering,\n levels = parsedResult.levels,\n sessionData = parsedResult.sessionData,\n sessionKeys = parsedResult.sessionKeys,\n startTimeOffset = parsedResult.startTimeOffset,\n variableList = parsedResult.variableList;\n this.variableList = variableList;\n var _M3U8Parser$parseMast = M3U8Parser.parseMasterPlaylistMedia(string, url, parsedResult),\n _M3U8Parser$parseMast2 = _M3U8Parser$parseMast.AUDIO,\n audioTracks = _M3U8Parser$parseMast2 === void 0 ? [] : _M3U8Parser$parseMast2,\n subtitles = _M3U8Parser$parseMast.SUBTITLES,\n captions = _M3U8Parser$parseMast['CLOSED-CAPTIONS'];\n if (audioTracks.length) {\n // check if we have found an audio track embedded in main playlist (audio track without URI attribute)\n var embeddedAudioFound = audioTracks.some(function (audioTrack) {\n return !audioTrack.url;\n });\n\n // if no embedded audio track defined, but audio codec signaled in quality level,\n // we need to signal this main audio track this could happen with playlists with\n // alt audio rendition in which quality levels (main)\n // contains both audio+video. but with mixed audio track not signaled\n if (!embeddedAudioFound && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger.log('[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({\n type: 'main',\n name: 'main',\n groupId: 'main',\n default: false,\n autoselect: false,\n forced: false,\n id: -1,\n attrs: new AttrList({}),\n bitrate: 0,\n url: ''\n });\n }\n }\n hls.trigger(Events.MANIFEST_LOADED, {\n levels: levels,\n audioTracks: audioTracks,\n subtitles: subtitles,\n captions: captions,\n contentSteering: contentSteering,\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: sessionData,\n sessionKeys: sessionKeys,\n startTimeOffset: startTimeOffset,\n variableList: variableList\n });\n };\n _proto.handleTrackOrLevelPlaylist = function handleTrackOrLevelPlaylist(response, stats, context, networkDetails, loader) {\n var hls = this.hls;\n var id = context.id,\n level = context.level,\n type = context.type;\n var url = getResponseUrl(response, context);\n var levelUrlId = isFiniteNumber(id) ? id : 0;\n var levelId = isFiniteNumber(level) ? level : levelUrlId;\n var levelType = mapContextToLevelType(context);\n var levelDetails = M3U8Parser.parseLevelPlaylist(response.data, url, levelId, levelType, levelUrlId, this.variableList);\n\n // We have done our first request (Manifest-type) and receive\n // not a master playlist but a chunk-list (track/level)\n // We fire the manifest-loaded event anyway with the parsed level-details\n // by creating a single-level structure for it.\n if (type === PlaylistContextType.MANIFEST) {\n var singleLevel = {\n attrs: new AttrList({}),\n bitrate: 0,\n details: levelDetails,\n name: '',\n url: url\n };\n hls.trigger(Events.MANIFEST_LOADED, {\n levels: [singleLevel],\n audioTracks: [],\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: null,\n sessionKeys: null,\n contentSteering: null,\n startTimeOffset: null,\n variableList: null\n });\n }\n\n // save parsing time\n stats.parsing.end = performance.now();\n\n // extend the context with the new levelDetails property\n context.levelDetails = levelDetails;\n this.handlePlaylistLoaded(levelDetails, response, stats, context, networkDetails, loader);\n };\n _proto.handleManifestParsingError = function handleManifestParsingError(response, context, error, networkDetails, stats) {\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.MANIFEST_PARSING_ERROR,\n fatal: context.type === PlaylistContextType.MANIFEST,\n url: response.url,\n err: error,\n error: error,\n reason: error.message,\n response: response,\n context: context,\n networkDetails: networkDetails,\n stats: stats\n });\n };\n _proto.handleNetworkError = function handleNetworkError(context, networkDetails, timeout, response, stats) {\n if (timeout === void 0) {\n timeout = false;\n }\n var message = \"A network \" + (timeout ? 'timeout' : 'error' + (response ? ' (status ' + response.code + ')' : '')) + \" occurred while loading \" + context.type;\n if (context.type === PlaylistContextType.LEVEL) {\n message += \": \" + context.level + \" id: \" + context.id;\n } else if (context.type === PlaylistContextType.AUDIO_TRACK || context.type === PlaylistContextType.SUBTITLE_TRACK) {\n message += \" id: \" + context.id + \" group-id: \\\"\" + context.groupId + \"\\\"\";\n }\n var error = new Error(message);\n logger.warn(\"[playlist-loader]: \" + message);\n var details = ErrorDetails.UNKNOWN;\n var fatal = false;\n var loader = this.getInternalLoader(context);\n switch (context.type) {\n case PlaylistContextType.MANIFEST:\n details = timeout ? ErrorDetails.MANIFEST_LOAD_TIMEOUT : ErrorDetails.MANIFEST_LOAD_ERROR;\n fatal = true;\n break;\n case PlaylistContextType.LEVEL:\n details = timeout ? ErrorDetails.LEVEL_LOAD_TIMEOUT : ErrorDetails.LEVEL_LOAD_ERROR;\n fatal = false;\n break;\n case PlaylistContextType.AUDIO_TRACK:\n details = timeout ? ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT : ErrorDetails.AUDIO_TRACK_LOAD_ERROR;\n fatal = false;\n break;\n case PlaylistContextType.SUBTITLE_TRACK:\n details = timeout ? ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT : ErrorDetails.SUBTITLE_LOAD_ERROR;\n fatal = false;\n break;\n }\n if (loader) {\n this.resetInternalLoader(context.type);\n }\n var errorData = {\n type: ErrorTypes.NETWORK_ERROR,\n details: details,\n fatal: fatal,\n url: context.url,\n loader: loader,\n context: context,\n error: error,\n networkDetails: networkDetails,\n stats: stats\n };\n if (response) {\n var url = (networkDetails == null ? void 0 : networkDetails.url) || context.url;\n errorData.response = _objectSpread2({\n url: url,\n data: undefined\n }, response);\n }\n this.hls.trigger(Events.ERROR, errorData);\n };\n _proto.handlePlaylistLoaded = function handlePlaylistLoaded(levelDetails, response, stats, context, networkDetails, loader) {\n var hls = this.hls;\n var type = context.type,\n level = context.level,\n id = context.id,\n groupId = context.groupId,\n deliveryDirectives = context.deliveryDirectives;\n var url = getResponseUrl(response, context);\n var parent = mapContextToLevelType(context);\n var levelIndex = typeof context.level === 'number' && parent === PlaylistLevelType.MAIN ? level : undefined;\n if (!levelDetails.fragments.length) {\n var _error = new Error('No Segments found in Playlist');\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.LEVEL_EMPTY_ERROR,\n fatal: false,\n url: url,\n error: _error,\n reason: _error.message,\n response: response,\n context: context,\n level: levelIndex,\n parent: parent,\n networkDetails: networkDetails,\n stats: stats\n });\n return;\n }\n if (!levelDetails.targetduration) {\n levelDetails.playlistParsingError = new Error('Missing Target Duration');\n }\n var error = levelDetails.playlistParsingError;\n if (error) {\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.LEVEL_PARSING_ERROR,\n fatal: false,\n url: url,\n error: error,\n reason: error.message,\n response: response,\n context: context,\n level: levelIndex,\n parent: parent,\n networkDetails: networkDetails,\n stats: stats\n });\n return;\n }\n if (levelDetails.live && loader) {\n if (loader.getCacheAge) {\n levelDetails.ageHeader = loader.getCacheAge() || 0;\n }\n if (!loader.getCacheAge || isNaN(levelDetails.ageHeader)) {\n levelDetails.ageHeader = 0;\n }\n }\n switch (type) {\n case PlaylistContextType.MANIFEST:\n case PlaylistContextType.LEVEL:\n hls.trigger(Events.LEVEL_LOADED, {\n details: levelDetails,\n level: levelIndex || 0,\n id: id || 0,\n stats: stats,\n networkDetails: networkDetails,\n deliveryDirectives: deliveryDirectives\n });\n break;\n case PlaylistContextType.AUDIO_TRACK:\n hls.trigger(Events.AUDIO_TRACK_LOADED, {\n details: levelDetails,\n id: id || 0,\n groupId: groupId || '',\n stats: stats,\n networkDetails: networkDetails,\n deliveryDirectives: deliveryDirectives\n });\n break;\n case PlaylistContextType.SUBTITLE_TRACK:\n hls.trigger(Events.SUBTITLE_TRACK_LOADED, {\n details: levelDetails,\n id: id || 0,\n groupId: groupId || '',\n stats: stats,\n networkDetails: networkDetails,\n deliveryDirectives: deliveryDirectives\n });\n break;\n }\n };\n return PlaylistLoader;\n }();\n\n function sendAddTrackEvent(track, videoEl) {\n var event;\n try {\n event = new Event('addtrack');\n } catch (err) {\n // for IE11\n event = document.createEvent('Event');\n event.initEvent('addtrack', false, false);\n }\n event.track = track;\n videoEl.dispatchEvent(event);\n }\n function clearCurrentCues(track) {\n // When track.mode is disabled, track.cues will be null.\n // To guarantee the removal of cues, we need to temporarily\n // change the mode to hidden\n var mode = track.mode;\n if (mode === 'disabled') {\n track.mode = 'hidden';\n }\n if (track.cues) {\n for (var i = track.cues.length; i--;) {\n track.removeCue(track.cues[i]);\n }\n }\n if (mode === 'disabled') {\n track.mode = mode;\n }\n }\n function removeCuesInRange(track, start, end, predicate) {\n var mode = track.mode;\n if (mode === 'disabled') {\n track.mode = 'hidden';\n }\n if (track.cues && track.cues.length > 0) {\n var cues = getCuesInRange(track.cues, start, end);\n for (var i = 0; i < cues.length; i++) {\n if (!predicate || predicate(cues[i])) {\n track.removeCue(cues[i]);\n }\n }\n }\n if (mode === 'disabled') {\n track.mode = mode;\n }\n }\n\n // Find first cue starting after given time.\n // Modified version of binary search O(log(n)).\n function getFirstCueIndexAfterTime(cues, time) {\n // If first cue starts after time, start there\n if (time < cues[0].startTime) {\n return 0;\n }\n // If the last cue ends before time there is no overlap\n var len = cues.length - 1;\n if (time > cues[len].endTime) {\n return -1;\n }\n var left = 0;\n var right = len;\n while (left <= right) {\n var mid = Math.floor((right + left) / 2);\n if (time < cues[mid].startTime) {\n right = mid - 1;\n } else if (time > cues[mid].startTime && left < len) {\n left = mid + 1;\n } else {\n // If it's not lower or higher, it must be equal.\n return mid;\n }\n }\n // At this point, left and right have swapped.\n // No direct match was found, left or right element must be the closest. Check which one has the smallest diff.\n return cues[left].startTime - time < time - cues[right].startTime ? left : right;\n }\n function getCuesInRange(cues, start, end) {\n var cuesFound = [];\n var firstCueInRange = getFirstCueIndexAfterTime(cues, start);\n if (firstCueInRange > -1) {\n for (var i = firstCueInRange, len = cues.length; i < len; i++) {\n var _cue = cues[i];\n if (_cue.startTime >= start && _cue.endTime <= end) {\n cuesFound.push(_cue);\n } else if (_cue.startTime > end) {\n return cuesFound;\n }\n }\n }\n return cuesFound;\n }\n\n var MetadataSchema = {\n audioId3: \"org.id3\",\n dateRange: \"com.apple.quicktime.HLS\",\n emsg: \"https://aomedia.org/emsg/ID3\"\n };\n\n var MIN_CUE_DURATION = 0.25;\n function getCueClass() {\n if (typeof self === 'undefined') return undefined;\n\n // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n return self.WebKitDataCue || self.VTTCue || self.TextTrackCue;\n }\n\n // VTTCue latest draft allows an infinite duration, fallback\n // to MAX_VALUE if necessary\n var MAX_CUE_ENDTIME = function () {\n var Cue = getCueClass();\n try {\n new Cue(0, Number.POSITIVE_INFINITY, '');\n } catch (e) {\n return Number.MAX_VALUE;\n }\n return Number.POSITIVE_INFINITY;\n }();\n function dateRangeDateToTimelineSeconds(date, offset) {\n return date.getTime() / 1000 - offset;\n }\n function hexToArrayBuffer(str) {\n return Uint8Array.from(str.replace(/^0x/, '').replace(/([\\da-fA-F]{2}) ?/g, '0x$1 ').replace(/ +$/, '').split(' ')).buffer;\n }\n var ID3TrackController = /*#__PURE__*/function () {\n function ID3TrackController(hls) {\n this.hls = void 0;\n this.id3Track = null;\n this.media = null;\n this.dateRangeCuesAppended = {};\n this.hls = hls;\n this._registerListeners();\n }\n var _proto = ID3TrackController.prototype;\n _proto.destroy = function destroy() {\n this._unregisterListeners();\n this.id3Track = null;\n this.media = null;\n this.dateRangeCuesAppended = {};\n // @ts-ignore\n this.hls = null;\n };\n _proto._registerListeners = function _registerListeners() {\n var hls = this.hls;\n hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);\n hls.on(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);\n hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n };\n _proto._unregisterListeners = function _unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this);\n hls.off(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);\n hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n }\n\n // Add ID3 metatadata text track.\n ;\n _proto.onMediaAttached = function onMediaAttached(event, data) {\n this.media = data.media;\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n if (!this.id3Track) {\n return;\n }\n clearCurrentCues(this.id3Track);\n this.id3Track = null;\n this.media = null;\n this.dateRangeCuesAppended = {};\n };\n _proto.onManifestLoading = function onManifestLoading() {\n this.dateRangeCuesAppended = {};\n };\n _proto.createTrack = function createTrack(media) {\n var track = this.getID3Track(media.textTracks);\n track.mode = 'hidden';\n return track;\n };\n _proto.getID3Track = function getID3Track(textTracks) {\n if (!this.media) {\n return;\n }\n for (var i = 0; i < textTracks.length; i++) {\n var textTrack = textTracks[i];\n if (textTrack.kind === 'metadata' && textTrack.label === 'id3') {\n // send 'addtrack' when reusing the textTrack for metadata,\n // same as what we do for captions\n sendAddTrackEvent(textTrack, this.media);\n return textTrack;\n }\n }\n return this.media.addTextTrack('metadata', 'id3');\n };\n _proto.onFragParsingMetadata = function onFragParsingMetadata(event, data) {\n if (!this.media) {\n return;\n }\n var _this$hls$config = this.hls.config,\n enableEmsgMetadataCues = _this$hls$config.enableEmsgMetadataCues,\n enableID3MetadataCues = _this$hls$config.enableID3MetadataCues;\n if (!enableEmsgMetadataCues && !enableID3MetadataCues) {\n return;\n }\n var samples = data.samples;\n\n // create track dynamically\n if (!this.id3Track) {\n this.id3Track = this.createTrack(this.media);\n }\n var Cue = getCueClass();\n for (var i = 0; i < samples.length; i++) {\n var type = samples[i].type;\n if (type === MetadataSchema.emsg && !enableEmsgMetadataCues || !enableID3MetadataCues) {\n continue;\n }\n var frames = getID3Frames(samples[i].data);\n if (frames) {\n var startTime = samples[i].pts;\n var endTime = startTime + samples[i].duration;\n if (endTime > MAX_CUE_ENDTIME) {\n endTime = MAX_CUE_ENDTIME;\n }\n var timeDiff = endTime - startTime;\n if (timeDiff <= 0) {\n endTime = startTime + MIN_CUE_DURATION;\n }\n for (var j = 0; j < frames.length; j++) {\n var frame = frames[j];\n // Safari doesn't put the timestamp frame in the TextTrack\n if (!isTimeStampFrame(frame)) {\n // add a bounds to any unbounded cues\n this.updateId3CueEnds(startTime, type);\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n if (type) {\n cue.type = type;\n }\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n _proto.updateId3CueEnds = function updateId3CueEnds(startTime, type) {\n var _this$id3Track;\n var cues = (_this$id3Track = this.id3Track) == null ? void 0 : _this$id3Track.cues;\n if (cues) {\n for (var i = cues.length; i--;) {\n var cue = cues[i];\n if (cue.type === type && cue.startTime < startTime && cue.endTime === MAX_CUE_ENDTIME) {\n cue.endTime = startTime;\n }\n }\n }\n };\n _proto.onBufferFlushing = function onBufferFlushing(event, _ref) {\n var startOffset = _ref.startOffset,\n endOffset = _ref.endOffset,\n type = _ref.type;\n var id3Track = this.id3Track,\n hls = this.hls;\n if (!hls) {\n return;\n }\n var _hls$config = hls.config,\n enableEmsgMetadataCues = _hls$config.enableEmsgMetadataCues,\n enableID3MetadataCues = _hls$config.enableID3MetadataCues;\n if (id3Track && (enableEmsgMetadataCues || enableID3MetadataCues)) {\n var predicate;\n if (type === 'audio') {\n predicate = function predicate(cue) {\n return cue.type === MetadataSchema.audioId3 && enableID3MetadataCues;\n };\n } else if (type === 'video') {\n predicate = function predicate(cue) {\n return cue.type === MetadataSchema.emsg && enableEmsgMetadataCues;\n };\n } else {\n predicate = function predicate(cue) {\n return cue.type === MetadataSchema.audioId3 && enableID3MetadataCues || cue.type === MetadataSchema.emsg && enableEmsgMetadataCues;\n };\n }\n removeCuesInRange(id3Track, startOffset, endOffset, predicate);\n }\n };\n _proto.onLevelUpdated = function onLevelUpdated(event, _ref2) {\n var _this = this;\n var details = _ref2.details;\n if (!this.media || !details.hasProgramDateTime || !this.hls.config.enableDateRangeMetadataCues) {\n return;\n }\n var dateRangeCuesAppended = this.dateRangeCuesAppended,\n id3Track = this.id3Track;\n var dateRanges = details.dateRanges;\n var ids = Object.keys(dateRanges);\n // Remove cues from track not found in details.dateRanges\n if (id3Track) {\n var idsToRemove = Object.keys(dateRangeCuesAppended).filter(function (id) {\n return !ids.includes(id);\n });\n var _loop = function _loop() {\n var id = idsToRemove[i];\n Object.keys(dateRangeCuesAppended[id].cues).forEach(function (key) {\n id3Track.removeCue(dateRangeCuesAppended[id].cues[key]);\n });\n delete dateRangeCuesAppended[id];\n };\n for (var i = idsToRemove.length; i--;) {\n _loop();\n }\n }\n // Exit if the playlist does not have Date Ranges or does not have Program Date Time\n var lastFragment = details.fragments[details.fragments.length - 1];\n if (ids.length === 0 || !isFiniteNumber(lastFragment == null ? void 0 : lastFragment.programDateTime)) {\n return;\n }\n if (!this.id3Track) {\n this.id3Track = this.createTrack(this.media);\n }\n var dateTimeOffset = lastFragment.programDateTime / 1000 - lastFragment.start;\n var Cue = getCueClass();\n var _loop2 = function _loop2() {\n var id = ids[_i];\n var dateRange = dateRanges[id];\n var appendedDateRangeCues = dateRangeCuesAppended[id];\n var cues = (appendedDateRangeCues == null ? void 0 : appendedDateRangeCues.cues) || {};\n var durationKnown = (appendedDateRangeCues == null ? void 0 : appendedDateRangeCues.durationKnown) || false;\n var startTime = dateRangeDateToTimelineSeconds(dateRange.startDate, dateTimeOffset);\n var endTime = MAX_CUE_ENDTIME;\n var endDate = dateRange.endDate;\n if (endDate) {\n endTime = dateRangeDateToTimelineSeconds(endDate, dateTimeOffset);\n durationKnown = true;\n } else if (dateRange.endOnNext && !durationKnown) {\n var nextDateRangeWithSameClass = ids.reduce(function (filterMapArray, id) {\n var candidate = dateRanges[id];\n if (candidate.class === dateRange.class && candidate.id !== id && candidate.startDate > dateRange.startDate) {\n filterMapArray.push(candidate);\n }\n return filterMapArray;\n }, []).sort(function (a, b) {\n return a.startDate.getTime() - b.startDate.getTime();\n })[0];\n if (nextDateRangeWithSameClass) {\n endTime = dateRangeDateToTimelineSeconds(nextDateRangeWithSameClass.startDate, dateTimeOffset);\n durationKnown = true;\n }\n }\n var attributes = Object.keys(dateRange.attr);\n for (var j = 0; j < attributes.length; j++) {\n var key = attributes[j];\n if (!isDateRangeCueAttribute(key)) {\n continue;\n }\n var cue = cues[key];\n if (cue) {\n if (durationKnown && !appendedDateRangeCues.durationKnown) {\n cue.endTime = endTime;\n }\n } else {\n var data = dateRange.attr[key];\n cue = new Cue(startTime, endTime, '');\n if (isSCTE35Attribute(key)) {\n data = hexToArrayBuffer(data);\n }\n cue.value = {\n key: key,\n data: data\n };\n cue.type = MetadataSchema.dateRange;\n cue.id = id;\n _this.id3Track.addCue(cue);\n cues[key] = cue;\n }\n }\n dateRangeCuesAppended[id] = {\n cues: cues,\n dateRange: dateRange,\n durationKnown: durationKnown\n };\n };\n for (var _i = 0; _i < ids.length; _i++) {\n _loop2();\n }\n };\n return ID3TrackController;\n }();\n\n var LatencyController = /*#__PURE__*/function () {\n function LatencyController(hls) {\n var _this = this;\n this.hls = void 0;\n this.config = void 0;\n this.media = null;\n this.levelDetails = null;\n this.currentTime = 0;\n this.stallCount = 0;\n this._latency = null;\n this.timeupdateHandler = function () {\n return _this.timeupdate();\n };\n this.hls = hls;\n this.config = hls.config;\n this.registerListeners();\n }\n var _proto = LatencyController.prototype;\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n this.onMediaDetaching();\n this.levelDetails = null;\n // @ts-ignore\n this.hls = this.timeupdateHandler = null;\n };\n _proto.registerListeners = function registerListeners() {\n this.hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n this.hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n this.hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n this.hls.on(Events.ERROR, this.onError, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n this.hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n this.hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n this.hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n this.hls.off(Events.ERROR, this.onError, this);\n };\n _proto.onMediaAttached = function onMediaAttached(event, data) {\n this.media = data.media;\n this.media.addEventListener('timeupdate', this.timeupdateHandler);\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n if (this.media) {\n this.media.removeEventListener('timeupdate', this.timeupdateHandler);\n this.media = null;\n }\n };\n _proto.onManifestLoading = function onManifestLoading() {\n this.levelDetails = null;\n this._latency = null;\n this.stallCount = 0;\n };\n _proto.onLevelUpdated = function onLevelUpdated(event, _ref) {\n var details = _ref.details;\n this.levelDetails = details;\n if (details.advanced) {\n this.timeupdate();\n }\n if (!details.live && this.media) {\n this.media.removeEventListener('timeupdate', this.timeupdateHandler);\n }\n };\n _proto.onError = function onError(event, data) {\n var _this$levelDetails;\n if (data.details !== ErrorDetails.BUFFER_STALLED_ERROR) {\n return;\n }\n this.stallCount++;\n if ((_this$levelDetails = this.levelDetails) != null && _this$levelDetails.live) {\n logger.warn('[playback-rate-controller]: Stall detected, adjusting target latency');\n }\n };\n _proto.timeupdate = function timeupdate() {\n var media = this.media,\n levelDetails = this.levelDetails;\n if (!media || !levelDetails) {\n return;\n }\n this.currentTime = media.currentTime;\n var latency = this.computeLatency();\n if (latency === null) {\n return;\n }\n this._latency = latency;\n\n // Adapt playbackRate to meet target latency in low-latency mode\n var _this$config = this.config,\n lowLatencyMode = _this$config.lowLatencyMode,\n maxLiveSyncPlaybackRate = _this$config.maxLiveSyncPlaybackRate;\n if (!lowLatencyMode || maxLiveSyncPlaybackRate === 1) {\n return;\n }\n var targetLatency = this.targetLatency;\n if (targetLatency === null) {\n return;\n }\n var distanceFromTarget = latency - targetLatency;\n // Only adjust playbackRate when within one target duration of targetLatency\n // and more than one second from under-buffering.\n // Playback further than one target duration from target can be considered DVR playback.\n var liveMinLatencyDuration = Math.min(this.maxLatency, targetLatency + levelDetails.targetduration);\n var inLiveRange = distanceFromTarget < liveMinLatencyDuration;\n if (levelDetails.live && inLiveRange && distanceFromTarget > 0.05 && this.forwardBufferLength > 1) {\n var max = Math.min(2, Math.max(1.0, maxLiveSyncPlaybackRate));\n var rate = Math.round(2 / (1 + Math.exp(-0.75 * distanceFromTarget - this.edgeStalled)) * 20) / 20;\n media.playbackRate = Math.min(max, Math.max(1, rate));\n } else if (media.playbackRate !== 1 && media.playbackRate !== 0) {\n media.playbackRate = 1;\n }\n };\n _proto.estimateLiveEdge = function estimateLiveEdge() {\n var levelDetails = this.levelDetails;\n if (levelDetails === null) {\n return null;\n }\n return levelDetails.edge + levelDetails.age;\n };\n _proto.computeLatency = function computeLatency() {\n var liveEdge = this.estimateLiveEdge();\n if (liveEdge === null) {\n return null;\n }\n return liveEdge - this.currentTime;\n };\n _createClass(LatencyController, [{\n key: \"latency\",\n get: function get() {\n return this._latency || 0;\n }\n }, {\n key: \"maxLatency\",\n get: function get() {\n var config = this.config,\n levelDetails = this.levelDetails;\n if (config.liveMaxLatencyDuration !== undefined) {\n return config.liveMaxLatencyDuration;\n }\n return levelDetails ? config.liveMaxLatencyDurationCount * levelDetails.targetduration : 0;\n }\n }, {\n key: \"targetLatency\",\n get: function get() {\n var levelDetails = this.levelDetails;\n if (levelDetails === null) {\n return null;\n }\n var holdBack = levelDetails.holdBack,\n partHoldBack = levelDetails.partHoldBack,\n targetduration = levelDetails.targetduration;\n var _this$config2 = this.config,\n liveSyncDuration = _this$config2.liveSyncDuration,\n liveSyncDurationCount = _this$config2.liveSyncDurationCount,\n lowLatencyMode = _this$config2.lowLatencyMode;\n var userConfig = this.hls.userConfig;\n var targetLatency = lowLatencyMode ? partHoldBack || holdBack : holdBack;\n if (userConfig.liveSyncDuration || userConfig.liveSyncDurationCount || targetLatency === 0) {\n targetLatency = liveSyncDuration !== undefined ? liveSyncDuration : liveSyncDurationCount * targetduration;\n }\n var maxLiveSyncOnStallIncrease = targetduration;\n var liveSyncOnStallIncrease = 1.0;\n return targetLatency + Math.min(this.stallCount * liveSyncOnStallIncrease, maxLiveSyncOnStallIncrease);\n }\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n var liveEdge = this.estimateLiveEdge();\n var targetLatency = this.targetLatency;\n var levelDetails = this.levelDetails;\n if (liveEdge === null || targetLatency === null || levelDetails === null) {\n return null;\n }\n var edge = levelDetails.edge;\n var syncPosition = liveEdge - targetLatency - this.edgeStalled;\n var min = edge - levelDetails.totalduration;\n var max = edge - (this.config.lowLatencyMode && levelDetails.partTarget || levelDetails.targetduration);\n return Math.min(Math.max(min, syncPosition), max);\n }\n }, {\n key: \"drift\",\n get: function get() {\n var levelDetails = this.levelDetails;\n if (levelDetails === null) {\n return 1;\n }\n return levelDetails.drift;\n }\n }, {\n key: \"edgeStalled\",\n get: function get() {\n var levelDetails = this.levelDetails;\n if (levelDetails === null) {\n return 0;\n }\n var maxLevelUpdateAge = (this.config.lowLatencyMode && levelDetails.partTarget || levelDetails.targetduration) * 3;\n return Math.max(levelDetails.age - maxLevelUpdateAge, 0);\n }\n }, {\n key: \"forwardBufferLength\",\n get: function get() {\n var media = this.media,\n levelDetails = this.levelDetails;\n if (!media || !levelDetails) {\n return 0;\n }\n var bufferedRanges = media.buffered.length;\n return (bufferedRanges ? media.buffered.end(bufferedRanges - 1) : levelDetails.edge) - this.currentTime;\n }\n }]);\n return LatencyController;\n }();\n\n var HdcpLevels = ['NONE', 'TYPE-0', 'TYPE-1', null];\n var HlsSkip = {\n No: \"\",\n Yes: \"YES\",\n v2: \"v2\"\n };\n function getSkipValue(details, msn) {\n var canSkipUntil = details.canSkipUntil,\n canSkipDateRanges = details.canSkipDateRanges,\n endSN = details.endSN;\n var snChangeGoal = msn !== undefined ? msn - endSN : 0;\n if (canSkipUntil && snChangeGoal < canSkipUntil) {\n if (canSkipDateRanges) {\n return HlsSkip.v2;\n }\n return HlsSkip.Yes;\n }\n return HlsSkip.No;\n }\n var HlsUrlParameters = /*#__PURE__*/function () {\n function HlsUrlParameters(msn, part, skip) {\n this.msn = void 0;\n this.part = void 0;\n this.skip = void 0;\n this.msn = msn;\n this.part = part;\n this.skip = skip;\n }\n var _proto = HlsUrlParameters.prototype;\n _proto.addDirectives = function addDirectives(uri) {\n var url = new self.URL(uri);\n if (this.msn !== undefined) {\n url.searchParams.set('_HLS_msn', this.msn.toString());\n }\n if (this.part !== undefined) {\n url.searchParams.set('_HLS_part', this.part.toString());\n }\n if (this.skip) {\n url.searchParams.set('_HLS_skip', this.skip);\n }\n return url.href;\n };\n return HlsUrlParameters;\n }();\n var Level = /*#__PURE__*/function () {\n function Level(data) {\n this._attrs = void 0;\n this.audioCodec = void 0;\n this.bitrate = void 0;\n this.codecSet = void 0;\n this.height = void 0;\n this.id = void 0;\n this.name = void 0;\n this.videoCodec = void 0;\n this.width = void 0;\n this.unknownCodecs = void 0;\n this.audioGroupIds = void 0;\n this.details = void 0;\n this.fragmentError = 0;\n this.loadError = 0;\n this.loaded = void 0;\n this.realBitrate = 0;\n this.textGroupIds = void 0;\n this.url = void 0;\n this._urlId = 0;\n this.url = [data.url];\n this._attrs = [data.attrs];\n this.bitrate = data.bitrate;\n if (data.details) {\n this.details = data.details;\n }\n this.id = data.id || 0;\n this.name = data.name;\n this.width = data.width || 0;\n this.height = data.height || 0;\n this.audioCodec = data.audioCodec;\n this.videoCodec = data.videoCodec;\n this.unknownCodecs = data.unknownCodecs;\n this.codecSet = [data.videoCodec, data.audioCodec].filter(function (c) {\n return c;\n }).join(',').replace(/\\.[^.,]+/g, '');\n }\n var _proto2 = Level.prototype;\n _proto2.addFallback = function addFallback(data) {\n this.url.push(data.url);\n this._attrs.push(data.attrs);\n };\n _createClass(Level, [{\n key: \"maxBitrate\",\n get: function get() {\n return Math.max(this.realBitrate, this.bitrate);\n }\n }, {\n key: \"attrs\",\n get: function get() {\n return this._attrs[this._urlId];\n }\n }, {\n key: \"pathwayId\",\n get: function get() {\n return this.attrs['PATHWAY-ID'] || '.';\n }\n }, {\n key: \"uri\",\n get: function get() {\n return this.url[this._urlId] || '';\n }\n }, {\n key: \"urlId\",\n get: function get() {\n return this._urlId;\n },\n set: function set(value) {\n var newValue = value % this.url.length;\n if (this._urlId !== newValue) {\n this.fragmentError = 0;\n this.loadError = 0;\n this.details = undefined;\n this._urlId = newValue;\n }\n }\n }, {\n key: \"audioGroupId\",\n get: function get() {\n var _this$audioGroupIds;\n return (_this$audioGroupIds = this.audioGroupIds) == null ? void 0 : _this$audioGroupIds[this.urlId];\n }\n }, {\n key: \"textGroupId\",\n get: function get() {\n var _this$textGroupIds;\n return (_this$textGroupIds = this.textGroupIds) == null ? void 0 : _this$textGroupIds[this.urlId];\n }\n }]);\n return Level;\n }();\n\n function updateFromToPTS(fragFrom, fragTo) {\n var fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if (isFiniteNumber(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n var duration = 0;\n var frag;\n if (fragTo.sn > fragFrom.sn) {\n duration = fragToPTS - fragFrom.start;\n frag = fragFrom;\n } else {\n duration = fragFrom.start - fragToPTS;\n frag = fragTo;\n }\n if (frag.duration !== duration) {\n frag.duration = duration;\n }\n // we dont know startPTS[toIdx]\n } else if (fragTo.sn > fragFrom.sn) {\n var contiguous = fragFrom.cc === fragTo.cc;\n // TODO: With part-loading end/durations we need to confirm the whole fragment is loaded before using (or setting) minEndPTS\n if (contiguous && fragFrom.minEndPTS) {\n fragTo.start = fragFrom.start + (fragFrom.minEndPTS - fragFrom.start);\n } else {\n fragTo.start = fragFrom.start + fragFrom.duration;\n }\n } else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n function updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n var parsedMediaDuration = endPTS - startPTS;\n if (parsedMediaDuration <= 0) {\n logger.warn('Fragment should have a positive duration', frag);\n endPTS = startPTS + frag.duration;\n endDTS = startDTS + frag.duration;\n }\n var maxStartPTS = startPTS;\n var minEndPTS = endPTS;\n var fragStartPts = frag.startPTS;\n var fragEndPts = frag.endPTS;\n if (isFiniteNumber(fragStartPts)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(fragStartPts - startPTS);\n if (!isFiniteNumber(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n } else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n maxStartPTS = Math.max(startPTS, fragStartPts);\n startPTS = Math.min(startPTS, fragStartPts);\n startDTS = Math.min(startDTS, frag.startDTS);\n minEndPTS = Math.min(endPTS, fragEndPts);\n endPTS = Math.max(endPTS, fragEndPts);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n var drift = startPTS - frag.start;\n if (frag.start !== 0) {\n frag.start = startPTS;\n }\n frag.duration = endPTS - frag.start;\n frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.startDTS = startDTS;\n frag.endPTS = endPTS;\n frag.minEndPTS = minEndPTS;\n frag.endDTS = endDTS;\n var sn = frag.sn; // 'initSegment'\n // exit if sn out of range\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n var i;\n var fragIdx = sn - details.startSN;\n var fragments = details.fragments;\n // update frag reference in fragments array\n // rationale is that fragments array might not contain this frag object.\n // this will happen if playlist has been refreshed between frag loading and call to updateFragPTSDTS()\n // if we don't update frag, we won't be able to propagate PTS info on the playlist\n // resulting in invalid sliding computation\n fragments[fragIdx] = frag;\n // adjust fragment PTS/duration from seqnum-1 to frag 0\n for (i = fragIdx; i > 0; i--) {\n updateFromToPTS(fragments[i], fragments[i - 1]);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updateFromToPTS(fragments[i], fragments[i + 1]);\n }\n if (details.fragmentHint) {\n updateFromToPTS(fragments[fragments.length - 1], details.fragmentHint);\n }\n details.PTSKnown = details.alignedSliding = true;\n return drift;\n }\n function mergeDetails(oldDetails, newDetails) {\n // Track the last initSegment processed. Initialize it to the last one on the timeline.\n var currentInitSegment = null;\n var oldFragments = oldDetails.fragments;\n for (var i = oldFragments.length - 1; i >= 0; i--) {\n var oldInit = oldFragments[i].initSegment;\n if (oldInit) {\n currentInitSegment = oldInit;\n break;\n }\n }\n if (oldDetails.fragmentHint) {\n // prevent PTS and duration from being adjusted on the next hint\n delete oldDetails.fragmentHint.endPTS;\n }\n // check if old/new playlists have fragments in common\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n var ccOffset = 0;\n var PTSFrag;\n mapFragmentIntersection(oldDetails, newDetails, function (oldFrag, newFrag) {\n if (oldFrag.relurl) {\n // Do not compare CC if the old fragment has no url. This is a level.fragmentHint used by LL-HLS parts.\n // It maybe be off by 1 if it was created before any parts or discontinuity tags were appended to the end\n // of the playlist.\n ccOffset = oldFrag.cc - newFrag.cc;\n }\n if (isFiniteNumber(oldFrag.startPTS) && isFiniteNumber(oldFrag.endPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.startDTS = oldFrag.startDTS;\n newFrag.maxStartPTS = oldFrag.maxStartPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.endDTS = oldFrag.endDTS;\n newFrag.minEndPTS = oldFrag.minEndPTS;\n newFrag.duration = oldFrag.endPTS - oldFrag.startPTS;\n if (newFrag.duration) {\n PTSFrag = newFrag;\n }\n\n // PTS is known when any segment has startPTS and endPTS\n newDetails.PTSKnown = newDetails.alignedSliding = true;\n }\n newFrag.elementaryStreams = oldFrag.elementaryStreams;\n newFrag.loader = oldFrag.loader;\n newFrag.stats = oldFrag.stats;\n newFrag.urlId = oldFrag.urlId;\n if (oldFrag.initSegment) {\n newFrag.initSegment = oldFrag.initSegment;\n currentInitSegment = oldFrag.initSegment;\n }\n });\n if (currentInitSegment) {\n var fragmentsToCheck = newDetails.fragmentHint ? newDetails.fragments.concat(newDetails.fragmentHint) : newDetails.fragments;\n fragmentsToCheck.forEach(function (frag) {\n var _currentInitSegment;\n if (!frag.initSegment || frag.initSegment.relurl === ((_currentInitSegment = currentInitSegment) == null ? void 0 : _currentInitSegment.relurl)) {\n frag.initSegment = currentInitSegment;\n }\n });\n }\n if (newDetails.skippedSegments) {\n newDetails.deltaUpdateFailed = newDetails.fragments.some(function (frag) {\n return !frag;\n });\n if (newDetails.deltaUpdateFailed) {\n logger.warn('[level-helper] Previous playlist missing segments skipped in delta playlist');\n for (var _i = newDetails.skippedSegments; _i--;) {\n newDetails.fragments.shift();\n }\n newDetails.startSN = newDetails.fragments[0].sn;\n newDetails.startCC = newDetails.fragments[0].cc;\n } else if (newDetails.canSkipDateRanges) {\n newDetails.dateRanges = mergeDateRanges(oldDetails.dateRanges, newDetails.dateRanges, newDetails.recentlyRemovedDateranges);\n }\n }\n var newFragments = newDetails.fragments;\n if (ccOffset) {\n logger.warn('discontinuity sliding from playlist, take drift into account');\n for (var _i2 = 0; _i2 < newFragments.length; _i2++) {\n newFragments[_i2].cc += ccOffset;\n }\n }\n if (newDetails.skippedSegments) {\n newDetails.startCC = newDetails.fragments[0].cc;\n }\n\n // Merge parts\n mapPartIntersection(oldDetails.partList, newDetails.partList, function (oldPart, newPart) {\n newPart.elementaryStreams = oldPart.elementaryStreams;\n newPart.stats = oldPart.stats;\n });\n\n // if at least one fragment contains PTS info, recompute PTS information for all fragments\n if (PTSFrag) {\n updateFragPTSDTS(newDetails, PTSFrag, PTSFrag.startPTS, PTSFrag.endPTS, PTSFrag.startDTS, PTSFrag.endDTS);\n } else {\n // ensure that delta is within oldFragments range\n // also adjust sliding in case delta is 0 (we could have old=[50-60] and new=old=[50-61])\n // in that case we also need to adjust start offset of all fragments\n adjustSliding(oldDetails, newDetails);\n }\n if (newFragments.length) {\n newDetails.totalduration = newDetails.edge - newFragments[0].start;\n }\n newDetails.driftStartTime = oldDetails.driftStartTime;\n newDetails.driftStart = oldDetails.driftStart;\n var advancedDateTime = newDetails.advancedDateTime;\n if (newDetails.advanced && advancedDateTime) {\n var edge = newDetails.edge;\n if (!newDetails.driftStart) {\n newDetails.driftStartTime = advancedDateTime;\n newDetails.driftStart = edge;\n }\n newDetails.driftEndTime = advancedDateTime;\n newDetails.driftEnd = edge;\n } else {\n newDetails.driftEndTime = oldDetails.driftEndTime;\n newDetails.driftEnd = oldDetails.driftEnd;\n newDetails.advancedDateTime = oldDetails.advancedDateTime;\n }\n }\n function mergeDateRanges(oldDateRanges, deltaDateRanges, recentlyRemovedDateranges) {\n var dateRanges = _extends({}, oldDateRanges);\n if (recentlyRemovedDateranges) {\n recentlyRemovedDateranges.forEach(function (id) {\n delete dateRanges[id];\n });\n }\n Object.keys(deltaDateRanges).forEach(function (id) {\n var dateRange = new DateRange(deltaDateRanges[id].attr, dateRanges[id]);\n if (dateRange.isValid) {\n dateRanges[id] = dateRange;\n } else {\n logger.warn(\"Ignoring invalid Playlist Delta Update DATERANGE tag: \\\"\" + JSON.stringify(deltaDateRanges[id].attr) + \"\\\"\");\n }\n });\n return dateRanges;\n }\n function mapPartIntersection(oldParts, newParts, intersectionFn) {\n if (oldParts && newParts) {\n var delta = 0;\n for (var i = 0, len = oldParts.length; i <= len; i++) {\n var _oldPart = oldParts[i];\n var _newPart = newParts[i + delta];\n if (_oldPart && _newPart && _oldPart.index === _newPart.index && _oldPart.fragment.sn === _newPart.fragment.sn) {\n intersectionFn(_oldPart, _newPart);\n } else {\n delta--;\n }\n }\n }\n }\n function mapFragmentIntersection(oldDetails, newDetails, intersectionFn) {\n var skippedSegments = newDetails.skippedSegments;\n var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN;\n var end = (oldDetails.fragmentHint ? 1 : 0) + (skippedSegments ? newDetails.endSN : Math.min(oldDetails.endSN, newDetails.endSN)) - newDetails.startSN;\n var delta = newDetails.startSN - oldDetails.startSN;\n var newFrags = newDetails.fragmentHint ? newDetails.fragments.concat(newDetails.fragmentHint) : newDetails.fragments;\n var oldFrags = oldDetails.fragmentHint ? oldDetails.fragments.concat(oldDetails.fragmentHint) : oldDetails.fragments;\n for (var i = start; i <= end; i++) {\n var _oldFrag = oldFrags[delta + i];\n var _newFrag = newFrags[i];\n if (skippedSegments && !_newFrag && i < skippedSegments) {\n // Fill in skipped segments in delta playlist\n _newFrag = newDetails.fragments[i] = _oldFrag;\n }\n if (_oldFrag && _newFrag) {\n intersectionFn(_oldFrag, _newFrag);\n }\n }\n }\n function adjustSliding(oldDetails, newDetails) {\n var delta = newDetails.startSN + newDetails.skippedSegments - oldDetails.startSN;\n var oldFragments = oldDetails.fragments;\n if (delta < 0 || delta >= oldFragments.length) {\n return;\n }\n addSliding(newDetails, oldFragments[delta].start);\n }\n function addSliding(details, start) {\n if (start) {\n var fragments = details.fragments;\n for (var i = details.skippedSegments; i < fragments.length; i++) {\n fragments[i].start += start;\n }\n if (details.fragmentHint) {\n details.fragmentHint.start += start;\n }\n }\n }\n function computeReloadInterval(newDetails, distanceToLiveEdgeMs) {\n if (distanceToLiveEdgeMs === void 0) {\n distanceToLiveEdgeMs = Infinity;\n }\n var reloadInterval = 1000 * newDetails.targetduration;\n if (newDetails.updated) {\n // Use last segment duration when shorter than target duration and near live edge\n var fragments = newDetails.fragments;\n var liveEdgeMaxTargetDurations = 4;\n if (fragments.length && reloadInterval * liveEdgeMaxTargetDurations > distanceToLiveEdgeMs) {\n var lastSegmentDuration = fragments[fragments.length - 1].duration * 1000;\n if (lastSegmentDuration < reloadInterval) {\n reloadInterval = lastSegmentDuration;\n }\n }\n } else {\n // estimate = 'miss half average';\n // follow HLS Spec, If the client reloads a Playlist file and finds that it has not\n // changed then it MUST wait for a period of one-half the target\n // duration before retrying.\n reloadInterval /= 2;\n }\n return Math.round(reloadInterval);\n }\n function getFragmentWithSN(level, sn, fragCurrent) {\n if (!(level != null && level.details)) {\n return null;\n }\n var levelDetails = level.details;\n var fragment = levelDetails.fragments[sn - levelDetails.startSN];\n if (fragment) {\n return fragment;\n }\n fragment = levelDetails.fragmentHint;\n if (fragment && fragment.sn === sn) {\n return fragment;\n }\n if (sn < levelDetails.startSN && fragCurrent && fragCurrent.sn === sn) {\n return fragCurrent;\n }\n return null;\n }\n function getPartWith(level, sn, partIndex) {\n var _level$details;\n if (!(level != null && level.details)) {\n return null;\n }\n return findPart((_level$details = level.details) == null ? void 0 : _level$details.partList, sn, partIndex);\n }\n function findPart(partList, sn, partIndex) {\n if (partList) {\n for (var i = partList.length; i--;) {\n var part = partList[i];\n if (part.index === partIndex && part.fragment.sn === sn) {\n return part;\n }\n }\n }\n return null;\n }\n\n function isTimeoutError(error) {\n switch (error.details) {\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n case ErrorDetails.MANIFEST_LOAD_TIMEOUT:\n return true;\n }\n return false;\n }\n function getRetryConfig(loadPolicy, error) {\n var isTimeout = isTimeoutError(error);\n return loadPolicy.default[(isTimeout ? 'timeout' : 'error') + \"Retry\"];\n }\n function getRetryDelay(retryConfig, retryCount) {\n // exponential backoff capped to max retry delay\n var backoffFactor = retryConfig.backoff === 'linear' ? 1 : Math.pow(2, retryCount);\n return Math.min(backoffFactor * retryConfig.retryDelayMs, retryConfig.maxRetryDelayMs);\n }\n function getLoaderConfigWithoutReties(loderConfig) {\n return _objectSpread2(_objectSpread2({}, loderConfig), {\n errorRetry: null,\n timeoutRetry: null\n });\n }\n function shouldRetry(retryConfig, retryCount, isTimeout, httpStatus) {\n return !!retryConfig && retryCount < retryConfig.maxNumRetry && (retryForHttpStatus(httpStatus) || !!isTimeout);\n }\n function retryForHttpStatus(httpStatus) {\n // Do not retry on status 4xx, status 0 (CORS error), or undefined (decrypt/gap/parse error)\n return httpStatus === 0 && navigator.onLine === false || !!httpStatus && (httpStatus < 400 || httpStatus > 499);\n }\n\n var BinarySearch = {\n /**\n * Searches for an item in an array which matches a certain condition.\n * This requires the condition to only match one item in the array,\n * and for the array to be ordered.\n *\n * @param list The array to search.\n * @param comparisonFn\n * Called and provided a candidate item as the first argument.\n * Should return:\n * > -1 if the item should be located at a lower index than the provided item.\n * > 1 if the item should be located at a higher index than the provided item.\n * > 0 if the item is the item you're looking for.\n *\n * @returns the object if found, otherwise returns null\n */\n search: function search(list, comparisonFn) {\n var minIndex = 0;\n var maxIndex = list.length - 1;\n var currentIndex = null;\n var currentElement = null;\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n var comparisonResult = comparisonFn(currentElement);\n if (comparisonResult > 0) {\n minIndex = currentIndex + 1;\n } else if (comparisonResult < 0) {\n maxIndex = currentIndex - 1;\n } else {\n return currentElement;\n }\n }\n return null;\n }\n };\n\n /**\n * Returns first fragment whose endPdt value exceeds the given PDT, or null.\n * @param fragments - The array of candidate fragments\n * @param PDTValue - The PDT value which must be exceeded\n * @param maxFragLookUpTolerance - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n */\n function findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {\n if (PDTValue === null || !Array.isArray(fragments) || !fragments.length || !isFiniteNumber(PDTValue)) {\n return null;\n }\n\n // if less than start\n var startPDT = fragments[0].programDateTime;\n if (PDTValue < (startPDT || 0)) {\n return null;\n }\n var endPDT = fragments[fragments.length - 1].endProgramDateTime;\n if (PDTValue >= (endPDT || 0)) {\n return null;\n }\n maxFragLookUpTolerance = maxFragLookUpTolerance || 0;\n for (var seg = 0; seg < fragments.length; ++seg) {\n var frag = fragments[seg];\n if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {\n return frag;\n }\n }\n return null;\n }\n\n /**\n * Finds a fragment based on the SN of the previous fragment; or based on the needs of the current buffer.\n * This method compensates for small buffer gaps by applying a tolerance to the start of any candidate fragment, thus\n * breaking any traps which would cause the same fragment to be continuously selected within a small range.\n * @param fragPrevious - The last frag successfully appended\n * @param fragments - The array of candidate fragments\n * @param bufferEnd - The end of the contiguous buffered range the playhead is currently within\n * @param maxFragLookUpTolerance - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns a matching fragment or null\n */\n function findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\n var fragNext = null;\n if (fragPrevious) {\n fragNext = fragments[fragPrevious.sn - fragments[0].sn + 1] || null;\n } else if (bufferEnd === 0 && fragments[0].start === 0) {\n fragNext = fragments[0];\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext) === 0) {\n return fragNext;\n }\n // We might be seeking past the tolerance so find the best match\n var foundFragment = BinarySearch.search(fragments, fragmentWithinToleranceTest.bind(null, bufferEnd, maxFragLookUpTolerance));\n if (foundFragment && (foundFragment !== fragPrevious || !fragNext)) {\n return foundFragment;\n }\n // If no match was found return the next fragment after fragPrevious, or null\n return fragNext;\n }\n\n /**\n * The test function used by the findFragmentBySn's BinarySearch to look for the best match to the current buffer conditions.\n * @param candidate - The fragment to test\n * @param bufferEnd - The end of the current buffered range the playhead is currently within\n * @param maxFragLookUpTolerance - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns 0 if it matches, 1 if too low, -1 if too high\n */\n function fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, candidate) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\n // eagerly accept an accurate match (no tolerance)\n if (candidate.start <= bufferEnd && candidate.start + candidate.duration > bufferEnd) {\n return 0;\n }\n // offset should be within fragment boundary - config.maxFragLookUpTolerance\n // this is to cope with situations like\n // bufferEnd = 9.991\n // frag[Ø] : [0,10]\n // frag[1] : [10,20]\n // bufferEnd is within frag[0] range ... although what we are expecting is to return frag[1] here\n // frag start frag start+duration\n // |-----------------------------|\n // <---> <--->\n // ...--------><-----------------------------><---------....\n // previous frag matching fragment next frag\n // return -1 return 0 return 1\n // logger.log(`level/sn/start/end/bufEnd:${level}/${candidate.sn}/${candidate.start}/${(candidate.start+candidate.duration)}/${bufferEnd}`);\n // Set the lookup tolerance to be small enough to detect the current segment - ensures we don't skip over very small segments\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0));\n if (candidate.start + candidate.duration - candidateLookupTolerance <= bufferEnd) {\n return 1;\n } else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n return -1;\n }\n return 0;\n }\n\n /**\n * The test function used by the findFragmentByPdt's BinarySearch to look for the best match to the current buffer conditions.\n * This function tests the candidate's program date time values, as represented in Unix time\n * @param candidate - The fragment to test\n * @param pdtBufferEnd - The Unix time representing the end of the current buffered range\n * @param maxFragLookUpTolerance - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns true if contiguous, false otherwise\n */\n function pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate) {\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0)) * 1000;\n\n // endProgramDateTime can be null, default to zero\n var endProgramDateTime = candidate.endProgramDateTime || 0;\n return endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;\n }\n function findFragWithCC(fragments, cc) {\n return BinarySearch.search(fragments, function (candidate) {\n if (candidate.cc < cc) {\n return 1;\n } else if (candidate.cc > cc) {\n return -1;\n } else {\n return 0;\n }\n });\n }\n\n var RENDITION_PENALTY_DURATION_MS = 300000;\n var NetworkErrorAction = {\n DoNothing: 0,\n SendEndCallback: 1,\n SendAlternateToPenaltyBox: 2,\n RemoveAlternatePermanently: 3,\n InsertDiscontinuity: 4,\n RetryRequest: 5\n };\n var ErrorActionFlags = {\n None: 0,\n MoveAllAlternatesMatchingHost: 1,\n MoveAllAlternatesMatchingHDCP: 2,\n SwitchToSDR: 4\n }; // Reserved for future use\n var ErrorController = /*#__PURE__*/function () {\n function ErrorController(hls) {\n this.hls = void 0;\n this.playlistError = 0;\n this.penalizedRenditions = {};\n this.log = void 0;\n this.warn = void 0;\n this.error = void 0;\n this.hls = hls;\n this.log = logger.log.bind(logger, \"[info]:\");\n this.warn = logger.warn.bind(logger, \"[warning]:\");\n this.error = logger.error.bind(logger, \"[error]:\");\n this.registerListeners();\n }\n var _proto = ErrorController.prototype;\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.ERROR, this.onError, this);\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n if (!hls) {\n return;\n }\n hls.off(Events.ERROR, this.onError, this);\n hls.off(Events.ERROR, this.onErrorOut, this);\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n };\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n // @ts-ignore\n this.hls = null;\n this.penalizedRenditions = {};\n };\n _proto.startLoad = function startLoad(startPosition) {\n this.playlistError = 0;\n };\n _proto.stopLoad = function stopLoad() {};\n _proto.getVariantLevelIndex = function getVariantLevelIndex(frag) {\n return (frag == null ? void 0 : frag.type) === PlaylistLevelType.MAIN ? frag.level : this.hls.loadLevel;\n };\n _proto.onManifestLoading = function onManifestLoading() {\n this.playlistError = 0;\n this.penalizedRenditions = {};\n };\n _proto.onLevelUpdated = function onLevelUpdated() {\n this.playlistError = 0;\n };\n _proto.onError = function onError(event, data) {\n var _data$frag, _data$level;\n if (data.fatal) {\n return;\n }\n var hls = this.hls;\n var context = data.context;\n switch (data.details) {\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n data.errorAction = this.getFragRetryOrSwitchAction(data);\n return;\n case ErrorDetails.FRAG_PARSING_ERROR:\n // ignore empty segment errors marked as gap\n if ((_data$frag = data.frag) != null && _data$frag.gap) {\n data.errorAction = {\n action: NetworkErrorAction.DoNothing,\n flags: ErrorActionFlags.None\n };\n return;\n }\n // falls through\n case ErrorDetails.FRAG_GAP:\n case ErrorDetails.FRAG_DECRYPT_ERROR:\n {\n // Switch level if possible, otherwise allow retry count to reach max error retries\n data.errorAction = this.getFragRetryOrSwitchAction(data);\n data.errorAction.action = NetworkErrorAction.SendAlternateToPenaltyBox;\n return;\n }\n case ErrorDetails.LEVEL_EMPTY_ERROR:\n case ErrorDetails.LEVEL_PARSING_ERROR:\n {\n var _data$context, _data$context$levelDe;\n // Only retry when empty and live\n var levelIndex = data.parent === PlaylistLevelType.MAIN ? data.level : hls.loadLevel;\n if (data.details === ErrorDetails.LEVEL_EMPTY_ERROR && !!((_data$context = data.context) != null && (_data$context$levelDe = _data$context.levelDetails) != null && _data$context$levelDe.live)) {\n data.errorAction = this.getPlaylistRetryOrSwitchAction(data, levelIndex);\n } else {\n // Escalate to fatal if not retrying or switching\n data.levelRetry = false;\n data.errorAction = this.getLevelSwitchAction(data, levelIndex);\n }\n }\n return;\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n if (typeof (context == null ? void 0 : context.level) === 'number') {\n data.errorAction = this.getPlaylistRetryOrSwitchAction(data, context.level);\n }\n return;\n case ErrorDetails.AUDIO_TRACK_LOAD_ERROR:\n case ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:\n case ErrorDetails.SUBTITLE_LOAD_ERROR:\n case ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:\n if (context) {\n var level = hls.levels[hls.loadLevel];\n if (level && (context.type === PlaylistContextType.AUDIO_TRACK && context.groupId === level.audioGroupId || context.type === PlaylistContextType.SUBTITLE_TRACK && context.groupId === level.textGroupId)) {\n // Perform Pathway switch or Redundant failover if possible for fastest recovery\n // otherwise allow playlist retry count to reach max error retries\n data.errorAction = this.getPlaylistRetryOrSwitchAction(data, hls.loadLevel);\n data.errorAction.action = NetworkErrorAction.SendAlternateToPenaltyBox;\n data.errorAction.flags = ErrorActionFlags.MoveAllAlternatesMatchingHost;\n return;\n }\n }\n return;\n case ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:\n {\n var _level = hls.levels[hls.loadLevel];\n var restrictedHdcpLevel = _level == null ? void 0 : _level.attrs['HDCP-LEVEL'];\n if (restrictedHdcpLevel) {\n data.errorAction = {\n action: NetworkErrorAction.SendAlternateToPenaltyBox,\n flags: ErrorActionFlags.MoveAllAlternatesMatchingHDCP,\n hdcpLevel: restrictedHdcpLevel\n };\n }\n }\n return;\n case ErrorDetails.BUFFER_ADD_CODEC_ERROR:\n case ErrorDetails.REMUX_ALLOC_ERROR:\n data.errorAction = this.getLevelSwitchAction(data, (_data$level = data.level) != null ? _data$level : hls.loadLevel);\n return;\n case ErrorDetails.INTERNAL_EXCEPTION:\n case ErrorDetails.BUFFER_APPENDING_ERROR:\n case ErrorDetails.BUFFER_APPEND_ERROR:\n case ErrorDetails.BUFFER_FULL_ERROR:\n case ErrorDetails.LEVEL_SWITCH_ERROR:\n case ErrorDetails.BUFFER_STALLED_ERROR:\n case ErrorDetails.BUFFER_SEEK_OVER_HOLE:\n case ErrorDetails.BUFFER_NUDGE_ON_STALL:\n data.errorAction = {\n action: NetworkErrorAction.DoNothing,\n flags: ErrorActionFlags.None\n };\n return;\n }\n if (data.type === ErrorTypes.KEY_SYSTEM_ERROR) {\n var _levelIndex = this.getVariantLevelIndex(data.frag);\n // Do not retry level. Escalate to fatal if switching levels fails.\n data.levelRetry = false;\n data.errorAction = this.getLevelSwitchAction(data, _levelIndex);\n return;\n }\n };\n _proto.getPlaylistRetryOrSwitchAction = function getPlaylistRetryOrSwitchAction(data, levelIndex) {\n var _data$response;\n var hls = this.hls;\n var retryConfig = getRetryConfig(hls.config.playlistLoadPolicy, data);\n var retryCount = this.playlistError++;\n var httpStatus = (_data$response = data.response) == null ? void 0 : _data$response.code;\n var retry = shouldRetry(retryConfig, retryCount, isTimeoutError(data), httpStatus);\n if (retry) {\n return {\n action: NetworkErrorAction.RetryRequest,\n flags: ErrorActionFlags.None,\n retryConfig: retryConfig,\n retryCount: retryCount\n };\n }\n var errorAction = this.getLevelSwitchAction(data, levelIndex);\n if (retryConfig) {\n errorAction.retryConfig = retryConfig;\n errorAction.retryCount = retryCount;\n }\n return errorAction;\n };\n _proto.getFragRetryOrSwitchAction = function getFragRetryOrSwitchAction(data) {\n var hls = this.hls;\n // Share fragment error count accross media options (main, audio, subs)\n // This allows for level based rendition switching when media option assets fail\n var variantLevelIndex = this.getVariantLevelIndex(data.frag);\n var level = hls.levels[variantLevelIndex];\n var _hls$config = hls.config,\n fragLoadPolicy = _hls$config.fragLoadPolicy,\n keyLoadPolicy = _hls$config.keyLoadPolicy;\n var retryConfig = getRetryConfig(data.details.startsWith('key') ? keyLoadPolicy : fragLoadPolicy, data);\n var fragmentErrors = hls.levels.reduce(function (acc, level) {\n return acc + level.fragmentError;\n }, 0);\n // Switch levels when out of retried or level index out of bounds\n if (level) {\n var _data$response2;\n if (data.details !== ErrorDetails.FRAG_GAP) {\n level.fragmentError++;\n }\n var httpStatus = (_data$response2 = data.response) == null ? void 0 : _data$response2.code;\n var retry = shouldRetry(retryConfig, fragmentErrors, isTimeoutError(data), httpStatus);\n if (retry) {\n return {\n action: NetworkErrorAction.RetryRequest,\n flags: ErrorActionFlags.None,\n retryConfig: retryConfig,\n retryCount: fragmentErrors\n };\n }\n }\n // Reach max retry count, or Missing level reference\n // Switch to valid index\n var errorAction = this.getLevelSwitchAction(data, variantLevelIndex);\n // Add retry details to allow skipping of FRAG_PARSING_ERROR\n if (retryConfig) {\n errorAction.retryConfig = retryConfig;\n errorAction.retryCount = fragmentErrors;\n }\n return errorAction;\n };\n _proto.getLevelSwitchAction = function getLevelSwitchAction(data, levelIndex) {\n var hls = this.hls;\n if (levelIndex === null || levelIndex === undefined) {\n levelIndex = hls.loadLevel;\n }\n var level = this.hls.levels[levelIndex];\n if (level) {\n level.loadError++;\n if (hls.autoLevelEnabled) {\n var _data$frag2, _data$context2;\n // Search for next level to retry\n var nextLevel = -1;\n var levels = hls.levels,\n loadLevel = hls.loadLevel,\n minAutoLevel = hls.minAutoLevel,\n maxAutoLevel = hls.maxAutoLevel;\n var fragErrorType = (_data$frag2 = data.frag) == null ? void 0 : _data$frag2.type;\n var _ref = (_data$context2 = data.context) != null ? _data$context2 : {},\n playlistErrorType = _ref.type,\n playlistErrorGroupId = _ref.groupId;\n for (var i = levels.length; i--;) {\n var candidate = (i + loadLevel) % levels.length;\n if (candidate !== loadLevel && candidate >= minAutoLevel && candidate <= maxAutoLevel && levels[candidate].loadError === 0) {\n var levelCandidate = levels[candidate];\n // Skip level switch if GAP tag is found in next level at same position\n if (data.details === ErrorDetails.FRAG_GAP && data.frag) {\n var levelDetails = levels[candidate].details;\n if (levelDetails) {\n var fragCandidate = findFragmentByPTS(data.frag, levelDetails.fragments, data.frag.start);\n if (fragCandidate != null && fragCandidate.gap) {\n continue;\n }\n }\n } else if (playlistErrorType === PlaylistContextType.AUDIO_TRACK && playlistErrorGroupId === levelCandidate.audioGroupId || playlistErrorType === PlaylistContextType.SUBTITLE_TRACK && playlistErrorGroupId === levelCandidate.textGroupId) {\n // For audio/subs playlist errors find another group ID or fallthrough to redundant fail-over\n continue;\n } else if (fragErrorType === PlaylistLevelType.AUDIO && level.audioGroupId === levelCandidate.audioGroupId || fragErrorType === PlaylistLevelType.SUBTITLE && level.textGroupId === levelCandidate.textGroupId) {\n // For audio/subs frag errors find another group ID or fallthrough to redundant fail-over\n continue;\n }\n nextLevel = candidate;\n break;\n }\n }\n if (nextLevel > -1 && hls.loadLevel !== nextLevel) {\n data.levelRetry = true;\n this.playlistError = 0;\n return {\n action: NetworkErrorAction.SendAlternateToPenaltyBox,\n flags: ErrorActionFlags.None,\n nextAutoLevel: nextLevel\n };\n }\n }\n }\n // No levels to switch / Manual level selection / Level not found\n // Resolve with Pathway switch, Redundant fail-over, or stay on lowest Level\n return {\n action: NetworkErrorAction.SendAlternateToPenaltyBox,\n flags: ErrorActionFlags.MoveAllAlternatesMatchingHost\n };\n };\n _proto.onErrorOut = function onErrorOut(event, data) {\n var _data$errorAction;\n switch ((_data$errorAction = data.errorAction) == null ? void 0 : _data$errorAction.action) {\n case NetworkErrorAction.DoNothing:\n break;\n case NetworkErrorAction.SendAlternateToPenaltyBox:\n this.sendAlternateToPenaltyBox(data);\n if (!data.errorAction.resolved && data.details !== ErrorDetails.FRAG_GAP) {\n data.fatal = true;\n }\n break;\n }\n if (data.fatal) {\n this.hls.stopLoad();\n return;\n }\n };\n _proto.sendAlternateToPenaltyBox = function sendAlternateToPenaltyBox(data) {\n var hls = this.hls;\n var errorAction = data.errorAction;\n if (!errorAction) {\n return;\n }\n var flags = errorAction.flags,\n hdcpLevel = errorAction.hdcpLevel,\n nextAutoLevel = errorAction.nextAutoLevel;\n switch (flags) {\n case ErrorActionFlags.None:\n this.switchLevel(data, nextAutoLevel);\n break;\n case ErrorActionFlags.MoveAllAlternatesMatchingHost:\n {\n // Handle Redundant Levels here. Pathway switching is handled by content-steering-controller\n if (!errorAction.resolved) {\n errorAction.resolved = this.redundantFailover(data);\n }\n }\n break;\n case ErrorActionFlags.MoveAllAlternatesMatchingHDCP:\n if (hdcpLevel) {\n hls.maxHdcpLevel = HdcpLevels[HdcpLevels.indexOf(hdcpLevel) - 1];\n errorAction.resolved = true;\n }\n this.warn(\"Restricting playback to HDCP-LEVEL of \\\"\" + hls.maxHdcpLevel + \"\\\" or lower\");\n break;\n }\n // If not resolved by previous actions try to switch to next level\n if (!errorAction.resolved) {\n this.switchLevel(data, nextAutoLevel);\n }\n };\n _proto.switchLevel = function switchLevel(data, levelIndex) {\n if (levelIndex !== undefined && data.errorAction) {\n this.warn(\"switching to level \" + levelIndex + \" after \" + data.details);\n this.hls.nextAutoLevel = levelIndex;\n data.errorAction.resolved = true;\n // Stream controller is responsible for this but won't switch on false start\n this.hls.nextLoadLevel = this.hls.nextAutoLevel;\n }\n };\n _proto.redundantFailover = function redundantFailover(data) {\n var _this = this;\n var hls = this.hls,\n penalizedRenditions = this.penalizedRenditions;\n var levelIndex = data.parent === PlaylistLevelType.MAIN ? data.level : hls.loadLevel;\n var level = hls.levels[levelIndex];\n var redundantLevels = level.url.length;\n var errorUrlId = data.frag ? data.frag.urlId : level.urlId;\n if (level.urlId === errorUrlId && (!data.frag || level.details)) {\n this.penalizeRendition(level, data);\n }\n var _loop = function _loop() {\n var newUrlId = (errorUrlId + i) % redundantLevels;\n var penalizedRendition = penalizedRenditions[newUrlId];\n // Check if rendition is penalized and skip if it is a bad fit for failover\n if (!penalizedRendition || checkExpired(penalizedRendition, data, penalizedRenditions[errorUrlId])) {\n // delete penalizedRenditions[newUrlId];\n // Update the url id of all levels so that we stay on the same set of variants when level switching\n _this.warn(\"Switching to Redundant Stream \" + (newUrlId + 1) + \"/\" + redundantLevels + \": \\\"\" + level.url[newUrlId] + \"\\\" after \" + data.details);\n _this.playlistError = 0;\n hls.levels.forEach(function (lv) {\n lv.urlId = newUrlId;\n });\n hls.nextLoadLevel = levelIndex;\n return {\n v: true\n };\n }\n };\n for (var i = 1; i < redundantLevels; i++) {\n var _ret = _loop();\n if (typeof _ret === \"object\") return _ret.v;\n }\n return false;\n };\n _proto.penalizeRendition = function penalizeRendition(level, data) {\n var penalizedRenditions = this.penalizedRenditions;\n var penalizedRendition = penalizedRenditions[level.urlId] || {\n lastErrorPerfMs: 0,\n errors: [],\n details: undefined\n };\n penalizedRendition.lastErrorPerfMs = performance.now();\n penalizedRendition.errors.push(data);\n penalizedRendition.details = level.details;\n penalizedRenditions[level.urlId] = penalizedRendition;\n };\n return ErrorController;\n }();\n function checkExpired(penalizedRendition, data, currentPenaltyState) {\n // Expire penalty for switching back to rendition after RENDITION_PENALTY_DURATION_MS\n if (performance.now() - penalizedRendition.lastErrorPerfMs > RENDITION_PENALTY_DURATION_MS) {\n return true;\n }\n // Expire penalty on GAP tag error if rendition has no GAP at position (does not cover media tracks)\n var lastErrorDetails = penalizedRendition.details;\n if (data.details === ErrorDetails.FRAG_GAP && lastErrorDetails && data.frag) {\n var position = data.frag.start;\n var candidateFrag = findFragmentByPTS(null, lastErrorDetails.fragments, position);\n if (candidateFrag && !candidateFrag.gap) {\n return true;\n }\n }\n // Expire penalty if there are more errors in currentLevel than in penalizedRendition\n if (currentPenaltyState && penalizedRendition.errors.length < currentPenaltyState.errors.length) {\n var lastCandidateError = penalizedRendition.errors[penalizedRendition.errors.length - 1];\n if (lastErrorDetails && lastCandidateError.frag && data.frag && Math.abs(lastCandidateError.frag.start - data.frag.start) > lastErrorDetails.targetduration * 3) {\n return true;\n }\n }\n return false;\n }\n\n var BasePlaylistController = /*#__PURE__*/function () {\n function BasePlaylistController(hls, logPrefix) {\n this.hls = void 0;\n this.timer = -1;\n this.requestScheduled = -1;\n this.canLoad = false;\n this.log = void 0;\n this.warn = void 0;\n this.log = logger.log.bind(logger, logPrefix + \":\");\n this.warn = logger.warn.bind(logger, logPrefix + \":\");\n this.hls = hls;\n }\n var _proto = BasePlaylistController.prototype;\n _proto.destroy = function destroy() {\n this.clearTimer();\n // @ts-ignore\n this.hls = this.log = this.warn = null;\n };\n _proto.clearTimer = function clearTimer() {\n clearTimeout(this.timer);\n this.timer = -1;\n };\n _proto.startLoad = function startLoad() {\n this.canLoad = true;\n this.requestScheduled = -1;\n this.loadPlaylist();\n };\n _proto.stopLoad = function stopLoad() {\n this.canLoad = false;\n this.clearTimer();\n };\n _proto.switchParams = function switchParams(playlistUri, previous) {\n var renditionReports = previous == null ? void 0 : previous.renditionReports;\n if (renditionReports) {\n var foundIndex = -1;\n for (var i = 0; i < renditionReports.length; i++) {\n var attr = renditionReports[i];\n var uri = void 0;\n try {\n uri = new self.URL(attr.URI, previous.url).href;\n } catch (error) {\n logger.warn(\"Could not construct new URL for Rendition Report: \" + error);\n uri = attr.URI || '';\n }\n // Use exact match. Otherwise, the last partial match, if any, will be used\n // (Playlist URI includes a query string that the Rendition Report does not)\n if (uri === playlistUri) {\n foundIndex = i;\n break;\n } else if (uri === playlistUri.substring(0, uri.length)) {\n foundIndex = i;\n }\n }\n if (foundIndex !== -1) {\n var _attr = renditionReports[foundIndex];\n var msn = parseInt(_attr['LAST-MSN']) || (previous == null ? void 0 : previous.lastPartSn);\n var part = parseInt(_attr['LAST-PART']) || (previous == null ? void 0 : previous.lastPartIndex);\n if (this.hls.config.lowLatencyMode) {\n var currentGoal = Math.min(previous.age - previous.partTarget, previous.targetduration);\n if (part >= 0 && currentGoal > previous.partTarget) {\n part += 1;\n }\n }\n return new HlsUrlParameters(msn, part >= 0 ? part : undefined, HlsSkip.No);\n }\n }\n };\n _proto.loadPlaylist = function loadPlaylist(hlsUrlParameters) {\n if (this.requestScheduled === -1) {\n this.requestScheduled = self.performance.now();\n }\n // Loading is handled by the subclasses\n };\n _proto.shouldLoadPlaylist = function shouldLoadPlaylist(playlist) {\n return this.canLoad && !!playlist && !!playlist.url && (!playlist.details || playlist.details.live);\n };\n _proto.shouldReloadPlaylist = function shouldReloadPlaylist(playlist) {\n return this.timer === -1 && this.requestScheduled === -1 && this.shouldLoadPlaylist(playlist);\n };\n _proto.playlistLoaded = function playlistLoaded(index, data, previousDetails) {\n var _this = this;\n var details = data.details,\n stats = data.stats;\n\n // Set last updated date-time\n var now = self.performance.now();\n var elapsed = stats.loading.first ? Math.max(0, now - stats.loading.first) : 0;\n details.advancedDateTime = Date.now() - elapsed;\n\n // if current playlist is a live playlist, arm a timer to reload it\n if (details.live || previousDetails != null && previousDetails.live) {\n details.reloaded(previousDetails);\n if (previousDetails) {\n this.log(\"live playlist \" + index + \" \" + (details.advanced ? 'REFRESHED ' + details.lastPartSn + '-' + details.lastPartIndex : details.updated ? 'UPDATED' : 'MISSED'));\n }\n // Merge live playlists to adjust fragment starts and fill in delta playlist skipped segments\n if (previousDetails && details.fragments.length > 0) {\n mergeDetails(previousDetails, details);\n }\n if (!this.canLoad || !details.live) {\n return;\n }\n var deliveryDirectives;\n var msn = undefined;\n var part = undefined;\n if (details.canBlockReload && details.endSN && details.advanced) {\n // Load level with LL-HLS delivery directives\n var lowLatencyMode = this.hls.config.lowLatencyMode;\n var lastPartSn = details.lastPartSn;\n var endSn = details.endSN;\n var lastPartIndex = details.lastPartIndex;\n var hasParts = lastPartIndex !== -1;\n var lastPart = lastPartSn === endSn;\n // When low latency mode is disabled, we'll skip part requests once the last part index is found\n var nextSnStartIndex = lowLatencyMode ? 0 : lastPartIndex;\n if (hasParts) {\n msn = lastPart ? endSn + 1 : lastPartSn;\n part = lastPart ? nextSnStartIndex : lastPartIndex + 1;\n } else {\n msn = endSn + 1;\n }\n // Low-Latency CDN Tune-in: \"age\" header and time since load indicates we're behind by more than one part\n // Update directives to obtain the Playlist that has the estimated additional duration of media\n var lastAdvanced = details.age;\n var cdnAge = lastAdvanced + details.ageHeader;\n var currentGoal = Math.min(cdnAge - details.partTarget, details.targetduration * 1.5);\n if (currentGoal > 0) {\n if (previousDetails && currentGoal > previousDetails.tuneInGoal) {\n // If we attempted to get the next or latest playlist update, but currentGoal increased,\n // then we either can't catchup, or the \"age\" header cannot be trusted.\n this.warn(\"CDN Tune-in goal increased from: \" + previousDetails.tuneInGoal + \" to: \" + currentGoal + \" with playlist age: \" + details.age);\n currentGoal = 0;\n } else {\n var segments = Math.floor(currentGoal / details.targetduration);\n msn += segments;\n if (part !== undefined) {\n var parts = Math.round(currentGoal % details.targetduration / details.partTarget);\n part += parts;\n }\n this.log(\"CDN Tune-in age: \" + details.ageHeader + \"s last advanced \" + lastAdvanced.toFixed(2) + \"s goal: \" + currentGoal + \" skip sn \" + segments + \" to part \" + part);\n }\n details.tuneInGoal = currentGoal;\n }\n deliveryDirectives = this.getDeliveryDirectives(details, data.deliveryDirectives, msn, part);\n if (lowLatencyMode || !lastPart) {\n this.loadPlaylist(deliveryDirectives);\n return;\n }\n } else if (details.canBlockReload || details.canSkipUntil) {\n deliveryDirectives = this.getDeliveryDirectives(details, data.deliveryDirectives, msn, part);\n }\n var bufferInfo = this.hls.mainForwardBufferInfo;\n var position = bufferInfo ? bufferInfo.end - bufferInfo.len : 0;\n var distanceToLiveEdgeMs = (details.edge - position) * 1000;\n var reloadInterval = computeReloadInterval(details, distanceToLiveEdgeMs);\n if (details.updated && now > this.requestScheduled + reloadInterval) {\n this.requestScheduled = stats.loading.start;\n }\n if (msn !== undefined && details.canBlockReload) {\n this.requestScheduled = stats.loading.first + reloadInterval - (details.partTarget * 1000 || 1000);\n } else if (this.requestScheduled === -1 || this.requestScheduled + reloadInterval < now) {\n this.requestScheduled = now;\n } else if (this.requestScheduled - now <= 0) {\n this.requestScheduled += reloadInterval;\n }\n var estimatedTimeUntilUpdate = this.requestScheduled - now;\n estimatedTimeUntilUpdate = Math.max(0, estimatedTimeUntilUpdate);\n this.log(\"reload live playlist \" + index + \" in \" + Math.round(estimatedTimeUntilUpdate) + \" ms\");\n // this.log(\n // `live reload ${details.updated ? 'REFRESHED' : 'MISSED'}\n // reload in ${estimatedTimeUntilUpdate / 1000}\n // round trip ${(stats.loading.end - stats.loading.start) / 1000}\n // diff ${\n // (reloadInterval -\n // (estimatedTimeUntilUpdate +\n // stats.loading.end -\n // stats.loading.start)) /\n // 1000\n // }\n // reload interval ${reloadInterval / 1000}\n // target duration ${details.targetduration}\n // distance to edge ${distanceToLiveEdgeMs / 1000}`\n // );\n\n this.timer = self.setTimeout(function () {\n return _this.loadPlaylist(deliveryDirectives);\n }, estimatedTimeUntilUpdate);\n } else {\n this.clearTimer();\n }\n };\n _proto.getDeliveryDirectives = function getDeliveryDirectives(details, previousDeliveryDirectives, msn, part) {\n var skip = getSkipValue(details, msn);\n if (previousDeliveryDirectives != null && previousDeliveryDirectives.skip && details.deltaUpdateFailed) {\n msn = previousDeliveryDirectives.msn;\n part = previousDeliveryDirectives.part;\n skip = HlsSkip.No;\n }\n return new HlsUrlParameters(msn, part, skip);\n };\n _proto.checkRetry = function checkRetry(errorEvent) {\n var _this2 = this;\n var errorDetails = errorEvent.details;\n var isTimeout = isTimeoutError(errorEvent);\n var errorAction = errorEvent.errorAction;\n var _ref = errorAction || {},\n action = _ref.action,\n _ref$retryCount = _ref.retryCount,\n retryCount = _ref$retryCount === void 0 ? 0 : _ref$retryCount,\n retryConfig = _ref.retryConfig;\n var retry = !!errorAction && !!retryConfig && (action === NetworkErrorAction.RetryRequest || !errorAction.resolved && action === NetworkErrorAction.SendAlternateToPenaltyBox);\n if (retry) {\n var _errorEvent$context;\n this.requestScheduled = -1;\n if (retryCount >= retryConfig.maxNumRetry) {\n return false;\n }\n if (isTimeout && (_errorEvent$context = errorEvent.context) != null && _errorEvent$context.deliveryDirectives) {\n // The LL-HLS request already timed out so retry immediately\n this.warn(\"Retrying playlist loading \" + (retryCount + 1) + \"/\" + retryConfig.maxNumRetry + \" after \\\"\" + errorDetails + \"\\\" without delivery-directives\");\n this.loadPlaylist();\n } else {\n var delay = getRetryDelay(retryConfig, retryCount);\n // Schedule level/track reload\n this.timer = self.setTimeout(function () {\n return _this2.loadPlaylist();\n }, delay);\n this.warn(\"Retrying playlist loading \" + (retryCount + 1) + \"/\" + retryConfig.maxNumRetry + \" after \\\"\" + errorDetails + \"\\\" in \" + delay + \"ms\");\n }\n // `levelRetry = true` used to inform other controllers that a retry is happening\n errorEvent.levelRetry = true;\n errorAction.resolved = true;\n }\n return retry;\n };\n return BasePlaylistController;\n }();\n\n var chromeOrFirefox;\n var LevelController = /*#__PURE__*/function (_BasePlaylistControll) {\n _inheritsLoose(LevelController, _BasePlaylistControll);\n function LevelController(hls, contentSteeringController) {\n var _this;\n _this = _BasePlaylistControll.call(this, hls, '[level-controller]') || this;\n _this._levels = [];\n _this._firstLevel = -1;\n _this._startLevel = void 0;\n _this.currentLevel = null;\n _this.currentLevelIndex = -1;\n _this.manualLevelIndex = -1;\n _this.steering = void 0;\n _this.onParsedComplete = void 0;\n _this.steering = contentSteeringController;\n _this._registerListeners();\n return _this;\n }\n var _proto = LevelController.prototype;\n _proto._registerListeners = function _registerListeners() {\n var hls = this.hls;\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.MANIFEST_LOADED, this.onManifestLoaded, this);\n hls.on(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.on(Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this);\n hls.on(Events.FRAG_LOADED, this.onFragLoaded, this);\n hls.on(Events.ERROR, this.onError, this);\n };\n _proto._unregisterListeners = function _unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.MANIFEST_LOADED, this.onManifestLoaded, this);\n hls.off(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.off(Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this);\n hls.off(Events.FRAG_LOADED, this.onFragLoaded, this);\n hls.off(Events.ERROR, this.onError, this);\n };\n _proto.destroy = function destroy() {\n this._unregisterListeners();\n this.steering = null;\n this.resetLevels();\n _BasePlaylistControll.prototype.destroy.call(this);\n };\n _proto.startLoad = function startLoad() {\n var levels = this._levels;\n\n // clean up live level details to force reload them, and reset load errors\n levels.forEach(function (level) {\n level.loadError = 0;\n level.fragmentError = 0;\n });\n _BasePlaylistControll.prototype.startLoad.call(this);\n };\n _proto.resetLevels = function resetLevels() {\n this._startLevel = undefined;\n this.manualLevelIndex = -1;\n this.currentLevelIndex = -1;\n this.currentLevel = null;\n this._levels = [];\n };\n _proto.onManifestLoading = function onManifestLoading(event, data) {\n this.resetLevels();\n };\n _proto.onManifestLoaded = function onManifestLoaded(event, data) {\n var levels = [];\n var levelSet = {};\n var levelFromSet;\n\n // regroup redundant levels together\n data.levels.forEach(function (levelParsed) {\n var _levelParsed$audioCod;\n var attributes = levelParsed.attrs;\n\n // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n if (((_levelParsed$audioCod = levelParsed.audioCodec) == null ? void 0 : _levelParsed$audioCod.indexOf('mp4a.40.34')) !== -1) {\n chromeOrFirefox || (chromeOrFirefox = /chrome|firefox/i.test(navigator.userAgent));\n if (chromeOrFirefox) {\n levelParsed.audioCodec = undefined;\n }\n }\n var AUDIO = attributes.AUDIO,\n CODECS = attributes.CODECS,\n FRAMERATE = attributes['FRAME-RATE'];\n attributes['PATHWAY-ID'];\n var RESOLUTION = attributes.RESOLUTION,\n SUBTITLES = attributes.SUBTITLES;\n var contentSteeringPrefix = '';\n var levelKey = \"\" + contentSteeringPrefix + levelParsed.bitrate + \"-\" + RESOLUTION + \"-\" + FRAMERATE + \"-\" + CODECS;\n levelFromSet = levelSet[levelKey];\n if (!levelFromSet) {\n levelFromSet = new Level(levelParsed);\n levelSet[levelKey] = levelFromSet;\n levels.push(levelFromSet);\n } else {\n levelFromSet.addFallback(levelParsed);\n }\n addGroupId(levelFromSet, 'audio', AUDIO);\n addGroupId(levelFromSet, 'text', SUBTITLES);\n });\n this.filterAndSortMediaOptions(levels, data);\n };\n _proto.filterAndSortMediaOptions = function filterAndSortMediaOptions(unfilteredLevels, data) {\n var _this2 = this;\n var audioTracks = [];\n var subtitleTracks = [];\n var resolutionFound = false;\n var videoCodecFound = false;\n var audioCodecFound = false;\n\n // only keep levels with supported audio/video codecs\n var levels = unfilteredLevels.filter(function (_ref) {\n var audioCodec = _ref.audioCodec,\n videoCodec = _ref.videoCodec,\n width = _ref.width,\n height = _ref.height,\n unknownCodecs = _ref.unknownCodecs;\n resolutionFound || (resolutionFound = !!(width && height));\n videoCodecFound || (videoCodecFound = !!videoCodec);\n audioCodecFound || (audioCodecFound = !!audioCodec);\n return !(unknownCodecs != null && unknownCodecs.length) && (!audioCodec || isCodecSupportedInMp4(audioCodec, 'audio')) && (!videoCodec || isCodecSupportedInMp4(videoCodec, 'video'));\n });\n\n // remove audio-only level if we also have levels with video codecs or RESOLUTION signalled\n if ((resolutionFound || videoCodecFound) && audioCodecFound) {\n levels = levels.filter(function (_ref2) {\n var videoCodec = _ref2.videoCodec,\n width = _ref2.width,\n height = _ref2.height;\n return !!videoCodec || !!(width && height);\n });\n }\n if (levels.length === 0) {\n // Dispatch error after MANIFEST_LOADED is done propagating\n Promise.resolve().then(function () {\n if (_this2.hls) {\n var error = new Error('no level with compatible codecs found in manifest');\n _this2.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: data.url,\n error: error,\n reason: error.message\n });\n }\n });\n return;\n }\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio');\n });\n // Assign ids after filtering as array indices by group-id\n assignTrackIdsByGroup(audioTracks);\n }\n if (data.subtitles) {\n subtitleTracks = data.subtitles;\n assignTrackIdsByGroup(subtitleTracks);\n }\n // start bitrate is the first bitrate of the manifest\n var unsortedLevels = levels.slice(0);\n // sort levels from lowest to highest\n levels.sort(function (a, b) {\n if (a.attrs['HDCP-LEVEL'] !== b.attrs['HDCP-LEVEL']) {\n return (a.attrs['HDCP-LEVEL'] || '') > (b.attrs['HDCP-LEVEL'] || '') ? 1 : -1;\n }\n if (a.bitrate !== b.bitrate) {\n return a.bitrate - b.bitrate;\n }\n if (a.attrs['FRAME-RATE'] !== b.attrs['FRAME-RATE']) {\n return a.attrs.decimalFloatingPoint('FRAME-RATE') - b.attrs.decimalFloatingPoint('FRAME-RATE');\n }\n if (a.attrs.SCORE !== b.attrs.SCORE) {\n return a.attrs.decimalFloatingPoint('SCORE') - b.attrs.decimalFloatingPoint('SCORE');\n }\n if (resolutionFound && a.height !== b.height) {\n return a.height - b.height;\n }\n return 0;\n });\n var firstLevelInPlaylist = unsortedLevels[0];\n if (this.steering) {\n levels = this.steering.filterParsedLevels(levels);\n if (levels.length !== unsortedLevels.length) {\n for (var i = 0; i < unsortedLevels.length; i++) {\n if (unsortedLevels[i].pathwayId === levels[0].pathwayId) {\n firstLevelInPlaylist = unsortedLevels[i];\n break;\n }\n }\n }\n }\n this._levels = levels;\n\n // find index of first level in sorted levels\n for (var _i = 0; _i < levels.length; _i++) {\n if (levels[_i] === firstLevelInPlaylist) {\n this._firstLevel = _i;\n this.log(\"manifest loaded, \" + levels.length + \" level(s) found, first bitrate: \" + firstLevelInPlaylist.bitrate);\n break;\n }\n }\n\n // Audio is only alternate if manifest include a URI along with the audio group tag,\n // and this is not an audio-only stream where levels contain audio-only\n var audioOnly = audioCodecFound && !videoCodecFound;\n var edata = {\n levels: levels,\n audioTracks: audioTracks,\n subtitleTracks: subtitleTracks,\n sessionData: data.sessionData,\n sessionKeys: data.sessionKeys,\n firstLevel: this._firstLevel,\n stats: data.stats,\n audio: audioCodecFound,\n video: videoCodecFound,\n altAudio: !audioOnly && audioTracks.some(function (t) {\n return !!t.url;\n })\n };\n this.hls.trigger(Events.MANIFEST_PARSED, edata);\n\n // Initiate loading after all controllers have received MANIFEST_PARSED\n if (this.hls.config.autoStartLoad || this.hls.forceStartLoad) {\n this.hls.startLoad(this.hls.config.startPosition);\n }\n };\n _proto.onError = function onError(event, data) {\n if (data.fatal || !data.context) {\n return;\n }\n if (data.context.type === PlaylistContextType.LEVEL && data.context.level === this.level) {\n this.checkRetry(data);\n }\n }\n\n // reset errors on the successful load of a fragment\n ;\n _proto.onFragLoaded = function onFragLoaded(event, _ref3) {\n var frag = _ref3.frag;\n if (frag !== undefined && frag.type === PlaylistLevelType.MAIN) {\n var level = this._levels[frag.level];\n if (level !== undefined) {\n level.loadError = 0;\n }\n }\n };\n _proto.onLevelLoaded = function onLevelLoaded(event, data) {\n var _data$deliveryDirecti2;\n var level = data.level,\n details = data.details;\n var curLevel = this._levels[level];\n if (!curLevel) {\n var _data$deliveryDirecti;\n this.warn(\"Invalid level index \" + level);\n if ((_data$deliveryDirecti = data.deliveryDirectives) != null && _data$deliveryDirecti.skip) {\n details.deltaUpdateFailed = true;\n }\n return;\n }\n\n // only process level loaded events matching with expected level\n if (level === this.currentLevelIndex) {\n // reset level load error counter on successful level loaded only if there is no issues with fragments\n if (curLevel.fragmentError === 0) {\n curLevel.loadError = 0;\n }\n this.playlistLoaded(level, data, curLevel.details);\n } else if ((_data$deliveryDirecti2 = data.deliveryDirectives) != null && _data$deliveryDirecti2.skip) {\n // received a delta playlist update that cannot be merged\n details.deltaUpdateFailed = true;\n }\n };\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(event, data) {\n var currentLevel = this.currentLevel;\n if (!currentLevel) {\n return;\n }\n var audioGroupId = this.hls.audioTracks[data.id].groupId;\n if (currentLevel.audioGroupIds && currentLevel.audioGroupId !== audioGroupId) {\n var urlId = -1;\n for (var i = 0; i < currentLevel.audioGroupIds.length; i++) {\n if (currentLevel.audioGroupIds[i] === audioGroupId) {\n urlId = i;\n break;\n }\n }\n if (urlId !== -1 && urlId !== currentLevel.urlId) {\n currentLevel.urlId = urlId;\n if (this.canLoad) {\n this.startLoad();\n }\n }\n }\n };\n _proto.loadPlaylist = function loadPlaylist(hlsUrlParameters) {\n _BasePlaylistControll.prototype.loadPlaylist.call(this);\n var currentLevelIndex = this.currentLevelIndex;\n var currentLevel = this.currentLevel;\n if (currentLevel && this.shouldLoadPlaylist(currentLevel)) {\n var id = currentLevel.urlId;\n var url = currentLevel.uri;\n if (hlsUrlParameters) {\n try {\n url = hlsUrlParameters.addDirectives(url);\n } catch (error) {\n this.warn(\"Could not construct new URL with HLS Delivery Directives: \" + error);\n }\n }\n var pathwayId = currentLevel.attrs['PATHWAY-ID'];\n this.log(\"Loading level index \" + currentLevelIndex + ((hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : '') + \" with\" + (pathwayId ? ' Pathway ' + pathwayId : '') + \" URI \" + (id + 1) + \"/\" + currentLevel.url.length + \" \" + url);\n\n // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);\n // console.log('New video quality level audio group id:', levelObject.attrs.AUDIO, level);\n this.clearTimer();\n this.hls.trigger(Events.LEVEL_LOADING, {\n url: url,\n level: currentLevelIndex,\n id: id,\n deliveryDirectives: hlsUrlParameters || null\n });\n }\n };\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n var _this3 = this;\n var filterLevelAndGroupByIdIndex = function filterLevelAndGroupByIdIndex(url, id) {\n return id !== urlId;\n };\n var levels = this._levels.filter(function (level, index) {\n if (index !== levelIndex) {\n return true;\n }\n if (level.url.length > 1 && urlId !== undefined) {\n level.url = level.url.filter(filterLevelAndGroupByIdIndex);\n if (level.audioGroupIds) {\n level.audioGroupIds = level.audioGroupIds.filter(filterLevelAndGroupByIdIndex);\n }\n if (level.textGroupIds) {\n level.textGroupIds = level.textGroupIds.filter(filterLevelAndGroupByIdIndex);\n }\n level.urlId = 0;\n return true;\n }\n if (_this3.steering) {\n _this3.steering.removeLevel(level);\n }\n return false;\n });\n this.hls.trigger(Events.LEVELS_UPDATED, {\n levels: levels\n });\n };\n _proto.onLevelsUpdated = function onLevelsUpdated(event, _ref4) {\n var levels = _ref4.levels;\n levels.forEach(function (level, index) {\n var details = level.details;\n if (details != null && details.fragments) {\n details.fragments.forEach(function (fragment) {\n fragment.level = index;\n });\n }\n });\n this._levels = levels;\n };\n _createClass(LevelController, [{\n key: \"levels\",\n get: function get() {\n if (this._levels.length === 0) {\n return null;\n }\n return this._levels;\n }\n }, {\n key: \"level\",\n get: function get() {\n return this.currentLevelIndex;\n },\n set: function set(newLevel) {\n var levels = this._levels;\n if (levels.length === 0) {\n return;\n }\n // check if level idx is valid\n if (newLevel < 0 || newLevel >= levels.length) {\n // invalid level id given, trigger error\n var error = new Error('invalid level idx');\n var fatal = newLevel < 0;\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.OTHER_ERROR,\n details: ErrorDetails.LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: fatal,\n error: error,\n reason: error.message\n });\n if (fatal) {\n return;\n }\n newLevel = Math.min(newLevel, levels.length - 1);\n }\n var lastLevelIndex = this.currentLevelIndex;\n var lastLevel = this.currentLevel;\n var lastPathwayId = lastLevel ? lastLevel.attrs['PATHWAY-ID'] : undefined;\n var level = levels[newLevel];\n var pathwayId = level.attrs['PATHWAY-ID'];\n this.currentLevelIndex = newLevel;\n this.currentLevel = level;\n if (lastLevelIndex === newLevel && level.details && lastLevel && lastPathwayId === pathwayId) {\n return;\n }\n this.log(\"Switching to level \" + newLevel + (pathwayId ? ' with Pathway ' + pathwayId : '') + \" from level \" + lastLevelIndex + (lastPathwayId ? ' with Pathway ' + lastPathwayId : ''));\n var levelSwitchingData = _extends({}, level, {\n level: newLevel,\n maxBitrate: level.maxBitrate,\n attrs: level.attrs,\n uri: level.uri,\n urlId: level.urlId\n });\n // @ts-ignore\n delete levelSwitchingData._attrs;\n // @ts-ignore\n delete levelSwitchingData._urlId;\n this.hls.trigger(Events.LEVEL_SWITCHING, levelSwitchingData);\n // check if we need to load playlist for this level\n var levelDetails = level.details;\n if (!levelDetails || levelDetails.live) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var hlsUrlParameters = this.switchParams(level.uri, lastLevel == null ? void 0 : lastLevel.details);\n this.loadPlaylist(hlsUrlParameters);\n }\n }\n }, {\n key: \"manualLevel\",\n get: function get() {\n return this.manualLevelIndex;\n },\n set: function set(newLevel) {\n this.manualLevelIndex = newLevel;\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n }, {\n key: \"firstLevel\",\n get: function get() {\n return this._firstLevel;\n },\n set: function set(newLevel) {\n this._firstLevel = newLevel;\n }\n }, {\n key: \"startLevel\",\n get: function get() {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n if (configStartLevel !== undefined) {\n return configStartLevel;\n } else {\n return this._firstLevel;\n }\n } else {\n return this._startLevel;\n }\n },\n set: function set(newLevel) {\n this._startLevel = newLevel;\n }\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n } else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function set(nextLevel) {\n this.level = nextLevel;\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n }\n }]);\n return LevelController;\n }(BasePlaylistController);\n function addGroupId(level, type, id) {\n if (!id) {\n return;\n }\n if (type === 'audio') {\n if (!level.audioGroupIds) {\n level.audioGroupIds = [];\n }\n level.audioGroupIds[level.url.length - 1] = id;\n } else if (type === 'text') {\n if (!level.textGroupIds) {\n level.textGroupIds = [];\n }\n level.textGroupIds[level.url.length - 1] = id;\n }\n }\n function assignTrackIdsByGroup(tracks) {\n var groups = {};\n tracks.forEach(function (track) {\n var groupId = track.groupId || '';\n track.id = groups[groupId] = groups[groupId] || 0;\n groups[groupId]++;\n });\n }\n\n var FragmentState = {\n NOT_LOADED: \"NOT_LOADED\",\n APPENDING: \"APPENDING\",\n PARTIAL: \"PARTIAL\",\n OK: \"OK\"\n };\n var FragmentTracker = /*#__PURE__*/function () {\n function FragmentTracker(hls) {\n this.activePartLists = Object.create(null);\n this.endListFragments = Object.create(null);\n this.fragments = Object.create(null);\n this.timeRanges = Object.create(null);\n this.bufferPadding = 0.2;\n this.hls = void 0;\n this.hasGaps = false;\n this.hls = hls;\n this._registerListeners();\n }\n var _proto = FragmentTracker.prototype;\n _proto._registerListeners = function _registerListeners() {\n var hls = this.hls;\n hls.on(Events.BUFFER_APPENDED, this.onBufferAppended, this);\n hls.on(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n hls.on(Events.FRAG_LOADED, this.onFragLoaded, this);\n };\n _proto._unregisterListeners = function _unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.BUFFER_APPENDED, this.onBufferAppended, this);\n hls.off(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n hls.off(Events.FRAG_LOADED, this.onFragLoaded, this);\n };\n _proto.destroy = function destroy() {\n this._unregisterListeners();\n // @ts-ignore\n this.fragments =\n // @ts-ignore\n this.activePartLists =\n // @ts-ignore\n this.endListFragments = this.timeRanges = null;\n }\n\n /**\n * Return a Fragment or Part with an appended range that matches the position and levelType\n * Otherwise, return null\n */;\n _proto.getAppendedFrag = function getAppendedFrag(position, levelType) {\n var activeParts = this.activePartLists[levelType];\n if (activeParts) {\n for (var i = activeParts.length; i--;) {\n var activePart = activeParts[i];\n if (!activePart) {\n break;\n }\n var appendedPTS = activePart.end;\n if (activePart.start <= position && appendedPTS !== null && position <= appendedPTS) {\n return activePart;\n }\n }\n }\n return this.getBufferedFrag(position, levelType);\n }\n\n /**\n * Return a buffered Fragment that matches the position and levelType.\n * A buffered Fragment is one whose loading, parsing and appending is done (completed or \"partial\" meaning aborted).\n * If not found any Fragment, return null\n */;\n _proto.getBufferedFrag = function getBufferedFrag(position, levelType) {\n var fragments = this.fragments;\n var keys = Object.keys(fragments);\n for (var i = keys.length; i--;) {\n var fragmentEntity = fragments[keys[i]];\n if ((fragmentEntity == null ? void 0 : fragmentEntity.body.type) === levelType && fragmentEntity.buffered) {\n var frag = fragmentEntity.body;\n if (frag.start <= position && position <= frag.end) {\n return frag;\n }\n }\n }\n return null;\n }\n\n /**\n * Partial fragments effected by coded frame eviction will be removed\n * The browser will unload parts of the buffer to free up memory for new buffer data\n * Fragments will need to be reloaded when the buffer is freed up, removing partial fragments will allow them to reload(since there might be parts that are still playable)\n */;\n _proto.detectEvictedFragments = function detectEvictedFragments(elementaryStream, timeRange, playlistType, appendedPart) {\n var _this = this;\n if (this.timeRanges) {\n this.timeRanges[elementaryStream] = timeRange;\n }\n // Check if any flagged fragments have been unloaded\n // excluding anything newer than appendedPartSn\n var appendedPartSn = (appendedPart == null ? void 0 : appendedPart.fragment.sn) || -1;\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this.fragments[key];\n if (!fragmentEntity) {\n return;\n }\n if (appendedPartSn >= fragmentEntity.body.sn) {\n return;\n }\n if (!fragmentEntity.buffered && !fragmentEntity.loaded) {\n if (fragmentEntity.body.type === playlistType) {\n _this.removeFragment(fragmentEntity.body);\n }\n return;\n }\n var esData = fragmentEntity.range[elementaryStream];\n if (!esData) {\n return;\n }\n esData.time.some(function (time) {\n var isNotBuffered = !_this.isTimeBuffered(time.startPTS, time.endPTS, timeRange);\n if (isNotBuffered) {\n // Unregister partial fragment as it needs to load again to be reused\n _this.removeFragment(fragmentEntity.body);\n }\n return isNotBuffered;\n });\n });\n }\n\n /**\n * Checks if the fragment passed in is loaded in the buffer properly\n * Partially loaded fragments will be registered as a partial fragment\n */;\n _proto.detectPartialFragments = function detectPartialFragments(data) {\n var _this2 = this;\n var timeRanges = this.timeRanges;\n var frag = data.frag,\n part = data.part;\n if (!timeRanges || frag.sn === 'initSegment') {\n return;\n }\n var fragKey = getFragmentKey(frag);\n var fragmentEntity = this.fragments[fragKey];\n if (!fragmentEntity || fragmentEntity.buffered && frag.gap) {\n return;\n }\n var isFragHint = !frag.relurl;\n Object.keys(timeRanges).forEach(function (elementaryStream) {\n var streamInfo = frag.elementaryStreams[elementaryStream];\n if (!streamInfo) {\n return;\n }\n var timeRange = timeRanges[elementaryStream];\n var partial = isFragHint || streamInfo.partial === true;\n fragmentEntity.range[elementaryStream] = _this2.getBufferedTimes(frag, part, partial, timeRange);\n });\n fragmentEntity.loaded = null;\n if (Object.keys(fragmentEntity.range).length) {\n fragmentEntity.buffered = true;\n var endList = fragmentEntity.body.endList = frag.endList || fragmentEntity.body.endList;\n if (endList) {\n this.endListFragments[fragmentEntity.body.type] = fragmentEntity;\n }\n if (!isPartial(fragmentEntity)) {\n // Remove older fragment parts from lookup after frag is tracked as buffered\n this.removeParts(frag.sn - 1, frag.type);\n }\n } else {\n // remove fragment if nothing was appended\n this.removeFragment(fragmentEntity.body);\n }\n };\n _proto.removeParts = function removeParts(snToKeep, levelType) {\n var activeParts = this.activePartLists[levelType];\n if (!activeParts) {\n return;\n }\n this.activePartLists[levelType] = activeParts.filter(function (part) {\n return part.fragment.sn >= snToKeep;\n });\n };\n _proto.fragBuffered = function fragBuffered(frag, force) {\n var fragKey = getFragmentKey(frag);\n var fragmentEntity = this.fragments[fragKey];\n if (!fragmentEntity && force) {\n fragmentEntity = this.fragments[fragKey] = {\n body: frag,\n appendedPTS: null,\n loaded: null,\n buffered: false,\n range: Object.create(null)\n };\n if (frag.gap) {\n this.hasGaps = true;\n }\n }\n if (fragmentEntity) {\n fragmentEntity.loaded = null;\n fragmentEntity.buffered = true;\n }\n };\n _proto.getBufferedTimes = function getBufferedTimes(fragment, part, partial, timeRange) {\n var buffered = {\n time: [],\n partial: partial\n };\n var startPTS = fragment.start;\n var endPTS = fragment.end;\n var minEndPTS = fragment.minEndPTS || endPTS;\n var maxStartPTS = fragment.maxStartPTS || startPTS;\n for (var i = 0; i < timeRange.length; i++) {\n var startTime = timeRange.start(i) - this.bufferPadding;\n var endTime = timeRange.end(i) + this.bufferPadding;\n if (maxStartPTS >= startTime && minEndPTS <= endTime) {\n // Fragment is entirely contained in buffer\n // No need to check the other timeRange times since it's completely playable\n buffered.time.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n break;\n } else if (startPTS < endTime && endPTS > startTime) {\n buffered.partial = true;\n // Check for intersection with buffer\n // Get playable sections of the fragment\n buffered.time.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n } else if (endPTS <= startTime) {\n // No need to check the rest of the timeRange as it is in order\n break;\n }\n }\n return buffered;\n }\n\n /**\n * Gets the partial fragment for a certain time\n */;\n _proto.getPartialFragment = function getPartialFragment(time) {\n var bestFragment = null;\n var timePadding;\n var startTime;\n var endTime;\n var bestOverlap = 0;\n var bufferPadding = this.bufferPadding,\n fragments = this.fragments;\n Object.keys(fragments).forEach(function (key) {\n var fragmentEntity = fragments[key];\n if (!fragmentEntity) {\n return;\n }\n if (isPartial(fragmentEntity)) {\n startTime = fragmentEntity.body.start - bufferPadding;\n endTime = fragmentEntity.body.end + bufferPadding;\n if (time >= startTime && time <= endTime) {\n // Use the fragment that has the most padding from start and end time\n timePadding = Math.min(time - startTime, endTime - time);\n if (bestOverlap <= timePadding) {\n bestFragment = fragmentEntity.body;\n bestOverlap = timePadding;\n }\n }\n }\n });\n return bestFragment;\n };\n _proto.isEndListAppended = function isEndListAppended(type) {\n var lastFragmentEntity = this.endListFragments[type];\n return lastFragmentEntity !== undefined && (lastFragmentEntity.buffered || isPartial(lastFragmentEntity));\n };\n _proto.getState = function getState(fragment) {\n var fragKey = getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n if (fragmentEntity) {\n if (!fragmentEntity.buffered) {\n return FragmentState.APPENDING;\n } else if (isPartial(fragmentEntity)) {\n return FragmentState.PARTIAL;\n } else {\n return FragmentState.OK;\n }\n }\n return FragmentState.NOT_LOADED;\n };\n _proto.isTimeBuffered = function isTimeBuffered(startPTS, endPTS, timeRange) {\n var startTime;\n var endTime;\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n if (startPTS >= startTime && endPTS <= endTime) {\n return true;\n }\n if (endPTS <= startTime) {\n // No need to check the rest of the timeRange as it is in order\n return false;\n }\n }\n return false;\n };\n _proto.onFragLoaded = function onFragLoaded(event, data) {\n var frag = data.frag,\n part = data.part;\n // don't track initsegment (for which sn is not a number)\n // don't track frags used for bitrateTest, they're irrelevant.\n if (frag.sn === 'initSegment' || frag.bitrateTest) {\n return;\n }\n\n // Fragment entity `loaded` FragLoadedData is null when loading parts\n var loaded = part ? null : data;\n var fragKey = getFragmentKey(frag);\n this.fragments[fragKey] = {\n body: frag,\n appendedPTS: null,\n loaded: loaded,\n buffered: false,\n range: Object.create(null)\n };\n };\n _proto.onBufferAppended = function onBufferAppended(event, data) {\n var _this3 = this;\n var frag = data.frag,\n part = data.part,\n timeRanges = data.timeRanges;\n if (frag.sn === 'initSegment') {\n return;\n }\n var playlistType = frag.type;\n if (part) {\n var activeParts = this.activePartLists[playlistType];\n if (!activeParts) {\n this.activePartLists[playlistType] = activeParts = [];\n }\n activeParts.push(part);\n }\n // Store the latest timeRanges loaded in the buffer\n this.timeRanges = timeRanges;\n Object.keys(timeRanges).forEach(function (elementaryStream) {\n var timeRange = timeRanges[elementaryStream];\n _this3.detectEvictedFragments(elementaryStream, timeRange, playlistType, part);\n });\n };\n _proto.onFragBuffered = function onFragBuffered(event, data) {\n this.detectPartialFragments(data);\n };\n _proto.hasFragment = function hasFragment(fragment) {\n var fragKey = getFragmentKey(fragment);\n return !!this.fragments[fragKey];\n };\n _proto.hasParts = function hasParts(type) {\n var _this$activePartLists;\n return !!((_this$activePartLists = this.activePartLists[type]) != null && _this$activePartLists.length);\n };\n _proto.removeFragmentsInRange = function removeFragmentsInRange(start, end, playlistType, withGapOnly, unbufferedOnly) {\n var _this4 = this;\n if (withGapOnly && !this.hasGaps) {\n return;\n }\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this4.fragments[key];\n if (!fragmentEntity) {\n return;\n }\n var frag = fragmentEntity.body;\n if (frag.type !== playlistType || withGapOnly && !frag.gap) {\n return;\n }\n if (frag.start < end && frag.end > start && (fragmentEntity.buffered || unbufferedOnly)) {\n _this4.removeFragment(frag);\n }\n });\n };\n _proto.removeFragment = function removeFragment(fragment) {\n var fragKey = getFragmentKey(fragment);\n fragment.stats.loaded = 0;\n fragment.clearElementaryStreamInfo();\n var activeParts = this.activePartLists[fragment.type];\n if (activeParts) {\n var snToRemove = fragment.sn;\n this.activePartLists[fragment.type] = activeParts.filter(function (part) {\n return part.fragment.sn !== snToRemove;\n });\n }\n delete this.fragments[fragKey];\n if (fragment.endList) {\n delete this.endListFragments[fragment.type];\n }\n };\n _proto.removeAllFragments = function removeAllFragments() {\n this.fragments = Object.create(null);\n this.endListFragments = Object.create(null);\n this.activePartLists = Object.create(null);\n this.hasGaps = false;\n };\n return FragmentTracker;\n }();\n function isPartial(fragmentEntity) {\n var _fragmentEntity$range, _fragmentEntity$range2, _fragmentEntity$range3;\n return fragmentEntity.buffered && (fragmentEntity.body.gap || ((_fragmentEntity$range = fragmentEntity.range.video) == null ? void 0 : _fragmentEntity$range.partial) || ((_fragmentEntity$range2 = fragmentEntity.range.audio) == null ? void 0 : _fragmentEntity$range2.partial) || ((_fragmentEntity$range3 = fragmentEntity.range.audiovideo) == null ? void 0 : _fragmentEntity$range3.partial));\n }\n function getFragmentKey(fragment) {\n return fragment.type + \"_\" + fragment.level + \"_\" + fragment.urlId + \"_\" + fragment.sn;\n }\n\n var MIN_CHUNK_SIZE = Math.pow(2, 17); // 128kb\n var FragmentLoader = /*#__PURE__*/function () {\n function FragmentLoader(config) {\n this.config = void 0;\n this.loader = null;\n this.partLoadTimeout = -1;\n this.config = config;\n }\n var _proto = FragmentLoader.prototype;\n _proto.destroy = function destroy() {\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n };\n _proto.abort = function abort() {\n if (this.loader) {\n // Abort the loader for current fragment. Only one may load at any given time\n this.loader.abort();\n }\n };\n _proto.load = function load(frag, _onProgress) {\n var _this = this;\n var url = frag.url;\n if (!url) {\n return Promise.reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.FRAG_LOAD_ERROR,\n fatal: false,\n frag: frag,\n error: new Error(\"Fragment does not have a \" + (url ? 'part list' : 'url')),\n networkDetails: null\n }));\n }\n this.abort();\n var config = this.config;\n var FragmentILoader = config.fLoader;\n var DefaultILoader = config.loader;\n return new Promise(function (resolve, reject) {\n if (_this.loader) {\n _this.loader.destroy();\n }\n if (frag.gap) {\n if (frag.tagList.some(function (tags) {\n return tags[0] === 'GAP';\n })) {\n reject(createGapLoadError(frag));\n return;\n } else {\n // Reset temporary treatment as GAP tag\n frag.gap = false;\n }\n }\n var loader = _this.loader = frag.loader = FragmentILoader ? new FragmentILoader(config) : new DefaultILoader(config);\n var loaderContext = createLoaderContext(frag);\n var loadPolicy = getLoaderConfigWithoutReties(config.fragLoadPolicy.default);\n var loaderConfig = {\n loadPolicy: loadPolicy,\n timeout: loadPolicy.maxLoadTimeMs,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: 0,\n highWaterMark: frag.sn === 'initSegment' ? Infinity : MIN_CHUNK_SIZE\n };\n // Assign frag stats to the loader's stats reference\n frag.stats = loader.stats;\n loader.load(loaderContext, loaderConfig, {\n onSuccess: function onSuccess(response, stats, context, networkDetails) {\n _this.resetLoader(frag, loader);\n var payload = response.data;\n if (context.resetIV && frag.decryptdata) {\n frag.decryptdata.iv = new Uint8Array(payload.slice(0, 16));\n payload = payload.slice(16);\n }\n resolve({\n frag: frag,\n part: null,\n payload: payload,\n networkDetails: networkDetails\n });\n },\n onError: function onError(response, context, networkDetails, stats) {\n _this.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.FRAG_LOAD_ERROR,\n fatal: false,\n frag: frag,\n response: _objectSpread2({\n url: url,\n data: undefined\n }, response),\n error: new Error(\"HTTP Error \" + response.code + \" \" + response.text),\n networkDetails: networkDetails,\n stats: stats\n }));\n },\n onAbort: function onAbort(stats, context, networkDetails) {\n _this.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.INTERNAL_ABORTED,\n fatal: false,\n frag: frag,\n error: new Error('Aborted'),\n networkDetails: networkDetails,\n stats: stats\n }));\n },\n onTimeout: function onTimeout(stats, context, networkDetails) {\n _this.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.FRAG_LOAD_TIMEOUT,\n fatal: false,\n frag: frag,\n error: new Error(\"Timeout after \" + loaderConfig.timeout + \"ms\"),\n networkDetails: networkDetails,\n stats: stats\n }));\n },\n onProgress: function onProgress(stats, context, data, networkDetails) {\n if (_onProgress) {\n _onProgress({\n frag: frag,\n part: null,\n payload: data,\n networkDetails: networkDetails\n });\n }\n }\n });\n });\n };\n _proto.loadPart = function loadPart(frag, part, onProgress) {\n var _this2 = this;\n this.abort();\n var config = this.config;\n var FragmentILoader = config.fLoader;\n var DefaultILoader = config.loader;\n return new Promise(function (resolve, reject) {\n if (_this2.loader) {\n _this2.loader.destroy();\n }\n if (frag.gap || part.gap) {\n reject(createGapLoadError(frag, part));\n return;\n }\n var loader = _this2.loader = frag.loader = FragmentILoader ? new FragmentILoader(config) : new DefaultILoader(config);\n var loaderContext = createLoaderContext(frag, part);\n // Should we define another load policy for parts?\n var loadPolicy = getLoaderConfigWithoutReties(config.fragLoadPolicy.default);\n var loaderConfig = {\n loadPolicy: loadPolicy,\n timeout: loadPolicy.maxLoadTimeMs,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: 0,\n highWaterMark: MIN_CHUNK_SIZE\n };\n // Assign part stats to the loader's stats reference\n part.stats = loader.stats;\n loader.load(loaderContext, loaderConfig, {\n onSuccess: function onSuccess(response, stats, context, networkDetails) {\n _this2.resetLoader(frag, loader);\n _this2.updateStatsFromPart(frag, part);\n var partLoadedData = {\n frag: frag,\n part: part,\n payload: response.data,\n networkDetails: networkDetails\n };\n onProgress(partLoadedData);\n resolve(partLoadedData);\n },\n onError: function onError(response, context, networkDetails, stats) {\n _this2.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.FRAG_LOAD_ERROR,\n fatal: false,\n frag: frag,\n part: part,\n response: _objectSpread2({\n url: loaderContext.url,\n data: undefined\n }, response),\n error: new Error(\"HTTP Error \" + response.code + \" \" + response.text),\n networkDetails: networkDetails,\n stats: stats\n }));\n },\n onAbort: function onAbort(stats, context, networkDetails) {\n frag.stats.aborted = part.stats.aborted;\n _this2.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.INTERNAL_ABORTED,\n fatal: false,\n frag: frag,\n part: part,\n error: new Error('Aborted'),\n networkDetails: networkDetails,\n stats: stats\n }));\n },\n onTimeout: function onTimeout(stats, context, networkDetails) {\n _this2.resetLoader(frag, loader);\n reject(new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: ErrorDetails.FRAG_LOAD_TIMEOUT,\n fatal: false,\n frag: frag,\n part: part,\n error: new Error(\"Timeout after \" + loaderConfig.timeout + \"ms\"),\n networkDetails: networkDetails,\n stats: stats\n }));\n }\n });\n });\n };\n _proto.updateStatsFromPart = function updateStatsFromPart(frag, part) {\n var fragStats = frag.stats;\n var partStats = part.stats;\n var partTotal = partStats.total;\n fragStats.loaded += partStats.loaded;\n if (partTotal) {\n var estTotalParts = Math.round(frag.duration / part.duration);\n var estLoadedParts = Math.min(Math.round(fragStats.loaded / partTotal), estTotalParts);\n var estRemainingParts = estTotalParts - estLoadedParts;\n var estRemainingBytes = estRemainingParts * Math.round(fragStats.loaded / estLoadedParts);\n fragStats.total = fragStats.loaded + estRemainingBytes;\n } else {\n fragStats.total = Math.max(fragStats.loaded, fragStats.total);\n }\n var fragLoading = fragStats.loading;\n var partLoading = partStats.loading;\n if (fragLoading.start) {\n // add to fragment loader latency\n fragLoading.first += partLoading.first - partLoading.start;\n } else {\n fragLoading.start = partLoading.start;\n fragLoading.first = partLoading.first;\n }\n fragLoading.end = partLoading.end;\n };\n _proto.resetLoader = function resetLoader(frag, loader) {\n frag.loader = null;\n if (this.loader === loader) {\n self.clearTimeout(this.partLoadTimeout);\n this.loader = null;\n }\n loader.destroy();\n };\n return FragmentLoader;\n }();\n function createLoaderContext(frag, part) {\n if (part === void 0) {\n part = null;\n }\n var segment = part || frag;\n var loaderContext = {\n frag: frag,\n part: part,\n responseType: 'arraybuffer',\n url: segment.url,\n headers: {},\n rangeStart: 0,\n rangeEnd: 0\n };\n var start = segment.byteRangeStartOffset;\n var end = segment.byteRangeEndOffset;\n if (isFiniteNumber(start) && isFiniteNumber(end)) {\n var _frag$decryptdata;\n var byteRangeStart = start;\n var byteRangeEnd = end;\n if (frag.sn === 'initSegment' && ((_frag$decryptdata = frag.decryptdata) == null ? void 0 : _frag$decryptdata.method) === 'AES-128') {\n // MAP segment encrypted with method 'AES-128', when served with HTTP Range,\n // has the unencrypted size specified in the range.\n // Ref: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08#section-6.3.6\n var fragmentLen = end - start;\n if (fragmentLen % 16) {\n byteRangeEnd = end + (16 - fragmentLen % 16);\n }\n if (start !== 0) {\n loaderContext.resetIV = true;\n byteRangeStart = start - 16;\n }\n }\n loaderContext.rangeStart = byteRangeStart;\n loaderContext.rangeEnd = byteRangeEnd;\n }\n return loaderContext;\n }\n function createGapLoadError(frag, part) {\n var error = new Error(\"GAP \" + (frag.gap ? 'tag' : 'attribute') + \" found\");\n var errorData = {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_GAP,\n fatal: false,\n frag: frag,\n error: error,\n networkDetails: null\n };\n if (part) {\n errorData.part = part;\n }\n (part ? part : frag).stats.aborted = true;\n return new LoadError(errorData);\n }\n var LoadError = /*#__PURE__*/function (_Error) {\n _inheritsLoose(LoadError, _Error);\n function LoadError(data) {\n var _this3;\n _this3 = _Error.call(this, data.error.message) || this;\n _this3.data = void 0;\n _this3.data = data;\n return _this3;\n }\n return LoadError;\n }( /*#__PURE__*/_wrapNativeSuper(Error));\n\n var KeyLoader = /*#__PURE__*/function () {\n function KeyLoader(config) {\n this.config = void 0;\n this.keyUriToKeyInfo = {};\n this.emeController = null;\n this.config = config;\n }\n var _proto = KeyLoader.prototype;\n _proto.abort = function abort(type) {\n for (var uri in this.keyUriToKeyInfo) {\n var loader = this.keyUriToKeyInfo[uri].loader;\n if (loader) {\n if (type && type !== loader.context.frag.type) {\n return;\n }\n loader.abort();\n }\n }\n };\n _proto.detach = function detach() {\n for (var uri in this.keyUriToKeyInfo) {\n var keyInfo = this.keyUriToKeyInfo[uri];\n // Remove cached EME keys on detach\n if (keyInfo.mediaKeySessionContext || keyInfo.decryptdata.isCommonEncryption) {\n delete this.keyUriToKeyInfo[uri];\n }\n }\n };\n _proto.destroy = function destroy() {\n this.detach();\n for (var uri in this.keyUriToKeyInfo) {\n var loader = this.keyUriToKeyInfo[uri].loader;\n if (loader) {\n loader.destroy();\n }\n }\n this.keyUriToKeyInfo = {};\n };\n _proto.createKeyLoadError = function createKeyLoadError(frag, details, error, networkDetails, response) {\n if (details === void 0) {\n details = ErrorDetails.KEY_LOAD_ERROR;\n }\n return new LoadError({\n type: ErrorTypes.NETWORK_ERROR,\n details: details,\n fatal: false,\n frag: frag,\n response: response,\n error: error,\n networkDetails: networkDetails\n });\n };\n _proto.loadClear = function loadClear(loadingFrag, encryptedFragments) {\n var _this = this;\n if (this.emeController && this.config.emeEnabled) {\n // access key-system with nearest key on start (loaidng frag is unencrypted)\n var sn = loadingFrag.sn,\n cc = loadingFrag.cc;\n var _loop = function _loop() {\n var frag = encryptedFragments[i];\n if (cc <= frag.cc && (sn === 'initSegment' || frag.sn === 'initSegment' || sn < frag.sn)) {\n _this.emeController.selectKeySystemFormat(frag).then(function (keySystemFormat) {\n frag.setKeyFormat(keySystemFormat);\n });\n return \"break\";\n }\n };\n for (var i = 0; i < encryptedFragments.length; i++) {\n var _ret = _loop();\n if (_ret === \"break\") break;\n }\n }\n };\n _proto.load = function load(frag) {\n var _this2 = this;\n if (!frag.decryptdata && frag.encrypted && this.emeController) {\n // Multiple keys, but none selected, resolve in eme-controller\n return this.emeController.selectKeySystemFormat(frag).then(function (keySystemFormat) {\n return _this2.loadInternal(frag, keySystemFormat);\n });\n }\n return this.loadInternal(frag);\n };\n _proto.loadInternal = function loadInternal(frag, keySystemFormat) {\n var _keyInfo, _keyInfo2;\n if (keySystemFormat) {\n frag.setKeyFormat(keySystemFormat);\n }\n var decryptdata = frag.decryptdata;\n if (!decryptdata) {\n var error = new Error(keySystemFormat ? \"Expected frag.decryptdata to be defined after setting format \" + keySystemFormat : 'Missing decryption data on fragment in onKeyLoading');\n return Promise.reject(this.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_ERROR, error));\n }\n var uri = decryptdata.uri;\n if (!uri) {\n return Promise.reject(this.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_ERROR, new Error(\"Invalid key URI: \\\"\" + uri + \"\\\"\")));\n }\n var keyInfo = this.keyUriToKeyInfo[uri];\n if ((_keyInfo = keyInfo) != null && _keyInfo.decryptdata.key) {\n decryptdata.key = keyInfo.decryptdata.key;\n return Promise.resolve({\n frag: frag,\n keyInfo: keyInfo\n });\n }\n // Return key load promise as long as it does not have a mediakey session with an unusable key status\n if ((_keyInfo2 = keyInfo) != null && _keyInfo2.keyLoadPromise) {\n var _keyInfo$mediaKeySess;\n switch ((_keyInfo$mediaKeySess = keyInfo.mediaKeySessionContext) == null ? void 0 : _keyInfo$mediaKeySess.keyStatus) {\n case undefined:\n case 'status-pending':\n case 'usable':\n case 'usable-in-future':\n return keyInfo.keyLoadPromise.then(function (keyLoadedData) {\n // Return the correct fragment with updated decryptdata key and loaded keyInfo\n decryptdata.key = keyLoadedData.keyInfo.decryptdata.key;\n return {\n frag: frag,\n keyInfo: keyInfo\n };\n });\n }\n // If we have a key session and status and it is not pending or usable, continue\n // This will go back to the eme-controller for expired keys to get a new keyLoadPromise\n }\n\n // Load the key or return the loading promise\n keyInfo = this.keyUriToKeyInfo[uri] = {\n decryptdata: decryptdata,\n keyLoadPromise: null,\n loader: null,\n mediaKeySessionContext: null\n };\n switch (decryptdata.method) {\n case 'ISO-23001-7':\n case 'SAMPLE-AES':\n case 'SAMPLE-AES-CENC':\n case 'SAMPLE-AES-CTR':\n if (decryptdata.keyFormat === 'identity') {\n // loadKeyHTTP handles http(s) and data URLs\n return this.loadKeyHTTP(keyInfo, frag);\n }\n return this.loadKeyEME(keyInfo, frag);\n case 'AES-128':\n return this.loadKeyHTTP(keyInfo, frag);\n default:\n return Promise.reject(this.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_ERROR, new Error(\"Key supplied with unsupported METHOD: \\\"\" + decryptdata.method + \"\\\"\")));\n }\n };\n _proto.loadKeyEME = function loadKeyEME(keyInfo, frag) {\n var keyLoadedData = {\n frag: frag,\n keyInfo: keyInfo\n };\n if (this.emeController && this.config.emeEnabled) {\n var keySessionContextPromise = this.emeController.loadKey(keyLoadedData);\n if (keySessionContextPromise) {\n return (keyInfo.keyLoadPromise = keySessionContextPromise.then(function (keySessionContext) {\n keyInfo.mediaKeySessionContext = keySessionContext;\n return keyLoadedData;\n })).catch(function (error) {\n // Remove promise for license renewal or retry\n keyInfo.keyLoadPromise = null;\n throw error;\n });\n }\n }\n return Promise.resolve(keyLoadedData);\n };\n _proto.loadKeyHTTP = function loadKeyHTTP(keyInfo, frag) {\n var _this3 = this;\n var config = this.config;\n var Loader = config.loader;\n var keyLoader = new Loader(config);\n frag.keyLoader = keyInfo.loader = keyLoader;\n return keyInfo.keyLoadPromise = new Promise(function (resolve, reject) {\n var loaderContext = {\n keyInfo: keyInfo,\n frag: frag,\n responseType: 'arraybuffer',\n url: keyInfo.decryptdata.uri\n };\n\n // maxRetry is 0 so that instead of retrying the same key on the same variant multiple times,\n // key-loader will trigger an error and rely on stream-controller to handle retry logic.\n // this will also align retry logic with fragment-loader\n var loadPolicy = config.keyLoadPolicy.default;\n var loaderConfig = {\n loadPolicy: loadPolicy,\n timeout: loadPolicy.maxLoadTimeMs,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: 0\n };\n var loaderCallbacks = {\n onSuccess: function onSuccess(response, stats, context, networkDetails) {\n var frag = context.frag,\n keyInfo = context.keyInfo,\n uri = context.url;\n if (!frag.decryptdata || keyInfo !== _this3.keyUriToKeyInfo[uri]) {\n return reject(_this3.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_ERROR, new Error('after key load, decryptdata unset or changed'), networkDetails));\n }\n keyInfo.decryptdata.key = frag.decryptdata.key = new Uint8Array(response.data);\n\n // detach fragment key loader on load success\n frag.keyLoader = null;\n keyInfo.loader = null;\n resolve({\n frag: frag,\n keyInfo: keyInfo\n });\n },\n onError: function onError(response, context, networkDetails, stats) {\n _this3.resetLoader(context);\n reject(_this3.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_ERROR, new Error(\"HTTP Error \" + response.code + \" loading key \" + response.text), networkDetails, _objectSpread2({\n url: loaderContext.url,\n data: undefined\n }, response)));\n },\n onTimeout: function onTimeout(stats, context, networkDetails) {\n _this3.resetLoader(context);\n reject(_this3.createKeyLoadError(frag, ErrorDetails.KEY_LOAD_TIMEOUT, new Error('key loading timed out'), networkDetails));\n },\n onAbort: function onAbort(stats, context, networkDetails) {\n _this3.resetLoader(context);\n reject(_this3.createKeyLoadError(frag, ErrorDetails.INTERNAL_ABORTED, new Error('key loading aborted'), networkDetails));\n }\n };\n keyLoader.load(loaderContext, loaderConfig, loaderCallbacks);\n });\n };\n _proto.resetLoader = function resetLoader(context) {\n var frag = context.frag,\n keyInfo = context.keyInfo,\n uri = context.url;\n var loader = keyInfo.loader;\n if (frag.keyLoader === loader) {\n frag.keyLoader = null;\n keyInfo.loader = null;\n }\n delete this.keyUriToKeyInfo[uri];\n if (loader) {\n loader.destroy();\n }\n };\n return KeyLoader;\n }();\n\n /**\n * @ignore\n * Sub-class specialization of EventHandler base class.\n *\n * TaskLoop allows to schedule a task function being called (optionnaly repeatedly) on the main loop,\n * scheduled asynchroneously, avoiding recursive calls in the same tick.\n *\n * The task itself is implemented in `doTick`. It can be requested and called for single execution\n * using the `tick` method.\n *\n * It will be assured that the task execution method (`tick`) only gets called once per main loop \"tick\",\n * no matter how often it gets requested for execution. Execution in further ticks will be scheduled accordingly.\n *\n * If further execution requests have already been scheduled on the next tick, it can be checked with `hasNextTick`,\n * and cancelled with `clearNextTick`.\n *\n * The task can be scheduled as an interval repeatedly with a period as parameter (see `setInterval`, `clearInterval`).\n *\n * Sub-classes need to implement the `doTick` method which will effectively have the task execution routine.\n *\n * Further explanations:\n *\n * The baseclass has a `tick` method that will schedule the doTick call. It may be called synchroneously\n * only for a stack-depth of one. On re-entrant calls, sub-sequent calls are scheduled for next main loop ticks.\n *\n * When the task execution (`tick` method) is called in re-entrant way this is detected and\n * we are limiting the task execution per call stack to exactly one, but scheduling/post-poning further\n * task processing on the next main loop iteration (also known as \"next tick\" in the Node/JS runtime lingo).\n */\n var TaskLoop = /*#__PURE__*/function () {\n function TaskLoop() {\n this._boundTick = void 0;\n this._tickTimer = null;\n this._tickInterval = null;\n this._tickCallCount = 0;\n this._boundTick = this.tick.bind(this);\n }\n var _proto = TaskLoop.prototype;\n _proto.destroy = function destroy() {\n this.onHandlerDestroying();\n this.onHandlerDestroyed();\n };\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n // clear all timers before unregistering from event bus\n this.clearNextTick();\n this.clearInterval();\n };\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {};\n _proto.hasInterval = function hasInterval() {\n return !!this._tickInterval;\n };\n _proto.hasNextTick = function hasNextTick() {\n return !!this._tickTimer;\n }\n\n /**\n * @param millis - Interval time (ms)\n * @eturns True when interval has been scheduled, false when already scheduled (no effect)\n */;\n _proto.setInterval = function setInterval(millis) {\n if (!this._tickInterval) {\n this._tickCallCount = 0;\n this._tickInterval = self.setInterval(this._boundTick, millis);\n return true;\n }\n return false;\n }\n\n /**\n * @returns True when interval was cleared, false when none was set (no effect)\n */;\n _proto.clearInterval = function clearInterval() {\n if (this._tickInterval) {\n self.clearInterval(this._tickInterval);\n this._tickInterval = null;\n return true;\n }\n return false;\n }\n\n /**\n * @returns True when timeout was cleared, false when none was set (no effect)\n */;\n _proto.clearNextTick = function clearNextTick() {\n if (this._tickTimer) {\n self.clearTimeout(this._tickTimer);\n this._tickTimer = null;\n return true;\n }\n return false;\n }\n\n /**\n * Will call the subclass doTick implementation in this main loop tick\n * or in the next one (via setTimeout(,0)) in case it has already been called\n * in this tick (in case this is a re-entrant call).\n */;\n _proto.tick = function tick() {\n this._tickCallCount++;\n if (this._tickCallCount === 1) {\n this.doTick();\n // re-entrant call to tick from previous doTick call stack\n // -> schedule a call on the next main loop iteration to process this task processing request\n if (this._tickCallCount > 1) {\n // make sure only one timer exists at any time at max\n this.tickImmediate();\n }\n this._tickCallCount = 0;\n }\n };\n _proto.tickImmediate = function tickImmediate() {\n this.clearNextTick();\n this._tickTimer = self.setTimeout(this._boundTick, 0);\n }\n\n /**\n * For subclass to implement task logic\n * @abstract\n */;\n _proto.doTick = function doTick() {};\n return TaskLoop;\n }();\n\n /**\n * Provides methods dealing with buffer length retrieval for example.\n *\n * In general, a helper around HTML5 MediaElement TimeRanges gathered from `buffered` property.\n *\n * Also @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/buffered\n */\n\n var noopBuffered = {\n length: 0,\n start: function start() {\n return 0;\n },\n end: function end() {\n return 0;\n }\n };\n var BufferHelper = /*#__PURE__*/function () {\n function BufferHelper() {}\n /**\n * Return true if `media`'s buffered include `position`\n */\n BufferHelper.isBuffered = function isBuffered(media, position) {\n try {\n if (media) {\n var buffered = BufferHelper.getBuffered(media);\n for (var i = 0; i < buffered.length; i++) {\n if (position >= buffered.start(i) && position <= buffered.end(i)) {\n return true;\n }\n }\n }\n } catch (error) {\n // this is to catch\n // InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':\n // This SourceBuffer has been removed from the parent media source\n }\n return false;\n };\n BufferHelper.bufferInfo = function bufferInfo(media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = BufferHelper.getBuffered(media);\n var buffered = [];\n var i;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({\n start: vbuffered.start(i),\n end: vbuffered.end(i)\n });\n }\n return this.bufferedInfo(buffered, pos, maxHoleDuration);\n }\n } catch (error) {\n // this is to catch\n // InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer':\n // This SourceBuffer has been removed from the parent media source\n }\n return {\n len: 0,\n start: pos,\n end: pos,\n nextStart: undefined\n };\n };\n BufferHelper.bufferedInfo = function bufferedInfo(buffered, pos, maxHoleDuration) {\n pos = Math.max(0, pos);\n // sort on buffer.start/smaller end (IE does not always return sorted buffered range)\n buffered.sort(function (a, b) {\n var diff = a.start - b.start;\n if (diff) {\n return diff;\n } else {\n return b.end - a.end;\n }\n });\n var buffered2 = [];\n if (maxHoleDuration) {\n // there might be some small holes between buffer time range\n // consider that holes smaller than maxHoleDuration are irrelevant and build another\n // buffer time range representations that discards those holes\n for (var i = 0; i < buffered.length; i++) {\n var buf2len = buffered2.length;\n if (buf2len) {\n var buf2end = buffered2[buf2len - 1].end;\n // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n if (buffered[i].start - buf2end < maxHoleDuration) {\n // merge overlapping time ranges\n // update lastRange.end only if smaller than item.end\n // e.g. [ 1, 15] with [ 2,8] => [ 1,15] (no need to modify lastRange.end)\n // whereas [ 1, 8] with [ 2,15] => [ 1,15] ( lastRange should switch from [1,8] to [1,15])\n if (buffered[i].end > buf2end) {\n buffered2[buf2len - 1].end = buffered[i].end;\n }\n } else {\n // big hole\n buffered2.push(buffered[i]);\n }\n } else {\n // first value\n buffered2.push(buffered[i]);\n }\n }\n } else {\n buffered2 = buffered;\n }\n var bufferLen = 0;\n\n // bufferStartNext can possibly be undefined based on the conditional logic below\n var bufferStartNext;\n\n // bufferStart and bufferEnd are buffer boundaries around current video position\n var bufferStart = pos;\n var bufferEnd = pos;\n for (var _i = 0; _i < buffered2.length; _i++) {\n var start = buffered2[_i].start;\n var end = buffered2[_i].end;\n // logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n if (pos + maxHoleDuration >= start && pos < end) {\n // play position is inside this buffer TimeRange, retrieve end of buffer position and buffer length\n bufferStart = start;\n bufferEnd = end;\n bufferLen = bufferEnd - pos;\n } else if (pos + maxHoleDuration < start) {\n bufferStartNext = start;\n break;\n }\n }\n return {\n len: bufferLen,\n start: bufferStart || 0,\n end: bufferEnd || 0,\n nextStart: bufferStartNext\n };\n }\n\n /**\n * Safe method to get buffered property.\n * SourceBuffer.buffered may throw if SourceBuffer is removed from it's MediaSource\n */;\n BufferHelper.getBuffered = function getBuffered(media) {\n try {\n return media.buffered;\n } catch (e) {\n logger.log('failed to get media.buffered', e);\n return noopBuffered;\n }\n };\n return BufferHelper;\n }();\n\n var ChunkMetadata = function ChunkMetadata(level, sn, id, size, part, partial) {\n if (size === void 0) {\n size = 0;\n }\n if (part === void 0) {\n part = -1;\n }\n if (partial === void 0) {\n partial = false;\n }\n this.level = void 0;\n this.sn = void 0;\n this.part = void 0;\n this.id = void 0;\n this.size = void 0;\n this.partial = void 0;\n this.transmuxing = getNewPerformanceTiming();\n this.buffering = {\n audio: getNewPerformanceTiming(),\n video: getNewPerformanceTiming(),\n audiovideo: getNewPerformanceTiming()\n };\n this.level = level;\n this.sn = sn;\n this.id = id;\n this.size = size;\n this.part = part;\n this.partial = partial;\n };\n function getNewPerformanceTiming() {\n return {\n start: 0,\n executeStart: 0,\n executeEnd: 0,\n end: 0\n };\n }\n\n function findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n for (var i = 0, len = fragments.length; i < len; i++) {\n var currentFrag = fragments[i];\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n return firstFrag;\n }\n function shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n if (lastLevel.details) {\n if (details.endCC > details.startCC || lastFrag && lastFrag.cc < details.startCC) {\n return true;\n }\n }\n return false;\n }\n\n // Find the first frag in the previous level which matches the CC of the first frag of the new level\n function findDiscontinuousReferenceFrag(prevDetails, curDetails, referenceIndex) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n if (!curFrags.length || !prevFrags.length) {\n logger.log('No fragments to align');\n return;\n }\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {\n logger.log('No frag in previous level to align on');\n return;\n }\n return prevStartFrag;\n }\n function adjustFragmentStart(frag, sliding) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n }\n function adjustSlidingStart(sliding, details) {\n // Update segments\n var fragments = details.fragments;\n for (var i = 0, len = fragments.length; i < len; i++) {\n adjustFragmentStart(fragments[i], sliding);\n }\n // Update LL-HLS parts at the end of the playlist\n if (details.fragmentHint) {\n adjustFragmentStart(details.fragmentHint, sliding);\n }\n details.alignedSliding = true;\n }\n\n /**\n * Using the parameters of the last level, this function computes PTS' of the new fragments so that they form a\n * contiguous stream with the last fragments.\n * The PTS of a fragment lets Hls.js know where it fits into a stream - by knowing every PTS, we know which fragment to\n * download at any given time. PTS is normally computed when the fragment is demuxed, so taking this step saves us time\n * and an extra download.\n * @param lastFrag\n * @param lastLevel\n * @param details\n */\n function alignStream(lastFrag, lastLevel, details) {\n if (!lastLevel) {\n return;\n }\n alignDiscontinuities(lastFrag, details, lastLevel);\n if (!details.alignedSliding && lastLevel.details) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n if (!details.alignedSliding && lastLevel.details && !details.skippedSegments) {\n // Try to align on sn so that we pick a better start fragment.\n // Do not perform this on playlists with delta updates as this is only to align levels on switch\n // and adjustSliding only adjusts fragments after skippedSegments.\n adjustSliding(lastLevel.details, details);\n }\n }\n\n /**\n * Computes the PTS if a new level's fragments using the PTS of a fragment in the last level which shares the same\n * discontinuity sequence.\n * @param lastFrag - The last Fragment which shares the same discontinuity sequence\n * @param lastLevel - The details of the last loaded level\n * @param details - The details of the new level\n */\n function alignDiscontinuities(lastFrag, details, lastLevel) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n if (referenceFrag && isFiniteNumber(referenceFrag.start)) {\n logger.log(\"Adjusting PTS using last level due to CC increase within current level \" + details.url);\n adjustSlidingStart(referenceFrag.start, details);\n }\n }\n }\n\n /**\n * Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.\n * @param details - The details of the new level\n * @param lastDetails - The details of the last loaded level\n */\n function alignPDT(details, lastDetails) {\n // This check protects the unsafe \"!\" usage below for null program date time access.\n if (!lastDetails.fragments.length || !details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {\n return;\n }\n // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n var lastPDT = lastDetails.fragments[0].programDateTime; // hasProgramDateTime check above makes this safe.\n var newPDT = details.fragments[0].programDateTime;\n // date diff is in ms. frag.start is in seconds\n var sliding = (newPDT - lastPDT) / 1000 + lastDetails.fragments[0].start;\n if (sliding && isFiniteNumber(sliding)) {\n logger.log(\"Adjusting PTS using programDateTime delta \" + (newPDT - lastPDT) + \"ms, sliding:\" + sliding.toFixed(3) + \" \" + details.url + \" \");\n adjustSlidingStart(sliding, details);\n }\n }\n\n var AESCrypto = /*#__PURE__*/function () {\n function AESCrypto(subtle, iv) {\n this.subtle = void 0;\n this.aesIV = void 0;\n this.subtle = subtle;\n this.aesIV = iv;\n }\n var _proto = AESCrypto.prototype;\n _proto.decrypt = function decrypt(data, key) {\n return this.subtle.decrypt({\n name: 'AES-CBC',\n iv: this.aesIV\n }, key, data);\n };\n return AESCrypto;\n }();\n\n var FastAESKey = /*#__PURE__*/function () {\n function FastAESKey(subtle, key) {\n this.subtle = void 0;\n this.key = void 0;\n this.subtle = subtle;\n this.key = key;\n }\n var _proto = FastAESKey.prototype;\n _proto.expandKey = function expandKey() {\n return this.subtle.importKey('raw', this.key, {\n name: 'AES-CBC'\n }, false, ['encrypt', 'decrypt']);\n };\n return FastAESKey;\n }();\n\n // PKCS7\n function removePadding(array) {\n var outputBytes = array.byteLength;\n var paddingBytes = outputBytes && new DataView(array.buffer).getUint8(outputBytes - 1);\n if (paddingBytes) {\n return sliceUint8(array, 0, outputBytes - paddingBytes);\n }\n return array;\n }\n var AESDecryptor = /*#__PURE__*/function () {\n function AESDecryptor() {\n this.rcon = [0x0, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n this.subMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)];\n this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)];\n this.sBox = new Uint32Array(256);\n this.invSBox = new Uint32Array(256);\n this.key = new Uint32Array(0);\n this.ksRows = 0;\n this.keySize = 0;\n this.keySchedule = void 0;\n this.invKeySchedule = void 0;\n this.initTable();\n }\n\n // Using view.getUint32() also swaps the byte order.\n var _proto = AESDecryptor.prototype;\n _proto.uint8ArrayToUint32Array_ = function uint8ArrayToUint32Array_(arrayBuffer) {\n var view = new DataView(arrayBuffer);\n var newArray = new Uint32Array(4);\n for (var i = 0; i < 4; i++) {\n newArray[i] = view.getUint32(i * 4);\n }\n return newArray;\n };\n _proto.initTable = function initTable() {\n var sBox = this.sBox;\n var invSBox = this.invSBox;\n var subMix = this.subMix;\n var subMix0 = subMix[0];\n var subMix1 = subMix[1];\n var subMix2 = subMix[2];\n var subMix3 = subMix[3];\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var d = new Uint32Array(256);\n var x = 0;\n var xi = 0;\n var i = 0;\n for (i = 0; i < 256; i++) {\n if (i < 128) {\n d[i] = i << 1;\n } else {\n d[i] = i << 1 ^ 0x11b;\n }\n }\n for (i = 0; i < 256; i++) {\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 0xff ^ 0x63;\n sBox[x] = sx;\n invSBox[sx] = x;\n\n // Compute multiplication\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4];\n\n // Compute sub/invSub bytes, mix columns tables\n var t = d[sx] * 0x101 ^ sx * 0x1010100;\n subMix0[x] = t << 24 | t >>> 8;\n subMix1[x] = t << 16 | t >>> 16;\n subMix2[x] = t << 8 | t >>> 24;\n subMix3[x] = t;\n\n // Compute inv sub bytes, inv mix columns tables\n t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n invSubMix0[sx] = t << 24 | t >>> 8;\n invSubMix1[sx] = t << 16 | t >>> 16;\n invSubMix2[sx] = t << 8 | t >>> 24;\n invSubMix3[sx] = t;\n\n // Compute next counter\n if (!x) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n };\n _proto.expandKey = function expandKey(keyBuffer) {\n // convert keyBuffer to Uint32Array\n var key = this.uint8ArrayToUint32Array_(keyBuffer);\n var sameKey = true;\n var offset = 0;\n while (offset < key.length && sameKey) {\n sameKey = key[offset] === this.key[offset];\n offset++;\n }\n if (sameKey) {\n return;\n }\n this.key = key;\n var keySize = this.keySize = key.length;\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\n var ksRows = this.ksRows = (keySize + 6 + 1) * 4;\n var ksRow;\n var invKsRow;\n var keySchedule = this.keySchedule = new Uint32Array(ksRows);\n var invKeySchedule = this.invKeySchedule = new Uint32Array(ksRows);\n var sbox = this.sBox;\n var rcon = this.rcon;\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var prev;\n var t;\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n t = prev;\n if (ksRow % keySize === 0) {\n // Rot word\n t = t << 8 | t >>> 24;\n\n // Sub word\n t = sbox[t >>> 24] << 24 | sbox[t >>> 16 & 0xff] << 16 | sbox[t >>> 8 & 0xff] << 8 | sbox[t & 0xff];\n\n // Mix Rcon\n t ^= rcon[ksRow / keySize | 0] << 24;\n } else if (keySize > 6 && ksRow % keySize === 4) {\n // Sub word\n t = sbox[t >>> 24] << 24 | sbox[t >>> 16 & 0xff] << 16 | sbox[t >>> 8 & 0xff] << 8 | sbox[t & 0xff];\n }\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\n for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n ksRow = ksRows - invKsRow;\n if (invKsRow & 3) {\n t = keySchedule[ksRow];\n } else {\n t = keySchedule[ksRow - 4];\n }\n if (invKsRow < 4 || ksRow <= 4) {\n invKeySchedule[invKsRow] = t;\n } else {\n invKeySchedule[invKsRow] = invSubMix0[sbox[t >>> 24]] ^ invSubMix1[sbox[t >>> 16 & 0xff]] ^ invSubMix2[sbox[t >>> 8 & 0xff]] ^ invSubMix3[sbox[t & 0xff]];\n }\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n }\n\n // Adding this as a method greatly improves performance.\n ;\n _proto.networkToHostOrderSwap = function networkToHostOrderSwap(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n _proto.decrypt = function decrypt(inputArrayBuffer, offset, aesIV) {\n var nRounds = this.keySize + 6;\n var invKeySchedule = this.invKeySchedule;\n var invSBOX = this.invSBox;\n var invSubMix = this.invSubMix;\n var invSubMix0 = invSubMix[0];\n var invSubMix1 = invSubMix[1];\n var invSubMix2 = invSubMix[2];\n var invSubMix3 = invSubMix[3];\n var initVector = this.uint8ArrayToUint32Array_(aesIV);\n var initVector0 = initVector[0];\n var initVector1 = initVector[1];\n var initVector2 = initVector[2];\n var initVector3 = initVector[3];\n var inputInt32 = new Int32Array(inputArrayBuffer);\n var outputInt32 = new Int32Array(inputInt32.length);\n var t0, t1, t2, t3;\n var s0, s1, s2, s3;\n var inputWords0, inputWords1, inputWords2, inputWords3;\n var ksRow, i;\n var swapWord = this.networkToHostOrderSwap;\n while (offset < inputInt32.length) {\n inputWords0 = swapWord(inputInt32[offset]);\n inputWords1 = swapWord(inputInt32[offset + 1]);\n inputWords2 = swapWord(inputInt32[offset + 2]);\n inputWords3 = swapWord(inputInt32[offset + 3]);\n s0 = inputWords0 ^ invKeySchedule[0];\n s1 = inputWords3 ^ invKeySchedule[1];\n s2 = inputWords2 ^ invKeySchedule[2];\n s3 = inputWords1 ^ invKeySchedule[3];\n ksRow = 4;\n\n // Iterate through the rounds of decryption\n for (i = 1; i < nRounds; i++) {\n t0 = invSubMix0[s0 >>> 24] ^ invSubMix1[s1 >> 16 & 0xff] ^ invSubMix2[s2 >> 8 & 0xff] ^ invSubMix3[s3 & 0xff] ^ invKeySchedule[ksRow];\n t1 = invSubMix0[s1 >>> 24] ^ invSubMix1[s2 >> 16 & 0xff] ^ invSubMix2[s3 >> 8 & 0xff] ^ invSubMix3[s0 & 0xff] ^ invKeySchedule[ksRow + 1];\n t2 = invSubMix0[s2 >>> 24] ^ invSubMix1[s3 >> 16 & 0xff] ^ invSubMix2[s0 >> 8 & 0xff] ^ invSubMix3[s1 & 0xff] ^ invKeySchedule[ksRow + 2];\n t3 = invSubMix0[s3 >>> 24] ^ invSubMix1[s0 >> 16 & 0xff] ^ invSubMix2[s1 >> 8 & 0xff] ^ invSubMix3[s2 & 0xff] ^ invKeySchedule[ksRow + 3];\n // Update state\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n ksRow = ksRow + 4;\n }\n\n // Shift rows, sub bytes, add round key\n t0 = invSBOX[s0 >>> 24] << 24 ^ invSBOX[s1 >> 16 & 0xff] << 16 ^ invSBOX[s2 >> 8 & 0xff] << 8 ^ invSBOX[s3 & 0xff] ^ invKeySchedule[ksRow];\n t1 = invSBOX[s1 >>> 24] << 24 ^ invSBOX[s2 >> 16 & 0xff] << 16 ^ invSBOX[s3 >> 8 & 0xff] << 8 ^ invSBOX[s0 & 0xff] ^ invKeySchedule[ksRow + 1];\n t2 = invSBOX[s2 >>> 24] << 24 ^ invSBOX[s3 >> 16 & 0xff] << 16 ^ invSBOX[s0 >> 8 & 0xff] << 8 ^ invSBOX[s1 & 0xff] ^ invKeySchedule[ksRow + 2];\n t3 = invSBOX[s3 >>> 24] << 24 ^ invSBOX[s0 >> 16 & 0xff] << 16 ^ invSBOX[s1 >> 8 & 0xff] << 8 ^ invSBOX[s2 & 0xff] ^ invKeySchedule[ksRow + 3];\n\n // Write\n outputInt32[offset] = swapWord(t0 ^ initVector0);\n outputInt32[offset + 1] = swapWord(t3 ^ initVector1);\n outputInt32[offset + 2] = swapWord(t2 ^ initVector2);\n outputInt32[offset + 3] = swapWord(t1 ^ initVector3);\n\n // reset initVector to last 4 unsigned int\n initVector0 = inputWords0;\n initVector1 = inputWords1;\n initVector2 = inputWords2;\n initVector3 = inputWords3;\n offset = offset + 4;\n }\n return outputInt32.buffer;\n };\n return AESDecryptor;\n }();\n\n var CHUNK_SIZE = 16; // 16 bytes, 128 bits\n var Decrypter = /*#__PURE__*/function () {\n function Decrypter(config, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$removePKCS7Paddi = _ref.removePKCS7Padding,\n removePKCS7Padding = _ref$removePKCS7Paddi === void 0 ? true : _ref$removePKCS7Paddi;\n this.logEnabled = true;\n this.removePKCS7Padding = void 0;\n this.subtle = null;\n this.softwareDecrypter = null;\n this.key = null;\n this.fastAesKey = null;\n this.remainderData = null;\n this.currentIV = null;\n this.currentResult = null;\n this.useSoftware = void 0;\n this.useSoftware = config.enableSoftwareAES;\n this.removePKCS7Padding = removePKCS7Padding;\n // built in decryptor expects PKCS7 padding\n if (removePKCS7Padding) {\n try {\n var browserCrypto = self.crypto;\n if (browserCrypto) {\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n }\n } catch (e) {\n /* no-op */\n }\n }\n if (this.subtle === null) {\n this.useSoftware = true;\n }\n }\n var _proto = Decrypter.prototype;\n _proto.destroy = function destroy() {\n this.subtle = null;\n this.softwareDecrypter = null;\n this.key = null;\n this.fastAesKey = null;\n this.remainderData = null;\n this.currentIV = null;\n this.currentResult = null;\n };\n _proto.isSync = function isSync() {\n return this.useSoftware;\n };\n _proto.flush = function flush() {\n var currentResult = this.currentResult,\n remainderData = this.remainderData;\n if (!currentResult || remainderData) {\n this.reset();\n return null;\n }\n var data = new Uint8Array(currentResult);\n this.reset();\n if (this.removePKCS7Padding) {\n return removePadding(data);\n }\n return data;\n };\n _proto.reset = function reset() {\n this.currentResult = null;\n this.currentIV = null;\n this.remainderData = null;\n if (this.softwareDecrypter) {\n this.softwareDecrypter = null;\n }\n };\n _proto.decrypt = function decrypt(data, key, iv) {\n var _this = this;\n if (this.useSoftware) {\n return new Promise(function (resolve, reject) {\n _this.softwareDecrypt(new Uint8Array(data), key, iv);\n var decryptResult = _this.flush();\n if (decryptResult) {\n resolve(decryptResult.buffer);\n } else {\n reject(new Error('[softwareDecrypt] Failed to decrypt data'));\n }\n });\n }\n return this.webCryptoDecrypt(new Uint8Array(data), key, iv);\n }\n\n // Software decryption is progressive. Progressive decryption may not return a result on each call. Any cached\n // data is handled in the flush() call\n ;\n _proto.softwareDecrypt = function softwareDecrypt(data, key, iv) {\n var currentIV = this.currentIV,\n currentResult = this.currentResult,\n remainderData = this.remainderData;\n this.logOnce('JS AES decrypt');\n // The output is staggered during progressive parsing - the current result is cached, and emitted on the next call\n // This is done in order to strip PKCS7 padding, which is found at the end of each segment. We only know we've reached\n // the end on flush(), but by that time we have already received all bytes for the segment.\n // Progressive decryption does not work with WebCrypto\n\n if (remainderData) {\n data = appendUint8Array(remainderData, data);\n this.remainderData = null;\n }\n\n // Byte length must be a multiple of 16 (AES-128 = 128 bit blocks = 16 bytes)\n var currentChunk = this.getValidChunk(data);\n if (!currentChunk.length) {\n return null;\n }\n if (currentIV) {\n iv = currentIV;\n }\n var softwareDecrypter = this.softwareDecrypter;\n if (!softwareDecrypter) {\n softwareDecrypter = this.softwareDecrypter = new AESDecryptor();\n }\n softwareDecrypter.expandKey(key);\n var result = currentResult;\n this.currentResult = softwareDecrypter.decrypt(currentChunk.buffer, 0, iv);\n this.currentIV = sliceUint8(currentChunk, -16).buffer;\n if (!result) {\n return null;\n }\n return result;\n };\n _proto.webCryptoDecrypt = function webCryptoDecrypt(data, key, iv) {\n var _this2 = this;\n var subtle = this.subtle;\n if (this.key !== key || !this.fastAesKey) {\n this.key = key;\n this.fastAesKey = new FastAESKey(subtle, key);\n }\n return this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n if (!subtle) {\n return Promise.reject(new Error('web crypto not initialized'));\n }\n _this2.logOnce('WebCrypto AES decrypt');\n var crypto = new AESCrypto(subtle, new Uint8Array(iv));\n return crypto.decrypt(data.buffer, aesKey);\n }).catch(function (err) {\n logger.warn(\"[decrypter]: WebCrypto Error, disable WebCrypto API, \" + err.name + \": \" + err.message);\n return _this2.onWebCryptoError(data, key, iv);\n });\n };\n _proto.onWebCryptoError = function onWebCryptoError(data, key, iv) {\n this.useSoftware = true;\n this.logEnabled = true;\n this.softwareDecrypt(data, key, iv);\n var decryptResult = this.flush();\n if (decryptResult) {\n return decryptResult.buffer;\n }\n throw new Error('WebCrypto and softwareDecrypt: failed to decrypt data');\n };\n _proto.getValidChunk = function getValidChunk(data) {\n var currentChunk = data;\n var splitPoint = data.length - data.length % CHUNK_SIZE;\n if (splitPoint !== data.length) {\n currentChunk = sliceUint8(data, 0, splitPoint);\n this.remainderData = sliceUint8(data, splitPoint);\n }\n return currentChunk;\n };\n _proto.logOnce = function logOnce(msg) {\n if (!this.logEnabled) {\n return;\n }\n logger.log(\"[decrypter]: \" + msg);\n this.logEnabled = false;\n };\n return Decrypter;\n }();\n\n /**\n * TimeRanges to string helper\n */\n\n var TimeRanges = {\n toString: function toString(r) {\n var log = '';\n var len = r.length;\n for (var i = 0; i < len; i++) {\n log += \"[\" + r.start(i).toFixed(3) + \"-\" + r.end(i).toFixed(3) + \"]\";\n }\n return log;\n }\n };\n\n var State = {\n STOPPED: 'STOPPED',\n IDLE: 'IDLE',\n KEY_LOADING: 'KEY_LOADING',\n FRAG_LOADING: 'FRAG_LOADING',\n FRAG_LOADING_WAITING_RETRY: 'FRAG_LOADING_WAITING_RETRY',\n WAITING_TRACK: 'WAITING_TRACK',\n PARSING: 'PARSING',\n PARSED: 'PARSED',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS',\n WAITING_LEVEL: 'WAITING_LEVEL'\n };\n var BaseStreamController = /*#__PURE__*/function (_TaskLoop) {\n _inheritsLoose(BaseStreamController, _TaskLoop);\n function BaseStreamController(hls, fragmentTracker, keyLoader, logPrefix, playlistType) {\n var _this;\n _this = _TaskLoop.call(this) || this;\n _this.hls = void 0;\n _this.fragPrevious = null;\n _this.fragCurrent = null;\n _this.fragmentTracker = void 0;\n _this.transmuxer = null;\n _this._state = State.STOPPED;\n _this.playlistType = void 0;\n _this.media = null;\n _this.mediaBuffer = null;\n _this.config = void 0;\n _this.bitrateTest = false;\n _this.lastCurrentTime = 0;\n _this.nextLoadPosition = 0;\n _this.startPosition = 0;\n _this.startTimeOffset = null;\n _this.loadedmetadata = false;\n _this.retryDate = 0;\n _this.levels = null;\n _this.fragmentLoader = void 0;\n _this.keyLoader = void 0;\n _this.levelLastLoaded = null;\n _this.startFragRequested = false;\n _this.decrypter = void 0;\n _this.initPTS = [];\n _this.onvseeking = null;\n _this.onvended = null;\n _this.logPrefix = '';\n _this.log = void 0;\n _this.warn = void 0;\n _this.playlistType = playlistType;\n _this.logPrefix = logPrefix;\n _this.log = logger.log.bind(logger, logPrefix + \":\");\n _this.warn = logger.warn.bind(logger, logPrefix + \":\");\n _this.hls = hls;\n _this.fragmentLoader = new FragmentLoader(hls.config);\n _this.keyLoader = keyLoader;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.decrypter = new Decrypter(hls.config);\n hls.on(Events.MANIFEST_LOADED, _this.onManifestLoaded, _assertThisInitialized(_this));\n return _this;\n }\n var _proto = BaseStreamController.prototype;\n _proto.doTick = function doTick() {\n this.onTickEnd();\n };\n _proto.onTickEnd = function onTickEnd() {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ;\n _proto.startLoad = function startLoad(startPosition) {};\n _proto.stopLoad = function stopLoad() {\n this.fragmentLoader.abort();\n this.keyLoader.abort(this.playlistType);\n var frag = this.fragCurrent;\n if (frag != null && frag.loader) {\n frag.abortRequests();\n this.fragmentTracker.removeFragment(frag);\n }\n this.resetTransmuxer();\n this.fragCurrent = null;\n this.fragPrevious = null;\n this.clearInterval();\n this.clearNextTick();\n this.state = State.STOPPED;\n };\n _proto._streamEnded = function _streamEnded(bufferInfo, levelDetails) {\n // If playlist is live, there is another buffered range after the current range, nothing buffered, media is detached,\n // of nothing loading/loaded return false\n if (levelDetails.live || bufferInfo.nextStart || !bufferInfo.end || !this.media) {\n return false;\n }\n var partList = levelDetails.partList;\n // Since the last part isn't guaranteed to correspond to the last playlist segment for Low-Latency HLS,\n // check instead if the last part is buffered.\n if (partList != null && partList.length) {\n var lastPart = partList[partList.length - 1];\n\n // Checking the midpoint of the part for potential margin of error and related issues.\n // NOTE: Technically I believe parts could yield content that is < the computed duration (including potential a duration of 0)\n // and still be spec-compliant, so there may still be edge cases here. Likewise, there could be issues in end of stream\n // part mismatches for independent audio and video playlists/segments.\n var lastPartBuffered = BufferHelper.isBuffered(this.media, lastPart.start + lastPart.duration / 2);\n return lastPartBuffered;\n }\n var playlistType = levelDetails.fragments[levelDetails.fragments.length - 1].type;\n return this.fragmentTracker.isEndListAppended(playlistType);\n };\n _proto.getLevelDetails = function getLevelDetails() {\n if (this.levels && this.levelLastLoaded !== null) {\n var _this$levels$this$lev;\n return (_this$levels$this$lev = this.levels[this.levelLastLoaded]) == null ? void 0 : _this$levels$this$lev.details;\n }\n };\n _proto.onMediaAttached = function onMediaAttached(event, data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n if (this.levels && config.autoStartLoad && this.state === State.STOPPED) {\n this.startLoad(config.startPosition);\n }\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media != null && media.ended) {\n this.log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // remove video listeners\n if (media && this.onvseeking && this.onvended) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvended = null;\n }\n if (this.keyLoader) {\n this.keyLoader.detach();\n }\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.fragmentTracker.removeAllFragments();\n this.stopLoad();\n };\n _proto.onMediaSeeking = function onMediaSeeking() {\n var config = this.config,\n fragCurrent = this.fragCurrent,\n media = this.media,\n mediaBuffer = this.mediaBuffer,\n state = this.state;\n var currentTime = media ? media.currentTime : 0;\n var bufferInfo = BufferHelper.bufferInfo(mediaBuffer ? mediaBuffer : media, currentTime, config.maxBufferHole);\n this.log(\"media seeking to \" + (isFiniteNumber(currentTime) ? currentTime.toFixed(3) : currentTime) + \", state: \" + state);\n if (this.state === State.ENDED) {\n this.resetLoadingState();\n } else if (fragCurrent) {\n // Seeking while frag load is in progress\n var tolerance = config.maxFragLookUpTolerance;\n var fragStartOffset = fragCurrent.start - tolerance;\n var fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance;\n // if seeking out of buffered range or into new one\n if (!bufferInfo.len || fragEndOffset < bufferInfo.start || fragStartOffset > bufferInfo.end) {\n var pastFragment = currentTime > fragEndOffset;\n // if the seek position is outside the current fragment range\n if (currentTime < fragStartOffset || pastFragment) {\n if (pastFragment && fragCurrent.loader) {\n this.log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.abortRequests();\n this.resetLoadingState();\n }\n this.fragPrevious = null;\n }\n }\n }\n if (media) {\n // Remove gap fragments\n this.fragmentTracker.removeFragmentsInRange(currentTime, Infinity, this.playlistType, true);\n this.lastCurrentTime = currentTime;\n }\n\n // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n if (!this.loadedmetadata && !bufferInfo.len) {\n this.nextLoadPosition = this.startPosition = currentTime;\n }\n\n // Async tick to speed up processing\n this.tickImmediate();\n };\n _proto.onMediaEnded = function onMediaEnded() {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n _proto.onManifestLoaded = function onManifestLoaded(event, data) {\n this.startTimeOffset = data.startTimeOffset;\n this.initPTS = [];\n };\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this.stopLoad();\n _TaskLoop.prototype.onHandlerDestroying.call(this);\n };\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {\n this.state = State.STOPPED;\n if (this.fragmentLoader) {\n this.fragmentLoader.destroy();\n }\n if (this.keyLoader) {\n this.keyLoader.destroy();\n }\n if (this.decrypter) {\n this.decrypter.destroy();\n }\n this.hls = this.log = this.warn = this.decrypter = this.keyLoader = this.fragmentLoader = this.fragmentTracker = null;\n _TaskLoop.prototype.onHandlerDestroyed.call(this);\n };\n _proto.loadFragment = function loadFragment(frag, level, targetBufferTime) {\n this._loadFragForPlayback(frag, level, targetBufferTime);\n };\n _proto._loadFragForPlayback = function _loadFragForPlayback(frag, level, targetBufferTime) {\n var _this2 = this;\n var progressCallback = function progressCallback(data) {\n if (_this2.fragContextChanged(frag)) {\n _this2.warn(\"Fragment \" + frag.sn + (data.part ? ' p: ' + data.part.index : '') + \" of level \" + frag.level + \" was dropped during download.\");\n _this2.fragmentTracker.removeFragment(frag);\n return;\n }\n frag.stats.chunkCount++;\n _this2._handleFragmentLoadProgress(data);\n };\n this._doFragLoad(frag, level, targetBufferTime, progressCallback).then(function (data) {\n if (!data) {\n // if we're here we probably needed to backtrack or are waiting for more parts\n return;\n }\n var state = _this2.state;\n if (_this2.fragContextChanged(frag)) {\n if (state === State.FRAG_LOADING || !_this2.fragCurrent && state === State.PARSING) {\n _this2.fragmentTracker.removeFragment(frag);\n _this2.state = State.IDLE;\n }\n return;\n }\n if ('payload' in data) {\n _this2.log(\"Loaded fragment \" + frag.sn + \" of level \" + frag.level);\n _this2.hls.trigger(Events.FRAG_LOADED, data);\n }\n\n // Pass through the whole payload; controllers not implementing progressive loading receive data from this callback\n _this2._handleFragmentLoadComplete(data);\n }).catch(function (reason) {\n if (_this2.state === State.STOPPED || _this2.state === State.ERROR) {\n return;\n }\n _this2.warn(reason);\n _this2.resetFragmentLoading(frag);\n });\n };\n _proto.clearTrackerIfNeeded = function clearTrackerIfNeeded(frag) {\n var _this$mediaBuffer;\n var fragmentTracker = this.fragmentTracker;\n var fragState = fragmentTracker.getState(frag);\n if (fragState === FragmentState.APPENDING) {\n // Lower the buffer size and try again\n var playlistType = frag.type;\n var bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);\n var minForwardBufferLength = Math.max(frag.duration, bufferedInfo ? bufferedInfo.len : this.config.maxBufferLength);\n if (this.reduceMaxBufferLength(minForwardBufferLength)) {\n fragmentTracker.removeFragment(frag);\n }\n } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {\n // Stop gap for bad tracker / buffer flush behavior\n fragmentTracker.removeAllFragments();\n } else if (fragmentTracker.hasParts(frag.type)) {\n // In low latency mode, remove fragments for which only some parts were buffered\n fragmentTracker.detectPartialFragments({\n frag: frag,\n part: null,\n stats: frag.stats,\n id: frag.type\n });\n if (fragmentTracker.getState(frag) === FragmentState.PARTIAL) {\n fragmentTracker.removeFragment(frag);\n }\n }\n };\n _proto.checkLiveUpdate = function checkLiveUpdate(details) {\n if (details.updated && !details.live) {\n // Live stream ended, update fragment tracker\n var lastFragment = details.fragments[details.fragments.length - 1];\n this.fragmentTracker.detectPartialFragments({\n frag: lastFragment,\n part: null,\n stats: lastFragment.stats,\n id: lastFragment.type\n });\n }\n if (!details.fragments[0]) {\n details.deltaUpdateFailed = true;\n }\n };\n _proto.flushMainBuffer = function flushMainBuffer(startOffset, endOffset, type) {\n if (type === void 0) {\n type = null;\n }\n if (!(startOffset - endOffset)) {\n return;\n }\n // When alternate audio is playing, the audio-stream-controller is responsible for the audio buffer. Otherwise,\n // passing a null type flushes both buffers\n var flushScope = {\n startOffset: startOffset,\n endOffset: endOffset,\n type: type\n };\n this.hls.trigger(Events.BUFFER_FLUSHING, flushScope);\n };\n _proto._loadInitSegment = function _loadInitSegment(frag, level) {\n var _this3 = this;\n this._doFragLoad(frag, level).then(function (data) {\n if (!data || _this3.fragContextChanged(frag) || !_this3.levels) {\n throw new Error('init load aborted');\n }\n return data;\n }).then(function (data) {\n var hls = _this3.hls;\n var payload = data.payload;\n var decryptData = frag.decryptdata;\n\n // check to see if the payload needs to be decrypted\n if (payload && payload.byteLength > 0 && decryptData && decryptData.key && decryptData.iv && decryptData.method === 'AES-128') {\n var startTime = self.performance.now();\n // decrypt init segment data\n return _this3.decrypter.decrypt(new Uint8Array(payload), decryptData.key.buffer, decryptData.iv.buffer).catch(function (err) {\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_DECRYPT_ERROR,\n fatal: false,\n error: err,\n reason: err.message,\n frag: frag\n });\n throw err;\n }).then(function (decryptedData) {\n var endTime = self.performance.now();\n hls.trigger(Events.FRAG_DECRYPTED, {\n frag: frag,\n payload: decryptedData,\n stats: {\n tstart: startTime,\n tdecrypt: endTime\n }\n });\n data.payload = decryptedData;\n return data;\n });\n }\n return data;\n }).then(function (data) {\n var fragCurrent = _this3.fragCurrent,\n hls = _this3.hls,\n levels = _this3.levels;\n if (!levels) {\n throw new Error('init load aborted, missing levels');\n }\n var stats = frag.stats;\n _this3.state = State.IDLE;\n level.fragmentError = 0;\n frag.data = new Uint8Array(data.payload);\n stats.parsing.start = stats.buffering.start = self.performance.now();\n stats.parsing.end = stats.buffering.end = self.performance.now();\n\n // Silence FRAG_BUFFERED event if fragCurrent is null\n if (data.frag === fragCurrent) {\n hls.trigger(Events.FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n part: null,\n id: frag.type\n });\n }\n _this3.tick();\n }).catch(function (reason) {\n if (_this3.state === State.STOPPED || _this3.state === State.ERROR) {\n return;\n }\n _this3.warn(reason);\n _this3.resetFragmentLoading(frag);\n });\n };\n _proto.fragContextChanged = function fragContextChanged(frag) {\n var fragCurrent = this.fragCurrent;\n return !frag || !fragCurrent || frag.level !== fragCurrent.level || frag.sn !== fragCurrent.sn || frag.urlId !== fragCurrent.urlId;\n };\n _proto.fragBufferedComplete = function fragBufferedComplete(frag, part) {\n var _frag$startPTS, _frag$endPTS, _this$fragCurrent, _this$fragPrevious;\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n this.log(\"Buffered \" + frag.type + \" sn: \" + frag.sn + (part ? ' part: ' + part.index : '') + \" of \" + (this.playlistType === PlaylistLevelType.MAIN ? 'level' : 'track') + \" \" + frag.level + \" (frag:[\" + ((_frag$startPTS = frag.startPTS) != null ? _frag$startPTS : NaN).toFixed(3) + \"-\" + ((_frag$endPTS = frag.endPTS) != null ? _frag$endPTS : NaN).toFixed(3) + \"] > buffer:\" + (media ? TimeRanges.toString(BufferHelper.getBuffered(media)) : '(detached)') + \")\");\n this.state = State.IDLE;\n if (!media) {\n return;\n }\n if (!this.loadedmetadata && frag.type == PlaylistLevelType.MAIN && media.buffered.length && ((_this$fragCurrent = this.fragCurrent) == null ? void 0 : _this$fragCurrent.sn) === ((_this$fragPrevious = this.fragPrevious) == null ? void 0 : _this$fragPrevious.sn)) {\n this.loadedmetadata = true;\n this.seekToStartPos();\n }\n this.tick();\n };\n _proto.seekToStartPos = function seekToStartPos() {};\n _proto._handleFragmentLoadComplete = function _handleFragmentLoadComplete(fragLoadedEndData) {\n var transmuxer = this.transmuxer;\n if (!transmuxer) {\n return;\n }\n var frag = fragLoadedEndData.frag,\n part = fragLoadedEndData.part,\n partsLoaded = fragLoadedEndData.partsLoaded;\n // If we did not load parts, or loaded all parts, we have complete (not partial) fragment data\n var complete = !partsLoaded || partsLoaded.length === 0 || partsLoaded.some(function (fragLoaded) {\n return !fragLoaded;\n });\n var chunkMeta = new ChunkMetadata(frag.level, frag.sn, frag.stats.chunkCount + 1, 0, part ? part.index : -1, !complete);\n transmuxer.flush(chunkMeta);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ;\n _proto._handleFragmentLoadProgress = function _handleFragmentLoadProgress(frag) {};\n _proto._doFragLoad = function _doFragLoad(frag, level, targetBufferTime, progressCallback) {\n var _frag$decryptdata,\n _this4 = this;\n if (targetBufferTime === void 0) {\n targetBufferTime = null;\n }\n var details = level == null ? void 0 : level.details;\n if (!this.levels || !details) {\n throw new Error(\"frag load aborted, missing level\" + (details ? '' : ' detail') + \"s\");\n }\n var keyLoadingPromise = null;\n if (frag.encrypted && !((_frag$decryptdata = frag.decryptdata) != null && _frag$decryptdata.key)) {\n this.log(\"Loading key for \" + frag.sn + \" of [\" + details.startSN + \"-\" + details.endSN + \"], \" + (this.logPrefix === '[stream-controller]' ? 'level' : 'track') + \" \" + frag.level);\n this.state = State.KEY_LOADING;\n this.fragCurrent = frag;\n keyLoadingPromise = this.keyLoader.load(frag).then(function (keyLoadedData) {\n if (!_this4.fragContextChanged(keyLoadedData.frag)) {\n _this4.hls.trigger(Events.KEY_LOADED, keyLoadedData);\n if (_this4.state === State.KEY_LOADING) {\n _this4.state = State.IDLE;\n }\n return keyLoadedData;\n }\n });\n this.hls.trigger(Events.KEY_LOADING, {\n frag: frag\n });\n if (this.fragCurrent === null) {\n keyLoadingPromise = Promise.reject(new Error(\"frag load aborted, context changed in KEY_LOADING\"));\n }\n } else if (!frag.encrypted && details.encryptedFragments.length) {\n this.keyLoader.loadClear(frag, details.encryptedFragments);\n }\n targetBufferTime = Math.max(frag.start, targetBufferTime || 0);\n if (this.config.lowLatencyMode && frag.sn !== 'initSegment') {\n var partList = details.partList;\n if (partList && progressCallback) {\n if (targetBufferTime > frag.end && details.fragmentHint) {\n frag = details.fragmentHint;\n }\n var partIndex = this.getNextPart(partList, frag, targetBufferTime);\n if (partIndex > -1) {\n var part = partList[partIndex];\n this.log(\"Loading part sn: \" + frag.sn + \" p: \" + part.index + \" cc: \" + frag.cc + \" of playlist [\" + details.startSN + \"-\" + details.endSN + \"] parts [0-\" + partIndex + \"-\" + (partList.length - 1) + \"] \" + (this.logPrefix === '[stream-controller]' ? 'level' : 'track') + \": \" + frag.level + \", target: \" + parseFloat(targetBufferTime.toFixed(3)));\n this.nextLoadPosition = part.start + part.duration;\n this.state = State.FRAG_LOADING;\n var _result;\n if (keyLoadingPromise) {\n _result = keyLoadingPromise.then(function (keyLoadedData) {\n if (!keyLoadedData || _this4.fragContextChanged(keyLoadedData.frag)) {\n return null;\n }\n return _this4.doFragPartsLoad(frag, part, level, progressCallback);\n }).catch(function (error) {\n return _this4.handleFragLoadError(error);\n });\n } else {\n _result = this.doFragPartsLoad(frag, part, level, progressCallback).catch(function (error) {\n return _this4.handleFragLoadError(error);\n });\n }\n this.hls.trigger(Events.FRAG_LOADING, {\n frag: frag,\n part: part,\n targetBufferTime: targetBufferTime\n });\n if (this.fragCurrent === null) {\n return Promise.reject(new Error(\"frag load aborted, context changed in FRAG_LOADING parts\"));\n }\n return _result;\n } else if (!frag.url || this.loadedEndOfParts(partList, targetBufferTime)) {\n // Fragment hint has no parts\n return Promise.resolve(null);\n }\n }\n }\n this.log(\"Loading fragment \" + frag.sn + \" cc: \" + frag.cc + \" \" + (details ? 'of [' + details.startSN + '-' + details.endSN + '] ' : '') + (this.logPrefix === '[stream-controller]' ? 'level' : 'track') + \": \" + frag.level + \", target: \" + parseFloat(targetBufferTime.toFixed(3)));\n // Don't update nextLoadPosition for fragments which are not buffered\n if (isFiniteNumber(frag.sn) && !this.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n this.state = State.FRAG_LOADING;\n\n // Load key before streaming fragment data\n var dataOnProgress = this.config.progressive;\n var result;\n if (dataOnProgress && keyLoadingPromise) {\n result = keyLoadingPromise.then(function (keyLoadedData) {\n if (!keyLoadedData || _this4.fragContextChanged(keyLoadedData == null ? void 0 : keyLoadedData.frag)) {\n return null;\n }\n return _this4.fragmentLoader.load(frag, progressCallback);\n }).catch(function (error) {\n return _this4.handleFragLoadError(error);\n });\n } else {\n // load unencrypted fragment data with progress event,\n // or handle fragment result after key and fragment are finished loading\n result = Promise.all([this.fragmentLoader.load(frag, dataOnProgress ? progressCallback : undefined), keyLoadingPromise]).then(function (_ref) {\n var fragLoadedData = _ref[0];\n if (!dataOnProgress && fragLoadedData && progressCallback) {\n progressCallback(fragLoadedData);\n }\n return fragLoadedData;\n }).catch(function (error) {\n return _this4.handleFragLoadError(error);\n });\n }\n this.hls.trigger(Events.FRAG_LOADING, {\n frag: frag,\n targetBufferTime: targetBufferTime\n });\n if (this.fragCurrent === null) {\n return Promise.reject(new Error(\"frag load aborted, context changed in FRAG_LOADING\"));\n }\n return result;\n };\n _proto.doFragPartsLoad = function doFragPartsLoad(frag, fromPart, level, progressCallback) {\n var _this5 = this;\n return new Promise(function (resolve, reject) {\n var _level$details;\n var partsLoaded = [];\n var initialPartList = (_level$details = level.details) == null ? void 0 : _level$details.partList;\n var loadPart = function loadPart(part) {\n _this5.fragmentLoader.loadPart(frag, part, progressCallback).then(function (partLoadedData) {\n partsLoaded[part.index] = partLoadedData;\n var loadedPart = partLoadedData.part;\n _this5.hls.trigger(Events.FRAG_LOADED, partLoadedData);\n var nextPart = getPartWith(level, frag.sn, part.index + 1) || findPart(initialPartList, frag.sn, part.index + 1);\n if (nextPart) {\n loadPart(nextPart);\n } else {\n return resolve({\n frag: frag,\n part: loadedPart,\n partsLoaded: partsLoaded\n });\n }\n }).catch(reject);\n };\n loadPart(fromPart);\n });\n };\n _proto.handleFragLoadError = function handleFragLoadError(error) {\n if ('data' in error) {\n var data = error.data;\n if (error.data && data.details === ErrorDetails.INTERNAL_ABORTED) {\n this.handleFragLoadAborted(data.frag, data.part);\n } else {\n this.hls.trigger(Events.ERROR, data);\n }\n } else {\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.OTHER_ERROR,\n details: ErrorDetails.INTERNAL_EXCEPTION,\n err: error,\n error: error,\n fatal: true\n });\n }\n return null;\n };\n _proto._handleTransmuxerFlush = function _handleTransmuxerFlush(chunkMeta) {\n var context = this.getCurrentContext(chunkMeta);\n if (!context || this.state !== State.PARSING) {\n if (!this.fragCurrent && this.state !== State.STOPPED && this.state !== State.ERROR) {\n this.state = State.IDLE;\n }\n return;\n }\n var frag = context.frag,\n part = context.part,\n level = context.level;\n var now = self.performance.now();\n frag.stats.parsing.end = now;\n if (part) {\n part.stats.parsing.end = now;\n }\n this.updateLevelTiming(frag, part, level, chunkMeta.partial);\n };\n _proto.getCurrentContext = function getCurrentContext(chunkMeta) {\n var levels = this.levels,\n fragCurrent = this.fragCurrent;\n var levelIndex = chunkMeta.level,\n sn = chunkMeta.sn,\n partIndex = chunkMeta.part;\n if (!(levels != null && levels[levelIndex])) {\n this.warn(\"Levels object was unset while buffering fragment \" + sn + \" of level \" + levelIndex + \". The current chunk will not be buffered.\");\n return null;\n }\n var level = levels[levelIndex];\n var part = partIndex > -1 ? getPartWith(level, sn, partIndex) : null;\n var frag = part ? part.fragment : getFragmentWithSN(level, sn, fragCurrent);\n if (!frag) {\n return null;\n }\n if (fragCurrent && fragCurrent !== frag) {\n frag.stats = fragCurrent.stats;\n }\n return {\n frag: frag,\n part: part,\n level: level\n };\n };\n _proto.bufferFragmentData = function bufferFragmentData(data, frag, part, chunkMeta, noBacktracking) {\n var _buffer;\n if (!data || this.state !== State.PARSING) {\n return;\n }\n var data1 = data.data1,\n data2 = data.data2;\n var buffer = data1;\n if (data1 && data2) {\n // Combine the moof + mdat so that we buffer with a single append\n buffer = appendUint8Array(data1, data2);\n }\n if (!((_buffer = buffer) != null && _buffer.length)) {\n return;\n }\n var segment = {\n type: data.type,\n frag: frag,\n part: part,\n chunkMeta: chunkMeta,\n parent: frag.type,\n data: buffer\n };\n this.hls.trigger(Events.BUFFER_APPENDING, segment);\n if (data.dropped && data.independent && !part) {\n if (noBacktracking) {\n return;\n }\n // Clear buffer so that we reload previous segments sequentially if required\n this.flushBufferGap(frag);\n }\n };\n _proto.flushBufferGap = function flushBufferGap(frag) {\n var media = this.media;\n if (!media) {\n return;\n }\n // If currentTime is not buffered, clear the back buffer so that we can backtrack as much as needed\n if (!BufferHelper.isBuffered(media, media.currentTime)) {\n this.flushMainBuffer(0, frag.start);\n return;\n }\n // Remove back-buffer without interrupting playback to allow back tracking\n var currentTime = media.currentTime;\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var fragDuration = frag.duration;\n var segmentFraction = Math.min(this.config.maxFragLookUpTolerance * 2, fragDuration * 0.25);\n var start = Math.max(Math.min(frag.start - segmentFraction, bufferInfo.end - segmentFraction), currentTime + segmentFraction);\n if (frag.start - start > segmentFraction) {\n this.flushMainBuffer(start, frag.start);\n }\n };\n _proto.getFwdBufferInfo = function getFwdBufferInfo(bufferable, type) {\n var pos = this.getLoadPosition();\n if (!isFiniteNumber(pos)) {\n return null;\n }\n return this.getFwdBufferInfoAtPos(bufferable, pos, type);\n };\n _proto.getFwdBufferInfoAtPos = function getFwdBufferInfoAtPos(bufferable, pos, type) {\n var maxBufferHole = this.config.maxBufferHole;\n var bufferInfo = BufferHelper.bufferInfo(bufferable, pos, maxBufferHole);\n // Workaround flaw in getting forward buffer when maxBufferHole is smaller than gap at current pos\n if (bufferInfo.len === 0 && bufferInfo.nextStart !== undefined) {\n var bufferedFragAtPos = this.fragmentTracker.getBufferedFrag(pos, type);\n if (bufferedFragAtPos && bufferInfo.nextStart < bufferedFragAtPos.end) {\n return BufferHelper.bufferInfo(bufferable, pos, Math.max(bufferInfo.nextStart, maxBufferHole));\n }\n }\n return bufferInfo;\n };\n _proto.getMaxBufferLength = function getMaxBufferLength(levelBitrate) {\n var config = this.config;\n var maxBufLen;\n if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n return Math.min(maxBufLen, config.maxMaxBufferLength);\n };\n _proto.reduceMaxBufferLength = function reduceMaxBufferLength(threshold) {\n var config = this.config;\n var minLength = threshold || config.maxBufferLength;\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n this.warn(\"Reduce max buffer length to \" + config.maxMaxBufferLength + \"s\");\n return true;\n }\n return false;\n };\n _proto.getAppendedFrag = function getAppendedFrag(position, playlistType) {\n var fragOrPart = this.fragmentTracker.getAppendedFrag(position, PlaylistLevelType.MAIN);\n if (fragOrPart && 'fragment' in fragOrPart) {\n return fragOrPart.fragment;\n }\n return fragOrPart;\n };\n _proto.getNextFragment = function getNextFragment(pos, levelDetails) {\n var fragments = levelDetails.fragments;\n var fragLen = fragments.length;\n if (!fragLen) {\n return null;\n }\n\n // find fragment index, contiguous with end of buffer position\n var config = this.config;\n var start = fragments[0].start;\n var frag;\n if (levelDetails.live) {\n var initialLiveManifestSize = config.initialLiveManifestSize;\n if (fragLen < initialLiveManifestSize) {\n this.warn(\"Not enough fragments to start playback (have: \" + fragLen + \", need: \" + initialLiveManifestSize + \")\");\n return null;\n }\n // The real fragment start times for a live stream are only known after the PTS range for that level is known.\n // In order to discover the range, we load the best matching fragment for that level and demux it.\n // Do not load using live logic if the starting frag is requested - we want to use getFragmentAtPosition() so that\n // we get the fragment matching that start time\n if (!levelDetails.PTSKnown && !this.startFragRequested && this.startPosition === -1) {\n frag = this.getInitialLiveFragment(levelDetails, fragments);\n this.startPosition = frag ? this.hls.liveSyncPosition || frag.start : pos;\n }\n } else if (pos <= start) {\n // VoD playlist: if loadPosition before start of playlist, load first fragment\n frag = fragments[0];\n }\n\n // If we haven't run into any special cases already, just load the fragment most closely matching the requested position\n if (!frag) {\n var end = config.lowLatencyMode ? levelDetails.partEnd : levelDetails.fragmentEnd;\n frag = this.getFragmentAtPosition(pos, end, levelDetails);\n }\n return this.mapToInitFragWhenRequired(frag);\n };\n _proto.isLoopLoading = function isLoopLoading(frag, targetBufferTime) {\n var trackerState = this.fragmentTracker.getState(frag);\n return (trackerState === FragmentState.OK || trackerState === FragmentState.PARTIAL && !!frag.gap) && this.nextLoadPosition > targetBufferTime;\n };\n _proto.getNextFragmentLoopLoading = function getNextFragmentLoopLoading(frag, levelDetails, bufferInfo, playlistType, maxBufLen) {\n var gapStart = frag.gap;\n var nextFragment = this.getNextFragment(this.nextLoadPosition, levelDetails);\n if (nextFragment === null) {\n return nextFragment;\n }\n frag = nextFragment;\n if (gapStart && frag && !frag.gap && bufferInfo.nextStart) {\n // Media buffered after GAP tags should not make the next buffer timerange exceed forward buffer length\n var nextbufferInfo = this.getFwdBufferInfoAtPos(this.mediaBuffer ? this.mediaBuffer : this.media, bufferInfo.nextStart, playlistType);\n if (nextbufferInfo !== null && bufferInfo.len + nextbufferInfo.len >= maxBufLen) {\n // Returning here might result in not finding an audio and video candiate to skip to\n this.log(\"buffer full after gaps in \\\"\" + playlistType + \"\\\" playlist starting at sn: \" + frag.sn);\n return null;\n }\n }\n return frag;\n };\n _proto.mapToInitFragWhenRequired = function mapToInitFragWhenRequired(frag) {\n // If an initSegment is present, it must be buffered first\n if (frag != null && frag.initSegment && !(frag != null && frag.initSegment.data) && !this.bitrateTest) {\n return frag.initSegment;\n }\n return frag;\n };\n _proto.getNextPart = function getNextPart(partList, frag, targetBufferTime) {\n var nextPart = -1;\n var contiguous = false;\n var independentAttrOmitted = true;\n for (var i = 0, len = partList.length; i < len; i++) {\n var part = partList[i];\n independentAttrOmitted = independentAttrOmitted && !part.independent;\n if (nextPart > -1 && targetBufferTime < part.start) {\n break;\n }\n var loaded = part.loaded;\n if (loaded) {\n nextPart = -1;\n } else if ((contiguous || part.independent || independentAttrOmitted) && part.fragment === frag) {\n nextPart = i;\n }\n contiguous = loaded;\n }\n return nextPart;\n };\n _proto.loadedEndOfParts = function loadedEndOfParts(partList, targetBufferTime) {\n var lastPart = partList[partList.length - 1];\n return lastPart && targetBufferTime > lastPart.start && lastPart.loaded;\n }\n\n /*\n This method is used find the best matching first fragment for a live playlist. This fragment is used to calculate the\n \"sliding\" of the playlist, which is its offset from the start of playback. After sliding we can compute the real\n start and end times for each fragment in the playlist (after which this method will not need to be called).\n */;\n _proto.getInitialLiveFragment = function getInitialLiveFragment(levelDetails, fragments) {\n var fragPrevious = this.fragPrevious;\n var frag = null;\n if (fragPrevious) {\n if (levelDetails.hasProgramDateTime) {\n // Prefer using PDT, because it can be accurate enough to choose the correct fragment without knowing the level sliding\n this.log(\"Live playlist, switching playlist, load frag with same PDT: \" + fragPrevious.programDateTime);\n frag = findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, this.config.maxFragLookUpTolerance);\n }\n if (!frag) {\n // SN does not need to be accurate between renditions, but depending on the packaging it may be so.\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n // Ensure that we're staying within the continuity range, since PTS resets upon a new range\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n this.log(\"Live playlist, switching playlist, load frag with next SN: \" + frag.sn);\n }\n }\n // It's important to stay within the continuity range if available; otherwise the fragments in the playlist\n // will have the wrong start times\n if (!frag) {\n frag = findFragWithCC(fragments, fragPrevious.cc);\n if (frag) {\n this.log(\"Live playlist, switching playlist, load frag with same CC: \" + frag.sn);\n }\n }\n }\n } else {\n // Find a new start fragment when fragPrevious is null\n var liveStart = this.hls.liveSyncPosition;\n if (liveStart !== null) {\n frag = this.getFragmentAtPosition(liveStart, this.bitrateTest ? levelDetails.fragmentEnd : levelDetails.edge, levelDetails);\n }\n }\n return frag;\n }\n\n /*\n This method finds the best matching fragment given the provided position.\n */;\n _proto.getFragmentAtPosition = function getFragmentAtPosition(bufferEnd, end, levelDetails) {\n var config = this.config;\n var fragPrevious = this.fragPrevious;\n var fragments = levelDetails.fragments,\n endSN = levelDetails.endSN;\n var fragmentHint = levelDetails.fragmentHint;\n var tolerance = config.maxFragLookUpTolerance;\n var partList = levelDetails.partList;\n var loadingParts = !!(config.lowLatencyMode && partList != null && partList.length && fragmentHint);\n if (loadingParts && fragmentHint && !this.bitrateTest) {\n // Include incomplete fragment with parts at end\n fragments = fragments.concat(fragmentHint);\n endSN = fragmentHint.sn;\n }\n var frag;\n if (bufferEnd < end) {\n var lookupTolerance = bufferEnd > end - tolerance ? 0 : tolerance;\n // Remove the tolerance if it would put the bufferEnd past the actual end of stream\n // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)\n frag = findFragmentByPTS(fragPrevious, fragments, bufferEnd, lookupTolerance);\n } else {\n // reach end of playlist\n frag = fragments[fragments.length - 1];\n }\n if (frag) {\n var curSNIdx = frag.sn - levelDetails.startSN;\n // Move fragPrevious forward to support forcing the next fragment to load\n // when the buffer catches up to a previously buffered range.\n var fragState = this.fragmentTracker.getState(frag);\n if (fragState === FragmentState.OK || fragState === FragmentState.PARTIAL && frag.gap) {\n fragPrevious = frag;\n }\n if (fragPrevious && frag.sn === fragPrevious.sn && (!loadingParts || partList[0].fragment.sn > frag.sn)) {\n // Force the next fragment to load if the previous one was already selected. This can occasionally happen with\n // non-uniform fragment durations\n var sameLevel = fragPrevious && frag.level === fragPrevious.level;\n if (sameLevel) {\n var nextFrag = fragments[curSNIdx + 1];\n if (frag.sn < endSN && this.fragmentTracker.getState(nextFrag) !== FragmentState.OK) {\n frag = nextFrag;\n } else {\n frag = null;\n }\n }\n }\n }\n return frag;\n };\n _proto.synchronizeToLiveEdge = function synchronizeToLiveEdge(levelDetails) {\n var config = this.config,\n media = this.media;\n if (!media) {\n return;\n }\n var liveSyncPosition = this.hls.liveSyncPosition;\n var currentTime = media.currentTime;\n var start = levelDetails.fragments[0].start;\n var end = levelDetails.edge;\n var withinSlidingWindow = currentTime >= start - config.maxFragLookUpTolerance && currentTime <= end;\n // Continue if we can seek forward to sync position or if current time is outside of sliding window\n if (liveSyncPosition !== null && media.duration > liveSyncPosition && (currentTime < liveSyncPosition || !withinSlidingWindow)) {\n // Continue if buffer is starving or if current time is behind max latency\n var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n if (!withinSlidingWindow && media.readyState < 4 || currentTime < end - maxLatency) {\n if (!this.loadedmetadata) {\n this.nextLoadPosition = liveSyncPosition;\n }\n // Only seek if ready and there is not a significant forward buffer available for playback\n if (media.readyState) {\n this.warn(\"Playback: \" + currentTime.toFixed(3) + \" is located too far from the end of live sliding playlist: \" + end + \", reset currentTime to : \" + liveSyncPosition.toFixed(3));\n media.currentTime = liveSyncPosition;\n }\n }\n }\n };\n _proto.alignPlaylists = function alignPlaylists(details, previousDetails) {\n var levels = this.levels,\n levelLastLoaded = this.levelLastLoaded,\n fragPrevious = this.fragPrevious;\n var lastLevel = levelLastLoaded !== null ? levels[levelLastLoaded] : null;\n\n // FIXME: If not for `shouldAlignOnDiscontinuities` requiring fragPrevious.cc,\n // this could all go in level-helper mergeDetails()\n var length = details.fragments.length;\n if (!length) {\n this.warn(\"No fragments in live playlist\");\n return 0;\n }\n var slidingStart = details.fragments[0].start;\n var firstLevelLoad = !previousDetails;\n var aligned = details.alignedSliding && isFiniteNumber(slidingStart);\n if (firstLevelLoad || !aligned && !slidingStart) {\n alignStream(fragPrevious, lastLevel, details);\n var alignedSlidingStart = details.fragments[0].start;\n this.log(\"Live playlist sliding: \" + alignedSlidingStart.toFixed(2) + \" start-sn: \" + (previousDetails ? previousDetails.startSN : 'na') + \"->\" + details.startSN + \" prev-sn: \" + (fragPrevious ? fragPrevious.sn : 'na') + \" fragments: \" + length);\n return alignedSlidingStart;\n }\n return slidingStart;\n };\n _proto.waitForCdnTuneIn = function waitForCdnTuneIn(details) {\n // Wait for Low-Latency CDN Tune-in to get an updated playlist\n var advancePartLimit = 3;\n return details.live && details.canBlockReload && details.partTarget && details.tuneInGoal > Math.max(details.partHoldBack, details.partTarget * advancePartLimit);\n };\n _proto.setStartPosition = function setStartPosition(details, sliding) {\n // compute start position if set to -1. use it straight away if value is defined\n var startPosition = this.startPosition;\n if (startPosition < sliding) {\n startPosition = -1;\n }\n if (startPosition === -1 || this.lastCurrentTime === -1) {\n // Use Playlist EXT-X-START:TIME-OFFSET when set\n // Prioritize Multivariant Playlist offset so that main, audio, and subtitle stream-controller start times match\n var offsetInMultivariantPlaylist = this.startTimeOffset !== null;\n var startTimeOffset = offsetInMultivariantPlaylist ? this.startTimeOffset : details.startTimeOffset;\n if (startTimeOffset !== null && isFiniteNumber(startTimeOffset)) {\n startPosition = sliding + startTimeOffset;\n if (startTimeOffset < 0) {\n startPosition += details.totalduration;\n }\n startPosition = Math.min(Math.max(sliding, startPosition), sliding + details.totalduration);\n this.log(\"Start time offset \" + startTimeOffset + \" found in \" + (offsetInMultivariantPlaylist ? 'multivariant' : 'media') + \" playlist, adjust startPosition to \" + startPosition);\n this.startPosition = startPosition;\n } else if (details.live) {\n // Leave this.startPosition at -1, so that we can use `getInitialLiveFragment` logic when startPosition has\n // not been specified via the config or an as an argument to startLoad (#3736).\n startPosition = this.hls.liveSyncPosition || sliding;\n } else {\n this.startPosition = startPosition = 0;\n }\n this.lastCurrentTime = startPosition;\n }\n this.nextLoadPosition = startPosition;\n };\n _proto.getLoadPosition = function getLoadPosition() {\n var media = this.media;\n // if we have not yet loaded any fragment, start loading from start position\n var pos = 0;\n if (this.loadedmetadata && media) {\n pos = media.currentTime;\n } else if (this.nextLoadPosition) {\n pos = this.nextLoadPosition;\n }\n return pos;\n };\n _proto.handleFragLoadAborted = function handleFragLoadAborted(frag, part) {\n if (this.transmuxer && frag.sn !== 'initSegment' && frag.stats.aborted) {\n this.warn(\"Fragment \" + frag.sn + (part ? ' part ' + part.index : '') + \" of level \" + frag.level + \" was aborted\");\n this.resetFragmentLoading(frag);\n }\n };\n _proto.resetFragmentLoading = function resetFragmentLoading(frag) {\n if (!this.fragCurrent || !this.fragContextChanged(frag) && this.state !== State.FRAG_LOADING_WAITING_RETRY) {\n this.state = State.IDLE;\n }\n };\n _proto.onFragmentOrKeyLoadError = function onFragmentOrKeyLoadError(filterType, data) {\n if (data.chunkMeta && !data.frag) {\n var context = this.getCurrentContext(data.chunkMeta);\n if (context) {\n data.frag = context.frag;\n }\n }\n var frag = data.frag;\n // Handle frag error related to caller's filterType\n if (!frag || frag.type !== filterType || !this.levels) {\n return;\n }\n if (this.fragContextChanged(frag)) {\n var _this$fragCurrent2;\n this.warn(\"Frag load error must match current frag to retry \" + frag.url + \" > \" + ((_this$fragCurrent2 = this.fragCurrent) == null ? void 0 : _this$fragCurrent2.url));\n return;\n }\n var gapTagEncountered = data.details === ErrorDetails.FRAG_GAP;\n if (gapTagEncountered) {\n this.fragmentTracker.fragBuffered(frag, true);\n }\n // keep retrying until the limit will be reached\n var errorAction = data.errorAction;\n var _ref2 = errorAction || {},\n action = _ref2.action,\n _ref2$retryCount = _ref2.retryCount,\n retryCount = _ref2$retryCount === void 0 ? 0 : _ref2$retryCount,\n retryConfig = _ref2.retryConfig;\n if (errorAction && action === NetworkErrorAction.RetryRequest && retryConfig) {\n var _this$levelLastLoaded;\n this.resetStartWhenNotLoaded((_this$levelLastLoaded = this.levelLastLoaded) != null ? _this$levelLastLoaded : frag.level);\n var delay = getRetryDelay(retryConfig, retryCount);\n this.warn(\"Fragment \" + frag.sn + \" of \" + filterType + \" \" + frag.level + \" errored with \" + data.details + \", retrying loading \" + (retryCount + 1) + \"/\" + retryConfig.maxNumRetry + \" in \" + delay + \"ms\");\n errorAction.resolved = true;\n this.retryDate = self.performance.now() + delay;\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else if (retryConfig && errorAction) {\n this.resetFragmentErrors(filterType);\n if (retryCount < retryConfig.maxNumRetry) {\n // Network retry is skipped when level switch is preferred\n if (!gapTagEncountered) {\n errorAction.resolved = true;\n }\n } else {\n logger.warn(data.details + \" reached or exceeded max retry (\" + retryCount + \")\");\n }\n } else if ((errorAction == null ? void 0 : errorAction.action) === NetworkErrorAction.SendAlternateToPenaltyBox) {\n this.state = State.WAITING_LEVEL;\n } else {\n this.state = State.ERROR;\n }\n // Perform next async tick sooner to speed up error action resolution\n this.tickImmediate();\n };\n _proto.reduceLengthAndFlushBuffer = function reduceLengthAndFlushBuffer(data) {\n // if in appending state\n if (this.state === State.PARSING || this.state === State.PARSED) {\n var playlistType = data.parent;\n var bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);\n // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n // reduce max buf len if current position is buffered\n var buffered = bufferedInfo && bufferedInfo.len > 0.5;\n if (buffered) {\n this.reduceMaxBufferLength(bufferedInfo.len);\n }\n var flushBuffer = !buffered;\n if (flushBuffer) {\n // current position is not buffered, but browser is still complaining about buffer full error\n // this happens on IE/Edge, refer to https://github.com/video-dev/hls.js/pull/708\n // in that case flush the whole audio buffer to recover\n this.warn(\"Buffer full error while media.currentTime is not buffered, flush \" + playlistType + \" buffer\");\n }\n if (data.frag) {\n this.fragmentTracker.removeFragment(data.frag);\n this.nextLoadPosition = data.frag.start;\n }\n this.resetLoadingState();\n return flushBuffer;\n }\n return false;\n };\n _proto.resetFragmentErrors = function resetFragmentErrors(filterType) {\n if (filterType === PlaylistLevelType.AUDIO) {\n // Reset current fragment since audio track audio is essential and may not have a fail-over track\n this.fragCurrent = null;\n }\n // Fragment errors that result in a level switch or redundant fail-over\n // should reset the stream controller state to idle\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n }\n if (this.state !== State.STOPPED) {\n this.state = State.IDLE;\n }\n };\n _proto.afterBufferFlushed = function afterBufferFlushed(media, bufferType, playlistType) {\n if (!media) {\n return;\n }\n // After successful buffer flushing, filter flushed fragments from bufferedFrags use mediaBuffered instead of media\n // (so that we will check against video.buffered ranges in case of alt audio track)\n var bufferedTimeRanges = BufferHelper.getBuffered(media);\n this.fragmentTracker.detectEvictedFragments(bufferType, bufferedTimeRanges, playlistType);\n if (this.state === State.ENDED) {\n this.resetLoadingState();\n }\n };\n _proto.resetLoadingState = function resetLoadingState() {\n this.log('Reset loading state');\n this.fragCurrent = null;\n this.fragPrevious = null;\n this.state = State.IDLE;\n };\n _proto.resetStartWhenNotLoaded = function resetStartWhenNotLoaded(level) {\n // if loadedmetadata is not set, it means that first frag request failed\n // in that case, reset startFragRequested flag\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n var details = this.levels ? this.levels[level].details : null;\n if (details != null && details.live) {\n // Update the start position and return to IDLE to recover live start\n this.startPosition = -1;\n this.setStartPosition(details, 0);\n this.resetLoadingState();\n } else {\n this.nextLoadPosition = this.startPosition;\n }\n }\n };\n _proto.resetWhenMissingContext = function resetWhenMissingContext(chunkMeta) {\n var _this$levelLastLoaded2;\n this.warn(\"The loading context changed while buffering fragment \" + chunkMeta.sn + \" of level \" + chunkMeta.level + \". This chunk will not be buffered.\");\n this.removeUnbufferedFrags();\n this.resetStartWhenNotLoaded((_this$levelLastLoaded2 = this.levelLastLoaded) != null ? _this$levelLastLoaded2 : chunkMeta.level);\n this.resetLoadingState();\n };\n _proto.removeUnbufferedFrags = function removeUnbufferedFrags(start) {\n if (start === void 0) {\n start = 0;\n }\n this.fragmentTracker.removeFragmentsInRange(start, Infinity, this.playlistType, false, true);\n };\n _proto.updateLevelTiming = function updateLevelTiming(frag, part, level, partial) {\n var _this6 = this,\n _this$transmuxer;\n var details = level.details;\n if (!details) {\n this.warn('level.details undefined');\n return;\n }\n var parsed = Object.keys(frag.elementaryStreams).reduce(function (result, type) {\n var info = frag.elementaryStreams[type];\n if (info) {\n var parsedDuration = info.endPTS - info.startPTS;\n if (parsedDuration <= 0) {\n // Destroy the transmuxer after it's next time offset failed to advance because duration was <= 0.\n // The new transmuxer will be configured with a time offset matching the next fragment start,\n // preventing the timeline from shifting.\n _this6.warn(\"Could not parse fragment \" + frag.sn + \" \" + type + \" duration reliably (\" + parsedDuration + \")\");\n return result || false;\n }\n var drift = partial ? 0 : updateFragPTSDTS(details, frag, info.startPTS, info.endPTS, info.startDTS, info.endDTS);\n _this6.hls.trigger(Events.LEVEL_PTS_UPDATED, {\n details: details,\n level: level,\n drift: drift,\n type: type,\n frag: frag,\n start: info.startPTS,\n end: info.endPTS\n });\n return true;\n }\n return result;\n }, false);\n if (parsed) {\n level.fragmentError = 0;\n } else if (((_this$transmuxer = this.transmuxer) == null ? void 0 : _this$transmuxer.error) === null) {\n var error = new Error(\"Found no media in fragment \" + frag.sn + \" of level \" + frag.level + \" resetting transmuxer to fallback to playlist timing\");\n if (level.fragmentError === 0) {\n // Mark and track the odd empty segment as a gap to avoid reloading\n level.fragmentError++;\n frag.gap = true;\n this.fragmentTracker.removeFragment(frag);\n this.fragmentTracker.fragBuffered(frag, true);\n }\n this.warn(error.message);\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: false,\n error: error,\n frag: frag,\n reason: \"Found no media in msn \" + frag.sn + \" of level \\\"\" + level.url + \"\\\"\"\n });\n if (!this.hls) {\n return;\n }\n this.resetTransmuxer();\n // For this error fallthrough. Marking parsed will allow advancing to next fragment.\n }\n\n this.state = State.PARSED;\n this.hls.trigger(Events.FRAG_PARSED, {\n frag: frag,\n part: part\n });\n };\n _proto.resetTransmuxer = function resetTransmuxer() {\n if (this.transmuxer) {\n this.transmuxer.destroy();\n this.transmuxer = null;\n }\n };\n _proto.recoverWorkerError = function recoverWorkerError(data) {\n if (data.event === 'demuxerWorker') {\n var _ref3, _this$levelLastLoaded3, _this$fragCurrent3;\n this.fragmentTracker.removeAllFragments();\n this.resetTransmuxer();\n this.resetStartWhenNotLoaded((_ref3 = (_this$levelLastLoaded3 = this.levelLastLoaded) != null ? _this$levelLastLoaded3 : (_this$fragCurrent3 = this.fragCurrent) == null ? void 0 : _this$fragCurrent3.level) != null ? _ref3 : 0);\n this.resetLoadingState();\n }\n };\n _createClass(BaseStreamController, [{\n key: \"state\",\n get: function get() {\n return this._state;\n },\n set: function set(nextState) {\n var previousState = this._state;\n if (previousState !== nextState) {\n this._state = nextState;\n this.log(previousState + \"->\" + nextState);\n }\n }\n }]);\n return BaseStreamController;\n }(TaskLoop);\n\n function getSourceBuffer() {\n return self.SourceBuffer || self.WebKitSourceBuffer;\n }\n\n /**\n * @ignore\n */\n function isSupported() {\n var mediaSource = getMediaSource();\n if (!mediaSource) {\n return false;\n }\n var sourceBuffer = getSourceBuffer();\n var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"');\n\n // if SourceBuffer is exposed ensure its API is valid\n // Older browsers do not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n return !!isTypeSupported && !!sourceBufferValidAPI;\n }\n\n /**\n * @ignore\n */\n function changeTypeSupported() {\n var _sourceBuffer$prototy;\n var sourceBuffer = getSourceBuffer();\n return typeof (sourceBuffer == null ? void 0 : (_sourceBuffer$prototy = sourceBuffer.prototype) == null ? void 0 : _sourceBuffer$prototy.changeType) === 'function';\n }\n\n function dummyTrack(type, inputTimeScale) {\n if (type === void 0) {\n type = '';\n }\n if (inputTimeScale === void 0) {\n inputTimeScale = 90000;\n }\n return {\n type: type,\n id: -1,\n pid: -1,\n inputTimeScale: inputTimeScale,\n sequenceNumber: -1,\n samples: [],\n dropped: 0\n };\n }\n\n var BaseAudioDemuxer = /*#__PURE__*/function () {\n function BaseAudioDemuxer() {\n this._audioTrack = void 0;\n this._id3Track = void 0;\n this.frameIndex = 0;\n this.cachedData = null;\n this.basePTS = null;\n this.initPTS = null;\n this.lastPTS = null;\n }\n var _proto = BaseAudioDemuxer.prototype;\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, trackDuration) {\n this._id3Track = {\n type: 'id3',\n id: 3,\n pid: -1,\n inputTimeScale: 90000,\n sequenceNumber: 0,\n samples: [],\n dropped: 0\n };\n };\n _proto.resetTimeStamp = function resetTimeStamp(deaultTimestamp) {\n this.initPTS = deaultTimestamp;\n this.resetContiguity();\n };\n _proto.resetContiguity = function resetContiguity() {\n this.basePTS = null;\n this.lastPTS = null;\n this.frameIndex = 0;\n };\n _proto.canParse = function canParse(data, offset) {\n return false;\n };\n _proto.appendFrame = function appendFrame(track, data, offset) {}\n\n // feed incoming data to the front of the parsing pipeline\n ;\n _proto.demux = function demux(data, timeOffset) {\n if (this.cachedData) {\n data = appendUint8Array(this.cachedData, data);\n this.cachedData = null;\n }\n var id3Data = getID3Data(data, 0);\n var offset = id3Data ? id3Data.length : 0;\n var lastDataIndex;\n var track = this._audioTrack;\n var id3Track = this._id3Track;\n var timestamp = id3Data ? getTimeStamp(id3Data) : undefined;\n var length = data.length;\n if (this.basePTS === null || this.frameIndex === 0 && isFiniteNumber(timestamp)) {\n this.basePTS = initPTSFn(timestamp, timeOffset, this.initPTS);\n this.lastPTS = this.basePTS;\n }\n if (this.lastPTS === null) {\n this.lastPTS = this.basePTS;\n }\n\n // more expressive than alternative: id3Data?.length\n if (id3Data && id3Data.length > 0) {\n id3Track.samples.push({\n pts: this.lastPTS,\n dts: this.lastPTS,\n data: id3Data,\n type: MetadataSchema.audioId3,\n duration: Number.POSITIVE_INFINITY\n });\n }\n while (offset < length) {\n if (this.canParse(data, offset)) {\n var frame = this.appendFrame(track, data, offset);\n if (frame) {\n this.frameIndex++;\n this.lastPTS = frame.sample.pts;\n offset += frame.length;\n lastDataIndex = offset;\n } else {\n offset = length;\n }\n } else if (canParse$2(data, offset)) {\n // after a ID3.canParse, a call to ID3.getID3Data *should* always returns some data\n id3Data = getID3Data(data, offset);\n id3Track.samples.push({\n pts: this.lastPTS,\n dts: this.lastPTS,\n data: id3Data,\n type: MetadataSchema.audioId3,\n duration: Number.POSITIVE_INFINITY\n });\n offset += id3Data.length;\n lastDataIndex = offset;\n } else {\n offset++;\n }\n if (offset === length && lastDataIndex !== length) {\n var partialData = sliceUint8(data, lastDataIndex);\n if (this.cachedData) {\n this.cachedData = appendUint8Array(this.cachedData, partialData);\n } else {\n this.cachedData = partialData;\n }\n }\n }\n return {\n audioTrack: track,\n videoTrack: dummyTrack(),\n id3Track: id3Track,\n textTrack: dummyTrack()\n };\n };\n _proto.demuxSampleAes = function demuxSampleAes(data, keyData, timeOffset) {\n return Promise.reject(new Error(\"[\" + this + \"] This demuxer does not support Sample-AES decryption\"));\n };\n _proto.flush = function flush(timeOffset) {\n // Parse cache in case of remaining frames.\n var cachedData = this.cachedData;\n if (cachedData) {\n this.cachedData = null;\n this.demux(cachedData, 0);\n }\n return {\n audioTrack: this._audioTrack,\n videoTrack: dummyTrack(),\n id3Track: this._id3Track,\n textTrack: dummyTrack()\n };\n };\n _proto.destroy = function destroy() {};\n return BaseAudioDemuxer;\n }();\n /**\n * Initialize PTS\n * <p>\n * use timestamp unless it is undefined, NaN or Infinity\n * </p>\n */\n var initPTSFn = function initPTSFn(timestamp, timeOffset, initPTS) {\n if (isFiniteNumber(timestamp)) {\n return timestamp * 90;\n }\n var init90kHz = initPTS ? initPTS.baseTime * 90000 / initPTS.timescale : 0;\n return timeOffset * 90000 + init90kHz;\n };\n\n /**\n * ADTS parser helper\n * @link https://wiki.multimedia.cx/index.php?title=ADTS\n */\n function getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType;\n var adtsExtensionSamplingIndex;\n var adtsChannelConfig;\n var config;\n var userAgent = navigator.userAgent.toLowerCase();\n var manifestCodec = audioCodec;\n var adtsSamplingRates = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];\n // byte 2\n adtsObjectType = ((data[offset + 2] & 0xc0) >>> 6) + 1;\n var adtsSamplingIndex = (data[offset + 2] & 0x3c) >>> 2;\n if (adtsSamplingIndex > adtsSamplingRates.length - 1) {\n observer.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: true,\n reason: \"invalid ADTS sampling index:\" + adtsSamplingIndex\n });\n return;\n }\n adtsChannelConfig = (data[offset + 2] & 0x01) << 2;\n // byte 3\n adtsChannelConfig |= (data[offset + 3] & 0xc0) >>> 6;\n logger.log(\"manifest codec:\" + audioCodec + \", ADTS type:\" + adtsObjectType + \", samplingIndex:\" + adtsSamplingIndex);\n // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n if (/firefox/i.test(userAgent)) {\n if (adtsSamplingIndex >= 6) {\n adtsObjectType = 5;\n config = new Array(4);\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSamplingIndex = adtsSamplingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSamplingIndex = adtsSamplingIndex;\n }\n // Android : always use AAC\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSamplingIndex = adtsSamplingIndex;\n } else {\n /* for other browsers (Chrome/Vivaldi/Opera ...)\n always force audio type to be HE-AAC SBR, as some browsers do not support audio codec switch properly (like Chrome ...)\n */\n adtsObjectType = 5;\n config = new Array(4);\n // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)\n if (audioCodec && (audioCodec.indexOf('mp4a.40.29') !== -1 || audioCodec.indexOf('mp4a.40.5') !== -1) || !audioCodec && adtsSamplingIndex >= 6) {\n // HE-AAC uses SBR (Spectral Band Replication) , high frequencies are constructed from low frequencies\n // there is a factor 2 between frame sample rate and output sample rate\n // multiply frequency by 2 (see table below, equivalent to substract 3)\n adtsExtensionSamplingIndex = adtsSamplingIndex - 3;\n } else {\n // if (manifest codec is AAC) AND (frequency less than 24kHz AND nb channel is 1) OR (manifest codec not specified and mono audio)\n // Chrome fails to play back with low frequency AAC LC mono when initialized with HE-AAC. This is not a problem with stereo.\n if (audioCodec && audioCodec.indexOf('mp4a.40.2') !== -1 && (adtsSamplingIndex >= 6 && adtsChannelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChannelConfig === 1) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n adtsExtensionSamplingIndex = adtsSamplingIndex;\n }\n }\n /* refer to http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config\n ISO 14496-3 (AAC).pdf - Table 1.13 — Syntax of AudioSpecificConfig()\n Audio Profile / Audio Object Type\n 0: Null\n 1: AAC Main\n 2: AAC LC (Low Complexity)\n 3: AAC SSR (Scalable Sample Rate)\n 4: AAC LTP (Long Term Prediction)\n 5: SBR (Spectral Band Replication)\n 6: AAC Scalable\n sampling freq\n 0: 96000 Hz\n 1: 88200 Hz\n 2: 64000 Hz\n 3: 48000 Hz\n 4: 44100 Hz\n 5: 32000 Hz\n 6: 24000 Hz\n 7: 22050 Hz\n 8: 16000 Hz\n 9: 12000 Hz\n 10: 11025 Hz\n 11: 8000 Hz\n 12: 7350 Hz\n 13: Reserved\n 14: Reserved\n 15: frequency is written explictly\n Channel Configurations\n These are the channel configurations:\n 0: Defined in AOT Specifc Config\n 1: 1 channel: front-center\n 2: 2 channels: front-left, front-right\n */\n // audioObjectType = profile => profile, the MPEG-4 Audio Object Type minus 1\n config[0] = adtsObjectType << 3;\n // samplingFrequencyIndex\n config[0] |= (adtsSamplingIndex & 0x0e) >> 1;\n config[1] |= (adtsSamplingIndex & 0x01) << 7;\n // channelConfiguration\n config[1] |= adtsChannelConfig << 3;\n if (adtsObjectType === 5) {\n // adtsExtensionSamplingIndex\n config[1] |= (adtsExtensionSamplingIndex & 0x0e) >> 1;\n config[2] = (adtsExtensionSamplingIndex & 0x01) << 7;\n // adtsObjectType (force to 2, chrome is checking that object type is less than 5 ???\n // https://chromium.googlesource.com/chromium/src.git/+/master/media/formats/mp4/aac.cc\n config[2] |= 2 << 2;\n config[3] = 0;\n }\n return {\n config: config,\n samplerate: adtsSamplingRates[adtsSamplingIndex],\n channelCount: adtsChannelConfig,\n codec: 'mp4a.40.' + adtsObjectType,\n manifestCodec: manifestCodec\n };\n }\n function isHeaderPattern$1(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n }\n function getHeaderLength(data, offset) {\n return data[offset + 1] & 0x01 ? 7 : 9;\n }\n function getFullFrameLength(data, offset) {\n return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xe0) >>> 5;\n }\n function canGetFrameLength(data, offset) {\n return offset + 5 < data.length;\n }\n function isHeader$1(data, offset) {\n // Look for ADTS header | 1111 1111 | 1111 X00X | where X can be either 0 or 1\n // Layer bits (position 14 and 15) in header should be always 0 for ADTS\n // More info https://wiki.multimedia.cx/index.php?title=ADTS\n return offset + 1 < data.length && isHeaderPattern$1(data, offset);\n }\n function canParse$1(data, offset) {\n return canGetFrameLength(data, offset) && isHeaderPattern$1(data, offset) && getFullFrameLength(data, offset) <= data.length - offset;\n }\n function probe$1(data, offset) {\n // same as isHeader but we also check that ADTS frame follows last ADTS frame\n // or end of data is reached\n if (isHeader$1(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n if (offset + headerLength >= data.length) {\n return false;\n }\n // ADTS frame Length\n var frameLength = getFullFrameLength(data, offset);\n if (frameLength <= headerLength) {\n return false;\n }\n var newOffset = offset + frameLength;\n return newOffset === data.length || isHeader$1(data, newOffset);\n }\n return false;\n }\n function initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\n if (!config) {\n return;\n }\n track.config = config.config;\n track.samplerate = config.samplerate;\n track.channelCount = config.channelCount;\n track.codec = config.codec;\n track.manifestCodec = config.manifestCodec;\n logger.log(\"parsed codec:\" + track.codec + \", rate:\" + config.samplerate + \", channels:\" + config.channelCount);\n }\n }\n function getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n }\n function parseFrameHeader(data, offset) {\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n var headerLength = getHeaderLength(data, offset);\n if (offset + headerLength <= data.length) {\n // retrieve frame size\n var frameLength = getFullFrameLength(data, offset) - headerLength;\n if (frameLength > 0) {\n // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}`);\n return {\n headerLength: headerLength,\n frameLength: frameLength\n };\n }\n }\n }\n function appendFrame$1(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var stamp = pts + frameIndex * frameDuration;\n var header = parseFrameHeader(data, offset);\n var unit;\n if (header) {\n var frameLength = header.frameLength,\n headerLength = header.headerLength;\n var _length = headerLength + frameLength;\n var missing = Math.max(0, offset + _length - data.length);\n // logger.log(`AAC frame ${frameIndex}, pts:${stamp} length@offset/total: ${frameLength}@${offset+headerLength}/${data.byteLength} missing: ${missing}`);\n if (missing) {\n unit = new Uint8Array(_length - headerLength);\n unit.set(data.subarray(offset + headerLength, data.length), 0);\n } else {\n unit = data.subarray(offset + headerLength, offset + _length);\n }\n var _sample = {\n unit: unit,\n pts: stamp\n };\n if (!missing) {\n track.samples.push(_sample);\n }\n return {\n sample: _sample,\n length: _length,\n missing: missing\n };\n }\n // overflow incomplete header\n var length = data.length - offset;\n unit = new Uint8Array(length);\n unit.set(data.subarray(offset, data.length), 0);\n var sample = {\n unit: unit,\n pts: stamp\n };\n return {\n sample: sample,\n length: length,\n missing: -1\n };\n }\n\n var AACDemuxer = /*#__PURE__*/function (_BaseAudioDemuxer) {\n _inheritsLoose(AACDemuxer, _BaseAudioDemuxer);\n function AACDemuxer(observer, config) {\n var _this;\n _this = _BaseAudioDemuxer.call(this) || this;\n _this.observer = void 0;\n _this.config = void 0;\n _this.observer = observer;\n _this.config = config;\n return _this;\n }\n var _proto = AACDemuxer.prototype;\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, trackDuration) {\n _BaseAudioDemuxer.prototype.resetInitSegment.call(this, initSegment, audioCodec, videoCodec, trackDuration);\n this._audioTrack = {\n container: 'audio/adts',\n type: 'audio',\n id: 2,\n pid: -1,\n sequenceNumber: 0,\n segmentCodec: 'aac',\n samples: [],\n manifestCodec: audioCodec,\n duration: trackDuration,\n inputTimeScale: 90000,\n dropped: 0\n };\n }\n\n // Source for probe info - https://wiki.multimedia.cx/index.php?title=ADTS\n ;\n AACDemuxer.probe = function probe(data) {\n if (!data) {\n return false;\n }\n\n // Check for the ADTS sync word\n // Look for ADTS header | 1111 1111 | 1111 X00X | where X can be either 0 or 1\n // Layer bits (position 14 and 15) in header should be always 0 for ADTS\n // More info https://wiki.multimedia.cx/index.php?title=ADTS\n var id3Data = getID3Data(data, 0) || [];\n var offset = id3Data.length;\n for (var length = data.length; offset < length; offset++) {\n if (probe$1(data, offset)) {\n logger.log('ADTS sync word found !');\n return true;\n }\n }\n return false;\n };\n _proto.canParse = function canParse(data, offset) {\n return canParse$1(data, offset);\n };\n _proto.appendFrame = function appendFrame(track, data, offset) {\n initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = appendFrame$1(track, data, offset, this.basePTS, this.frameIndex);\n if (frame && frame.missing === 0) {\n return frame;\n }\n };\n return AACDemuxer;\n }(BaseAudioDemuxer);\n\n var emsgSchemePattern = /\\/emsg[-/]ID3/i;\n var MP4Demuxer = /*#__PURE__*/function () {\n function MP4Demuxer(observer, config) {\n this.remainderData = null;\n this.timeOffset = 0;\n this.config = void 0;\n this.videoTrack = void 0;\n this.audioTrack = void 0;\n this.id3Track = void 0;\n this.txtTrack = void 0;\n this.config = config;\n }\n var _proto = MP4Demuxer.prototype;\n _proto.resetTimeStamp = function resetTimeStamp() {};\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, trackDuration) {\n var videoTrack = this.videoTrack = dummyTrack('video', 1);\n var audioTrack = this.audioTrack = dummyTrack('audio', 1);\n var captionTrack = this.txtTrack = dummyTrack('text', 1);\n this.id3Track = dummyTrack('id3', 1);\n this.timeOffset = 0;\n if (!(initSegment != null && initSegment.byteLength)) {\n return;\n }\n var initData = parseInitSegment(initSegment);\n if (initData.video) {\n var _initData$video = initData.video,\n id = _initData$video.id,\n timescale = _initData$video.timescale,\n codec = _initData$video.codec;\n videoTrack.id = id;\n videoTrack.timescale = captionTrack.timescale = timescale;\n videoTrack.codec = codec;\n }\n if (initData.audio) {\n var _initData$audio = initData.audio,\n _id = _initData$audio.id,\n _timescale = _initData$audio.timescale,\n _codec = _initData$audio.codec;\n audioTrack.id = _id;\n audioTrack.timescale = _timescale;\n audioTrack.codec = _codec;\n }\n captionTrack.id = RemuxerTrackIdConfig.text;\n videoTrack.sampleDuration = 0;\n videoTrack.duration = audioTrack.duration = trackDuration;\n };\n _proto.resetContiguity = function resetContiguity() {\n this.remainderData = null;\n };\n MP4Demuxer.probe = function probe(data) {\n // ensure we find a moof box in the first 16 kB\n data = data.length > 16384 ? data.subarray(0, 16384) : data;\n return findBox(data, ['moof']).length > 0;\n };\n _proto.demux = function demux(data, timeOffset) {\n this.timeOffset = timeOffset;\n // Load all data into the avc track. The CMAF remuxer will look for the data in the samples object; the rest of the fields do not matter\n var videoSamples = data;\n var videoTrack = this.videoTrack;\n var textTrack = this.txtTrack;\n if (this.config.progressive) {\n // Split the bytestream into two ranges: one encompassing all data up until the start of the last moof, and everything else.\n // This is done to guarantee that we're sending valid data to MSE - when demuxing progressively, we have no guarantee\n // that the fetch loader gives us flush moof+mdat pairs. If we push jagged data to MSE, it will throw an exception.\n if (this.remainderData) {\n videoSamples = appendUint8Array(this.remainderData, data);\n }\n var segmentedData = segmentValidRange(videoSamples);\n this.remainderData = segmentedData.remainder;\n videoTrack.samples = segmentedData.valid || new Uint8Array();\n } else {\n videoTrack.samples = videoSamples;\n }\n var id3Track = this.extractID3Track(videoTrack, timeOffset);\n textTrack.samples = parseSamples(timeOffset, videoTrack);\n return {\n videoTrack: videoTrack,\n audioTrack: this.audioTrack,\n id3Track: id3Track,\n textTrack: this.txtTrack\n };\n };\n _proto.flush = function flush() {\n var timeOffset = this.timeOffset;\n var videoTrack = this.videoTrack;\n var textTrack = this.txtTrack;\n videoTrack.samples = this.remainderData || new Uint8Array();\n this.remainderData = null;\n var id3Track = this.extractID3Track(videoTrack, this.timeOffset);\n textTrack.samples = parseSamples(timeOffset, videoTrack);\n return {\n videoTrack: videoTrack,\n audioTrack: dummyTrack(),\n id3Track: id3Track,\n textTrack: dummyTrack()\n };\n };\n _proto.extractID3Track = function extractID3Track(videoTrack, timeOffset) {\n var id3Track = this.id3Track;\n if (videoTrack.samples.length) {\n var emsgs = findBox(videoTrack.samples, ['emsg']);\n if (emsgs) {\n emsgs.forEach(function (data) {\n var emsgInfo = parseEmsg(data);\n if (emsgSchemePattern.test(emsgInfo.schemeIdUri)) {\n var pts = isFiniteNumber(emsgInfo.presentationTime) ? emsgInfo.presentationTime / emsgInfo.timeScale : timeOffset + emsgInfo.presentationTimeDelta / emsgInfo.timeScale;\n var duration = emsgInfo.eventDuration === 0xffffffff ? Number.POSITIVE_INFINITY : emsgInfo.eventDuration / emsgInfo.timeScale;\n // Safari takes anything <= 0.001 seconds and maps it to Infinity\n if (duration <= 0.001) {\n duration = Number.POSITIVE_INFINITY;\n }\n var payload = emsgInfo.payload;\n id3Track.samples.push({\n data: payload,\n len: payload.byteLength,\n dts: pts,\n pts: pts,\n type: MetadataSchema.emsg,\n duration: duration\n });\n }\n });\n }\n }\n return id3Track;\n };\n _proto.demuxSampleAes = function demuxSampleAes(data, keyData, timeOffset) {\n return Promise.reject(new Error('The MP4 demuxer does not support SAMPLE-AES decryption'));\n };\n _proto.destroy = function destroy() {};\n return MP4Demuxer;\n }();\n\n /**\n * MPEG parser helper\n */\n\n var chromeVersion$1 = null;\n var BitratesMap = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160];\n var SamplingRateMap = [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000];\n var SamplesCoefficients = [\n // MPEG 2.5\n [0,\n // Reserved\n 72,\n // Layer3\n 144,\n // Layer2\n 12 // Layer1\n ],\n // Reserved\n [0,\n // Reserved\n 0,\n // Layer3\n 0,\n // Layer2\n 0 // Layer1\n ],\n // MPEG 2\n [0,\n // Reserved\n 72,\n // Layer3\n 144,\n // Layer2\n 12 // Layer1\n ],\n // MPEG 1\n [0,\n // Reserved\n 144,\n // Layer3\n 144,\n // Layer2\n 12 // Layer1\n ]];\n\n var BytesInSlot = [0,\n // Reserved\n 1,\n // Layer3\n 1,\n // Layer2\n 4 // Layer1\n ];\n\n function appendFrame(track, data, offset, pts, frameIndex) {\n // Using http://www.datavoyage.com/mpgscript/mpeghdr.htm as a reference\n if (offset + 24 > data.length) {\n return;\n }\n var header = parseHeader(data, offset);\n if (header && offset + header.frameLength <= data.length) {\n var frameDuration = header.samplesPerFrame * 90000 / header.sampleRate;\n var stamp = pts + frameIndex * frameDuration;\n var sample = {\n unit: data.subarray(offset, offset + header.frameLength),\n pts: stamp,\n dts: stamp\n };\n track.config = [];\n track.channelCount = header.channelCount;\n track.samplerate = header.sampleRate;\n track.samples.push(sample);\n return {\n sample: sample,\n length: header.frameLength,\n missing: 0\n };\n }\n }\n function parseHeader(data, offset) {\n var mpegVersion = data[offset + 1] >> 3 & 3;\n var mpegLayer = data[offset + 1] >> 1 & 3;\n var bitRateIndex = data[offset + 2] >> 4 & 15;\n var sampleRateIndex = data[offset + 2] >> 2 & 3;\n if (mpegVersion !== 1 && bitRateIndex !== 0 && bitRateIndex !== 15 && sampleRateIndex !== 3) {\n var paddingBit = data[offset + 2] >> 1 & 1;\n var channelMode = data[offset + 3] >> 6;\n var columnInBitrates = mpegVersion === 3 ? 3 - mpegLayer : mpegLayer === 3 ? 3 : 4;\n var bitRate = BitratesMap[columnInBitrates * 14 + bitRateIndex - 1] * 1000;\n var columnInSampleRates = mpegVersion === 3 ? 0 : mpegVersion === 2 ? 1 : 2;\n var sampleRate = SamplingRateMap[columnInSampleRates * 3 + sampleRateIndex];\n var channelCount = channelMode === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n var sampleCoefficient = SamplesCoefficients[mpegVersion][mpegLayer];\n var bytesInSlot = BytesInSlot[mpegLayer];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = Math.floor(sampleCoefficient * bitRate / sampleRate + paddingBit) * bytesInSlot;\n if (chromeVersion$1 === null) {\n var userAgent = navigator.userAgent || '';\n var result = userAgent.match(/Chrome\\/(\\d+)/i);\n chromeVersion$1 = result ? parseInt(result[1]) : 0;\n }\n var needChromeFix = !!chromeVersion$1 && chromeVersion$1 <= 87;\n if (needChromeFix && mpegLayer === 2 && bitRate >= 224000 && channelMode === 0) {\n // Work around bug in Chromium by setting channelMode to dual-channel (01) instead of stereo (00)\n data[offset + 3] = data[offset + 3] | 0x80;\n }\n return {\n sampleRate: sampleRate,\n channelCount: channelCount,\n frameLength: frameLength,\n samplesPerFrame: samplesPerFrame\n };\n }\n }\n function isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n }\n function isHeader(data, offset) {\n // Look for MPEG header | 1111 1111 | 111X XYZX | where X can be either 0 or 1 and Y or Z should be 1\n // Layer bits (position 14 and 15) in header should be always different from 0 (Layer I or Layer II or Layer III)\n // More info http://www.mp3-tech.org/programmer/frame_header.html\n return offset + 1 < data.length && isHeaderPattern(data, offset);\n }\n function canParse(data, offset) {\n var headerSize = 4;\n return isHeaderPattern(data, offset) && headerSize <= data.length - offset;\n }\n function probe(data, offset) {\n // same as isHeader but we also check that MPEG frame follows last MPEG frame\n // or end of data is reached\n if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4;\n // MPEG frame Length\n var header = parseHeader(data, offset);\n var frameLength = headerLength;\n if (header != null && header.frameLength) {\n frameLength = header.frameLength;\n }\n var newOffset = offset + frameLength;\n return newOffset === data.length || isHeader(data, newOffset);\n }\n return false;\n }\n\n /**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n */\n\n var ExpGolomb = /*#__PURE__*/function () {\n function ExpGolomb(data) {\n this.data = void 0;\n this.bytesAvailable = void 0;\n this.word = void 0;\n this.bitsAvailable = void 0;\n this.data = data;\n // the number of bytes left to examine in this.data\n this.bytesAvailable = data.byteLength;\n // the current word being examined\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n this.bitsAvailable = 0; // :uint\n }\n\n // ():void\n var _proto = ExpGolomb.prototype;\n _proto.loadWord = function loadWord() {\n var data = this.data;\n var bytesAvailable = this.bytesAvailable;\n var position = data.byteLength - bytesAvailable;\n var workingBytes = new Uint8Array(4);\n var availableBytes = Math.min(4, bytesAvailable);\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n workingBytes.set(data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0);\n // track the amount of this.data that has been processed\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n }\n\n // (count:int):void\n ;\n _proto.skipBits = function skipBits(count) {\n var skipBytes; // :int\n count = Math.min(count, this.bytesAvailable * 8 + this.bitsAvailable);\n if (this.bitsAvailable > count) {\n this.word <<= count;\n this.bitsAvailable -= count;\n } else {\n count -= this.bitsAvailable;\n skipBytes = count >> 3;\n count -= skipBytes << 3;\n this.bytesAvailable -= skipBytes;\n this.loadWord();\n this.word <<= count;\n this.bitsAvailable -= count;\n }\n }\n\n // (size:int):uint\n ;\n _proto.readBits = function readBits(size) {\n var bits = Math.min(this.bitsAvailable, size); // :uint\n var valu = this.word >>> 32 - bits; // :uint\n if (size > 32) {\n logger.error('Cannot read more than 32 bits at a time');\n }\n this.bitsAvailable -= bits;\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n } else if (this.bytesAvailable > 0) {\n this.loadWord();\n } else {\n throw new Error('no bits available');\n }\n bits = size - bits;\n if (bits > 0 && this.bitsAvailable) {\n return valu << bits | this.readBits(bits);\n } else {\n return valu;\n }\n }\n\n // ():uint\n ;\n _proto.skipLZ = function skipLZ() {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if ((this.word & 0x80000000 >>> leadingZeroCount) !== 0) {\n // the first bit of working word is 1\n this.word <<= leadingZeroCount;\n this.bitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n }\n // we exhausted word and still have not found a 1\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n }\n\n // ():void\n ;\n _proto.skipUEG = function skipUEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():void\n ;\n _proto.skipEG = function skipEG() {\n this.skipBits(1 + this.skipLZ());\n }\n\n // ():uint\n ;\n _proto.readUEG = function readUEG() {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n }\n\n // ():int\n ;\n _proto.readEG = function readEG() {\n var valu = this.readUEG(); // :int\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return 1 + valu >>> 1; // add 1 to make it even, and divide by 2\n } else {\n return -1 * (valu >>> 1); // divide by two then make it negative\n }\n }\n\n // Some convenience functions\n // :Boolean\n ;\n _proto.readBoolean = function readBoolean() {\n return this.readBits(1) === 1;\n }\n\n // ():int\n ;\n _proto.readUByte = function readUByte() {\n return this.readBits(8);\n }\n\n // ():int\n ;\n _proto.readUShort = function readUShort() {\n return this.readBits(16);\n }\n\n // ():int\n ;\n _proto.readUInt = function readUInt() {\n return this.readBits(32);\n }\n\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */;\n _proto.skipScalingList = function skipScalingList(count) {\n var lastScale = 8;\n var nextScale = 8;\n var deltaScale;\n for (var j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n lastScale = nextScale === 0 ? lastScale : nextScale;\n }\n }\n\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @returns an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */;\n _proto.readSPS = function readSPS() {\n var frameCropLeftOffset = 0;\n var frameCropRightOffset = 0;\n var frameCropTopOffset = 0;\n var frameCropBottomOffset = 0;\n var numRefFramesInPicOrderCntCycle;\n var scalingListCount;\n var i;\n var readUByte = this.readUByte.bind(this);\n var readBits = this.readBits.bind(this);\n var readUEG = this.readUEG.bind(this);\n var readBoolean = this.readBoolean.bind(this);\n var skipBits = this.skipBits.bind(this);\n var skipEG = this.skipEG.bind(this);\n var skipUEG = this.skipUEG.bind(this);\n var skipScalingList = this.skipScalingList.bind(this);\n readUByte();\n var profileIdc = readUByte(); // profile_idc\n readBits(5); // profileCompat constraint_set[0-4]_flag, u(5)\n skipBits(3); // reserved_zero_3bits u(3),\n readUByte(); // level_idc u(8)\n skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n if (profileIdc === 100 || profileIdc === 110 || profileIdc === 122 || profileIdc === 244 || profileIdc === 44 || profileIdc === 83 || profileIdc === 86 || profileIdc === 118 || profileIdc === 128) {\n var chromaFormatIdc = readUEG();\n if (chromaFormatIdc === 3) {\n skipBits(1);\n } // separate_colour_plane_flag\n\n skipUEG(); // bit_depth_luma_minus8\n skipUEG(); // bit_depth_chroma_minus8\n skipBits(1); // qpprime_y_zero_transform_bypass_flag\n if (readBoolean()) {\n // seq_scaling_matrix_present_flag\n scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (readBoolean()) {\n // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n skipScalingList(16);\n } else {\n skipScalingList(64);\n }\n }\n }\n }\n }\n skipUEG(); // log2_max_frame_num_minus4\n var picOrderCntType = readUEG();\n if (picOrderCntType === 0) {\n readUEG(); // log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n skipBits(1); // delta_pic_order_always_zero_flag\n skipEG(); // offset_for_non_ref_pic\n skipEG(); // offset_for_top_to_bottom_field\n numRefFramesInPicOrderCntCycle = readUEG();\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n skipEG();\n } // offset_for_ref_frame[ i ]\n }\n\n skipUEG(); // max_num_ref_frames\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n var picWidthInMbsMinus1 = readUEG();\n var picHeightInMapUnitsMinus1 = readUEG();\n var frameMbsOnlyFlag = readBits(1);\n if (frameMbsOnlyFlag === 0) {\n skipBits(1);\n } // mb_adaptive_frame_field_flag\n\n skipBits(1); // direct_8x8_inference_flag\n if (readBoolean()) {\n // frame_cropping_flag\n frameCropLeftOffset = readUEG();\n frameCropRightOffset = readUEG();\n frameCropTopOffset = readUEG();\n frameCropBottomOffset = readUEG();\n }\n var pixelRatio = [1, 1];\n if (readBoolean()) {\n // vui_parameters_present_flag\n if (readBoolean()) {\n // aspect_ratio_info_present_flag\n var aspectRatioIdc = readUByte();\n switch (aspectRatioIdc) {\n case 1:\n pixelRatio = [1, 1];\n break;\n case 2:\n pixelRatio = [12, 11];\n break;\n case 3:\n pixelRatio = [10, 11];\n break;\n case 4:\n pixelRatio = [16, 11];\n break;\n case 5:\n pixelRatio = [40, 33];\n break;\n case 6:\n pixelRatio = [24, 11];\n break;\n case 7:\n pixelRatio = [20, 11];\n break;\n case 8:\n pixelRatio = [32, 11];\n break;\n case 9:\n pixelRatio = [80, 33];\n break;\n case 10:\n pixelRatio = [18, 11];\n break;\n case 11:\n pixelRatio = [15, 11];\n break;\n case 12:\n pixelRatio = [64, 33];\n break;\n case 13:\n pixelRatio = [160, 99];\n break;\n case 14:\n pixelRatio = [4, 3];\n break;\n case 15:\n pixelRatio = [3, 2];\n break;\n case 16:\n pixelRatio = [2, 1];\n break;\n case 255:\n {\n pixelRatio = [readUByte() << 8 | readUByte(), readUByte() << 8 | readUByte()];\n break;\n }\n }\n }\n }\n return {\n width: Math.ceil((picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2),\n height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - (frameMbsOnlyFlag ? 2 : 4) * (frameCropTopOffset + frameCropBottomOffset),\n pixelRatio: pixelRatio\n };\n };\n _proto.readSliceType = function readSliceType() {\n // skip NALu type\n this.readUByte();\n // discard first_mb_in_slice\n this.readUEG();\n // return slice_type\n return this.readUEG();\n };\n return ExpGolomb;\n }();\n\n /**\n * SAMPLE-AES decrypter\n */\n\n var SampleAesDecrypter = /*#__PURE__*/function () {\n function SampleAesDecrypter(observer, config, keyData) {\n this.keyData = void 0;\n this.decrypter = void 0;\n this.keyData = keyData;\n this.decrypter = new Decrypter(config, {\n removePKCS7Padding: false\n });\n }\n var _proto = SampleAesDecrypter.prototype;\n _proto.decryptBuffer = function decryptBuffer(encryptedData) {\n return this.decrypter.decrypt(encryptedData, this.keyData.key.buffer, this.keyData.iv.buffer);\n }\n\n // AAC - encrypt all full 16 bytes blocks starting from offset 16\n ;\n _proto.decryptAacSample = function decryptAacSample(samples, sampleIndex, callback) {\n var _this = this;\n var curUnit = samples[sampleIndex].unit;\n if (curUnit.length <= 16) {\n // No encrypted portion in this sample (first 16 bytes is not\n // encrypted, see https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Encryption/Encryption.html),\n return;\n }\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n this.decryptBuffer(encryptedBuffer).then(function (decryptedBuffer) {\n var decryptedData = new Uint8Array(decryptedBuffer);\n curUnit.set(decryptedData, 16);\n if (!_this.decrypter.isSync()) {\n _this.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\n });\n };\n _proto.decryptAacSamples = function decryptAacSamples(samples, sampleIndex, callback) {\n for (;; sampleIndex++) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n this.decryptAacSample(samples, sampleIndex, callback);\n if (!this.decrypter.isSync()) {\n return;\n }\n }\n }\n\n // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n ;\n _proto.getAvcEncryptedData = function getAvcEncryptedData(decodedData) {\n var encryptedDataLen = Math.floor((decodedData.length - 48) / 160) * 16 + 16;\n var encryptedData = new Int8Array(encryptedDataLen);\n var outputPos = 0;\n for (var inputPos = 32; inputPos < decodedData.length - 16; inputPos += 160, outputPos += 16) {\n encryptedData.set(decodedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return encryptedData;\n };\n _proto.getAvcDecryptedUnit = function getAvcDecryptedUnit(decodedData, decryptedData) {\n var uint8DecryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n for (var outputPos = 32; outputPos < decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(uint8DecryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return decodedData;\n };\n _proto.decryptAvcSample = function decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit) {\n var _this2 = this;\n var decodedData = discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n this.decryptBuffer(encryptedData.buffer).then(function (decryptedBuffer) {\n curUnit.data = _this2.getAvcDecryptedUnit(decodedData, decryptedBuffer);\n if (!_this2.decrypter.isSync()) {\n _this2.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n _proto.decryptAvcSamples = function decryptAvcSamples(samples, sampleIndex, unitIndex, callback) {\n if (samples instanceof Uint8Array) {\n throw new Error('Cannot decrypt samples of type Uint8Array');\n }\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n var curUnits = samples[sampleIndex].units;\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n var curUnit = curUnits[unitIndex];\n if (curUnit.data.length <= 48 || curUnit.type !== 1 && curUnit.type !== 5) {\n continue;\n }\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit);\n if (!this.decrypter.isSync()) {\n return;\n }\n }\n }\n };\n return SampleAesDecrypter;\n }();\n\n var PACKET_LENGTH = 188;\n var TSDemuxer = /*#__PURE__*/function () {\n function TSDemuxer(observer, config, typeSupported) {\n this.observer = void 0;\n this.config = void 0;\n this.typeSupported = void 0;\n this.sampleAes = null;\n this.pmtParsed = false;\n this.audioCodec = void 0;\n this.videoCodec = void 0;\n this._duration = 0;\n this._pmtId = -1;\n this._avcTrack = void 0;\n this._audioTrack = void 0;\n this._id3Track = void 0;\n this._txtTrack = void 0;\n this.aacOverFlow = null;\n this.avcSample = null;\n this.remainderData = null;\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n }\n TSDemuxer.probe = function probe(data) {\n var syncOffset = TSDemuxer.syncOffset(data);\n if (syncOffset > 0) {\n logger.warn(\"MPEG2-TS detected but first sync word found @ offset \" + syncOffset);\n }\n return syncOffset !== -1;\n };\n TSDemuxer.syncOffset = function syncOffset(data) {\n var length = data.length;\n var scanwindow = Math.min(PACKET_LENGTH * 5, data.length - PACKET_LENGTH) + 1;\n var i = 0;\n while (i < scanwindow) {\n // a TS init segment should contain at least 2 TS packets: PAT and PMT, each starting with 0x47\n var foundPat = false;\n var packetStart = -1;\n var tsPackets = 0;\n for (var j = i; j < length; j += PACKET_LENGTH) {\n if (data[j] === 0x47) {\n tsPackets++;\n if (packetStart === -1) {\n packetStart = j;\n // First sync word found at offset, increase scan length (#5251)\n if (packetStart !== 0) {\n scanwindow = Math.min(packetStart + PACKET_LENGTH * 99, data.length - PACKET_LENGTH) + 1;\n }\n }\n if (!foundPat) {\n foundPat = parsePID(data, j) === 0;\n }\n // Sync word found at 0 with 3 packets, or found at offset least 2 packets up to scanwindow (#5501)\n if (foundPat && tsPackets > 1 && (packetStart === 0 && tsPackets > 2 || j + PACKET_LENGTH > scanwindow)) {\n return packetStart;\n }\n } else if (tsPackets) {\n // Exit if sync word found, but does not contain contiguous packets (#5501)\n return -1;\n } else {\n break;\n }\n }\n i++;\n }\n return -1;\n }\n\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n */;\n TSDemuxer.createTrack = function createTrack(type, duration) {\n return {\n container: type === 'video' || type === 'audio' ? 'video/mp2t' : undefined,\n type: type,\n id: RemuxerTrackIdConfig[type],\n pid: -1,\n inputTimeScale: 90000,\n sequenceNumber: 0,\n samples: [],\n dropped: 0,\n duration: type === 'audio' ? duration : undefined\n };\n }\n\n /**\n * Initializes a new init segment on the demuxer/remuxer interface. Needed for discontinuities/track-switches (or at stream start)\n * Resets all internal track instances of the demuxer.\n */;\n var _proto = TSDemuxer.prototype;\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, trackDuration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n this._avcTrack = TSDemuxer.createTrack('video');\n this._audioTrack = TSDemuxer.createTrack('audio', trackDuration);\n this._id3Track = TSDemuxer.createTrack('id3');\n this._txtTrack = TSDemuxer.createTrack('text');\n this._audioTrack.segmentCodec = 'aac';\n\n // flush any partial content\n this.aacOverFlow = null;\n this.avcSample = null;\n this.remainderData = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = trackDuration;\n };\n _proto.resetTimeStamp = function resetTimeStamp() {};\n _proto.resetContiguity = function resetContiguity() {\n var _audioTrack = this._audioTrack,\n _avcTrack = this._avcTrack,\n _id3Track = this._id3Track;\n if (_audioTrack) {\n _audioTrack.pesData = null;\n }\n if (_avcTrack) {\n _avcTrack.pesData = null;\n }\n if (_id3Track) {\n _id3Track.pesData = null;\n }\n this.aacOverFlow = null;\n this.avcSample = null;\n this.remainderData = null;\n };\n _proto.demux = function demux(data, timeOffset, isSampleAes, flush) {\n if (isSampleAes === void 0) {\n isSampleAes = false;\n }\n if (flush === void 0) {\n flush = false;\n }\n if (!isSampleAes) {\n this.sampleAes = null;\n }\n var pes;\n var videoTrack = this._avcTrack;\n var audioTrack = this._audioTrack;\n var id3Track = this._id3Track;\n var textTrack = this._txtTrack;\n var avcId = videoTrack.pid;\n var avcData = videoTrack.pesData;\n var audioId = audioTrack.pid;\n var id3Id = id3Track.pid;\n var audioData = audioTrack.pesData;\n var id3Data = id3Track.pesData;\n var unknownPID = null;\n var pmtParsed = this.pmtParsed;\n var pmtId = this._pmtId;\n var len = data.length;\n if (this.remainderData) {\n data = appendUint8Array(this.remainderData, data);\n len = data.length;\n this.remainderData = null;\n }\n if (len < PACKET_LENGTH && !flush) {\n this.remainderData = data;\n return {\n audioTrack: audioTrack,\n videoTrack: videoTrack,\n id3Track: id3Track,\n textTrack: textTrack\n };\n }\n var syncOffset = Math.max(0, TSDemuxer.syncOffset(data));\n len -= (len - syncOffset) % PACKET_LENGTH;\n if (len < data.byteLength && !flush) {\n this.remainderData = new Uint8Array(data.buffer, len, data.buffer.byteLength - len);\n }\n\n // loop through TS packets\n var tsPacketErrors = 0;\n for (var start = syncOffset; start < len; start += PACKET_LENGTH) {\n if (data[start] === 0x47) {\n var stt = !!(data[start + 1] & 0x40);\n var pid = parsePID(data, start);\n var atf = (data[start + 3] & 0x30) >> 4;\n\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n var offset = void 0;\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === start + PACKET_LENGTH) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData))) {\n this.parseAVCPES(videoTrack, textTrack, pes, false);\n }\n avcData = {\n data: [],\n size: 0\n };\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + PACKET_LENGTH));\n avcData.size += start + PACKET_LENGTH - offset;\n }\n break;\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData))) {\n switch (audioTrack.segmentCodec) {\n case 'aac':\n this.parseAACPES(audioTrack, pes);\n break;\n case 'mp3':\n this.parseMPEGPES(audioTrack, pes);\n break;\n }\n }\n audioData = {\n data: [],\n size: 0\n };\n }\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + PACKET_LENGTH));\n audioData.size += start + PACKET_LENGTH - offset;\n }\n break;\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data))) {\n this.parseID3PES(id3Track, pes);\n }\n id3Data = {\n data: [],\n size: 0\n };\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + PACKET_LENGTH));\n id3Data.size += start + PACKET_LENGTH - offset;\n }\n break;\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n pmtId = this._pmtId = parsePAT(data, offset);\n // logger.log('PMT PID:' + this._pmtId);\n break;\n case pmtId:\n {\n if (stt) {\n offset += data[offset] + 1;\n }\n var parsedPIDs = parsePMT(data, offset, this.typeSupported, isSampleAes);\n\n // only update track id if track PID found while parsing PMT\n // this is to avoid resetting the PID to -1 in case\n // track PID transiently disappears from the stream\n // this could happen in case of transient missing audio samples for example\n // NOTE this is only the PID of the track as found in TS,\n // but we are not using this for MP4 track IDs.\n avcId = parsedPIDs.avc;\n if (avcId > 0) {\n videoTrack.pid = avcId;\n }\n audioId = parsedPIDs.audio;\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.segmentCodec = parsedPIDs.segmentCodec;\n }\n id3Id = parsedPIDs.id3;\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n if (unknownPID !== null && !pmtParsed) {\n logger.warn(\"MPEG-TS PMT found at \" + start + \" after unknown PID '\" + unknownPID + \"'. Backtracking to sync byte @\" + syncOffset + \" to parse all TS packets.\");\n unknownPID = null;\n // we set it to -188, the += 188 in the for loop will reset start to 0\n start = syncOffset - 188;\n }\n pmtParsed = this.pmtParsed = true;\n break;\n }\n case 0x11:\n case 0x1fff:\n break;\n default:\n unknownPID = pid;\n break;\n }\n } else {\n tsPacketErrors++;\n }\n }\n if (tsPacketErrors > 0) {\n var error = new Error(\"Found \" + tsPacketErrors + \" TS packet/s that do not start with 0x47\");\n this.observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: false,\n error: error,\n reason: error.message\n });\n }\n videoTrack.pesData = avcData;\n audioTrack.pesData = audioData;\n id3Track.pesData = id3Data;\n var demuxResult = {\n audioTrack: audioTrack,\n videoTrack: videoTrack,\n id3Track: id3Track,\n textTrack: textTrack\n };\n if (flush) {\n this.extractRemainingSamples(demuxResult);\n }\n return demuxResult;\n };\n _proto.flush = function flush() {\n var remainderData = this.remainderData;\n this.remainderData = null;\n var result;\n if (remainderData) {\n result = this.demux(remainderData, -1, false, true);\n } else {\n result = {\n videoTrack: this._avcTrack,\n audioTrack: this._audioTrack,\n id3Track: this._id3Track,\n textTrack: this._txtTrack\n };\n }\n this.extractRemainingSamples(result);\n if (this.sampleAes) {\n return this.decrypt(result, this.sampleAes);\n }\n return result;\n };\n _proto.extractRemainingSamples = function extractRemainingSamples(demuxResult) {\n var audioTrack = demuxResult.audioTrack,\n videoTrack = demuxResult.videoTrack,\n id3Track = demuxResult.id3Track,\n textTrack = demuxResult.textTrack;\n var avcData = videoTrack.pesData;\n var audioData = audioTrack.pesData;\n var id3Data = id3Track.pesData;\n // try to parse last PES packets\n var pes;\n if (avcData && (pes = parsePES(avcData))) {\n this.parseAVCPES(videoTrack, textTrack, pes, true);\n videoTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n videoTrack.pesData = avcData;\n }\n if (audioData && (pes = parsePES(audioData))) {\n switch (audioTrack.segmentCodec) {\n case 'aac':\n this.parseAACPES(audioTrack, pes);\n break;\n case 'mp3':\n this.parseMPEGPES(audioTrack, pes);\n break;\n }\n audioTrack.pesData = null;\n } else {\n if (audioData != null && audioData.size) {\n logger.log('last AAC PES packet truncated,might overlap between fragments');\n }\n\n // either audioData null or PES truncated, keep it for next frag parsing\n audioTrack.pesData = audioData;\n }\n if (id3Data && (pes = parsePES(id3Data))) {\n this.parseID3PES(id3Track, pes);\n id3Track.pesData = null;\n } else {\n // either id3Data null or PES truncated, keep it for next frag parsing\n id3Track.pesData = id3Data;\n }\n };\n _proto.demuxSampleAes = function demuxSampleAes(data, keyData, timeOffset) {\n var demuxResult = this.demux(data, timeOffset, true, !this.config.progressive);\n var sampleAes = this.sampleAes = new SampleAesDecrypter(this.observer, this.config, keyData);\n return this.decrypt(demuxResult, sampleAes);\n };\n _proto.decrypt = function decrypt(demuxResult, sampleAes) {\n return new Promise(function (resolve) {\n var audioTrack = demuxResult.audioTrack,\n videoTrack = demuxResult.videoTrack;\n if (audioTrack.samples && audioTrack.segmentCodec === 'aac') {\n sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n if (videoTrack.samples) {\n sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n resolve(demuxResult);\n });\n } else {\n resolve(demuxResult);\n }\n });\n } else if (videoTrack.samples) {\n sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n resolve(demuxResult);\n });\n }\n });\n };\n _proto.destroy = function destroy() {\n this._duration = 0;\n };\n _proto.parseAVCPES = function parseAVCPES(track, textTrack, pes, last) {\n var _this = this;\n var units = this.parseAVCNALu(track, pes.data);\n var avcSample = this.avcSample;\n var push;\n var spsfound = false;\n // free pes.data to save up some memory\n pes.data = null;\n\n // if new NAL units found and last sample still there, let's push ...\n // this helps parsing streams with missing AUD (only do this if AUD never found)\n if (avcSample && units.length && !track.audFound) {\n pushAccessUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n units.forEach(function (unit) {\n var _avcSample2;\n switch (unit.type) {\n // NDR\n case 1:\n {\n var iskey = false;\n push = true;\n var data = unit.data;\n // only check slice type to detect KF in case SPS found in same packet (any keyframe is preceded by SPS ...)\n if (spsfound && data.length > 4) {\n // retrieve slice type by parsing beginning of NAL unit (follow H264 spec, slice_header definition) to detect keyframe embedded in NDR\n var sliceType = new ExpGolomb(data).readSliceType();\n // 2 : I slice, 4 : SI slice, 7 : I slice, 9: SI slice\n // SI slice : A slice that is coded using intra prediction only and using quantisation of the prediction samples.\n // An SI slice can be coded such that its decoded samples can be constructed identically to an SP slice.\n // I slice: A slice that is not an SI slice that is decoded using intra prediction only.\n // if (sliceType === 2 || sliceType === 7) {\n if (sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9) {\n iskey = true;\n }\n }\n if (iskey) {\n var _avcSample;\n // if we have non-keyframe data already, that cannot belong to the same frame as a keyframe, so force a push\n if ((_avcSample = avcSample) != null && _avcSample.frame && !avcSample.key) {\n pushAccessUnit(avcSample, track);\n avcSample = _this.avcSample = null;\n }\n }\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n avcSample.frame = true;\n avcSample.key = iskey;\n break;\n // IDR\n }\n\n case 5:\n push = true;\n // handle PES not starting with AUD\n // if we have non-keyframe data already, that cannot belong to the same frame as a keyframe, so force a push\n if ((_avcSample2 = avcSample) != null && _avcSample2.frame && !avcSample.key) {\n pushAccessUnit(avcSample, track);\n avcSample = _this.avcSample = null;\n }\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n avcSample.key = true;\n avcSample.frame = true;\n break;\n // SEI\n case 6:\n {\n push = true;\n parseSEIMessageFromNALu(unit.data, 1, pes.pts, textTrack.samples);\n break;\n // SPS\n }\n\n case 7:\n push = true;\n spsfound = true;\n if (!track.sps) {\n var sps = unit.data;\n var expGolombDecoder = new ExpGolomb(sps);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [sps];\n track.duration = _this._duration;\n var codecarray = sps.subarray(1, 4);\n var codecstring = 'avc1.';\n for (var i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecstring += h;\n }\n track.codec = codecstring;\n }\n break;\n // PPS\n case 8:\n push = true;\n if (!track.pps) {\n track.pps = [unit.data];\n }\n break;\n // AUD\n case 9:\n push = false;\n track.audFound = true;\n if (avcSample) {\n pushAccessUnit(avcSample, track);\n }\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n break;\n // Filler Data\n case 12:\n push = true;\n break;\n default:\n push = false;\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n break;\n }\n if (avcSample && push) {\n var _units = avcSample.units;\n _units.push(unit);\n }\n });\n // if last PES packet, push samples\n if (last && avcSample) {\n pushAccessUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n _proto.getLastNalUnit = function getLastNalUnit(samples) {\n var _avcSample3;\n var avcSample = this.avcSample;\n var lastUnit;\n // try to fallback to previous sample if current one is empty\n if (!avcSample || avcSample.units.length === 0) {\n avcSample = samples[samples.length - 1];\n }\n if ((_avcSample3 = avcSample) != null && _avcSample3.units) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n return lastUnit;\n };\n _proto.parseAVCNALu = function parseAVCNALu(track, array) {\n var len = array.byteLength;\n var state = track.naluState || 0;\n var lastState = state;\n var units = [];\n var i = 0;\n var value;\n var overflow;\n var unitType;\n var lastUnitStart = -1;\n var lastUnitType = 0;\n // logger.log('PES:' + Hex.hexDump(array));\n\n if (state === -1) {\n // special use case where we found 3 or 4-byte start codes exactly at the end of previous PES packet\n lastUnitStart = 0;\n // NALu type is value read from offset 0\n lastUnitType = array[0] & 0x1f;\n state = 0;\n i = 1;\n }\n while (i < len) {\n value = array[i++];\n // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n }\n // here we have state either equal to 2 or 3\n if (!value) {\n state = 3;\n } else if (value === 1) {\n if (lastUnitStart >= 0) {\n var unit = {\n data: array.subarray(lastUnitStart, i - state - 1),\n type: lastUnitType\n };\n // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);\n units.push(unit);\n } else {\n // lastUnitStart is undefined => this is the first start code found in this PES packet\n // first check if start code delimiter is overlapping between 2 PES packets,\n // ie it started in last packet (lastState not zero)\n // and ended at the beginning of this PES packet (i <= 4 - lastState)\n var lastUnit = this.getLastNalUnit(track.samples);\n if (lastUnit) {\n if (lastState && i <= 4 - lastState) {\n // start delimiter overlapping between PES packets\n // strip start delimiter bytes from the end of last NAL unit\n // check if lastUnit had a state different from zero\n if (lastUnit.state) {\n // strip last bytes\n lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState);\n }\n }\n // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n overflow = i - state - 1;\n if (overflow > 0) {\n // logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n lastUnit.state = 0;\n }\n }\n }\n // check if we can read unit type\n if (i < len) {\n unitType = array[i] & 0x1f;\n // logger.log('find NALU @ offset:' + i + ',type:' + unitType);\n lastUnitStart = i;\n lastUnitType = unitType;\n state = 0;\n } else {\n // not enough byte to read unit type. let's read it on next PES parsing\n state = -1;\n }\n } else {\n state = 0;\n }\n }\n if (lastUnitStart >= 0 && state >= 0) {\n var _unit = {\n data: array.subarray(lastUnitStart, len),\n type: lastUnitType,\n state: state\n };\n units.push(_unit);\n // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);\n }\n // no NALu found\n if (units.length === 0) {\n // append pes.data to previous NAL unit\n var _lastUnit = this.getLastNalUnit(track.samples);\n if (_lastUnit) {\n var _tmp = new Uint8Array(_lastUnit.data.byteLength + array.byteLength);\n _tmp.set(_lastUnit.data, 0);\n _tmp.set(array, _lastUnit.data.byteLength);\n _lastUnit.data = _tmp;\n }\n }\n track.naluState = state;\n return units;\n };\n _proto.parseAACPES = function parseAACPES(track, pes) {\n var startOffset = 0;\n var aacOverFlow = this.aacOverFlow;\n var data = pes.data;\n if (aacOverFlow) {\n this.aacOverFlow = null;\n var frameMissingBytes = aacOverFlow.missing;\n var sampleLength = aacOverFlow.sample.unit.byteLength;\n // logger.log(`AAC: append overflowing ${sampleLength} bytes to beginning of new PES`);\n if (frameMissingBytes === -1) {\n var tmp = new Uint8Array(sampleLength + data.byteLength);\n tmp.set(aacOverFlow.sample.unit, 0);\n tmp.set(data, sampleLength);\n data = tmp;\n } else {\n var frameOverflowBytes = sampleLength - frameMissingBytes;\n aacOverFlow.sample.unit.set(data.subarray(0, frameMissingBytes), frameOverflowBytes);\n track.samples.push(aacOverFlow.sample);\n startOffset = aacOverFlow.missing;\n }\n }\n // look for ADTS header (0xFFFx)\n var offset;\n var len;\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (isHeader$1(data, offset)) {\n break;\n }\n }\n // if ADTS header does not start straight from the beginning of the PES payload, raise an error\n if (offset !== startOffset) {\n var reason;\n var recoverable = offset < len - 1;\n if (recoverable) {\n reason = \"AAC PES did not start with ADTS header,offset:\" + offset;\n } else {\n reason = 'No ADTS header found in AAC PES';\n }\n var error = new Error(reason);\n logger.warn(\"parsing error: \" + reason);\n this.observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: false,\n levelRetry: recoverable,\n error: error,\n reason: reason\n });\n if (!recoverable) {\n return;\n }\n }\n initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n var pts;\n if (pes.pts !== undefined) {\n pts = pes.pts;\n } else if (aacOverFlow) {\n // if last AAC frame is overflowing, we should ensure timestamps are contiguous:\n // first sample PTS should be equal to last sample PTS + frameDuration\n var frameDuration = getFrameDuration(track.samplerate);\n pts = aacOverFlow.sample.pts + frameDuration;\n } else {\n logger.warn('[tsdemuxer]: AAC PES unknown PTS');\n return;\n }\n\n // scan for aac samples\n var frameIndex = 0;\n var frame;\n while (offset < len) {\n frame = appendFrame$1(track, data, offset, pts, frameIndex);\n offset += frame.length;\n if (!frame.missing) {\n frameIndex++;\n for (; offset < len - 1; offset++) {\n if (isHeader$1(data, offset)) {\n break;\n }\n }\n } else {\n this.aacOverFlow = frame;\n break;\n }\n }\n };\n _proto.parseMPEGPES = function parseMPEGPES(track, pes) {\n var data = pes.data;\n var length = data.length;\n var frameIndex = 0;\n var offset = 0;\n var pts = pes.pts;\n if (pts === undefined) {\n logger.warn('[tsdemuxer]: MPEG PES unknown PTS');\n return;\n }\n while (offset < length) {\n if (isHeader(data, offset)) {\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n frameIndex++;\n } else {\n // logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n };\n _proto.parseID3PES = function parseID3PES(id3Track, pes) {\n if (pes.pts === undefined) {\n logger.warn('[tsdemuxer]: ID3 PES unknown PTS');\n return;\n }\n var id3Sample = _extends({}, pes, {\n type: this._avcTrack ? MetadataSchema.emsg : MetadataSchema.audioId3,\n duration: Number.POSITIVE_INFINITY\n });\n id3Track.samples.push(id3Sample);\n };\n return TSDemuxer;\n }();\n function createAVCSample(key, pts, dts, debug) {\n return {\n key: key,\n frame: false,\n pts: pts,\n dts: dts,\n units: [],\n debug: debug,\n length: 0\n };\n }\n function parsePID(data, offset) {\n // pid is a 13-bit field starting at the last bit of TS[1]\n return ((data[offset + 1] & 0x1f) << 8) + data[offset + 2];\n }\n function parsePAT(data, offset) {\n // skip the PSI header and parse the first PMT entry\n return (data[offset + 10] & 0x1f) << 8 | data[offset + 11];\n }\n function parsePMT(data, offset, typeSupported, isSampleAes) {\n var result = {\n audio: -1,\n avc: -1,\n id3: -1,\n segmentCodec: 'aac'\n };\n var sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n var tableEnd = offset + 3 + sectionLength - 4;\n // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n var programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11];\n // advance the offset to the first entry in the mapping table\n offset += 12 + programInfoLength;\n while (offset < tableEnd) {\n var pid = parsePID(data, offset);\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n logger.log('ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream');\n break;\n }\n /* falls through */\n case 0x0f:\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n // logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n break;\n\n // Packetized metadata (ID3)\n case 0x15:\n // logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n break;\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n logger.log('H.264 with AES-128-CBC slice encryption found in unencrypted stream');\n break;\n }\n /* falls through */\n case 0x1b:\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n // logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n break;\n\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n case 0x03:\n case 0x04:\n // logger.log('MPEG PID:' + pid);\n if (typeSupported.mpeg !== true && typeSupported.mp3 !== true) {\n logger.log('MPEG audio found, not supported in this browser');\n } else if (result.audio === -1) {\n result.audio = pid;\n result.segmentCodec = 'mp3';\n }\n break;\n case 0x24:\n logger.warn('Unsupported HEVC stream type found');\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0f) << 8 | data[offset + 4]) + 5;\n }\n return result;\n }\n function parsePES(stream) {\n var i = 0;\n var frag;\n var pesLen;\n var pesHdrLen;\n var pesPts;\n var pesDts;\n var data = stream.data;\n // safety check\n if (!stream || stream.size === 0) {\n return null;\n }\n\n // we might need up to 19 bytes to read PES header\n // if first chunk of data is less than 19 bytes, let's merge it with following ones until we get 19 bytes\n // usually only one merge is needed (and this is rare ...)\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n }\n // retrieve PTS/DTS from first fragment\n frag = data[0];\n var pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5];\n // if PES parsed length is not zero and greater than total received length, stop parsing. PES might be truncated\n // minus 6 : PES header size\n if (pesLen && pesLen > stream.size - 6) {\n return null;\n }\n var pesFlags = frag[7];\n if (pesFlags & 0xc0) {\n /* PES header described here : http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n as PTS / DTS is 33 bit we cannot use bitwise operator in JS,\n as Bitwise operators treat their operands as a sequence of 32 bits */\n pesPts = (frag[9] & 0x0e) * 536870912 +\n // 1 << 29\n (frag[10] & 0xff) * 4194304 +\n // 1 << 22\n (frag[11] & 0xfe) * 16384 +\n // 1 << 14\n (frag[12] & 0xff) * 128 +\n // 1 << 7\n (frag[13] & 0xfe) / 2;\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0e) * 536870912 +\n // 1 << 29\n (frag[15] & 0xff) * 4194304 +\n // 1 << 22\n (frag[16] & 0xfe) * 16384 +\n // 1 << 14\n (frag[17] & 0xff) * 128 +\n // 1 << 7\n (frag[18] & 0xfe) / 2;\n if (pesPts - pesDts > 60 * 90000) {\n logger.warn(Math.round((pesPts - pesDts) / 90000) + \"s delta between PTS and DTS, align them\");\n pesPts = pesDts;\n }\n } else {\n pesDts = pesPts;\n }\n }\n pesHdrLen = frag[8];\n // 9 bytes : 6 bytes for PES header + 3 bytes for PES extension\n var payloadStartOffset = pesHdrLen + 9;\n if (stream.size <= payloadStartOffset) {\n return null;\n }\n stream.size -= payloadStartOffset;\n // reassemble PES packet\n var pesData = new Uint8Array(stream.size);\n for (var j = 0, dataLen = data.length; j < dataLen; j++) {\n frag = data[j];\n var len = frag.byteLength;\n if (payloadStartOffset) {\n if (payloadStartOffset > len) {\n // trim full frag if PES header bigger than frag\n payloadStartOffset -= len;\n continue;\n } else {\n // trim partial frag if PES header smaller than frag\n frag = frag.subarray(payloadStartOffset);\n len -= payloadStartOffset;\n payloadStartOffset = 0;\n }\n }\n pesData.set(frag, i);\n i += len;\n }\n if (pesLen) {\n // payload size : remove PES header + PES extension\n pesLen -= pesHdrLen + 3;\n }\n return {\n data: pesData,\n pts: pesPts,\n dts: pesDts,\n len: pesLen\n };\n }\n return null;\n }\n function pushAccessUnit(avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n // if sample does not have PTS/DTS, patch with last sample PTS/DTS\n if (avcSample.pts === undefined) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length;\n if (nbSamples) {\n var lastSample = samples[nbSamples - 1];\n avcSample.pts = lastSample.pts;\n avcSample.dts = lastSample.dts;\n } else {\n // dropping samples, no timestamp found\n avcTrack.dropped++;\n return;\n }\n }\n avcTrack.samples.push(avcSample);\n }\n if (avcSample.debug.length) {\n logger.log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n }\n\n var MP3Demuxer = /*#__PURE__*/function (_BaseAudioDemuxer) {\n _inheritsLoose(MP3Demuxer, _BaseAudioDemuxer);\n function MP3Demuxer() {\n return _BaseAudioDemuxer.apply(this, arguments) || this;\n }\n var _proto = MP3Demuxer.prototype;\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, trackDuration) {\n _BaseAudioDemuxer.prototype.resetInitSegment.call(this, initSegment, audioCodec, videoCodec, trackDuration);\n this._audioTrack = {\n container: 'audio/mpeg',\n type: 'audio',\n id: 2,\n pid: -1,\n sequenceNumber: 0,\n segmentCodec: 'mp3',\n samples: [],\n manifestCodec: audioCodec,\n duration: trackDuration,\n inputTimeScale: 90000,\n dropped: 0\n };\n };\n MP3Demuxer.probe = function probe$1(data) {\n if (!data) {\n return false;\n }\n\n // check if data contains ID3 timestamp and MPEG sync word\n // Look for MPEG header | 1111 1111 | 111X XYZX | where X can be either 0 or 1 and Y or Z should be 1\n // Layer bits (position 14 and 15) in header should be always different from 0 (Layer I or Layer II or Layer III)\n // More info http://www.mp3-tech.org/programmer/frame_header.html\n var id3Data = getID3Data(data, 0) || [];\n var offset = id3Data.length;\n for (var length = data.length; offset < length; offset++) {\n if (probe(data, offset)) {\n logger.log('MPEG Audio sync word found !');\n return true;\n }\n }\n return false;\n };\n _proto.canParse = function canParse$1(data, offset) {\n return canParse(data, offset);\n };\n _proto.appendFrame = function appendFrame$1(track, data, offset) {\n if (this.basePTS === null) {\n return;\n }\n return appendFrame(track, data, offset, this.basePTS, this.frameIndex);\n };\n return MP3Demuxer;\n }(BaseAudioDemuxer);\n\n /**\n * AAC helper\n */\n var AAC = /*#__PURE__*/function () {\n function AAC() {}\n AAC.getSilentFrame = function getSilentFrame(codec, channelCount) {\n switch (codec) {\n case 'mp4a.40.2':\n if (channelCount === 1) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x23, 0x80]);\n } else if (channelCount === 2) {\n return new Uint8Array([0x21, 0x00, 0x49, 0x90, 0x02, 0x19, 0x00, 0x23, 0x80]);\n } else if (channelCount === 3) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x8e]);\n } else if (channelCount === 4) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x80, 0x2c, 0x80, 0x08, 0x02, 0x38]);\n } else if (channelCount === 5) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x38]);\n } else if (channelCount === 6) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64, 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x00, 0xb2, 0x00, 0x20, 0x08, 0xe0]);\n }\n break;\n // handle HE-AAC below (mp4a.40.5 / mp4a.40.29)\n default:\n if (channelCount === 1) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0:d=0.05\" -c:a libfdk_aac -profile:a aac_he -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x4e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x1c, 0x6, 0xf1, 0xc1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n } else if (channelCount === 2) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0|0:d=0.05\" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n } else if (channelCount === 3) {\n // ffmpeg -y -f lavfi -i \"aevalsrc=0|0|0:d=0.05\" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 \"0x%x,\" \"\\n\"' -v output.aac\n return new Uint8Array([0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e]);\n }\n break;\n }\n return undefined;\n };\n return AAC;\n }();\n\n /**\n * Generate MP4 Box\n */\n\n var UINT32_MAX = Math.pow(2, 32) - 1;\n var MP4 = /*#__PURE__*/function () {\n function MP4() {}\n MP4.init = function init() {\n MP4.types = {\n avc1: [],\n // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n var i;\n for (i in MP4.types) {\n if (MP4.types.hasOwnProperty(i)) {\n MP4.types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)];\n }\n }\n var videoHdlr = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0x76, 0x69, 0x64, 0x65,\n // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n\n var audioHdlr = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0x73, 0x6f, 0x75, 0x6e,\n // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n\n MP4.HDLR_TYPES = {\n video: videoHdlr,\n audio: audioHdlr\n };\n var dref = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x01,\n // entry_count\n 0x00, 0x00, 0x00, 0x0c,\n // entry_size\n 0x75, 0x72, 0x6c, 0x20,\n // 'url' type\n 0x00,\n // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n\n var stco = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n MP4.STSZ = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n\n MP4.VMHD = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x01,\n // flags\n 0x00, 0x00,\n // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n\n MP4.SMHD = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00,\n // balance\n 0x00, 0x00 // reserved\n ]);\n\n MP4.STSD = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x01]); // entry_count\n\n var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom\n var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1\n var minorVersion = new Uint8Array([0, 0, 0, 1]);\n MP4.FTYP = MP4.box(MP4.types.ftyp, majorBrand, minorVersion, majorBrand, avc1Brand);\n MP4.DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, dref));\n };\n MP4.box = function box(type) {\n var size = 8;\n for (var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n payload[_key - 1] = arguments[_key];\n }\n var i = payload.length;\n var len = i;\n // calculate the total size we need to allocate\n while (i--) {\n size += payload[i].byteLength;\n }\n var result = new Uint8Array(size);\n result[0] = size >> 24 & 0xff;\n result[1] = size >> 16 & 0xff;\n result[2] = size >> 8 & 0xff;\n result[3] = size & 0xff;\n result.set(type, 4);\n // copy the payload into the result\n for (i = 0, size = 8; i < len; i++) {\n // copy payload[i] array @ offset size\n result.set(payload[i], size);\n size += payload[i].byteLength;\n }\n return result;\n };\n MP4.hdlr = function hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n MP4.mdat = function mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n };\n MP4.mdhd = function mdhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.mdhd, new Uint8Array([0x01,\n // version 1\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n // modification_time\n timescale >> 24 & 0xff, timescale >> 16 & 0xff, timescale >> 8 & 0xff, timescale & 0xff,\n // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xff, upperWordDuration >> 8 & 0xff, upperWordDuration & 0xff, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xff, lowerWordDuration >> 8 & 0xff, lowerWordDuration & 0xff, 0x55, 0xc4,\n // 'und' language (undetermined)\n 0x00, 0x00]));\n };\n MP4.mdia = function mdia(track) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(track.timescale, track.duration), MP4.hdlr(track.type), MP4.minf(track));\n };\n MP4.mfhd = function mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00,\n // flags\n sequenceNumber >> 24, sequenceNumber >> 16 & 0xff, sequenceNumber >> 8 & 0xff, sequenceNumber & 0xff // sequence_number\n ]));\n };\n MP4.minf = function minf(track) {\n if (track.type === 'audio') {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.smhd, MP4.SMHD), MP4.DINF, MP4.stbl(track));\n } else {\n return MP4.box(MP4.types.minf, MP4.box(MP4.types.vmhd, MP4.VMHD), MP4.DINF, MP4.stbl(track));\n }\n };\n MP4.moof = function moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n };\n MP4.moov = function moov(tracks) {\n var i = tracks.length;\n var boxes = [];\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.moov, MP4.mvhd(tracks[0].timescale, tracks[0].duration)].concat(boxes).concat(MP4.mvex(tracks)));\n };\n MP4.mvex = function mvex(tracks) {\n var i = tracks.length;\n var boxes = [];\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\n MP4.mvhd = function mvhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n var bytes = new Uint8Array([0x01,\n // version 1\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n // modification_time\n timescale >> 24 & 0xff, timescale >> 16 & 0xff, timescale >> 8 & 0xff, timescale & 0xff,\n // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xff, upperWordDuration >> 8 & 0xff, upperWordDuration & 0xff, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xff, lowerWordDuration >> 8 & 0xff, lowerWordDuration & 0xff, 0x00, 0x01, 0x00, 0x00,\n // 1.0 rate\n 0x01, 0x00,\n // 1.0 volume\n 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,\n // transformation: unity matrix\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n\n return MP4.box(MP4.types.mvhd, bytes);\n };\n MP4.sdtp = function sdtp(track) {\n var samples = track.samples || [];\n var bytes = new Uint8Array(4 + samples.length);\n var i;\n var flags;\n // leave the full box header (4 bytes) all zero\n // write the sample table\n for (i = 0; i < samples.length; i++) {\n flags = samples[i].flags;\n bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;\n }\n return MP4.box(MP4.types.sdtp, bytes);\n };\n MP4.stbl = function stbl(track) {\n return MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.box(MP4.types.stts, MP4.STTS), MP4.box(MP4.types.stsc, MP4.STSC), MP4.box(MP4.types.stsz, MP4.STSZ), MP4.box(MP4.types.stco, MP4.STCO));\n };\n MP4.avc1 = function avc1(track) {\n var sps = [];\n var pps = [];\n var i;\n var data;\n var len;\n // assemble the SPSs\n\n for (i = 0; i < track.sps.length; i++) {\n data = track.sps[i];\n len = data.byteLength;\n sps.push(len >>> 8 & 0xff);\n sps.push(len & 0xff);\n\n // SPS\n sps = sps.concat(Array.prototype.slice.call(data));\n }\n\n // assemble the PPSs\n for (i = 0; i < track.pps.length; i++) {\n data = track.pps[i];\n len = data.byteLength;\n pps.push(len >>> 8 & 0xff);\n pps.push(len & 0xff);\n pps = pps.concat(Array.prototype.slice.call(data));\n }\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01,\n // version\n sps[3],\n // profile\n sps[4],\n // profile compat\n sps[5],\n // level\n 0xfc | 3,\n // lengthSizeMinusOne, hard-coded to 4 bytes\n 0xe0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets\n ].concat(sps).concat([track.pps.length // numOfPictureParameterSets\n ]).concat(pps))); // \"PPS\"\n var width = track.width;\n var height = track.height;\n var hSpacing = track.pixelRatio[0];\n var vSpacing = track.pixelRatio[1];\n return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // data_reference_index\n 0x00, 0x00,\n // pre_defined\n 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n width >> 8 & 0xff, width & 0xff,\n // width\n height >> 8 & 0xff, height & 0xff,\n // height\n 0x00, 0x48, 0x00, 0x00,\n // horizresolution\n 0x00, 0x48, 0x00, 0x00,\n // vertresolution\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // frame_count\n 0x12, 0x64, 0x61, 0x69, 0x6c,\n // dailymotion/hls.js\n 0x79, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x68, 0x6c, 0x73, 0x2e, 0x6a, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // compressorname\n 0x00, 0x18,\n // depth = 24\n 0x11, 0x11]),\n // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80,\n // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0,\n // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])),\n // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24,\n // hSpacing\n hSpacing >> 16 & 0xff, hSpacing >> 8 & 0xff, hSpacing & 0xff, vSpacing >> 24,\n // vSpacing\n vSpacing >> 16 & 0xff, vSpacing >> 8 & 0xff, vSpacing & 0xff])));\n };\n MP4.esds = function esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n\n 0x03,\n // descriptor_type\n 0x17 + configlen,\n // length\n 0x00, 0x01,\n // es_id\n 0x00,\n // stream_priority\n\n 0x04,\n // descriptor_type\n 0x0f + configlen,\n // length\n 0x40,\n // codec : mpeg4_audio\n 0x15,\n // stream_type\n 0x00, 0x00, 0x00,\n // buffer_size\n 0x00, 0x00, 0x00, 0x00,\n // maxBitrate\n 0x00, 0x00, 0x00, 0x00,\n // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n MP4.mp4a = function mp4a(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, track.channelCount,\n // channelcount\n 0x00, 0x10,\n // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00,\n // reserved2\n samplerate >> 8 & 0xff, samplerate & 0xff,\n //\n 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n MP4.mp3 = function mp3(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, track.channelCount,\n // channelcount\n 0x00, 0x10,\n // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00,\n // reserved2\n samplerate >> 8 & 0xff, samplerate & 0xff,\n //\n 0x00, 0x00]));\n };\n MP4.stsd = function stsd(track) {\n if (track.type === 'audio') {\n if (track.segmentCodec === 'mp3' && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));\n } else {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));\n }\n };\n MP4.tkhd = function tkhd(track) {\n var id = track.id;\n var duration = track.duration * track.timescale;\n var width = track.width;\n var height = track.height;\n var upperWordDuration = Math.floor(duration / (UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([0x01,\n // version 1\n 0x00, 0x00, 0x07,\n // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,\n // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,\n // modification_time\n id >> 24 & 0xff, id >> 16 & 0xff, id >> 8 & 0xff, id & 0xff,\n // track_ID\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xff, upperWordDuration >> 8 & 0xff, upperWordDuration & 0xff, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xff, lowerWordDuration >> 8 & 0xff, lowerWordDuration & 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00,\n // layer\n 0x00, 0x00,\n // alternate_group\n 0x00, 0x00,\n // non-audio track volume\n 0x00, 0x00,\n // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,\n // transformation: unity matrix\n width >> 8 & 0xff, width & 0xff, 0x00, 0x00,\n // width\n height >> 8 & 0xff, height & 0xff, 0x00, 0x00 // height\n ]));\n };\n MP4.traf = function traf(track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track);\n var id = track.id;\n var upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n id >> 24, id >> 16 & 0xff, id >> 8 & 0xff, id & 0xff // track_ID\n ])), MP4.box(MP4.types.tfdt, new Uint8Array([0x01,\n // version 1\n 0x00, 0x00, 0x00,\n // flags\n upperWordBaseMediaDecodeTime >> 24, upperWordBaseMediaDecodeTime >> 16 & 0xff, upperWordBaseMediaDecodeTime >> 8 & 0xff, upperWordBaseMediaDecodeTime & 0xff, lowerWordBaseMediaDecodeTime >> 24, lowerWordBaseMediaDecodeTime >> 16 & 0xff, lowerWordBaseMediaDecodeTime >> 8 & 0xff, lowerWordBaseMediaDecodeTime & 0xff])), MP4.trun(track, sampleDependencyTable.length + 16 +\n // tfhd\n 20 +\n // tfdt\n 8 +\n // traf header\n 16 +\n // mfhd\n 8 +\n // moof header\n 8),\n // mdat header\n sampleDependencyTable);\n }\n\n /**\n * Generate a track box.\n * @param track a track definition\n */;\n MP4.trak = function trak(track) {\n track.duration = track.duration || 0xffffffff;\n return MP4.box(MP4.types.trak, MP4.tkhd(track), MP4.mdia(track));\n };\n MP4.trex = function trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n id >> 24, id >> 16 & 0xff, id >> 8 & 0xff, id & 0xff,\n // track_ID\n 0x00, 0x00, 0x00, 0x01,\n // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_duration\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n MP4.trun = function trun(track, offset) {\n var samples = track.samples || [];\n var len = samples.length;\n var arraylen = 12 + 16 * len;\n var array = new Uint8Array(arraylen);\n var i;\n var sample;\n var duration;\n var size;\n var flags;\n var cts;\n offset += 8 + arraylen;\n array.set([track.type === 'video' ? 0x01 : 0x00,\n // version 1 for video with signed-int sample_composition_time_offset\n 0x00, 0x0f, 0x01,\n // flags\n len >>> 24 & 0xff, len >>> 16 & 0xff, len >>> 8 & 0xff, len & 0xff,\n // sample_count\n offset >>> 24 & 0xff, offset >>> 16 & 0xff, offset >>> 8 & 0xff, offset & 0xff // data_offset\n ], 0);\n for (i = 0; i < len; i++) {\n sample = samples[i];\n duration = sample.duration;\n size = sample.size;\n flags = sample.flags;\n cts = sample.cts;\n array.set([duration >>> 24 & 0xff, duration >>> 16 & 0xff, duration >>> 8 & 0xff, duration & 0xff,\n // sample_duration\n size >>> 24 & 0xff, size >>> 16 & 0xff, size >>> 8 & 0xff, size & 0xff,\n // sample_size\n flags.isLeading << 2 | flags.dependsOn, flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.paddingValue << 1 | flags.isNonSync, flags.degradPrio & 0xf0 << 8, flags.degradPrio & 0x0f,\n // sample_flags\n cts >>> 24 & 0xff, cts >>> 16 & 0xff, cts >>> 8 & 0xff, cts & 0xff // sample_composition_time_offset\n ], 12 + 16 * i);\n }\n return MP4.box(MP4.types.trun, array);\n };\n MP4.initSegment = function initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n var movie = MP4.moov(tracks);\n var result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n return MP4;\n }();\n MP4.types = void 0;\n MP4.HDLR_TYPES = void 0;\n MP4.STTS = void 0;\n MP4.STSC = void 0;\n MP4.STCO = void 0;\n MP4.STSZ = void 0;\n MP4.VMHD = void 0;\n MP4.SMHD = void 0;\n MP4.STSD = void 0;\n MP4.FTYP = void 0;\n MP4.DINF = void 0;\n\n var MPEG_TS_CLOCK_FREQ_HZ = 90000;\n function toTimescaleFromBase(baseTime, destScale, srcBase, round) {\n if (srcBase === void 0) {\n srcBase = 1;\n }\n if (round === void 0) {\n round = false;\n }\n var result = baseTime * destScale * srcBase; // equivalent to `(value * scale) / (1 / base)`\n return round ? Math.round(result) : result;\n }\n function toMsFromMpegTsClock(baseTime, round) {\n if (round === void 0) {\n round = false;\n }\n return toTimescaleFromBase(baseTime, 1000, 1 / MPEG_TS_CLOCK_FREQ_HZ, round);\n }\n\n var MAX_SILENT_FRAME_DURATION = 10 * 1000; // 10 seconds\n var AAC_SAMPLES_PER_FRAME = 1024;\n var MPEG_AUDIO_SAMPLE_PER_FRAME = 1152;\n var chromeVersion = null;\n var safariWebkitVersion = null;\n var MP4Remuxer = /*#__PURE__*/function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n this.observer = void 0;\n this.config = void 0;\n this.typeSupported = void 0;\n this.ISGenerated = false;\n this._initPTS = null;\n this._initDTS = null;\n this.nextAvcDts = null;\n this.nextAudioPts = null;\n this.videoSampleDuration = null;\n this.isAudioContiguous = false;\n this.isVideoContiguous = false;\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.ISGenerated = false;\n if (chromeVersion === null) {\n var userAgent = navigator.userAgent || '';\n var result = userAgent.match(/Chrome\\/(\\d+)/i);\n chromeVersion = result ? parseInt(result[1]) : 0;\n }\n if (safariWebkitVersion === null) {\n var _result = navigator.userAgent.match(/Safari\\/(\\d+)/i);\n safariWebkitVersion = _result ? parseInt(_result[1]) : 0;\n }\n }\n var _proto = MP4Remuxer.prototype;\n _proto.destroy = function destroy() {};\n _proto.resetTimeStamp = function resetTimeStamp(defaultTimeStamp) {\n logger.log('[mp4-remuxer]: initPTS & initDTS reset');\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n _proto.resetNextTimestamp = function resetNextTimestamp() {\n logger.log('[mp4-remuxer]: reset next timestamp');\n this.isVideoContiguous = false;\n this.isAudioContiguous = false;\n };\n _proto.resetInitSegment = function resetInitSegment() {\n logger.log('[mp4-remuxer]: ISGenerated flag reset');\n this.ISGenerated = false;\n };\n _proto.getVideoStartPts = function getVideoStartPts(videoSamples) {\n var rolloverDetected = false;\n var startPTS = videoSamples.reduce(function (minPTS, sample) {\n var delta = sample.pts - minPTS;\n if (delta < -4294967296) {\n // 2^32, see PTSNormalize for reasoning, but we're hitting a rollover here, and we don't want that to impact the timeOffset calculation\n rolloverDetected = true;\n return normalizePts(minPTS, sample.pts);\n } else if (delta > 0) {\n return minPTS;\n } else {\n return sample.pts;\n }\n }, videoSamples[0].pts);\n if (rolloverDetected) {\n logger.debug('PTS rollover detected');\n }\n return startPTS;\n };\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, accurateTimeOffset, flush, playlistType) {\n var video;\n var audio;\n var initSegment;\n var text;\n var id3;\n var independent;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n\n // If we're remuxing audio and video progressively, wait until we've received enough samples for each track before proceeding.\n // This is done to synchronize the audio and video streams. We know if the current segment will have samples if the \"pid\"\n // parameter is greater than -1. The pid is set when the PMT is parsed, which contains the tracks list.\n // However, if the initSegment has already been generated, or we've reached the end of a segment (flush),\n // then we can remux one track without waiting for the other.\n var hasAudio = audioTrack.pid > -1;\n var hasVideo = videoTrack.pid > -1;\n var length = videoTrack.samples.length;\n var enoughAudioSamples = audioTrack.samples.length > 0;\n var enoughVideoSamples = flush && length > 0 || length > 1;\n var canRemuxAvc = (!hasAudio || enoughAudioSamples) && (!hasVideo || enoughVideoSamples) || this.ISGenerated || flush;\n if (canRemuxAvc) {\n if (!this.ISGenerated) {\n initSegment = this.generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset);\n }\n var isVideoContiguous = this.isVideoContiguous;\n var firstKeyFrameIndex = -1;\n var firstKeyFramePTS;\n if (enoughVideoSamples) {\n firstKeyFrameIndex = findKeyframeIndex(videoTrack.samples);\n if (!isVideoContiguous && this.config.forceKeyFrameOnDiscontinuity) {\n independent = true;\n if (firstKeyFrameIndex > 0) {\n logger.warn(\"[mp4-remuxer]: Dropped \" + firstKeyFrameIndex + \" out of \" + length + \" video samples due to a missing keyframe\");\n var startPTS = this.getVideoStartPts(videoTrack.samples);\n videoTrack.samples = videoTrack.samples.slice(firstKeyFrameIndex);\n videoTrack.dropped += firstKeyFrameIndex;\n videoTimeOffset += (videoTrack.samples[0].pts - startPTS) / videoTrack.inputTimeScale;\n firstKeyFramePTS = videoTimeOffset;\n } else if (firstKeyFrameIndex === -1) {\n logger.warn(\"[mp4-remuxer]: No keyframe found out of \" + length + \" video samples\");\n independent = false;\n }\n }\n }\n if (this.ISGenerated) {\n if (enoughAudioSamples && enoughVideoSamples) {\n // timeOffset is expected to be the offset of the first timestamp of this fragment (first DTS)\n // if first audio DTS is not aligned with first video DTS then we need to take that into account\n // when providing timeOffset to remuxAudio / remuxVideo. if we don't do that, there might be a permanent / small\n // drift between audio and video streams\n var _startPTS = this.getVideoStartPts(videoTrack.samples);\n var tsDelta = normalizePts(audioTrack.samples[0].pts, _startPTS) - _startPTS;\n var audiovideoTimestampDelta = tsDelta / videoTrack.inputTimeScale;\n audioTimeOffset += Math.max(0, audiovideoTimestampDelta);\n videoTimeOffset += Math.max(0, -audiovideoTimestampDelta);\n }\n\n // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is calculated in remuxAudio.\n if (enoughAudioSamples) {\n // if initSegment was generated without audio samples, regenerate it again\n if (!audioTrack.samplerate) {\n logger.warn('[mp4-remuxer]: regenerate InitSegment as audio detected');\n initSegment = this.generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset);\n }\n audio = this.remuxAudio(audioTrack, audioTimeOffset, this.isAudioContiguous, accurateTimeOffset, hasVideo || enoughVideoSamples || playlistType === PlaylistLevelType.AUDIO ? videoTimeOffset : undefined);\n if (enoughVideoSamples) {\n var audioTrackLength = audio ? audio.endPTS - audio.startPTS : 0;\n // if initSegment was generated without video samples, regenerate it again\n if (!videoTrack.inputTimeScale) {\n logger.warn('[mp4-remuxer]: regenerate InitSegment as video detected');\n initSegment = this.generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset);\n }\n video = this.remuxVideo(videoTrack, videoTimeOffset, isVideoContiguous, audioTrackLength);\n }\n } else if (enoughVideoSamples) {\n video = this.remuxVideo(videoTrack, videoTimeOffset, isVideoContiguous, 0);\n }\n if (video) {\n video.firstKeyFrame = firstKeyFrameIndex;\n video.independent = firstKeyFrameIndex !== -1;\n video.firstKeyFramePTS = firstKeyFramePTS;\n }\n }\n }\n\n // Allow ID3 and text to remux, even if more audio/video samples are required\n if (this.ISGenerated && this._initPTS && this._initDTS) {\n if (id3Track.samples.length) {\n id3 = flushTextTrackMetadataCueSamples(id3Track, timeOffset, this._initPTS, this._initDTS);\n }\n if (textTrack.samples.length) {\n text = flushTextTrackUserdataCueSamples(textTrack, timeOffset, this._initPTS);\n }\n }\n return {\n audio: audio,\n video: video,\n initSegment: initSegment,\n independent: independent,\n text: text,\n id3: id3\n };\n };\n _proto.generateIS = function generateIS(audioTrack, videoTrack, timeOffset, accurateTimeOffset) {\n var audioSamples = audioTrack.samples;\n var videoSamples = videoTrack.samples;\n var typeSupported = this.typeSupported;\n var tracks = {};\n var _initPTS = this._initPTS;\n var computePTSDTS = !_initPTS || accurateTimeOffset;\n var container = 'audio/mp4';\n var initPTS;\n var initDTS;\n var timescale;\n if (computePTSDTS) {\n initPTS = initDTS = Infinity;\n }\n if (audioTrack.config && audioSamples.length) {\n // let's use audio sampling rate as MP4 time scale.\n // rationale is that there is a integer nb of audio frames per audio sample (1024 for AAC)\n // using audio sampling rate here helps having an integer MP4 frame duration\n // this avoids potential rounding issue and AV sync issue\n audioTrack.timescale = audioTrack.samplerate;\n switch (audioTrack.segmentCodec) {\n case 'mp3':\n if (typeSupported.mpeg) {\n // Chrome and Safari\n container = 'audio/mpeg';\n audioTrack.codec = '';\n } else if (typeSupported.mp3) {\n // Firefox\n audioTrack.codec = 'mp3';\n }\n break;\n }\n tracks.audio = {\n id: 'audio',\n container: container,\n codec: audioTrack.codec,\n initSegment: audioTrack.segmentCodec === 'mp3' && typeSupported.mpeg ? new Uint8Array(0) : MP4.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n if (computePTSDTS) {\n timescale = audioTrack.inputTimeScale;\n if (!_initPTS || timescale !== _initPTS.timescale) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - Math.round(timescale * timeOffset);\n } else {\n computePTSDTS = false;\n }\n }\n }\n if (videoTrack.sps && videoTrack.pps && videoSamples.length) {\n // let's use input time scale as MP4 video timescale\n // we use input time scale straight away to avoid rounding issues on frame duration / cts computation\n videoTrack.timescale = videoTrack.inputTimeScale;\n tracks.video = {\n id: 'main',\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: MP4.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n if (computePTSDTS) {\n timescale = videoTrack.inputTimeScale;\n if (!_initPTS || timescale !== _initPTS.timescale) {\n var startPTS = this.getVideoStartPts(videoSamples);\n var startOffset = Math.round(timescale * timeOffset);\n initDTS = Math.min(initDTS, normalizePts(videoSamples[0].dts, startPTS) - startOffset);\n initPTS = Math.min(initPTS, startPTS - startOffset);\n } else {\n computePTSDTS = false;\n }\n }\n }\n if (Object.keys(tracks).length) {\n this.ISGenerated = true;\n if (computePTSDTS) {\n this._initPTS = {\n baseTime: initPTS,\n timescale: timescale\n };\n this._initDTS = {\n baseTime: initDTS,\n timescale: timescale\n };\n } else {\n initPTS = timescale = undefined;\n }\n return {\n tracks: tracks,\n initPTS: initPTS,\n timescale: timescale\n };\n }\n };\n _proto.remuxVideo = function remuxVideo(track, timeOffset, contiguous, audioTrackLength) {\n var timeScale = track.inputTimeScale;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nbSamples = inputSamples.length;\n var initPTS = this._initPTS;\n var nextAvcDts = this.nextAvcDts;\n var offset = 8;\n var mp4SampleDuration = this.videoSampleDuration;\n var firstDTS;\n var lastDTS;\n var minPTS = Number.POSITIVE_INFINITY;\n var maxPTS = Number.NEGATIVE_INFINITY;\n var sortSamples = false;\n\n // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n if (!contiguous || nextAvcDts === null) {\n var pts = timeOffset * timeScale;\n var cts = inputSamples[0].pts - normalizePts(inputSamples[0].dts, inputSamples[0].pts);\n // if not contiguous, let's use target timeOffset\n nextAvcDts = pts - cts;\n }\n\n // PTS is coded on 33bits, and can loop from -2^32 to 2^32\n // PTSNormalize will make PTS/DTS value monotonic, we use last known DTS value as reference value\n var initTime = initPTS.baseTime * timeScale / initPTS.timescale;\n for (var i = 0; i < nbSamples; i++) {\n var sample = inputSamples[i];\n sample.pts = normalizePts(sample.pts - initTime, nextAvcDts);\n sample.dts = normalizePts(sample.dts - initTime, nextAvcDts);\n if (sample.dts < inputSamples[i > 0 ? i - 1 : i].dts) {\n sortSamples = true;\n }\n }\n\n // sort video samples by DTS then PTS then demux id order\n if (sortSamples) {\n inputSamples.sort(function (a, b) {\n var deltadts = a.dts - b.dts;\n var deltapts = a.pts - b.pts;\n return deltadts || deltapts;\n });\n }\n\n // Get first/last DTS\n firstDTS = inputSamples[0].dts;\n lastDTS = inputSamples[inputSamples.length - 1].dts;\n\n // Sample duration (as expected by trun MP4 boxes), should be the delta between sample DTS\n // set this constant duration as being the avg delta between consecutive DTS.\n var inputDuration = lastDTS - firstDTS;\n var averageSampleDuration = inputDuration ? Math.round(inputDuration / (nbSamples - 1)) : mp4SampleDuration || track.inputTimeScale / 30;\n\n // if fragment are contiguous, detect hole/overlapping between fragments\n if (contiguous) {\n // check timestamp continuity across consecutive fragments (this is to remove inter-fragment gap/hole)\n var delta = firstDTS - nextAvcDts;\n var foundHole = delta > averageSampleDuration;\n var foundOverlap = delta < -1;\n if (foundHole || foundOverlap) {\n if (foundHole) {\n logger.warn(\"AVC: \" + toMsFromMpegTsClock(delta, true) + \" ms (\" + delta + \"dts) hole between fragments detected, filling it\");\n } else {\n logger.warn(\"AVC: \" + toMsFromMpegTsClock(-delta, true) + \" ms (\" + delta + \"dts) overlapping between fragments detected\");\n }\n if (!foundOverlap || nextAvcDts >= inputSamples[0].pts) {\n firstDTS = nextAvcDts;\n var firstPTS = inputSamples[0].pts - delta;\n inputSamples[0].dts = firstDTS;\n inputSamples[0].pts = firstPTS;\n logger.log(\"Video: First PTS/DTS adjusted: \" + toMsFromMpegTsClock(firstPTS, true) + \"/\" + toMsFromMpegTsClock(firstDTS, true) + \", delta: \" + toMsFromMpegTsClock(delta, true) + \" ms\");\n }\n }\n }\n firstDTS = Math.max(0, firstDTS);\n var nbNalu = 0;\n var naluLen = 0;\n for (var _i = 0; _i < nbSamples; _i++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i];\n var units = _sample.units;\n var nbUnits = units.length;\n var sampleLen = 0;\n for (var j = 0; j < nbUnits; j++) {\n sampleLen += units[j].data.length;\n }\n naluLen += sampleLen;\n nbNalu += nbUnits;\n _sample.length = sampleLen;\n\n // ensure sample monotonic DTS\n _sample.dts = Math.max(_sample.dts, firstDTS);\n minPTS = Math.min(_sample.pts, minPTS);\n maxPTS = Math.max(_sample.pts, maxPTS);\n }\n lastDTS = inputSamples[nbSamples - 1].dts;\n\n /* concatenate the video data and construct the mdat in place\n (need 8 more bytes to fill length and mpdat type) */\n var mdatSize = naluLen + 4 * nbNalu + 8;\n var mdat;\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MUX_ERROR,\n details: ErrorDetails.REMUX_ALLOC_ERROR,\n fatal: false,\n error: err,\n bytes: mdatSize,\n reason: \"fail allocating video mdat \" + mdatSize\n });\n return;\n }\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(MP4.types.mdat, 4);\n var stretchedLastFrame = false;\n var minDtsDelta = Number.POSITIVE_INFINITY;\n var minPtsDelta = Number.POSITIVE_INFINITY;\n var maxDtsDelta = Number.NEGATIVE_INFINITY;\n var maxPtsDelta = Number.NEGATIVE_INFINITY;\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n var avcSample = inputSamples[_i2];\n var avcSampleUnits = avcSample.units;\n var mp4SampleLength = 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n for (var _j = 0, _nbUnits = avcSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = avcSampleUnits[_j];\n var unitData = unit.data;\n var unitDataLen = unit.data.byteLength;\n view.setUint32(offset, unitDataLen);\n offset += 4;\n mdat.set(unitData, offset);\n offset += unitDataLen;\n mp4SampleLength += 4 + unitDataLen;\n }\n\n // expected sample duration is the Decoding Timestamp diff of consecutive samples\n var ptsDelta = void 0;\n if (_i2 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i2 + 1].dts - avcSample.dts;\n ptsDelta = inputSamples[_i2 + 1].pts - avcSample.pts;\n } else {\n var config = this.config;\n var lastFrameDuration = _i2 > 0 ? avcSample.dts - inputSamples[_i2 - 1].dts : averageSampleDuration;\n ptsDelta = _i2 > 0 ? avcSample.pts - inputSamples[_i2 - 1].pts : averageSampleDuration;\n if (config.stretchShortVideoTrack && this.nextAudioPts !== null) {\n // In some cases, a segment's audio track duration may exceed the video track duration.\n // Since we've already remuxed audio, and we know how long the audio track is, we look to\n // see if the delta to the next segment is longer than maxBufferHole.\n // If so, playback would potentially get stuck, so we artificially inflate\n // the duration of the last frame to minimize any potential gap between segments.\n var gapTolerance = Math.floor(config.maxBufferHole * timeScale);\n var deltaToFrameEnd = (audioTrackLength ? minPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n if (deltaToFrameEnd > gapTolerance) {\n // We subtract lastFrameDuration from deltaToFrameEnd to try to prevent any video\n // frame overlap. maxBufferHole should be >> lastFrameDuration anyway.\n mp4SampleDuration = deltaToFrameEnd - lastFrameDuration;\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n } else {\n stretchedLastFrame = true;\n }\n logger.log(\"[mp4-remuxer]: It is approximately \" + deltaToFrameEnd / 90 + \" ms to the next segment; using duration \" + mp4SampleDuration / 90 + \" ms for the last video frame.\");\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n }\n var compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts);\n minDtsDelta = Math.min(minDtsDelta, mp4SampleDuration);\n maxDtsDelta = Math.max(maxDtsDelta, mp4SampleDuration);\n minPtsDelta = Math.min(minPtsDelta, ptsDelta);\n maxPtsDelta = Math.max(maxPtsDelta, ptsDelta);\n outputSamples.push(new Mp4Sample(avcSample.key, mp4SampleDuration, mp4SampleLength, compositionTimeOffset));\n }\n if (outputSamples.length) {\n if (chromeVersion) {\n if (chromeVersion < 70) {\n // Chrome workaround, mark first sample as being a Random Access Point (keyframe) to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n var flags = outputSamples[0].flags;\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n } else if (safariWebkitVersion) {\n // Fix for \"CNN special report, with CC\" in test-streams (Safari browser only)\n // Ignore DTS when frame durations are irregular. Safari MSE does not handle this leading to gaps.\n if (maxPtsDelta - minPtsDelta < maxDtsDelta - minDtsDelta && averageSampleDuration / maxDtsDelta < 0.025 && outputSamples[0].cts === 0) {\n logger.warn('Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.');\n var dts = firstDTS;\n for (var _i3 = 0, len = outputSamples.length; _i3 < len; _i3++) {\n var nextDts = dts + outputSamples[_i3].duration;\n var _pts = dts + outputSamples[_i3].cts;\n if (_i3 < len - 1) {\n var nextPts = nextDts + outputSamples[_i3 + 1].cts;\n outputSamples[_i3].duration = nextPts - _pts;\n } else {\n outputSamples[_i3].duration = _i3 ? outputSamples[_i3 - 1].duration : averageSampleDuration;\n }\n outputSamples[_i3].cts = 0;\n dts = nextDts;\n }\n }\n }\n }\n // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n mp4SampleDuration = stretchedLastFrame || !mp4SampleDuration ? averageSampleDuration : mp4SampleDuration;\n this.nextAvcDts = nextAvcDts = lastDTS + mp4SampleDuration;\n this.videoSampleDuration = mp4SampleDuration;\n this.isVideoContiguous = true;\n var moof = MP4.moof(track.sequenceNumber++, firstDTS, _extends({}, track, {\n samples: outputSamples\n }));\n var type = 'video';\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: minPTS / timeScale,\n endPTS: (maxPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: nextAvcDts / timeScale,\n type: type,\n hasAudio: false,\n hasVideo: true,\n nb: outputSamples.length,\n dropped: track.dropped\n };\n track.samples = [];\n track.dropped = 0;\n return data;\n };\n _proto.remuxAudio = function remuxAudio(track, timeOffset, contiguous, accurateTimeOffset, videoTimeOffset) {\n var inputTimeScale = track.inputTimeScale;\n var mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale;\n var scaleFactor = inputTimeScale / mp4timeScale;\n var mp4SampleDuration = track.segmentCodec === 'aac' ? AAC_SAMPLES_PER_FRAME : MPEG_AUDIO_SAMPLE_PER_FRAME;\n var inputSampleDuration = mp4SampleDuration * scaleFactor;\n var initPTS = this._initPTS;\n var rawMPEG = track.segmentCodec === 'mp3' && this.typeSupported.mpeg;\n var outputSamples = [];\n var alignedWithVideo = videoTimeOffset !== undefined;\n var inputSamples = track.samples;\n var offset = rawMPEG ? 0 : 8;\n var nextAudioPts = this.nextAudioPts || -1;\n\n // window.audioSamples ? window.audioSamples.push(inputSamples.map(s => s.pts)) : (window.audioSamples = [inputSamples.map(s => s.pts)]);\n\n // for audio samples, also consider consecutive fragments as being contiguous (even if a level switch occurs),\n // for sake of clarity:\n // consecutive fragments are frags with\n // - less than 100ms gaps between new time offset (if accurate) and next expected PTS OR\n // - less than 20 audio frames distance\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n // this helps ensuring audio continuity\n // and this also avoids audio glitches/cut when switching quality, or reporting wrong duration on first audio frame\n var timeOffsetMpegTS = timeOffset * inputTimeScale;\n var initTime = initPTS.baseTime * inputTimeScale / initPTS.timescale;\n this.isAudioContiguous = contiguous = contiguous || inputSamples.length && nextAudioPts > 0 && (accurateTimeOffset && Math.abs(timeOffsetMpegTS - nextAudioPts) < 9000 || Math.abs(normalizePts(inputSamples[0].pts - initTime, timeOffsetMpegTS) - nextAudioPts) < 20 * inputSampleDuration);\n\n // compute normalized PTS\n inputSamples.forEach(function (sample) {\n sample.pts = normalizePts(sample.pts - initTime, timeOffsetMpegTS);\n });\n if (!contiguous || nextAudioPts < 0) {\n // filter out sample with negative PTS that are not playable anyway\n // if we don't remove these negative samples, they will shift all audio samples forward.\n // leading to audio overlap between current / next fragment\n inputSamples = inputSamples.filter(function (sample) {\n return sample.pts >= 0;\n });\n\n // in case all samples have negative PTS, and have been filtered out, return now\n if (!inputSamples.length) {\n return;\n }\n if (videoTimeOffset === 0) {\n // Set the start to 0 to match video so that start gaps larger than inputSampleDuration are filled with silence\n nextAudioPts = 0;\n } else if (accurateTimeOffset && !alignedWithVideo) {\n // When not seeking, not live, and LevelDetails.PTSKnown, use fragment start as predicted next audio PTS\n nextAudioPts = Math.max(0, timeOffsetMpegTS);\n } else {\n // if frags are not contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n }\n }\n\n // If the audio track is missing samples, the frames seem to get \"left-shifted\" within the\n // resulting mp4 segment, causing sync issues and leaving gaps at the end of the audio segment.\n // In an effort to prevent this from happening, we inject frames here where there are gaps.\n // When possible, we inject a silent frame; when that's not possible, we duplicate the last\n // frame.\n\n if (track.segmentCodec === 'aac') {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length; i++) {\n // First, let's see how far off this frame is from where we expect it to be\n var sample = inputSamples[i];\n var pts = sample.pts;\n var delta = pts - nextPts;\n var duration = Math.abs(1000 * delta / inputTimeScale);\n\n // When remuxing with video, if we're overlapping by more than a duration, drop this sample to stay in sync\n if (delta <= -maxAudioFramesDrift * inputSampleDuration && alignedWithVideo) {\n if (i === 0) {\n logger.warn(\"Audio frame @ \" + (pts / inputTimeScale).toFixed(3) + \"s overlaps nextAudioPts by \" + Math.round(1000 * delta / inputTimeScale) + \" ms.\");\n this.nextAudioPts = nextAudioPts = nextPts = pts;\n }\n } // eslint-disable-line brace-style\n\n // Insert missing frames if:\n // 1: We're more than maxAudioFramesDrift frame away\n // 2: Not more than MAX_SILENT_FRAME_DURATION away\n // 3: currentTime (aka nextPtsNorm) is not 0\n // 4: remuxing with video (videoTimeOffset !== undefined)\n else if (delta >= maxAudioFramesDrift * inputSampleDuration && duration < MAX_SILENT_FRAME_DURATION && alignedWithVideo) {\n var missing = Math.round(delta / inputSampleDuration);\n // Adjust nextPts so that silent samples are aligned with media pts. This will prevent media samples from\n // later being shifted if nextPts is based on timeOffset and delta is not a multiple of inputSampleDuration.\n nextPts = pts - missing * inputSampleDuration;\n if (nextPts < 0) {\n missing--;\n nextPts += inputSampleDuration;\n }\n if (i === 0) {\n this.nextAudioPts = nextAudioPts = nextPts;\n }\n logger.warn(\"[mp4-remuxer]: Injecting \" + missing + \" audio frame @ \" + (nextPts / inputTimeScale).toFixed(3) + \"s due to \" + Math.round(1000 * delta / inputTimeScale) + \" ms gap.\");\n for (var j = 0; j < missing; j++) {\n var newStamp = Math.max(nextPts, 0);\n var fillFrame = AAC.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger.log('[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n inputSamples.splice(i, 0, {\n unit: fillFrame,\n pts: newStamp\n });\n nextPts += inputSampleDuration;\n i++;\n }\n }\n sample.pts = nextPts;\n nextPts += inputSampleDuration;\n }\n }\n var firstPTS = null;\n var lastPTS = null;\n var mdat;\n var mdatSize = 0;\n var sampleLength = inputSamples.length;\n while (sampleLength--) {\n mdatSize += inputSamples[sampleLength].unit.byteLength;\n }\n for (var _j2 = 0, _nbSamples = inputSamples.length; _j2 < _nbSamples; _j2++) {\n var audioSample = inputSamples[_j2];\n var unit = audioSample.unit;\n var _pts2 = audioSample.pts;\n if (lastPTS !== null) {\n // If we have more than one sample, set the duration of the sample to the \"real\" duration; the PTS diff with\n // the previous sample\n var prevSample = outputSamples[_j2 - 1];\n prevSample.duration = Math.round((_pts2 - lastPTS) / scaleFactor);\n } else {\n if (contiguous && track.segmentCodec === 'aac') {\n // set PTS/DTS to expected PTS/DTS\n _pts2 = nextAudioPts;\n }\n // remember first PTS of our audioSamples\n firstPTS = _pts2;\n if (mdatSize > 0) {\n /* concatenate the audio data and construct the mdat in place\n (need 8 more bytes to fill length and mdat type) */\n mdatSize += offset;\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MUX_ERROR,\n details: ErrorDetails.REMUX_ALLOC_ERROR,\n fatal: false,\n error: err,\n bytes: mdatSize,\n reason: \"fail allocating audio mdat \" + mdatSize\n });\n return;\n }\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(MP4.types.mdat, 4);\n }\n } else {\n // no audio samples\n return;\n }\n }\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen;\n // Default the sample's duration to the computed mp4SampleDuration, which will either be 1024 for AAC or 1152 for MPEG\n // In the case that we have 1 sample, this will be the duration. If we have more than one sample, the duration\n // becomes the PTS diff with the previous sample\n outputSamples.push(new Mp4Sample(true, mp4SampleDuration, unitLen, 0));\n lastPTS = _pts2;\n }\n\n // We could end up with no audio samples if all input samples were overlapping with the previously remuxed ones\n var nbSamples = outputSamples.length;\n if (!nbSamples) {\n return;\n }\n\n // The next audio sample PTS should be equal to last sample PTS + duration\n var lastSample = outputSamples[outputSamples.length - 1];\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSample.duration;\n\n // Set the track samples from inputSamples to outputSamples before remuxing\n var moof = rawMPEG ? new Uint8Array(0) : MP4.moof(track.sequenceNumber++, firstPTS / scaleFactor, _extends({}, track, {\n samples: outputSamples\n }));\n\n // Clear the track samples. This also clears the samples array in the demuxer, since the reference is shared\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var type = 'audio';\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: type,\n hasAudio: true,\n hasVideo: false,\n nb: nbSamples\n };\n this.isAudioContiguous = true;\n return audioData;\n };\n _proto.remuxEmptyAudio = function remuxEmptyAudio(track, timeOffset, contiguous, videoData) {\n var inputTimeScale = track.inputTimeScale;\n var mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale;\n var scaleFactor = inputTimeScale / mp4timeScale;\n var nextAudioPts = this.nextAudioPts;\n // sync with video's timestamp\n var initDTS = this._initDTS;\n var init90kHz = initDTS.baseTime * 90000 / initDTS.timescale;\n var startDTS = (nextAudioPts !== null ? nextAudioPts : videoData.startDTS * inputTimeScale) + init90kHz;\n var endDTS = videoData.endDTS * inputTimeScale + init90kHz;\n // one sample's duration value\n var frameDuration = scaleFactor * AAC_SAMPLES_PER_FRAME;\n // samples count of this segment's duration\n var nbSamples = Math.ceil((endDTS - startDTS) / frameDuration);\n // silent frame\n var silentFrame = AAC.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n logger.warn('[mp4-remuxer]: remux empty Audio');\n // Can't remux if we can't generate a silent frame...\n if (!silentFrame) {\n logger.trace('[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec');\n return;\n }\n var samples = [];\n for (var i = 0; i < nbSamples; i++) {\n var stamp = startDTS + i * frameDuration;\n samples.push({\n unit: silentFrame,\n pts: stamp,\n dts: stamp\n });\n }\n track.samples = samples;\n return this.remuxAudio(track, timeOffset, contiguous, false);\n };\n return MP4Remuxer;\n }();\n function normalizePts(value, reference) {\n var offset;\n if (reference === null) {\n return value;\n }\n if (reference < value) {\n // - 2^33\n offset = -8589934592;\n } else {\n // + 2^33\n offset = 8589934592;\n }\n /* PTS is 33bit (from 0 to 2^33 -1)\n if diff between value and reference is bigger than half of the amplitude (2^32) then it means that\n PTS looping occured. fill the gap */\n while (Math.abs(value - reference) > 4294967296) {\n value += offset;\n }\n return value;\n }\n function findKeyframeIndex(samples) {\n for (var i = 0; i < samples.length; i++) {\n if (samples[i].key) {\n return i;\n }\n }\n return -1;\n }\n function flushTextTrackMetadataCueSamples(track, timeOffset, initPTS, initDTS) {\n var length = track.samples.length;\n if (!length) {\n return;\n }\n var inputTimeScale = track.inputTimeScale;\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index];\n // setting id3 pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = normalizePts(sample.pts - initPTS.baseTime * inputTimeScale / initPTS.timescale, timeOffset * inputTimeScale) / inputTimeScale;\n sample.dts = normalizePts(sample.dts - initDTS.baseTime * inputTimeScale / initDTS.timescale, timeOffset * inputTimeScale) / inputTimeScale;\n }\n var samples = track.samples;\n track.samples = [];\n return {\n samples: samples\n };\n }\n function flushTextTrackUserdataCueSamples(track, timeOffset, initPTS) {\n var length = track.samples.length;\n if (!length) {\n return;\n }\n var inputTimeScale = track.inputTimeScale;\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index];\n // setting text pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n sample.pts = normalizePts(sample.pts - initPTS.baseTime * inputTimeScale / initPTS.timescale, timeOffset * inputTimeScale) / inputTimeScale;\n }\n track.samples.sort(function (a, b) {\n return a.pts - b.pts;\n });\n var samples = track.samples;\n track.samples = [];\n return {\n samples: samples\n };\n }\n var Mp4Sample = function Mp4Sample(isKeyframe, duration, size, cts) {\n this.size = void 0;\n this.duration = void 0;\n this.cts = void 0;\n this.flags = void 0;\n this.duration = duration;\n this.size = size;\n this.cts = cts;\n this.flags = new Mp4SampleFlags(isKeyframe);\n };\n var Mp4SampleFlags = function Mp4SampleFlags(isKeyframe) {\n this.isLeading = 0;\n this.isDependedOn = 0;\n this.hasRedundancy = 0;\n this.degradPrio = 0;\n this.dependsOn = 1;\n this.isNonSync = 1;\n this.dependsOn = isKeyframe ? 2 : 1;\n this.isNonSync = isKeyframe ? 0 : 1;\n };\n\n var PassThroughRemuxer = /*#__PURE__*/function () {\n function PassThroughRemuxer() {\n this.emitInitSegment = false;\n this.audioCodec = void 0;\n this.videoCodec = void 0;\n this.initData = void 0;\n this.initPTS = null;\n this.initTracks = void 0;\n this.lastEndTime = null;\n }\n var _proto = PassThroughRemuxer.prototype;\n _proto.destroy = function destroy() {};\n _proto.resetTimeStamp = function resetTimeStamp(defaultInitPTS) {\n this.initPTS = defaultInitPTS;\n this.lastEndTime = null;\n };\n _proto.resetNextTimestamp = function resetNextTimestamp() {\n this.lastEndTime = null;\n };\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, decryptdata) {\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this.generateInitSegment(patchEncyptionData(initSegment, decryptdata));\n this.emitInitSegment = true;\n };\n _proto.generateInitSegment = function generateInitSegment(initSegment) {\n var audioCodec = this.audioCodec,\n videoCodec = this.videoCodec;\n if (!(initSegment != null && initSegment.byteLength)) {\n this.initTracks = undefined;\n this.initData = undefined;\n return;\n }\n var initData = this.initData = parseInitSegment(initSegment);\n\n // Get codec from initSegment or fallback to default\n if (!audioCodec) {\n audioCodec = getParsedTrackCodec(initData.audio, ElementaryStreamTypes.AUDIO);\n }\n if (!videoCodec) {\n videoCodec = getParsedTrackCodec(initData.video, ElementaryStreamTypes.VIDEO);\n }\n var tracks = {};\n if (initData.audio && initData.video) {\n tracks.audiovideo = {\n container: 'video/mp4',\n codec: audioCodec + ',' + videoCodec,\n initSegment: initSegment,\n id: 'main'\n };\n } else if (initData.audio) {\n tracks.audio = {\n container: 'audio/mp4',\n codec: audioCodec,\n initSegment: initSegment,\n id: 'audio'\n };\n } else if (initData.video) {\n tracks.video = {\n container: 'video/mp4',\n codec: videoCodec,\n initSegment: initSegment,\n id: 'main'\n };\n } else {\n logger.warn('[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.');\n }\n this.initTracks = tracks;\n };\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, accurateTimeOffset) {\n var _initData, _initData2;\n var initPTS = this.initPTS,\n lastEndTime = this.lastEndTime;\n var result = {\n audio: undefined,\n video: undefined,\n text: textTrack,\n id3: id3Track,\n initSegment: undefined\n };\n\n // If we haven't yet set a lastEndDTS, or it was reset, set it to the provided timeOffset. We want to use the\n // lastEndDTS over timeOffset whenever possible; during progressive playback, the media source will not update\n // the media duration (which is what timeOffset is provided as) before we need to process the next chunk.\n if (!isFiniteNumber(lastEndTime)) {\n lastEndTime = this.lastEndTime = timeOffset || 0;\n }\n\n // The binary segment data is added to the videoTrack in the mp4demuxer. We don't check to see if the data is only\n // audio or video (or both); adding it to video was an arbitrary choice.\n var data = videoTrack.samples;\n if (!(data != null && data.length)) {\n return result;\n }\n var initSegment = {\n initPTS: undefined,\n timescale: 1\n };\n var initData = this.initData;\n if (!((_initData = initData) != null && _initData.length)) {\n this.generateInitSegment(data);\n initData = this.initData;\n }\n if (!((_initData2 = initData) != null && _initData2.length)) {\n // We can't remux if the initSegment could not be generated\n logger.warn('[passthrough-remuxer.ts]: Failed to generate initSegment.');\n return result;\n }\n if (this.emitInitSegment) {\n initSegment.tracks = this.initTracks;\n this.emitInitSegment = false;\n }\n var duration = getDuration(data, initData);\n var startDTS = getStartDTS(initData, data);\n var decodeTime = startDTS === null ? timeOffset : startDTS;\n if (isInvalidInitPts(initPTS, decodeTime, timeOffset, duration) || initSegment.timescale !== initPTS.timescale && accurateTimeOffset) {\n initSegment.initPTS = decodeTime - timeOffset;\n if (initPTS && initPTS.timescale === 1) {\n logger.warn(\"Adjusting initPTS by \" + (initSegment.initPTS - initPTS.baseTime));\n }\n this.initPTS = initPTS = {\n baseTime: initSegment.initPTS,\n timescale: 1\n };\n }\n var startTime = audioTrack ? decodeTime - initPTS.baseTime / initPTS.timescale : lastEndTime;\n var endTime = startTime + duration;\n offsetStartDTS(initData, data, initPTS.baseTime / initPTS.timescale);\n if (duration > 0) {\n this.lastEndTime = endTime;\n } else {\n logger.warn('Duration parsed from mp4 should be greater than zero');\n this.resetNextTimestamp();\n }\n var hasAudio = !!initData.audio;\n var hasVideo = !!initData.video;\n var type = '';\n if (hasAudio) {\n type += 'audio';\n }\n if (hasVideo) {\n type += 'video';\n }\n var track = {\n data1: data,\n startPTS: startTime,\n startDTS: startTime,\n endPTS: endTime,\n endDTS: endTime,\n type: type,\n hasAudio: hasAudio,\n hasVideo: hasVideo,\n nb: 1,\n dropped: 0\n };\n result.audio = track.type === 'audio' ? track : undefined;\n result.video = track.type !== 'audio' ? track : undefined;\n result.initSegment = initSegment;\n result.id3 = flushTextTrackMetadataCueSamples(id3Track, timeOffset, initPTS, initPTS);\n if (textTrack.samples.length) {\n result.text = flushTextTrackUserdataCueSamples(textTrack, timeOffset, initPTS);\n }\n return result;\n };\n return PassThroughRemuxer;\n }();\n function isInvalidInitPts(initPTS, startDTS, timeOffset, duration) {\n if (initPTS === null) {\n return true;\n }\n // InitPTS is invalid when distance from program would be more than segment duration or a minimum of one second\n var minDuration = Math.max(duration, 1);\n var startTime = startDTS - initPTS.baseTime / initPTS.timescale;\n return Math.abs(startTime - timeOffset) > minDuration;\n }\n function getParsedTrackCodec(track, type) {\n var parsedCodec = track == null ? void 0 : track.codec;\n if (parsedCodec && parsedCodec.length > 4) {\n return parsedCodec;\n }\n // Since mp4-tools cannot parse full codec string (see 'TODO: Parse codec details'... in mp4-tools)\n // Provide defaults based on codec type\n // This allows for some playback of some fmp4 playlists without CODECS defined in manifest\n if (parsedCodec === 'hvc1' || parsedCodec === 'hev1') {\n return 'hvc1.1.6.L120.90';\n }\n if (parsedCodec === 'av01') {\n return 'av01.0.04M.08';\n }\n if (parsedCodec === 'avc1' || type === ElementaryStreamTypes.VIDEO) {\n return 'avc1.42e01e';\n }\n return 'mp4a.40.5';\n }\n\n var now;\n // performance.now() not available on WebWorker, at least on Safari Desktop\n try {\n now = self.performance.now.bind(self.performance);\n } catch (err) {\n logger.debug('Unable to use Performance API on this environment');\n now = typeof self !== 'undefined' && self.Date.now;\n }\n var muxConfig = [{\n demux: MP4Demuxer,\n remux: PassThroughRemuxer\n }, {\n demux: TSDemuxer,\n remux: MP4Remuxer\n }, {\n demux: AACDemuxer,\n remux: MP4Remuxer\n }, {\n demux: MP3Demuxer,\n remux: MP4Remuxer\n }];\n var Transmuxer = /*#__PURE__*/function () {\n function Transmuxer(observer, typeSupported, config, vendor, id) {\n this.async = false;\n this.observer = void 0;\n this.typeSupported = void 0;\n this.config = void 0;\n this.vendor = void 0;\n this.id = void 0;\n this.demuxer = void 0;\n this.remuxer = void 0;\n this.decrypter = void 0;\n this.probe = void 0;\n this.decryptionPromise = null;\n this.transmuxConfig = void 0;\n this.currentTransmuxState = void 0;\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n this.id = id;\n }\n var _proto = Transmuxer.prototype;\n _proto.configure = function configure(transmuxConfig) {\n this.transmuxConfig = transmuxConfig;\n if (this.decrypter) {\n this.decrypter.reset();\n }\n };\n _proto.push = function push(data, decryptdata, chunkMeta, state) {\n var _this = this;\n var stats = chunkMeta.transmuxing;\n stats.executeStart = now();\n var uintData = new Uint8Array(data);\n var currentTransmuxState = this.currentTransmuxState,\n transmuxConfig = this.transmuxConfig;\n if (state) {\n this.currentTransmuxState = state;\n }\n var _ref = state || currentTransmuxState,\n contiguous = _ref.contiguous,\n discontinuity = _ref.discontinuity,\n trackSwitch = _ref.trackSwitch,\n accurateTimeOffset = _ref.accurateTimeOffset,\n timeOffset = _ref.timeOffset,\n initSegmentChange = _ref.initSegmentChange;\n var audioCodec = transmuxConfig.audioCodec,\n videoCodec = transmuxConfig.videoCodec,\n defaultInitPts = transmuxConfig.defaultInitPts,\n duration = transmuxConfig.duration,\n initSegmentData = transmuxConfig.initSegmentData;\n var keyData = getEncryptionType(uintData, decryptdata);\n if (keyData && keyData.method === 'AES-128') {\n var decrypter = this.getDecrypter();\n // Software decryption is synchronous; webCrypto is not\n if (decrypter.isSync()) {\n // Software decryption is progressive. Progressive decryption may not return a result on each call. Any cached\n // data is handled in the flush() call\n var decryptedData = decrypter.softwareDecrypt(uintData, keyData.key.buffer, keyData.iv.buffer);\n // For Low-Latency HLS Parts, decrypt in place, since part parsing is expected on push progress\n var loadingParts = chunkMeta.part > -1;\n if (loadingParts) {\n decryptedData = decrypter.flush();\n }\n if (!decryptedData) {\n stats.executeEnd = now();\n return emptyResult(chunkMeta);\n }\n uintData = new Uint8Array(decryptedData);\n } else {\n this.decryptionPromise = decrypter.webCryptoDecrypt(uintData, keyData.key.buffer, keyData.iv.buffer).then(function (decryptedData) {\n // Calling push here is important; if flush() is called while this is still resolving, this ensures that\n // the decrypted data has been transmuxed\n var result = _this.push(decryptedData, null, chunkMeta);\n _this.decryptionPromise = null;\n return result;\n });\n return this.decryptionPromise;\n }\n }\n var resetMuxers = this.needsProbing(discontinuity, trackSwitch);\n if (resetMuxers) {\n var error = this.configureTransmuxer(uintData);\n if (error) {\n logger.warn(\"[transmuxer] \" + error.message);\n this.observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: false,\n error: error,\n reason: error.message\n });\n stats.executeEnd = now();\n return emptyResult(chunkMeta);\n }\n }\n if (discontinuity || trackSwitch || initSegmentChange || resetMuxers) {\n this.resetInitSegment(initSegmentData, audioCodec, videoCodec, duration, decryptdata);\n }\n if (discontinuity || initSegmentChange || resetMuxers) {\n this.resetInitialTimestamp(defaultInitPts);\n }\n if (!contiguous) {\n this.resetContiguity();\n }\n var result = this.transmux(uintData, keyData, timeOffset, accurateTimeOffset, chunkMeta);\n var currentState = this.currentTransmuxState;\n currentState.contiguous = true;\n currentState.discontinuity = false;\n currentState.trackSwitch = false;\n stats.executeEnd = now();\n return result;\n }\n\n // Due to data caching, flush calls can produce more than one TransmuxerResult (hence the Array type)\n ;\n _proto.flush = function flush(chunkMeta) {\n var _this2 = this;\n var stats = chunkMeta.transmuxing;\n stats.executeStart = now();\n var decrypter = this.decrypter,\n currentTransmuxState = this.currentTransmuxState,\n decryptionPromise = this.decryptionPromise;\n if (decryptionPromise) {\n // Upon resolution, the decryption promise calls push() and returns its TransmuxerResult up the stack. Therefore\n // only flushing is required for async decryption\n return decryptionPromise.then(function () {\n return _this2.flush(chunkMeta);\n });\n }\n var transmuxResults = [];\n var timeOffset = currentTransmuxState.timeOffset;\n if (decrypter) {\n // The decrypter may have data cached, which needs to be demuxed. In this case we'll have two TransmuxResults\n // This happens in the case that we receive only 1 push call for a segment (either for non-progressive downloads,\n // or for progressive downloads with small segments)\n var decryptedData = decrypter.flush();\n if (decryptedData) {\n // Push always returns a TransmuxerResult if decryptdata is null\n transmuxResults.push(this.push(decryptedData, null, chunkMeta));\n }\n }\n var demuxer = this.demuxer,\n remuxer = this.remuxer;\n if (!demuxer || !remuxer) {\n // If probing failed, then Hls.js has been given content its not able to handle\n stats.executeEnd = now();\n return [emptyResult(chunkMeta)];\n }\n var demuxResultOrPromise = demuxer.flush(timeOffset);\n if (isPromise(demuxResultOrPromise)) {\n // Decrypt final SAMPLE-AES samples\n return demuxResultOrPromise.then(function (demuxResult) {\n _this2.flushRemux(transmuxResults, demuxResult, chunkMeta);\n return transmuxResults;\n });\n }\n this.flushRemux(transmuxResults, demuxResultOrPromise, chunkMeta);\n return transmuxResults;\n };\n _proto.flushRemux = function flushRemux(transmuxResults, demuxResult, chunkMeta) {\n var audioTrack = demuxResult.audioTrack,\n videoTrack = demuxResult.videoTrack,\n id3Track = demuxResult.id3Track,\n textTrack = demuxResult.textTrack;\n var _this$currentTransmux = this.currentTransmuxState,\n accurateTimeOffset = _this$currentTransmux.accurateTimeOffset,\n timeOffset = _this$currentTransmux.timeOffset;\n logger.log(\"[transmuxer.ts]: Flushed fragment \" + chunkMeta.sn + (chunkMeta.part > -1 ? ' p: ' + chunkMeta.part : '') + \" of level \" + chunkMeta.level);\n var remuxResult = this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, accurateTimeOffset, true, this.id);\n transmuxResults.push({\n remuxResult: remuxResult,\n chunkMeta: chunkMeta\n });\n chunkMeta.transmuxing.executeEnd = now();\n };\n _proto.resetInitialTimestamp = function resetInitialTimestamp(defaultInitPts) {\n var demuxer = this.demuxer,\n remuxer = this.remuxer;\n if (!demuxer || !remuxer) {\n return;\n }\n demuxer.resetTimeStamp(defaultInitPts);\n remuxer.resetTimeStamp(defaultInitPts);\n };\n _proto.resetContiguity = function resetContiguity() {\n var demuxer = this.demuxer,\n remuxer = this.remuxer;\n if (!demuxer || !remuxer) {\n return;\n }\n demuxer.resetContiguity();\n remuxer.resetNextTimestamp();\n };\n _proto.resetInitSegment = function resetInitSegment(initSegmentData, audioCodec, videoCodec, trackDuration, decryptdata) {\n var demuxer = this.demuxer,\n remuxer = this.remuxer;\n if (!demuxer || !remuxer) {\n return;\n }\n demuxer.resetInitSegment(initSegmentData, audioCodec, videoCodec, trackDuration);\n remuxer.resetInitSegment(initSegmentData, audioCodec, videoCodec, decryptdata);\n };\n _proto.destroy = function destroy() {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = undefined;\n }\n if (this.remuxer) {\n this.remuxer.destroy();\n this.remuxer = undefined;\n }\n };\n _proto.transmux = function transmux(data, keyData, timeOffset, accurateTimeOffset, chunkMeta) {\n var result;\n if (keyData && keyData.method === 'SAMPLE-AES') {\n result = this.transmuxSampleAes(data, keyData, timeOffset, accurateTimeOffset, chunkMeta);\n } else {\n result = this.transmuxUnencrypted(data, timeOffset, accurateTimeOffset, chunkMeta);\n }\n return result;\n };\n _proto.transmuxUnencrypted = function transmuxUnencrypted(data, timeOffset, accurateTimeOffset, chunkMeta) {\n var _demux = this.demuxer.demux(data, timeOffset, false, !this.config.progressive),\n audioTrack = _demux.audioTrack,\n videoTrack = _demux.videoTrack,\n id3Track = _demux.id3Track,\n textTrack = _demux.textTrack;\n var remuxResult = this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, accurateTimeOffset, false, this.id);\n return {\n remuxResult: remuxResult,\n chunkMeta: chunkMeta\n };\n };\n _proto.transmuxSampleAes = function transmuxSampleAes(data, decryptData, timeOffset, accurateTimeOffset, chunkMeta) {\n var _this3 = this;\n return this.demuxer.demuxSampleAes(data, decryptData, timeOffset).then(function (demuxResult) {\n var remuxResult = _this3.remuxer.remux(demuxResult.audioTrack, demuxResult.videoTrack, demuxResult.id3Track, demuxResult.textTrack, timeOffset, accurateTimeOffset, false, _this3.id);\n return {\n remuxResult: remuxResult,\n chunkMeta: chunkMeta\n };\n });\n };\n _proto.configureTransmuxer = function configureTransmuxer(data) {\n var config = this.config,\n observer = this.observer,\n typeSupported = this.typeSupported,\n vendor = this.vendor;\n // probe for content type\n var mux;\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n if (muxConfig[i].demux.probe(data)) {\n mux = muxConfig[i];\n break;\n }\n }\n if (!mux) {\n return new Error('Failed to find demuxer by probing fragment data');\n }\n // so let's check that current remuxer and demuxer are still valid\n var demuxer = this.demuxer;\n var remuxer = this.remuxer;\n var Remuxer = mux.remux;\n var Demuxer = mux.demux;\n if (!remuxer || !(remuxer instanceof Remuxer)) {\n this.remuxer = new Remuxer(observer, config, typeSupported, vendor);\n }\n if (!demuxer || !(demuxer instanceof Demuxer)) {\n this.demuxer = new Demuxer(observer, config, typeSupported);\n this.probe = Demuxer.probe;\n }\n };\n _proto.needsProbing = function needsProbing(discontinuity, trackSwitch) {\n // in case of continuity change, or track switch\n // we might switch from content type (AAC container to TS container, or TS to fmp4 for example)\n return !this.demuxer || !this.remuxer || discontinuity || trackSwitch;\n };\n _proto.getDecrypter = function getDecrypter() {\n var decrypter = this.decrypter;\n if (!decrypter) {\n decrypter = this.decrypter = new Decrypter(this.config);\n }\n return decrypter;\n };\n return Transmuxer;\n }();\n function getEncryptionType(data, decryptData) {\n var encryptionType = null;\n if (data.byteLength > 0 && decryptData != null && decryptData.key != null && decryptData.iv !== null && decryptData.method != null) {\n encryptionType = decryptData;\n }\n return encryptionType;\n }\n var emptyResult = function emptyResult(chunkMeta) {\n return {\n remuxResult: {},\n chunkMeta: chunkMeta\n };\n };\n function isPromise(p) {\n return 'then' in p && p.then instanceof Function;\n }\n var TransmuxConfig = function TransmuxConfig(audioCodec, videoCodec, initSegmentData, duration, defaultInitPts) {\n this.audioCodec = void 0;\n this.videoCodec = void 0;\n this.initSegmentData = void 0;\n this.duration = void 0;\n this.defaultInitPts = void 0;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this.initSegmentData = initSegmentData;\n this.duration = duration;\n this.defaultInitPts = defaultInitPts || null;\n };\n var TransmuxState = function TransmuxState(discontinuity, contiguous, accurateTimeOffset, trackSwitch, timeOffset, initSegmentChange) {\n this.discontinuity = void 0;\n this.contiguous = void 0;\n this.accurateTimeOffset = void 0;\n this.trackSwitch = void 0;\n this.timeOffset = void 0;\n this.initSegmentChange = void 0;\n this.discontinuity = discontinuity;\n this.contiguous = contiguous;\n this.accurateTimeOffset = accurateTimeOffset;\n this.trackSwitch = trackSwitch;\n this.timeOffset = timeOffset;\n this.initSegmentChange = initSegmentChange;\n };\n\n var eventemitter3 = {exports: {}};\n\n (function (module) {\n\n \tvar has = Object.prototype.hasOwnProperty\n \t , prefix = '~';\n\n \t/**\n \t * Constructor to create a storage for our `EE` objects.\n \t * An `Events` instance is a plain object whose properties are event names.\n \t *\n \t * @constructor\n \t * @private\n \t */\n \tfunction Events() {}\n\n \t//\n \t// We try to not inherit from `Object.prototype`. In some engines creating an\n \t// instance in this way is faster than calling `Object.create(null)` directly.\n \t// If `Object.create(null)` is not supported we prefix the event names with a\n \t// character to make sure that the built-in object properties are not\n \t// overridden or used as an attack vector.\n \t//\n \tif (Object.create) {\n \t Events.prototype = Object.create(null);\n\n \t //\n \t // This hack is needed because the `__proto__` property is still inherited in\n \t // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n \t //\n \t if (!new Events().__proto__) prefix = false;\n \t}\n\n \t/**\n \t * Representation of a single event listener.\n \t *\n \t * @param {Function} fn The listener function.\n \t * @param {*} context The context to invoke the listener with.\n \t * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n \t * @constructor\n \t * @private\n \t */\n \tfunction EE(fn, context, once) {\n \t this.fn = fn;\n \t this.context = context;\n \t this.once = once || false;\n \t}\n\n \t/**\n \t * Add a listener for a given event.\n \t *\n \t * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n \t * @param {(String|Symbol)} event The event name.\n \t * @param {Function} fn The listener function.\n \t * @param {*} context The context to invoke the listener with.\n \t * @param {Boolean} once Specify if the listener is a one-time listener.\n \t * @returns {EventEmitter}\n \t * @private\n \t */\n \tfunction addListener(emitter, event, fn, context, once) {\n \t if (typeof fn !== 'function') {\n \t throw new TypeError('The listener must be a function');\n \t }\n\n \t var listener = new EE(fn, context || emitter, once)\n \t , evt = prefix ? prefix + event : event;\n\n \t if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n \t else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n \t else emitter._events[evt] = [emitter._events[evt], listener];\n\n \t return emitter;\n \t}\n\n \t/**\n \t * Clear event by name.\n \t *\n \t * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n \t * @param {(String|Symbol)} evt The Event name.\n \t * @private\n \t */\n \tfunction clearEvent(emitter, evt) {\n \t if (--emitter._eventsCount === 0) emitter._events = new Events();\n \t else delete emitter._events[evt];\n \t}\n\n \t/**\n \t * Minimal `EventEmitter` interface that is molded against the Node.js\n \t * `EventEmitter` interface.\n \t *\n \t * @constructor\n \t * @public\n \t */\n \tfunction EventEmitter() {\n \t this._events = new Events();\n \t this._eventsCount = 0;\n \t}\n\n \t/**\n \t * Return an array listing the events for which the emitter has registered\n \t * listeners.\n \t *\n \t * @returns {Array}\n \t * @public\n \t */\n \tEventEmitter.prototype.eventNames = function eventNames() {\n \t var names = []\n \t , events\n \t , name;\n\n \t if (this._eventsCount === 0) return names;\n\n \t for (name in (events = this._events)) {\n \t if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n \t }\n\n \t if (Object.getOwnPropertySymbols) {\n \t return names.concat(Object.getOwnPropertySymbols(events));\n \t }\n\n \t return names;\n \t};\n\n \t/**\n \t * Return the listeners registered for a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @returns {Array} The registered listeners.\n \t * @public\n \t */\n \tEventEmitter.prototype.listeners = function listeners(event) {\n \t var evt = prefix ? prefix + event : event\n \t , handlers = this._events[evt];\n\n \t if (!handlers) return [];\n \t if (handlers.fn) return [handlers.fn];\n\n \t for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n \t ee[i] = handlers[i].fn;\n \t }\n\n \t return ee;\n \t};\n\n \t/**\n \t * Return the number of listeners listening to a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @returns {Number} The number of listeners.\n \t * @public\n \t */\n \tEventEmitter.prototype.listenerCount = function listenerCount(event) {\n \t var evt = prefix ? prefix + event : event\n \t , listeners = this._events[evt];\n\n \t if (!listeners) return 0;\n \t if (listeners.fn) return 1;\n \t return listeners.length;\n \t};\n\n \t/**\n \t * Calls each of the listeners registered for a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @returns {Boolean} `true` if the event had listeners, else `false`.\n \t * @public\n \t */\n \tEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n \t var evt = prefix ? prefix + event : event;\n\n \t if (!this._events[evt]) return false;\n\n \t var listeners = this._events[evt]\n \t , len = arguments.length\n \t , args\n \t , i;\n\n \t if (listeners.fn) {\n \t if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n \t switch (len) {\n \t case 1: return listeners.fn.call(listeners.context), true;\n \t case 2: return listeners.fn.call(listeners.context, a1), true;\n \t case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n \t case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n \t case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n \t case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n \t }\n\n \t for (i = 1, args = new Array(len -1); i < len; i++) {\n \t args[i - 1] = arguments[i];\n \t }\n\n \t listeners.fn.apply(listeners.context, args);\n \t } else {\n \t var length = listeners.length\n \t , j;\n\n \t for (i = 0; i < length; i++) {\n \t if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n \t switch (len) {\n \t case 1: listeners[i].fn.call(listeners[i].context); break;\n \t case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n \t case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n \t case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n \t default:\n \t if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n \t args[j - 1] = arguments[j];\n \t }\n\n \t listeners[i].fn.apply(listeners[i].context, args);\n \t }\n \t }\n \t }\n\n \t return true;\n \t};\n\n \t/**\n \t * Add a listener for a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @param {Function} fn The listener function.\n \t * @param {*} [context=this] The context to invoke the listener with.\n \t * @returns {EventEmitter} `this`.\n \t * @public\n \t */\n \tEventEmitter.prototype.on = function on(event, fn, context) {\n \t return addListener(this, event, fn, context, false);\n \t};\n\n \t/**\n \t * Add a one-time listener for a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @param {Function} fn The listener function.\n \t * @param {*} [context=this] The context to invoke the listener with.\n \t * @returns {EventEmitter} `this`.\n \t * @public\n \t */\n \tEventEmitter.prototype.once = function once(event, fn, context) {\n \t return addListener(this, event, fn, context, true);\n \t};\n\n \t/**\n \t * Remove the listeners of a given event.\n \t *\n \t * @param {(String|Symbol)} event The event name.\n \t * @param {Function} fn Only remove the listeners that match this function.\n \t * @param {*} context Only remove the listeners that have this context.\n \t * @param {Boolean} once Only remove one-time listeners.\n \t * @returns {EventEmitter} `this`.\n \t * @public\n \t */\n \tEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n \t var evt = prefix ? prefix + event : event;\n\n \t if (!this._events[evt]) return this;\n \t if (!fn) {\n \t clearEvent(this, evt);\n \t return this;\n \t }\n\n \t var listeners = this._events[evt];\n\n \t if (listeners.fn) {\n \t if (\n \t listeners.fn === fn &&\n \t (!once || listeners.once) &&\n \t (!context || listeners.context === context)\n \t ) {\n \t clearEvent(this, evt);\n \t }\n \t } else {\n \t for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n \t if (\n \t listeners[i].fn !== fn ||\n \t (once && !listeners[i].once) ||\n \t (context && listeners[i].context !== context)\n \t ) {\n \t events.push(listeners[i]);\n \t }\n \t }\n\n \t //\n \t // Reset the array, or remove it completely if we have no more listeners.\n \t //\n \t if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n \t else clearEvent(this, evt);\n \t }\n\n \t return this;\n \t};\n\n \t/**\n \t * Remove all listeners, or those of the specified event.\n \t *\n \t * @param {(String|Symbol)} [event] The event name.\n \t * @returns {EventEmitter} `this`.\n \t * @public\n \t */\n \tEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n \t var evt;\n\n \t if (event) {\n \t evt = prefix ? prefix + event : event;\n \t if (this._events[evt]) clearEvent(this, evt);\n \t } else {\n \t this._events = new Events();\n \t this._eventsCount = 0;\n \t }\n\n \t return this;\n \t};\n\n \t//\n \t// Alias methods names because people roll like that.\n \t//\n \tEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n \tEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n \t//\n \t// Expose the prefix.\n \t//\n \tEventEmitter.prefixed = prefix;\n\n \t//\n \t// Allow `EventEmitter` to be imported as module namespace.\n \t//\n \tEventEmitter.EventEmitter = EventEmitter;\n\n \t//\n \t// Expose the module.\n \t//\n \t{\n \t module.exports = EventEmitter;\n \t} \n } (eventemitter3));\n\n var eventemitter3Exports = eventemitter3.exports;\n var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);\n\n if (typeof __IN_WORKER__ !== 'undefined' && __IN_WORKER__) {\n startWorker(self);\n }\n function startWorker(self) {\n var observer = new EventEmitter();\n var forwardMessage = function forwardMessage(ev, data) {\n self.postMessage({\n event: ev,\n data: data\n });\n };\n\n // forward events to main thread\n observer.on(Events.FRAG_DECRYPTED, forwardMessage);\n observer.on(Events.ERROR, forwardMessage);\n\n // forward logger events to main thread\n var forwardWorkerLogs = function forwardWorkerLogs() {\n var _loop = function _loop(logFn) {\n var func = function func(message) {\n forwardMessage('workerLog', {\n logType: logFn,\n message: message\n });\n };\n logger[logFn] = func;\n };\n for (var logFn in logger) {\n _loop(logFn);\n }\n };\n self.addEventListener('message', function (ev) {\n var data = ev.data;\n switch (data.cmd) {\n case 'init':\n {\n var config = JSON.parse(data.config);\n self.transmuxer = new Transmuxer(observer, data.typeSupported, config, data.vendor, data.id);\n enableLogs(config.debug, data.id);\n forwardWorkerLogs();\n forwardMessage('init', null);\n break;\n }\n case 'configure':\n {\n self.transmuxer.configure(data.config);\n break;\n }\n case 'demux':\n {\n var transmuxResult = self.transmuxer.push(data.data, data.decryptdata, data.chunkMeta, data.state);\n if (isPromise(transmuxResult)) {\n self.transmuxer.async = true;\n transmuxResult.then(function (data) {\n emitTransmuxComplete(self, data);\n }).catch(function (error) {\n forwardMessage(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n chunkMeta: data.chunkMeta,\n fatal: false,\n error: error,\n err: error,\n reason: \"transmuxer-worker push error\"\n });\n });\n } else {\n self.transmuxer.async = false;\n emitTransmuxComplete(self, transmuxResult);\n }\n break;\n }\n case 'flush':\n {\n var id = data.chunkMeta;\n var _transmuxResult = self.transmuxer.flush(id);\n var asyncFlush = isPromise(_transmuxResult);\n if (asyncFlush || self.transmuxer.async) {\n if (!isPromise(_transmuxResult)) {\n _transmuxResult = Promise.resolve(_transmuxResult);\n }\n _transmuxResult.then(function (results) {\n handleFlushResult(self, results, id);\n }).catch(function (error) {\n forwardMessage(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n chunkMeta: data.chunkMeta,\n fatal: false,\n error: error,\n err: error,\n reason: \"transmuxer-worker flush error\"\n });\n });\n } else {\n handleFlushResult(self, _transmuxResult, id);\n }\n break;\n }\n }\n });\n }\n function emitTransmuxComplete(self, transmuxResult) {\n if (isEmptyResult(transmuxResult.remuxResult)) {\n return false;\n }\n var transferable = [];\n var _transmuxResult$remux = transmuxResult.remuxResult,\n audio = _transmuxResult$remux.audio,\n video = _transmuxResult$remux.video;\n if (audio) {\n addToTransferable(transferable, audio);\n }\n if (video) {\n addToTransferable(transferable, video);\n }\n self.postMessage({\n event: 'transmuxComplete',\n data: transmuxResult\n }, transferable);\n return true;\n }\n\n // Converts data to a transferable object https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast)\n // in order to minimize message passing overhead\n function addToTransferable(transferable, track) {\n if (track.data1) {\n transferable.push(track.data1.buffer);\n }\n if (track.data2) {\n transferable.push(track.data2.buffer);\n }\n }\n function handleFlushResult(self, results, chunkMeta) {\n var parsed = results.reduce(function (parsed, result) {\n return emitTransmuxComplete(self, result) || parsed;\n }, false);\n if (!parsed) {\n // Emit at least one \"transmuxComplete\" message even if media is not found to update stream-controller state to PARSING\n self.postMessage({\n event: 'transmuxComplete',\n data: results[0]\n });\n }\n self.postMessage({\n event: 'flush',\n data: chunkMeta\n });\n }\n function isEmptyResult(remuxResult) {\n return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;\n }\n\n // ensure the worker ends up in the bundle\n // If the worker should not be included this gets aliased to empty.js\n function hasUMDWorker() {\n return typeof __HLS_WORKER_BUNDLE__ === 'function';\n }\n function injectWorker() {\n var blob = new self.Blob([\"var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(\" + __HLS_WORKER_BUNDLE__.toString() + \")(true);\"], {\n type: 'text/javascript'\n });\n var objectURL = self.URL.createObjectURL(blob);\n var worker = new self.Worker(objectURL);\n return {\n worker: worker,\n objectURL: objectURL\n };\n }\n function loadWorker(path) {\n var scriptURL = new self.URL(path, self.location.href).href;\n var worker = new self.Worker(scriptURL);\n return {\n worker: worker,\n scriptURL: scriptURL\n };\n }\n\n var MediaSource$1 = getMediaSource() || {\n isTypeSupported: function isTypeSupported() {\n return false;\n }\n };\n var TransmuxerInterface = /*#__PURE__*/function () {\n function TransmuxerInterface(hls, id, onTransmuxComplete, onFlush) {\n var _this = this;\n this.error = null;\n this.hls = void 0;\n this.id = void 0;\n this.observer = void 0;\n this.frag = null;\n this.part = null;\n this.useWorker = void 0;\n this.workerContext = null;\n this.onwmsg = void 0;\n this.transmuxer = null;\n this.onTransmuxComplete = void 0;\n this.onFlush = void 0;\n var config = hls.config;\n this.hls = hls;\n this.id = id;\n this.useWorker = !!config.enableWorker;\n this.onTransmuxComplete = onTransmuxComplete;\n this.onFlush = onFlush;\n var forwardMessage = function forwardMessage(ev, data) {\n data = data || {};\n data.frag = _this.frag;\n data.id = _this.id;\n if (ev === Events.ERROR) {\n _this.error = data.error;\n }\n _this.hls.trigger(ev, data);\n };\n\n // forward events to main thread\n this.observer = new EventEmitter();\n this.observer.on(Events.FRAG_DECRYPTED, forwardMessage);\n this.observer.on(Events.ERROR, forwardMessage);\n var typeSupported = {\n mp4: MediaSource$1.isTypeSupported('video/mp4'),\n mpeg: MediaSource$1.isTypeSupported('audio/mpeg'),\n mp3: MediaSource$1.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n };\n // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n var vendor = navigator.vendor;\n if (this.useWorker && typeof Worker !== 'undefined') {\n var canCreateWorker = config.workerPath || hasUMDWorker();\n if (canCreateWorker) {\n try {\n if (config.workerPath) {\n logger.log(\"loading Web Worker \" + config.workerPath + \" for \\\"\" + id + \"\\\"\");\n this.workerContext = loadWorker(config.workerPath);\n } else {\n logger.log(\"injecting Web Worker for \\\"\" + id + \"\\\"\");\n this.workerContext = injectWorker();\n }\n this.onwmsg = function (ev) {\n return _this.onWorkerMessage(ev);\n };\n var worker = this.workerContext.worker;\n worker.addEventListener('message', this.onwmsg);\n worker.onerror = function (event) {\n var error = new Error(event.message + \" (\" + event.filename + \":\" + event.lineno + \")\");\n config.enableWorker = false;\n logger.warn(\"Error in \\\"\" + id + \"\\\" Web Worker, fallback to inline\");\n _this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.OTHER_ERROR,\n details: ErrorDetails.INTERNAL_EXCEPTION,\n fatal: false,\n event: 'demuxerWorker',\n error: error\n });\n };\n worker.postMessage({\n cmd: 'init',\n typeSupported: typeSupported,\n vendor: vendor,\n id: id,\n config: JSON.stringify(config)\n });\n } catch (err) {\n logger.warn(\"Error setting up \\\"\" + id + \"\\\" Web Worker, fallback to inline\", err);\n this.resetWorker();\n this.error = null;\n this.transmuxer = new Transmuxer(this.observer, typeSupported, config, vendor, id);\n }\n return;\n }\n }\n this.transmuxer = new Transmuxer(this.observer, typeSupported, config, vendor, id);\n }\n var _proto = TransmuxerInterface.prototype;\n _proto.resetWorker = function resetWorker() {\n if (this.workerContext) {\n var _this$workerContext = this.workerContext,\n worker = _this$workerContext.worker,\n objectURL = _this$workerContext.objectURL;\n if (objectURL) {\n // revoke the Object URL that was used to create transmuxer worker, so as not to leak it\n self.URL.revokeObjectURL(objectURL);\n }\n worker.removeEventListener('message', this.onwmsg);\n worker.onerror = null;\n worker.terminate();\n this.workerContext = null;\n }\n };\n _proto.destroy = function destroy() {\n if (this.workerContext) {\n this.resetWorker();\n this.onwmsg = undefined;\n } else {\n var transmuxer = this.transmuxer;\n if (transmuxer) {\n transmuxer.destroy();\n this.transmuxer = null;\n }\n }\n var observer = this.observer;\n if (observer) {\n observer.removeAllListeners();\n }\n this.frag = null;\n // @ts-ignore\n this.observer = null;\n // @ts-ignore\n this.hls = null;\n };\n _proto.push = function push(data, initSegmentData, audioCodec, videoCodec, frag, part, duration, accurateTimeOffset, chunkMeta, defaultInitPTS) {\n var _frag$initSegment,\n _lastFrag$initSegment,\n _this2 = this;\n chunkMeta.transmuxing.start = self.performance.now();\n var transmuxer = this.transmuxer;\n var timeOffset = part ? part.start : frag.start;\n // TODO: push \"clear-lead\" decrypt data for unencrypted fragments in streams with encrypted ones\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && frag.cc === lastFrag.cc);\n var trackSwitch = !(lastFrag && chunkMeta.level === lastFrag.level);\n var snDiff = lastFrag ? chunkMeta.sn - lastFrag.sn : -1;\n var partDiff = this.part ? chunkMeta.part - this.part.index : -1;\n var progressive = snDiff === 0 && chunkMeta.id > 1 && chunkMeta.id === (lastFrag == null ? void 0 : lastFrag.stats.chunkCount);\n var contiguous = !trackSwitch && (snDiff === 1 || snDiff === 0 && (partDiff === 1 || progressive && partDiff <= 0));\n var now = self.performance.now();\n if (trackSwitch || snDiff || frag.stats.parsing.start === 0) {\n frag.stats.parsing.start = now;\n }\n if (part && (partDiff || !contiguous)) {\n part.stats.parsing.start = now;\n }\n var initSegmentChange = !(lastFrag && ((_frag$initSegment = frag.initSegment) == null ? void 0 : _frag$initSegment.url) === ((_lastFrag$initSegment = lastFrag.initSegment) == null ? void 0 : _lastFrag$initSegment.url));\n var state = new TransmuxState(discontinuity, contiguous, accurateTimeOffset, trackSwitch, timeOffset, initSegmentChange);\n if (!contiguous || discontinuity || initSegmentChange) {\n logger.log(\"[transmuxer-interface, \" + frag.type + \"]: Starting new transmux session for sn: \" + chunkMeta.sn + \" p: \" + chunkMeta.part + \" level: \" + chunkMeta.level + \" id: \" + chunkMeta.id + \"\\n discontinuity: \" + discontinuity + \"\\n trackSwitch: \" + trackSwitch + \"\\n contiguous: \" + contiguous + \"\\n accurateTimeOffset: \" + accurateTimeOffset + \"\\n timeOffset: \" + timeOffset + \"\\n initSegmentChange: \" + initSegmentChange);\n var config = new TransmuxConfig(audioCodec, videoCodec, initSegmentData, duration, defaultInitPTS);\n this.configureTransmuxer(config);\n }\n this.frag = frag;\n this.part = part;\n\n // Frags with sn of 'initSegment' are not transmuxed\n if (this.workerContext) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n this.workerContext.worker.postMessage({\n cmd: 'demux',\n data: data,\n decryptdata: decryptdata,\n chunkMeta: chunkMeta,\n state: state\n }, data instanceof ArrayBuffer ? [data] : []);\n } else if (transmuxer) {\n var _transmuxResult = transmuxer.push(data, decryptdata, chunkMeta, state);\n if (isPromise(_transmuxResult)) {\n transmuxer.async = true;\n _transmuxResult.then(function (data) {\n _this2.handleTransmuxComplete(data);\n }).catch(function (error) {\n _this2.transmuxerError(error, chunkMeta, 'transmuxer-interface push error');\n });\n } else {\n transmuxer.async = false;\n this.handleTransmuxComplete(_transmuxResult);\n }\n }\n };\n _proto.flush = function flush(chunkMeta) {\n var _this3 = this;\n chunkMeta.transmuxing.start = self.performance.now();\n var transmuxer = this.transmuxer;\n if (this.workerContext) {\n this.workerContext.worker.postMessage({\n cmd: 'flush',\n chunkMeta: chunkMeta\n });\n } else if (transmuxer) {\n var _transmuxResult2 = transmuxer.flush(chunkMeta);\n var asyncFlush = isPromise(_transmuxResult2);\n if (asyncFlush || transmuxer.async) {\n if (!isPromise(_transmuxResult2)) {\n _transmuxResult2 = Promise.resolve(_transmuxResult2);\n }\n _transmuxResult2.then(function (data) {\n _this3.handleFlushResult(data, chunkMeta);\n }).catch(function (error) {\n _this3.transmuxerError(error, chunkMeta, 'transmuxer-interface flush error');\n });\n } else {\n this.handleFlushResult(_transmuxResult2, chunkMeta);\n }\n }\n };\n _proto.transmuxerError = function transmuxerError(error, chunkMeta, reason) {\n if (!this.hls) {\n return;\n }\n this.error = error;\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n chunkMeta: chunkMeta,\n fatal: false,\n error: error,\n err: error,\n reason: reason\n });\n };\n _proto.handleFlushResult = function handleFlushResult(results, chunkMeta) {\n var _this4 = this;\n results.forEach(function (result) {\n _this4.handleTransmuxComplete(result);\n });\n this.onFlush(chunkMeta);\n };\n _proto.onWorkerMessage = function onWorkerMessage(ev) {\n var data = ev.data;\n var hls = this.hls;\n switch (data.event) {\n case 'init':\n {\n var _this$workerContext2;\n var objectURL = (_this$workerContext2 = this.workerContext) == null ? void 0 : _this$workerContext2.objectURL;\n if (objectURL) {\n // revoke the Object URL that was used to create transmuxer worker, so as not to leak it\n self.URL.revokeObjectURL(objectURL);\n }\n break;\n }\n case 'transmuxComplete':\n {\n this.handleTransmuxComplete(data.data);\n break;\n }\n case 'flush':\n {\n this.onFlush(data.data);\n break;\n }\n\n // pass logs from the worker thread to the main logger\n case 'workerLog':\n if (logger[data.data.logType]) {\n logger[data.data.logType](data.data.message);\n }\n break;\n default:\n {\n data.data = data.data || {};\n data.data.frag = this.frag;\n data.data.id = this.id;\n hls.trigger(data.event, data.data);\n break;\n }\n }\n };\n _proto.configureTransmuxer = function configureTransmuxer(config) {\n var transmuxer = this.transmuxer;\n if (this.workerContext) {\n this.workerContext.worker.postMessage({\n cmd: 'configure',\n config: config\n });\n } else if (transmuxer) {\n transmuxer.configure(config);\n }\n };\n _proto.handleTransmuxComplete = function handleTransmuxComplete(result) {\n result.chunkMeta.transmuxing.end = self.performance.now();\n this.onTransmuxComplete(result);\n };\n return TransmuxerInterface;\n }();\n\n var STALL_MINIMUM_DURATION_MS = 250;\n var MAX_START_GAP_JUMP = 2.0;\n var SKIP_BUFFER_HOLE_STEP_SECONDS = 0.1;\n var SKIP_BUFFER_RANGE_START = 0.05;\n var GapController = /*#__PURE__*/function () {\n function GapController(config, media, fragmentTracker, hls) {\n this.config = void 0;\n this.media = null;\n this.fragmentTracker = void 0;\n this.hls = void 0;\n this.nudgeRetry = 0;\n this.stallReported = false;\n this.stalled = null;\n this.moved = false;\n this.seeking = false;\n this.config = config;\n this.media = media;\n this.fragmentTracker = fragmentTracker;\n this.hls = hls;\n }\n var _proto = GapController.prototype;\n _proto.destroy = function destroy() {\n this.media = null;\n // @ts-ignore\n this.hls = this.fragmentTracker = null;\n }\n\n /**\n * Checks if the playhead is stuck within a gap, and if so, attempts to free it.\n * A gap is an unbuffered range between two buffered ranges (or the start and the first buffered range).\n *\n * @param lastCurrentTime - Previously read playhead position\n */;\n _proto.poll = function poll(lastCurrentTime, activeFrag) {\n var config = this.config,\n media = this.media,\n stalled = this.stalled;\n if (media === null) {\n return;\n }\n var currentTime = media.currentTime,\n seeking = media.seeking;\n var seeked = this.seeking && !seeking;\n var beginSeek = !this.seeking && seeking;\n this.seeking = seeking;\n\n // The playhead is moving, no-op\n if (currentTime !== lastCurrentTime) {\n this.moved = true;\n if (stalled !== null) {\n // The playhead is now moving, but was previously stalled\n if (this.stallReported) {\n var _stalledDuration = self.performance.now() - stalled;\n logger.warn(\"playback not stuck anymore @\" + currentTime + \", after \" + Math.round(_stalledDuration) + \"ms\");\n this.stallReported = false;\n }\n this.stalled = null;\n this.nudgeRetry = 0;\n }\n return;\n }\n\n // Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek\n if (beginSeek || seeked) {\n this.stalled = null;\n return;\n }\n\n // The playhead should not be moving\n if (media.paused && !seeking || media.ended || media.playbackRate === 0 || !BufferHelper.getBuffered(media).length) {\n return;\n }\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var isBuffered = bufferInfo.len > 0;\n var nextStart = bufferInfo.nextStart || 0;\n\n // There is no playable buffer (seeked, waiting for buffer)\n if (!isBuffered && !nextStart) {\n return;\n }\n if (seeking) {\n // Waiting for seeking in a buffered range to complete\n var hasEnoughBuffer = bufferInfo.len > MAX_START_GAP_JUMP;\n // Next buffered range is too far ahead to jump to while still seeking\n var noBufferGap = !nextStart || activeFrag && activeFrag.start <= currentTime || nextStart - currentTime > MAX_START_GAP_JUMP && !this.fragmentTracker.getPartialFragment(currentTime);\n if (hasEnoughBuffer || noBufferGap) {\n return;\n }\n // Reset moved state when seeking to a point in or before a gap\n this.moved = false;\n }\n\n // Skip start gaps if we haven't played, but the last poll detected the start of a stall\n // The addition poll gives the browser a chance to jump the gap for us\n if (!this.moved && this.stalled !== null) {\n var _level$details;\n // Jump start gaps within jump threshold\n var startJump = Math.max(nextStart, bufferInfo.start || 0) - currentTime;\n\n // When joining a live stream with audio tracks, account for live playlist window sliding by allowing\n // a larger jump over start gaps caused by the audio-stream-controller buffering a start fragment\n // that begins over 1 target duration after the video start position.\n var level = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null;\n var isLive = level == null ? void 0 : (_level$details = level.details) == null ? void 0 : _level$details.live;\n var maxStartGapJump = isLive ? level.details.targetduration * 2 : MAX_START_GAP_JUMP;\n var partialOrGap = this.fragmentTracker.getPartialFragment(currentTime);\n if (startJump > 0 && (startJump <= maxStartGapJump || partialOrGap)) {\n this._trySkipBufferHole(partialOrGap);\n return;\n }\n }\n\n // Start tracking stall time\n var tnow = self.performance.now();\n if (stalled === null) {\n this.stalled = tnow;\n return;\n }\n var stalledDuration = tnow - stalled;\n if (!seeking && stalledDuration >= STALL_MINIMUM_DURATION_MS) {\n // Report stalling after trying to fix\n this._reportStall(bufferInfo);\n if (!this.media) {\n return;\n }\n }\n var bufferedWithHoles = BufferHelper.bufferInfo(media, currentTime, config.maxBufferHole);\n this._tryFixBufferStall(bufferedWithHoles, stalledDuration);\n }\n\n /**\n * Detects and attempts to fix known buffer stalling issues.\n * @param bufferInfo - The properties of the current buffer.\n * @param stalledDurationMs - The amount of time Hls.js has been stalling for.\n * @private\n */;\n _proto._tryFixBufferStall = function _tryFixBufferStall(bufferInfo, stalledDurationMs) {\n var config = this.config,\n fragmentTracker = this.fragmentTracker,\n media = this.media;\n if (media === null) {\n return;\n }\n var currentTime = media.currentTime;\n var partial = fragmentTracker.getPartialFragment(currentTime);\n if (partial) {\n // Try to skip over the buffer hole caused by a partial fragment\n // This method isn't limited by the size of the gap between buffered ranges\n var targetTime = this._trySkipBufferHole(partial);\n // we return here in this case, meaning\n // the branch below only executes when we haven't seeked to a new position\n if (targetTime || !this.media) {\n return;\n }\n }\n\n // if we haven't had to skip over a buffer hole of a partial fragment\n // we may just have to \"nudge\" the playlist as the browser decoding/rendering engine\n // needs to cross some sort of threshold covering all source-buffers content\n // to start playing properly.\n if ((bufferInfo.len > config.maxBufferHole || bufferInfo.nextStart && bufferInfo.nextStart - currentTime < config.maxBufferHole) && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {\n logger.warn('Trying to nudge playhead over buffer-hole');\n // Try to nudge currentTime over a buffer hole if we've been stalling for the configured amount of seconds\n // We only try to jump the hole if it's under the configured size\n // Reset stalled so to rearm watchdog timer\n this.stalled = null;\n this._tryNudgeBuffer();\n }\n }\n\n /**\n * Triggers a BUFFER_STALLED_ERROR event, but only once per stall period.\n * @param bufferLen - The playhead distance from the end of the current buffer segment.\n * @private\n */;\n _proto._reportStall = function _reportStall(bufferInfo) {\n var hls = this.hls,\n media = this.media,\n stallReported = this.stallReported;\n if (!stallReported && media) {\n // Report stalled error once\n this.stallReported = true;\n var error = new Error(\"Playback stalling at @\" + media.currentTime + \" due to low buffer (\" + JSON.stringify(bufferInfo) + \")\");\n logger.warn(error.message);\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_STALLED_ERROR,\n fatal: false,\n error: error,\n buffer: bufferInfo.len\n });\n }\n }\n\n /**\n * Attempts to fix buffer stalls by jumping over known gaps caused by partial fragments\n * @param partial - The partial fragment found at the current time (where playback is stalling).\n * @private\n */;\n _proto._trySkipBufferHole = function _trySkipBufferHole(partial) {\n var config = this.config,\n hls = this.hls,\n media = this.media;\n if (media === null) {\n return 0;\n }\n\n // Check if currentTime is between unbuffered regions of partial fragments\n var currentTime = media.currentTime;\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var startTime = currentTime < bufferInfo.start ? bufferInfo.start : bufferInfo.nextStart;\n if (startTime) {\n var bufferStarved = bufferInfo.len <= config.maxBufferHole;\n var waiting = bufferInfo.len > 0 && bufferInfo.len < 1 && media.readyState < 3;\n var gapLength = startTime - currentTime;\n if (gapLength > 0 && (bufferStarved || waiting)) {\n // Only allow large gaps to be skipped if it is a start gap, or all fragments in skip range are partial\n if (gapLength > config.maxBufferHole) {\n var fragmentTracker = this.fragmentTracker;\n var startGap = false;\n if (currentTime === 0) {\n var startFrag = fragmentTracker.getAppendedFrag(0, PlaylistLevelType.MAIN);\n if (startFrag && startTime < startFrag.end) {\n startGap = true;\n }\n }\n if (!startGap) {\n var startProvisioned = partial || fragmentTracker.getAppendedFrag(currentTime, PlaylistLevelType.MAIN);\n if (startProvisioned) {\n var moreToLoad = false;\n var pos = startProvisioned.end;\n while (pos < startTime) {\n var provisioned = fragmentTracker.getPartialFragment(pos);\n if (provisioned) {\n pos += provisioned.duration;\n } else {\n moreToLoad = true;\n break;\n }\n }\n if (moreToLoad) {\n return 0;\n }\n }\n }\n }\n var targetTime = Math.max(startTime + SKIP_BUFFER_RANGE_START, currentTime + SKIP_BUFFER_HOLE_STEP_SECONDS);\n logger.warn(\"skipping hole, adjusting currentTime from \" + currentTime + \" to \" + targetTime);\n this.moved = true;\n this.stalled = null;\n media.currentTime = targetTime;\n if (partial && !partial.gap) {\n var error = new Error(\"fragment loaded with buffer holes, seeking from \" + currentTime + \" to \" + targetTime);\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_SEEK_OVER_HOLE,\n fatal: false,\n error: error,\n reason: error.message,\n frag: partial\n });\n }\n return targetTime;\n }\n }\n return 0;\n }\n\n /**\n * Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.\n * @private\n */;\n _proto._tryNudgeBuffer = function _tryNudgeBuffer() {\n var config = this.config,\n hls = this.hls,\n media = this.media,\n nudgeRetry = this.nudgeRetry;\n if (media === null) {\n return;\n }\n var currentTime = media.currentTime;\n this.nudgeRetry++;\n if (nudgeRetry < config.nudgeMaxRetry) {\n var targetTime = currentTime + (nudgeRetry + 1) * config.nudgeOffset;\n // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n var error = new Error(\"Nudging 'currentTime' from \" + currentTime + \" to \" + targetTime);\n logger.warn(error.message);\n media.currentTime = targetTime;\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_NUDGE_ON_STALL,\n error: error,\n fatal: false\n });\n } else {\n var _error = new Error(\"Playhead still not moving while enough data buffered @\" + currentTime + \" after \" + config.nudgeMaxRetry + \" nudges\");\n logger.error(_error.message);\n hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_STALLED_ERROR,\n error: _error,\n fatal: true\n });\n }\n };\n return GapController;\n }();\n\n var TICK_INTERVAL = 100; // how often to tick in ms\n var StreamController = /*#__PURE__*/function (_BaseStreamController) {\n _inheritsLoose(StreamController, _BaseStreamController);\n function StreamController(hls, fragmentTracker, keyLoader) {\n var _this;\n _this = _BaseStreamController.call(this, hls, fragmentTracker, keyLoader, '[stream-controller]', PlaylistLevelType.MAIN) || this;\n _this.audioCodecSwap = false;\n _this.gapController = null;\n _this.level = -1;\n _this._forceStartLoad = false;\n _this.altAudio = false;\n _this.audioOnly = false;\n _this.fragPlaying = null;\n _this.onvplaying = null;\n _this.onvseeked = null;\n _this.fragLastKbps = 0;\n _this.couldBacktrack = false;\n _this.backtrackFragment = null;\n _this.audioCodecSwitch = false;\n _this.videoBuffer = null;\n _this._registerListeners();\n return _this;\n }\n var _proto = StreamController.prototype;\n _proto._registerListeners = function _registerListeners() {\n var hls = this.hls;\n hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.on(Events.LEVEL_LOADING, this.onLevelLoading, this);\n hls.on(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n hls.on(Events.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this);\n hls.on(Events.ERROR, this.onError, this);\n hls.on(Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this);\n hls.on(Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this);\n hls.on(Events.BUFFER_CREATED, this.onBufferCreated, this);\n hls.on(Events.BUFFER_FLUSHED, this.onBufferFlushed, this);\n hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.on(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n };\n _proto._unregisterListeners = function _unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);\n hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.off(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n hls.off(Events.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this);\n hls.off(Events.ERROR, this.onError, this);\n hls.off(Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this);\n hls.off(Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this);\n hls.off(Events.BUFFER_CREATED, this.onBufferCreated, this);\n hls.off(Events.BUFFER_FLUSHED, this.onBufferFlushed, this);\n hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.off(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n };\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this._unregisterListeners();\n this.onMediaDetaching();\n };\n _proto.startLoad = function startLoad(startPosition) {\n if (this.levels) {\n var lastCurrentTime = this.lastCurrentTime,\n hls = this.hls;\n this.stopLoad();\n this.setInterval(TICK_INTERVAL);\n this.level = -1;\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls.startLevel;\n if (startLevel === -1) {\n if (hls.config.testBandwidth && this.levels.length > 1) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.bitrateTest = true;\n } else {\n startLevel = hls.nextAutoLevel;\n }\n }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n }\n // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n if (lastCurrentTime > 0 && startPosition === -1) {\n this.log(\"Override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n startPosition = lastCurrentTime;\n }\n this.state = State.IDLE;\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime = startPosition;\n this.tick();\n } else {\n this._forceStartLoad = true;\n this.state = State.STOPPED;\n }\n };\n _proto.stopLoad = function stopLoad() {\n this._forceStartLoad = false;\n _BaseStreamController.prototype.stopLoad.call(this);\n };\n _proto.doTick = function doTick() {\n switch (this.state) {\n case State.WAITING_LEVEL:\n {\n var _levels$level;\n var levels = this.levels,\n level = this.level;\n var details = levels == null ? void 0 : (_levels$level = levels[level]) == null ? void 0 : _levels$level.details;\n if (details && (!details.live || this.levelLastLoaded === this.level)) {\n if (this.waitForCdnTuneIn(details)) {\n break;\n }\n this.state = State.IDLE;\n break;\n } else if (this.hls.nextLoadLevel !== this.level) {\n this.state = State.IDLE;\n break;\n }\n break;\n }\n case State.FRAG_LOADING_WAITING_RETRY:\n {\n var _this$media;\n var now = self.performance.now();\n var retryDate = this.retryDate;\n // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n if (!retryDate || now >= retryDate || (_this$media = this.media) != null && _this$media.seeking) {\n this.resetStartWhenNotLoaded(this.level);\n this.state = State.IDLE;\n }\n }\n break;\n }\n if (this.state === State.IDLE) {\n this.doTickIdle();\n }\n this.onTickEnd();\n };\n _proto.onTickEnd = function onTickEnd() {\n _BaseStreamController.prototype.onTickEnd.call(this);\n this.checkBuffer();\n this.checkFragmentChanged();\n };\n _proto.doTickIdle = function doTickIdle() {\n var hls = this.hls,\n levelLastLoaded = this.levelLastLoaded,\n levels = this.levels,\n media = this.media;\n var config = hls.config,\n level = hls.nextLoadLevel;\n\n // if start level not parsed yet OR\n // if video not attached AND start fragment already requested OR start frag prefetch not enabled\n // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment\n if (levelLastLoaded === null || !media && (this.startFragRequested || !config.startFragPrefetch)) {\n return;\n }\n\n // If the \"main\" level is audio-only but we are loading an alternate track in the same group, do not load anything\n if (this.altAudio && this.audioOnly) {\n return;\n }\n if (!(levels != null && levels[level])) {\n return;\n }\n var levelInfo = levels[level];\n\n // if buffer length is less than maxBufLen try to load a new fragment\n\n var bufferInfo = this.getMainFwdBufferInfo();\n if (bufferInfo === null) {\n return;\n }\n var lastDetails = this.getLevelDetails();\n if (lastDetails && this._streamEnded(bufferInfo, lastDetails)) {\n var data = {};\n if (this.altAudio) {\n data.type = 'video';\n }\n this.hls.trigger(Events.BUFFER_EOS, data);\n this.state = State.ENDED;\n return;\n }\n\n // set next load level : this will trigger a playlist load if needed\n if (hls.loadLevel !== level && hls.manualLevel === -1) {\n this.log(\"Adapting to level \" + level + \" from level \" + this.level);\n }\n this.level = hls.nextLoadLevel = level;\n var levelDetails = levelInfo.details;\n // if level info not retrieved yet, switch state and wait for level retrieval\n // if live playlist, ensure that new playlist has been refreshed to avoid loading/try to load\n // a useless and outdated fragment (that might even introduce load error if it is already out of the live playlist)\n if (!levelDetails || this.state === State.WAITING_LEVEL || levelDetails.live && this.levelLastLoaded !== level) {\n this.level = level;\n this.state = State.WAITING_LEVEL;\n return;\n }\n var bufferLen = bufferInfo.len;\n\n // compute max Buffer Length that we could get from this load level, based on level bitrate. don't buffer more than 60 MB and more than 30s\n var maxBufLen = this.getMaxBufferLength(levelInfo.maxBitrate);\n\n // Stay idle if we are still with buffer margins\n if (bufferLen >= maxBufLen) {\n return;\n }\n if (this.backtrackFragment && this.backtrackFragment.start > bufferInfo.end) {\n this.backtrackFragment = null;\n }\n var targetBufferTime = this.backtrackFragment ? this.backtrackFragment.start : bufferInfo.end;\n var frag = this.getNextFragment(targetBufferTime, levelDetails);\n // Avoid backtracking by loading an earlier segment in streams with segments that do not start with a key frame (flagged by `couldBacktrack`)\n if (this.couldBacktrack && !this.fragPrevious && frag && frag.sn !== 'initSegment' && this.fragmentTracker.getState(frag) !== FragmentState.OK) {\n var _this$backtrackFragme;\n var backtrackSn = ((_this$backtrackFragme = this.backtrackFragment) != null ? _this$backtrackFragme : frag).sn;\n var fragIdx = backtrackSn - levelDetails.startSN;\n var backtrackFrag = levelDetails.fragments[fragIdx - 1];\n if (backtrackFrag && frag.cc === backtrackFrag.cc) {\n frag = backtrackFrag;\n this.fragmentTracker.removeFragment(backtrackFrag);\n }\n } else if (this.backtrackFragment && bufferInfo.len) {\n this.backtrackFragment = null;\n }\n // Avoid loop loading by using nextLoadPosition set for backtracking and skipping consecutive GAP tags\n if (frag && this.isLoopLoading(frag, targetBufferTime)) {\n var gapStart = frag.gap;\n if (!gapStart) {\n // Cleanup the fragment tracker before trying to find the next unbuffered fragment\n var type = this.audioOnly && !this.altAudio ? ElementaryStreamTypes.AUDIO : ElementaryStreamTypes.VIDEO;\n var mediaBuffer = (type === ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this.media;\n if (mediaBuffer) {\n this.afterBufferFlushed(mediaBuffer, type, PlaylistLevelType.MAIN);\n }\n }\n frag = this.getNextFragmentLoopLoading(frag, levelDetails, bufferInfo, PlaylistLevelType.MAIN, maxBufLen);\n }\n if (!frag) {\n return;\n }\n if (frag.initSegment && !frag.initSegment.data && !this.bitrateTest) {\n frag = frag.initSegment;\n }\n this.loadFragment(frag, levelInfo, targetBufferTime);\n };\n _proto.loadFragment = function loadFragment(frag, level, targetBufferTime) {\n // Check if fragment is not loaded\n var fragState = this.fragmentTracker.getState(frag);\n this.fragCurrent = frag;\n if (fragState === FragmentState.NOT_LOADED || fragState === FragmentState.PARTIAL) {\n if (frag.sn === 'initSegment') {\n this._loadInitSegment(frag, level);\n } else if (this.bitrateTest) {\n this.log(\"Fragment \" + frag.sn + \" of level \" + frag.level + \" is being downloaded to test bitrate and will not be buffered\");\n this._loadBitrateTestFrag(frag, level);\n } else {\n this.startFragRequested = true;\n _BaseStreamController.prototype.loadFragment.call(this, frag, level, targetBufferTime);\n }\n } else {\n this.clearTrackerIfNeeded(frag);\n }\n };\n _proto.getBufferedFrag = function getBufferedFrag(position) {\n return this.fragmentTracker.getBufferedFrag(position, PlaylistLevelType.MAIN);\n };\n _proto.followingBufferedFrag = function followingBufferedFrag(frag) {\n if (frag) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferedFrag(frag.end + 0.5);\n }\n return null;\n }\n\n /*\n on immediate level switch :\n - pause playback if playing\n - cancel any pending load request\n - and trigger a buffer flush\n */;\n _proto.immediateLevelSwitch = function immediateLevelSwitch() {\n this.abortCurrentFrag();\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n\n /**\n * try to switch ASAP without breaking video playback:\n * in order to ensure smooth but quick level switching,\n * we need to find the next flushable buffer range\n * we should take into account new segment fetch time\n */;\n _proto.nextLevelSwitch = function nextLevelSwitch() {\n var levels = this.levels,\n media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media != null && media.readyState) {\n var fetchdelay;\n var fragPlayingCurrent = this.getAppendedFrag(media.currentTime);\n if (fragPlayingCurrent && fragPlayingCurrent.start > 1) {\n // flush buffer preceding current fragment (flush until current fragment start offset)\n // minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...\n this.flushMainBuffer(0, fragPlayingCurrent.start - 1);\n }\n var levelDetails = this.getLevelDetails();\n if (levelDetails != null && levelDetails.live) {\n var bufferInfo = this.getMainFwdBufferInfo();\n // Do not flush in live stream with low buffer\n if (!bufferInfo || bufferInfo.len < levelDetails.targetduration * 2) {\n return;\n }\n }\n if (!media.paused && levels) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel;\n var nextLevel = levels[nextLevelId];\n var fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.maxBitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n // this.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n var bufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n if (bufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n var nextBufferedFrag = this.followingBufferedFrag(bufferedFrag);\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n this.abortCurrentFrag();\n // start flush position is in next buffered frag. Leave some padding for non-independent segments and smoother playback.\n var maxStart = nextBufferedFrag.maxStartPTS ? nextBufferedFrag.maxStartPTS : nextBufferedFrag.start;\n var fragDuration = nextBufferedFrag.duration;\n var startPts = Math.max(bufferedFrag.end, maxStart + Math.min(Math.max(fragDuration - this.config.maxFragLookUpTolerance, fragDuration * 0.5), fragDuration * 0.75));\n this.flushMainBuffer(startPts, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n _proto.abortCurrentFrag = function abortCurrentFrag() {\n var fragCurrent = this.fragCurrent;\n this.fragCurrent = null;\n this.backtrackFragment = null;\n if (fragCurrent) {\n fragCurrent.abortRequests();\n this.fragmentTracker.removeFragment(fragCurrent);\n }\n switch (this.state) {\n case State.KEY_LOADING:\n case State.FRAG_LOADING:\n case State.FRAG_LOADING_WAITING_RETRY:\n case State.PARSING:\n case State.PARSED:\n this.state = State.IDLE;\n break;\n }\n this.nextLoadPosition = this.getLoadPosition();\n };\n _proto.flushMainBuffer = function flushMainBuffer(startOffset, endOffset) {\n _BaseStreamController.prototype.flushMainBuffer.call(this, startOffset, endOffset, this.altAudio ? 'video' : null);\n };\n _proto.onMediaAttached = function onMediaAttached(event, data) {\n _BaseStreamController.prototype.onMediaAttached.call(this, event, data);\n var media = data.media;\n this.onvplaying = this.onMediaPlaying.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n media.addEventListener('playing', this.onvplaying);\n media.addEventListener('seeked', this.onvseeked);\n this.gapController = new GapController(this.config, media, this.fragmentTracker, this.hls);\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media && this.onvplaying && this.onvseeked) {\n media.removeEventListener('playing', this.onvplaying);\n media.removeEventListener('seeked', this.onvseeked);\n this.onvplaying = this.onvseeked = null;\n this.videoBuffer = null;\n }\n this.fragPlaying = null;\n if (this.gapController) {\n this.gapController.destroy();\n this.gapController = null;\n }\n _BaseStreamController.prototype.onMediaDetaching.call(this);\n };\n _proto.onMediaPlaying = function onMediaPlaying() {\n // tick to speed up FRAG_CHANGED triggering\n this.tick();\n };\n _proto.onMediaSeeked = function onMediaSeeked() {\n var media = this.media;\n var currentTime = media ? media.currentTime : null;\n if (isFiniteNumber(currentTime)) {\n this.log(\"Media seeked to \" + currentTime.toFixed(3));\n }\n\n // If seeked was issued before buffer was appended do not tick immediately\n var bufferInfo = this.getMainFwdBufferInfo();\n if (bufferInfo === null || bufferInfo.len === 0) {\n this.warn(\"Main forward buffer length on \\\"seeked\\\" event \" + (bufferInfo ? bufferInfo.len : 'empty') + \")\");\n return;\n }\n\n // tick to speed up FRAG_CHANGED triggering\n this.tick();\n };\n _proto.onManifestLoading = function onManifestLoading() {\n // reset buffer on manifest loading\n this.log('Trigger BUFFER_RESET');\n this.hls.trigger(Events.BUFFER_RESET, undefined);\n this.fragmentTracker.removeAllFragments();\n this.couldBacktrack = false;\n this.startPosition = this.lastCurrentTime = 0;\n this.levels = this.fragPlaying = this.backtrackFragment = null;\n this.altAudio = this.audioOnly = false;\n };\n _proto.onManifestParsed = function onManifestParsed(event, data) {\n var aac = false;\n var heaac = false;\n var codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = aac && heaac && !changeTypeSupported();\n if (this.audioCodecSwitch) {\n this.log('Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n this.levels = data.levels;\n this.startFragRequested = false;\n };\n _proto.onLevelLoading = function onLevelLoading(event, data) {\n var levels = this.levels;\n if (!levels || this.state !== State.IDLE) {\n return;\n }\n var level = levels[data.level];\n if (!level.details || level.details.live && this.levelLastLoaded !== data.level || this.waitForCdnTuneIn(level.details)) {\n this.state = State.WAITING_LEVEL;\n }\n };\n _proto.onLevelLoaded = function onLevelLoaded(event, data) {\n var _curLevel$details;\n var levels = this.levels;\n var newLevelId = data.level;\n var newDetails = data.details;\n var duration = newDetails.totalduration;\n if (!levels) {\n this.warn(\"Levels were reset while loading level \" + newLevelId);\n return;\n }\n this.log(\"Level \" + newLevelId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"]\" + (newDetails.lastPartSn ? \"[part-\" + newDetails.lastPartSn + \"-\" + newDetails.lastPartIndex + \"]\" : '') + \", cc [\" + newDetails.startCC + \", \" + newDetails.endCC + \"] duration:\" + duration);\n var curLevel = levels[newLevelId];\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && (this.state === State.FRAG_LOADING || this.state === State.FRAG_LOADING_WAITING_RETRY)) {\n if ((fragCurrent.level !== data.level || fragCurrent.urlId !== curLevel.urlId) && fragCurrent.loader) {\n this.abortCurrentFrag();\n }\n }\n var sliding = 0;\n if (newDetails.live || (_curLevel$details = curLevel.details) != null && _curLevel$details.live) {\n this.checkLiveUpdate(newDetails);\n if (newDetails.deltaUpdateFailed) {\n return;\n }\n sliding = this.alignPlaylists(newDetails, curLevel.details);\n }\n // override level info\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(Events.LEVEL_UPDATED, {\n details: newDetails,\n level: newLevelId\n });\n\n // only switch back to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n if (this.waitForCdnTuneIn(newDetails)) {\n // Wait for Low-Latency CDN Tune-in\n return;\n }\n this.state = State.IDLE;\n }\n if (!this.startFragRequested) {\n this.setStartPosition(newDetails, sliding);\n } else if (newDetails.live) {\n this.synchronizeToLiveEdge(newDetails);\n }\n\n // trigger handler right now\n this.tick();\n };\n _proto._handleFragmentLoadProgress = function _handleFragmentLoadProgress(data) {\n var _frag$initSegment;\n var frag = data.frag,\n part = data.part,\n payload = data.payload;\n var levels = this.levels;\n if (!levels) {\n this.warn(\"Levels were reset while fragment load was in progress. Fragment \" + frag.sn + \" of level \" + frag.level + \" will not be buffered\");\n return;\n }\n var currentLevel = levels[frag.level];\n var details = currentLevel.details;\n if (!details) {\n this.warn(\"Dropping fragment \" + frag.sn + \" of level \" + frag.level + \" after level details were reset\");\n this.fragmentTracker.removeFragment(frag);\n return;\n }\n var videoCodec = currentLevel.videoCodec;\n\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n var accurateTimeOffset = details.PTSKnown || !details.live;\n var initSegmentData = (_frag$initSegment = frag.initSegment) == null ? void 0 : _frag$initSegment.data;\n var audioCodec = this._getAudioCodec(currentLevel);\n\n // transmux the MPEG-TS data to ISO-BMFF segments\n // this.log(`Transmuxing ${frag.sn} of [${details.startSN} ,${details.endSN}],level ${frag.level}, cc ${frag.cc}`);\n var transmuxer = this.transmuxer = this.transmuxer || new TransmuxerInterface(this.hls, PlaylistLevelType.MAIN, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this));\n var partIndex = part ? part.index : -1;\n var partial = partIndex !== -1;\n var chunkMeta = new ChunkMetadata(frag.level, frag.sn, frag.stats.chunkCount, payload.byteLength, partIndex, partial);\n var initPTS = this.initPTS[frag.cc];\n transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);\n };\n _proto.onAudioTrackSwitching = function onAudioTrackSwitching(event, data) {\n // if any URL found on new audio track, it is an alternate audio track\n var fromAltAudio = this.altAudio;\n var altAudio = !!data.url;\n // if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered\n // don't do anything if we switch to alt audio: audio stream controller is handling it.\n // we will just have to change buffer scheduling on audioTrackSwitched\n if (!altAudio) {\n if (this.mediaBuffer !== this.media) {\n this.log('Switching on main audio, use media.buffered to schedule main fragment loading');\n this.mediaBuffer = this.media;\n var fragCurrent = this.fragCurrent;\n // we need to refill audio buffer from main: cancel any frag loading to speed up audio switch\n if (fragCurrent) {\n this.log('Switching to main audio track, cancel main fragment load');\n fragCurrent.abortRequests();\n this.fragmentTracker.removeFragment(fragCurrent);\n }\n // destroy transmuxer to force init segment generation (following audio switch)\n this.resetTransmuxer();\n // switch to IDLE state to load new fragment\n this.resetLoadingState();\n } else if (this.audioOnly) {\n // Reset audio transmuxer so when switching back to main audio we're not still appending where we left off\n this.resetTransmuxer();\n }\n var hls = this.hls;\n // If switching from alt to main audio, flush all audio and trigger track switched\n if (fromAltAudio) {\n hls.trigger(Events.BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: null\n });\n this.fragmentTracker.removeAllFragments();\n }\n hls.trigger(Events.AUDIO_TRACK_SWITCHED, data);\n }\n };\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(event, data) {\n var trackId = data.id;\n var altAudio = !!this.hls.audioTracks[trackId].url;\n if (altAudio) {\n var videoBuffer = this.videoBuffer;\n // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered\n if (videoBuffer && this.mediaBuffer !== videoBuffer) {\n this.log('Switching on alternate audio, use video.buffered to schedule main fragment loading');\n this.mediaBuffer = videoBuffer;\n }\n }\n this.altAudio = altAudio;\n this.tick();\n };\n _proto.onBufferCreated = function onBufferCreated(event, data) {\n var tracks = data.tracks;\n var mediaTrack;\n var name;\n var alternate = false;\n for (var type in tracks) {\n var track = tracks[type];\n if (track.id === 'main') {\n name = type;\n mediaTrack = track;\n // keep video source buffer reference\n if (type === 'video') {\n var videoTrack = tracks[type];\n if (videoTrack) {\n this.videoBuffer = videoTrack.buffer;\n }\n }\n } else {\n alternate = true;\n }\n }\n if (alternate && mediaTrack) {\n this.log(\"Alternate track found, use \" + name + \".buffered to schedule main fragment loading\");\n this.mediaBuffer = mediaTrack.buffer;\n } else {\n this.mediaBuffer = this.media;\n }\n };\n _proto.onFragBuffered = function onFragBuffered(event, data) {\n var frag = data.frag,\n part = data.part;\n if (frag && frag.type !== PlaylistLevelType.MAIN) {\n return;\n }\n if (this.fragContextChanged(frag)) {\n // If a level switch was requested while a fragment was buffering, it will emit the FRAG_BUFFERED event upon completion\n // Avoid setting state back to IDLE, since that will interfere with a level switch\n this.warn(\"Fragment \" + frag.sn + (part ? ' p: ' + part.index : '') + \" of level \" + frag.level + \" finished buffering, but was aborted. state: \" + this.state);\n if (this.state === State.PARSED) {\n this.state = State.IDLE;\n }\n return;\n }\n var stats = part ? part.stats : frag.stats;\n this.fragLastKbps = Math.round(8 * stats.total / (stats.buffering.end - stats.loading.first));\n if (frag.sn !== 'initSegment') {\n this.fragPrevious = frag;\n }\n this.fragBufferedComplete(frag, part);\n };\n _proto.onError = function onError(event, data) {\n var _data$context;\n if (data.fatal) {\n this.state = State.ERROR;\n return;\n }\n switch (data.details) {\n case ErrorDetails.FRAG_GAP:\n case ErrorDetails.FRAG_PARSING_ERROR:\n case ErrorDetails.FRAG_DECRYPT_ERROR:\n case ErrorDetails.FRAG_LOAD_ERROR:\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n case ErrorDetails.KEY_LOAD_ERROR:\n case ErrorDetails.KEY_LOAD_TIMEOUT:\n this.onFragmentOrKeyLoadError(PlaylistLevelType.MAIN, data);\n break;\n case ErrorDetails.LEVEL_LOAD_ERROR:\n case ErrorDetails.LEVEL_LOAD_TIMEOUT:\n case ErrorDetails.LEVEL_PARSING_ERROR:\n // in case of non fatal error while loading level, if level controller is not retrying to load level, switch back to IDLE\n if (!data.levelRetry && this.state === State.WAITING_LEVEL && ((_data$context = data.context) == null ? void 0 : _data$context.type) === PlaylistContextType.LEVEL) {\n this.state = State.IDLE;\n }\n break;\n case ErrorDetails.BUFFER_FULL_ERROR:\n if (!data.parent || data.parent !== 'main') {\n return;\n }\n if (this.reduceLengthAndFlushBuffer(data)) {\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n break;\n case ErrorDetails.INTERNAL_EXCEPTION:\n this.recoverWorkerError(data);\n break;\n }\n }\n\n // Checks the health of the buffer and attempts to resolve playback stalls.\n ;\n _proto.checkBuffer = function checkBuffer() {\n var media = this.media,\n gapController = this.gapController;\n if (!media || !gapController || !media.readyState) {\n // Exit early if we don't have media or if the media hasn't buffered anything yet (readyState 0)\n return;\n }\n if (this.loadedmetadata || !BufferHelper.getBuffered(media).length) {\n // Resolve gaps using the main buffer, whose ranges are the intersections of the A/V sourcebuffers\n var activeFrag = this.state !== State.IDLE ? this.fragCurrent : null;\n gapController.poll(this.lastCurrentTime, activeFrag);\n }\n this.lastCurrentTime = media.currentTime;\n };\n _proto.onFragLoadEmergencyAborted = function onFragLoadEmergencyAborted() {\n this.state = State.IDLE;\n // if loadedmetadata is not set, it means that we are emergency switch down on first frag\n // in that case, reset startFragRequested flag\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n this.tickImmediate();\n };\n _proto.onBufferFlushed = function onBufferFlushed(event, _ref) {\n var type = _ref.type;\n if (type !== ElementaryStreamTypes.AUDIO || this.audioOnly && !this.altAudio) {\n var mediaBuffer = (type === ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this.media;\n this.afterBufferFlushed(mediaBuffer, type, PlaylistLevelType.MAIN);\n }\n };\n _proto.onLevelsUpdated = function onLevelsUpdated(event, data) {\n this.levels = data.levels;\n };\n _proto.swapAudioCodec = function swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n\n /**\n * Seeks to the set startPosition if not equal to the mediaElement's current time.\n */;\n _proto.seekToStartPos = function seekToStartPos() {\n var media = this.media;\n if (!media) {\n return;\n }\n var currentTime = media.currentTime;\n var startPosition = this.startPosition;\n // only adjust currentTime if different from startPosition or if startPosition not buffered\n // at that stage, there should be only one buffered range, as we reach that code after first fragment has been buffered\n if (startPosition >= 0 && currentTime < startPosition) {\n if (media.seeking) {\n this.log(\"could not seek to \" + startPosition + \", already seeking at \" + currentTime);\n return;\n }\n var buffered = BufferHelper.getBuffered(media);\n var bufferStart = buffered.length ? buffered.start(0) : 0;\n var delta = bufferStart - startPosition;\n if (delta > 0 && (delta < this.config.maxBufferHole || delta < this.config.maxFragLookUpTolerance)) {\n this.log(\"adjusting start position by \" + delta + \" to match buffer start\");\n startPosition += delta;\n this.startPosition = startPosition;\n }\n this.log(\"seek to target start position \" + startPosition + \" from current time \" + currentTime);\n media.currentTime = startPosition;\n }\n };\n _proto._getAudioCodec = function _getAudioCodec(currentLevel) {\n var audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n if (this.audioCodecSwap && audioCodec) {\n this.log('Swapping audio codec');\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n return audioCodec;\n };\n _proto._loadBitrateTestFrag = function _loadBitrateTestFrag(frag, level) {\n var _this2 = this;\n frag.bitrateTest = true;\n this._doFragLoad(frag, level).then(function (data) {\n var hls = _this2.hls;\n if (!data || _this2.fragContextChanged(frag)) {\n return;\n }\n level.fragmentError = 0;\n _this2.state = State.IDLE;\n _this2.startFragRequested = false;\n _this2.bitrateTest = false;\n var stats = frag.stats;\n // Bitrate tests fragments are neither parsed nor buffered\n stats.parsing.start = stats.parsing.end = stats.buffering.start = stats.buffering.end = self.performance.now();\n hls.trigger(Events.FRAG_LOADED, data);\n frag.bitrateTest = false;\n });\n };\n _proto._handleTransmuxComplete = function _handleTransmuxComplete(transmuxResult) {\n var _id3$samples;\n var id = 'main';\n var hls = this.hls;\n var remuxResult = transmuxResult.remuxResult,\n chunkMeta = transmuxResult.chunkMeta;\n var context = this.getCurrentContext(chunkMeta);\n if (!context) {\n this.resetWhenMissingContext(chunkMeta);\n return;\n }\n var frag = context.frag,\n part = context.part,\n level = context.level;\n var video = remuxResult.video,\n text = remuxResult.text,\n id3 = remuxResult.id3,\n initSegment = remuxResult.initSegment;\n var details = level.details;\n // The audio-stream-controller handles audio buffering if Hls.js is playing an alternate audio track\n var audio = this.altAudio ? undefined : remuxResult.audio;\n\n // Check if the current fragment has been aborted. We check this by first seeing if we're still playing the current level.\n // If we are, subsequently check if the currently loading fragment (fragCurrent) has changed.\n if (this.fragContextChanged(frag)) {\n this.fragmentTracker.removeFragment(frag);\n return;\n }\n this.state = State.PARSING;\n if (initSegment) {\n if (initSegment != null && initSegment.tracks) {\n var mapFragment = frag.initSegment || frag;\n this._bufferInitSegment(level, initSegment.tracks, mapFragment, chunkMeta);\n hls.trigger(Events.FRAG_PARSING_INIT_SEGMENT, {\n frag: mapFragment,\n id: id,\n tracks: initSegment.tracks\n });\n }\n\n // This would be nice if Number.isFinite acted as a typeguard, but it doesn't. See: https://github.com/Microsoft/TypeScript/issues/10038\n var initPTS = initSegment.initPTS;\n var timescale = initSegment.timescale;\n if (isFiniteNumber(initPTS)) {\n this.initPTS[frag.cc] = {\n baseTime: initPTS,\n timescale: timescale\n };\n hls.trigger(Events.INIT_PTS_FOUND, {\n frag: frag,\n id: id,\n initPTS: initPTS,\n timescale: timescale\n });\n }\n }\n\n // Avoid buffering if backtracking this fragment\n if (video && details && frag.sn !== 'initSegment') {\n var prevFrag = details.fragments[frag.sn - 1 - details.startSN];\n var isFirstFragment = frag.sn === details.startSN;\n var isFirstInDiscontinuity = !prevFrag || frag.cc > prevFrag.cc;\n if (remuxResult.independent !== false) {\n var startPTS = video.startPTS,\n endPTS = video.endPTS,\n startDTS = video.startDTS,\n endDTS = video.endDTS;\n if (part) {\n part.elementaryStreams[video.type] = {\n startPTS: startPTS,\n endPTS: endPTS,\n startDTS: startDTS,\n endDTS: endDTS\n };\n } else {\n if (video.firstKeyFrame && video.independent && chunkMeta.id === 1 && !isFirstInDiscontinuity) {\n this.couldBacktrack = true;\n }\n if (video.dropped && video.independent) {\n // Backtrack if dropped frames create a gap after currentTime\n\n var bufferInfo = this.getMainFwdBufferInfo();\n var targetBufferTime = (bufferInfo ? bufferInfo.end : this.getLoadPosition()) + this.config.maxBufferHole;\n var startTime = video.firstKeyFramePTS ? video.firstKeyFramePTS : startPTS;\n if (!isFirstFragment && targetBufferTime < startTime - this.config.maxBufferHole && !isFirstInDiscontinuity) {\n this.backtrack(frag);\n return;\n } else if (isFirstInDiscontinuity) {\n // Mark segment with a gap to avoid loop loading\n frag.gap = true;\n }\n // Set video stream start to fragment start so that truncated samples do not distort the timeline, and mark it partial\n frag.setElementaryStreamInfo(video.type, frag.start, endPTS, frag.start, endDTS, true);\n }\n }\n frag.setElementaryStreamInfo(video.type, startPTS, endPTS, startDTS, endDTS);\n if (this.backtrackFragment) {\n this.backtrackFragment = frag;\n }\n this.bufferFragmentData(video, frag, part, chunkMeta, isFirstFragment || isFirstInDiscontinuity);\n } else if (isFirstFragment || isFirstInDiscontinuity) {\n // Mark segment with a gap to avoid loop loading\n frag.gap = true;\n } else {\n this.backtrack(frag);\n return;\n }\n }\n if (audio) {\n var _startPTS = audio.startPTS,\n _endPTS = audio.endPTS,\n _startDTS = audio.startDTS,\n _endDTS = audio.endDTS;\n if (part) {\n part.elementaryStreams[ElementaryStreamTypes.AUDIO] = {\n startPTS: _startPTS,\n endPTS: _endPTS,\n startDTS: _startDTS,\n endDTS: _endDTS\n };\n }\n frag.setElementaryStreamInfo(ElementaryStreamTypes.AUDIO, _startPTS, _endPTS, _startDTS, _endDTS);\n this.bufferFragmentData(audio, frag, part, chunkMeta);\n }\n if (details && id3 != null && (_id3$samples = id3.samples) != null && _id3$samples.length) {\n var emittedID3 = {\n id: id,\n frag: frag,\n details: details,\n samples: id3.samples\n };\n hls.trigger(Events.FRAG_PARSING_METADATA, emittedID3);\n }\n if (details && text) {\n var emittedText = {\n id: id,\n frag: frag,\n details: details,\n samples: text.samples\n };\n hls.trigger(Events.FRAG_PARSING_USERDATA, emittedText);\n }\n };\n _proto._bufferInitSegment = function _bufferInitSegment(currentLevel, tracks, frag, chunkMeta) {\n var _this3 = this;\n if (this.state !== State.PARSING) {\n return;\n }\n this.audioOnly = !!tracks.audio && !tracks.video;\n\n // if audio track is expected to come from audio stream controller, discard any coming from main\n if (this.altAudio && !this.audioOnly) {\n delete tracks.audio;\n }\n // include levelCodec in audio and video tracks\n var audio = tracks.audio,\n video = tracks.video,\n audiovideo = tracks.audiovideo;\n if (audio) {\n var audioCodec = currentLevel.audioCodec;\n var ua = navigator.userAgent.toLowerCase();\n if (this.audioCodecSwitch) {\n if (audioCodec) {\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n }\n // In the case that AAC and HE-AAC audio codecs are signalled in manifest,\n // force HE-AAC, as it seems that most browsers prefers it.\n // don't force HE-AAC if mono stream, or in Firefox\n if (audio.metadata.channelCount !== 1 && ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if (ua.indexOf('android') !== -1 && audio.container !== 'audio/mpeg') {\n // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n this.log(\"Android: force audio codec to \" + audioCodec);\n }\n if (currentLevel.audioCodec && currentLevel.audioCodec !== audioCodec) {\n this.log(\"Swapping manifest audio codec \\\"\" + currentLevel.audioCodec + \"\\\" for \\\"\" + audioCodec + \"\\\"\");\n }\n audio.levelCodec = audioCodec;\n audio.id = 'main';\n this.log(\"Init audio buffer, container:\" + audio.container + \", codecs[selected/level/parsed]=[\" + (audioCodec || '') + \"/\" + (currentLevel.audioCodec || '') + \"/\" + audio.codec + \"]\");\n }\n if (video) {\n video.levelCodec = currentLevel.videoCodec;\n video.id = 'main';\n this.log(\"Init video buffer, container:\" + video.container + \", codecs[level/parsed]=[\" + (currentLevel.videoCodec || '') + \"/\" + video.codec + \"]\");\n }\n if (audiovideo) {\n this.log(\"Init audiovideo buffer, container:\" + audiovideo.container + \", codecs[level/parsed]=[\" + (currentLevel.attrs.CODECS || '') + \"/\" + audiovideo.codec + \"]\");\n }\n this.hls.trigger(Events.BUFFER_CODECS, tracks);\n // loop through tracks that are going to be provided to bufferController\n Object.keys(tracks).forEach(function (trackName) {\n var track = tracks[trackName];\n var initSegment = track.initSegment;\n if (initSegment != null && initSegment.byteLength) {\n _this3.hls.trigger(Events.BUFFER_APPENDING, {\n type: trackName,\n data: initSegment,\n frag: frag,\n part: null,\n chunkMeta: chunkMeta,\n parent: frag.type\n });\n }\n });\n // trigger handler right now\n this.tick();\n };\n _proto.getMainFwdBufferInfo = function getMainFwdBufferInfo() {\n return this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, PlaylistLevelType.MAIN);\n };\n _proto.backtrack = function backtrack(frag) {\n this.couldBacktrack = true;\n // Causes findFragments to backtrack through fragments to find the keyframe\n this.backtrackFragment = frag;\n this.resetTransmuxer();\n this.flushBufferGap(frag);\n this.fragmentTracker.removeFragment(frag);\n this.fragPrevious = null;\n this.nextLoadPosition = frag.start;\n this.state = State.IDLE;\n };\n _proto.checkFragmentChanged = function checkFragmentChanged() {\n var video = this.media;\n var fragPlayingCurrent = null;\n if (video && video.readyState > 1 && video.seeking === false) {\n var currentTime = video.currentTime;\n /* if video element is in seeked state, currentTime can only increase.\n (assuming that playback rate is positive ...)\n As sometimes currentTime jumps back to zero after a\n media decode error, check this, to avoid seeking back to\n wrong position after a media decode error\n */\n\n if (BufferHelper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getAppendedFrag(currentTime);\n } else if (BufferHelper.isBuffered(video, currentTime + 0.1)) {\n /* ensure that FRAG_CHANGED event is triggered at startup,\n when first video frame is displayed and playback is paused.\n add a tolerance of 100ms, in case current position is not buffered,\n check if current pos+100ms is buffered and use that buffer range\n for FRAG_CHANGED event reporting */\n fragPlayingCurrent = this.getAppendedFrag(currentTime + 0.1);\n }\n if (fragPlayingCurrent) {\n this.backtrackFragment = null;\n var fragPlaying = this.fragPlaying;\n var fragCurrentLevel = fragPlayingCurrent.level;\n if (!fragPlaying || fragPlayingCurrent.sn !== fragPlaying.sn || fragPlaying.level !== fragCurrentLevel || fragPlayingCurrent.urlId !== fragPlaying.urlId) {\n this.fragPlaying = fragPlayingCurrent;\n this.hls.trigger(Events.FRAG_CHANGED, {\n frag: fragPlayingCurrent\n });\n if (!fragPlaying || fragPlaying.level !== fragCurrentLevel) {\n this.hls.trigger(Events.LEVEL_SWITCHED, {\n level: fragCurrentLevel\n });\n }\n }\n }\n }\n };\n _createClass(StreamController, [{\n key: \"nextLevel\",\n get: function get() {\n var frag = this.nextBufferedFrag;\n if (frag) {\n return frag.level;\n }\n return -1;\n }\n }, {\n key: \"currentFrag\",\n get: function get() {\n var media = this.media;\n if (media) {\n return this.fragPlaying || this.getAppendedFrag(media.currentTime);\n }\n return null;\n }\n }, {\n key: \"currentProgramDateTime\",\n get: function get() {\n var media = this.media;\n if (media) {\n var currentTime = media.currentTime;\n var frag = this.currentFrag;\n if (frag && isFiniteNumber(currentTime) && isFiniteNumber(frag.programDateTime)) {\n var epocMs = frag.programDateTime + (currentTime - frag.start) * 1000;\n return new Date(epocMs);\n }\n }\n return null;\n }\n }, {\n key: \"currentLevel\",\n get: function get() {\n var frag = this.currentFrag;\n if (frag) {\n return frag.level;\n }\n return -1;\n }\n }, {\n key: \"nextBufferedFrag\",\n get: function get() {\n var frag = this.currentFrag;\n if (frag) {\n return this.followingBufferedFrag(frag);\n }\n return null;\n }\n }, {\n key: \"forceStartLoad\",\n get: function get() {\n return this._forceStartLoad;\n }\n }]);\n return StreamController;\n }(BaseStreamController);\n\n /*\n * compute an Exponential Weighted moving average\n * - https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average\n * - heavily inspired from shaka-player\n */\n var EWMA = /*#__PURE__*/function () {\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife, estimate, weight) {\n if (estimate === void 0) {\n estimate = 0;\n }\n if (weight === void 0) {\n weight = 0;\n }\n this.halfLife = void 0;\n this.alpha_ = void 0;\n this.estimate_ = void 0;\n this.totalWeight_ = void 0;\n this.halfLife = halfLife;\n // Larger values of alpha expire historical data more slowly.\n this.alpha_ = halfLife ? Math.exp(Math.log(0.5) / halfLife) : 0;\n this.estimate_ = estimate;\n this.totalWeight_ = weight;\n }\n var _proto = EWMA.prototype;\n _proto.sample = function sample(weight, value) {\n var adjAlpha = Math.pow(this.alpha_, weight);\n this.estimate_ = value * (1 - adjAlpha) + adjAlpha * this.estimate_;\n this.totalWeight_ += weight;\n };\n _proto.getTotalWeight = function getTotalWeight() {\n return this.totalWeight_;\n };\n _proto.getEstimate = function getEstimate() {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n if (zeroFactor) {\n return this.estimate_ / zeroFactor;\n }\n }\n return this.estimate_;\n };\n return EWMA;\n }();\n\n /*\n * EWMA Bandwidth Estimator\n * - heavily inspired from shaka-player\n * Tracks bandwidth samples and estimates available bandwidth.\n * Based on the minimum of two exponentially-weighted moving averages with\n * different half-lives.\n */\n\n var EwmaBandWidthEstimator = /*#__PURE__*/function () {\n function EwmaBandWidthEstimator(slow, fast, defaultEstimate, defaultTTFB) {\n if (defaultTTFB === void 0) {\n defaultTTFB = 100;\n }\n this.defaultEstimate_ = void 0;\n this.minWeight_ = void 0;\n this.minDelayMs_ = void 0;\n this.slow_ = void 0;\n this.fast_ = void 0;\n this.defaultTTFB_ = void 0;\n this.ttfb_ = void 0;\n this.defaultEstimate_ = defaultEstimate;\n this.minWeight_ = 0.001;\n this.minDelayMs_ = 50;\n this.slow_ = new EWMA(slow);\n this.fast_ = new EWMA(fast);\n this.defaultTTFB_ = defaultTTFB;\n this.ttfb_ = new EWMA(slow);\n }\n var _proto = EwmaBandWidthEstimator.prototype;\n _proto.update = function update(slow, fast) {\n var slow_ = this.slow_,\n fast_ = this.fast_,\n ttfb_ = this.ttfb_;\n if (slow_.halfLife !== slow) {\n this.slow_ = new EWMA(slow, slow_.getEstimate(), slow_.getTotalWeight());\n }\n if (fast_.halfLife !== fast) {\n this.fast_ = new EWMA(fast, fast_.getEstimate(), fast_.getTotalWeight());\n }\n if (ttfb_.halfLife !== slow) {\n this.ttfb_ = new EWMA(slow, ttfb_.getEstimate(), ttfb_.getTotalWeight());\n }\n };\n _proto.sample = function sample(durationMs, numBytes) {\n durationMs = Math.max(durationMs, this.minDelayMs_);\n var numBits = 8 * numBytes;\n // weight is duration in seconds\n var durationS = durationMs / 1000;\n // value is bandwidth in bits/s\n var bandwidthInBps = numBits / durationS;\n this.fast_.sample(durationS, bandwidthInBps);\n this.slow_.sample(durationS, bandwidthInBps);\n };\n _proto.sampleTTFB = function sampleTTFB(ttfb) {\n // weight is frequency curve applied to TTFB in seconds\n // (longer times have less weight with expected input under 1 second)\n var seconds = ttfb / 1000;\n var weight = Math.sqrt(2) * Math.exp(-Math.pow(seconds, 2) / 2);\n this.ttfb_.sample(weight, Math.max(ttfb, 5));\n };\n _proto.canEstimate = function canEstimate() {\n return this.fast_.getTotalWeight() >= this.minWeight_;\n };\n _proto.getEstimate = function getEstimate() {\n if (this.canEstimate()) {\n // console.log('slow estimate:'+ Math.round(this.slow_.getEstimate()));\n // console.log('fast estimate:'+ Math.round(this.fast_.getEstimate()));\n // Take the minimum of these two estimates. This should have the effect of\n // adapting down quickly, but up more slowly.\n return Math.min(this.fast_.getEstimate(), this.slow_.getEstimate());\n } else {\n return this.defaultEstimate_;\n }\n };\n _proto.getEstimateTTFB = function getEstimateTTFB() {\n if (this.ttfb_.getTotalWeight() >= this.minWeight_) {\n return this.ttfb_.getEstimate();\n } else {\n return this.defaultTTFB_;\n }\n };\n _proto.destroy = function destroy() {};\n return EwmaBandWidthEstimator;\n }();\n\n var AbrController = /*#__PURE__*/function () {\n function AbrController(hls) {\n this.hls = void 0;\n this.lastLevelLoadSec = 0;\n this.lastLoadedFragLevel = 0;\n this._nextAutoLevel = -1;\n this.timer = -1;\n this.onCheck = this._abandonRulesCheck.bind(this);\n this.fragCurrent = null;\n this.partCurrent = null;\n this.bitrateTestDelay = 0;\n this.bwEstimator = void 0;\n this.hls = hls;\n var config = hls.config;\n this.bwEstimator = new EwmaBandWidthEstimator(config.abrEwmaSlowVoD, config.abrEwmaFastVoD, config.abrEwmaDefaultEstimate);\n this.registerListeners();\n }\n var _proto = AbrController.prototype;\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.FRAG_LOADING, this.onFragLoading, this);\n hls.on(Events.FRAG_LOADED, this.onFragLoaded, this);\n hls.on(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n hls.on(Events.LEVEL_SWITCHING, this.onLevelSwitching, this);\n hls.on(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.FRAG_LOADING, this.onFragLoading, this);\n hls.off(Events.FRAG_LOADED, this.onFragLoaded, this);\n hls.off(Events.FRAG_BUFFERED, this.onFragBuffered, this);\n hls.off(Events.LEVEL_SWITCHING, this.onLevelSwitching, this);\n hls.off(Events.LEVEL_LOADED, this.onLevelLoaded, this);\n };\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n this.clearTimer();\n // @ts-ignore\n this.hls = this.onCheck = null;\n this.fragCurrent = this.partCurrent = null;\n };\n _proto.onFragLoading = function onFragLoading(event, data) {\n var _data$part;\n var frag = data.frag;\n if (this.ignoreFragment(frag)) {\n return;\n }\n this.fragCurrent = frag;\n this.partCurrent = (_data$part = data.part) != null ? _data$part : null;\n this.clearTimer();\n this.timer = self.setInterval(this.onCheck, 100);\n };\n _proto.onLevelSwitching = function onLevelSwitching(event, data) {\n this.clearTimer();\n };\n _proto.getTimeToLoadFrag = function getTimeToLoadFrag(timeToFirstByteSec, bandwidth, fragSizeBits, isSwitch) {\n var fragLoadSec = timeToFirstByteSec + fragSizeBits / bandwidth;\n var playlistLoadSec = isSwitch ? this.lastLevelLoadSec : 0;\n return fragLoadSec + playlistLoadSec;\n };\n _proto.onLevelLoaded = function onLevelLoaded(event, data) {\n var config = this.hls.config;\n var _data$stats = data.stats,\n total = _data$stats.total,\n bwEstimate = _data$stats.bwEstimate;\n // Total is the bytelength and bwEstimate in bits/sec\n if (isFiniteNumber(total) && isFiniteNumber(bwEstimate)) {\n this.lastLevelLoadSec = 8 * total / bwEstimate;\n }\n if (data.details.live) {\n this.bwEstimator.update(config.abrEwmaSlowLive, config.abrEwmaFastLive);\n } else {\n this.bwEstimator.update(config.abrEwmaSlowVoD, config.abrEwmaFastVoD);\n }\n }\n\n /*\n This method monitors the download rate of the current fragment, and will downswitch if that fragment will not load\n quickly enough to prevent underbuffering\n */;\n _proto._abandonRulesCheck = function _abandonRulesCheck() {\n var frag = this.fragCurrent,\n part = this.partCurrent,\n hls = this.hls;\n var autoLevelEnabled = hls.autoLevelEnabled,\n media = hls.media;\n if (!frag || !media) {\n return;\n }\n var now = performance.now();\n var stats = part ? part.stats : frag.stats;\n var duration = part ? part.duration : frag.duration;\n var timeLoading = now - stats.loading.start;\n // If frag loading is aborted, complete, or from lowest level, stop timer and return\n if (stats.aborted || stats.loaded && stats.loaded === stats.total || frag.level === 0) {\n this.clearTimer();\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n return;\n }\n\n // This check only runs if we're in ABR mode and actually playing\n if (!autoLevelEnabled || media.paused || !media.playbackRate || !media.readyState) {\n return;\n }\n var bufferInfo = hls.mainForwardBufferInfo;\n if (bufferInfo === null) {\n return;\n }\n var ttfbEstimate = this.bwEstimator.getEstimateTTFB();\n var playbackRate = Math.abs(media.playbackRate);\n // To maintain stable adaptive playback, only begin monitoring frag loading after half or more of its playback duration has passed\n if (timeLoading <= Math.max(ttfbEstimate, 1000 * (duration / (playbackRate * 2)))) {\n return;\n }\n\n // bufferStarvationDelay is an estimate of the amount time (in seconds) it will take to exhaust the buffer\n var bufferStarvationDelay = bufferInfo.len / playbackRate;\n // Only downswitch if less than 2 fragment lengths are buffered\n if (bufferStarvationDelay >= 2 * duration / playbackRate) {\n return;\n }\n var ttfb = stats.loading.first ? stats.loading.first - stats.loading.start : -1;\n var loadedFirstByte = stats.loaded && ttfb > -1;\n var bwEstimate = this.bwEstimator.getEstimate();\n var levels = hls.levels,\n minAutoLevel = hls.minAutoLevel;\n var level = levels[frag.level];\n var expectedLen = stats.total || Math.max(stats.loaded, Math.round(duration * level.maxBitrate / 8));\n var timeStreaming = timeLoading - ttfb;\n if (timeStreaming < 1 && loadedFirstByte) {\n timeStreaming = Math.min(timeLoading, stats.loaded * 8 / bwEstimate);\n }\n var loadRate = loadedFirstByte ? stats.loaded * 1000 / timeStreaming : 0;\n // fragLoadDelay is an estimate of the time (in seconds) it will take to buffer the remainder of the fragment\n var fragLoadedDelay = loadRate ? (expectedLen - stats.loaded) / loadRate : expectedLen * 8 / bwEstimate + ttfbEstimate / 1000;\n // Only downswitch if the time to finish loading the current fragment is greater than the amount of buffer left\n if (fragLoadedDelay <= bufferStarvationDelay) {\n return;\n }\n var bwe = loadRate ? loadRate * 8 : bwEstimate;\n var fragLevelNextLoadedDelay = Number.POSITIVE_INFINITY;\n var nextLoadLevel;\n // Iterate through lower level and try to find the largest one that avoids rebuffering\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].maxBitrate;\n fragLevelNextLoadedDelay = this.getTimeToLoadFrag(ttfbEstimate / 1000, bwe, duration * levelNextBitrate, !levels[nextLoadLevel].details);\n if (fragLevelNextLoadedDelay < bufferStarvationDelay) {\n break;\n }\n }\n // Only emergency switch down if it takes less time to load a new fragment at lowest level instead of continuing\n // to load the current one\n if (fragLevelNextLoadedDelay >= fragLoadedDelay) {\n return;\n }\n\n // if estimated load time of new segment is completely unreasonable, ignore and do not emergency switch down\n if (fragLevelNextLoadedDelay > duration * 10) {\n return;\n }\n hls.nextLoadLevel = nextLoadLevel;\n if (loadedFirstByte) {\n // If there has been loading progress, sample bandwidth using loading time offset by minimum TTFB time\n this.bwEstimator.sample(timeLoading - Math.min(ttfbEstimate, ttfb), stats.loaded);\n } else {\n // If there has been no loading progress, sample TTFB\n this.bwEstimator.sampleTTFB(timeLoading);\n }\n this.clearTimer();\n logger.warn(\"[abr] Fragment \" + frag.sn + (part ? ' part ' + part.index : '') + \" of level \" + frag.level + \" is loading too slowly;\\n Time to underbuffer: \" + bufferStarvationDelay.toFixed(3) + \" s\\n Estimated load time for current fragment: \" + fragLoadedDelay.toFixed(3) + \" s\\n Estimated load time for down switch fragment: \" + fragLevelNextLoadedDelay.toFixed(3) + \" s\\n TTFB estimate: \" + ttfb + \"\\n Current BW estimate: \" + (isFiniteNumber(bwEstimate) ? (bwEstimate / 1024).toFixed(3) : 'Unknown') + \" Kb/s\\n New BW estimate: \" + (this.bwEstimator.getEstimate() / 1024).toFixed(3) + \" Kb/s\\n Aborting and switching to level \" + nextLoadLevel);\n if (frag.loader) {\n this.fragCurrent = this.partCurrent = null;\n frag.abortRequests();\n }\n hls.trigger(Events.FRAG_LOAD_EMERGENCY_ABORTED, {\n frag: frag,\n part: part,\n stats: stats\n });\n };\n _proto.onFragLoaded = function onFragLoaded(event, _ref) {\n var frag = _ref.frag,\n part = _ref.part;\n var stats = part ? part.stats : frag.stats;\n if (frag.type === PlaylistLevelType.MAIN) {\n this.bwEstimator.sampleTTFB(stats.loading.first - stats.loading.start);\n }\n if (this.ignoreFragment(frag)) {\n return;\n }\n // stop monitoring bw once frag loaded\n this.clearTimer();\n // store level id after successful fragment load\n this.lastLoadedFragLevel = frag.level;\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n\n // compute level average bitrate\n if (this.hls.config.abrMaxWithRealBitrate) {\n var duration = part ? part.duration : frag.duration;\n var level = this.hls.levels[frag.level];\n var loadedBytes = (level.loaded ? level.loaded.bytes : 0) + stats.loaded;\n var loadedDuration = (level.loaded ? level.loaded.duration : 0) + duration;\n level.loaded = {\n bytes: loadedBytes,\n duration: loadedDuration\n };\n level.realBitrate = Math.round(8 * loadedBytes / loadedDuration);\n }\n if (frag.bitrateTest) {\n var fragBufferedData = {\n stats: stats,\n frag: frag,\n part: part,\n id: frag.type\n };\n this.onFragBuffered(Events.FRAG_BUFFERED, fragBufferedData);\n frag.bitrateTest = false;\n }\n };\n _proto.onFragBuffered = function onFragBuffered(event, data) {\n var frag = data.frag,\n part = data.part;\n var stats = part != null && part.stats.loaded ? part.stats : frag.stats;\n if (stats.aborted) {\n return;\n }\n if (this.ignoreFragment(frag)) {\n return;\n }\n // Use the difference between parsing and request instead of buffering and request to compute fragLoadingProcessing;\n // rationale is that buffer appending only happens once media is attached. This can happen when config.startFragPrefetch\n // is used. If we used buffering in that case, our BW estimate sample will be very large.\n var processingMs = stats.parsing.end - stats.loading.start - Math.min(stats.loading.first - stats.loading.start, this.bwEstimator.getEstimateTTFB());\n this.bwEstimator.sample(processingMs, stats.loaded);\n stats.bwEstimate = this.bwEstimator.getEstimate();\n if (frag.bitrateTest) {\n this.bitrateTestDelay = processingMs / 1000;\n } else {\n this.bitrateTestDelay = 0;\n }\n };\n _proto.ignoreFragment = function ignoreFragment(frag) {\n // Only count non-alt-audio frags which were actually buffered in our BW calculations\n return frag.type !== PlaylistLevelType.MAIN || frag.sn === 'initSegment';\n };\n _proto.clearTimer = function clearTimer() {\n self.clearInterval(this.timer);\n }\n\n // return next auto level\n ;\n _proto.getNextABRAutoLevel = function getNextABRAutoLevel() {\n var fragCurrent = this.fragCurrent,\n partCurrent = this.partCurrent,\n hls = this.hls;\n var maxAutoLevel = hls.maxAutoLevel,\n config = hls.config,\n minAutoLevel = hls.minAutoLevel,\n media = hls.media;\n var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;\n\n // playbackRate is the absolute value of the playback rate; if media.playbackRate is 0, we use 1 to load as\n // if we're playing back at the normal rate.\n var playbackRate = media && media.playbackRate !== 0 ? Math.abs(media.playbackRate) : 1.0;\n var avgbw = this.bwEstimator ? this.bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate;\n // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n var bufferInfo = hls.mainForwardBufferInfo;\n var bufferStarvationDelay = (bufferInfo ? bufferInfo.len : 0) / playbackRate;\n\n // First, look to see if we can find a level matching with our avg bandwidth AND that could also guarantee no rebuffering at all\n var bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, config.abrBandWidthFactor, config.abrBandWidthUpFactor);\n if (bestLevel >= 0) {\n return bestLevel;\n }\n logger.trace(\"[abr] \" + (bufferStarvationDelay ? 'rebuffering expected' : 'buffer is empty') + \", finding optimal quality level\");\n // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay;\n var bwFactor = config.abrBandWidthFactor;\n var bwUpFactor = config.abrBandWidthUpFactor;\n if (!bufferStarvationDelay) {\n // in case buffer is empty, let's check if previous fragment was loaded to perform a bitrate test\n var bitrateTestDelay = this.bitrateTestDelay;\n if (bitrateTestDelay) {\n // if it is the case, then we need to adjust our max starvation delay using maxLoadingDelay config value\n // max video loading delay used in automatic start level selection :\n // in that mode ABR controller will ensure that video loading time (ie the time to fetch the first fragment at lowest quality level +\n // the time to fetch the fragment at the appropriate quality level is less than ```maxLoadingDelay``` )\n // cap maxLoadingDelay and ensure it is not bigger 'than bitrate test' frag duration\n var maxLoadingDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxLoadingDelay) : config.maxLoadingDelay;\n maxStarvationDelay = maxLoadingDelay - bitrateTestDelay;\n logger.trace(\"[abr] bitrate test took \" + Math.round(1000 * bitrateTestDelay) + \"ms, set first fragment max fetchDuration to \" + Math.round(1000 * maxStarvationDelay) + \" ms\");\n // don't use conservative factor on bitrate test\n bwFactor = bwUpFactor = 1;\n }\n }\n bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor);\n return Math.max(bestLevel, 0);\n };\n _proto.findBestLevel = function findBestLevel(currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor) {\n var _level$details;\n var fragCurrent = this.fragCurrent,\n partCurrent = this.partCurrent,\n currentLevel = this.lastLoadedFragLevel;\n var levels = this.hls.levels;\n var level = levels[currentLevel];\n var live = !!(level != null && (_level$details = level.details) != null && _level$details.live);\n var currentCodecSet = level == null ? void 0 : level.codecSet;\n var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;\n var ttfbEstimateSec = this.bwEstimator.getEstimateTTFB() / 1000;\n var levelSkippedMin = minAutoLevel;\n var levelSkippedMax = -1;\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i];\n if (!levelInfo || currentCodecSet && levelInfo.codecSet !== currentCodecSet) {\n if (levelInfo) {\n levelSkippedMin = Math.min(i, levelSkippedMin);\n levelSkippedMax = Math.max(i, levelSkippedMax);\n }\n continue;\n }\n if (levelSkippedMax !== -1) {\n logger.trace(\"[abr] Skipped level(s) \" + levelSkippedMin + \"-\" + levelSkippedMax + \" with CODECS:\\\"\" + levels[levelSkippedMax].attrs.CODECS + \"\\\"; not compatible with \\\"\" + level.attrs.CODECS + \"\\\"\");\n }\n var levelDetails = levelInfo.details;\n var avgDuration = (partCurrent ? levelDetails == null ? void 0 : levelDetails.partTarget : levelDetails == null ? void 0 : levelDetails.averagetargetduration) || currentFragDuration;\n var adjustedbw = void 0;\n // follow algorithm captured from stagefright :\n // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp\n // Pick the highest bandwidth stream below or equal to estimated bandwidth.\n // consider only 80% of the available bandwidth, but if we are switching up,\n // be even more conservative (70%) to avoid overestimating and immediately\n // switching back.\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n var bitrate = levels[i].maxBitrate;\n var fetchDuration = this.getTimeToLoadFrag(ttfbEstimateSec, adjustedbw, bitrate * avgDuration, levelDetails === undefined);\n logger.trace(\"[abr] level:\" + i + \" adjustedbw-bitrate:\" + Math.round(adjustedbw - bitrate) + \" avgDuration:\" + avgDuration.toFixed(1) + \" maxFetchDuration:\" + maxFetchDuration.toFixed(1) + \" fetchDuration:\" + fetchDuration.toFixed(1));\n // if adjusted bw is greater than level bitrate AND\n if (adjustedbw > bitrate && (\n // fragment fetchDuration unknown OR live stream OR fragment fetchDuration less than max allowed fetch duration, then this level matches\n // we don't account for max Fetch Duration for live streams, this is to avoid switching down when near the edge of live sliding window ...\n // special case to support startLevel = -1 (bitrateTest) on live streams : in that case we should not exit loop so that findBestLevel will return -1\n fetchDuration === 0 || !isFiniteNumber(fetchDuration) || live && !this.bitrateTestDelay || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n }\n // not enough time budget even with quality level 0 ... rebuffering might happen\n return -1;\n };\n _createClass(AbrController, [{\n key: \"nextAutoLevel\",\n get: function get() {\n var forcedAutoLevel = this._nextAutoLevel;\n var bwEstimator = this.bwEstimator;\n // in case next auto level has been forced, and bw not available or not reliable, return forced value\n if (forcedAutoLevel !== -1 && !bwEstimator.canEstimate()) {\n return forcedAutoLevel;\n }\n\n // compute next level using ABR logic\n var nextABRAutoLevel = this.getNextABRAutoLevel();\n // use forced auto level when ABR selected level has errored\n if (forcedAutoLevel !== -1) {\n var levels = this.hls.levels;\n if (levels.length > Math.max(forcedAutoLevel, nextABRAutoLevel) && levels[forcedAutoLevel].loadError <= levels[nextABRAutoLevel].loadError) {\n return forcedAutoLevel;\n }\n }\n // if forced auto level has been defined, use it to cap ABR computed quality level\n if (forcedAutoLevel !== -1) {\n nextABRAutoLevel = Math.min(forcedAutoLevel, nextABRAutoLevel);\n }\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n }]);\n return AbrController;\n }();\n\n var BufferOperationQueue = /*#__PURE__*/function () {\n function BufferOperationQueue(sourceBufferReference) {\n this.buffers = void 0;\n this.queues = {\n video: [],\n audio: [],\n audiovideo: []\n };\n this.buffers = sourceBufferReference;\n }\n var _proto = BufferOperationQueue.prototype;\n _proto.append = function append(operation, type) {\n var queue = this.queues[type];\n queue.push(operation);\n if (queue.length === 1 && this.buffers[type]) {\n this.executeNext(type);\n }\n };\n _proto.insertAbort = function insertAbort(operation, type) {\n var queue = this.queues[type];\n queue.unshift(operation);\n this.executeNext(type);\n };\n _proto.appendBlocker = function appendBlocker(type) {\n var execute;\n var promise = new Promise(function (resolve) {\n execute = resolve;\n });\n var operation = {\n execute: execute,\n onStart: function onStart() {},\n onComplete: function onComplete() {},\n onError: function onError() {}\n };\n this.append(operation, type);\n return promise;\n };\n _proto.executeNext = function executeNext(type) {\n var buffers = this.buffers,\n queues = this.queues;\n var sb = buffers[type];\n var queue = queues[type];\n if (queue.length) {\n var operation = queue[0];\n try {\n // Operations are expected to result in an 'updateend' event being fired. If not, the queue will lock. Operations\n // which do not end with this event must call _onSBUpdateEnd manually\n operation.execute();\n } catch (e) {\n logger.warn('[buffer-operation-queue]: Unhandled exception executing the current operation');\n operation.onError(e);\n\n // Only shift the current operation off, otherwise the updateend handler will do this for us\n if (!(sb != null && sb.updating)) {\n queue.shift();\n this.executeNext(type);\n }\n }\n }\n };\n _proto.shiftAndExecuteNext = function shiftAndExecuteNext(type) {\n this.queues[type].shift();\n this.executeNext(type);\n };\n _proto.current = function current(type) {\n return this.queues[type][0];\n };\n return BufferOperationQueue;\n }();\n\n var MediaSource = getMediaSource();\n var VIDEO_CODEC_PROFILE_REPACE = /([ha]vc.)(?:\\.[^.,]+)+/;\n var BufferController = /*#__PURE__*/function () {\n // The level details used to determine duration, target-duration and live\n\n // cache the self generated object url to detect hijack of video tag\n\n // A queue of buffer operations which require the SourceBuffer to not be updating upon execution\n\n // References to event listeners for each SourceBuffer, so that they can be referenced for event removal\n\n // The number of BUFFER_CODEC events received before any sourceBuffers are created\n\n // The total number of BUFFER_CODEC events received\n\n // A reference to the attached media element\n\n // A reference to the active media source\n\n // Last MP3 audio chunk appended\n\n // counters\n\n function BufferController(hls) {\n var _this = this;\n this.details = null;\n this._objectUrl = null;\n this.operationQueue = void 0;\n this.listeners = void 0;\n this.hls = void 0;\n this.bufferCodecEventsExpected = 0;\n this._bufferCodecEventsTotal = 0;\n this.media = null;\n this.mediaSource = null;\n this.lastMpegAudioChunk = null;\n this.appendError = 0;\n this.tracks = {};\n this.pendingTracks = {};\n this.sourceBuffer = void 0;\n // Keep as arrow functions so that we can directly reference these functions directly as event listeners\n this._onMediaSourceOpen = function () {\n var media = _this.media,\n mediaSource = _this.mediaSource;\n logger.log('[buffer-controller]: Media source opened');\n if (media) {\n media.removeEventListener('emptied', _this._onMediaEmptied);\n _this.updateMediaElementDuration();\n _this.hls.trigger(Events.MEDIA_ATTACHED, {\n media: media\n });\n }\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', _this._onMediaSourceOpen);\n }\n _this.checkPendingTracks();\n };\n this._onMediaSourceClose = function () {\n logger.log('[buffer-controller]: Media source closed');\n };\n this._onMediaSourceEnded = function () {\n logger.log('[buffer-controller]: Media source ended');\n };\n this._onMediaEmptied = function () {\n var media = _this.media,\n _objectUrl = _this._objectUrl;\n if (media && media.src !== _objectUrl) {\n logger.error(\"Media element src was set while attaching MediaSource (\" + _objectUrl + \" > \" + media.src + \")\");\n }\n };\n this.hls = hls;\n this._initSourceBuffer();\n this.registerListeners();\n }\n var _proto = BufferController.prototype;\n _proto.hasSourceTypes = function hasSourceTypes() {\n return this.getSourceBufferTypes().length > 0 || Object.keys(this.pendingTracks).length > 0;\n };\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n this.details = null;\n this.lastMpegAudioChunk = null;\n };\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.on(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.on(Events.BUFFER_RESET, this.onBufferReset, this);\n hls.on(Events.BUFFER_APPENDING, this.onBufferAppending, this);\n hls.on(Events.BUFFER_CODECS, this.onBufferCodecs, this);\n hls.on(Events.BUFFER_EOS, this.onBufferEos, this);\n hls.on(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);\n hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n hls.on(Events.FRAG_PARSED, this.onFragParsed, this);\n hls.on(Events.FRAG_CHANGED, this.onFragChanged, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.off(Events.BUFFER_RESET, this.onBufferReset, this);\n hls.off(Events.BUFFER_APPENDING, this.onBufferAppending, this);\n hls.off(Events.BUFFER_CODECS, this.onBufferCodecs, this);\n hls.off(Events.BUFFER_EOS, this.onBufferEos, this);\n hls.off(Events.BUFFER_FLUSHING, this.onBufferFlushing, this);\n hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);\n hls.off(Events.FRAG_PARSED, this.onFragParsed, this);\n hls.off(Events.FRAG_CHANGED, this.onFragChanged, this);\n };\n _proto._initSourceBuffer = function _initSourceBuffer() {\n this.sourceBuffer = {};\n this.operationQueue = new BufferOperationQueue(this.sourceBuffer);\n this.listeners = {\n audio: [],\n video: [],\n audiovideo: []\n };\n this.lastMpegAudioChunk = null;\n };\n _proto.onManifestLoading = function onManifestLoading() {\n this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = 0;\n this.details = null;\n };\n _proto.onManifestParsed = function onManifestParsed(event, data) {\n // in case of alt audio 2 BUFFER_CODECS events will be triggered, one per stream controller\n // sourcebuffers will be created all at once when the expected nb of tracks will be reached\n // in case alt audio is not used, only one BUFFER_CODEC event will be fired from main stream controller\n // it will contain the expected nb of source buffers, no need to compute it\n var codecEvents = 2;\n if (data.audio && !data.video || !data.altAudio || !false) {\n codecEvents = 1;\n }\n this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = codecEvents;\n logger.log(this.bufferCodecEventsExpected + \" bufferCodec event(s) expected\");\n };\n _proto.onMediaAttaching = function onMediaAttaching(event, data) {\n var media = this.media = data.media;\n if (media && MediaSource) {\n var ms = this.mediaSource = new MediaSource();\n // MediaSource listeners are arrow functions with a lexical scope, and do not need to be bound\n ms.addEventListener('sourceopen', this._onMediaSourceOpen);\n ms.addEventListener('sourceended', this._onMediaSourceEnded);\n ms.addEventListener('sourceclose', this._onMediaSourceClose);\n // link video and media Source\n media.src = self.URL.createObjectURL(ms);\n // cache the locally generated object url\n this._objectUrl = media.src;\n media.addEventListener('emptied', this._onMediaEmptied);\n }\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media,\n mediaSource = this.mediaSource,\n _objectUrl = this._objectUrl;\n if (mediaSource) {\n logger.log('[buffer-controller]: media source detaching');\n if (mediaSource.readyState === 'open') {\n try {\n // endOfStream could trigger exception if any sourcebuffer is in updating state\n // we don't really care about checking sourcebuffer state here,\n // as we are anyway detaching the MediaSource\n // let's just avoid this exception to propagate\n mediaSource.endOfStream();\n } catch (err) {\n logger.warn(\"[buffer-controller]: onMediaDetaching: \" + err.message + \" while calling endOfStream\");\n }\n }\n // Clean up the SourceBuffers by invoking onBufferReset\n this.onBufferReset();\n mediaSource.removeEventListener('sourceopen', this._onMediaSourceOpen);\n mediaSource.removeEventListener('sourceended', this._onMediaSourceEnded);\n mediaSource.removeEventListener('sourceclose', this._onMediaSourceClose);\n\n // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n if (media) {\n media.removeEventListener('emptied', this._onMediaEmptied);\n if (_objectUrl) {\n self.URL.revokeObjectURL(_objectUrl);\n }\n\n // clean up video tag src only if it's our own url. some external libraries might\n // hijack the video tag and change its 'src' without destroying the Hls instance first\n if (media.src === _objectUrl) {\n media.removeAttribute('src');\n media.load();\n } else {\n logger.warn('[buffer-controller]: media.src was changed by a third party - skip cleanup');\n }\n }\n this.mediaSource = null;\n this.media = null;\n this._objectUrl = null;\n this.bufferCodecEventsExpected = this._bufferCodecEventsTotal;\n this.pendingTracks = {};\n this.tracks = {};\n }\n this.hls.trigger(Events.MEDIA_DETACHED, undefined);\n };\n _proto.onBufferReset = function onBufferReset() {\n var _this2 = this;\n this.getSourceBufferTypes().forEach(function (type) {\n var sb = _this2.sourceBuffer[type];\n try {\n if (sb) {\n _this2.removeBufferListeners(type);\n if (_this2.mediaSource) {\n _this2.mediaSource.removeSourceBuffer(sb);\n }\n // Synchronously remove the SB from the map before the next call in order to prevent an async function from\n // accessing it\n _this2.sourceBuffer[type] = undefined;\n }\n } catch (err) {\n logger.warn(\"[buffer-controller]: Failed to reset the \" + type + \" buffer\", err);\n }\n });\n this._initSourceBuffer();\n };\n _proto.onBufferCodecs = function onBufferCodecs(event, data) {\n var _this3 = this;\n var sourceBufferCount = this.getSourceBufferTypes().length;\n Object.keys(data).forEach(function (trackName) {\n if (sourceBufferCount) {\n // check if SourceBuffer codec needs to change\n var track = _this3.tracks[trackName];\n if (track && typeof track.buffer.changeType === 'function') {\n var _data$trackName = data[trackName],\n id = _data$trackName.id,\n codec = _data$trackName.codec,\n levelCodec = _data$trackName.levelCodec,\n container = _data$trackName.container,\n metadata = _data$trackName.metadata;\n var currentCodec = (track.levelCodec || track.codec).replace(VIDEO_CODEC_PROFILE_REPACE, '$1');\n var nextCodec = (levelCodec || codec).replace(VIDEO_CODEC_PROFILE_REPACE, '$1');\n if (currentCodec !== nextCodec) {\n var mimeType = container + \";codecs=\" + (levelCodec || codec);\n _this3.appendChangeType(trackName, mimeType);\n logger.log(\"[buffer-controller]: switching codec \" + currentCodec + \" to \" + nextCodec);\n _this3.tracks[trackName] = {\n buffer: track.buffer,\n codec: codec,\n container: container,\n levelCodec: levelCodec,\n metadata: metadata,\n id: id\n };\n }\n }\n } else {\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n _this3.pendingTracks[trackName] = data[trackName];\n }\n });\n\n // if sourcebuffers already created, do nothing ...\n if (sourceBufferCount) {\n return;\n }\n this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0);\n if (this.mediaSource && this.mediaSource.readyState === 'open') {\n this.checkPendingTracks();\n }\n };\n _proto.appendChangeType = function appendChangeType(type, mimeType) {\n var _this4 = this;\n var operationQueue = this.operationQueue;\n var operation = {\n execute: function execute() {\n var sb = _this4.sourceBuffer[type];\n if (sb) {\n logger.log(\"[buffer-controller]: changing \" + type + \" sourceBuffer type to \" + mimeType);\n sb.changeType(mimeType);\n }\n operationQueue.shiftAndExecuteNext(type);\n },\n onStart: function onStart() {},\n onComplete: function onComplete() {},\n onError: function onError(e) {\n logger.warn(\"[buffer-controller]: Failed to change \" + type + \" SourceBuffer type\", e);\n }\n };\n operationQueue.append(operation, type);\n };\n _proto.onBufferAppending = function onBufferAppending(event, eventData) {\n var _this5 = this;\n var hls = this.hls,\n operationQueue = this.operationQueue,\n tracks = this.tracks;\n var data = eventData.data,\n type = eventData.type,\n frag = eventData.frag,\n part = eventData.part,\n chunkMeta = eventData.chunkMeta;\n var chunkStats = chunkMeta.buffering[type];\n var bufferAppendingStart = self.performance.now();\n chunkStats.start = bufferAppendingStart;\n var fragBuffering = frag.stats.buffering;\n var partBuffering = part ? part.stats.buffering : null;\n if (fragBuffering.start === 0) {\n fragBuffering.start = bufferAppendingStart;\n }\n if (partBuffering && partBuffering.start === 0) {\n partBuffering.start = bufferAppendingStart;\n }\n\n // TODO: Only update timestampOffset when audio/mpeg fragment or part is not contiguous with previously appended\n // Adjusting `SourceBuffer.timestampOffset` (desired point in the timeline where the next frames should be appended)\n // in Chrome browser when we detect MPEG audio container and time delta between level PTS and `SourceBuffer.timestampOffset`\n // is greater than 100ms (this is enough to handle seek for VOD or level change for LIVE videos).\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n var audioTrack = tracks.audio;\n var checkTimestampOffset = false;\n if (type === 'audio' && (audioTrack == null ? void 0 : audioTrack.container) === 'audio/mpeg') {\n checkTimestampOffset = !this.lastMpegAudioChunk || chunkMeta.id === 1 || this.lastMpegAudioChunk.sn !== chunkMeta.sn;\n this.lastMpegAudioChunk = chunkMeta;\n }\n var fragStart = frag.start;\n var operation = {\n execute: function execute() {\n chunkStats.executeStart = self.performance.now();\n if (checkTimestampOffset) {\n var sb = _this5.sourceBuffer[type];\n if (sb) {\n var delta = fragStart - sb.timestampOffset;\n if (Math.abs(delta) >= 0.1) {\n logger.log(\"[buffer-controller]: Updating audio SourceBuffer timestampOffset to \" + fragStart + \" (delta: \" + delta + \") sn: \" + frag.sn + \")\");\n sb.timestampOffset = fragStart;\n }\n }\n }\n _this5.appendExecutor(data, type);\n },\n onStart: function onStart() {\n // logger.debug(`[buffer-controller]: ${type} SourceBuffer updatestart`);\n },\n onComplete: function onComplete() {\n // logger.debug(`[buffer-controller]: ${type} SourceBuffer updateend`);\n var end = self.performance.now();\n chunkStats.executeEnd = chunkStats.end = end;\n if (fragBuffering.first === 0) {\n fragBuffering.first = end;\n }\n if (partBuffering && partBuffering.first === 0) {\n partBuffering.first = end;\n }\n var sourceBuffer = _this5.sourceBuffer;\n var timeRanges = {};\n for (var _type in sourceBuffer) {\n timeRanges[_type] = BufferHelper.getBuffered(sourceBuffer[_type]);\n }\n _this5.appendError = 0;\n _this5.hls.trigger(Events.BUFFER_APPENDED, {\n type: type,\n frag: frag,\n part: part,\n chunkMeta: chunkMeta,\n parent: frag.type,\n timeRanges: timeRanges\n });\n },\n onError: function onError(err) {\n // in case any error occured while appending, put back segment in segments table\n logger.error(\"[buffer-controller]: Error encountered while trying to append to the \" + type + \" SourceBuffer\", err);\n var event = {\n type: ErrorTypes.MEDIA_ERROR,\n parent: frag.type,\n details: ErrorDetails.BUFFER_APPEND_ERROR,\n frag: frag,\n part: part,\n chunkMeta: chunkMeta,\n error: err,\n err: err,\n fatal: false\n };\n if (err.code === DOMException.QUOTA_EXCEEDED_ERR) {\n // QuotaExceededError: http://www.w3.org/TR/html5/infrastructure.html#quotaexceedederror\n // let's stop appending any segments, and report BUFFER_FULL_ERROR error\n event.details = ErrorDetails.BUFFER_FULL_ERROR;\n } else {\n _this5.appendError++;\n event.details = ErrorDetails.BUFFER_APPEND_ERROR;\n /* with UHD content, we could get loop of quota exceeded error until\n browser is able to evict some data from sourcebuffer. Retrying can help recover.\n */\n if (_this5.appendError > hls.config.appendErrorMaxRetry) {\n logger.error(\"[buffer-controller]: Failed \" + hls.config.appendErrorMaxRetry + \" times to append segment in sourceBuffer\");\n event.fatal = true;\n }\n }\n hls.trigger(Events.ERROR, event);\n }\n };\n operationQueue.append(operation, type);\n };\n _proto.onBufferFlushing = function onBufferFlushing(event, data) {\n var _this6 = this;\n var operationQueue = this.operationQueue;\n var flushOperation = function flushOperation(type) {\n return {\n execute: _this6.removeExecutor.bind(_this6, type, data.startOffset, data.endOffset),\n onStart: function onStart() {\n // logger.debug(`[buffer-controller]: Started flushing ${data.startOffset} -> ${data.endOffset} for ${type} Source Buffer`);\n },\n onComplete: function onComplete() {\n // logger.debug(`[buffer-controller]: Finished flushing ${data.startOffset} -> ${data.endOffset} for ${type} Source Buffer`);\n _this6.hls.trigger(Events.BUFFER_FLUSHED, {\n type: type\n });\n },\n onError: function onError(e) {\n logger.warn(\"[buffer-controller]: Failed to remove from \" + type + \" SourceBuffer\", e);\n }\n };\n };\n if (data.type) {\n operationQueue.append(flushOperation(data.type), data.type);\n } else {\n this.getSourceBufferTypes().forEach(function (type) {\n operationQueue.append(flushOperation(type), type);\n });\n }\n };\n _proto.onFragParsed = function onFragParsed(event, data) {\n var _this7 = this;\n var frag = data.frag,\n part = data.part;\n var buffersAppendedTo = [];\n var elementaryStreams = part ? part.elementaryStreams : frag.elementaryStreams;\n if (elementaryStreams[ElementaryStreamTypes.AUDIOVIDEO]) {\n buffersAppendedTo.push('audiovideo');\n } else {\n if (elementaryStreams[ElementaryStreamTypes.AUDIO]) {\n buffersAppendedTo.push('audio');\n }\n if (elementaryStreams[ElementaryStreamTypes.VIDEO]) {\n buffersAppendedTo.push('video');\n }\n }\n var onUnblocked = function onUnblocked() {\n var now = self.performance.now();\n frag.stats.buffering.end = now;\n if (part) {\n part.stats.buffering.end = now;\n }\n var stats = part ? part.stats : frag.stats;\n _this7.hls.trigger(Events.FRAG_BUFFERED, {\n frag: frag,\n part: part,\n stats: stats,\n id: frag.type\n });\n };\n if (buffersAppendedTo.length === 0) {\n logger.warn(\"Fragments must have at least one ElementaryStreamType set. type: \" + frag.type + \" level: \" + frag.level + \" sn: \" + frag.sn);\n }\n this.blockBuffers(onUnblocked, buffersAppendedTo);\n };\n _proto.onFragChanged = function onFragChanged(event, data) {\n this.flushBackBuffer();\n }\n\n // on BUFFER_EOS mark matching sourcebuffer(s) as ended and trigger checkEos()\n // an undefined data.type will mark all buffers as EOS.\n ;\n _proto.onBufferEos = function onBufferEos(event, data) {\n var _this8 = this;\n var ended = this.getSourceBufferTypes().reduce(function (acc, type) {\n var sb = _this8.sourceBuffer[type];\n if (sb && (!data.type || data.type === type)) {\n sb.ending = true;\n if (!sb.ended) {\n sb.ended = true;\n logger.log(\"[buffer-controller]: \" + type + \" sourceBuffer now EOS\");\n }\n }\n return acc && !!(!sb || sb.ended);\n }, true);\n if (ended) {\n logger.log(\"[buffer-controller]: Queueing mediaSource.endOfStream()\");\n this.blockBuffers(function () {\n _this8.getSourceBufferTypes().forEach(function (type) {\n var sb = _this8.sourceBuffer[type];\n if (sb) {\n sb.ending = false;\n }\n });\n var mediaSource = _this8.mediaSource;\n if (!mediaSource || mediaSource.readyState !== 'open') {\n if (mediaSource) {\n logger.info(\"[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: \" + mediaSource.readyState);\n }\n return;\n }\n logger.log(\"[buffer-controller]: Calling mediaSource.endOfStream()\");\n // Allow this to throw and be caught by the enqueueing function\n mediaSource.endOfStream();\n });\n }\n };\n _proto.onLevelUpdated = function onLevelUpdated(event, _ref) {\n var details = _ref.details;\n if (!details.fragments.length) {\n return;\n }\n this.details = details;\n if (this.getSourceBufferTypes().length) {\n this.blockBuffers(this.updateMediaElementDuration.bind(this));\n } else {\n this.updateMediaElementDuration();\n }\n };\n _proto.flushBackBuffer = function flushBackBuffer() {\n var hls = this.hls,\n details = this.details,\n media = this.media,\n sourceBuffer = this.sourceBuffer;\n if (!media || details === null) {\n return;\n }\n var sourceBufferTypes = this.getSourceBufferTypes();\n if (!sourceBufferTypes.length) {\n return;\n }\n\n // Support for deprecated liveBackBufferLength\n var backBufferLength = details.live && hls.config.liveBackBufferLength !== null ? hls.config.liveBackBufferLength : hls.config.backBufferLength;\n if (!isFiniteNumber(backBufferLength) || backBufferLength < 0) {\n return;\n }\n var currentTime = media.currentTime;\n var targetDuration = details.levelTargetDuration;\n var maxBackBufferLength = Math.max(backBufferLength, targetDuration);\n var targetBackBufferPosition = Math.floor(currentTime / targetDuration) * targetDuration - maxBackBufferLength;\n sourceBufferTypes.forEach(function (type) {\n var sb = sourceBuffer[type];\n if (sb) {\n var buffered = BufferHelper.getBuffered(sb);\n // when target buffer start exceeds actual buffer start\n if (buffered.length > 0 && targetBackBufferPosition > buffered.start(0)) {\n hls.trigger(Events.BACK_BUFFER_REACHED, {\n bufferEnd: targetBackBufferPosition\n });\n\n // Support for deprecated event:\n if (details.live) {\n hls.trigger(Events.LIVE_BACK_BUFFER_REACHED, {\n bufferEnd: targetBackBufferPosition\n });\n } else if (sb.ended && buffered.end(buffered.length - 1) - currentTime < targetDuration * 2) {\n logger.info(\"[buffer-controller]: Cannot flush \" + type + \" back buffer while SourceBuffer is in ended state\");\n return;\n }\n hls.trigger(Events.BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: targetBackBufferPosition,\n type: type\n });\n }\n }\n });\n }\n\n /**\n * Update Media Source duration to current level duration or override to Infinity if configuration parameter\n * 'liveDurationInfinity` is set to `true`\n * More details: https://github.com/video-dev/hls.js/issues/355\n */;\n _proto.updateMediaElementDuration = function updateMediaElementDuration() {\n if (!this.details || !this.media || !this.mediaSource || this.mediaSource.readyState !== 'open') {\n return;\n }\n var details = this.details,\n hls = this.hls,\n media = this.media,\n mediaSource = this.mediaSource;\n var levelDuration = details.fragments[0].start + details.totalduration;\n var mediaDuration = media.duration;\n var msDuration = isFiniteNumber(mediaSource.duration) ? mediaSource.duration : 0;\n if (details.live && hls.config.liveDurationInfinity) {\n // Override duration to Infinity\n logger.log('[buffer-controller]: Media Source duration is set to Infinity');\n mediaSource.duration = Infinity;\n this.updateSeekableRange(details);\n } else if (levelDuration > msDuration && levelDuration > mediaDuration || !isFiniteNumber(mediaDuration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger.log(\"[buffer-controller]: Updating Media Source duration to \" + levelDuration.toFixed(3));\n mediaSource.duration = levelDuration;\n }\n };\n _proto.updateSeekableRange = function updateSeekableRange(levelDetails) {\n var mediaSource = this.mediaSource;\n var fragments = levelDetails.fragments;\n var len = fragments.length;\n if (len && levelDetails.live && mediaSource != null && mediaSource.setLiveSeekableRange) {\n var start = Math.max(0, fragments[0].start);\n var end = Math.max(start, start + levelDetails.totalduration);\n mediaSource.setLiveSeekableRange(start, end);\n }\n };\n _proto.checkPendingTracks = function checkPendingTracks() {\n var bufferCodecEventsExpected = this.bufferCodecEventsExpected,\n operationQueue = this.operationQueue,\n pendingTracks = this.pendingTracks;\n\n // Check if we've received all of the expected bufferCodec events. When none remain, create all the sourceBuffers at once.\n // This is important because the MSE spec allows implementations to throw QuotaExceededErrors if creating new sourceBuffers after\n // data has been appended to existing ones.\n // 2 tracks is the max (one for audio, one for video). If we've reach this max go ahead and create the buffers.\n var pendingTracksCount = Object.keys(pendingTracks).length;\n if (pendingTracksCount && !bufferCodecEventsExpected || pendingTracksCount === 2) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {};\n // append any pending segments now !\n var buffers = this.getSourceBufferTypes();\n if (buffers.length) {\n this.hls.trigger(Events.BUFFER_CREATED, {\n tracks: this.tracks\n });\n buffers.forEach(function (type) {\n operationQueue.executeNext(type);\n });\n } else {\n var error = new Error('could not create source buffer for media codec(s)');\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n error: error,\n reason: error.message\n });\n }\n }\n };\n _proto.createSourceBuffers = function createSourceBuffers(tracks) {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n if (!mediaSource) {\n throw Error('createSourceBuffers called when mediaSource was null');\n }\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n if (!track) {\n throw Error(\"source buffer exists for track \" + trackName + \", however track does not\");\n }\n // use levelCodec as first priority\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + \";codecs=\" + codec;\n logger.log(\"[buffer-controller]: creating sourceBuffer(\" + mimeType + \")\");\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n var sbName = trackName;\n this.addBufferListener(sbName, 'updatestart', this._onSBUpdateStart);\n this.addBufferListener(sbName, 'updateend', this._onSBUpdateEnd);\n this.addBufferListener(sbName, 'error', this._onSBUpdateError);\n this.tracks[trackName] = {\n buffer: sb,\n codec: codec,\n container: track.container,\n levelCodec: track.levelCodec,\n metadata: track.metadata,\n id: track.id\n };\n } catch (err) {\n logger.error(\"[buffer-controller]: error while trying to add sourceBuffer: \" + err.message);\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_ADD_CODEC_ERROR,\n fatal: false,\n error: err,\n mimeType: mimeType\n });\n }\n }\n }\n };\n _proto._onSBUpdateStart = function _onSBUpdateStart(type) {\n var operationQueue = this.operationQueue;\n var operation = operationQueue.current(type);\n operation.onStart();\n };\n _proto._onSBUpdateEnd = function _onSBUpdateEnd(type) {\n var operationQueue = this.operationQueue;\n var operation = operationQueue.current(type);\n operation.onComplete();\n operationQueue.shiftAndExecuteNext(type);\n };\n _proto._onSBUpdateError = function _onSBUpdateError(type, event) {\n var error = new Error(type + \" SourceBuffer error\");\n logger.error(\"[buffer-controller]: \" + error, event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // SourceBuffer errors are not necessarily fatal; if so, the HTMLMediaElement will fire an error event\n this.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_APPENDING_ERROR,\n error: error,\n fatal: false\n });\n // updateend is always fired after error, so we'll allow that to shift the current operation off of the queue\n var operation = this.operationQueue.current(type);\n if (operation) {\n operation.onError(event);\n }\n }\n\n // This method must result in an updateend event; if remove is not called, _onSBUpdateEnd must be called manually\n ;\n _proto.removeExecutor = function removeExecutor(type, startOffset, endOffset) {\n var media = this.media,\n mediaSource = this.mediaSource,\n operationQueue = this.operationQueue,\n sourceBuffer = this.sourceBuffer;\n var sb = sourceBuffer[type];\n if (!media || !mediaSource || !sb) {\n logger.warn(\"[buffer-controller]: Attempting to remove from the \" + type + \" SourceBuffer, but it does not exist\");\n operationQueue.shiftAndExecuteNext(type);\n return;\n }\n var mediaDuration = isFiniteNumber(media.duration) ? media.duration : Infinity;\n var msDuration = isFiniteNumber(mediaSource.duration) ? mediaSource.duration : Infinity;\n var removeStart = Math.max(0, startOffset);\n var removeEnd = Math.min(endOffset, mediaDuration, msDuration);\n if (removeEnd > removeStart && !sb.ending) {\n sb.ended = false;\n logger.log(\"[buffer-controller]: Removing [\" + removeStart + \",\" + removeEnd + \"] from the \" + type + \" SourceBuffer\");\n sb.remove(removeStart, removeEnd);\n } else {\n // Cycle the queue\n operationQueue.shiftAndExecuteNext(type);\n }\n }\n\n // This method must result in an updateend event; if append is not called, _onSBUpdateEnd must be called manually\n ;\n _proto.appendExecutor = function appendExecutor(data, type) {\n var operationQueue = this.operationQueue,\n sourceBuffer = this.sourceBuffer;\n var sb = sourceBuffer[type];\n if (!sb) {\n logger.warn(\"[buffer-controller]: Attempting to append to the \" + type + \" SourceBuffer, but it does not exist\");\n operationQueue.shiftAndExecuteNext(type);\n return;\n }\n sb.ended = false;\n sb.appendBuffer(data);\n }\n\n // Enqueues an operation to each SourceBuffer queue which, upon execution, resolves a promise. When all promises\n // resolve, the onUnblocked function is executed. Functions calling this method do not need to unblock the queue\n // upon completion, since we already do it here\n ;\n _proto.blockBuffers = function blockBuffers(onUnblocked, buffers) {\n var _this9 = this;\n if (buffers === void 0) {\n buffers = this.getSourceBufferTypes();\n }\n if (!buffers.length) {\n logger.log('[buffer-controller]: Blocking operation requested, but no SourceBuffers exist');\n Promise.resolve().then(onUnblocked);\n return;\n }\n var operationQueue = this.operationQueue;\n\n // logger.debug(`[buffer-controller]: Blocking ${buffers} SourceBuffer`);\n var blockingOperations = buffers.map(function (type) {\n return operationQueue.appendBlocker(type);\n });\n Promise.all(blockingOperations).then(function () {\n // logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);\n onUnblocked();\n buffers.forEach(function (type) {\n var sb = _this9.sourceBuffer[type];\n // Only cycle the queue if the SB is not updating. There's a bug in Chrome which sets the SB updating flag to\n // true when changing the MediaSource duration (https://bugs.chromium.org/p/chromium/issues/detail?id=959359&can=2&q=mediasource%20duration)\n // While this is a workaround, it's probably useful to have around\n if (!(sb != null && sb.updating)) {\n operationQueue.shiftAndExecuteNext(type);\n }\n });\n });\n };\n _proto.getSourceBufferTypes = function getSourceBufferTypes() {\n return Object.keys(this.sourceBuffer);\n };\n _proto.addBufferListener = function addBufferListener(type, event, fn) {\n var buffer = this.sourceBuffer[type];\n if (!buffer) {\n return;\n }\n var listener = fn.bind(this, type);\n this.listeners[type].push({\n event: event,\n listener: listener\n });\n buffer.addEventListener(event, listener);\n };\n _proto.removeBufferListeners = function removeBufferListeners(type) {\n var buffer = this.sourceBuffer[type];\n if (!buffer) {\n return;\n }\n this.listeners[type].forEach(function (l) {\n buffer.removeEventListener(l.event, l.listener);\n });\n };\n return BufferController;\n }();\n\n var CapLevelController = /*#__PURE__*/function () {\n function CapLevelController(hls) {\n this.hls = void 0;\n this.autoLevelCapping = void 0;\n this.firstLevel = void 0;\n this.media = void 0;\n this.restrictedLevels = void 0;\n this.timer = void 0;\n this.clientRect = void 0;\n this.streamController = void 0;\n this.hls = hls;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.firstLevel = -1;\n this.media = null;\n this.restrictedLevels = [];\n this.timer = undefined;\n this.clientRect = null;\n this.registerListeners();\n }\n var _proto = CapLevelController.prototype;\n _proto.setStreamController = function setStreamController(streamController) {\n this.streamController = streamController;\n };\n _proto.destroy = function destroy() {\n this.unregisterListener();\n if (this.hls.config.capLevelToPlayerSize) {\n this.stopCapping();\n }\n this.media = null;\n this.clientRect = null;\n // @ts-ignore\n this.hls = this.streamController = null;\n };\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this);\n hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n hls.on(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.on(Events.BUFFER_CODECS, this.onBufferCodecs, this);\n hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n };\n _proto.unregisterListener = function unregisterListener() {\n var hls = this.hls;\n hls.off(Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this);\n hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n hls.off(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.off(Events.BUFFER_CODECS, this.onBufferCodecs, this);\n hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);\n };\n _proto.onFpsDropLevelCapping = function onFpsDropLevelCapping(event, data) {\n // Don't add a restricted level more than once\n var level = this.hls.levels[data.droppedLevel];\n if (this.isLevelAllowed(level)) {\n this.restrictedLevels.push({\n bitrate: level.bitrate,\n height: level.height,\n width: level.width\n });\n }\n };\n _proto.onMediaAttaching = function onMediaAttaching(event, data) {\n this.media = data.media instanceof HTMLVideoElement ? data.media : null;\n this.clientRect = null;\n };\n _proto.onManifestParsed = function onManifestParsed(event, data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n this.firstLevel = data.firstLevel;\n if (hls.config.capLevelToPlayerSize && data.video) {\n // Start capping immediately if the manifest has signaled video codecs\n this.startCapping();\n }\n }\n\n // Only activate capping when playing a video stream; otherwise, multi-bitrate audio-only streams will be restricted\n // to the first level\n ;\n _proto.onBufferCodecs = function onBufferCodecs(event, data) {\n var hls = this.hls;\n if (hls.config.capLevelToPlayerSize && data.video) {\n // If the manifest did not signal a video codec capping has been deferred until we're certain video is present\n this.startCapping();\n }\n };\n _proto.onMediaDetaching = function onMediaDetaching() {\n this.stopCapping();\n };\n _proto.detectPlayerSize = function detectPlayerSize() {\n if (this.media && this.mediaHeight > 0 && this.mediaWidth > 0) {\n var levels = this.hls.levels;\n if (levels.length) {\n var hls = this.hls;\n hls.autoLevelCapping = this.getMaxLevel(levels.length - 1);\n if (hls.autoLevelCapping > this.autoLevelCapping && this.streamController) {\n // if auto level capping has a higher value for the previous one, flush the buffer using nextLevelSwitch\n // usually happen when the user go to the fullscreen mode.\n this.streamController.nextLevelSwitch();\n }\n this.autoLevelCapping = hls.autoLevelCapping;\n }\n }\n }\n\n /*\n * returns level should be the one with the dimensions equal or greater than the media (player) dimensions (so the video will be downscaled)\n */;\n _proto.getMaxLevel = function getMaxLevel(capLevelIndex) {\n var _this = this;\n var levels = this.hls.levels;\n if (!levels.length) {\n return -1;\n }\n var validLevels = levels.filter(function (level, index) {\n return _this.isLevelAllowed(level) && index <= capLevelIndex;\n });\n this.clientRect = null;\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\n _proto.startCapping = function startCapping() {\n if (this.timer) {\n // Don't reset capping if started twice; this can happen if the manifest signals a video codec\n return;\n }\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.hls.firstLevel = this.getMaxLevel(this.firstLevel);\n self.clearInterval(this.timer);\n this.timer = self.setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n };\n _proto.stopCapping = function stopCapping() {\n this.restrictedLevels = [];\n this.firstLevel = -1;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n self.clearInterval(this.timer);\n this.timer = undefined;\n }\n };\n _proto.getDimensions = function getDimensions() {\n if (this.clientRect) {\n return this.clientRect;\n }\n var media = this.media;\n var boundsRect = {\n width: 0,\n height: 0\n };\n if (media) {\n var clientRect = media.getBoundingClientRect();\n boundsRect.width = clientRect.width;\n boundsRect.height = clientRect.height;\n if (!boundsRect.width && !boundsRect.height) {\n // When the media element has no width or height (equivalent to not being in the DOM),\n // then use its width and height attributes (media.width, media.height)\n boundsRect.width = clientRect.right - clientRect.left || media.width || 0;\n boundsRect.height = clientRect.bottom - clientRect.top || media.height || 0;\n }\n }\n this.clientRect = boundsRect;\n return boundsRect;\n };\n _proto.isLevelAllowed = function isLevelAllowed(level) {\n var restrictedLevels = this.restrictedLevels;\n return !restrictedLevels.some(function (restrictedLevel) {\n return level.bitrate === restrictedLevel.bitrate && level.width === restrictedLevel.width && level.height === restrictedLevel.height;\n });\n };\n CapLevelController.getMaxLevelByMediaSize = function getMaxLevelByMediaSize(levels, width, height) {\n if (!(levels != null && levels.length)) {\n return -1;\n }\n\n // Levels can have the same dimensions but differing bandwidths - since levels are ordered, we can look to the next\n // to determine whether we've chosen the greatest bandwidth for the media's dimensions\n var atGreatestBandwidth = function atGreatestBandwidth(curLevel, nextLevel) {\n if (!nextLevel) {\n return true;\n }\n return curLevel.width !== nextLevel.width || curLevel.height !== nextLevel.height;\n };\n\n // If we run through the loop without breaking, the media's dimensions are greater than every level, so default to\n // the max level\n var maxLevelIndex = levels.length - 1;\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n if ((level.width >= width || level.height >= height) && atGreatestBandwidth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n return maxLevelIndex;\n };\n _createClass(CapLevelController, [{\n key: \"mediaWidth\",\n get: function get() {\n return this.getDimensions().width * this.contentScaleFactor;\n }\n }, {\n key: \"mediaHeight\",\n get: function get() {\n return this.getDimensions().height * this.contentScaleFactor;\n }\n }, {\n key: \"contentScaleFactor\",\n get: function get() {\n var pixelRatio = 1;\n if (!this.hls.config.ignoreDevicePixelRatio) {\n try {\n pixelRatio = self.devicePixelRatio;\n } catch (e) {\n /* no-op */\n }\n }\n return pixelRatio;\n }\n }]);\n return CapLevelController;\n }();\n\n var FPSController = /*#__PURE__*/function () {\n // stream controller must be provided as a dependency!\n\n function FPSController(hls) {\n this.hls = void 0;\n this.isVideoPlaybackQualityAvailable = false;\n this.timer = void 0;\n this.media = null;\n this.lastTime = void 0;\n this.lastDroppedFrames = 0;\n this.lastDecodedFrames = 0;\n this.streamController = void 0;\n this.hls = hls;\n this.registerListeners();\n }\n var _proto = FPSController.prototype;\n _proto.setStreamController = function setStreamController(streamController) {\n this.streamController = streamController;\n };\n _proto.registerListeners = function registerListeners() {\n this.hls.on(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n this.hls.off(Events.MEDIA_ATTACHING, this.onMediaAttaching, this);\n };\n _proto.destroy = function destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.unregisterListeners();\n this.isVideoPlaybackQualityAvailable = false;\n this.media = null;\n };\n _proto.onMediaAttaching = function onMediaAttaching(event, data) {\n var config = this.hls.config;\n if (config.capLevelOnFPSDrop) {\n var media = data.media instanceof self.HTMLVideoElement ? data.media : null;\n this.media = media;\n if (media && typeof media.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n self.clearInterval(this.timer);\n this.timer = self.setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n _proto.checkFPS = function checkFPS(video, decodedFrames, droppedFrames) {\n var currentTime = performance.now();\n if (decodedFrames) {\n if (this.lastTime) {\n var currentPeriod = currentTime - this.lastTime;\n var currentDropped = droppedFrames - this.lastDroppedFrames;\n var currentDecoded = decodedFrames - this.lastDecodedFrames;\n var droppedFPS = 1000 * currentDropped / currentPeriod;\n var hls = this.hls;\n hls.trigger(Events.FPS_DROP, {\n currentDropped: currentDropped,\n currentDecoded: currentDecoded,\n totalDroppedFrames: droppedFrames\n });\n if (droppedFPS > 0) {\n // logger.log('checkFPS : droppedFPS/decodedFPS:' + droppedFPS/(1000 * currentDecoded / currentPeriod));\n if (currentDropped > hls.config.fpsDroppedMonitoringThreshold * currentDecoded) {\n var currentLevel = hls.currentLevel;\n logger.warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);\n if (currentLevel > 0 && (hls.autoLevelCapping === -1 || hls.autoLevelCapping >= currentLevel)) {\n currentLevel = currentLevel - 1;\n hls.trigger(Events.FPS_DROP_LEVEL_CAPPING, {\n level: currentLevel,\n droppedLevel: hls.currentLevel\n });\n hls.autoLevelCapping = currentLevel;\n this.streamController.nextLevelSwitch();\n }\n }\n }\n }\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n _proto.checkFPSInterval = function checkFPSInterval() {\n var video = this.media;\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n } else {\n // HTMLVideoElement doesn't include the webkit types\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n return FPSController;\n }();\n\n var AGE_HEADER_LINE_REGEX = /^age:\\s*[\\d.]+\\s*$/im;\n var XhrLoader = /*#__PURE__*/function () {\n function XhrLoader(config) {\n this.xhrSetup = void 0;\n this.requestTimeout = void 0;\n this.retryTimeout = void 0;\n this.retryDelay = void 0;\n this.config = null;\n this.callbacks = null;\n this.context = void 0;\n this.loader = null;\n this.stats = void 0;\n this.xhrSetup = config ? config.xhrSetup || null : null;\n this.stats = new LoadStats();\n this.retryDelay = 0;\n }\n var _proto = XhrLoader.prototype;\n _proto.destroy = function destroy() {\n this.callbacks = null;\n this.abortInternal();\n this.loader = null;\n this.config = null;\n };\n _proto.abortInternal = function abortInternal() {\n var loader = this.loader;\n self.clearTimeout(this.requestTimeout);\n self.clearTimeout(this.retryTimeout);\n if (loader) {\n loader.onreadystatechange = null;\n loader.onprogress = null;\n if (loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n }\n };\n _proto.abort = function abort() {\n var _this$callbacks;\n this.abortInternal();\n if ((_this$callbacks = this.callbacks) != null && _this$callbacks.onAbort) {\n this.callbacks.onAbort(this.stats, this.context, this.loader);\n }\n };\n _proto.load = function load(context, config, callbacks) {\n if (this.stats.loading.start) {\n throw new Error('Loader can only be used once.');\n }\n this.stats.loading.start = self.performance.now();\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.loadInternal();\n };\n _proto.loadInternal = function loadInternal() {\n var _this = this;\n var config = this.config,\n context = this.context;\n if (!config) {\n return;\n }\n var xhr = this.loader = new self.XMLHttpRequest();\n var stats = this.stats;\n stats.loading.first = 0;\n stats.loaded = 0;\n stats.aborted = false;\n var xhrSetup = this.xhrSetup;\n if (xhrSetup) {\n Promise.resolve().then(function () {\n if (_this.stats.aborted) return;\n return xhrSetup(xhr, context.url);\n }).catch(function (error) {\n xhr.open('GET', context.url, true);\n return xhrSetup(xhr, context.url);\n }).then(function () {\n if (_this.stats.aborted) return;\n _this.openAndSendXhr(xhr, context, config);\n }).catch(function (error) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n _this.callbacks.onError({\n code: xhr.status,\n text: error.message\n }, context, xhr, stats);\n return;\n });\n } else {\n this.openAndSendXhr(xhr, context, config);\n }\n };\n _proto.openAndSendXhr = function openAndSendXhr(xhr, context, config) {\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n var headers = this.context.headers;\n var _config$loadPolicy = config.loadPolicy,\n maxTimeToFirstByteMs = _config$loadPolicy.maxTimeToFirstByteMs,\n maxLoadTimeMs = _config$loadPolicy.maxLoadTimeMs;\n if (headers) {\n for (var header in headers) {\n xhr.setRequestHeader(header, headers[header]);\n }\n }\n if (context.rangeEnd) {\n xhr.setRequestHeader('Range', 'bytes=' + context.rangeStart + '-' + (context.rangeEnd - 1));\n }\n xhr.onreadystatechange = this.readystatechange.bind(this);\n xhr.onprogress = this.loadprogress.bind(this);\n xhr.responseType = context.responseType;\n // setup timeout before we perform request\n self.clearTimeout(this.requestTimeout);\n config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;\n this.requestTimeout = self.setTimeout(this.loadtimeout.bind(this), config.timeout);\n xhr.send();\n };\n _proto.readystatechange = function readystatechange() {\n var context = this.context,\n xhr = this.loader,\n stats = this.stats;\n if (!context || !xhr) {\n return;\n }\n var readyState = xhr.readyState;\n var config = this.config;\n\n // don't proceed if xhr has been aborted\n if (stats.aborted) {\n return;\n }\n\n // >= HEADERS_RECEIVED\n if (readyState >= 2) {\n if (stats.loading.first === 0) {\n stats.loading.first = Math.max(self.performance.now(), stats.loading.start);\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n if (config.timeout !== config.loadPolicy.maxLoadTimeMs) {\n self.clearTimeout(this.requestTimeout);\n config.timeout = config.loadPolicy.maxLoadTimeMs;\n this.requestTimeout = self.setTimeout(this.loadtimeout.bind(this), config.loadPolicy.maxLoadTimeMs - (stats.loading.first - stats.loading.start));\n }\n }\n if (readyState === 4) {\n self.clearTimeout(this.requestTimeout);\n xhr.onreadystatechange = null;\n xhr.onprogress = null;\n var _status = xhr.status;\n // http status between 200 to 299 are all successful\n var useResponse = xhr.responseType !== 'text';\n if (_status >= 200 && _status < 300 && (useResponse && xhr.response || xhr.responseText !== null)) {\n stats.loading.end = Math.max(self.performance.now(), stats.loading.first);\n var data = useResponse ? xhr.response : xhr.responseText;\n var len = xhr.responseType === 'arraybuffer' ? data.byteLength : data.length;\n stats.loaded = stats.total = len;\n stats.bwEstimate = stats.total * 8000 / (stats.loading.end - stats.loading.first);\n if (!this.callbacks) {\n return;\n }\n var onProgress = this.callbacks.onProgress;\n if (onProgress) {\n onProgress(stats, context, data, xhr);\n }\n if (!this.callbacks) {\n return;\n }\n var response = {\n url: xhr.responseURL,\n data: data,\n code: _status\n };\n this.callbacks.onSuccess(response, stats, context, xhr);\n } else {\n var retryConfig = config.loadPolicy.errorRetry;\n var retryCount = stats.retry;\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (shouldRetry(retryConfig, retryCount, false, _status)) {\n this.retry(retryConfig);\n } else {\n logger.error(_status + \" while loading \" + context.url);\n this.callbacks.onError({\n code: _status,\n text: xhr.statusText\n }, context, xhr, stats);\n }\n }\n }\n }\n };\n _proto.loadtimeout = function loadtimeout() {\n var _this$config;\n var retryConfig = (_this$config = this.config) == null ? void 0 : _this$config.loadPolicy.timeoutRetry;\n var retryCount = this.stats.retry;\n if (shouldRetry(retryConfig, retryCount, true)) {\n this.retry(retryConfig);\n } else {\n logger.warn(\"timeout while loading \" + this.context.url);\n var callbacks = this.callbacks;\n if (callbacks) {\n this.abortInternal();\n callbacks.onTimeout(this.stats, this.context, this.loader);\n }\n }\n };\n _proto.retry = function retry(retryConfig) {\n var context = this.context,\n stats = this.stats;\n this.retryDelay = getRetryDelay(retryConfig, stats.retry);\n stats.retry++;\n logger.warn((status ? 'HTTP Status ' + status : 'Timeout') + \" while loading \" + context.url + \", retrying \" + stats.retry + \"/\" + retryConfig.maxNumRetry + \" in \" + this.retryDelay + \"ms\");\n // abort and reset internal state\n this.abortInternal();\n this.loader = null;\n // schedule retry\n self.clearTimeout(this.retryTimeout);\n this.retryTimeout = self.setTimeout(this.loadInternal.bind(this), this.retryDelay);\n };\n _proto.loadprogress = function loadprogress(event) {\n var stats = this.stats;\n stats.loaded = event.loaded;\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n };\n _proto.getCacheAge = function getCacheAge() {\n var result = null;\n if (this.loader && AGE_HEADER_LINE_REGEX.test(this.loader.getAllResponseHeaders())) {\n var ageHeader = this.loader.getResponseHeader('age');\n result = ageHeader ? parseFloat(ageHeader) : null;\n }\n return result;\n };\n _proto.getResponseHeader = function getResponseHeader(name) {\n if (this.loader && new RegExp(\"^\" + name + \":\\\\s*[\\\\d.]+\\\\s*$\", 'im').test(this.loader.getAllResponseHeaders())) {\n return this.loader.getResponseHeader(name);\n }\n return null;\n };\n return XhrLoader;\n }();\n\n var ChunkCache = /*#__PURE__*/function () {\n function ChunkCache() {\n this.chunks = [];\n this.dataLength = 0;\n }\n var _proto = ChunkCache.prototype;\n _proto.push = function push(chunk) {\n this.chunks.push(chunk);\n this.dataLength += chunk.length;\n };\n _proto.flush = function flush() {\n var chunks = this.chunks,\n dataLength = this.dataLength;\n var result;\n if (!chunks.length) {\n return new Uint8Array(0);\n } else if (chunks.length === 1) {\n result = chunks[0];\n } else {\n result = concatUint8Arrays(chunks, dataLength);\n }\n this.reset();\n return result;\n };\n _proto.reset = function reset() {\n this.chunks.length = 0;\n this.dataLength = 0;\n };\n return ChunkCache;\n }();\n function concatUint8Arrays(chunks, dataLength) {\n var result = new Uint8Array(dataLength);\n var offset = 0;\n for (var i = 0; i < chunks.length; i++) {\n var chunk = chunks[i];\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n }\n\n function fetchSupported() {\n if (\n // @ts-ignore\n self.fetch && self.AbortController && self.ReadableStream && self.Request) {\n try {\n new self.ReadableStream({}); // eslint-disable-line no-new\n return true;\n } catch (e) {\n /* noop */\n }\n }\n return false;\n }\n var BYTERANGE = /(\\d+)-(\\d+)\\/(\\d+)/;\n var FetchLoader = /*#__PURE__*/function () {\n function FetchLoader(config /* HlsConfig */) {\n this.fetchSetup = void 0;\n this.requestTimeout = void 0;\n this.request = void 0;\n this.response = void 0;\n this.controller = void 0;\n this.context = void 0;\n this.config = null;\n this.callbacks = null;\n this.stats = void 0;\n this.loader = null;\n this.fetchSetup = config.fetchSetup || getRequest;\n this.controller = new self.AbortController();\n this.stats = new LoadStats();\n }\n var _proto = FetchLoader.prototype;\n _proto.destroy = function destroy() {\n this.loader = this.callbacks = null;\n this.abortInternal();\n };\n _proto.abortInternal = function abortInternal() {\n var response = this.response;\n if (!(response != null && response.ok)) {\n this.stats.aborted = true;\n this.controller.abort();\n }\n };\n _proto.abort = function abort() {\n var _this$callbacks;\n this.abortInternal();\n if ((_this$callbacks = this.callbacks) != null && _this$callbacks.onAbort) {\n this.callbacks.onAbort(this.stats, this.context, this.response);\n }\n };\n _proto.load = function load(context, config, callbacks) {\n var _this = this;\n var stats = this.stats;\n if (stats.loading.start) {\n throw new Error('Loader can only be used once.');\n }\n stats.loading.start = self.performance.now();\n var initParams = getRequestParameters(context, this.controller.signal);\n var onProgress = callbacks.onProgress;\n var isArrayBuffer = context.responseType === 'arraybuffer';\n var LENGTH = isArrayBuffer ? 'byteLength' : 'length';\n var _config$loadPolicy = config.loadPolicy,\n maxTimeToFirstByteMs = _config$loadPolicy.maxTimeToFirstByteMs,\n maxLoadTimeMs = _config$loadPolicy.maxLoadTimeMs;\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.request = this.fetchSetup(context, initParams);\n self.clearTimeout(this.requestTimeout);\n config.timeout = maxTimeToFirstByteMs && isFiniteNumber(maxTimeToFirstByteMs) ? maxTimeToFirstByteMs : maxLoadTimeMs;\n this.requestTimeout = self.setTimeout(function () {\n _this.abortInternal();\n callbacks.onTimeout(stats, context, _this.response);\n }, config.timeout);\n self.fetch(this.request).then(function (response) {\n _this.response = _this.loader = response;\n var first = Math.max(self.performance.now(), stats.loading.start);\n self.clearTimeout(_this.requestTimeout);\n config.timeout = maxLoadTimeMs;\n _this.requestTimeout = self.setTimeout(function () {\n _this.abortInternal();\n callbacks.onTimeout(stats, context, _this.response);\n }, maxLoadTimeMs - (first - stats.loading.start));\n if (!response.ok) {\n var status = response.status,\n statusText = response.statusText;\n throw new FetchError(statusText || 'fetch, bad network response', status, response);\n }\n stats.loading.first = first;\n stats.total = getContentLength(response.headers) || stats.total;\n if (onProgress && isFiniteNumber(config.highWaterMark)) {\n return _this.loadProgressively(response, stats, context, config.highWaterMark, onProgress);\n }\n if (isArrayBuffer) {\n return response.arrayBuffer();\n }\n if (context.responseType === 'json') {\n return response.json();\n }\n return response.text();\n }).then(function (responseData) {\n var response = _this.response;\n self.clearTimeout(_this.requestTimeout);\n stats.loading.end = Math.max(self.performance.now(), stats.loading.first);\n var total = responseData[LENGTH];\n if (total) {\n stats.loaded = stats.total = total;\n }\n var loaderResponse = {\n url: response.url,\n data: responseData,\n code: response.status\n };\n if (onProgress && !isFiniteNumber(config.highWaterMark)) {\n onProgress(stats, context, responseData, response);\n }\n callbacks.onSuccess(loaderResponse, stats, context, response);\n }).catch(function (error) {\n self.clearTimeout(_this.requestTimeout);\n if (stats.aborted) {\n return;\n }\n // CORS errors result in an undefined code. Set it to 0 here to align with XHR's behavior\n // when destroying, 'error' itself can be undefined\n var code = !error ? 0 : error.code || 0;\n var text = !error ? null : error.message;\n callbacks.onError({\n code: code,\n text: text\n }, context, error ? error.details : null, stats);\n });\n };\n _proto.getCacheAge = function getCacheAge() {\n var result = null;\n if (this.response) {\n var ageHeader = this.response.headers.get('age');\n result = ageHeader ? parseFloat(ageHeader) : null;\n }\n return result;\n };\n _proto.getResponseHeader = function getResponseHeader(name) {\n return this.response ? this.response.headers.get(name) : null;\n };\n _proto.loadProgressively = function loadProgressively(response, stats, context, highWaterMark, onProgress) {\n if (highWaterMark === void 0) {\n highWaterMark = 0;\n }\n var chunkCache = new ChunkCache();\n var reader = response.body.getReader();\n var pump = function pump() {\n return reader.read().then(function (data) {\n if (data.done) {\n if (chunkCache.dataLength) {\n onProgress(stats, context, chunkCache.flush(), response);\n }\n return Promise.resolve(new ArrayBuffer(0));\n }\n var chunk = data.value;\n var len = chunk.length;\n stats.loaded += len;\n if (len < highWaterMark || chunkCache.dataLength) {\n // The current chunk is too small to to be emitted or the cache already has data\n // Push it to the cache\n chunkCache.push(chunk);\n if (chunkCache.dataLength >= highWaterMark) {\n // flush in order to join the typed arrays\n onProgress(stats, context, chunkCache.flush(), response);\n }\n } else {\n // If there's nothing cached already, and the chache is large enough\n // just emit the progress event\n onProgress(stats, context, chunk, response);\n }\n return pump();\n }).catch(function () {\n /* aborted */\n return Promise.reject();\n });\n };\n return pump();\n };\n return FetchLoader;\n }();\n function getRequestParameters(context, signal) {\n var initParams = {\n method: 'GET',\n mode: 'cors',\n credentials: 'same-origin',\n signal: signal,\n headers: new self.Headers(_extends({}, context.headers))\n };\n if (context.rangeEnd) {\n initParams.headers.set('Range', 'bytes=' + context.rangeStart + '-' + String(context.rangeEnd - 1));\n }\n return initParams;\n }\n function getByteRangeLength(byteRangeHeader) {\n var result = BYTERANGE.exec(byteRangeHeader);\n if (result) {\n return parseInt(result[2]) - parseInt(result[1]) + 1;\n }\n }\n function getContentLength(headers) {\n var contentRange = headers.get('Content-Range');\n if (contentRange) {\n var byteRangeLength = getByteRangeLength(contentRange);\n if (isFiniteNumber(byteRangeLength)) {\n return byteRangeLength;\n }\n }\n var contentLength = headers.get('Content-Length');\n if (contentLength) {\n return parseInt(contentLength);\n }\n }\n function getRequest(context, initParams) {\n return new self.Request(context.url, initParams);\n }\n var FetchError = /*#__PURE__*/function (_Error) {\n _inheritsLoose(FetchError, _Error);\n function FetchError(message, code, details) {\n var _this2;\n _this2 = _Error.call(this, message) || this;\n _this2.code = void 0;\n _this2.details = void 0;\n _this2.code = code;\n _this2.details = details;\n return _this2;\n }\n return FetchError;\n }( /*#__PURE__*/_wrapNativeSuper(Error));\n\n /**\n * @deprecated use fragLoadPolicy.default\n */\n\n /**\n * @deprecated use manifestLoadPolicy.default and playlistLoadPolicy.default\n */\n\n var defaultLoadPolicy = {\n maxTimeToFirstByteMs: 8000,\n maxLoadTimeMs: 20000,\n timeoutRetry: null,\n errorRetry: null\n };\n\n /**\n * @ignore\n * If possible, keep hlsDefaultConfig shallow\n * It is cloned whenever a new Hls instance is created, by keeping the config\n * shallow the properties are cloned, and we don't end up manipulating the default\n */\n var hlsDefaultConfig = _objectSpread2(_objectSpread2({\n autoStartLoad: true,\n // used by stream-controller\n startPosition: -1,\n // used by stream-controller\n defaultAudioCodec: undefined,\n // used by stream-controller\n debug: false,\n // used by logger\n capLevelOnFPSDrop: false,\n // used by fps-controller\n capLevelToPlayerSize: false,\n // used by cap-level-controller\n ignoreDevicePixelRatio: false,\n // used by cap-level-controller\n initialLiveManifestSize: 1,\n // used by stream-controller\n maxBufferLength: 30,\n // used by stream-controller\n backBufferLength: Infinity,\n // used by buffer-controller\n maxBufferSize: 60 * 1000 * 1000,\n // used by stream-controller\n maxBufferHole: 0.1,\n // used by stream-controller\n highBufferWatchdogPeriod: 2,\n // used by stream-controller\n nudgeOffset: 0.1,\n // used by stream-controller\n nudgeMaxRetry: 3,\n // used by stream-controller\n maxFragLookUpTolerance: 0.25,\n // used by stream-controller\n liveSyncDurationCount: 3,\n // used by latency-controller\n liveMaxLatencyDurationCount: Infinity,\n // used by latency-controller\n liveSyncDuration: undefined,\n // used by latency-controller\n liveMaxLatencyDuration: undefined,\n // used by latency-controller\n maxLiveSyncPlaybackRate: 1,\n // used by latency-controller\n liveDurationInfinity: false,\n // used by buffer-controller\n /**\n * @deprecated use backBufferLength\n */\n liveBackBufferLength: null,\n // used by buffer-controller\n maxMaxBufferLength: 600,\n // used by stream-controller\n enableWorker: true,\n // used by transmuxer\n workerPath: null,\n // used by transmuxer\n enableSoftwareAES: true,\n // used by decrypter\n startLevel: undefined,\n // used by level-controller\n startFragPrefetch: false,\n // used by stream-controller\n fpsDroppedMonitoringPeriod: 5000,\n // used by fps-controller\n fpsDroppedMonitoringThreshold: 0.2,\n // used by fps-controller\n appendErrorMaxRetry: 3,\n // used by buffer-controller\n loader: XhrLoader,\n // loader: FetchLoader,\n fLoader: undefined,\n // used by fragment-loader\n pLoader: undefined,\n // used by playlist-loader\n xhrSetup: undefined,\n // used by xhr-loader\n licenseXhrSetup: undefined,\n // used by eme-controller\n licenseResponseCallback: undefined,\n // used by eme-controller\n abrController: AbrController,\n bufferController: BufferController,\n capLevelController: CapLevelController,\n errorController: ErrorController,\n fpsController: FPSController,\n stretchShortVideoTrack: false,\n // used by mp4-remuxer\n maxAudioFramesDrift: 1,\n // used by mp4-remuxer\n forceKeyFrameOnDiscontinuity: true,\n // used by ts-demuxer\n abrEwmaFastLive: 3,\n // used by abr-controller\n abrEwmaSlowLive: 9,\n // used by abr-controller\n abrEwmaFastVoD: 3,\n // used by abr-controller\n abrEwmaSlowVoD: 9,\n // used by abr-controller\n abrEwmaDefaultEstimate: 5e5,\n // 500 kbps // used by abr-controller\n abrBandWidthFactor: 0.95,\n // used by abr-controller\n abrBandWidthUpFactor: 0.7,\n // used by abr-controller\n abrMaxWithRealBitrate: false,\n // used by abr-controller\n maxStarvationDelay: 4,\n // used by abr-controller\n maxLoadingDelay: 4,\n // used by abr-controller\n minAutoBitrate: 0,\n // used by hls\n emeEnabled: false,\n // used by eme-controller\n widevineLicenseUrl: undefined,\n // used by eme-controller\n drmSystems: {},\n // used by eme-controller\n drmSystemOptions: {},\n // used by eme-controller\n requestMediaKeySystemAccessFunc: null,\n // used by eme-controller\n testBandwidth: true,\n progressive: false,\n lowLatencyMode: true,\n cmcd: undefined,\n enableDateRangeMetadataCues: true,\n enableEmsgMetadataCues: true,\n enableID3MetadataCues: true,\n certLoadPolicy: {\n default: defaultLoadPolicy\n },\n keyLoadPolicy: {\n default: {\n maxTimeToFirstByteMs: 8000,\n maxLoadTimeMs: 20000,\n timeoutRetry: {\n maxNumRetry: 1,\n retryDelayMs: 1000,\n maxRetryDelayMs: 20000,\n backoff: 'linear'\n },\n errorRetry: {\n maxNumRetry: 8,\n retryDelayMs: 1000,\n maxRetryDelayMs: 20000,\n backoff: 'linear'\n }\n }\n },\n manifestLoadPolicy: {\n default: {\n maxTimeToFirstByteMs: Infinity,\n maxLoadTimeMs: 20000,\n timeoutRetry: {\n maxNumRetry: 2,\n retryDelayMs: 0,\n maxRetryDelayMs: 0\n },\n errorRetry: {\n maxNumRetry: 1,\n retryDelayMs: 1000,\n maxRetryDelayMs: 8000\n }\n }\n },\n playlistLoadPolicy: {\n default: {\n maxTimeToFirstByteMs: 10000,\n maxLoadTimeMs: 20000,\n timeoutRetry: {\n maxNumRetry: 2,\n retryDelayMs: 0,\n maxRetryDelayMs: 0\n },\n errorRetry: {\n maxNumRetry: 2,\n retryDelayMs: 1000,\n maxRetryDelayMs: 8000\n }\n }\n },\n fragLoadPolicy: {\n default: {\n maxTimeToFirstByteMs: 10000,\n maxLoadTimeMs: 120000,\n timeoutRetry: {\n maxNumRetry: 4,\n retryDelayMs: 0,\n maxRetryDelayMs: 0\n },\n errorRetry: {\n maxNumRetry: 6,\n retryDelayMs: 1000,\n maxRetryDelayMs: 8000\n }\n }\n },\n steeringManifestLoadPolicy: {\n default: defaultLoadPolicy\n },\n // These default settings are deprecated in favor of the above policies\n // and are maintained for backwards compatibility\n manifestLoadingTimeOut: 10000,\n manifestLoadingMaxRetry: 1,\n manifestLoadingRetryDelay: 1000,\n manifestLoadingMaxRetryTimeout: 64000,\n levelLoadingTimeOut: 10000,\n levelLoadingMaxRetry: 4,\n levelLoadingRetryDelay: 1000,\n levelLoadingMaxRetryTimeout: 64000,\n fragLoadingTimeOut: 20000,\n fragLoadingMaxRetry: 6,\n fragLoadingRetryDelay: 1000,\n fragLoadingMaxRetryTimeout: 64000\n }, timelineConfig()), {}, {\n subtitleStreamController: undefined,\n subtitleTrackController: undefined,\n timelineController: undefined,\n audioStreamController: undefined,\n audioTrackController: undefined,\n emeController: undefined,\n cmcdController: undefined,\n contentSteeringController: undefined\n });\n function timelineConfig() {\n return {\n cueHandler: Cues,\n // used by timeline-controller\n enableWebVTT: false,\n // used by timeline-controller\n enableIMSC1: false,\n // used by timeline-controller\n enableCEA708Captions: false,\n // used by timeline-controller\n captionsTextTrack1Label: 'English',\n // used by timeline-controller\n captionsTextTrack1LanguageCode: 'en',\n // used by timeline-controller\n captionsTextTrack2Label: 'Spanish',\n // used by timeline-controller\n captionsTextTrack2LanguageCode: 'es',\n // used by timeline-controller\n captionsTextTrack3Label: 'Unknown CC',\n // used by timeline-controller\n captionsTextTrack3LanguageCode: '',\n // used by timeline-controller\n captionsTextTrack4Label: 'Unknown CC',\n // used by timeline-controller\n captionsTextTrack4LanguageCode: '',\n // used by timeline-controller\n renderTextTracksNatively: true\n };\n }\n\n /**\n * @ignore\n */\n function mergeConfig(defaultConfig, userConfig) {\n if ((userConfig.liveSyncDurationCount || userConfig.liveMaxLatencyDurationCount) && (userConfig.liveSyncDuration || userConfig.liveMaxLatencyDuration)) {\n throw new Error(\"Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration\");\n }\n if (userConfig.liveMaxLatencyDurationCount !== undefined && (userConfig.liveSyncDurationCount === undefined || userConfig.liveMaxLatencyDurationCount <= userConfig.liveSyncDurationCount)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be greater than \"liveSyncDurationCount\"');\n }\n if (userConfig.liveMaxLatencyDuration !== undefined && (userConfig.liveSyncDuration === undefined || userConfig.liveMaxLatencyDuration <= userConfig.liveSyncDuration)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be greater than \"liveSyncDuration\"');\n }\n var defaultsCopy = deepCpy(defaultConfig);\n\n // Backwards compatibility with deprecated config values\n var deprecatedSettingTypes = ['manifest', 'level', 'frag'];\n var deprecatedSettings = ['TimeOut', 'MaxRetry', 'RetryDelay', 'MaxRetryTimeout'];\n deprecatedSettingTypes.forEach(function (type) {\n var policyName = (type === 'level' ? 'playlist' : type) + \"LoadPolicy\";\n var policyNotSet = userConfig[policyName] === undefined;\n var report = [];\n deprecatedSettings.forEach(function (setting) {\n var deprecatedSetting = type + \"Loading\" + setting;\n var value = userConfig[deprecatedSetting];\n if (value !== undefined && policyNotSet) {\n report.push(deprecatedSetting);\n var settings = defaultsCopy[policyName].default;\n userConfig[policyName] = {\n default: settings\n };\n switch (setting) {\n case 'TimeOut':\n settings.maxLoadTimeMs = value;\n settings.maxTimeToFirstByteMs = value;\n break;\n case 'MaxRetry':\n settings.errorRetry.maxNumRetry = value;\n settings.timeoutRetry.maxNumRetry = value;\n break;\n case 'RetryDelay':\n settings.errorRetry.retryDelayMs = value;\n settings.timeoutRetry.retryDelayMs = value;\n break;\n case 'MaxRetryTimeout':\n settings.errorRetry.maxRetryDelayMs = value;\n settings.timeoutRetry.maxRetryDelayMs = value;\n break;\n }\n }\n });\n if (report.length) {\n logger.warn(\"hls.js config: \\\"\" + report.join('\", \"') + \"\\\" setting(s) are deprecated, use \\\"\" + policyName + \"\\\": \" + JSON.stringify(userConfig[policyName]));\n }\n });\n return _objectSpread2(_objectSpread2({}, defaultsCopy), userConfig);\n }\n function deepCpy(obj) {\n if (obj && typeof obj === 'object') {\n if (Array.isArray(obj)) {\n return obj.map(deepCpy);\n }\n return Object.keys(obj).reduce(function (result, key) {\n result[key] = deepCpy(obj[key]);\n return result;\n }, {});\n }\n return obj;\n }\n\n /**\n * @ignore\n */\n function enableStreamingMode(config) {\n var currentLoader = config.loader;\n if (currentLoader !== FetchLoader && currentLoader !== XhrLoader) {\n // If a developer has configured their own loader, respect that choice\n logger.log('[config]: Custom loader detected, cannot enable progressive streaming');\n config.progressive = false;\n } else {\n var canStreamProgressively = fetchSupported();\n if (canStreamProgressively) {\n config.loader = FetchLoader;\n config.progressive = true;\n config.enableSoftwareAES = true;\n logger.log('[config]: Progressive streaming enabled, using FetchLoader');\n }\n }\n }\n\n /**\n * The `Hls` class is the core of the HLS.js library used to instantiate player instances.\n * @public\n */\n var Hls = /*#__PURE__*/function () {\n /**\n * Check if the required MediaSource Extensions are available.\n */\n Hls.isSupported = function isSupported$1() {\n return isSupported();\n };\n /**\n * Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.\n * @param userConfig - Configuration options applied over `Hls.DefaultConfig`\n */\n function Hls(userConfig) {\n if (userConfig === void 0) {\n userConfig = {};\n }\n /**\n * The runtime configuration used by the player. At instantiation this is combination of `hls.userConfig` merged over `Hls.DefaultConfig`.\n */\n this.config = void 0;\n /**\n * The configuration object provided on player instantiation.\n */\n this.userConfig = void 0;\n this.coreComponents = void 0;\n this.networkControllers = void 0;\n this._emitter = new EventEmitter();\n this._autoLevelCapping = void 0;\n this._maxHdcpLevel = null;\n this.abrController = void 0;\n this.bufferController = void 0;\n this.capLevelController = void 0;\n this.latencyController = void 0;\n this.levelController = void 0;\n this.streamController = void 0;\n this.audioTrackController = void 0;\n this.subtitleTrackController = void 0;\n this.emeController = void 0;\n this.cmcdController = void 0;\n this._media = null;\n this.url = null;\n enableLogs(userConfig.debug || false, 'Hls instance');\n var config = this.config = mergeConfig(Hls.DefaultConfig, userConfig);\n this.userConfig = userConfig;\n this._autoLevelCapping = -1;\n if (config.progressive) {\n enableStreamingMode(config);\n }\n\n // core controllers and network loaders\n var ConfigAbrController = config.abrController,\n ConfigBufferController = config.bufferController,\n ConfigCapLevelController = config.capLevelController,\n ConfigErrorController = config.errorController,\n ConfigFpsController = config.fpsController;\n var errorController = new ConfigErrorController(this);\n var abrController = this.abrController = new ConfigAbrController(this);\n var bufferController = this.bufferController = new ConfigBufferController(this);\n var capLevelController = this.capLevelController = new ConfigCapLevelController(this);\n var fpsController = new ConfigFpsController(this);\n var playListLoader = new PlaylistLoader(this);\n var id3TrackController = new ID3TrackController(this);\n var ConfigContentSteeringController = config.contentSteeringController;\n // ConentSteeringController is defined before LevelController to receive Multivariant Playlist events first\n var contentSteering = ConfigContentSteeringController ? new ConfigContentSteeringController(this) : null;\n var levelController = this.levelController = new LevelController(this, contentSteering);\n // FragmentTracker must be defined before StreamController because the order of event handling is important\n var fragmentTracker = new FragmentTracker(this);\n var keyLoader = new KeyLoader(this.config);\n var streamController = this.streamController = new StreamController(this, fragmentTracker, keyLoader);\n\n // Cap level controller uses streamController to flush the buffer\n capLevelController.setStreamController(streamController);\n // fpsController uses streamController to switch when frames are being dropped\n fpsController.setStreamController(streamController);\n var networkControllers = [playListLoader, levelController, streamController];\n if (contentSteering) {\n networkControllers.splice(1, 0, contentSteering);\n }\n this.networkControllers = networkControllers;\n var coreComponents = [abrController, bufferController, capLevelController, fpsController, id3TrackController, fragmentTracker];\n this.audioTrackController = this.createController(config.audioTrackController, networkControllers);\n var AudioStreamControllerClass = config.audioStreamController;\n if (AudioStreamControllerClass) {\n networkControllers.push(new AudioStreamControllerClass(this, fragmentTracker, keyLoader));\n }\n // subtitleTrackController must be defined before subtitleStreamController because the order of event handling is important\n this.subtitleTrackController = this.createController(config.subtitleTrackController, networkControllers);\n var SubtitleStreamControllerClass = config.subtitleStreamController;\n if (SubtitleStreamControllerClass) {\n networkControllers.push(new SubtitleStreamControllerClass(this, fragmentTracker, keyLoader));\n }\n this.createController(config.timelineController, coreComponents);\n keyLoader.emeController = this.emeController = this.createController(config.emeController, coreComponents);\n this.cmcdController = this.createController(config.cmcdController, coreComponents);\n this.latencyController = this.createController(LatencyController, coreComponents);\n this.coreComponents = coreComponents;\n\n // Error controller handles errors before and after all other controllers\n // This listener will be invoked after all other controllers error listeners\n networkControllers.push(errorController);\n var onErrorOut = errorController.onErrorOut;\n if (typeof onErrorOut === 'function') {\n this.on(Events.ERROR, onErrorOut, errorController);\n }\n }\n var _proto = Hls.prototype;\n _proto.createController = function createController(ControllerClass, components) {\n if (ControllerClass) {\n var controllerInstance = new ControllerClass(this);\n if (components) {\n components.push(controllerInstance);\n }\n return controllerInstance;\n }\n return null;\n }\n\n // Delegate the EventEmitter through the public API of Hls.js\n ;\n _proto.on = function on(event, listener, context) {\n if (context === void 0) {\n context = this;\n }\n this._emitter.on(event, listener, context);\n };\n _proto.once = function once(event, listener, context) {\n if (context === void 0) {\n context = this;\n }\n this._emitter.once(event, listener, context);\n };\n _proto.removeAllListeners = function removeAllListeners(event) {\n this._emitter.removeAllListeners(event);\n };\n _proto.off = function off(event, listener, context, once) {\n if (context === void 0) {\n context = this;\n }\n this._emitter.off(event, listener, context, once);\n };\n _proto.listeners = function listeners(event) {\n return this._emitter.listeners(event);\n };\n _proto.emit = function emit(event, name, eventObject) {\n return this._emitter.emit(event, name, eventObject);\n };\n _proto.trigger = function trigger(event, eventObject) {\n if (this.config.debug) {\n return this.emit(event, event, eventObject);\n } else {\n try {\n return this.emit(event, event, eventObject);\n } catch (e) {\n logger.error('An internal error happened while handling event ' + event + '. Error message: \"' + e.message + '\". Here is a stacktrace:', e);\n this.trigger(Events.ERROR, {\n type: ErrorTypes.OTHER_ERROR,\n details: ErrorDetails.INTERNAL_EXCEPTION,\n fatal: false,\n event: event,\n error: e\n });\n }\n }\n return false;\n };\n _proto.listenerCount = function listenerCount(event) {\n return this._emitter.listenerCount(event);\n }\n\n /**\n * Dispose of the instance\n */;\n _proto.destroy = function destroy() {\n logger.log('destroy');\n this.trigger(Events.DESTROYING, undefined);\n this.detachMedia();\n this.removeAllListeners();\n this._autoLevelCapping = -1;\n this.url = null;\n this.networkControllers.forEach(function (component) {\n return component.destroy();\n });\n this.networkControllers.length = 0;\n this.coreComponents.forEach(function (component) {\n return component.destroy();\n });\n this.coreComponents.length = 0;\n // Remove any references that could be held in config options or callbacks\n var config = this.config;\n config.xhrSetup = config.fetchSetup = undefined;\n // @ts-ignore\n this.userConfig = null;\n }\n\n /**\n * Attaches Hls.js to a media element\n */;\n _proto.attachMedia = function attachMedia(media) {\n logger.log('attachMedia');\n this._media = media;\n this.trigger(Events.MEDIA_ATTACHING, {\n media: media\n });\n }\n\n /**\n * Detach Hls.js from the media\n */;\n _proto.detachMedia = function detachMedia() {\n logger.log('detachMedia');\n this.trigger(Events.MEDIA_DETACHING, undefined);\n this._media = null;\n }\n\n /**\n * Set the source URL. Can be relative or absolute.\n */;\n _proto.loadSource = function loadSource(url) {\n this.stopLoad();\n var media = this.media;\n var loadedSource = this.url;\n var loadingSource = this.url = urlToolkitExports.buildAbsoluteURL(self.location.href, url, {\n alwaysNormalize: true\n });\n logger.log(\"loadSource:\" + loadingSource);\n if (media && loadedSource && (loadedSource !== loadingSource || this.bufferController.hasSourceTypes())) {\n this.detachMedia();\n this.attachMedia(media);\n }\n // when attaching to a source URL, trigger a playlist load\n this.trigger(Events.MANIFEST_LOADING, {\n url: url\n });\n }\n\n /**\n * Start loading data from the stream source.\n * Depending on default config, client starts loading automatically when a source is set.\n *\n * @param startPosition - Set the start position to stream from.\n * Defaults to -1 (None: starts from earliest point)\n */;\n _proto.startLoad = function startLoad(startPosition) {\n if (startPosition === void 0) {\n startPosition = -1;\n }\n logger.log(\"startLoad(\" + startPosition + \")\");\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n }\n\n /**\n * Stop loading of any stream data.\n */;\n _proto.stopLoad = function stopLoad() {\n logger.log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n }\n\n /**\n * Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)\n */;\n _proto.swapAudioCodec = function swapAudioCodec() {\n logger.log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n }\n\n /**\n * When the media-element fails, this allows to detach and then re-attach it\n * as one call (convenience method).\n *\n * Automatic recovery of media-errors by this process is configurable.\n */;\n _proto.recoverMediaError = function recoverMediaError() {\n logger.log('recoverMediaError');\n var media = this._media;\n this.detachMedia();\n if (media) {\n this.attachMedia(media);\n }\n };\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n if (urlId === void 0) {\n urlId = 0;\n }\n this.levelController.removeLevel(levelIndex, urlId);\n }\n\n /**\n * @returns an array of levels (variants) sorted by HDCP-LEVEL, BANDWIDTH, SCORE, and RESOLUTION (height)\n */;\n _createClass(Hls, [{\n key: \"levels\",\n get: function get() {\n var levels = this.levelController.levels;\n return levels ? levels : [];\n }\n\n /**\n * Index of quality level (variant) currently played\n */\n }, {\n key: \"currentLevel\",\n get: function get() {\n return this.streamController.currentLevel;\n }\n\n /**\n * Set quality level index immediately. This will flush the current buffer to replace the quality asap. That means playback will interrupt at least shortly to re-buffer and re-sync eventually. Set to -1 for automatic level selection.\n */,\n set: function set(newLevel) {\n logger.log(\"set currentLevel:\" + newLevel);\n this.loadLevel = newLevel;\n this.abrController.clearTimer();\n this.streamController.immediateLevelSwitch();\n }\n\n /**\n * Index of next quality level loaded as scheduled by stream controller.\n */\n }, {\n key: \"nextLevel\",\n get: function get() {\n return this.streamController.nextLevel;\n }\n\n /**\n * Set quality level index for next loaded data.\n * This will switch the video quality asap, without interrupting playback.\n * May abort current loading of data, and flush parts of buffer (outside currently played fragment region).\n * @param newLevel - Pass -1 for automatic level selection\n */,\n set: function set(newLevel) {\n logger.log(\"set nextLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n\n /**\n * Return the quality level of the currently or last (of none is loaded currently) segment\n */\n }, {\n key: \"loadLevel\",\n get: function get() {\n return this.levelController.level;\n }\n\n /**\n * Set quality level index for next loaded data in a conservative way.\n * This will switch the quality without flushing, but interrupt current loading.\n * Thus the moment when the quality switch will appear in effect will only be after the already existing buffer.\n * @param newLevel - Pass -1 for automatic level selection\n */,\n set: function set(newLevel) {\n logger.log(\"set loadLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n }\n\n /**\n * get next quality level loaded\n */\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n return this.levelController.nextLoadLevel;\n }\n\n /**\n * Set quality level of next loaded segment in a fully \"non-destructive\" way.\n * Same as `loadLevel` but will wait for next switch (until current loading is done).\n */,\n set: function set(level) {\n this.levelController.nextLoadLevel = level;\n }\n\n /**\n * Return \"first level\": like a default level, if not set,\n * falls back to index of first level referenced in manifest\n */\n }, {\n key: \"firstLevel\",\n get: function get() {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n }\n\n /**\n * Sets \"first-level\", see getter.\n */,\n set: function set(newLevel) {\n logger.log(\"set firstLevel:\" + newLevel);\n this.levelController.firstLevel = newLevel;\n }\n\n /**\n * Return start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n */\n }, {\n key: \"startLevel\",\n get: function get() {\n return this.levelController.startLevel;\n }\n\n /**\n * set start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n */,\n set: function set(newLevel) {\n logger.log(\"set startLevel:\" + newLevel);\n // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, this.minAutoLevel);\n }\n this.levelController.startLevel = newLevel;\n }\n\n /**\n * Whether level capping is enabled.\n * Default value is set via `config.capLevelToPlayerSize`.\n */\n }, {\n key: \"capLevelToPlayerSize\",\n get: function get() {\n return this.config.capLevelToPlayerSize;\n }\n\n /**\n * Enables or disables level capping. If disabled after previously enabled, `nextLevelSwitch` will be immediately called.\n */,\n set: function set(shouldStartCapping) {\n var newCapLevelToPlayerSize = !!shouldStartCapping;\n if (newCapLevelToPlayerSize !== this.config.capLevelToPlayerSize) {\n if (newCapLevelToPlayerSize) {\n this.capLevelController.startCapping(); // If capping occurs, nextLevelSwitch will happen based on size.\n } else {\n this.capLevelController.stopCapping();\n this.autoLevelCapping = -1;\n this.streamController.nextLevelSwitch(); // Now we're uncapped, get the next level asap.\n }\n\n this.config.capLevelToPlayerSize = newCapLevelToPlayerSize;\n }\n }\n\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n */\n }, {\n key: \"autoLevelCapping\",\n get: function get() {\n return this._autoLevelCapping;\n }\n\n /**\n * Returns the current bandwidth estimate in bits per second, when available. Otherwise, `NaN` is returned.\n */,\n set:\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n */\n function set(newLevel) {\n if (this._autoLevelCapping !== newLevel) {\n logger.log(\"set autoLevelCapping:\" + newLevel);\n this._autoLevelCapping = newLevel;\n }\n }\n }, {\n key: \"bandwidthEstimate\",\n get: function get() {\n var bwEstimator = this.abrController.bwEstimator;\n if (!bwEstimator) {\n return NaN;\n }\n return bwEstimator.getEstimate();\n }\n\n /**\n * get time to first byte estimate\n * @type {number}\n */\n }, {\n key: \"ttfbEstimate\",\n get: function get() {\n var bwEstimator = this.abrController.bwEstimator;\n if (!bwEstimator) {\n return NaN;\n }\n return bwEstimator.getEstimateTTFB();\n }\n }, {\n key: \"maxHdcpLevel\",\n get: function get() {\n return this._maxHdcpLevel;\n },\n set: function set(value) {\n if (HdcpLevels.indexOf(value) > -1) {\n this._maxHdcpLevel = value;\n }\n }\n\n /**\n * True when automatic level selection enabled\n */\n }, {\n key: \"autoLevelEnabled\",\n get: function get() {\n return this.levelController.manualLevel === -1;\n }\n\n /**\n * Level set manually (if any)\n */\n }, {\n key: \"manualLevel\",\n get: function get() {\n return this.levelController.manualLevel;\n }\n\n /**\n * min level selectable in auto mode according to config.minAutoBitrate\n */\n }, {\n key: \"minAutoLevel\",\n get: function get() {\n var levels = this.levels,\n minAutoBitrate = this.config.minAutoBitrate;\n if (!levels) return 0;\n var len = levels.length;\n for (var i = 0; i < len; i++) {\n if (levels[i].maxBitrate >= minAutoBitrate) {\n return i;\n }\n }\n return 0;\n }\n\n /**\n * max level selectable in auto mode according to autoLevelCapping\n */\n }, {\n key: \"maxAutoLevel\",\n get: function get() {\n var levels = this.levels,\n autoLevelCapping = this.autoLevelCapping,\n maxHdcpLevel = this.maxHdcpLevel;\n var maxAutoLevel;\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n } else {\n maxAutoLevel = autoLevelCapping;\n }\n if (maxHdcpLevel) {\n for (var i = maxAutoLevel; i--;) {\n var hdcpLevel = levels[i].attrs['HDCP-LEVEL'];\n if (hdcpLevel && hdcpLevel <= maxHdcpLevel) {\n return i;\n }\n }\n }\n return maxAutoLevel;\n }\n\n /**\n * next automatically selected quality level\n */\n }, {\n key: \"nextAutoLevel\",\n get: function get() {\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), this.maxAutoLevel);\n }\n\n /**\n * this setter is used to force next auto level.\n * this is useful to force a switch down in auto mode:\n * in case of load error on level N, hls.js can set nextAutoLevel to N-1 for example)\n * forced value is valid for one fragment. upon successful frag loading at forced level,\n * this value will be resetted to -1 by ABR controller.\n */,\n set: function set(nextLevel) {\n this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, nextLevel);\n }\n\n /**\n * get the datetime value relative to media.currentTime for the active level Program Date Time if present\n */\n }, {\n key: \"playingDate\",\n get: function get() {\n return this.streamController.currentProgramDateTime;\n }\n }, {\n key: \"mainForwardBufferInfo\",\n get: function get() {\n return this.streamController.getMainFwdBufferInfo();\n }\n\n /**\n * Get the list of selectable audio tracks\n */\n }, {\n key: \"audioTracks\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n }\n\n /**\n * index of the selected audio track (index in audio track lists)\n */\n }, {\n key: \"audioTrack\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTrack : -1;\n }\n\n /**\n * selects an audio track, based on its index in audio track lists\n */,\n set: function set(audioTrackId) {\n var audioTrackController = this.audioTrackController;\n if (audioTrackController) {\n audioTrackController.audioTrack = audioTrackId;\n }\n }\n\n /**\n * get alternate subtitle tracks list from playlist\n */\n }, {\n key: \"subtitleTracks\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTracks : [];\n }\n\n /**\n * index of the selected subtitle track (index in subtitle track lists)\n */\n }, {\n key: \"subtitleTrack\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTrack : -1;\n },\n set:\n /**\n * select an subtitle track, based on its index in subtitle track lists\n */\n function set(subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n }\n\n /**\n * Whether subtitle display is enabled or not\n */\n }, {\n key: \"media\",\n get: function get() {\n return this._media;\n }\n }, {\n key: \"subtitleDisplay\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n }\n\n /**\n * Enable/disable subtitle display rendering\n */,\n set: function set(value) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n }\n\n /**\n * get mode for Low-Latency HLS loading\n */\n }, {\n key: \"lowLatencyMode\",\n get: function get() {\n return this.config.lowLatencyMode;\n }\n\n /**\n * Enable/disable Low-Latency HLS part playlist and segment loading, and start live streams at playlist PART-HOLD-BACK rather than HOLD-BACK.\n */,\n set: function set(mode) {\n this.config.lowLatencyMode = mode;\n }\n\n /**\n * Position (in seconds) of live sync point (ie edge of live position minus safety delay defined by ```hls.config.liveSyncDuration```)\n * @returns null prior to loading live Playlist\n */\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n return this.latencyController.liveSyncPosition;\n }\n\n /**\n * Estimated position (in seconds) of live edge (ie edge of live playlist plus time sync playlist advanced)\n * @returns 0 before first playlist is loaded\n */\n }, {\n key: \"latency\",\n get: function get() {\n return this.latencyController.latency;\n }\n\n /**\n * maximum distance from the edge before the player seeks forward to ```hls.liveSyncPosition```\n * configured using ```liveMaxLatencyDurationCount``` (multiple of target duration) or ```liveMaxLatencyDuration```\n * @returns 0 before first playlist is loaded\n */\n }, {\n key: \"maxLatency\",\n get: function get() {\n return this.latencyController.maxLatency;\n }\n\n /**\n * target distance from the edge as calculated by the latency controller\n */\n }, {\n key: \"targetLatency\",\n get: function get() {\n return this.latencyController.targetLatency;\n }\n\n /**\n * the rate at which the edge of the current live playlist is advancing or 1 if there is none\n */\n }, {\n key: \"drift\",\n get: function get() {\n return this.latencyController.drift;\n }\n\n /**\n * set to true when startLoad is called before MANIFEST_PARSED event\n */\n }, {\n key: \"forceStartLoad\",\n get: function get() {\n return this.streamController.forceStartLoad;\n }\n }], [{\n key: \"version\",\n get:\n /**\n * Get the video-dev/hls.js package version.\n */\n function get() {\n return \"1.4.12\";\n }\n }, {\n key: \"Events\",\n get: function get() {\n return Events;\n }\n }, {\n key: \"ErrorTypes\",\n get: function get() {\n return ErrorTypes;\n }\n }, {\n key: \"ErrorDetails\",\n get: function get() {\n return ErrorDetails;\n }\n\n /**\n * Get the default configuration applied to new instances.\n */\n }, {\n key: \"DefaultConfig\",\n get: function get() {\n if (!Hls.defaultConfig) {\n return hlsDefaultConfig;\n }\n return Hls.defaultConfig;\n }\n\n /**\n * Replace the default configuration applied to new instances.\n */,\n set: function set(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n }]);\n return Hls;\n }();\n Hls.defaultConfig = void 0;\n\n return Hls;\n\n}));\n})(false);\n//# sourceMappingURL=hls.light.js.map\n"],"names":["__HLS_WORKER_BUNDLE__","__IN_WORKER__","module","exports","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread2","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_defineProperties","props","descriptor","configurable","writable","_toPropertyKey","_createClass","Constructor","protoProps","staticProps","prototype","obj","value","_extends","assign","bind","hasOwnProperty","call","this","_inheritsLoose","subClass","superClass","create","constructor","_setPrototypeOf","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","p","_isNativeReflectConstruct","Reflect","construct","sham","Proxy","Boolean","valueOf","e","_construct","Parent","args","Class","a","instance","Function","_isNativeFunction","fn","toString","indexOf","_wrapNativeSuper","_cache","Map","undefined","TypeError","has","get","set","Wrapper","_assertThisInitialized","self","ReferenceError","_toPrimitive","input","hint","prim","Symbol","toPrimitive","res","String","Number","arg","getDefaultExportFromCjs","x","__esModule","urlToolkit","URL_REGEX","FIRST_SEGMENT_REGEX","SLASH_DOT_REGEX","SLASH_DOT_DOT_REGEX","URLToolkit","buildAbsoluteURL","baseURL","relativeURL","opts","trim","alwaysNormalize","basePartsForNormalise","parseURL","Error","path","normalizePath","buildURLFromParts","relativeParts","scheme","baseParts","netLoc","pathParts","exec","builtParts","params","query","fragment","baseURLPath","newPath","substring","lastIndexOf","url","parts","split","reverse","join","replace","urlToolkitExports","isFiniteNumber","isFinite","Events","ErrorTypes","ErrorDetails","noop","fakeLogger","trace","debug","log","warn","info","error","exportedLogger","consolePrintFn","type","func","console","exportLoggerFunctions","debugConfig","_len","functions","Array","_key","enableLogs","id","logger","DECIMAL_RESOLUTION_REGEX","ATTR_LIST_REGEX","AttrList","attrs","attr","parseAttrList","clientAttrs","_proto","decimalInteger","attrName","intValue","parseInt","MAX_SAFE_INTEGER","Infinity","hexadecimalInteger","stringValue","slice","Uint8Array","hexadecimalIntegerAsNumber","decimalFloatingPoint","parseFloat","optionalFloat","defaultValue","enumeratedString","bool","decimalResolution","width","height","match","quote","lastIndex","isDateRangeCueAttribute","isSCTE35Attribute","DateRange","dateRangeAttr","dateRangeWithSameId","_startDate","_endDate","_badValueForSameId","previousAttr","ID","Date","endDate","getTime","CLASS","duration","startDate","endOnNext","class","LoadStats","aborted","loaded","retry","total","chunkCount","bwEstimate","loading","start","first","end","parsing","buffering","ElementaryStreamTypes","AUDIO","VIDEO","AUDIOVIDEO","BaseSegment","baseurl","_this$elementaryStrea","_byteRange","_url","relurl","elementaryStreams","setByteRange","previous","byteRange","byteRangeEndOffset","Fragment","_BaseSegment","_this","_decryptdata","rawProgramDateTime","programDateTime","tagList","sn","levelkeys","loader","keyLoader","level","cc","startPTS","endPTS","startDTS","endDTS","deltaPTS","maxStartPTS","minEndPTS","stats","urlId","data","bitrateTest","title","initSegment","endList","gap","_proto2","setKeyFormat","keyFormat","getDecryptData","abortRequests","_this$loader","_this$keyLoader","abort","setElementaryStreamInfo","partial","Math","min","max","clearElementaryStreamInfo","NONE","_key2","identity","keyFormats","_this$_decryptdata","encrypted","len","Part","_BaseSegment2","partAttrs","frag","index","_this2","fragOffset","independent","audio","video","audiovideo","DEFAULT_TARGET_DURATION","LevelDetails","baseUrl","PTSKnown","alignedSliding","averagetargetduration","endCC","endSN","fragments","fragmentHint","partList","dateRanges","live","ageHeader","advancedDateTime","updated","advanced","availabilityDelay","misses","startCC","startSN","startTimeOffset","targetduration","totalduration","m3u8","version","canBlockReload","canSkipUntil","canSkipDateRanges","skippedSegments","recentlyRemovedDateranges","partHoldBack","holdBack","partTarget","preloadHint","renditionReports","tuneInGoal","deltaUpdateFailed","driftStartTime","driftEndTime","driftStart","driftEnd","encryptedFragments","playlistParsingError","variableList","hasVariableRefs","reloaded","partSnDiff","lastPartSn","partIndexDiff","lastPartIndex","floor","runTime","partEnd","fragmentEnd","_this$partList","_this$fragments","now","_this$partList2","_this$partList3","Cues","sliceUint8","array","decoder","isHeader$2","offset","isFooter","getID3Data","front","readSize","subarray","size","canParse$2","getTimeStamp","frames","getID3Frames","frame","isTimeStampFrame","readTimeStamp","getFrameData","fromCharCode","id3Data","frameData","decodeFrame","decodePrivFrame","decodeURLFrame","decodeTextFrame","owner","utf8ArrayToStr","privateData","buffer","description","text","timeStampFrame","byteLength","pts33Bit","timestamp","round","exitOnNull","getTextDecoder","decoded","decode","idx","c","char2","char3","out","TextDecoder","Hex","hexDump","str","h","UINT32_MAX$1","pow","RemuxerTrackIdConfig","id3","bin2str","readUint16","val","readUint32","readSint32","writeUint32","findBox","results","endbox","subresults","parseSegmentIndex","sidx","references","timescale","earliestPresentationTime","firstOffset","startByte","referencesCount","referenceIndex","referenceInfo","referenceSize","subsegmentDuration","parseInitSegment","result","traks","trak","tkhd","_index","trackId","mdhd","hdlr","hdlrType","soun","vide","stsd","codec","trex","track","default","flags","patchEncyptionData","decryptdata","keyId","isCommonEncryption","sampleEntries","encBoxes","isAudio","enc","sinf","tenc","parseSinf","tencKeyId","some","b","schm","getStartDTS","initData","fmp4","reduce","traf","tfdt","tfhd","baseTime","startTime","getDuration","rawDuration","videoDuration","audioDuration","trafs","trackDefault","tfhdFlags","sampleDuration","truns","j","computeRawDurationFromSamples","sidxDuration","sidxs","_i","dur","ref","trun","sampleCount","offsetStartDTS","timeOffset","baseMediaDecodeTime","upper","lower","segmentValidRange","segmentedRange","valid","remainder","moofs","last","byteOffset","appendUint8Array","data1","data2","temp","parseSamples","seiSamples","videoData","samples","isHEVCFlavor","map","moof","moofOffset","defaultSampleDuration","defaultSampleSizePresent","defaultSampleSize","defaultSampleFlagsPresent","tfhdOffset","isHEVC","dataOffsetPresent","dataOffset","firstSampleFlagsPresent","sampleDurationPresent","sampleSizePresent","sampleSize","sampleFlagsPresent","sampleCompositionOffsetsPresent","compositionOffset","trunOffset","sampleOffset","ix","naluTotalSize","naluSize","isSEIMessage","parseSEIMessageFromNALu","delimit","baseCodec","naluHeader","naluType","unescapedData","headerSize","pts","discardEPB","seiPtr","payloadType","payloadSize","endOfCaptions","leftOver","providerCode","userStructure","userDataType","firstByte","enabled","totalBytes","byteArray","bytes","uuidStrArray","_i2","_b","userDataBytes","_i3","uuid","userData","EPBPositions","newLength","newData","sourceIndex","shift","parseEmsg","schemeIdUri","timeScale","presentationTimeDelta","presentationTime","eventDuration","leftPresentationTime","rightPresentationTime","isSafeInteger","payload","LevelKey","method","uri","format","formatversions","iv","keyFormatVersions","pssh","clearKeyUriToKeyIdMap","isSupported","createInitializationVector","segmentNumber","uint8View","getMediaSource","MediaSource","WebKitMediaSource","sampleEntryCodesISO","a3ds","alac","alaw","dra1","dtsc","dtse","dtsh","enca","g719","g726","m4ae","mha1","mha2","mhm1","mhm2","mlpa","mp4a","Opus","opus","samr","sawb","sawp","sevc","sqcp","ssmv","twos","ulaw","avc1","avc2","avc3","avc4","avcp","av01","drac","dva1","dvav","dvh1","dvhe","encv","hev1","hvc1","mjp2","mp4v","mvc1","mvc2","mvc3","mvc4","resv","rv60","s263","svc1","svc2","vp08","vp09","stpp","wvtt","MediaSource$2","isCodecType","typeCodes","isCodecSupportedInMp4","_MediaSource$isTypeSu","isTypeSupported","MASTER_PLAYLIST_REGEX","MASTER_PLAYLIST_MEDIA_REGEX","IS_MEDIA_PLAYLIST","LEVEL_PLAYLIST_REGEX_FAST","RegExp","LEVEL_PLAYLIST_REGEX_SLOW","M3U8Parser","findGroup","groups","mediaGroupId","group","convertAVC1ToAVCOTI","avcdata","resolve","isMediaPlaylist","test","parseMasterPlaylist","string","parsed","contentSteering","levels","sessionData","sessionKeys","levelsWithKnownCodecs","_level$unknownCodecs","bitrate","name","NAME","resolution","setCodecs","CODECS","videoCodec","unknownCodecs","tag","attributes","sessionAttrs","dataId","sessionKey","parseKey","contentSteeringAttributes","pathwayId","parseStartTimeOffset","stripUnknownCodecLevels","parseMasterPlaylistMedia","groupsByType","audioCodec","SUBTITLES","textCodec","TYPE","medias","media","groupId","instreamId","LANGUAGE","autoselect","forced","lang","URI","groupCodec","assignCodec","parseLevelPlaylist","levelUrlId","multivariantVariableList","currentInitSegment","currentSN","currentPart","discontinuityCounter","prevFrag","firstPdtIndex","createNextFrag","setFragLevelKeys","assignProgramDateTime","value1","value2","toUpperCase","skipAttrs","unshift","dateRange","isValid","levelKey","mapAttrs","init","setInitSegment","serverControlAttrs","partInfAttrs","previousFragmentPart","part","preloadHintAttrs","renditionReportAttrs","pop","fragmentLength","firstFragment","lastFragment","lastSn","backfillProgramDateTimes","keyTagAttributes","_keyAttrs$METHOD","_keyAttrs$KEYFORMAT","keyAttrs","decryptmethod","METHOD","decrypturi","decryptiv","decryptkeyformatversions","KEYFORMATVERSIONS","decryptkeyformat","KEYFORMAT","IV","resolvedUri","startAttributes","codecs","filtered","preferred","groupItem","codecProperty","codecValue","fragPrev","parse","endProgramDateTime","BYTERANGE","PlaylistContextType","MANIFEST","LEVEL","AUDIO_TRACK","SUBTITLE_TRACK","PlaylistLevelType","MAIN","SUBTITLE","mapContextToLevelType","context","getResponseUrl","response","PlaylistLoader","hls","loaders","registerListeners","startLoad","startPosition","stopLoad","destroyInternalLoaders","on","MANIFEST_LOADING","onManifestLoading","LEVEL_LOADING","onLevelLoading","AUDIO_TRACK_LOADING","onAudioTrackLoading","SUBTITLE_TRACK_LOADING","onSubtitleTrackLoading","unregisterListeners","off","createInternalLoader","config","PLoader","pLoader","Loader","getInternalLoader","resetInternalLoader","contextType","destroy","event","load","responseType","deliveryDirectives","_context$deliveryDire","loadPolicy","levelDetails","loaderContext","manifestLoadPolicy","playlistLoadPolicy","timeoutRetry","errorRetry","details","audioTracks","subtitleTracks","targetDuration","maxLowLatencyPlaylistRefresh","maxTimeToFirstByteMs","maxLoadTimeMs","legacyRetryCompatibility","loaderConfig","timeout","maxRetry","maxNumRetry","retryDelay","retryDelayMs","maxRetryDelay","maxRetryDelayMs","loaderCallbacks","onSuccess","networkDetails","performance","handleTrackOrLevelPlaylist","handleMasterPlaylist","handleManifestParsingError","onError","handleNetworkError","onTimeout","parsedResult","_M3U8Parser$parseMast","_M3U8Parser$parseMast2","subtitles","captions","audioTrack","trigger","MANIFEST_LOADED","levelId","levelType","singleLevel","handlePlaylistLoaded","ERROR","NETWORK_ERROR","MANIFEST_PARSING_ERROR","fatal","err","reason","message","code","UNKNOWN","MANIFEST_LOAD_TIMEOUT","MANIFEST_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","LEVEL_LOAD_ERROR","AUDIO_TRACK_LOAD_TIMEOUT","AUDIO_TRACK_LOAD_ERROR","SUBTITLE_TRACK_LOAD_TIMEOUT","SUBTITLE_LOAD_ERROR","errorData","parent","levelIndex","LEVEL_PARSING_ERROR","getCacheAge","isNaN","LEVEL_LOADED","AUDIO_TRACK_LOADED","SUBTITLE_TRACK_LOADED","_error","LEVEL_EMPTY_ERROR","sendAddTrackEvent","videoEl","Event","document","createEvent","initEvent","dispatchEvent","clearCurrentCues","mode","cues","removeCue","removeCuesInRange","predicate","getCuesInRange","getFirstCueIndexAfterTime","time","endTime","left","right","mid","cuesFound","firstCueInRange","_cue","MetadataSchema","audioId3","emsg","MIN_CUE_DURATION","getCueClass","WebKitDataCue","VTTCue","TextTrackCue","MAX_CUE_ENDTIME","Cue","POSITIVE_INFINITY","MAX_VALUE","dateRangeDateToTimelineSeconds","date","hexToArrayBuffer","from","ID3TrackController","id3Track","dateRangeCuesAppended","_registerListeners","_unregisterListeners","MEDIA_ATTACHED","onMediaAttached","MEDIA_DETACHING","onMediaDetaching","FRAG_PARSING_METADATA","onFragParsingMetadata","BUFFER_FLUSHING","onBufferFlushing","LEVEL_UPDATED","onLevelUpdated","createTrack","getID3Track","textTracks","textTrack","kind","label","addTextTrack","_this$hls$config","enableEmsgMetadataCues","enableID3MetadataCues","updateId3CueEnds","cue","addCue","_this$id3Track","_ref","startOffset","endOffset","_hls$config","_ref2","hasProgramDateTime","enableDateRangeMetadataCues","ids","idsToRemove","includes","_loop","dateTimeOffset","_loop2","appendedDateRangeCues","durationKnown","nextDateRangeWithSameClass","filterMapArray","candidate","sort","LatencyController","currentTime","stallCount","_latency","timeupdateHandler","timeupdate","addEventListener","removeEventListener","_this$levelDetails","BUFFER_STALLED_ERROR","latency","computeLatency","_this$config","lowLatencyMode","maxLiveSyncPlaybackRate","targetLatency","distanceFromTarget","inLiveRange","maxLatency","forwardBufferLength","rate","exp","edgeStalled","playbackRate","estimateLiveEdge","edge","age","liveEdge","liveMaxLatencyDuration","liveMaxLatencyDurationCount","_this$config2","liveSyncDuration","liveSyncDurationCount","userConfig","maxLiveSyncOnStallIncrease","liveSyncOnStallIncrease","syncPosition","drift","maxLevelUpdateAge","bufferedRanges","buffered","HdcpLevels","HlsSkip","No","Yes","v2","getSkipValue","msn","HlsUrlParameters","skip","addDirectives","URL","searchParams","href","Level","_attrs","codecSet","audioGroupIds","fragmentError","loadError","realBitrate","textGroupIds","_urlId","addFallback","newValue","_this$audioGroupIds","_this$textGroupIds","updateFromToPTS","fragFrom","fragTo","fragToPTS","updateFragPTSDTS","fragStartPts","fragEndPts","abs","fragIdx","mergeDetails","oldDetails","newDetails","oldFragments","oldInit","PTSFrag","ccOffset","mapFragmentIntersection","oldFrag","newFrag","concat","_currentInitSegment","mergeDateRanges","newFragments","mapPartIntersection","oldPart","newPart","adjustSliding","oldDateRanges","deltaDateRanges","JSON","stringify","oldParts","newParts","intersectionFn","delta","_oldPart","_newPart","newFrags","oldFrags","_oldFrag","_newFrag","addSliding","computeReloadInterval","distanceToLiveEdgeMs","reloadInterval","liveEdgeMaxTargetDurations","lastSegmentDuration","getFragmentWithSN","fragCurrent","getPartWith","partIndex","_level$details","findPart","isTimeoutError","FRAG_LOAD_TIMEOUT","KEY_LOAD_TIMEOUT","getRetryConfig","isTimeout","getRetryDelay","retryConfig","retryCount","backoffFactor","backoff","getLoaderConfigWithoutReties","loderConfig","shouldRetry","httpStatus","retryForHttpStatus","navigator","onLine","BinarySearch","search","list","comparisonFn","minIndex","maxIndex","currentIndex","currentElement","comparisonResult","findFragmentByPDT","PDTValue","maxFragLookUpTolerance","isArray","seg","pdtWithinToleranceTest","findFragmentByPTS","fragPrevious","bufferEnd","fragNext","fragmentWithinToleranceTest","foundFragment","candidateLookupTolerance","pdtBufferEnd","findFragWithCC","RENDITION_PENALTY_DURATION_MS","NetworkErrorAction","DoNothing","SendEndCallback","SendAlternateToPenaltyBox","RemoveAlternatePermanently","InsertDiscontinuity","RetryRequest","ErrorActionFlags","None","MoveAllAlternatesMatchingHost","MoveAllAlternatesMatchingHDCP","SwitchToSDR","ErrorController","playlistError","penalizedRenditions","onErrorOut","getVariantLevelIndex","loadLevel","_data$frag","_data$level","FRAG_LOAD_ERROR","KEY_LOAD_ERROR","errorAction","getFragRetryOrSwitchAction","FRAG_PARSING_ERROR","action","FRAG_GAP","FRAG_DECRYPT_ERROR","_data$context","_data$context$levelDe","getPlaylistRetryOrSwitchAction","levelRetry","getLevelSwitchAction","audioGroupId","textGroupId","KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED","_level","restrictedHdcpLevel","hdcpLevel","BUFFER_ADD_CODEC_ERROR","REMUX_ALLOC_ERROR","INTERNAL_EXCEPTION","BUFFER_APPENDING_ERROR","BUFFER_APPEND_ERROR","BUFFER_FULL_ERROR","LEVEL_SWITCH_ERROR","BUFFER_SEEK_OVER_HOLE","BUFFER_NUDGE_ON_STALL","KEY_SYSTEM_ERROR","_levelIndex","_data$response","variantLevelIndex","fragLoadPolicy","keyLoadPolicy","startsWith","fragmentErrors","acc","_data$response2","autoLevelEnabled","_data$frag2","_data$context2","nextLevel","minAutoLevel","maxAutoLevel","fragErrorType","playlistErrorType","playlistErrorGroupId","levelCandidate","fragCandidate","nextAutoLevel","_data$errorAction","sendAlternateToPenaltyBox","resolved","switchLevel","redundantFailover","maxHdcpLevel","nextLoadLevel","redundantLevels","errorUrlId","penalizeRendition","newUrlId","penalizedRendition","checkExpired","lv","v","_ret","lastErrorPerfMs","errors","currentPenaltyState","lastErrorDetails","position","candidateFrag","lastCandidateError","chromeOrFirefox","LevelController","_BasePlaylistControll","contentSteeringController","_levels","_firstLevel","_startLevel","currentLevel","currentLevelIndex","manualLevelIndex","steering","onParsedComplete","onManifestLoaded","onLevelLoaded","LEVELS_UPDATED","onLevelsUpdated","AUDIO_TRACK_SWITCHED","onAudioTrackSwitched","FRAG_LOADED","onFragLoaded","resetLevels","levelFromSet","levelSet","levelParsed","_levelParsed$audioCod","userAgent","FRAMERATE","RESOLUTION","addGroupId","filterAndSortMediaOptions","unfilteredLevels","resolutionFound","videoCodecFound","audioCodecFound","assignTrackIdsByGroup","unsortedLevels","SCORE","firstLevelInPlaylist","filterParsedLevels","audioOnly","edata","firstLevel","altAudio","t","MANIFEST_PARSED","autoStartLoad","forceStartLoad","Promise","then","MEDIA_ERROR","MANIFEST_INCOMPATIBLE_CODECS_ERROR","checkRetry","_ref3","_data$deliveryDirecti2","_data$deliveryDirecti","curLevel","playlistLoaded","canLoad","loadPlaylist","hlsUrlParameters","shouldLoadPlaylist","clearTimer","removeLevel","_this3","filterLevelAndGroupByIdIndex","_ref4","newLevel","OTHER_ERROR","lastLevelIndex","lastLevel","lastPathwayId","levelSwitchingData","maxBitrate","LEVEL_SWITCHING","switchParams","configStartLevel","startLevel","BasePlaylistController","logPrefix","timer","requestScheduled","clearTimeout","playlistUri","foundIndex","_attr","currentGoal","playlist","shouldReloadPlaylist","previousDetails","elapsed","endSn","lastPart","lastAdvanced","cdnAge","segments","toFixed","getDeliveryDirectives","bufferInfo","mainForwardBufferInfo","estimatedTimeUntilUpdate","setTimeout","previousDeliveryDirectives","errorEvent","errorDetails","_ref$retryCount","_errorEvent$context","delay","tracks","FragmentState","NOT_LOADED","APPENDING","PARTIAL","OK","FragmentTracker","activePartLists","endListFragments","timeRanges","bufferPadding","hasGaps","BUFFER_APPENDED","onBufferAppended","FRAG_BUFFERED","onFragBuffered","getAppendedFrag","activeParts","activePart","appendedPTS","getBufferedFrag","fragmentEntity","body","detectEvictedFragments","elementaryStream","timeRange","playlistType","appendedPart","appendedPartSn","esData","range","isNotBuffered","isTimeBuffered","removeFragment","detectPartialFragments","fragKey","getFragmentKey","isFragHint","streamInfo","getBufferedTimes","isPartial","removeParts","snToKeep","fragBuffered","force","getPartialFragment","timePadding","bestFragment","bestOverlap","isEndListAppended","lastFragmentEntity","getState","hasFragment","hasParts","_this$activePartLists","removeFragmentsInRange","withGapOnly","unbufferedOnly","_this4","snToRemove","removeAllFragments","_fragmentEntity$range","_fragmentEntity$range2","_fragmentEntity$range3","MIN_CHUNK_SIZE","FragmentLoader","partLoadTimeout","_onProgress","reject","LoadError","FragmentILoader","fLoader","DefaultILoader","tags","createGapLoadError","createLoaderContext","highWaterMark","resetLoader","resetIV","onAbort","INTERNAL_ABORTED","onProgress","loadPart","updateStatsFromPart","partLoadedData","fragStats","partStats","partTotal","estTotalParts","estLoadedParts","estRemainingBytes","fragLoading","partLoading","segment","headers","rangeStart","rangeEnd","byteRangeStartOffset","_frag$decryptdata","byteRangeStart","byteRangeEnd","fragmentLen","_Error","KeyLoader","keyUriToKeyInfo","emeController","detach","keyInfo","mediaKeySessionContext","createKeyLoadError","loadClear","loadingFrag","emeEnabled","selectKeySystemFormat","keySystemFormat","loadInternal","_keyInfo","_keyInfo2","_keyInfo$mediaKeySess","keyLoadPromise","keyStatus","keyLoadedData","loadKeyHTTP","loadKeyEME","keySessionContextPromise","loadKey","keySessionContext","catch","TaskLoop","_boundTick","_tickTimer","_tickInterval","_tickCallCount","tick","onHandlerDestroying","onHandlerDestroyed","clearNextTick","clearInterval","hasInterval","hasNextTick","setInterval","millis","doTick","tickImmediate","noopBuffered","BufferHelper","isBuffered","getBuffered","pos","maxHoleDuration","vbuffered","bufferedInfo","nextStart","diff","buffered2","buf2len","buf2end","bufferStartNext","bufferLen","bufferStart","ChunkMetadata","transmuxing","getNewPerformanceTiming","executeStart","executeEnd","findFirstFragWithCC","firstFrag","currentFrag","shouldAlignOnDiscontinuities","lastFrag","findDiscontinuousReferenceFrag","prevDetails","curDetails","prevFrags","curFrags","prevStartFrag","adjustFragmentStart","sliding","adjustSlidingStart","alignStream","alignDiscontinuities","alignPDT","referenceFrag","lastDetails","lastPDT","newPDT","AESCrypto","subtle","aesIV","decrypt","FastAESKey","expandKey","importKey","removePadding","outputBytes","paddingBytes","DataView","getUint8","AESDecryptor","rcon","subMix","Uint32Array","invSubMix","sBox","invSBox","ksRows","keySize","keySchedule","invKeySchedule","initTable","uint8ArrayToUint32Array_","arrayBuffer","view","newArray","getUint32","subMix0","subMix1","subMix2","subMix3","invSubMix0","invSubMix1","invSubMix2","invSubMix3","d","xi","sx","x2","x4","x8","keyBuffer","sameKey","ksRow","invKsRow","prev","sbox","networkToHostOrderSwap","word","inputArrayBuffer","t0","t1","t2","t3","s0","s1","s2","s3","inputWords0","inputWords1","inputWords2","inputWords3","nRounds","invSBOX","initVector","initVector0","initVector1","initVector2","initVector3","inputInt32","Int32Array","outputInt32","swapWord","CHUNK_SIZE","Decrypter","_temp","_ref$removePKCS7Paddi","removePKCS7Padding","logEnabled","softwareDecrypter","fastAesKey","remainderData","currentIV","currentResult","useSoftware","enableSoftwareAES","browserCrypto","crypto","webkitSubtle","isSync","flush","reset","softwareDecrypt","decryptResult","webCryptoDecrypt","logOnce","currentChunk","getValidChunk","aesKey","onWebCryptoError","splitPoint","msg","TimeRanges","r","State","STOPPED","IDLE","KEY_LOADING","FRAG_LOADING","FRAG_LOADING_WAITING_RETRY","WAITING_TRACK","PARSING","PARSED","ENDED","WAITING_INIT_PTS","WAITING_LEVEL","BaseStreamController","_TaskLoop","fragmentTracker","transmuxer","_state","mediaBuffer","lastCurrentTime","nextLoadPosition","loadedmetadata","retryDate","fragmentLoader","levelLastLoaded","startFragRequested","decrypter","initPTS","onvseeking","onvended","onTickEnd","resetTransmuxer","state","_streamEnded","getLevelDetails","_this$levels$this$lev","onMediaSeeking","onMediaEnded","ended","maxBufferHole","resetLoadingState","tolerance","fragStartOffset","fragEndOffset","pastFragment","loadFragment","targetBufferTime","_loadFragForPlayback","progressCallback","fragContextChanged","_handleFragmentLoadProgress","_doFragLoad","_handleFragmentLoadComplete","resetFragmentLoading","clearTrackerIfNeeded","_this$mediaBuffer","getFwdBufferInfo","minForwardBufferLength","maxBufferLength","reduceMaxBufferLength","checkLiveUpdate","flushMainBuffer","flushScope","_loadInitSegment","decryptData","decryptedData","FRAG_DECRYPTED","tstart","tdecrypt","fragBufferedComplete","_frag$startPTS","_frag$endPTS","_this$fragCurrent","_this$fragPrevious","NaN","seekToStartPos","fragLoadedEndData","partsLoaded","complete","fragLoaded","chunkMeta","keyLoadingPromise","KEY_LOADED","getNextPart","_result","doFragPartsLoad","handleFragLoadError","loadedEndOfParts","dataOnProgress","progressive","all","fragLoadedData","fromPart","_this5","initialPartList","loadedPart","nextPart","handleFragLoadAborted","_handleTransmuxerFlush","getCurrentContext","updateLevelTiming","bufferFragmentData","noBacktracking","_buffer","BUFFER_APPENDING","dropped","flushBufferGap","fragDuration","segmentFraction","bufferable","getLoadPosition","getFwdBufferInfoAtPos","bufferedFragAtPos","getMaxBufferLength","levelBitrate","maxBufLen","maxBufferSize","maxMaxBufferLength","threshold","minLength","fragOrPart","getNextFragment","fragLen","initialLiveManifestSize","getInitialLiveFragment","liveSyncPosition","getFragmentAtPosition","mapToInitFragWhenRequired","isLoopLoading","trackerState","getNextFragmentLoopLoading","gapStart","nextFragment","nextbufferInfo","contiguous","independentAttrOmitted","targetSN","liveStart","loadingParts","curSNIdx","fragState","nextFrag","synchronizeToLiveEdge","withinSlidingWindow","readyState","alignPlaylists","slidingStart","firstLevelLoad","aligned","alignedSlidingStart","waitForCdnTuneIn","advancePartLimit","setStartPosition","offsetInMultivariantPlaylist","onFragmentOrKeyLoadError","filterType","_this$fragCurrent2","gapTagEncountered","_ref2$retryCount","_this$levelLastLoaded","resetStartWhenNotLoaded","resetFragmentErrors","reduceLengthAndFlushBuffer","flushBuffer","afterBufferFlushed","bufferType","bufferedTimeRanges","resetWhenMissingContext","_this$levelLastLoaded2","removeUnbufferedFrags","_this$transmuxer","_this6","parsedDuration","LEVEL_PTS_UPDATED","FRAG_PARSED","recoverWorkerError","_this$levelLastLoaded3","_this$fragCurrent3","nextState","previousState","getSourceBuffer","SourceBuffer","WebKitSourceBuffer","mediaSource","sourceBuffer","sourceBufferValidAPI","appendBuffer","remove","changeTypeSupported","_sourceBuffer$prototy","changeType","dummyTrack","inputTimeScale","pid","sequenceNumber","BaseAudioDemuxer","_audioTrack","_id3Track","frameIndex","cachedData","basePTS","lastPTS","resetInitSegment","trackDuration","resetTimeStamp","deaultTimestamp","resetContiguity","canParse","appendFrame","demux","lastDataIndex","initPTSFn","dts","sample","partialData","videoTrack","demuxSampleAes","keyData","getAudioConfig","observer","adtsObjectType","adtsExtensionSamplingIndex","adtsChannelConfig","toLowerCase","manifestCodec","adtsSamplingRates","adtsSamplingIndex","samplerate","channelCount","isHeaderPattern$1","getHeaderLength","getFullFrameLength","canGetFrameLength","isHeader$1","canParse$1","probe$1","headerLength","frameLength","newOffset","initTrackConfig","getFrameDuration","parseFrameHeader","appendFrame$1","unit","stamp","header","_length","missing","_sample","AACDemuxer","_BaseAudioDemuxer","container","segmentCodec","probe","emsgSchemePattern","MP4Demuxer","txtTrack","captionTrack","_initData$video","_initData$audio","_id","_timescale","_codec","videoSamples","segmentedData","extractID3Track","emsgs","emsgInfo","chromeVersion$1","BitratesMap","SamplingRateMap","SamplesCoefficients","BytesInSlot","parseHeader","samplesPerFrame","sampleRate","mpegVersion","mpegLayer","bitRateIndex","sampleRateIndex","paddingBit","channelMode","bitRate","sampleCoefficient","bytesInSlot","isHeaderPattern","isHeader","ExpGolomb","bytesAvailable","bitsAvailable","loadWord","workingBytes","availableBytes","skipBits","count","skipBytes","readBits","bits","valu","skipLZ","leadingZeroCount","skipUEG","skipEG","readUEG","clz","readEG","readBoolean","readUByte","readUShort","readUInt","skipScalingList","lastScale","nextScale","readSPS","numRefFramesInPicOrderCntCycle","scalingListCount","frameCropLeftOffset","frameCropRightOffset","frameCropTopOffset","frameCropBottomOffset","profileIdc","chromaFormatIdc","picOrderCntType","picWidthInMbsMinus1","picHeightInMapUnitsMinus1","frameMbsOnlyFlag","pixelRatio","ceil","readSliceType","SampleAesDecrypter","decryptBuffer","encryptedData","decryptAacSample","sampleIndex","callback","curUnit","encryptedBuffer","decryptedBuffer","decryptAacSamples","getAvcEncryptedData","decodedData","encryptedDataLen","Int8Array","outputPos","inputPos","getAvcDecryptedUnit","uint8DecryptedData","decryptAvcSample","unitIndex","decryptAvcSamples","curUnits","units","PACKET_LENGTH","TSDemuxer","typeSupported","sampleAes","pmtParsed","_duration","_pmtId","_avcTrack","_txtTrack","aacOverFlow","avcSample","syncOffset","scanwindow","foundPat","packetStart","tsPackets","parsePID","pesData","isSampleAes","pes","avcId","avcData","audioId","id3Id","audioData","unknownPID","pmtId","tsPacketErrors","stt","parsePES","parseAVCPES","parseAACPES","parseMPEGPES","parseID3PES","parsePAT","parsedPIDs","parsePMT","avc","emit","demuxResult","extractRemainingSamples","parseAVCNALu","spsfound","audFound","pushAccessUnit","createAVCSample","_avcSample2","iskey","_avcSample","sliceType","sps","codecarray","codecstring","pps","getLastNalUnit","_avcSample3","lastUnit","overflow","naluState","lastState","lastUnitStart","lastUnitType","tmp","_unit","_lastUnit","_tmp","frameMissingBytes","sampleLength","frameOverflowBytes","recoverable","frameDuration","id3Sample","tableEnd","mpeg","mp3","stream","pesLen","pesHdrLen","pesPts","pesDts","splice","pesFlags","payloadStartOffset","dataLen","avcTrack","nbSamples","lastSample","MP3Demuxer","AAC","getSilentFrame","UINT32_MAX","MP4","types","avcC","btrt","dinf","dref","esds","ftyp","mdat","mdia","mfhd","minf","moov","mvex","mvhd","pasp","sdtp","stbl","stco","stsc","stsz","stts","vmhd","smhd","charCodeAt","videoHdlr","audioHdlr","HDLR_TYPES","STTS","STSC","STCO","STSZ","VMHD","SMHD","STSD","majorBrand","avc1Brand","minorVersion","FTYP","box","DINF","upperWordDuration","lowerWordDuration","boxes","dependsOn","isDependedOn","hasRedundancy","avcc","hSpacing","vSpacing","configlen","sampleDependencyTable","upperWordBaseMediaDecodeTime","lowerWordBaseMediaDecodeTime","cts","arraylen","isLeading","paddingValue","isNonSync","degradPrio","movie","MPEG_TS_CLOCK_FREQ_HZ","toTimescaleFromBase","destScale","srcBase","toMsFromMpegTsClock","MAX_SILENT_FRAME_DURATION","AAC_SAMPLES_PER_FRAME","MPEG_AUDIO_SAMPLE_PER_FRAME","chromeVersion","safariWebkitVersion","MP4Remuxer","vendor","ISGenerated","_initPTS","_initDTS","nextAvcDts","nextAudioPts","videoSampleDuration","isAudioContiguous","isVideoContiguous","defaultTimeStamp","resetNextTimestamp","getVideoStartPts","rolloverDetected","minPTS","normalizePts","remux","accurateTimeOffset","audioTimeOffset","videoTimeOffset","hasAudio","hasVideo","enoughAudioSamples","enoughVideoSamples","generateIS","firstKeyFramePTS","firstKeyFrameIndex","findKeyframeIndex","forceKeyFrameOnDiscontinuity","_startPTS","audiovideoTimestampDelta","remuxAudio","audioTrackLength","remuxVideo","firstKeyFrame","flushTextTrackMetadataCueSamples","flushTextTrackUserdataCueSamples","initDTS","audioSamples","computePTSDTS","metadata","firstDTS","lastDTS","inputSamples","outputSamples","mp4SampleDuration","maxPTS","NEGATIVE_INFINITY","sortSamples","initTime","deltadts","deltapts","inputDuration","averageSampleDuration","foundHole","foundOverlap","firstPTS","nbNalu","naluLen","nbUnits","sampleLen","mdatSize","MUX_ERROR","setUint32","stretchedLastFrame","minDtsDelta","minPtsDelta","maxDtsDelta","maxPtsDelta","avcSampleUnits","mp4SampleLength","_j","_nbUnits","unitData","unitDataLen","ptsDelta","lastFrameDuration","stretchShortVideoTrack","gapTolerance","deltaToFrameEnd","compositionTimeOffset","Mp4Sample","nextDts","_pts","nextPts","nb","scaleFactor","inputSampleDuration","rawMPEG","alignedWithVideo","timeOffsetMpegTS","maxAudioFramesDrift","newStamp","fillFrame","_j2","_nbSamples","audioSample","_pts2","unitLen","remuxEmptyAudio","init90kHz","silentFrame","reference","isKeyframe","Mp4SampleFlags","PassThroughRemuxer","emitInitSegment","initTracks","lastEndTime","defaultInitPTS","generateInitSegment","getParsedTrackCodec","_initData","_initData2","decodeTime","isInvalidInitPts","minDuration","parsedCodec","muxConfig","Transmuxer","async","demuxer","remuxer","decryptionPromise","transmuxConfig","currentTransmuxState","configure","uintData","discontinuity","trackSwitch","initSegmentChange","defaultInitPts","initSegmentData","getEncryptionType","getDecrypter","emptyResult","resetMuxers","needsProbing","configureTransmuxer","resetInitialTimestamp","transmux","currentState","transmuxResults","demuxResultOrPromise","isPromise","flushRemux","_this$currentTransmux","remuxResult","transmuxSampleAes","transmuxUnencrypted","_demux","mux","Remuxer","Demuxer","encryptionType","TransmuxConfig","TransmuxState","eventemitter3","prefix","EE","once","addListener","emitter","listener","evt","_events","_eventsCount","clearEvent","EventEmitter","eventNames","events","names","listeners","handlers","l","ee","listenerCount","a1","a2","a3","a4","a5","removeListener","removeAllListeners","prefixed","startWorker","forwardMessage","ev","postMessage","forwardWorkerLogs","logFn","logType","cmd","transmuxResult","emitTransmuxComplete","_transmuxResult","handleFlushResult","isEmptyResult","transferable","_transmuxResult$remux","addToTransferable","hasUMDWorker","injectWorker","blob","Blob","objectURL","createObjectURL","worker","Worker","loadWorker","scriptURL","location","MediaSource$1","TransmuxerInterface","onTransmuxComplete","onFlush","useWorker","workerContext","onwmsg","enableWorker","mp4","workerPath","onWorkerMessage","onerror","filename","lineno","resetWorker","_this$workerContext","revokeObjectURL","terminate","_frag$initSegment","_lastFrag$initSegment","snDiff","partDiff","ArrayBuffer","handleTransmuxComplete","transmuxerError","_transmuxResult2","_this$workerContext2","STALL_MINIMUM_DURATION_MS","MAX_START_GAP_JUMP","SKIP_BUFFER_HOLE_STEP_SECONDS","SKIP_BUFFER_RANGE_START","GapController","nudgeRetry","stallReported","stalled","moved","seeking","poll","activeFrag","seeked","beginSeek","paused","hasEnoughBuffer","noBufferGap","startJump","maxStartGapJump","partialOrGap","_trySkipBufferHole","tnow","stalledDuration","_reportStall","bufferedWithHoles","_tryFixBufferStall","_stalledDuration","stalledDurationMs","highBufferWatchdogPeriod","_tryNudgeBuffer","bufferStarved","waiting","gapLength","startGap","startFrag","startProvisioned","moreToLoad","provisioned","targetTime","nudgeMaxRetry","nudgeOffset","TICK_INTERVAL","StreamController","_BaseStreamController","audioCodecSwap","gapController","_forceStartLoad","fragPlaying","onvplaying","onvseeked","fragLastKbps","couldBacktrack","backtrackFragment","audioCodecSwitch","videoBuffer","onManifestParsed","FRAG_LOAD_EMERGENCY_ABORTED","onFragLoadEmergencyAborted","AUDIO_TRACK_SWITCHING","onAudioTrackSwitching","BUFFER_CREATED","onBufferCreated","BUFFER_FLUSHED","onBufferFlushed","testBandwidth","_levels$level","_this$media","doTickIdle","checkBuffer","checkFragmentChanged","startFragPrefetch","levelInfo","getMainFwdBufferInfo","BUFFER_EOS","manualLevel","_this$backtrackFragme","backtrackFrag","_loadBitrateTestFrag","followingBufferedFrag","immediateLevelSwitch","abortCurrentFrag","nextLevelSwitch","fetchdelay","fragPlayingCurrent","bufferedFrag","nextBufferedFrag","maxStart","startPts","onMediaPlaying","onMediaSeeked","BUFFER_RESET","aac","heaac","_curLevel$details","newLevelId","_getAudioCodec","_handleTransmuxComplete","fromAltAudio","mediaTrack","alternate","swapAudioCodec","defaultAudioCodec","_id3$samples","mapFragment","_bufferInitSegment","FRAG_PARSING_INIT_SEGMENT","INIT_PTS_FOUND","isFirstFragment","isFirstInDiscontinuity","backtrack","_endPTS","_startDTS","_endDTS","emittedID3","emittedText","FRAG_PARSING_USERDATA","ua","levelCodec","BUFFER_CODECS","trackName","fragCurrentLevel","FRAG_CHANGED","LEVEL_SWITCHED","epocMs","EWMA","halfLife","estimate","weight","alpha_","estimate_","totalWeight_","adjAlpha","getTotalWeight","getEstimate","zeroFactor","EwmaBandWidthEstimator","slow","fast","defaultEstimate","defaultTTFB","defaultEstimate_","minWeight_","minDelayMs_","slow_","fast_","defaultTTFB_","ttfb_","update","durationMs","numBytes","durationS","bandwidthInBps","sampleTTFB","ttfb","seconds","sqrt","canEstimate","getEstimateTTFB","AbrController","lastLevelLoadSec","lastLoadedFragLevel","_nextAutoLevel","onCheck","_abandonRulesCheck","partCurrent","bitrateTestDelay","bwEstimator","abrEwmaSlowVoD","abrEwmaFastVoD","abrEwmaDefaultEstimate","onFragLoading","onLevelSwitching","_data$part","ignoreFragment","getTimeToLoadFrag","timeToFirstByteSec","bandwidth","fragSizeBits","isSwitch","_data$stats","abrEwmaSlowLive","abrEwmaFastLive","timeLoading","ttfbEstimate","bufferStarvationDelay","loadedFirstByte","expectedLen","timeStreaming","loadRate","fragLoadedDelay","bwe","fragLevelNextLoadedDelay","levelNextBitrate","abrMaxWithRealBitrate","loadedBytes","loadedDuration","fragBufferedData","processingMs","getNextABRAutoLevel","currentFragDuration","avgbw","bestLevel","findBestLevel","abrBandWidthFactor","abrBandWidthUpFactor","maxStarvationDelay","bwFactor","bwUpFactor","maxLoadingDelay","currentBw","maxFetchDuration","currentCodecSet","ttfbEstimateSec","levelSkippedMin","levelSkippedMax","avgDuration","adjustedbw","fetchDuration","forcedAutoLevel","nextABRAutoLevel","BufferOperationQueue","sourceBufferReference","buffers","queues","append","operation","queue","executeNext","insertAbort","appendBlocker","execute","promise","onStart","onComplete","sb","updating","shiftAndExecuteNext","current","VIDEO_CODEC_PROFILE_REPACE","BufferController","_objectUrl","operationQueue","bufferCodecEventsExpected","_bufferCodecEventsTotal","lastMpegAudioChunk","appendError","pendingTracks","_onMediaSourceOpen","_onMediaEmptied","updateMediaElementDuration","checkPendingTracks","_onMediaSourceClose","_onMediaSourceEnded","src","_initSourceBuffer","hasSourceTypes","getSourceBufferTypes","MEDIA_ATTACHING","onMediaAttaching","onBufferReset","onBufferAppending","onBufferCodecs","onBufferEos","onFragParsed","onFragChanged","codecEvents","ms","endOfStream","removeAttribute","MEDIA_DETACHED","removeBufferListeners","removeSourceBuffer","sourceBufferCount","_data$trackName","currentCodec","nextCodec","mimeType","appendChangeType","eventData","chunkStats","bufferAppendingStart","fragBuffering","partBuffering","checkTimestampOffset","fragStart","timestampOffset","appendExecutor","_type","DOMException","QUOTA_EXCEEDED_ERR","appendErrorMaxRetry","flushOperation","removeExecutor","_this7","buffersAppendedTo","onUnblocked","blockBuffers","flushBackBuffer","_this8","ending","sourceBufferTypes","backBufferLength","liveBackBufferLength","levelTargetDuration","maxBackBufferLength","targetBackBufferPosition","BACK_BUFFER_REACHED","LIVE_BACK_BUFFER_REACHED","levelDuration","mediaDuration","msDuration","liveDurationInfinity","updateSeekableRange","setLiveSeekableRange","pendingTracksCount","createSourceBuffers","BUFFER_INCOMPATIBLE_CODECS_ERROR","addSourceBuffer","sbName","addBufferListener","_onSBUpdateStart","_onSBUpdateEnd","_onSBUpdateError","removeStart","removeEnd","_this9","blockingOperations","CapLevelController","autoLevelCapping","restrictedLevels","clientRect","streamController","setStreamController","unregisterListener","capLevelToPlayerSize","stopCapping","FPS_DROP_LEVEL_CAPPING","onFpsDropLevelCapping","droppedLevel","isLevelAllowed","HTMLVideoElement","startCapping","detectPlayerSize","mediaHeight","mediaWidth","getMaxLevel","capLevelIndex","validLevels","getMaxLevelByMediaSize","getDimensions","boundsRect","getBoundingClientRect","bottom","top","restrictedLevel","atGreatestBandwidth","maxLevelIndex","contentScaleFactor","ignoreDevicePixelRatio","devicePixelRatio","FPSController","isVideoPlaybackQualityAvailable","lastTime","lastDroppedFrames","lastDecodedFrames","capLevelOnFPSDrop","getVideoPlaybackQuality","checkFPSInterval","fpsDroppedMonitoringPeriod","checkFPS","decodedFrames","droppedFrames","currentPeriod","currentDropped","currentDecoded","droppedFPS","FPS_DROP","totalDroppedFrames","fpsDroppedMonitoringThreshold","videoPlaybackQuality","totalVideoFrames","droppedVideoFrames","webkitDecodedFrameCount","webkitDroppedFrameCount","AGE_HEADER_LINE_REGEX","XhrLoader","xhrSetup","requestTimeout","retryTimeout","callbacks","abortInternal","onreadystatechange","onprogress","_this$callbacks","xhr","XMLHttpRequest","open","openAndSendXhr","status","_config$loadPolicy","setRequestHeader","readystatechange","loadprogress","loadtimeout","send","_status","useResponse","responseText","responseURL","statusText","lengthComputable","getAllResponseHeaders","getResponseHeader","ChunkCache","chunks","dataLength","chunk","concatUint8Arrays","fetchSupported","fetch","AbortController","ReadableStream","Request","FetchLoader","fetchSetup","request","controller","getRequest","ok","initParams","getRequestParameters","signal","isArrayBuffer","LENGTH","FetchError","getContentLength","loadProgressively","json","responseData","loaderResponse","chunkCache","reader","getReader","pump","read","done","credentials","Headers","getByteRangeLength","byteRangeHeader","contentRange","byteRangeLength","contentLength","defaultLoadPolicy","hlsDefaultConfig","licenseXhrSetup","licenseResponseCallback","abrController","bufferController","capLevelController","errorController","fpsController","minAutoBitrate","widevineLicenseUrl","drmSystems","drmSystemOptions","requestMediaKeySystemAccessFunc","cmcd","certLoadPolicy","steeringManifestLoadPolicy","manifestLoadingTimeOut","manifestLoadingMaxRetry","manifestLoadingRetryDelay","manifestLoadingMaxRetryTimeout","levelLoadingTimeOut","levelLoadingMaxRetry","levelLoadingRetryDelay","levelLoadingMaxRetryTimeout","fragLoadingTimeOut","fragLoadingMaxRetry","fragLoadingRetryDelay","fragLoadingMaxRetryTimeout","timelineConfig","subtitleStreamController","subtitleTrackController","timelineController","audioStreamController","audioTrackController","cmcdController","cueHandler","enableWebVTT","enableIMSC1","enableCEA708Captions","captionsTextTrack1Label","captionsTextTrack1LanguageCode","captionsTextTrack2Label","captionsTextTrack2LanguageCode","captionsTextTrack3Label","captionsTextTrack3LanguageCode","captionsTextTrack4Label","captionsTextTrack4LanguageCode","renderTextTracksNatively","mergeConfig","defaultConfig","defaultsCopy","deepCpy","deprecatedSettings","policyName","policyNotSet","report","setting","deprecatedSetting","settings","enableStreamingMode","currentLoader","Hls","coreComponents","networkControllers","_emitter","_autoLevelCapping","_maxHdcpLevel","latencyController","levelController","_media","DefaultConfig","ConfigAbrController","ConfigBufferController","ConfigCapLevelController","ConfigErrorController","ConfigFpsController","playListLoader","id3TrackController","ConfigContentSteeringController","createController","AudioStreamControllerClass","SubtitleStreamControllerClass","ControllerClass","components","controllerInstance","eventObject","DESTROYING","detachMedia","component","attachMedia","loadSource","loadedSource","loadingSource","recoverMediaError","shouldStartCapping","newCapLevelToPlayerSize","currentProgramDateTime","audioTrackId","subtitleTrack","subtitleTrackId","subtitleDisplay","factory"],"sourceRoot":""}
|