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D,IAIA,WACE,MAAO,QACT,GACC,CACDhD,IAAK,SACLgD,IAAK,WACH,OAAOsD,CACT,GACC,CACDtG,IAAK,aACLgD,IAAK,WACH,OAAOuD,CACT,GACC,CACDvG,IAAK,eACLgD,IAAK,WACH,OAAOwD,CACT,GAKC,CACDxG,IAAK,gBACLgD,IAAK,WACH,OAAKkkG,EAAI7oC,cAGF6oC,EAAI7oC,cAFFzE,EAGX,EAKA32D,IAAK,SAAao7D,GAChB6oC,EAAI7oC,cAAgBA,CACtB,KAEK6oC,CACT,CAt4BuB,GAy4BvB,OAFAA,GAAI7oC,mBAAgB,EAEb6oC,EAER,CApnpBiF+C,EAqnpBjF,CAvnpBD,EAunpBG,E","sources":["webpack://sakurairo-scripts/./node_modules/.pnpm/hls.js@1.5.15/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(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n }\n function _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n }\n function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : String(i);\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 try {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n } catch (e) {\n return typeof fn === \"function\";\n }\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\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 // https://caniuse.com/mdn-javascript_builtins_number_isfinite\n var isFiniteNumber = Number.isFinite || function (value) {\n return typeof value === 'number' && isFinite(value);\n };\n\n // https://caniuse.com/mdn-javascript_builtins_number_issafeinteger\n var isSafeInteger = Number.isSafeInteger || function (value) {\n return typeof value === 'number' && Math.abs(value) <= MAX_SAFE_INTEGER;\n };\n var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;\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[\"MAX_AUTO_LEVEL_UPDATED\"] = \"hlsMaxAutoLevelUpdated\";\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 Events[\"STEERING_MANIFEST_LOADED\"] = \"hlsSteeringManifestLoaded\";\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 (typeof console === 'object' && 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.5.15\");\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 _extends(this, attrs);\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 _createClass(AttrList, [{\n key: \"clientAttrs\",\n get: function get() {\n return Object.keys(this).filter(function (attr) {\n return attr.substring(0, 2) === 'X-';\n });\n }\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 function BaseSegment(baseurl) {\n var _this$elementaryStrea;\n this._byteRange = null;\n this._url = null;\n // baseurl is the URL to the playlist\n this.baseurl = void 0;\n // relurl is the portion of the URL that comes from inside the playlist.\n this.relurl = void 0;\n // Holds the types of data this fragment supports\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 start;\n if (params.length === 1) {\n start = (previous == null ? void 0 : previous.byteRangeEndOffset) || 0;\n } else {\n start = parseInt(params[1]);\n }\n this._byteRange = [start, parseInt(params[0]) + start];\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 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 // EXTINF has to be present for a m3u8 to be considered valid\n _this.duration = 0;\n // sn notates the sequence number for a segment, and if set to a string can be 'initSegment'\n _this.sn = 0;\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 _this.levelkeys = void 0;\n // A string representing the fragment type\n _this.type = void 0;\n // A reference to the loader. Set while the fragment is loading, and removed afterwards. Used to abort fragment loading\n _this.loader = null;\n // A reference to the key loader. Set while the key is loading, and removed afterwards. Used to abort key loading\n _this.keyLoader = null;\n // The level/track index to which the fragment belongs\n _this.level = -1;\n // The continuity counter of the fragment\n _this.cc = 0;\n // The starting Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.\n _this.startPTS = void 0;\n // The ending Presentation Time Stamp (PTS) of the fragment. Set after transmux complete.\n _this.endPTS = void 0;\n // The starting Decode Time Stamp (DTS) of the fragment. Set after transmux complete.\n _this.startDTS = void 0;\n // The ending Decode Time Stamp (DTS) of the fragment. Set after transmux complete.\n _this.endDTS = void 0;\n // The start time of the fragment, as listed in the manifest. Updated after transmux complete.\n _this.start = 0;\n // Set by `updateFragPTSDTS` in level-helper\n _this.deltaPTS = void 0;\n // The maximum starting Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.\n _this.maxStartPTS = void 0;\n // The minimum ending Presentation Time Stamp (audio/video PTS) of the fragment. Set after transmux complete.\n _this.minEndPTS = void 0;\n // Load/parse timing information\n _this.stats = new LoadStats();\n // Init Segment bytes (unset for media segments)\n _this.data = void 0;\n // A flag indicating whether the segment was downloaded in order to test bitrate, and was not buffered\n _this.bitrateTest = false;\n // #EXTINF segment title\n _this.title = null;\n // The Media Initialization Section for this segment\n _this.initSegment = null;\n // Fragment is the last fragment in the media playlist\n _this.endList = void 0;\n // Fragment is marked by an EXT-X-GAP tag indicating that it does not contain media data and should not be loaded\n _this.gap = void 0;\n // Deprecated\n _this.urlId = 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 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 // Manifest reload synchronization\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 // On Play Station 4, TextDecoder is defined but partially implemented.\n // Manual decoding option is preferable\n if (navigator.userAgent.includes('PlayStation 4')) {\n return;\n }\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 readUint64(buffer, offset) {\n var result = readUint32(buffer, offset);\n result *= Math.pow(2, 32);\n result += readUint32(buffer, offset + 4);\n return result;\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 \"moof\" box\n function hasMoofData(data) {\n var end = data.byteLength;\n for (var i = 0; i < end;) {\n var size = readUint32(data, i);\n if (size > 8 && data[i + 4] === 0x6d && data[i + 5] === 0x6f && data[i + 6] === 0x6f && data[i + 7] === 0x66) {\n return true;\n }\n i = size > 1 ? i + size : end;\n }\n return false;\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 var earliestPresentationTime = 0;\n var firstOffset = 0;\n if (version === 0) {\n earliestPresentationTime = readUint32(sidx, index);\n firstOffset = readUint32(sidx, index + 4);\n index += 8;\n } else {\n earliestPresentationTime = readUint64(sidx, index);\n firstOffset = readUint64(sidx, index + 8);\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 trackId = readUint32(tkhd, version === 0 ? 12 : 20);\n var mdhd = findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n version = mdhd[0];\n var timescale = readUint32(mdhd, version === 0 ? 12 : 20);\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 stsdData = parseStsd(stsd);\n result[trackId] = {\n timescale: timescale,\n type: type\n };\n result[type] = _objectSpread2({\n timescale: timescale,\n id: trackId\n }, stsdData);\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 parseStsd(stsd) {\n var sampleEntries = stsd.subarray(8);\n var sampleEntriesEnd = sampleEntries.subarray(8 + 78);\n var fourCC = bin2str(sampleEntries.subarray(4, 8));\n var codec = fourCC;\n var encrypted = fourCC === 'enca' || fourCC === 'encv';\n if (encrypted) {\n var encBox = findBox(sampleEntries, [fourCC])[0];\n var encBoxChildren = encBox.subarray(fourCC === 'enca' ? 28 : 78);\n var sinfs = findBox(encBoxChildren, ['sinf']);\n sinfs.forEach(function (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 var frma = findBox(sinf, ['frma'])[0];\n if (frma) {\n // for encrypted content codec fourCC will be in frma\n codec = bin2str(frma);\n }\n }\n }\n });\n }\n switch (codec) {\n case 'avc1':\n case 'avc2':\n case 'avc3':\n case 'avc4':\n {\n // extract profile + compatibility + level out of avcC box\n var avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];\n codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);\n break;\n }\n case 'mp4a':\n {\n var codecBox = findBox(sampleEntries, [fourCC])[0];\n var esdsBox = findBox(codecBox.subarray(28), ['esds'])[0];\n if (esdsBox && esdsBox.length > 12) {\n var i = 4;\n // ES Descriptor tag\n if (esdsBox[i++] !== 0x03) {\n break;\n }\n i = skipBERInteger(esdsBox, i);\n i += 2; // skip es_id;\n var flags = esdsBox[i++];\n if (flags & 0x80) {\n i += 2; // skip dependency es_id\n }\n if (flags & 0x40) {\n i += esdsBox[i++]; // skip URL\n }\n // Decoder config descriptor\n if (esdsBox[i++] !== 0x04) {\n break;\n }\n i = skipBERInteger(esdsBox, i);\n var objectType = esdsBox[i++];\n if (objectType === 0x40) {\n codec += '.' + toHex(objectType);\n } else {\n break;\n }\n i += 12;\n // Decoder specific info\n if (esdsBox[i++] !== 0x05) {\n break;\n }\n i = skipBERInteger(esdsBox, i);\n var firstByte = esdsBox[i++];\n var audioObjectType = (firstByte & 0xf8) >> 3;\n if (audioObjectType === 31) {\n audioObjectType += 1 + ((firstByte & 0x7) << 3) + ((esdsBox[i] & 0xe0) >> 5);\n }\n codec += '.' + audioObjectType;\n }\n break;\n }\n case 'hvc1':\n case 'hev1':\n {\n var hvcCBox = findBox(sampleEntriesEnd, ['hvcC'])[0];\n var profileByte = hvcCBox[1];\n var profileSpace = ['', 'A', 'B', 'C'][profileByte >> 6];\n var generalProfileIdc = profileByte & 0x1f;\n var profileCompat = readUint32(hvcCBox, 2);\n var tierFlag = (profileByte & 0x20) >> 5 ? 'H' : 'L';\n var levelIDC = hvcCBox[12];\n var constraintIndicator = hvcCBox.subarray(6, 12);\n codec += '.' + profileSpace + generalProfileIdc;\n codec += '.' + profileCompat.toString(16).toUpperCase();\n codec += '.' + tierFlag + levelIDC;\n var constraintString = '';\n for (var _i = constraintIndicator.length; _i--;) {\n var _byte = constraintIndicator[_i];\n if (_byte || constraintString) {\n var encodedByte = _byte.toString(16).toUpperCase();\n constraintString = '.' + encodedByte + constraintString;\n }\n }\n codec += constraintString;\n break;\n }\n case 'dvh1':\n case 'dvhe':\n {\n var dvcCBox = findBox(sampleEntriesEnd, ['dvcC'])[0];\n var profile = dvcCBox[2] >> 1 & 0x7f;\n var level = dvcCBox[2] << 5 & 0x20 | dvcCBox[3] >> 3 & 0x1f;\n codec += '.' + addLeadingZero(profile) + '.' + addLeadingZero(level);\n break;\n }\n case 'vp09':\n {\n var vpcCBox = findBox(sampleEntriesEnd, ['vpcC'])[0];\n var _profile = vpcCBox[4];\n var _level = vpcCBox[5];\n var bitDepth = vpcCBox[6] >> 4 & 0x0f;\n codec += '.' + addLeadingZero(_profile) + '.' + addLeadingZero(_level) + '.' + addLeadingZero(bitDepth);\n break;\n }\n case 'av01':\n {\n var av1CBox = findBox(sampleEntriesEnd, ['av1C'])[0];\n var _profile2 = av1CBox[1] >>> 5;\n var _level2 = av1CBox[1] & 0x1f;\n var _tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';\n var highBitDepth = (av1CBox[2] & 0x40) >> 6;\n var twelveBit = (av1CBox[2] & 0x20) >> 5;\n var _bitDepth = _profile2 === 2 && highBitDepth ? twelveBit ? 12 : 10 : highBitDepth ? 10 : 8;\n var monochrome = (av1CBox[2] & 0x10) >> 4;\n var chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;\n var chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;\n var chromaSamplePosition = av1CBox[2] & 0x03;\n // TODO: parse color_description_present_flag\n // default it to BT.709/limited range for now\n // more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax\n var colorPrimaries = 1;\n var transferCharacteristics = 1;\n var matrixCoefficients = 1;\n var videoFullRangeFlag = 0;\n codec += '.' + _profile2 + '.' + addLeadingZero(_level2) + _tierFlag + '.' + addLeadingZero(_bitDepth) + '.' + monochrome + '.' + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition + '.' + addLeadingZero(colorPrimaries) + '.' + addLeadingZero(transferCharacteristics) + '.' + addLeadingZero(matrixCoefficients) + '.' + videoFullRangeFlag;\n break;\n }\n }\n return {\n codec: codec,\n encrypted: encrypted\n };\n }\n function skipBERInteger(bytes, i) {\n var limit = i + 5;\n while (bytes[i++] & 0x80 && i < limit) {}\n return i;\n }\n function toHex(x) {\n return ('0' + x.toString(16).toUpperCase()).slice(-2);\n }\n function addLeadingZero(num) {\n return (num < 10 ? '0' : '') + num;\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 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 (isFiniteNumber(startTime) && (result === null || startTime < result)) {\n return startTime;\n }\n }\n return result;\n }, null);\n if (start !== null && isFiniteNumber(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 sidxMinStart = Infinity;\n var sidxMaxEnd = 0;\n var sidxDuration = 0;\n var sidxs = findBox(data, ['sidx']);\n for (var _i2 = 0; _i2 < sidxs.length; _i2++) {\n var sidx = parseSegmentIndex(sidxs[_i2]);\n if (sidx != null && sidx.references) {\n sidxMinStart = Math.min(sidxMinStart, sidx.earliestPresentationTime / sidx.timescale);\n var subSegmentDuration = sidx.references.reduce(function (dur, ref) {\n return dur + ref.info.duration || 0;\n }, 0);\n sidxMaxEnd = Math.max(sidxMaxEnd, subSegmentDuration + sidx.earliestPresentationTime / sidx.timescale);\n sidxDuration = sidxMaxEnd - sidxMinStart;\n }\n }\n if (sidxDuration && isFiniteNumber(sidxDuration)) {\n return sidxDuration;\n }\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 offset = timeOffset * timescale;\n if (offset) {\n var baseMediaDecodeTime = readUint32(tfdt, 4);\n if (version === 0) {\n baseMediaDecodeTime -= offset;\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 -= offset;\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\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.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 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 // Create a variable to process the payload\n var payPtr = seiPtr;\n\n // Increment the seiPtr to the end of the payload\n if (payloadSize < leftOver) {\n seiPtr += payloadSize;\n } else if (payloadSize > leftOver) {\n // Some type of corruption has happened?\n logger.error(\"Malformed SEI payload. \" + payloadSize + \" is too small, only \" + leftOver + \" bytes left to parse.\");\n // We might be able to parse some data, but let's be safe and ignore it.\n break;\n }\n if (payloadType === 4) {\n var countryCode = data[payPtr++];\n if (countryCode === 181) {\n var providerCode = readUint16(data, payPtr);\n payPtr += 2;\n if (providerCode === 49) {\n var userStructure = readUint32(data, payPtr);\n payPtr += 4;\n if (userStructure === 0x47413934) {\n var userDataType = data[payPtr++];\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3) {\n var firstByte = data[payPtr++];\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[payPtr++];\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) {\n if (payloadSize > 16) {\n var uuidStrArray = [];\n for (var _i3 = 0; _i3 < 16; _i3++) {\n var _b = data[payPtr++].toString(16);\n uuidStrArray.push(_b.length == 1 ? '0' + _b : _b);\n if (_i3 === 3 || _i3 === 5 || _i3 === 7 || _i3 === 9) {\n uuidStrArray.push('-');\n }\n }\n var length = payloadSize - 16;\n var userDataBytes = new Uint8Array(length);\n for (var _i4 = 0; _i4 < length; _i4++) {\n userDataBytes[_i4] = data[payPtr++];\n }\n samples.push({\n payloadType: payloadType,\n pts: pts,\n uuid: uuidStrArray.join(''),\n userData: utf8ArrayToStr(userDataBytes),\n userDataBytes: userDataBytes\n });\n }\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 (!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(preferManagedMediaSource) {\n if (preferManagedMediaSource === void 0) {\n preferManagedMediaSource = true;\n }\n if (typeof self === 'undefined') return undefined;\n var mms = (preferManagedMediaSource || !self.MediaSource) && self.ManagedMediaSource;\n return mms || self.MediaSource || self.WebKitMediaSource;\n }\n function isManagedMediaSource(source) {\n return typeof self !== 'undefined' && source === self.ManagedMediaSource;\n }\n\n // from http://mp4ra.org/codecs.html\n // values indicate codec selection preference (lower is higher priority)\n var sampleEntryCodesISO = {\n audio: {\n a3ds: 1,\n 'ac-3': 0.95,\n 'ac-4': 1,\n alac: 0.9,\n alaw: 1,\n dra1: 1,\n 'dts+': 1,\n 'dts-': 1,\n dtsc: 1,\n dtse: 1,\n dtsh: 1,\n 'ec-3': 0.9,\n enca: 1,\n fLaC: 0.9,\n // MP4-RA listed codec entry for FLAC\n flac: 0.9,\n // legacy browser codec name for FLAC\n FLAC: 0.9,\n // some manifests may list \"FLAC\" with Apple's tools\n g719: 1,\n g726: 1,\n m4ae: 1,\n mha1: 1,\n mha2: 1,\n mhm1: 1,\n mhm2: 1,\n mlpa: 1,\n mp4a: 1,\n 'raw ': 1,\n Opus: 1,\n opus: 1,\n // browsers expect this to be lowercase despite MP4RA says 'Opus'\n samr: 1,\n sawb: 1,\n sawp: 1,\n sevc: 1,\n sqcp: 1,\n ssmv: 1,\n twos: 1,\n ulaw: 1\n },\n video: {\n avc1: 1,\n avc2: 1,\n avc3: 1,\n avc4: 1,\n avcp: 1,\n av01: 0.8,\n drac: 1,\n dva1: 1,\n dvav: 1,\n dvh1: 0.7,\n dvhe: 0.7,\n encv: 1,\n hev1: 0.75,\n hvc1: 0.75,\n mjp2: 1,\n mp4v: 1,\n mvc1: 1,\n mvc2: 1,\n mvc3: 1,\n mvc4: 1,\n resv: 1,\n rv60: 1,\n s263: 1,\n svc1: 1,\n svc2: 1,\n 'vc-1': 1,\n vp08: 1,\n vp09: 0.9\n },\n text: {\n stpp: 1,\n wvtt: 1\n }\n };\n function isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && !!typeCodes[codec.slice(0, 4)];\n }\n function areCodecsMediaSourceSupported(codecs, type, preferManagedMediaSource) {\n if (preferManagedMediaSource === void 0) {\n preferManagedMediaSource = true;\n }\n return !codecs.split(',').some(function (codec) {\n return !isCodecMediaSourceSupported(codec, type, preferManagedMediaSource);\n });\n }\n function isCodecMediaSourceSupported(codec, type, preferManagedMediaSource) {\n var _MediaSource$isTypeSu;\n if (preferManagedMediaSource === void 0) {\n preferManagedMediaSource = true;\n }\n var MediaSource = getMediaSource(preferManagedMediaSource);\n return (_MediaSource$isTypeSu = MediaSource == null ? void 0 : MediaSource.isTypeSupported(mimeTypeForCodec(codec, type))) != null ? _MediaSource$isTypeSu : false;\n }\n function mimeTypeForCodec(codec, type) {\n return type + \"/mp4;codecs=\\\"\" + codec + \"\\\"\";\n }\n function videoCodecPreferenceValue(videoCodec) {\n if (videoCodec) {\n var fourCC = videoCodec.substring(0, 4);\n return sampleEntryCodesISO.video[fourCC];\n }\n return 2;\n }\n function codecsSetSelectionPreferenceValue(codecSet) {\n return codecSet.split(',').reduce(function (num, fourCC) {\n var preferenceValue = sampleEntryCodesISO.video[fourCC];\n if (preferenceValue) {\n return (preferenceValue * 2 + num) / (num ? 3 : 2);\n }\n return (sampleEntryCodesISO.audio[fourCC] + num) / (num ? 2 : 1);\n }, 0);\n }\n var CODEC_COMPATIBLE_NAMES = {};\n function getCodecCompatibleNameLower(lowerCaseCodec, preferManagedMediaSource) {\n if (preferManagedMediaSource === void 0) {\n preferManagedMediaSource = true;\n }\n if (CODEC_COMPATIBLE_NAMES[lowerCaseCodec]) {\n return CODEC_COMPATIBLE_NAMES[lowerCaseCodec];\n }\n\n // Idealy fLaC and Opus would be first (spec-compliant) but\n // some browsers will report that fLaC is supported then fail.\n // see: https://bugs.chromium.org/p/chromium/issues/detail?id=1422728\n var codecsToCheck = {\n flac: ['flac', 'fLaC', 'FLAC'],\n opus: ['opus', 'Opus']\n }[lowerCaseCodec];\n for (var i = 0; i < codecsToCheck.length; i++) {\n if (isCodecMediaSourceSupported(codecsToCheck[i], 'audio', preferManagedMediaSource)) {\n CODEC_COMPATIBLE_NAMES[lowerCaseCodec] = codecsToCheck[i];\n return codecsToCheck[i];\n }\n }\n return lowerCaseCodec;\n }\n var AUDIO_CODEC_REGEXP = /flac|opus/i;\n function getCodecCompatibleName(codec, preferManagedMediaSource) {\n if (preferManagedMediaSource === void 0) {\n preferManagedMediaSource = true;\n }\n return codec.replace(AUDIO_CODEC_REGEXP, function (m) {\n return getCodecCompatibleNameLower(m.toLowerCase(), preferManagedMediaSource);\n });\n }\n function pickMostCompleteCodecName(parsedCodec, levelCodec) {\n // Parsing of mp4a codecs strings in mp4-tools from media is incomplete as of d8c6c7a\n // so use level codec is parsed codec is unavailable or incomplete\n if (parsedCodec && parsedCodec !== 'mp4a') {\n return parsedCodec;\n }\n return levelCodec ? levelCodec.split(',')[0] : levelCodec;\n }\n function convertAVC1ToAVCOTI(codec) {\n // Convert avc1 codec string from RFC-4281 to RFC-6381 for MediaSource.isTypeSupported\n // Examples: avc1.66.30 to avc1.42001e and avc1.77.30,avc1.66.30 to avc1.4d001e,avc1.42001e.\n var codecs = codec.split(',');\n for (var i = 0; i < codecs.length; i++) {\n var avcdata = codecs[i].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 codecs[i] = result;\n }\n }\n return codecs.join(',');\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[^\\r\\n]*)/.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|INDEPENDENT-SEGMENTS)/.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.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('BANDWIDTH') || attrs.decimalInteger('AVERAGE-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, level);\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 lang = attrs.LANGUAGE;\n var assocLang = attrs['ASSOC-LANGUAGE'];\n var channels = attrs.CHANNELS;\n var characteristics = attrs.CHARACTERISTICS;\n var instreamId = attrs['INSTREAM-ID'];\n var media = {\n attrs: attrs,\n bitrate: 0,\n id: id++,\n groupId: attrs['GROUP-ID'] || '',\n name: attrs.NAME || lang || '',\n type: type,\n default: attrs.bool('DEFAULT'),\n autoselect: attrs.bool('AUTOSELECT'),\n forced: attrs.bool('FORCED'),\n lang: lang,\n url: attrs.URI ? M3U8Parser.resolve(attrs.URI, baseurl) : ''\n };\n if (assocLang) {\n media.assocLang = assocLang;\n }\n if (channels) {\n media.channels = channels;\n }\n if (characteristics) {\n media.characteristics = characteristics;\n }\n if (instreamId) {\n media.instreamId = instreamId;\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 var nextByteRange = null;\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 if (nextByteRange) {\n frag.setByteRange(nextByteRange);\n nextByteRange = null;\n }\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 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 'INDEPENDENT-SEGMENTS':\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 // Handle case where EXT-X-MAP is declared after EXT-X-BYTERANGE\n var end = frag.byteRangeEndOffset;\n if (end) {\n var start = frag.byteRangeStartOffset;\n nextByteRange = end - start + \"@\" + start;\n } else {\n nextByteRange = null;\n }\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(codecsAttributeValue, level) {\n var codecs = (codecsAttributeValue || '').split(/[ ,]+/).filter(function (c) {\n return c;\n });\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 // Comma separated list of all codecs for type\n level[type + \"Codec\"] = filtered.join(',');\n // Remove known codecs so that only unknownCodecs are left after iterating through each type\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 pathwayId = data.pathwayId,\n url = data.url,\n deliveryDirectives = data.deliveryDirectives;\n this.load({\n id: id,\n level: level,\n pathwayId: pathwayId,\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 && loaderContext.level === context.level) {\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 (isFiniteNumber((_context$deliveryDire = context.deliveryDirectives) == null ? void 0 : _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 = 0;\n var levelId = isFiniteNumber(level) ? level : isFiniteNumber(id) ? id : 0;\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 return self.VTTCue || self.TextTrackCue;\n }\n function createCueWithDataFields(Cue, startTime, endTime, data, type) {\n var cue = new Cue(startTime, endTime, '');\n try {\n cue.value = data;\n if (type) {\n cue.type = type;\n }\n } catch (e) {\n cue = new Cue(startTime, endTime, JSON.stringify(type ? _objectSpread2({\n type: type\n }, data) : data));\n }\n return cue;\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 Cue && 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 if (!Cue) {\n return;\n }\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 = createCueWithDataFields(Cue, startTime, endTime, frame, type);\n if (cue) {\n this.id3Track.addCue(cue);\n }\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 startTime = dateRangeDateToTimelineSeconds(dateRange.startDate, dateTimeOffset);\n\n // Process DateRanges to determine end-time (known DURATION, END-DATE, or END-ON-NEXT)\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 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 (candidateDateRange, id) {\n if (id !== dateRange.id) {\n var otherDateRange = dateRanges[id];\n if (otherDateRange.class === dateRange.class && otherDateRange.startDate > dateRange.startDate && (!candidateDateRange || dateRange.startDate < candidateDateRange.startDate)) {\n return otherDateRange;\n }\n }\n return candidateDateRange;\n }, null);\n if (nextDateRangeWithSameClass) {\n endTime = dateRangeDateToTimelineSeconds(nextDateRangeWithSameClass.startDate, dateTimeOffset);\n durationKnown = true;\n }\n }\n\n // Create TextTrack Cues for each MetadataGroup Item (select DateRange attribute)\n // This is to emulate Safari HLS playback handling of DateRange tags\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 if (Cue) {\n var data = dateRange.attr[key];\n if (isSCTE35Attribute(key)) {\n data = hexToArrayBuffer(data);\n }\n var _cue = createCueWithDataFields(Cue, startTime, endTime, {\n key: key,\n data: data\n }, MetadataSchema.dateRange);\n if (_cue) {\n _cue.id = id;\n _this.id3Track.addCue(_cue);\n cues[key] = _cue;\n }\n }\n }\n\n // Keep track of processed DateRanges by ID for updating cues with new DateRange tag attributes\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 || !levelDetails.live) {\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 (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 function isHdcpLevel(value) {\n return HdcpLevels.indexOf(value) > -1;\n }\n var VideoRangeValues = ['SDR', 'PQ', 'HLG'];\n function isVideoRange(value) {\n return !!value && VideoRangeValues.indexOf(value) > -1;\n }\n var HlsSkip = {\n No: \"\",\n Yes: \"YES\",\n v2: \"v2\"\n };\n function getSkipValue(details) {\n var canSkipUntil = details.canSkipUntil,\n canSkipDateRanges = details.canSkipDateRanges,\n age = details.age;\n // A Client SHOULD NOT request a Playlist Delta Update unless it already\n // has a version of the Playlist that is no older than one-half of the Skip Boundary.\n // @see: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-6.3.7\n var playlistRecentEnough = age < canSkipUntil / 2;\n if (canSkipUntil && playlistRecentEnough) {\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.url = void 0;\n this.frameRate = 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.details = void 0;\n this.fragmentError = 0;\n this.loadError = 0;\n this.loaded = void 0;\n this.realBitrate = 0;\n this.supportedPromise = void 0;\n this.supportedResult = void 0;\n this._avgBitrate = 0;\n this._audioGroups = void 0;\n this._subtitleGroups = void 0;\n // Deprecated (retained for backwards compatibility)\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.frameRate = data.attrs.optionalFloat('FRAME-RATE', 0);\n this._avgBitrate = data.attrs.decimalInteger('AVERAGE-BANDWIDTH');\n this.audioCodec = data.audioCodec;\n this.videoCodec = data.videoCodec;\n this.codecSet = [data.videoCodec, data.audioCodec].filter(function (c) {\n return !!c;\n }).map(function (s) {\n return s.substring(0, 4);\n }).join(',');\n this.addGroupId('audio', data.attrs.AUDIO);\n this.addGroupId('text', data.attrs.SUBTITLES);\n }\n var _proto2 = Level.prototype;\n _proto2.hasAudioGroup = function hasAudioGroup(groupId) {\n return hasGroup(this._audioGroups, groupId);\n };\n _proto2.hasSubtitleGroup = function hasSubtitleGroup(groupId) {\n return hasGroup(this._subtitleGroups, groupId);\n };\n _proto2.addGroupId = function addGroupId(type, groupId) {\n if (!groupId) {\n return;\n }\n if (type === 'audio') {\n var audioGroups = this._audioGroups;\n if (!audioGroups) {\n audioGroups = this._audioGroups = [];\n }\n if (audioGroups.indexOf(groupId) === -1) {\n audioGroups.push(groupId);\n }\n } else if (type === 'text') {\n var subtitleGroups = this._subtitleGroups;\n if (!subtitleGroups) {\n subtitleGroups = this._subtitleGroups = [];\n }\n if (subtitleGroups.indexOf(groupId) === -1) {\n subtitleGroups.push(groupId);\n }\n }\n }\n\n // Deprecated methods (retained for backwards compatibility)\n ;\n _proto2.addFallback = function addFallback() {};\n _createClass(Level, [{\n key: \"maxBitrate\",\n get: function get() {\n return Math.max(this.realBitrate, this.bitrate);\n }\n }, {\n key: \"averageBitrate\",\n get: function get() {\n return this._avgBitrate || this.realBitrate || this.bitrate;\n }\n }, {\n key: \"attrs\",\n get: function get() {\n return this._attrs[0];\n }\n }, {\n key: \"codecs\",\n get: function get() {\n return this.attrs.CODECS || '';\n }\n }, {\n key: \"pathwayId\",\n get: function get() {\n return this.attrs['PATHWAY-ID'] || '.';\n }\n }, {\n key: \"videoRange\",\n get: function get() {\n return this.attrs['VIDEO-RANGE'] || 'SDR';\n }\n }, {\n key: \"score\",\n get: function get() {\n return this.attrs.optionalFloat('SCORE', 0);\n }\n }, {\n key: \"uri\",\n get: function get() {\n return this.url[0] || '';\n }\n }, {\n key: \"audioGroups\",\n get: function get() {\n return this._audioGroups;\n }\n }, {\n key: \"subtitleGroups\",\n get: function get() {\n return this._subtitleGroups;\n }\n }, {\n key: \"urlId\",\n get: function get() {\n return 0;\n },\n set: function set(value) {}\n }, {\n key: \"audioGroupIds\",\n get: function get() {\n return this.audioGroups ? [this.audioGroupId] : undefined;\n }\n }, {\n key: \"textGroupIds\",\n get: function get() {\n return this.subtitleGroups ? [this.textGroupId] : undefined;\n }\n }, {\n key: \"audioGroupId\",\n get: function get() {\n var _this$audioGroups;\n return (_this$audioGroups = this.audioGroups) == null ? void 0 : _this$audioGroups[0];\n }\n }, {\n key: \"textGroupId\",\n get: function get() {\n var _this$subtitleGroups;\n return (_this$subtitleGroups = this.subtitleGroups) == null ? void 0 : _this$subtitleGroups[0];\n }\n }]);\n return Level;\n }();\n function hasGroup(groups, groupId) {\n if (!groupId || !groups) {\n return false;\n }\n return groups.indexOf(groupId) !== -1;\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 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 && (!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 function reassignFragmentLevelIndexes(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 }\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, loaderResponse) {\n if (!retryConfig) {\n return false;\n }\n var httpStatus = loaderResponse == null ? void 0 : loaderResponse.code;\n var retry = retryCount < retryConfig.maxNumRetry && (retryForHttpStatus(httpStatus) || !!isTimeout);\n return retryConfig.shouldRetry ? retryConfig.shouldRetry(retryConfig, retryCount, isTimeout, loaderResponse, retry) : retry;\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, nextFragLookupTolerance) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\n if (nextFragLookupTolerance === void 0) {\n nextFragLookupTolerance = 0.005;\n }\n var fragNext = null;\n if (fragPrevious) {\n fragNext = fragments[fragPrevious.sn - fragments[0].sn + 1] || null;\n // check for buffer-end rounding error\n var bufferEdgeError = fragPrevious.endDTS - bufferEnd;\n if (bufferEdgeError > 0 && bufferEdgeError < 0.0000015) {\n bufferEnd += 0.0000015;\n }\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 && ((!fragPrevious || fragPrevious.level === fragNext.level) && fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext) === 0 || fragmentWithinFastStartSwitch(fragNext, fragPrevious, Math.min(nextFragLookupTolerance, maxFragLookUpTolerance)))) {\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 function fragmentWithinFastStartSwitch(fragNext, fragPrevious, nextFragLookupTolerance) {\n if (fragPrevious && fragPrevious.start === 0 && fragPrevious.level < fragNext.level && (fragPrevious.endPTS || 0) > 0) {\n var firstDuration = fragPrevious.tagList.reduce(function (duration, tag) {\n if (tag[0] === 'INF') {\n duration += parseFloat(tag[1]);\n }\n return duration;\n }, nextFragLookupTolerance);\n return fragNext.start <= firstDuration;\n }\n return false;\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 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 _proto.stopLoad = function stopLoad() {\n this.playlistError = 0;\n };\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 && level.hasAudioGroup(context.groupId) || context.type === PlaylistContextType.SUBTITLE_TRACK && level.hasSubtitleGroup(context.groupId))) {\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 } else {\n this.keySystemError(data);\n }\n }\n return;\n case ErrorDetails.BUFFER_ADD_CODEC_ERROR:\n case ErrorDetails.REMUX_ALLOC_ERROR:\n case ErrorDetails.BUFFER_APPEND_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_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 this.keySystemError(data);\n }\n };\n _proto.keySystemError = function keySystemError(data) {\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 };\n _proto.getPlaylistRetryOrSwitchAction = function getPlaylistRetryOrSwitchAction(data, levelIndex) {\n var hls = this.hls;\n var retryConfig = getRetryConfig(hls.config.playlistLoadPolicy, data);\n var retryCount = this.playlistError++;\n var retry = shouldRetry(retryConfig, retryCount, isTimeoutError(data), data.response);\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 if (data.details !== ErrorDetails.FRAG_GAP) {\n level.fragmentError++;\n }\n var retry = shouldRetry(retryConfig, fragmentErrors, isTimeoutError(data), data.response);\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 var _data$frag2, _data$context2;\n var errorDetails = data.details;\n level.loadError++;\n if (errorDetails === ErrorDetails.BUFFER_APPEND_ERROR) {\n level.fragmentError++;\n }\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 if (!hls.autoLevelEnabled) {\n hls.loadLevel = -1;\n }\n var fragErrorType = (_data$frag2 = data.frag) == null ? void 0 : _data$frag2.type;\n // Find alternate audio codec if available on audio codec error\n var isAudioCodecError = fragErrorType === PlaylistLevelType.AUDIO && errorDetails === ErrorDetails.FRAG_PARSING_ERROR || data.sourceBufferName === 'audio' && (errorDetails === ErrorDetails.BUFFER_ADD_CODEC_ERROR || errorDetails === ErrorDetails.BUFFER_APPEND_ERROR);\n var findAudioCodecAlternate = isAudioCodecError && levels.some(function (_ref) {\n var audioCodec = _ref.audioCodec;\n return level.audioCodec !== audioCodec;\n });\n // Find alternate video codec if available on video codec error\n var isVideoCodecError = data.sourceBufferName === 'video' && (errorDetails === ErrorDetails.BUFFER_ADD_CODEC_ERROR || errorDetails === ErrorDetails.BUFFER_APPEND_ERROR);\n var findVideoCodecAlternate = isVideoCodecError && levels.some(function (_ref2) {\n var codecSet = _ref2.codecSet,\n audioCodec = _ref2.audioCodec;\n return level.codecSet !== codecSet && level.audioCodec === audioCodec;\n });\n var _ref3 = (_data$context2 = data.context) != null ? _data$context2 : {},\n playlistErrorType = _ref3.type,\n playlistErrorGroupId = _ref3.groupId;\n var _loop = function _loop() {\n var candidate = (i + loadLevel) % levels.length;\n if (candidate !== loadLevel && candidate >= minAutoLevel && candidate <= maxAutoLevel && levels[candidate].loadError === 0) {\n var _level$audioGroups, _level$subtitleGroups;\n var levelCandidate = levels[candidate];\n // Skip level switch if GAP tag is found in next level at same position\n if (errorDetails === ErrorDetails.FRAG_GAP && fragErrorType === PlaylistLevelType.MAIN && 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 return 0; // continue\n }\n }\n } else if (playlistErrorType === PlaylistContextType.AUDIO_TRACK && levelCandidate.hasAudioGroup(playlistErrorGroupId) || playlistErrorType === PlaylistContextType.SUBTITLE_TRACK && levelCandidate.hasSubtitleGroup(playlistErrorGroupId)) {\n // For audio/subs playlist errors find another group ID or fallthrough to redundant fail-over\n return 0; // continue\n } else if (fragErrorType === PlaylistLevelType.AUDIO && (_level$audioGroups = level.audioGroups) != null && _level$audioGroups.some(function (groupId) {\n return levelCandidate.hasAudioGroup(groupId);\n }) || fragErrorType === PlaylistLevelType.SUBTITLE && (_level$subtitleGroups = level.subtitleGroups) != null && _level$subtitleGroups.some(function (groupId) {\n return levelCandidate.hasSubtitleGroup(groupId);\n }) || findAudioCodecAlternate && level.audioCodec === levelCandidate.audioCodec || !findAudioCodecAlternate && level.audioCodec !== levelCandidate.audioCodec || findVideoCodecAlternate && level.codecSet === levelCandidate.codecSet) {\n // For video/audio/subs frag errors find another group ID or fallthrough to redundant fail-over\n return 0; // continue\n }\n nextLevel = candidate;\n return 1; // break\n }\n },\n _ret;\n for (var i = levels.length; i--;) {\n _ret = _loop();\n if (_ret === 0) continue;\n if (_ret === 1) break;\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 // 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 } else if (/MediaSource readyState: ended/.test(data.error.message)) {\n this.warn(\"MediaSource ended after \\\"\" + data.sourceBufferName + \"\\\" sourceBuffer append error. Attempting to recover from media error.\");\n this.hls.recoverMediaError();\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.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 return ErrorController;\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 if (this.timer !== -1) {\n self.clearTimeout(this.timer);\n this.timer = -1;\n }\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, current) {\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 var skip = current && getSkipValue(current);\n return new HlsUrlParameters(msn, part >= 0 ? part : undefined, skip);\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);\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 /*\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 /**\n * @returns Whether we can detect and validate HDR capability within the window context\n */\n function isHdrSupported() {\n if (typeof matchMedia === 'function') {\n var mediaQueryList = matchMedia('(dynamic-range: high)');\n var badQuery = matchMedia('bad query');\n if (mediaQueryList.media !== badQuery.media) {\n return mediaQueryList.matches === true;\n }\n }\n return false;\n }\n\n /**\n * Sanitizes inputs to return the active video selection options for HDR/SDR.\n * When both inputs are null:\n *\n * `{ preferHDR: false, allowedVideoRanges: [] }`\n *\n * When `currentVideoRange` non-null, maintain the active range:\n *\n * `{ preferHDR: currentVideoRange !== 'SDR', allowedVideoRanges: [currentVideoRange] }`\n *\n * When VideoSelectionOption non-null:\n *\n * - Allow all video ranges if `allowedVideoRanges` unspecified.\n * - If `preferHDR` is non-null use the value to filter `allowedVideoRanges`.\n * - Else check window for HDR support and set `preferHDR` to the result.\n *\n * @param currentVideoRange\n * @param videoPreference\n */\n function getVideoSelectionOptions(currentVideoRange, videoPreference) {\n var preferHDR = false;\n var allowedVideoRanges = [];\n if (currentVideoRange) {\n preferHDR = currentVideoRange !== 'SDR';\n allowedVideoRanges = [currentVideoRange];\n }\n if (videoPreference) {\n allowedVideoRanges = videoPreference.allowedVideoRanges || VideoRangeValues.slice(0);\n preferHDR = videoPreference.preferHDR !== undefined ? videoPreference.preferHDR : isHdrSupported();\n if (preferHDR) {\n allowedVideoRanges = allowedVideoRanges.filter(function (range) {\n return range !== 'SDR';\n });\n } else {\n allowedVideoRanges = ['SDR'];\n }\n }\n return {\n preferHDR: preferHDR,\n allowedVideoRanges: allowedVideoRanges\n };\n }\n\n function getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference) {\n var codecSets = Object.keys(codecTiers);\n var channelsPreference = audioPreference == null ? void 0 : audioPreference.channels;\n var audioCodecPreference = audioPreference == null ? void 0 : audioPreference.audioCodec;\n var preferStereo = channelsPreference && parseInt(channelsPreference) === 2;\n // Use first level set to determine stereo, and minimum resolution and framerate\n var hasStereo = true;\n var hasCurrentVideoRange = false;\n var minHeight = Infinity;\n var minFramerate = Infinity;\n var minBitrate = Infinity;\n var selectedScore = 0;\n var videoRanges = [];\n var _getVideoSelectionOpt = getVideoSelectionOptions(currentVideoRange, videoPreference),\n preferHDR = _getVideoSelectionOpt.preferHDR,\n allowedVideoRanges = _getVideoSelectionOpt.allowedVideoRanges;\n var _loop = function _loop() {\n var tier = codecTiers[codecSets[i]];\n hasStereo = tier.channels[2] > 0;\n minHeight = Math.min(minHeight, tier.minHeight);\n minFramerate = Math.min(minFramerate, tier.minFramerate);\n minBitrate = Math.min(minBitrate, tier.minBitrate);\n var matchingVideoRanges = allowedVideoRanges.filter(function (range) {\n return tier.videoRanges[range] > 0;\n });\n if (matchingVideoRanges.length > 0) {\n hasCurrentVideoRange = true;\n videoRanges = matchingVideoRanges;\n }\n };\n for (var i = codecSets.length; i--;) {\n _loop();\n }\n minHeight = isFiniteNumber(minHeight) ? minHeight : 0;\n minFramerate = isFiniteNumber(minFramerate) ? minFramerate : 0;\n var maxHeight = Math.max(1080, minHeight);\n var maxFramerate = Math.max(30, minFramerate);\n minBitrate = isFiniteNumber(minBitrate) ? minBitrate : currentBw;\n currentBw = Math.max(minBitrate, currentBw);\n // If there are no variants with matching preference, set currentVideoRange to undefined\n if (!hasCurrentVideoRange) {\n currentVideoRange = undefined;\n videoRanges = [];\n }\n var codecSet = codecSets.reduce(function (selected, candidate) {\n // Remove candiates which do not meet bitrate, default audio, stereo or channels preference, 1080p or lower, 30fps or lower, or SDR/HDR selection if present\n var candidateTier = codecTiers[candidate];\n if (candidate === selected) {\n return selected;\n }\n if (candidateTier.minBitrate > currentBw) {\n logStartCodecCandidateIgnored(candidate, \"min bitrate of \" + candidateTier.minBitrate + \" > current estimate of \" + currentBw);\n return selected;\n }\n if (!candidateTier.hasDefaultAudio) {\n logStartCodecCandidateIgnored(candidate, \"no renditions with default or auto-select sound found\");\n return selected;\n }\n if (audioCodecPreference && candidate.indexOf(audioCodecPreference.substring(0, 4)) % 5 !== 0) {\n logStartCodecCandidateIgnored(candidate, \"audio codec preference \\\"\" + audioCodecPreference + \"\\\" not found\");\n return selected;\n }\n if (channelsPreference && !preferStereo) {\n if (!candidateTier.channels[channelsPreference]) {\n logStartCodecCandidateIgnored(candidate, \"no renditions with \" + channelsPreference + \" channel sound found (channels options: \" + Object.keys(candidateTier.channels) + \")\");\n return selected;\n }\n } else if ((!audioCodecPreference || preferStereo) && hasStereo && candidateTier.channels['2'] === 0) {\n logStartCodecCandidateIgnored(candidate, \"no renditions with stereo sound found\");\n return selected;\n }\n if (candidateTier.minHeight > maxHeight) {\n logStartCodecCandidateIgnored(candidate, \"min resolution of \" + candidateTier.minHeight + \" > maximum of \" + maxHeight);\n return selected;\n }\n if (candidateTier.minFramerate > maxFramerate) {\n logStartCodecCandidateIgnored(candidate, \"min framerate of \" + candidateTier.minFramerate + \" > maximum of \" + maxFramerate);\n return selected;\n }\n if (!videoRanges.some(function (range) {\n return candidateTier.videoRanges[range] > 0;\n })) {\n logStartCodecCandidateIgnored(candidate, \"no variants with VIDEO-RANGE of \" + JSON.stringify(videoRanges) + \" found\");\n return selected;\n }\n if (candidateTier.maxScore < selectedScore) {\n logStartCodecCandidateIgnored(candidate, \"max score of \" + candidateTier.maxScore + \" < selected max of \" + selectedScore);\n return selected;\n }\n // Remove candiates with less preferred codecs or more errors\n if (selected && (codecsSetSelectionPreferenceValue(candidate) >= codecsSetSelectionPreferenceValue(selected) || candidateTier.fragmentError > codecTiers[selected].fragmentError)) {\n return selected;\n }\n selectedScore = candidateTier.maxScore;\n return candidate;\n }, undefined);\n return {\n codecSet: codecSet,\n videoRanges: videoRanges,\n preferHDR: preferHDR,\n minFramerate: minFramerate,\n minBitrate: minBitrate\n };\n }\n function logStartCodecCandidateIgnored(codeSet, reason) {\n logger.log(\"[abr] start candidates with \\\"\" + codeSet + \"\\\" ignored because \" + reason);\n }\n function getAudioTracksByGroup(allAudioTracks) {\n return allAudioTracks.reduce(function (audioTracksByGroup, track) {\n var trackGroup = audioTracksByGroup.groups[track.groupId];\n if (!trackGroup) {\n trackGroup = audioTracksByGroup.groups[track.groupId] = {\n tracks: [],\n channels: {\n 2: 0\n },\n hasDefault: false,\n hasAutoSelect: false\n };\n }\n trackGroup.tracks.push(track);\n var channelsKey = track.channels || '2';\n trackGroup.channels[channelsKey] = (trackGroup.channels[channelsKey] || 0) + 1;\n trackGroup.hasDefault = trackGroup.hasDefault || track.default;\n trackGroup.hasAutoSelect = trackGroup.hasAutoSelect || track.autoselect;\n if (trackGroup.hasDefault) {\n audioTracksByGroup.hasDefaultAudio = true;\n }\n if (trackGroup.hasAutoSelect) {\n audioTracksByGroup.hasAutoSelectAudio = true;\n }\n return audioTracksByGroup;\n }, {\n hasDefaultAudio: false,\n hasAutoSelectAudio: false,\n groups: {}\n });\n }\n function getCodecTiers(levels, audioTracksByGroup, minAutoLevel, maxAutoLevel) {\n return levels.slice(minAutoLevel, maxAutoLevel + 1).reduce(function (tiers, level) {\n if (!level.codecSet) {\n return tiers;\n }\n var audioGroups = level.audioGroups;\n var tier = tiers[level.codecSet];\n if (!tier) {\n tiers[level.codecSet] = tier = {\n minBitrate: Infinity,\n minHeight: Infinity,\n minFramerate: Infinity,\n maxScore: 0,\n videoRanges: {\n SDR: 0\n },\n channels: {\n '2': 0\n },\n hasDefaultAudio: !audioGroups,\n fragmentError: 0\n };\n }\n tier.minBitrate = Math.min(tier.minBitrate, level.bitrate);\n var lesserWidthOrHeight = Math.min(level.height, level.width);\n tier.minHeight = Math.min(tier.minHeight, lesserWidthOrHeight);\n tier.minFramerate = Math.min(tier.minFramerate, level.frameRate);\n tier.maxScore = Math.max(tier.maxScore, level.score);\n tier.fragmentError += level.fragmentError;\n tier.videoRanges[level.videoRange] = (tier.videoRanges[level.videoRange] || 0) + 1;\n return tiers;\n }, {});\n }\n\n var AbrController = /*#__PURE__*/function () {\n function AbrController(_hls) {\n var _this = this;\n this.hls = void 0;\n this.lastLevelLoadSec = 0;\n this.lastLoadedFragLevel = -1;\n this.firstSelection = -1;\n this._nextAutoLevel = -1;\n this.nextAutoLevelKey = '';\n this.audioTracksByGroup = null;\n this.codecTiers = null;\n this.timer = -1;\n this.fragCurrent = null;\n this.partCurrent = null;\n this.bitrateTestDelay = 0;\n this.bwEstimator = void 0;\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 this._abandonRulesCheck = function () {\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 var minAutoLevel = hls.minAutoLevel;\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 <= minAutoLevel) {\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 var ttfb = stats.loading.first ? stats.loading.first - stats.loading.start : -1;\n var loadedFirstByte = stats.loaded && ttfb > -1;\n var bwEstimate = _this.getBwEstimate();\n var levels = hls.levels;\n var level = levels[frag.level];\n var expectedLen = stats.total || Math.max(stats.loaded, Math.round(duration * level.averageBitrate / 8));\n var timeStreaming = loadedFirstByte ? timeLoading - ttfb : timeLoading;\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 = hls.nextAutoLevel = 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 var nextLoadLevelBitrate = levels[nextLoadLevel].maxBitrate;\n if (_this.getBwEstimate() * _this.hls.config.abrBandWidthUpFactor > nextLoadLevelBitrate) {\n _this.resetEstimator(nextLoadLevelBitrate);\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 | 0) + \" ms\\n Current BW estimate: \" + (isFiniteNumber(bwEstimate) ? bwEstimate | 0 : 'Unknown') + \" bps\\n New BW estimate: \" + (_this.getBwEstimate() | 0) + \" bps\\n Switching to level \" + nextLoadLevel + \" @ \" + (nextLoadLevelBitrate | 0) + \" bps\");\n hls.trigger(Events.FRAG_LOAD_EMERGENCY_ABORTED, {\n frag: frag,\n part: part,\n stats: stats\n });\n };\n this.hls = _hls;\n this.bwEstimator = this.initEstimator();\n this.registerListeners();\n }\n var _proto = AbrController.prototype;\n _proto.resetEstimator = function resetEstimator(abrEwmaDefaultEstimate) {\n if (abrEwmaDefaultEstimate) {\n logger.log(\"setting initial bwe to \" + abrEwmaDefaultEstimate);\n this.hls.config.abrEwmaDefaultEstimate = abrEwmaDefaultEstimate;\n }\n this.firstSelection = -1;\n this.bwEstimator = this.initEstimator();\n };\n _proto.initEstimator = function initEstimator() {\n var config = this.hls.config;\n return new EwmaBandWidthEstimator(config.abrEwmaSlowVoD, config.abrEwmaFastVoD, config.abrEwmaDefaultEstimate);\n };\n _proto.registerListeners = function registerListeners() {\n var hls = this.hls;\n hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);\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 hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.on(Events.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this);\n hls.on(Events.ERROR, this.onError, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n if (!hls) {\n return;\n }\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\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 hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);\n hls.off(Events.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this);\n hls.off(Events.ERROR, this.onError, this);\n };\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n this.clearTimer();\n // @ts-ignore\n this.hls = this._abandonRulesCheck = null;\n this.fragCurrent = this.partCurrent = null;\n };\n _proto.onManifestLoading = function onManifestLoading(event, data) {\n this.lastLoadedFragLevel = -1;\n this.firstSelection = -1;\n this.lastLevelLoadSec = 0;\n this.fragCurrent = this.partCurrent = null;\n this.onLevelsUpdated();\n this.clearTimer();\n };\n _proto.onLevelsUpdated = function onLevelsUpdated() {\n if (this.lastLoadedFragLevel > -1 && this.fragCurrent) {\n this.lastLoadedFragLevel = this.fragCurrent.level;\n }\n this._nextAutoLevel = -1;\n this.onMaxAutoLevelUpdated();\n this.codecTiers = null;\n this.audioTracksByGroup = null;\n };\n _proto.onMaxAutoLevelUpdated = function onMaxAutoLevelUpdated() {\n this.firstSelection = -1;\n this.nextAutoLevelKey = '';\n };\n _proto.onFragLoading = function onFragLoading(event, data) {\n var frag = data.frag;\n if (this.ignoreFragment(frag)) {\n return;\n }\n if (!frag.bitrateTest) {\n var _data$part;\n this.fragCurrent = frag;\n this.partCurrent = (_data$part = data.part) != null ? _data$part : null;\n }\n this.clearTimer();\n this.timer = self.setInterval(this._abandonRulesCheck, 100);\n };\n _proto.onLevelSwitching = function onLevelSwitching(event, data) {\n this.clearTimer();\n };\n _proto.onError = function onError(event, data) {\n if (data.fatal) {\n return;\n }\n switch (data.details) {\n case ErrorDetails.BUFFER_ADD_CODEC_ERROR:\n case ErrorDetails.BUFFER_APPEND_ERROR:\n // Reset last loaded level so that a new selection can be made after calling recoverMediaError\n this.lastLoadedFragLevel = -1;\n this.firstSelection = -1;\n break;\n case ErrorDetails.FRAG_LOAD_TIMEOUT:\n {\n var frag = data.frag;\n var fragCurrent = this.fragCurrent,\n part = this.partCurrent;\n if (frag && fragCurrent && frag.sn === fragCurrent.sn && frag.level === fragCurrent.level) {\n var now = performance.now();\n var stats = part ? part.stats : frag.stats;\n var timeLoading = now - stats.loading.start;\n var ttfb = stats.loading.first ? stats.loading.first - stats.loading.start : -1;\n var loadedFirstByte = stats.loaded && ttfb > -1;\n if (loadedFirstByte) {\n var ttfbEstimate = this.bwEstimator.getEstimateTTFB();\n this.bwEstimator.sample(timeLoading - Math.min(ttfbEstimate, ttfb), stats.loaded);\n } else {\n this.bwEstimator.sampleTTFB(timeLoading);\n }\n }\n break;\n }\n }\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 loading = data.stats.loading;\n var timeLoadingMs = loading.end - loading.start;\n if (isFiniteNumber(timeLoadingMs)) {\n this.lastLevelLoadSec = timeLoadingMs / 1000;\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 _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 // reset forced auto level value so that next level will be selected\n if (frag.level === this._nextAutoLevel) {\n this._nextAutoLevel = -1;\n }\n this.firstSelection = -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 } else {\n // store level id after successful fragment load for playback\n this.lastLoadedFragLevel = frag.level;\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.getBwEstimate();\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 if (this.timer > -1) {\n self.clearInterval(this.timer);\n this.timer = -1;\n }\n };\n _proto.getAutoLevelKey = function getAutoLevelKey() {\n return this.getBwEstimate() + \"_\" + this.getStarvationDelay().toFixed(2);\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 var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;\n var avgbw = this.getBwEstimate();\n // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n var bufferStarvationDelay = this.getStarvationDelay();\n var bwFactor = config.abrBandWidthFactor;\n var bwUpFactor = config.abrBandWidthUpFactor;\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 if (bufferStarvationDelay) {\n var _bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, 0, bwFactor, bwUpFactor);\n if (_bestLevel >= 0) {\n return _bestLevel;\n }\n }\n // not possible to get rid of rebuffering... try to find level that will guarantee less than maxStarvationDelay of rebuffering\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay;\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.info(\"[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 var bestLevel = this.findBestLevel(avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, maxStarvationDelay, bwFactor, bwUpFactor);\n logger.info(\"[abr] \" + (bufferStarvationDelay ? 'rebuffering expected' : 'buffer is empty') + \", optimal quality level \" + bestLevel);\n if (bestLevel > -1) {\n return bestLevel;\n }\n // If no matching level found, see if min auto level would be a better option\n var minLevel = hls.levels[minAutoLevel];\n var autoLevel = hls.levels[hls.loadLevel];\n if ((minLevel == null ? void 0 : minLevel.bitrate) < (autoLevel == null ? void 0 : autoLevel.bitrate)) {\n return minAutoLevel;\n }\n // or if bitrate is not lower, continue to use loadLevel\n return hls.loadLevel;\n };\n _proto.getStarvationDelay = function getStarvationDelay() {\n var hls = this.hls;\n var media = hls.media;\n if (!media) {\n return Infinity;\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 bufferInfo = hls.mainForwardBufferInfo;\n return (bufferInfo ? bufferInfo.len : 0) / playbackRate;\n };\n _proto.getBwEstimate = function getBwEstimate() {\n return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate;\n };\n _proto.findBestLevel = function findBestLevel(currentBw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, maxStarvationDelay, bwFactor, bwUpFactor) {\n var _level$details,\n _this2 = this;\n var maxFetchDuration = bufferStarvationDelay + maxStarvationDelay;\n var lastLoadedFragLevel = this.lastLoadedFragLevel;\n var selectionBaseLevel = lastLoadedFragLevel === -1 ? this.hls.firstLevel : lastLoadedFragLevel;\n var fragCurrent = this.fragCurrent,\n partCurrent = this.partCurrent;\n var _this$hls = this.hls,\n levels = _this$hls.levels,\n allAudioTracks = _this$hls.allAudioTracks,\n loadLevel = _this$hls.loadLevel,\n config = _this$hls.config;\n if (levels.length === 1) {\n return 0;\n }\n var level = levels[selectionBaseLevel];\n var live = !!(level != null && (_level$details = level.details) != null && _level$details.live);\n var firstSelection = loadLevel === -1 || lastLoadedFragLevel === -1;\n var currentCodecSet;\n var currentVideoRange = 'SDR';\n var currentFrameRate = (level == null ? void 0 : level.frameRate) || 0;\n var audioPreference = config.audioPreference,\n videoPreference = config.videoPreference;\n var audioTracksByGroup = this.audioTracksByGroup || (this.audioTracksByGroup = getAudioTracksByGroup(allAudioTracks));\n if (firstSelection) {\n if (this.firstSelection !== -1) {\n return this.firstSelection;\n }\n var codecTiers = this.codecTiers || (this.codecTiers = getCodecTiers(levels, audioTracksByGroup, minAutoLevel, maxAutoLevel));\n var startTier = getStartCodecTier(codecTiers, currentVideoRange, currentBw, audioPreference, videoPreference);\n var codecSet = startTier.codecSet,\n videoRanges = startTier.videoRanges,\n minFramerate = startTier.minFramerate,\n minBitrate = startTier.minBitrate,\n preferHDR = startTier.preferHDR;\n currentCodecSet = codecSet;\n currentVideoRange = preferHDR ? videoRanges[videoRanges.length - 1] : videoRanges[0];\n currentFrameRate = minFramerate;\n currentBw = Math.max(currentBw, minBitrate);\n logger.log(\"[abr] picked start tier \" + JSON.stringify(startTier));\n } else {\n currentCodecSet = level == null ? void 0 : level.codecSet;\n currentVideoRange = level == null ? void 0 : level.videoRange;\n }\n var currentFragDuration = partCurrent ? partCurrent.duration : fragCurrent ? fragCurrent.duration : 0;\n var ttfbEstimateSec = this.bwEstimator.getEstimateTTFB() / 1000;\n var levelsSkipped = [];\n var _loop = function _loop() {\n var _levelInfo$supportedR;\n var levelInfo = levels[i];\n var upSwitch = i > selectionBaseLevel;\n if (!levelInfo) {\n return 0; // continue\n }\n\n // skip candidates which change codec-family or video-range,\n // and which decrease or increase frame-rate for up and down-switch respectfully\n if (currentCodecSet && levelInfo.codecSet !== currentCodecSet || currentVideoRange && levelInfo.videoRange !== currentVideoRange || upSwitch && currentFrameRate > levelInfo.frameRate || !upSwitch && currentFrameRate > 0 && currentFrameRate < levelInfo.frameRate || levelInfo.supportedResult && !((_levelInfo$supportedR = levelInfo.supportedResult.decodingInfoResults) != null && _levelInfo$supportedR[0].smooth)) {\n levelsSkipped.push(i);\n return 0; // continue\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;\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 (!upSwitch) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n\n // Use average bitrate when starvation delay (buffer length) is gt or eq two segment durations and rebuffering is not expected (maxStarvationDelay > 0)\n var bitrate = currentFragDuration && bufferStarvationDelay >= currentFragDuration * 2 && maxStarvationDelay === 0 ? levels[i].averageBitrate : levels[i].maxBitrate;\n var fetchDuration = _this2.getTimeToLoadFrag(ttfbEstimateSec, adjustedbw, bitrate * avgDuration, levelDetails === undefined);\n var canSwitchWithinTolerance =\n // if adjusted bw is greater than level bitrate AND\n adjustedbw >= bitrate && (\n // no level change, or new level has no error history\n i === lastLoadedFragLevel || levelInfo.loadError === 0 && levelInfo.fragmentError === 0) && (\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 <= ttfbEstimateSec || !isFiniteNumber(fetchDuration) || live && !_this2.bitrateTestDelay || fetchDuration < maxFetchDuration);\n if (canSwitchWithinTolerance) {\n var forcedAutoLevel = _this2.forcedAutoLevel;\n if (i !== loadLevel && (forcedAutoLevel === -1 || forcedAutoLevel !== loadLevel)) {\n if (levelsSkipped.length) {\n logger.trace(\"[abr] Skipped level(s) \" + levelsSkipped.join(',') + \" of \" + maxAutoLevel + \" max with CODECS and VIDEO-RANGE:\\\"\" + levels[levelsSkipped[0]].codecs + \"\\\" \" + levels[levelsSkipped[0]].videoRange + \"; not compatible with \\\"\" + level.codecs + \"\\\" \" + currentVideoRange);\n }\n logger.info(\"[abr] switch candidate:\" + selectionBaseLevel + \"->\" + i + \" adjustedbw(\" + Math.round(adjustedbw) + \")-bitrate=\" + Math.round(adjustedbw - bitrate) + \" ttfb:\" + ttfbEstimateSec.toFixed(1) + \" avgDuration:\" + avgDuration.toFixed(1) + \" maxFetchDuration:\" + maxFetchDuration.toFixed(1) + \" fetchDuration:\" + fetchDuration.toFixed(1) + \" firstSelection:\" + firstSelection + \" codecSet:\" + currentCodecSet + \" videoRange:\" + currentVideoRange + \" hls.loadLevel:\" + loadLevel);\n }\n if (firstSelection) {\n _this2.firstSelection = i;\n }\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return {\n v: i\n };\n }\n },\n _ret;\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n _ret = _loop();\n if (_ret === 0) continue;\n if (_ret) return _ret.v;\n }\n // not enough time budget even with quality level 0 ... rebuffering might happen\n return -1;\n };\n _createClass(AbrController, [{\n key: \"firstAutoLevel\",\n get: function get() {\n var _this$hls2 = this.hls,\n maxAutoLevel = _this$hls2.maxAutoLevel,\n minAutoLevel = _this$hls2.minAutoLevel;\n var bwEstimate = this.getBwEstimate();\n var maxStartDelay = this.hls.config.maxStarvationDelay;\n var abrAutoLevel = this.findBestLevel(bwEstimate, minAutoLevel, maxAutoLevel, 0, maxStartDelay, 1, 1);\n if (abrAutoLevel > -1) {\n return abrAutoLevel;\n }\n var firstLevel = this.hls.firstLevel;\n var clamped = Math.min(Math.max(firstLevel, minAutoLevel), maxAutoLevel);\n logger.warn(\"[abr] Could not find best starting auto level. Defaulting to first in playlist \" + firstLevel + \" clamped to \" + clamped);\n return clamped;\n }\n }, {\n key: \"forcedAutoLevel\",\n get: function get() {\n if (this.nextAutoLevelKey) {\n return -1;\n }\n return this._nextAutoLevel;\n }\n\n // return next auto level\n }, {\n key: \"nextAutoLevel\",\n get: function get() {\n var forcedAutoLevel = this.forcedAutoLevel;\n var bwEstimator = this.bwEstimator;\n var useEstimate = bwEstimator.canEstimate();\n var loadedFirstFrag = this.lastLoadedFragLevel > -1;\n // in case next auto level has been forced, and bw not available or not reliable, return forced value\n if (forcedAutoLevel !== -1 && (!useEstimate || !loadedFirstFrag || this.nextAutoLevelKey === this.getAutoLevelKey())) {\n return forcedAutoLevel;\n }\n\n // compute next level using ABR logic\n var nextABRAutoLevel = useEstimate && loadedFirstFrag ? this.getNextABRAutoLevel() : this.firstAutoLevel;\n\n // use forced auto level while it hasn't errored more than ABR selection\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\n // save result until state has changed\n this._nextAutoLevel = nextABRAutoLevel;\n this.nextAutoLevelKey = this.getAutoLevelKey();\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n var _this$hls3 = this.hls,\n maxAutoLevel = _this$hls3.maxAutoLevel,\n minAutoLevel = _this$hls3.minAutoLevel;\n var value = Math.min(Math.max(nextLevel, minAutoLevel), maxAutoLevel);\n if (this._nextAutoLevel !== value) {\n this.nextAutoLevelKey = '';\n this._nextAutoLevel = value;\n }\n }\n }]);\n return AbrController;\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 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, pending) {\n var queue = this.queues[type];\n queue.push(operation);\n if (queue.length === 1 && !pending) {\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 queue = this.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 (error) {\n logger.warn(\"[buffer-operation-queue]: Exception executing \\\"\" + type + \"\\\" SourceBuffer operation: \" + error);\n operation.onError(error);\n\n // Only shift the current operation off, otherwise the updateend handler will do this for us\n var sb = this.buffers[type];\n if (!(sb != null && sb.updating)) {\n this.shiftAndExecuteNext(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 VIDEO_CODEC_PROFILE_REPLACE = /(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\\.[^.,]+)+/;\n var BufferController = /*#__PURE__*/function () {\n function BufferController(hls) {\n var _this = this;\n // The level details used to determine duration, target-duration and live\n this.details = null;\n // cache the self generated object url to detect hijack of video tag\n this._objectUrl = null;\n // A queue of buffer operations which require the SourceBuffer to not be updating upon execution\n this.operationQueue = void 0;\n // References to event listeners for each SourceBuffer, so that they can be referenced for event removal\n this.listeners = void 0;\n this.hls = void 0;\n // The number of BUFFER_CODEC events received before any sourceBuffers are created\n this.bufferCodecEventsExpected = 0;\n // The total number of BUFFER_CODEC events received\n this._bufferCodecEventsTotal = 0;\n // A reference to the attached media element\n this.media = null;\n // A reference to the active media source\n this.mediaSource = null;\n // Last MP3 audio chunk appended\n this.lastMpegAudioChunk = null;\n this.appendSource = void 0;\n // counters\n this.appendErrors = {\n audio: 0,\n video: 0,\n audiovideo: 0\n };\n this.tracks = {};\n this.pendingTracks = {};\n this.sourceBuffer = void 0;\n this.log = void 0;\n this.warn = void 0;\n this.error = void 0;\n this._onEndStreaming = function (event) {\n if (!_this.hls) {\n return;\n }\n _this.hls.pauseBuffering();\n };\n this._onStartStreaming = function (event) {\n if (!_this.hls) {\n return;\n }\n _this.hls.resumeBuffering();\n };\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 _this.log('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 mediaSource: mediaSource\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 _this.log('Media source closed');\n };\n this._onMediaSourceEnded = function () {\n _this.log('Media source ended');\n };\n this._onMediaEmptied = function () {\n var mediaSrc = _this.mediaSrc,\n _objectUrl = _this._objectUrl;\n if (mediaSrc !== _objectUrl) {\n logger.error(\"Media element src was set while attaching MediaSource (\" + _objectUrl + \" > \" + mediaSrc + \")\");\n }\n };\n this.hls = hls;\n var logPrefix = '[buffer-controller]';\n this.appendSource = isManagedMediaSource(getMediaSource(hls.config.preferManagedMediaSource));\n this.log = logger.log.bind(logger, logPrefix);\n this.warn = logger.warn.bind(logger, logPrefix);\n this.error = logger.error.bind(logger, logPrefix);\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 // @ts-ignore\n this.hls = 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.appendErrors = {\n audio: 0,\n video: 0,\n audiovideo: 0\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 this.log(this.bufferCodecEventsExpected + \" bufferCodec event(s) expected\");\n };\n _proto.onMediaAttaching = function onMediaAttaching(event, data) {\n var media = this.media = data.media;\n var MediaSource = getMediaSource(this.appendSource);\n if (media && MediaSource) {\n var _ms$constructor;\n var ms = this.mediaSource = new MediaSource();\n this.log(\"created media source: \" + ((_ms$constructor = ms.constructor) == null ? void 0 : _ms$constructor.name));\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 if (this.appendSource) {\n ms.addEventListener('startstreaming', this._onStartStreaming);\n ms.addEventListener('endstreaming', this._onEndStreaming);\n }\n\n // cache the locally generated object url\n var objectUrl = this._objectUrl = self.URL.createObjectURL(ms);\n // link video and media Source\n if (this.appendSource) {\n try {\n media.removeAttribute('src');\n // ManagedMediaSource will not open without disableRemotePlayback set to false or source alternatives\n var MMS = self.ManagedMediaSource;\n media.disableRemotePlayback = media.disableRemotePlayback || MMS && ms instanceof MMS;\n removeSourceChildren(media);\n addSource(media, objectUrl);\n media.load();\n } catch (error) {\n media.src = objectUrl;\n }\n } else {\n media.src = objectUrl;\n }\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 this.log('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 this.warn(\"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 if (this.appendSource) {\n mediaSource.removeEventListener('startstreaming', this._onStartStreaming);\n mediaSource.removeEventListener('endstreaming', this._onEndStreaming);\n }\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 (this.mediaSrc === _objectUrl) {\n media.removeAttribute('src');\n if (this.appendSource) {\n removeSourceChildren(media);\n }\n media.load();\n } else {\n this.warn('media|source.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 _this2.resetBuffer(type);\n });\n this._initSourceBuffer();\n };\n _proto.resetBuffer = function resetBuffer(type) {\n var sb = this.sourceBuffer[type];\n try {\n if (sb) {\n var _this$mediaSource;\n this.removeBufferListeners(type);\n // Synchronously remove the SB from the map before the next call in order to prevent an async function from\n // accessing it\n this.sourceBuffer[type] = undefined;\n if ((_this$mediaSource = this.mediaSource) != null && _this$mediaSource.sourceBuffers.length) {\n this.mediaSource.removeSourceBuffer(sb);\n }\n }\n } catch (err) {\n this.warn(\"onBufferReset \" + type, err);\n }\n };\n _proto.onBufferCodecs = function onBufferCodecs(event, data) {\n var _this3 = this;\n var sourceBufferCount = this.getSourceBufferTypes().length;\n var trackNames = Object.keys(data);\n trackNames.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 _trackCodec;\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 currentCodecFull = pickMostCompleteCodecName(track.codec, track.levelCodec);\n var currentCodec = currentCodecFull == null ? void 0 : currentCodecFull.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');\n var trackCodec = pickMostCompleteCodecName(codec, levelCodec);\n var nextCodec = (_trackCodec = trackCodec) == null ? void 0 : _trackCodec.replace(VIDEO_CODEC_PROFILE_REPLACE, '$1');\n if (trackCodec && currentCodec !== nextCodec) {\n if (trackName.slice(0, 5) === 'audio') {\n trackCodec = getCodecCompatibleName(trackCodec, _this3.appendSource);\n }\n var mimeType = container + \";codecs=\" + trackCodec;\n _this3.appendChangeType(trackName, mimeType);\n _this3.log(\"switching codec \" + currentCodecFull + \" to \" + trackCodec);\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 var bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0);\n if (this.bufferCodecEventsExpected !== bufferCodecEventsExpected) {\n this.log(bufferCodecEventsExpected + \" bufferCodec event(s) expected \" + trackNames.join(','));\n this.bufferCodecEventsExpected = bufferCodecEventsExpected;\n }\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 _this4.log(\"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(error) {\n _this4.warn(\"Failed to change \" + type + \" SourceBuffer type\", error);\n }\n };\n operationQueue.append(operation, type, !!this.pendingTracks[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 _this5.log(\"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.appendErrors[type] = 0;\n if (type === 'audio' || type === 'video') {\n _this5.appendErrors.audiovideo = 0;\n } else {\n _this5.appendErrors.audio = 0;\n _this5.appendErrors.video = 0;\n }\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(error) {\n // in case any error occured while appending, put back segment in segments table\n var event = {\n type: ErrorTypes.MEDIA_ERROR,\n parent: frag.type,\n details: ErrorDetails.BUFFER_APPEND_ERROR,\n sourceBufferName: type,\n frag: frag,\n part: part,\n chunkMeta: chunkMeta,\n error: error,\n err: error,\n fatal: false\n };\n if (error.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 var appendErrorCount = ++_this5.appendErrors[type];\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 _this5.warn(\"Failed \" + appendErrorCount + \"/\" + hls.config.appendErrorMaxRetry + \" times to append segment in \\\"\" + type + \"\\\" sourceBuffer\");\n if (appendErrorCount >= hls.config.appendErrorMaxRetry) {\n event.fatal = true;\n }\n }\n hls.trigger(Events.ERROR, event);\n }\n };\n operationQueue.append(operation, type, !!this.pendingTracks[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(error) {\n _this6.warn(\"Failed to remove from \" + type + \" SourceBuffer\", error);\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 this.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.trimBuffers();\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 _this8.log(type + \" sourceBuffer now EOS\");\n }\n }\n return acc && !!(!sb || sb.ended);\n }, true);\n if (ended) {\n this.log(\"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 _this8.log(\"Could not call mediaSource.endOfStream(). mediaSource.readyState: \" + mediaSource.readyState);\n }\n return;\n }\n _this8.log(\"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.trimBuffers = function trimBuffers() {\n var hls = this.hls,\n details = this.details,\n media = this.media;\n if (!media || details === null) {\n return;\n }\n var sourceBufferTypes = this.getSourceBufferTypes();\n if (!sourceBufferTypes.length) {\n return;\n }\n var config = hls.config;\n var currentTime = media.currentTime;\n var targetDuration = details.levelTargetDuration;\n\n // Support for deprecated liveBackBufferLength\n var backBufferLength = details.live && config.liveBackBufferLength !== null ? config.liveBackBufferLength : config.backBufferLength;\n if (isFiniteNumber(backBufferLength) && backBufferLength > 0) {\n var maxBackBufferLength = Math.max(backBufferLength, targetDuration);\n var targetBackBufferPosition = Math.floor(currentTime / targetDuration) * targetDuration - maxBackBufferLength;\n this.flushBackBuffer(currentTime, targetDuration, targetBackBufferPosition);\n }\n if (isFiniteNumber(config.frontBufferFlushThreshold) && config.frontBufferFlushThreshold > 0) {\n var frontBufferLength = Math.max(config.maxBufferLength, config.frontBufferFlushThreshold);\n var maxFrontBufferLength = Math.max(frontBufferLength, targetDuration);\n var targetFrontBufferPosition = Math.floor(currentTime / targetDuration) * targetDuration + maxFrontBufferLength;\n this.flushFrontBuffer(currentTime, targetDuration, targetFrontBufferPosition);\n }\n };\n _proto.flushBackBuffer = function flushBackBuffer(currentTime, targetDuration, targetBackBufferPosition) {\n var _this9 = this;\n var details = this.details,\n sourceBuffer = this.sourceBuffer;\n var sourceBufferTypes = this.getSourceBufferTypes();\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 _this9.hls.trigger(Events.BACK_BUFFER_REACHED, {\n bufferEnd: targetBackBufferPosition\n });\n\n // Support for deprecated event:\n if (details != null && details.live) {\n _this9.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 _this9.log(\"Cannot flush \" + type + \" back buffer while SourceBuffer is in ended state\");\n return;\n }\n _this9.hls.trigger(Events.BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: targetBackBufferPosition,\n type: type\n });\n }\n }\n });\n };\n _proto.flushFrontBuffer = function flushFrontBuffer(currentTime, targetDuration, targetFrontBufferPosition) {\n var _this10 = this;\n var sourceBuffer = this.sourceBuffer;\n var sourceBufferTypes = this.getSourceBufferTypes();\n sourceBufferTypes.forEach(function (type) {\n var sb = sourceBuffer[type];\n if (sb) {\n var buffered = BufferHelper.getBuffered(sb);\n var numBufferedRanges = buffered.length;\n // The buffer is either empty or contiguous\n if (numBufferedRanges < 2) {\n return;\n }\n var bufferStart = buffered.start(numBufferedRanges - 1);\n var bufferEnd = buffered.end(numBufferedRanges - 1);\n // No flush if we can tolerate the current buffer length or the current buffer range we would flush is contiguous with current position\n if (targetFrontBufferPosition > bufferStart || currentTime >= bufferStart && currentTime <= bufferEnd) {\n return;\n } else if (sb.ended && currentTime - bufferEnd < 2 * targetDuration) {\n _this10.log(\"Cannot flush \" + type + \" front buffer while SourceBuffer is in ended state\");\n return;\n }\n _this10.hls.trigger(Events.BUFFER_FLUSHING, {\n startOffset: bufferStart,\n endOffset: Infinity,\n type: type\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 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 this.log(\"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 this.log(\"Media Source duration is set to \" + mediaSource.duration + \". Setting seekable range to \" + start + \"-\" + end + \".\");\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 || 'audiovideo' in pendingTracks)) {\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 _this11 = this;\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n if (!mediaSource) {\n throw Error('createSourceBuffers called when mediaSource was null');\n }\n var _loop = function _loop(trackName) {\n if (!sourceBuffer[trackName]) {\n var _track$levelCodec;\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 unless it contains multiple comma-separated codec values\n var codec = ((_track$levelCodec = track.levelCodec) == null ? void 0 : _track$levelCodec.indexOf(',')) === -1 ? track.levelCodec : track.codec;\n if (codec) {\n if (trackName.slice(0, 5) === 'audio') {\n codec = getCodecCompatibleName(codec, _this11.appendSource);\n }\n }\n var mimeType = track.container + \";codecs=\" + codec;\n _this11.log(\"creating sourceBuffer(\" + mimeType + \")\");\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n var sbName = trackName;\n _this11.addBufferListener(sbName, 'updatestart', _this11._onSBUpdateStart);\n _this11.addBufferListener(sbName, 'updateend', _this11._onSBUpdateEnd);\n _this11.addBufferListener(sbName, 'error', _this11._onSBUpdateError);\n // ManagedSourceBuffer bufferedchange event\n if (_this11.appendSource) {\n _this11.addBufferListener(sbName, 'bufferedchange', function (type, event) {\n // If media was ejected check for a change. Added ranges are redundant with changes on 'updateend' event.\n var removedRanges = event.removedRanges;\n if (removedRanges != null && removedRanges.length) {\n _this11.hls.trigger(Events.BUFFER_FLUSHED, {\n type: trackName\n });\n }\n });\n }\n _this11.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 _this11.error(\"error while trying to add sourceBuffer: \" + err.message);\n _this11.hls.trigger(Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.BUFFER_ADD_CODEC_ERROR,\n fatal: false,\n error: err,\n sourceBufferName: trackName,\n mimeType: mimeType\n });\n }\n }\n };\n for (var trackName in tracks) {\n _loop(trackName);\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 _this$mediaSource2;\n if (((_this$mediaSource2 = this.mediaSource) == null ? void 0 : _this$mediaSource2.readyState) === 'closed') {\n this.resetBuffer(type);\n return;\n }\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 _this$mediaSource3;\n var error = new Error(type + \" SourceBuffer error. MediaSource readyState: \" + ((_this$mediaSource3 = this.mediaSource) == null ? void 0 : _this$mediaSource3.readyState));\n this.error(\"\" + 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 sourceBufferName: type,\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(error);\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 this.warn(\"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 || sb.ended)) {\n sb.ended = false;\n this.log(\"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 sb = this.sourceBuffer[type];\n if (!sb) {\n if (!this.pendingTracks[type]) {\n throw new Error(\"Attempting to append to the \" + type + \" SourceBuffer, but it does not exist\");\n }\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 _this12 = this;\n if (buffers === void 0) {\n buffers = this.getSourceBufferTypes();\n }\n if (!buffers.length) {\n this.log('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 = _this12.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 _createClass(BufferController, [{\n key: \"mediaSrc\",\n get: function get() {\n var _this$media, _this$media$querySele;\n var media = ((_this$media = this.media) == null ? void 0 : (_this$media$querySele = _this$media.querySelector) == null ? void 0 : _this$media$querySele.call(_this$media, 'source')) || this.media;\n return media == null ? void 0 : media.src;\n }\n }]);\n return BufferController;\n }();\n function removeSourceChildren(node) {\n var sourceChildren = node.querySelectorAll('source');\n [].slice.call(sourceChildren).forEach(function (source) {\n node.removeChild(source);\n });\n }\n function addSource(media, url) {\n var source = self.document.createElement('source');\n source.type = 'video/mp4';\n source.src = url;\n media.appendChild(source);\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 if (this.hls) {\n this.unregisterListener();\n }\n if (this.timer) {\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.LEVELS_UPDATED, this.onLevelsUpdated, 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.LEVELS_UPDATED, this.onLevelsUpdated, 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 if (this.timer && this.hls.levels.length) {\n this.detectPlayerSize();\n }\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 _proto.onLevelsUpdated = function onLevelsUpdated(event, data) {\n if (this.timer && isFiniteNumber(this.autoLevelCapping)) {\n this.detectPlayerSize();\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) {\n if (this.mediaHeight <= 0 || this.mediaWidth <= 0) {\n this.clientRect = null;\n return;\n }\n var levels = this.hls.levels;\n if (levels.length) {\n var hls = this.hls;\n var maxLevel = this.getMaxLevel(levels.length - 1);\n if (maxLevel !== this.autoLevelCapping) {\n logger.log(\"Setting autoLevelCapping to \" + maxLevel + \": \" + levels[maxLevel].height + \"p@\" + levels[maxLevel].bitrate + \" for media \" + this.mediaWidth + \"x\" + this.mediaHeight);\n }\n hls.autoLevelCapping = maxLevel;\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 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 // Prevent changes in aspect-ratio from causing capping to toggle back and forth\n var squareSize = Math.max(width, height);\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n if ((level.width >= squareSize || level.height >= squareSize) && 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 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 // stream controller must be provided as a dependency!\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 PATHWAY_PENALTY_DURATION_MS = 300000;\n var ContentSteeringController = /*#__PURE__*/function () {\n function ContentSteeringController(hls) {\n this.hls = void 0;\n this.log = void 0;\n this.loader = null;\n this.uri = null;\n this.pathwayId = '.';\n this.pathwayPriority = null;\n this.timeToLoad = 300;\n this.reloadTimer = -1;\n this.updated = 0;\n this.started = false;\n this.enabled = true;\n this.levels = null;\n this.audioTracks = null;\n this.subtitleTracks = null;\n this.penalizedPathways = {};\n this.hls = hls;\n this.log = logger.log.bind(logger, \"[content-steering]:\");\n this.registerListeners();\n }\n var _proto = ContentSteeringController.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.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.on(Events.ERROR, this.onError, this);\n };\n _proto.unregisterListeners = function unregisterListeners() {\n var hls = this.hls;\n if (!hls) {\n return;\n }\n hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);\n hls.off(Events.MANIFEST_LOADED, this.onManifestLoaded, this);\n hls.off(Events.MANIFEST_PARSED, this.onManifestParsed, this);\n hls.off(Events.ERROR, this.onError, this);\n };\n _proto.startLoad = function startLoad() {\n this.started = true;\n this.clearTimeout();\n if (this.enabled && this.uri) {\n if (this.updated) {\n var ttl = this.timeToLoad * 1000 - (performance.now() - this.updated);\n if (ttl > 0) {\n this.scheduleRefresh(this.uri, ttl);\n return;\n }\n }\n this.loadSteeringManifest(this.uri);\n }\n };\n _proto.stopLoad = function stopLoad() {\n this.started = false;\n if (this.loader) {\n this.loader.destroy();\n this.loader = null;\n }\n this.clearTimeout();\n };\n _proto.clearTimeout = function clearTimeout() {\n if (this.reloadTimer !== -1) {\n self.clearTimeout(this.reloadTimer);\n this.reloadTimer = -1;\n }\n };\n _proto.destroy = function destroy() {\n this.unregisterListeners();\n this.stopLoad();\n // @ts-ignore\n this.hls = null;\n this.levels = this.audioTracks = this.subtitleTracks = null;\n };\n _proto.removeLevel = function removeLevel(levelToRemove) {\n var levels = this.levels;\n if (levels) {\n this.levels = levels.filter(function (level) {\n return level !== levelToRemove;\n });\n }\n };\n _proto.onManifestLoading = function onManifestLoading() {\n this.stopLoad();\n this.enabled = true;\n this.timeToLoad = 300;\n this.updated = 0;\n this.uri = null;\n this.pathwayId = '.';\n this.levels = this.audioTracks = this.subtitleTracks = null;\n };\n _proto.onManifestLoaded = function onManifestLoaded(event, data) {\n var contentSteering = data.contentSteering;\n if (contentSteering === null) {\n return;\n }\n this.pathwayId = contentSteering.pathwayId;\n this.uri = contentSteering.uri;\n if (this.started) {\n this.startLoad();\n }\n };\n _proto.onManifestParsed = function onManifestParsed(event, data) {\n this.audioTracks = data.audioTracks;\n this.subtitleTracks = data.subtitleTracks;\n };\n _proto.onError = function onError(event, data) {\n var errorAction = data.errorAction;\n if ((errorAction == null ? void 0 : errorAction.action) === NetworkErrorAction.SendAlternateToPenaltyBox && errorAction.flags === ErrorActionFlags.MoveAllAlternatesMatchingHost) {\n var levels = this.levels;\n var pathwayPriority = this.pathwayPriority;\n var errorPathway = this.pathwayId;\n if (data.context) {\n var _data$context = data.context,\n groupId = _data$context.groupId,\n _pathwayId = _data$context.pathwayId,\n type = _data$context.type;\n if (groupId && levels) {\n errorPathway = this.getPathwayForGroupId(groupId, type, errorPathway);\n } else if (_pathwayId) {\n errorPathway = _pathwayId;\n }\n }\n if (!(errorPathway in this.penalizedPathways)) {\n this.penalizedPathways[errorPathway] = performance.now();\n }\n if (!pathwayPriority && levels) {\n // If PATHWAY-PRIORITY was not provided, list pathways for error handling\n pathwayPriority = levels.reduce(function (pathways, level) {\n if (pathways.indexOf(level.pathwayId) === -1) {\n pathways.push(level.pathwayId);\n }\n return pathways;\n }, []);\n }\n if (pathwayPriority && pathwayPriority.length > 1) {\n this.updatePathwayPriority(pathwayPriority);\n errorAction.resolved = this.pathwayId !== errorPathway;\n }\n if (!errorAction.resolved) {\n logger.warn(\"Could not resolve \" + data.details + \" (\\\"\" + data.error.message + \"\\\") with content-steering for Pathway: \" + errorPathway + \" levels: \" + (levels ? levels.length : levels) + \" priorities: \" + JSON.stringify(pathwayPriority) + \" penalized: \" + JSON.stringify(this.penalizedPathways));\n }\n }\n };\n _proto.filterParsedLevels = function filterParsedLevels(levels) {\n // Filter levels to only include those that are in the initial pathway\n this.levels = levels;\n var pathwayLevels = this.getLevelsForPathway(this.pathwayId);\n if (pathwayLevels.length === 0) {\n var _pathwayId2 = levels[0].pathwayId;\n this.log(\"No levels found in Pathway \" + this.pathwayId + \". Setting initial Pathway to \\\"\" + _pathwayId2 + \"\\\"\");\n pathwayLevels = this.getLevelsForPathway(_pathwayId2);\n this.pathwayId = _pathwayId2;\n }\n if (pathwayLevels.length !== levels.length) {\n this.log(\"Found \" + pathwayLevels.length + \"/\" + levels.length + \" levels in Pathway \\\"\" + this.pathwayId + \"\\\"\");\n return pathwayLevels;\n }\n return levels;\n };\n _proto.getLevelsForPathway = function getLevelsForPathway(pathwayId) {\n if (this.levels === null) {\n return [];\n }\n return this.levels.filter(function (level) {\n return pathwayId === level.pathwayId;\n });\n };\n _proto.updatePathwayPriority = function updatePathwayPriority(pathwayPriority) {\n this.pathwayPriority = pathwayPriority;\n var levels;\n\n // Evaluate if we should remove the pathway from the penalized list\n var penalizedPathways = this.penalizedPathways;\n var now = performance.now();\n Object.keys(penalizedPathways).forEach(function (pathwayId) {\n if (now - penalizedPathways[pathwayId] > PATHWAY_PENALTY_DURATION_MS) {\n delete penalizedPathways[pathwayId];\n }\n });\n for (var i = 0; i < pathwayPriority.length; i++) {\n var _pathwayId3 = pathwayPriority[i];\n if (_pathwayId3 in penalizedPathways) {\n continue;\n }\n if (_pathwayId3 === this.pathwayId) {\n return;\n }\n var selectedIndex = this.hls.nextLoadLevel;\n var selectedLevel = this.hls.levels[selectedIndex];\n levels = this.getLevelsForPathway(_pathwayId3);\n if (levels.length > 0) {\n this.log(\"Setting Pathway to \\\"\" + _pathwayId3 + \"\\\"\");\n this.pathwayId = _pathwayId3;\n reassignFragmentLevelIndexes(levels);\n this.hls.trigger(Events.LEVELS_UPDATED, {\n levels: levels\n });\n // Set LevelController's level to trigger LEVEL_SWITCHING which loads playlist if needed\n var levelAfterChange = this.hls.levels[selectedIndex];\n if (selectedLevel && levelAfterChange && this.levels) {\n if (levelAfterChange.attrs['STABLE-VARIANT-ID'] !== selectedLevel.attrs['STABLE-VARIANT-ID'] && levelAfterChange.bitrate !== selectedLevel.bitrate) {\n this.log(\"Unstable Pathways change from bitrate \" + selectedLevel.bitrate + \" to \" + levelAfterChange.bitrate);\n }\n this.hls.nextLoadLevel = selectedIndex;\n }\n break;\n }\n }\n };\n _proto.getPathwayForGroupId = function getPathwayForGroupId(groupId, type, defaultPathway) {\n var levels = this.getLevelsForPathway(defaultPathway).concat(this.levels || []);\n for (var i = 0; i < levels.length; i++) {\n if (type === PlaylistContextType.AUDIO_TRACK && levels[i].hasAudioGroup(groupId) || type === PlaylistContextType.SUBTITLE_TRACK && levels[i].hasSubtitleGroup(groupId)) {\n return levels[i].pathwayId;\n }\n }\n return defaultPathway;\n };\n _proto.clonePathways = function clonePathways(pathwayClones) {\n var _this = this;\n var levels = this.levels;\n if (!levels) {\n return;\n }\n var audioGroupCloneMap = {};\n var subtitleGroupCloneMap = {};\n pathwayClones.forEach(function (pathwayClone) {\n var cloneId = pathwayClone.ID,\n baseId = pathwayClone['BASE-ID'],\n uriReplacement = pathwayClone['URI-REPLACEMENT'];\n if (levels.some(function (level) {\n return level.pathwayId === cloneId;\n })) {\n return;\n }\n var clonedVariants = _this.getLevelsForPathway(baseId).map(function (baseLevel) {\n var attributes = new AttrList(baseLevel.attrs);\n attributes['PATHWAY-ID'] = cloneId;\n var clonedAudioGroupId = attributes.AUDIO && attributes.AUDIO + \"_clone_\" + cloneId;\n var clonedSubtitleGroupId = attributes.SUBTITLES && attributes.SUBTITLES + \"_clone_\" + cloneId;\n if (clonedAudioGroupId) {\n audioGroupCloneMap[attributes.AUDIO] = clonedAudioGroupId;\n attributes.AUDIO = clonedAudioGroupId;\n }\n if (clonedSubtitleGroupId) {\n subtitleGroupCloneMap[attributes.SUBTITLES] = clonedSubtitleGroupId;\n attributes.SUBTITLES = clonedSubtitleGroupId;\n }\n var url = performUriReplacement(baseLevel.uri, attributes['STABLE-VARIANT-ID'], 'PER-VARIANT-URIS', uriReplacement);\n var clonedLevel = new Level({\n attrs: attributes,\n audioCodec: baseLevel.audioCodec,\n bitrate: baseLevel.bitrate,\n height: baseLevel.height,\n name: baseLevel.name,\n url: url,\n videoCodec: baseLevel.videoCodec,\n width: baseLevel.width\n });\n if (baseLevel.audioGroups) {\n for (var i = 1; i < baseLevel.audioGroups.length; i++) {\n clonedLevel.addGroupId('audio', baseLevel.audioGroups[i] + \"_clone_\" + cloneId);\n }\n }\n if (baseLevel.subtitleGroups) {\n for (var _i = 1; _i < baseLevel.subtitleGroups.length; _i++) {\n clonedLevel.addGroupId('text', baseLevel.subtitleGroups[_i] + \"_clone_\" + cloneId);\n }\n }\n return clonedLevel;\n });\n levels.push.apply(levels, clonedVariants);\n cloneRenditionGroups(_this.audioTracks, audioGroupCloneMap, uriReplacement, cloneId);\n cloneRenditionGroups(_this.subtitleTracks, subtitleGroupCloneMap, uriReplacement, cloneId);\n });\n };\n _proto.loadSteeringManifest = function loadSteeringManifest(uri) {\n var _this2 = this;\n var config = this.hls.config;\n var Loader = config.loader;\n if (this.loader) {\n this.loader.destroy();\n }\n this.loader = new Loader(config);\n var url;\n try {\n url = new self.URL(uri);\n } catch (error) {\n this.enabled = false;\n this.log(\"Failed to parse Steering Manifest URI: \" + uri);\n return;\n }\n if (url.protocol !== 'data:') {\n var throughput = (this.hls.bandwidthEstimate || config.abrEwmaDefaultEstimate) | 0;\n url.searchParams.set('_HLS_pathway', this.pathwayId);\n url.searchParams.set('_HLS_throughput', '' + throughput);\n }\n var context = {\n responseType: 'json',\n url: url.href\n };\n var loadPolicy = config.steeringManifestLoadPolicy.default;\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 callbacks = {\n onSuccess: function onSuccess(response, stats, context, networkDetails) {\n _this2.log(\"Loaded steering manifest: \\\"\" + url + \"\\\"\");\n var steeringData = response.data;\n if (steeringData.VERSION !== 1) {\n _this2.log(\"Steering VERSION \" + steeringData.VERSION + \" not supported!\");\n return;\n }\n _this2.updated = performance.now();\n _this2.timeToLoad = steeringData.TTL;\n var reloadUri = steeringData['RELOAD-URI'],\n pathwayClones = steeringData['PATHWAY-CLONES'],\n pathwayPriority = steeringData['PATHWAY-PRIORITY'];\n if (reloadUri) {\n try {\n _this2.uri = new self.URL(reloadUri, url).href;\n } catch (error) {\n _this2.enabled = false;\n _this2.log(\"Failed to parse Steering Manifest RELOAD-URI: \" + reloadUri);\n return;\n }\n }\n _this2.scheduleRefresh(_this2.uri || context.url);\n if (pathwayClones) {\n _this2.clonePathways(pathwayClones);\n }\n var loadedSteeringData = {\n steeringManifest: steeringData,\n url: url.toString()\n };\n _this2.hls.trigger(Events.STEERING_MANIFEST_LOADED, loadedSteeringData);\n if (pathwayPriority) {\n _this2.updatePathwayPriority(pathwayPriority);\n }\n },\n onError: function onError(error, context, networkDetails, stats) {\n _this2.log(\"Error loading steering manifest: \" + error.code + \" \" + error.text + \" (\" + context.url + \")\");\n _this2.stopLoad();\n if (error.code === 410) {\n _this2.enabled = false;\n _this2.log(\"Steering manifest \" + context.url + \" no longer available\");\n return;\n }\n var ttl = _this2.timeToLoad * 1000;\n if (error.code === 429) {\n var loader = _this2.loader;\n if (typeof (loader == null ? void 0 : loader.getResponseHeader) === 'function') {\n var retryAfter = loader.getResponseHeader('Retry-After');\n if (retryAfter) {\n ttl = parseFloat(retryAfter) * 1000;\n }\n }\n _this2.log(\"Steering manifest \" + context.url + \" rate limited\");\n return;\n }\n _this2.scheduleRefresh(_this2.uri || context.url, ttl);\n },\n onTimeout: function onTimeout(stats, context, networkDetails) {\n _this2.log(\"Timeout loading steering manifest (\" + context.url + \")\");\n _this2.scheduleRefresh(_this2.uri || context.url);\n }\n };\n this.log(\"Requesting steering manifest: \" + url);\n this.loader.load(context, loaderConfig, callbacks);\n };\n _proto.scheduleRefresh = function scheduleRefresh(uri, ttlMs) {\n var _this3 = this;\n if (ttlMs === void 0) {\n ttlMs = this.timeToLoad * 1000;\n }\n this.clearTimeout();\n this.reloadTimer = self.setTimeout(function () {\n var _this3$hls;\n var media = (_this3$hls = _this3.hls) == null ? void 0 : _this3$hls.media;\n if (media && !media.ended) {\n _this3.loadSteeringManifest(uri);\n return;\n }\n _this3.scheduleRefresh(uri, _this3.timeToLoad * 1000);\n }, ttlMs);\n };\n return ContentSteeringController;\n }();\n function cloneRenditionGroups(tracks, groupCloneMap, uriReplacement, cloneId) {\n if (!tracks) {\n return;\n }\n Object.keys(groupCloneMap).forEach(function (audioGroupId) {\n var clonedTracks = tracks.filter(function (track) {\n return track.groupId === audioGroupId;\n }).map(function (track) {\n var clonedTrack = _extends({}, track);\n clonedTrack.details = undefined;\n clonedTrack.attrs = new AttrList(clonedTrack.attrs);\n clonedTrack.url = clonedTrack.attrs.URI = performUriReplacement(track.url, track.attrs['STABLE-RENDITION-ID'], 'PER-RENDITION-URIS', uriReplacement);\n clonedTrack.groupId = clonedTrack.attrs['GROUP-ID'] = groupCloneMap[audioGroupId];\n clonedTrack.attrs['PATHWAY-ID'] = cloneId;\n return clonedTrack;\n });\n tracks.push.apply(tracks, clonedTracks);\n });\n }\n function performUriReplacement(uri, stableId, perOptionKey, uriReplacement) {\n var host = uriReplacement.HOST,\n params = uriReplacement.PARAMS,\n perOptionUris = uriReplacement[perOptionKey];\n var perVariantUri;\n if (stableId) {\n perVariantUri = perOptionUris == null ? void 0 : perOptionUris[stableId];\n if (perVariantUri) {\n uri = perVariantUri;\n }\n }\n var url = new self.URL(uri);\n if (host && !perVariantUri) {\n url.host = host;\n }\n if (params) {\n Object.keys(params).sort().forEach(function (key) {\n if (key) {\n url.searchParams.set(key, params[key]);\n }\n });\n }\n return url.href;\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 = null;\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 this.context = null;\n this.xhrSetup = 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 || !context) {\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.loader !== xhr || _this.stats.aborted) return;\n return xhrSetup(xhr, context.url);\n }).catch(function (error) {\n if (_this.loader !== xhr || _this.stats.aborted) return;\n xhr.open('GET', context.url, true);\n return xhrSetup(xhr, context.url);\n }).then(function () {\n if (_this.loader !== xhr || _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 = 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 var _response = {\n url: context.url,\n data: undefined,\n code: _status\n };\n if (shouldRetry(retryConfig, retryCount, false, _response)) {\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 if (!this.config) return;\n var retryConfig = this.config.loadPolicy.timeoutRetry;\n var retryCount = this.stats.retry;\n if (shouldRetry(retryConfig, retryCount, true)) {\n this.retry(retryConfig);\n } else {\n var _this$context;\n logger.warn(\"timeout while loading \" + ((_this$context = this.context) == null ? void 0 : _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 == null ? void 0 : 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 = null;\n this.response = null;\n this.controller = void 0;\n this.context = null;\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 = this.context = this.config = this.request = null;\n this.abortInternal();\n this.response = null;\n // @ts-ignore\n this.fetchSetup = this.controller = this.stats = null;\n };\n _proto.abortInternal = function abortInternal() {\n if (this.controller && !this.stats.loading.end) {\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 if (!response) {\n throw new Error('loader destroyed');\n }\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 preferManagedMediaSource: true,\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 frontBufferFlushThreshold: Infinity,\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 abrEwmaDefaultEstimateMax: 5e6,\n // 5 mbps\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 useMediaCapabilities: false,\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: {\n maxTimeToFirstByteMs: 10000,\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 // 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: ContentSteeringController \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 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._maxAutoLevel = -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.FRAG_BUFFERED, this.onFragBuffered, 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.FRAG_BUFFERED, this.onFragBuffered, 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.stopLoad = function stopLoad() {\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.stopLoad.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 this._maxAutoLevel = -1;\n };\n _proto.onManifestLoading = function onManifestLoading(event, data) {\n this.resetLevels();\n };\n _proto.onManifestLoaded = function onManifestLoaded(event, data) {\n var preferManagedMediaSource = this.hls.config.preferManagedMediaSource;\n var levels = [];\n var redundantSet = {};\n var generatePathwaySet = {};\n var resolutionFound = false;\n var videoCodecFound = false;\n var audioCodecFound = false;\n data.levels.forEach(function (levelParsed) {\n var _audioCodec, _videoCodec;\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 var audioCodec = levelParsed.audioCodec,\n videoCodec = levelParsed.videoCodec;\n if (((_audioCodec = audioCodec) == null ? void 0 : _audioCodec.indexOf('mp4a.40.34')) !== -1) {\n chromeOrFirefox || (chromeOrFirefox = /chrome|firefox/i.test(navigator.userAgent));\n if (chromeOrFirefox) {\n levelParsed.audioCodec = audioCodec = undefined;\n }\n }\n if (audioCodec) {\n levelParsed.audioCodec = audioCodec = getCodecCompatibleName(audioCodec, preferManagedMediaSource);\n }\n if (((_videoCodec = videoCodec) == null ? void 0 : _videoCodec.indexOf('avc1')) === 0) {\n videoCodec = levelParsed.videoCodec = convertAVC1ToAVCOTI(videoCodec);\n }\n\n // only keep levels with supported audio/video codecs\n var width = levelParsed.width,\n height = levelParsed.height,\n unknownCodecs = levelParsed.unknownCodecs;\n resolutionFound || (resolutionFound = !!(width && height));\n videoCodecFound || (videoCodecFound = !!videoCodec);\n audioCodecFound || (audioCodecFound = !!audioCodec);\n if (unknownCodecs != null && unknownCodecs.length || audioCodec && !areCodecsMediaSourceSupported(audioCodec, 'audio', preferManagedMediaSource) || videoCodec && !areCodecsMediaSourceSupported(videoCodec, 'video', preferManagedMediaSource)) {\n return;\n }\n var CODECS = attributes.CODECS,\n FRAMERATE = attributes['FRAME-RATE'],\n HDCP = attributes['HDCP-LEVEL'],\n PATHWAY = attributes['PATHWAY-ID'],\n RESOLUTION = attributes.RESOLUTION,\n VIDEO_RANGE = attributes['VIDEO-RANGE'];\n var contentSteeringPrefix = (PATHWAY || '.') + \"-\";\n var levelKey = \"\" + contentSteeringPrefix + levelParsed.bitrate + \"-\" + RESOLUTION + \"-\" + FRAMERATE + \"-\" + CODECS + \"-\" + VIDEO_RANGE + \"-\" + HDCP;\n if (!redundantSet[levelKey]) {\n var level = new Level(levelParsed);\n redundantSet[levelKey] = level;\n generatePathwaySet[levelKey] = 1;\n levels.push(level);\n } else if (redundantSet[levelKey].uri !== levelParsed.url && !levelParsed.attrs['PATHWAY-ID']) {\n // Assign Pathway IDs to Redundant Streams (default Pathways is \".\". Redundant Streams \"..\", \"...\", and so on.)\n // Content Steering controller to handles Pathway fallback on error\n var pathwayCount = generatePathwaySet[levelKey] += 1;\n levelParsed.attrs['PATHWAY-ID'] = new Array(pathwayCount + 1).join('.');\n var _level = new Level(levelParsed);\n redundantSet[levelKey] = _level;\n levels.push(_level);\n } else {\n redundantSet[levelKey].addGroupId('audio', attributes.AUDIO);\n redundantSet[levelKey].addGroupId('text', attributes.SUBTITLES);\n }\n });\n this.filterAndSortMediaOptions(levels, data, resolutionFound, videoCodecFound, audioCodecFound);\n };\n _proto.filterAndSortMediaOptions = function filterAndSortMediaOptions(filteredLevels, data, resolutionFound, videoCodecFound, audioCodecFound) {\n var _this2 = this;\n var audioTracks = [];\n var subtitleTracks = [];\n var levels = filteredLevels;\n\n // remove audio-only and invalid video-range levels if we also have levels with video codecs or RESOLUTION signalled\n if ((resolutionFound || videoCodecFound) && audioCodecFound) {\n levels = levels.filter(function (_ref) {\n var videoCodec = _ref.videoCodec,\n videoRange = _ref.videoRange,\n width = _ref.width,\n height = _ref.height;\n return (!!videoCodec || !!(width && height)) && isVideoRange(videoRange);\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 if (data.levels.length) {\n _this2.warn(\"One or more CODECS in variant not supported: \" + JSON.stringify(data.levels[0].attrs));\n }\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 var preferManagedMediaSource = this.hls.config.preferManagedMediaSource;\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || areCodecsMediaSourceSupported(track.audioCodec, 'audio', preferManagedMediaSource);\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 // sort on height before bitrate for cap-level-controller\n if (resolutionFound && a.height !== b.height) {\n return a.height - b.height;\n }\n if (a.frameRate !== b.frameRate) {\n return a.frameRate - b.frameRate;\n }\n if (a.videoRange !== b.videoRange) {\n return VideoRangeValues.indexOf(a.videoRange) - VideoRangeValues.indexOf(b.videoRange);\n }\n if (a.videoCodec !== b.videoCodec) {\n var valueA = videoCodecPreferenceValue(a.videoCodec);\n var valueB = videoCodecPreferenceValue(b.videoCodec);\n if (valueA !== valueB) {\n return valueB - valueA;\n }\n }\n if (a.uri === b.uri && a.codecSet !== b.codecSet) {\n var _valueA = codecsSetSelectionPreferenceValue(a.codecSet);\n var _valueB = codecsSetSelectionPreferenceValue(b.codecSet);\n if (_valueA !== _valueB) {\n return _valueB - _valueA;\n }\n }\n if (a.averageBitrate !== b.averageBitrate) {\n return a.averageBitrate - b.averageBitrate;\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 var _this$hls$userConfig;\n this._firstLevel = _i;\n var firstLevelBitrate = firstLevelInPlaylist.bitrate;\n var bandwidthEstimate = this.hls.bandwidthEstimate;\n this.log(\"manifest loaded, \" + levels.length + \" level(s) found, first bitrate: \" + firstLevelBitrate);\n // Update default bwe to first variant bitrate as long it has not been configured or set\n if (((_this$hls$userConfig = this.hls.userConfig) == null ? void 0 : _this$hls$userConfig.abrEwmaDefaultEstimate) === undefined) {\n var startingBwEstimate = Math.min(firstLevelBitrate, this.hls.config.abrEwmaDefaultEstimateMax);\n if (startingBwEstimate > bandwidthEstimate && bandwidthEstimate === hlsDefaultConfig.abrEwmaDefaultEstimate) {\n this.hls.bandwidthEstimate = startingBwEstimate;\n }\n }\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.onFragBuffered = function onFragBuffered(event, _ref2) {\n var frag = _ref2.frag;\n if (frag !== undefined && frag.type === PlaylistLevelType.MAIN) {\n var el = frag.elementaryStreams;\n if (!Object.keys(el).some(function (type) {\n return !!el[type];\n })) {\n return;\n }\n var level = this._levels[frag.level];\n if (level != null && level.loadError) {\n this.log(\"Resetting level error count of \" + level.loadError + \" on frag buffered\");\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.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 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 : '') + \" \" + 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 pathwayId: currentLevel.attrs['PATHWAY-ID'],\n id: 0,\n // Deprecated Level urlId\n deliveryDirectives: hlsUrlParameters || null\n });\n }\n };\n _proto.removeLevel = function removeLevel(levelIndex) {\n var _this3 = this,\n _this$currentLevel;\n var levels = this._levels.filter(function (level, index) {\n if (index !== levelIndex) {\n return true;\n }\n if (_this3.steering) {\n _this3.steering.removeLevel(level);\n }\n if (level === _this3.currentLevel) {\n _this3.currentLevel = null;\n _this3.currentLevelIndex = -1;\n if (level.details) {\n level.details.fragments.forEach(function (f) {\n return f.level = -1;\n });\n }\n }\n return false;\n });\n reassignFragmentLevelIndexes(levels);\n this._levels = levels;\n if (this.currentLevelIndex > -1 && (_this$currentLevel = this.currentLevel) != null && _this$currentLevel.details) {\n this.currentLevelIndex = this.currentLevel.details.fragments[0].level;\n }\n this.hls.trigger(Events.LEVELS_UPDATED, {\n levels: levels\n });\n };\n _proto.onLevelsUpdated = function onLevelsUpdated(event, _ref3) {\n var levels = _ref3.levels;\n this._levels = levels;\n };\n _proto.checkMaxAutoUpdated = function checkMaxAutoUpdated() {\n var _this$hls = this.hls,\n autoLevelCapping = _this$hls.autoLevelCapping,\n maxAutoLevel = _this$hls.maxAutoLevel,\n maxHdcpLevel = _this$hls.maxHdcpLevel;\n if (this._maxAutoLevel !== maxAutoLevel) {\n this._maxAutoLevel = maxAutoLevel;\n this.hls.trigger(Events.MAX_AUTO_LEVEL_UPDATED, {\n autoLevelCapping: autoLevelCapping,\n levels: this.levels,\n maxAutoLevel: maxAutoLevel,\n minAutoLevel: this.hls.minAutoLevel,\n maxHdcpLevel: maxHdcpLevel\n });\n }\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 + \" (\" + (level.height ? level.height + 'p ' : '') + (level.videoRange ? level.videoRange + ' ' : '') + (level.codecSet ? level.codecSet + ' ' : '') + \"@\" + level.bitrate + \")\" + (pathwayId ? ' with Pathway ' + pathwayId : '') + \" from level \" + lastLevelIndex + (lastPathwayId ? ' with Pathway ' + lastPathwayId : ''));\n var levelSwitchingData = {\n level: newLevel,\n attrs: level.attrs,\n details: level.details,\n bitrate: level.bitrate,\n averageBitrate: level.averageBitrate,\n maxBitrate: level.maxBitrate,\n realBitrate: level.realBitrate,\n width: level.width,\n height: level.height,\n codecSet: level.codecSet,\n audioCodec: level.audioCodec,\n videoCodec: level.videoCodec,\n audioGroups: level.audioGroups,\n subtitleGroups: level.subtitleGroups,\n loaded: level.loaded,\n loadError: level.loadError,\n fragmentError: level.fragmentError,\n name: level.name,\n id: level.id,\n uri: level.uri,\n url: level.url,\n urlId: 0,\n audioGroupIds: level.audioGroupIds,\n textGroupIds: level.textGroupIds\n };\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, levelDetails);\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 // Setting hls.startLevel (this._startLevel) overrides config.startLevel\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n if (configStartLevel !== undefined) {\n return configStartLevel;\n }\n return this.hls.firstAutoLevel;\n }\n return this._startLevel;\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 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 var start = Math.max(startPTS, timeRange.start(i));\n var end = Math.min(endPTS, timeRange.end(i));\n if (end > start) {\n buffered.partial = true;\n // Check for intersection with buffer\n // Get playable sections of the fragment\n buffered.time.push({\n startPTS: start,\n endPTS: end\n });\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.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 var _loader$context;\n if (type && type !== ((_loader$context = loader.context) == null ? void 0 : _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 1; // break\n }\n };\n for (var i = 0; i < encryptedFragments.length; i++) {\n if (_loop()) 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 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 for (var i = 0, len = fragments.length; i < len; i++) {\n var _fragments$i;\n if (((_fragments$i = fragments[i]) == null ? void 0 : _fragments$i.cc) === cc) {\n return fragments[i];\n }\n }\n return null;\n }\n function shouldAlignOnDiscontinuities(lastFrag, switchDetails, details) {\n if (switchDetails) {\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) {\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, switchDetails, details) {\n if (!switchDetails) {\n return;\n }\n alignDiscontinuities(lastFrag, details, switchDetails);\n if (!details.alignedSliding && switchDetails) {\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 alignMediaPlaylistByPDT(details, switchDetails);\n }\n if (!details.alignedSliding && switchDetails && !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(switchDetails, 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, switchDetails) {\n if (shouldAlignOnDiscontinuities(lastFrag, switchDetails, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(switchDetails, 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 * Ensures appropriate time-alignment between renditions based on PDT.\n * This function assumes the timelines represented in `refDetails` are accurate, including the PDTs\n * for the last discontinuity sequence number shared by both playlists when present,\n * and uses the \"wallclock\"/PDT timeline as a cross-reference to `details`, adjusting the presentation\n * times/timelines of `details` accordingly.\n * Given the asynchronous nature of fetches and initial loads of live `main` and audio/subtitle tracks,\n * the primary purpose of this function is to ensure the \"local timelines\" of audio/subtitle tracks\n * are aligned to the main/video timeline, using PDT as the cross-reference/\"anchor\" that should\n * be consistent across playlists, per the HLS spec.\n * @param details - The details of the rendition you'd like to time-align (e.g. an audio rendition).\n * @param refDetails - The details of the reference rendition with start and PDT times for alignment.\n */\n function alignMediaPlaylistByPDT(details, refDetails) {\n if (!details.hasProgramDateTime || !refDetails.hasProgramDateTime) {\n return;\n }\n var fragments = details.fragments;\n var refFragments = refDetails.fragments;\n if (!fragments.length || !refFragments.length) {\n return;\n }\n\n // Calculate a delta to apply to all fragments according to the delta in PDT times and start times\n // of a fragment in the reference details, and a fragment in the target details of the same discontinuity.\n // If a fragment of the same discontinuity was not found use the middle fragment of both.\n var refFrag;\n var frag;\n var targetCC = Math.min(refDetails.endCC, details.endCC);\n if (refDetails.startCC < targetCC && details.startCC < targetCC) {\n refFrag = findFirstFragWithCC(refFragments, targetCC);\n frag = findFirstFragWithCC(fragments, targetCC);\n }\n if (!refFrag || !frag) {\n refFrag = refFragments[Math.floor(refFragments.length / 2)];\n frag = findFirstFragWithCC(fragments, refFrag.cc) || fragments[Math.floor(fragments.length / 2)];\n }\n var refPDT = refFrag.programDateTime;\n var targetPDT = frag.programDateTime;\n if (!refPDT || !targetPDT) {\n return;\n }\n var delta = (targetPDT - refPDT) / 1000 - (frag.start - refFrag.start);\n adjustSlidingStart(delta, details);\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 this.useSoftware = !this.subtle;\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 if (this.key !== key || !this.fastAesKey) {\n if (!this.subtle) {\n return Promise.resolve(this.onWebCryptoError(data, key, iv));\n }\n this.key = key;\n this.fastAesKey = new FastAESKey(this.subtle, key);\n }\n return this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n if (!_this2.subtle) {\n return Promise.reject(new Error('web crypto not initialized'));\n }\n _this2.logOnce('WebCrypto AES decrypt');\n var crypto = new AESCrypto(_this2.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$levelLastLoaded;\n return (_this$levelLastLoaded = this.levelLastLoaded) == null ? void 0 : _this$levelLastLoaded.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.hls.off(Events.MANIFEST_LOADED, this.onManifestLoaded, this);\n this.stopLoad();\n _TaskLoop.prototype.onHandlerDestroying.call(this);\n // @ts-ignore\n this.hls = null;\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(\"Frag error: \" + ((reason == null ? void 0 : reason.message) || 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 max buffer length 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 backtracking, always remove from the tracker without reducing max buffer length\n var backtrackFragment = this.backtrackFragment;\n var backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;\n if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength, frag.duration)) {\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 != null && 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 _this3.completeInitSegmentLoad(data);\n });\n }\n return _this3.completeInitSegmentLoad(data);\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.completeInitSegmentLoad = function completeInitSegmentLoad(data) {\n var levels = this.levels;\n if (!levels) {\n throw new Error('init load aborted, missing levels');\n }\n var stats = data.frag.stats;\n this.state = State.IDLE;\n data.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 this.tick();\n };\n _proto.fragContextChanged = function fragContextChanged(frag) {\n var fragCurrent = this.fragCurrent;\n return !frag || !fragCurrent || frag.sn !== fragCurrent.sn || frag.level !== fragCurrent.level;\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 if (frag.sn !== 'initSegment') {\n var _this$levels;\n if (frag.type !== PlaylistLevelType.SUBTITLE) {\n var el = frag.elementaryStreams;\n if (!Object.keys(el).some(function (type) {\n return !!el[type];\n })) {\n // empty segment\n this.state = State.IDLE;\n return;\n }\n }\n var level = (_this$levels = this.levels) == null ? void 0 : _this$levels[frag.level];\n if (level != null && level.fragmentError) {\n this.log(\"Resetting level fragment error count of \" + level.fragmentError + \" on frag buffered\");\n level.fragmentError = 0;\n }\n }\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, fragDuration) {\n var config = this.config;\n var minLength = Math.max(Math.min(threshold - fragDuration, config.maxBufferLength), fragDuration);\n var reducedLength = Math.max(threshold - fragDuration * 3, config.maxMaxBufferLength / 2, minLength);\n if (reducedLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength = reducedLength;\n this.warn(\"Reduce max buffer length to \" + reducedLength + \"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 || pos < start) {\n frag = this.getInitialLiveFragment(levelDetails, fragments);\n this.startPosition = this.nextLoadPosition = 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 maxFragLookUpTolerance = 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 - maxFragLookUpTolerance ? 0 : maxFragLookUpTolerance;\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, switchDetails) {\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 var fragPrevious = this.fragPrevious;\n alignStream(fragPrevious, switchDetails, 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 this.resetStartWhenNotLoaded(this.levelLastLoaded);\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 && action !== NetworkErrorAction.RemoveAlternatePermanently) {\n errorAction.resolved = true;\n }\n } else {\n logger.warn(data.details + \" reached or exceeded max retry (\" + retryCount + \")\");\n return;\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 frag = data.frag;\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, (frag == null ? void 0 : frag.duration) || 10);\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 (frag) {\n this.fragmentTracker.removeFragment(frag);\n this.nextLoadPosition = 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 = level ? 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 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.levelLastLoaded);\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 && ((_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 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 this.fragmentTracker.removeAllFragments();\n this.resetTransmuxer();\n this.resetStartWhenNotLoaded(this.levelLastLoaded);\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 function isMSESupported() {\n var mediaSource = getMediaSource();\n if (!mediaSource) {\n return false;\n }\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 sourceBuffer = getSourceBuffer();\n return !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n }\n function isSupported() {\n if (!isMSESupported()) {\n return false;\n }\n var mediaSource = getMediaSource();\n return typeof (mediaSource == null ? void 0 : mediaSource.isTypeSupported) === 'function' && (['avc1.42E01E,mp4a.40.2', 'av01.0.01M.08', 'vp09.00.50.08'].some(function (codecsForVideoContainer) {\n return mediaSource.isTypeSupported(mimeTypeForCodec(codecsForVideoContainer, 'video'));\n }) || ['mp4a.40.2', 'fLaC'].some(function (codecForAudioContainer) {\n return mediaSource.isTypeSupported(mimeTypeForCodec(codecForAudioContainer, 'audio'));\n }));\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 var error = new Error(\"invalid ADTS sampling index:\" + adtsSamplingIndex);\n observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: true,\n error: error,\n reason: error.message\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 /**\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 var BytesInSlot = [0,\n // Reserved\n 1,\n // Layer3\n 1,\n // Layer2\n 4 // Layer1\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 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$2(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 == null ? void 0 : id3Data.length) || 0;\n if (probe(data, offset)) {\n return false;\n }\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 return hasMoofData(data);\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 var getAudioBSID = function getAudioBSID(data, offset) {\n // check the bsid to confirm ac-3 | ec-3\n var bsid = 0;\n var numBits = 5;\n offset += numBits;\n var temp = new Uint32Array(1); // unsigned 32 bit for temporary storage\n var mask = new Uint32Array(1); // unsigned 32 bit mask value\n var _byte = new Uint8Array(1); // unsigned 8 bit for temporary storage\n while (numBits > 0) {\n _byte[0] = data[offset];\n // read remaining bits, upto 8 bits at a time\n var bits = Math.min(numBits, 8);\n var shift = 8 - bits;\n mask[0] = 0xff000000 >>> 24 + shift << shift;\n temp[0] = (_byte[0] & mask[0]) >> shift;\n bsid = !bsid ? temp[0] : bsid << bits | temp[0];\n offset += 1;\n numBits -= bits;\n }\n return bsid;\n };\n\n var BaseVideoParser = /*#__PURE__*/function () {\n function BaseVideoParser() {\n this.VideoSample = null;\n }\n var _proto = BaseVideoParser.prototype;\n _proto.createVideoSample = function createVideoSample(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 _proto.getLastNalUnit = function getLastNalUnit(samples) {\n var _VideoSample;\n var VideoSample = this.VideoSample;\n var lastUnit;\n // try to fallback to previous sample if current one is empty\n if (!VideoSample || VideoSample.units.length === 0) {\n VideoSample = samples[samples.length - 1];\n }\n if ((_VideoSample = VideoSample) != null && _VideoSample.units) {\n var units = VideoSample.units;\n lastUnit = units[units.length - 1];\n }\n return lastUnit;\n };\n _proto.pushAccessUnit = function pushAccessUnit(VideoSample, videoTrack) {\n if (VideoSample.units.length && VideoSample.frame) {\n // if sample does not have PTS/DTS, patch with last sample PTS/DTS\n if (VideoSample.pts === undefined) {\n var samples = videoTrack.samples;\n var nbSamples = samples.length;\n if (nbSamples) {\n var lastSample = samples[nbSamples - 1];\n VideoSample.pts = lastSample.pts;\n VideoSample.dts = lastSample.dts;\n } else {\n // dropping samples, no timestamp found\n videoTrack.dropped++;\n return;\n }\n }\n videoTrack.samples.push(VideoSample);\n }\n if (VideoSample.debug.length) {\n logger.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);\n }\n };\n return BaseVideoParser;\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 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 var AvcVideoParser = /*#__PURE__*/function (_BaseVideoParser) {\n _inheritsLoose(AvcVideoParser, _BaseVideoParser);\n function AvcVideoParser() {\n return _BaseVideoParser.apply(this, arguments) || this;\n }\n var _proto = AvcVideoParser.prototype;\n _proto.parseAVCPES = function parseAVCPES(track, textTrack, pes, last, duration) {\n var _this = this;\n var units = this.parseAVCNALu(track, pes.data);\n var VideoSample = this.VideoSample;\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 (VideoSample && units.length && !track.audFound) {\n this.pushAccessUnit(VideoSample, track);\n VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');\n }\n units.forEach(function (unit) {\n var _VideoSample2;\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 _VideoSample;\n // if we have non-keyframe data already, that cannot belong to the same frame as a keyframe, so force a push\n if ((_VideoSample = VideoSample) != null && _VideoSample.frame && !VideoSample.key) {\n _this.pushAccessUnit(VideoSample, track);\n VideoSample = _this.VideoSample = null;\n }\n }\n if (!VideoSample) {\n VideoSample = _this.VideoSample = _this.createVideoSample(true, pes.pts, pes.dts, '');\n }\n VideoSample.frame = true;\n VideoSample.key = iskey;\n break;\n // IDR\n }\n case 5:\n push = true;\n // handle PES not starting with AUD\n // if we have frame data already, that cannot belong to the same frame, so force a push\n if ((_VideoSample2 = VideoSample) != null && _VideoSample2.frame && !VideoSample.key) {\n _this.pushAccessUnit(VideoSample, track);\n VideoSample = _this.VideoSample = null;\n }\n if (!VideoSample) {\n VideoSample = _this.VideoSample = _this.createVideoSample(true, pes.pts, pes.dts, '');\n }\n VideoSample.key = true;\n VideoSample.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 case 7:\n {\n var _track$pixelRatio, _track$pixelRatio2;\n push = true;\n spsfound = true;\n var sps = unit.data;\n var expGolombDecoder = new ExpGolomb(sps);\n var config = expGolombDecoder.readSPS();\n if (!track.sps || track.width !== config.width || track.height !== config.height || ((_track$pixelRatio = track.pixelRatio) == null ? void 0 : _track$pixelRatio[0]) !== config.pixelRatio[0] || ((_track$pixelRatio2 = track.pixelRatio) == null ? void 0 : _track$pixelRatio2[1]) !== config.pixelRatio[1]) {\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [sps];\n track.duration = 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 }\n // PPS\n case 8:\n push = true;\n track.pps = [unit.data];\n break;\n // AUD\n case 9:\n push = true;\n track.audFound = true;\n if (VideoSample) {\n _this.pushAccessUnit(VideoSample, track);\n }\n VideoSample = _this.VideoSample = _this.createVideoSample(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 (VideoSample) {\n VideoSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n break;\n }\n if (VideoSample && push) {\n var _units = VideoSample.units;\n _units.push(unit);\n }\n });\n // if last PES packet, push samples\n if (last && VideoSample) {\n this.pushAccessUnit(VideoSample, track);\n this.VideoSample = null;\n }\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 overflow = i - state - 1;\n if (lastUnitStart >= 0) {\n var unit = {\n data: array.subarray(lastUnitStart, overflow),\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\n if (overflow > 0) {\n // logger.log('first NALU found with overflow:' + overflow);\n lastUnit.data = appendUint8Array(lastUnit.data, array.subarray(0, overflow));\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 _lastUnit.data = appendUint8Array(_lastUnit.data, array);\n }\n }\n track.naluState = state;\n return units;\n };\n return AvcVideoParser;\n }(BaseVideoParser);\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._videoTrack = void 0;\n this._audioTrack = void 0;\n this._id3Track = void 0;\n this._txtTrack = void 0;\n this.aacOverFlow = null;\n this.remainderData = null;\n this.videoParser = void 0;\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.videoParser = new AvcVideoParser();\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, 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 && (length - j === PACKET_LENGTH || data[j + PACKET_LENGTH] === 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\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._videoTrack = 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.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 _videoTrack = this._videoTrack,\n _id3Track = this._id3Track;\n if (_audioTrack) {\n _audioTrack.pesData = null;\n }\n if (_videoTrack) {\n _videoTrack.pesData = null;\n }\n if (_id3Track) {\n _id3Track.pesData = null;\n }\n this.aacOverFlow = 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._videoTrack;\n var audioTrack = this._audioTrack;\n var id3Track = this._id3Track;\n var textTrack = this._txtTrack;\n var videoPid = videoTrack.pid;\n var videoData = videoTrack.pesData;\n var audioPid = audioTrack.pid;\n var id3Pid = 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 videoPid:\n if (stt) {\n if (videoData && (pes = parsePES(videoData))) {\n this.videoParser.parseAVCPES(videoTrack, textTrack, pes, false, this._duration);\n }\n videoData = {\n data: [],\n size: 0\n };\n }\n if (videoData) {\n videoData.data.push(data.subarray(offset, start + PACKET_LENGTH));\n videoData.size += start + PACKET_LENGTH - offset;\n }\n break;\n case audioPid:\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 id3Pid:\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, this.observer);\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 videoPid = parsedPIDs.videoPid;\n if (videoPid > 0) {\n videoTrack.pid = videoPid;\n videoTrack.segmentCodec = parsedPIDs.segmentVideoCodec;\n }\n audioPid = parsedPIDs.audioPid;\n if (audioPid > 0) {\n audioTrack.pid = audioPid;\n audioTrack.segmentCodec = parsedPIDs.segmentAudioCodec;\n }\n id3Pid = parsedPIDs.id3Pid;\n if (id3Pid > 0) {\n id3Track.pid = id3Pid;\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 emitParsingError(this.observer, new Error(\"Found \" + tsPacketErrors + \" TS packet/s that do not start with 0x47\"));\n }\n videoTrack.pesData = videoData;\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._videoTrack,\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 videoData = videoTrack.pesData;\n var audioData = audioTrack.pesData;\n var id3Data = id3Track.pesData;\n // try to parse last PES packets\n var pes;\n if (videoData && (pes = parsePES(videoData))) {\n this.videoParser.parseAVCPES(videoTrack, textTrack, pes, true, this._duration);\n videoTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n videoTrack.pesData = videoData;\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.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 data = appendUint8Array(aacOverFlow.sample.unit, data);\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 emitParsingError(this.observer, new Error(reason), recoverable);\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.parseAC3PES = function parseAC3PES(track, pes) {\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._videoTrack ? MetadataSchema.emsg : MetadataSchema.audioId3,\n duration: Number.POSITIVE_INFINITY\n });\n id3Track.samples.push(id3Sample);\n };\n return TSDemuxer;\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, observer) {\n var result = {\n audioPid: -1,\n videoPid: -1,\n id3Pid: -1,\n segmentVideoCodec: 'avc',\n segmentAudioCodec: '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 var esInfoLength = (data[offset + 3] & 0x0f) << 8 | data[offset + 4];\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n logEncryptedSamplesFoundInUnencryptedStream('ADTS AAC');\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.audioPid === -1) {\n result.audioPid = pid;\n }\n break;\n\n // Packetized metadata (ID3)\n case 0x15:\n // logger.log('ID3 PID:' + pid);\n if (result.id3Pid === -1) {\n result.id3Pid = pid;\n }\n break;\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n logEncryptedSamplesFoundInUnencryptedStream('H.264');\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.videoPid === -1) {\n result.videoPid = pid;\n result.segmentVideoCodec = 'avc';\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 && !typeSupported.mp3) {\n logger.log('MPEG audio found, not supported in this browser');\n } else if (result.audioPid === -1) {\n result.audioPid = pid;\n result.segmentAudioCodec = 'mp3';\n }\n break;\n case 0xc1:\n // SAMPLE-AES AC3\n if (!isSampleAes) {\n logEncryptedSamplesFoundInUnencryptedStream('AC-3');\n break;\n }\n /* falls through */\n case 0x81:\n {\n logger.warn('AC-3 in M2TS support not included in build');\n }\n break;\n case 0x06:\n // stream_type 6 can mean a lot of different things in case of DVB.\n // We need to look at the descriptors. Right now, we're only interested\n // in AC-3 audio, so we do the descriptor parsing only when we don't have\n // an audio PID yet.\n if (result.audioPid === -1 && esInfoLength > 0) {\n var parsePos = offset + 5;\n var remaining = esInfoLength;\n while (remaining > 2) {\n var descriptorId = data[parsePos];\n switch (descriptorId) {\n case 0x6a:\n // DVB Descriptor for AC-3\n {\n logger.warn('AC-3 in M2TS support not included in build');\n }\n break;\n }\n var descriptorLen = data[parsePos + 1] + 2;\n parsePos += descriptorLen;\n remaining -= descriptorLen;\n }\n }\n break;\n case 0xc2: // SAMPLE-AES EC3\n /* falls through */\n case 0x87:\n emitParsingError(observer, new Error('Unsupported EC-3 in M2TS found'));\n return result;\n case 0x24:\n emitParsingError(observer, new Error('Unsupported HEVC in M2TS found'));\n return result;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += esInfoLength + 5;\n }\n return result;\n }\n function emitParsingError(observer, error, levelRetry) {\n logger.warn(\"parsing error: \" + error.message);\n observer.emit(Events.ERROR, Events.ERROR, {\n type: ErrorTypes.MEDIA_ERROR,\n details: ErrorDetails.FRAG_PARSING_ERROR,\n fatal: false,\n levelRetry: levelRetry,\n error: error,\n reason: error.message\n });\n }\n function logEncryptedSamplesFoundInUnencryptedStream(type) {\n logger.log(type + \" with AES-128-CBC encryption found in unencrypted stream\");\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 data[0] = appendUint8Array(data[0], data[1]);\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\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 == null ? void 0 : id3Data.length) || 0;\n\n // Check for ac-3|ec-3 sync bytes and return false if present\n if (id3Data && data[offset] === 0x0b && data[offset + 1] === 0x77 && getTimeStamp(id3Data) !== undefined &&\n // check the bsid to confirm ac-3 or ec-3 (not mp3)\n getAudioBSID(data, offset) <= 16) {\n return false;\n }\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 dac3: [],\n 'ac-3': [],\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 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 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 var stco = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\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 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 MP4.SMHD = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00,\n // balance\n 0x00, 0x00 // reserved\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 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.audioStsd = function audioStsd(track) {\n var samplerate = track.samplerate;\n return 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.mp4a = function mp4a(track) {\n return MP4.box(MP4.types.mp4a, MP4.audioStsd(track), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n MP4.mp3 = function mp3(track) {\n return MP4.box(MP4.types['.mp3'], MP4.audioStsd(track));\n };\n MP4.ac3 = function ac3(track) {\n return MP4.box(MP4.types['ac-3'], MP4.audioStsd(track), MP4.box(MP4.types.dac3, track.config));\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 if (track.segmentCodec === 'ac3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.ac3(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 = appendUint8Array(MP4.FTYP, movie);\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 AC3_SAMPLES_PER_FRAME = 1536;\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.videoTrackConfig = void 0;\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 // @ts-ignore\n this.config = this.videoTrackConfig = this._initPTS = this._initDTS = null;\n };\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 this.videoTrackConfig = undefined;\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 var _videoTrack$pixelRati, _config$pixelRatio, _videoTrack$pixelRati2, _config$pixelRatio2;\n var config = this.videoTrackConfig;\n if (config && (videoTrack.width !== config.width || videoTrack.height !== config.height || ((_videoTrack$pixelRati = videoTrack.pixelRatio) == null ? void 0 : _videoTrack$pixelRati[0]) !== ((_config$pixelRatio = config.pixelRatio) == null ? void 0 : _config$pixelRatio[0]) || ((_videoTrack$pixelRati2 = videoTrack.pixelRatio) == null ? void 0 : _videoTrack$pixelRati2[1]) !== ((_config$pixelRatio2 = config.pixelRatio) == null ? void 0 : _config$pixelRatio2[1]))) {\n this.resetInitSegment();\n }\n } else {\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 case 'ac3':\n audioTrack.codec = 'ac-3';\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 this.videoTrackConfig = {\n width: videoTrack.width,\n height: videoTrack.height,\n pixelRatio: videoTrack.pixelRatio\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 (chromeVersion && nextAvcDts !== null && Math.abs(pts - cts - nextAvcDts) < 15000) {\n // treat as contigous to adjust samples that would otherwise produce video buffer gaps in Chrome\n contiguous = true;\n } else {\n // if not contiguous, let's use target timeOffset\n nextAvcDts = pts - cts;\n }\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 at \" + timeOffset.toFixed(3));\n } else {\n logger.warn(\"AVC: \" + toMsFromMpegTsClock(-delta, true) + \" ms (\" + delta + \"dts) overlapping between fragments detected at \" + timeOffset.toFixed(3));\n }\n if (!foundOverlap || nextAvcDts >= inputSamples[0].pts || chromeVersion) {\n firstDTS = nextAvcDts;\n var firstPTS = inputSamples[0].pts - delta;\n if (foundHole) {\n inputSamples[0].dts = firstDTS;\n inputSamples[0].pts = firstPTS;\n } else {\n for (var _i = 0; _i < inputSamples.length; _i++) {\n if (inputSamples[_i].dts > firstPTS) {\n break;\n }\n inputSamples[_i].dts -= delta;\n inputSamples[_i].pts -= delta;\n }\n }\n logger.log(\"Video: Initial 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 var dtsStep = firstDTS;\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i2];\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 if (_sample.dts < dtsStep) {\n _sample.dts = dtsStep;\n dtsStep += averageSampleDuration / 4 | 0 || 1;\n } else {\n dtsStep = _sample.dts;\n }\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 _i3 = 0; _i3 < nbSamples; _i3++) {\n var _VideoSample = inputSamples[_i3];\n var VideoSampleUnits = _VideoSample.units;\n var mp4SampleLength = 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n for (var _j = 0, _nbUnits = VideoSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = VideoSampleUnits[_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 (_i3 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i3 + 1].dts - _VideoSample.dts;\n ptsDelta = inputSamples[_i3 + 1].pts - _VideoSample.pts;\n } else {\n var config = this.config;\n var lastFrameDuration = _i3 > 0 ? _VideoSample.dts - inputSamples[_i3 - 1].dts : averageSampleDuration;\n ptsDelta = _i3 > 0 ? _VideoSample.pts - inputSamples[_i3 - 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) - _VideoSample.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(_VideoSample.pts - _VideoSample.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(_VideoSample.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 _i4 = 0, len = outputSamples.length; _i4 < len; _i4++) {\n var nextDts = dts + outputSamples[_i4].duration;\n var _pts = dts + outputSamples[_i4].cts;\n if (_i4 < len - 1) {\n var nextPts = nextDts + outputSamples[_i4 + 1].cts;\n outputSamples[_i4].duration = nextPts - _pts;\n } else {\n outputSamples[_i4].duration = _i4 ? outputSamples[_i4 - 1].duration : averageSampleDuration;\n }\n outputSamples[_i4].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.getSamplesPerFrame = function getSamplesPerFrame(track) {\n switch (track.segmentCodec) {\n case 'mp3':\n return MPEG_AUDIO_SAMPLE_PER_FRAME;\n case 'ac3':\n return AC3_SAMPLES_PER_FRAME;\n default:\n return AAC_SAMPLES_PER_FRAME;\n }\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 = this.getSamplesPerFrame(track);\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 = {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: isKeyframe ? 2 : 1,\n isNonSync: isKeyframe ? 0 : 1\n };\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 (initData.audio) {\n audioCodec = getParsedTrackCodec(initData.audio, ElementaryStreamTypes.AUDIO);\n }\n if (initData.video) {\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 if (type === ElementaryStreamTypes.AUDIO) {\n if (parsedCodec === 'ec-3' || parsedCodec === 'ac-3' || parsedCodec === 'alac') {\n return parsedCodec;\n }\n if (parsedCodec === 'fLaC' || parsedCodec === 'Opus') {\n // Opting not to get `preferManagedMediaSource` from player config for isSupported() check for simplicity\n var preferManagedMediaSource = false;\n return getCodecCompatibleName(parsedCodec, preferManagedMediaSource);\n }\n var result = 'mp4a.40.5';\n logger.info(\"Parsed audio codec \\\"\" + parsedCodec + \"\\\" or audio object type not handled. Using \\\"\" + result + \"\\\"\");\n return result;\n }\n // Provide defaults based on codec type\n // This allows for some playback of some fmp4 playlists without CODECS defined in manifest\n logger.warn(\"Unhandled video codec \\\"\" + parsedCodec + \"\\\"\");\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 return 'avc1.42e01e';\n }\n\n /** returns `undefined` is `self` is missing, e.g. in node */\n var optionalSelf = typeof self !== 'undefined' ? self : undefined;\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 = optionalSelf == null ? void 0 : optionalSelf.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 var _muxConfig$i$demux;\n if ((_muxConfig$i$demux = muxConfig[i].demux) != null && _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 ? void 0 : 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.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 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 MediaSource = getMediaSource(config.preferManagedMediaSource) || {\n isTypeSupported: function isTypeSupported() {\n return false;\n }\n };\n var m2tsTypeSupported = {\n mpeg: MediaSource.isTypeSupported('audio/mpeg'),\n mp3: MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"'),\n ac3: false\n };\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 (event) {\n return _this.onWorkerMessage(event);\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: m2tsTypeSupported,\n 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, m2tsTypeSupported, config, '', id);\n }\n return;\n }\n }\n this.transmuxer = new Transmuxer(this.observer, m2tsTypeSupported, config, '', 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 frag: this.frag || undefined,\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(event) {\n var data = event.data;\n if (!(data != null && data.event)) {\n logger.warn(\"worker message received with no \" + (data ? 'event name' : 'data'));\n return;\n }\n var hls = this.hls;\n if (!this.hls) {\n return;\n }\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 (!seeking) {\n this.nudgeRetry = 0;\n }\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 }\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 this.nudgeRetry = 0;\n return;\n }\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var nextStart = bufferInfo.nextStart || 0;\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 // There is no playable buffer (seeked, waiting for buffer)\n var isBuffered = bufferInfo.len > 0;\n if (!isBuffered && !nextStart) {\n return;\n }\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 if (!media.paused) {\n this._trySkipBufferHole(partialOrGap);\n }\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 _BaseStreamController.prototype.onHandlerDestroying.call(this);\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.firstAutoLevel;\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 hls.nextLoadLevel = startLevel;\n this.level = hls.loadLevel;\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 = this.levels,\n level = this.level;\n var currentLevel = levels == null ? void 0 : levels[level];\n var details = currentLevel == null ? void 0 : currentLevel.details;\n if (details && (!details.live || this.levelLastLoaded === currentLevel)) {\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 var _levels = this.levels,\n _level = this.level;\n var _currentLevel = _levels == null ? void 0 : _levels[_level];\n this.resetStartWhenNotLoaded(_currentLevel || null);\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\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 || !hls.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 var level = hls.nextLoadLevel;\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 !== levelInfo) {\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 * (this.couldBacktrack ? 0.5 : 0.125)), fragDuration * (this.couldBacktrack ? 0.75 : 0.25)));\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 = this.fragLastKbps = 0;\n this.levels = this.fragPlaying = this.backtrackFragment = this.levelLastLoaded = null;\n this.altAudio = this.audioOnly = this.startFragRequested = false;\n };\n _proto.onManifestParsed = function onManifestParsed(event, data) {\n // detect if we have different kind of audio codecs used amongst playlists\n var aac = false;\n var heaac = false;\n data.levels.forEach(function (level) {\n var codec = level.audioCodec;\n if (codec) {\n aac = aac || codec.indexOf('mp4a.40.2') !== -1;\n heaac = heaac || codec.indexOf('mp4a.40.5') !== -1;\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 !== 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.loader) {\n this.abortCurrentFrag();\n }\n }\n var sliding = 0;\n if (newDetails.live || (_curLevel$details = curLevel.details) != null && _curLevel$details.live) {\n var _this$levelLastLoaded;\n this.checkLiveUpdate(newDetails);\n if (newDetails.deltaUpdateFailed) {\n return;\n }\n sliding = this.alignPlaylists(newDetails, curLevel.details, (_this$levelLastLoaded = this.levelLastLoaded) == null ? void 0 : _this$levelLastLoaded.details);\n }\n // override level info\n curLevel.details = newDetails;\n this.levelLastLoaded = curLevel;\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_APPEND_ERROR:\n case ErrorDetails.BUFFER_FULL_ERROR:\n if (!data.parent || data.parent !== 'main') {\n return;\n }\n if (data.details === ErrorDetails.BUFFER_APPEND_ERROR) {\n this.resetLoadingState();\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 this.tick();\n }\n };\n _proto.onLevelsUpdated = function onLevelsUpdated(event, data) {\n if (this.level > -1 && this.fragCurrent) {\n this.level = this.fragCurrent.level;\n }\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 } else if (isFirstFragment && startPTS > MAX_START_GAP_JUMP) {\n // Mark segment with a gap to skip large start gap\n frag.gap = 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 var audioMetadata = audio.metadata;\n if (audioMetadata && 'channelCount' in audioMetadata && (audioMetadata.channelCount || 1) !== 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 (audioCodec && audioCodec.indexOf('mp4a.40.5') !== -1 && 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.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.tickImmediate();\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) {\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 * 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.isMSESupported = function isMSESupported$1() {\n return isMSESupported();\n }\n\n /**\n * Check if MediaSource Extensions are available and isTypeSupported checks pass for any baseline codecs.\n */;\n Hls.isSupported = function isSupported$1() {\n return isSupported();\n }\n\n /**\n * Get the MediaSource global used for MSE playback (ManagedMediaSource, MediaSource, or WebKitMediaSource).\n */;\n Hls.getMediaSource = function getMediaSource$1() {\n return getMediaSource();\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.started = false;\n this._emitter = new EventEmitter();\n this._autoLevelCapping = -1;\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 this.triggeringException = void 0;\n enableLogs(userConfig.debug || false, 'Hls instance');\n var config = this.config = mergeConfig(Hls.DefaultConfig, userConfig);\n this.userConfig = userConfig;\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 (error) {\n logger.error('An internal error happened while handling event ' + event + '. Error message: \"' + error.message + '\". Here is a stacktrace:', error);\n // Prevent recursion in error event handlers that throw #5497\n if (!this.triggeringException) {\n this.triggeringException = true;\n var fatal = event === Events.ERROR;\n this.trigger(Events.ERROR, {\n type: ErrorTypes.OTHER_ERROR,\n details: ErrorDetails.INTERNAL_EXCEPTION,\n fatal: fatal,\n event: event,\n error: error\n });\n this.triggeringException = false;\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 this._autoLevelCapping = -1;\n this._maxHdcpLevel = null;\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.started = true;\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.started = false;\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n }\n\n /**\n * Resumes stream controller segment loading if previously started.\n */;\n _proto.resumeBuffering = function resumeBuffering() {\n if (this.started) {\n this.networkControllers.forEach(function (controller) {\n if ('fragmentLoader' in controller) {\n controller.startLoad(-1);\n }\n });\n }\n }\n\n /**\n * Stops stream controller segment loading without changing 'started' state like stopLoad().\n * This allows for media buffering to be paused without interupting playlist loading.\n */;\n _proto.pauseBuffering = function pauseBuffering() {\n this.networkControllers.forEach(function (controller) {\n if ('fragmentLoader' in controller) {\n controller.stopLoad();\n }\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) {\n this.levelController.removeLevel(levelIndex);\n }\n\n /**\n * @returns an array of levels (variants) sorted by HDCP-LEVEL, RESOLUTION (height), FRAME-RATE, CODECS, VIDEO-RANGE, and BANDWIDTH\n */;\n /**\n * Find and select the best matching audio track, making a level switch when a Group change is necessary.\n * Updates `hls.config.audioPreference`. Returns the selected track, or null when no matching track is found.\n */\n _proto.setAudioOption = function setAudioOption(audioOption) {\n var _this$audioTrackContr;\n return (_this$audioTrackContr = this.audioTrackController) == null ? void 0 : _this$audioTrackContr.setAudioOption(audioOption);\n }\n /**\n * Find and select the best matching subtitle track, making a level switch when a Group change is necessary.\n * Updates `hls.config.subtitlePreference`. Returns the selected track, or null when no matching track is found.\n */;\n _proto.setSubtitleOption = function setSubtitleOption(subtitleOption) {\n var _this$subtitleTrackCo;\n (_this$subtitleTrackCo = this.subtitleTrackController) == null ? void 0 : _this$subtitleTrackCo.setSubtitleOption(subtitleOption);\n return null;\n }\n\n /**\n * Get the complete list of audio tracks across all media groups\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.levelController.manualLevel = newLevel;\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 the desired start level for the first fragment that will be loaded.\n * The default value of -1 indicates automatic start level selection.\n * Setting hls.nextAutoLevel without setting a startLevel will result in\n * the nextAutoLevel value being used for one fragment load.\n */\n }, {\n key: \"startLevel\",\n get: function get() {\n var startLevel = this.levelController.startLevel;\n if (startLevel === -1 && this.abrController.forcedAutoLevel > -1) {\n return this.abrController.forcedAutoLevel;\n }\n return 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 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 this.levelController.checkMaxAutoUpdated();\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 set: function set(abrEwmaDefaultEstimate) {\n this.abrController.resetEstimator(abrEwmaDefaultEstimate);\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 (isHdcpLevel(value) && this._maxHdcpLevel !== value) {\n this._maxHdcpLevel = value;\n this.levelController.checkMaxAutoUpdated();\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 != null && 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 key: \"firstAutoLevel\",\n get: function get() {\n return this.abrController.firstAutoLevel;\n }\n\n /**\n * next automatically selected quality level\n */\n }, {\n key: \"nextAutoLevel\",\n get: function get() {\n return this.abrController.nextAutoLevel;\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 = 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 key: \"allAudioTracks\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.allAudioTracks : [];\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 the complete list of subtitle tracks across all media groups\n */\n }, {\n key: \"allSubtitleTracks\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.allSubtitleTracks : [];\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.5.15\";\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","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread2","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPrimitive","Symbol","toPrimitive","i","call","TypeError","String","Number","_toPropertyKey","_defineProperties","target","props","descriptor","configurable","writable","key","_createClass","Constructor","protoProps","staticProps","prototype","obj","value","_extends","assign","bind","source","hasOwnProperty","this","_inheritsLoose","subClass","superClass","create","constructor","_setPrototypeOf","_getPrototypeOf","setPrototypeOf","getPrototypeOf","__proto__","p","_isNativeReflectConstruct","Reflect","construct","sham","Proxy","Boolean","valueOf","_construct","Parent","args","Class","a","instance","Function","_isNativeFunction","fn","toString","indexOf","_wrapNativeSuper","_cache","Map","undefined","has","get","set","Wrapper","_assertThisInitialized","self","ReferenceError","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","isSafeInteger","Math","abs","MAX_SAFE_INTEGER","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","parseAttrList","_proto","decimalInteger","attrName","intValue","parseInt","Infinity","hexadecimalInteger","stringValue","slice","Uint8Array","hexadecimalIntegerAsNumber","decimalFloatingPoint","parseFloat","optionalFloat","defaultValue","enumeratedString","bool","decimalResolution","res","width","height","input","match","quote","lastIndex","attr","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","byteRangeEndOffset","byteRange","Fragment","_BaseSegment","_this","_decryptdata","rawProgramDateTime","programDateTime","tagList","sn","levelkeys","loader","keyLoader","level","cc","startPTS","endPTS","startDTS","endDTS","deltaPTS","maxStartPTS","minEndPTS","stats","data","bitrateTest","title","initSegment","endList","gap","urlId","_proto2","setKeyFormat","keyFormat","getDecryptData","abortRequests","_this$loader","_this$keyLoader","abort","setElementaryStreamInfo","partial","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","navigator","userAgent","includes","TextDecoder","Hex","hexDump","str","h","UINT32_MAX$1","pow","RemuxerTrackIdConfig","id3","bin2str","readUint16","val","readUint32","readSint32","readUint64","result","writeUint32","hasMoofData","findBox","results","endbox","subresults","parseSegmentIndex","sidx","references","timescale","earliestPresentationTime","firstOffset","startByte","referencesCount","referenceIndex","referenceInfo","referenceSize","subsegmentDuration","parseInitSegment","traks","trak","tkhd","trackId","mdhd","hdlr","hdlrType","soun","vide","stsdData","parseStsd","trex","track","default","flags","stsd","sampleEntries","sampleEntriesEnd","fourCC","codec","encBox","sinf","schm","frma","avcCBox","toHex","codecBox","esdsBox","skipBERInteger","objectType","firstByte","audioObjectType","hvcCBox","profileByte","profileSpace","generalProfileIdc","profileCompat","tierFlag","levelIDC","constraintIndicator","toUpperCase","constraintString","_i","_byte","dvcCBox","profile","addLeadingZero","vpcCBox","_profile","_level","bitDepth","av1CBox","_profile2","_level2","_tierFlag","highBitDepth","twelveBit","_bitDepth","monochrome","chromaSubsamplingX","chromaSubsamplingY","chromaSamplePosition","colorPrimaries","transferCharacteristics","matrixCoefficients","videoFullRangeFlag","bytes","limit","num","patchEncyptionData","decryptdata","keyId","isCommonEncryption","encBoxes","isAudio","enc","tenc","parseSinf","tencKeyId","some","b","getStartDTS","initData","fmp4","reduce","traf","tfdt","tfhd","baseTime","startTime","getDuration","rawDuration","videoDuration","audioDuration","trafs","trackDefault","tfhdFlags","sampleDuration","truns","j","computeRawDurationFromSamples","sidxMinStart","sidxMaxEnd","sidxDuration","sidxs","_i2","subSegmentDuration","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","leftOver","payPtr","providerCode","userStructure","userDataType","enabled","totalBytes","byteArray","uuidStrArray","_i3","_b","userDataBytes","_i4","uuid","userData","EPBPositions","newLength","newData","sourceIndex","shift","parseEmsg","schemeIdUri","timeScale","presentationTimeDelta","presentationTime","eventDuration","leftPresentationTime","rightPresentationTime","payload","LevelKey","method","uri","format","formatversions","iv","keyFormatVersions","pssh","clearKeyUriToKeyIdMap","isSupported","createInitializationVector","segmentNumber","uint8View","getMediaSource","preferManagedMediaSource","MediaSource","ManagedMediaSource","WebKitMediaSource","isManagedMediaSource","sampleEntryCodesISO","a3ds","alac","alaw","dra1","dtsc","dtse","dtsh","enca","fLaC","flac","FLAC","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","isCodecType","typeCodes","areCodecsMediaSourceSupported","codecs","isCodecMediaSourceSupported","_MediaSource$isTypeSu","isTypeSupported","mimeTypeForCodec","videoCodecPreferenceValue","videoCodec","codecsSetSelectionPreferenceValue","codecSet","preferenceValue","CODEC_COMPATIBLE_NAMES","getCodecCompatibleNameLower","lowerCaseCodec","codecsToCheck","AUDIO_CODEC_REGEXP","getCodecCompatibleName","m","toLowerCase","pickMostCompleteCodecName","parsedCodec","levelCodec","convertAVC1ToAVCOTI","avcdata","MASTER_PLAYLIST_REGEX","MASTER_PLAYLIST_MEDIA_REGEX","IS_MEDIA_PLAYLIST","LEVEL_PLAYLIST_REGEX_FAST","RegExp","LEVEL_PLAYLIST_REGEX_SLOW","M3U8Parser","findGroup","groups","mediaGroupId","group","resolve","isMediaPlaylist","test","parseMasterPlaylist","string","parsed","contentSteering","levels","sessionData","sessionKeys","levelsWithKnownCodecs","_level$unknownCodecs","bitrate","name","NAME","resolution","setCodecs","CODECS","unknownCodecs","tag","attributes","sessionAttrs","dataId","sessionKey","parseKey","contentSteeringAttributes","pathwayId","parseStartTimeOffset","stripUnknownCodecLevels","parseMasterPlaylistMedia","groupsByType","audioCodec","SUBTITLES","textCodec","TYPE","medias","lang","LANGUAGE","assocLang","channels","CHANNELS","characteristics","CHARACTERISTICS","instreamId","media","groupId","autoselect","forced","URI","groupCodec","assignCodec","parseLevelPlaylist","levelUrlId","multivariantVariableList","currentInitSegment","currentSN","currentPart","discontinuityCounter","prevFrag","firstPdtIndex","createNextFrag","nextByteRange","setFragLevelKeys","assignProgramDateTime","value1","value2","skipAttrs","unshift","dateRange","isValid","levelKey","mapAttrs","init","setInitSegment","byteRangeStartOffset","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","codecsAttributeValue","filtered","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","VTTCue","TextTrackCue","createCueWithDataFields","Cue","cue","JSON","stringify","MAX_CUE_ENDTIME","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","addCue","_this$id3Track","_ref","startOffset","endOffset","_hls$config","_ref2","hasProgramDateTime","enableDateRangeMetadataCues","ids","idsToRemove","_loop","dateTimeOffset","_loop2","appendedDateRangeCues","durationKnown","nextDateRangeWithSameClass","candidateDateRange","otherDateRange","LatencyController","currentTime","stallCount","_latency","timeupdateHandler","timeupdate","addEventListener","removeEventListener","_this$levelDetails","BUFFER_STALLED_ERROR","latency","computeLatency","_this$config","lowLatencyMode","maxLiveSyncPlaybackRate","targetLatency","distanceFromTarget","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","isHdcpLevel","VideoRangeValues","isVideoRange","HlsSkip","No","Yes","v2","getSkipValue","HlsUrlParameters","msn","skip","addDirectives","URL","searchParams","href","Level","_attrs","frameRate","fragmentError","loadError","realBitrate","supportedPromise","supportedResult","_avgBitrate","_audioGroups","_subtitleGroups","_urlId","s","addGroupId","hasAudioGroup","hasGroup","hasSubtitleGroup","audioGroups","subtitleGroups","addFallback","audioGroupId","textGroupId","_this$audioGroups","_this$subtitleGroups","updateFromToPTS","fragFrom","fragTo","fragToPTS","updateFragPTSDTS","fragStartPts","fragEndPts","fragIdx","mergeDetails","oldDetails","newDetails","oldFragments","oldInit","PTSFrag","ccOffset","mapFragmentIntersection","oldFrag","newFrag","concat","_currentInitSegment","mergeDateRanges","newFragments","mapPartIntersection","oldPart","newPart","adjustSliding","oldDateRanges","deltaDateRanges","oldParts","newParts","intersectionFn","delta","_oldPart","_newPart","newFrags","oldFrags","_oldFrag","_newFrag","addSliding","computeReloadInterval","distanceToLiveEdgeMs","reloadInterval","liveEdgeMaxTargetDurations","lastSegmentDuration","getFragmentWithSN","fragCurrent","getPartWith","partIndex","_level$details","findPart","reassignFragmentLevelIndexes","isTimeoutError","FRAG_LOAD_TIMEOUT","KEY_LOAD_TIMEOUT","getRetryConfig","isTimeout","getRetryDelay","retryConfig","retryCount","backoffFactor","backoff","getLoaderConfigWithoutReties","loderConfig","shouldRetry","loaderResponse","httpStatus","retryForHttpStatus","onLine","BinarySearch","search","list","comparisonFn","minIndex","maxIndex","currentIndex","currentElement","comparisonResult","findFragmentByPDT","PDTValue","maxFragLookUpTolerance","isArray","seg","pdtWithinToleranceTest","findFragmentByPTS","fragPrevious","bufferEnd","nextFragLookupTolerance","fragNext","bufferEdgeError","fragmentWithinToleranceTest","fragmentWithinFastStartSwitch","foundFragment","firstDuration","candidate","candidateLookupTolerance","pdtBufferEnd","findFragWithCC","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","KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED","restrictedHdcpLevel","hdcpLevel","keySystemError","BUFFER_ADD_CODEC_ERROR","REMUX_ALLOC_ERROR","BUFFER_APPEND_ERROR","INTERNAL_EXCEPTION","BUFFER_APPENDING_ERROR","BUFFER_FULL_ERROR","LEVEL_SWITCH_ERROR","BUFFER_SEEK_OVER_HOLE","BUFFER_NUDGE_ON_STALL","KEY_SYSTEM_ERROR","variantLevelIndex","fragLoadPolicy","keyLoadPolicy","startsWith","fragmentErrors","acc","_data$frag2","_data$context2","errorDetails","nextLevel","minAutoLevel","maxAutoLevel","autoLevelEnabled","_ret","fragErrorType","findAudioCodecAlternate","sourceBufferName","findVideoCodecAlternate","_ref3","playlistErrorType","playlistErrorGroupId","_level$audioGroups","_level$subtitleGroups","levelCandidate","fragCandidate","nextAutoLevel","_data$errorAction","sendAlternateToPenaltyBox","resolved","recoverMediaError","switchLevel","maxHdcpLevel","nextLoadLevel","BasePlaylistController","logPrefix","timer","requestScheduled","canLoad","clearTimer","clearTimeout","loadPlaylist","switchParams","playlistUri","current","foundIndex","_attr","currentGoal","hlsUrlParameters","shouldLoadPlaylist","playlist","shouldReloadPlaylist","playlistLoaded","previousDetails","elapsed","endSn","lastPart","lastAdvanced","cdnAge","segments","toFixed","getDeliveryDirectives","bufferInfo","mainForwardBufferInfo","position","estimatedTimeUntilUpdate","setTimeout","previousDeliveryDirectives","checkRetry","errorEvent","_ref$retryCount","_errorEvent$context","delay","EWMA","halfLife","estimate","weight","alpha_","estimate_","totalWeight_","sample","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","isHdrSupported","matchMedia","mediaQueryList","badQuery","matches","getVideoSelectionOptions","currentVideoRange","videoPreference","preferHDR","allowedVideoRanges","range","getStartCodecTier","codecTiers","currentBw","audioPreference","codecSets","channelsPreference","audioCodecPreference","preferStereo","hasStereo","hasCurrentVideoRange","minHeight","minFramerate","minBitrate","selectedScore","videoRanges","_getVideoSelectionOpt","tier","matchingVideoRanges","maxHeight","maxFramerate","selected","candidateTier","logStartCodecCandidateIgnored","hasDefaultAudio","maxScore","codeSet","getAudioTracksByGroup","allAudioTracks","audioTracksByGroup","trackGroup","tracks","hasDefault","hasAutoSelect","channelsKey","hasAutoSelectAudio","getCodecTiers","tiers","SDR","lesserWidthOrHeight","score","videoRange","AbrController","_hls","lastLevelLoadSec","lastLoadedFragLevel","firstSelection","_nextAutoLevel","nextAutoLevelKey","partCurrent","bitrateTestDelay","bwEstimator","_abandonRulesCheck","timeLoading","paused","readyState","ttfbEstimate","bufferStarvationDelay","loadedFirstByte","getBwEstimate","expectedLen","averageBitrate","timeStreaming","loadRate","fragLoadedDelay","bwe","fragLevelNextLoadedDelay","levelNextBitrate","maxBitrate","getTimeToLoadFrag","nextLoadLevelBitrate","abrBandWidthUpFactor","resetEstimator","FRAG_LOAD_EMERGENCY_ABORTED","initEstimator","abrEwmaDefaultEstimate","abrEwmaSlowVoD","abrEwmaFastVoD","FRAG_LOADING","onFragLoading","FRAG_LOADED","onFragLoaded","FRAG_BUFFERED","onFragBuffered","LEVEL_SWITCHING","onLevelSwitching","onLevelLoaded","LEVELS_UPDATED","onLevelsUpdated","MAX_AUTO_LEVEL_UPDATED","onMaxAutoLevelUpdated","_data$part","ignoreFragment","setInterval","timeToFirstByteSec","bandwidth","fragSizeBits","isSwitch","timeLoadingMs","abrEwmaSlowLive","abrEwmaFastLive","abrMaxWithRealBitrate","loadedBytes","loadedDuration","fragBufferedData","processingMs","clearInterval","getAutoLevelKey","getStarvationDelay","getNextABRAutoLevel","currentFragDuration","avgbw","bwFactor","abrBandWidthFactor","bwUpFactor","_bestLevel","findBestLevel","maxStarvationDelay","maxLoadingDelay","bestLevel","minLevel","autoLevel","maxFetchDuration","selectionBaseLevel","firstLevel","_this$hls","currentCodecSet","currentFrameRate","startTier","ttfbEstimateSec","levelsSkipped","_levelInfo$supportedR","levelInfo","upSwitch","decodingInfoResults","smooth","adjustedbw","avgDuration","fetchDuration","forcedAutoLevel","v","_this$hls2","maxStartDelay","abrAutoLevel","clamped","useEstimate","loadedFirstFrag","nextABRAutoLevel","firstAutoLevel","_this$hls3","noopBuffered","BufferHelper","isBuffered","getBuffered","pos","maxHoleDuration","vbuffered","bufferedInfo","nextStart","sort","diff","buffered2","buf2len","buf2end","bufferStartNext","bufferLen","bufferStart","BufferOperationQueue","sourceBufferReference","buffers","queues","append","operation","pending","queue","executeNext","insertAbort","appendBlocker","execute","promise","Promise","onStart","onComplete","sb","updating","shiftAndExecuteNext","VIDEO_CODEC_PROFILE_REPLACE","BufferController","_objectUrl","operationQueue","listeners","bufferCodecEventsExpected","_bufferCodecEventsTotal","mediaSource","lastMpegAudioChunk","appendSource","appendErrors","pendingTracks","sourceBuffer","_onEndStreaming","pauseBuffering","_onStartStreaming","resumeBuffering","_onMediaSourceOpen","_onMediaEmptied","updateMediaElementDuration","checkPendingTracks","_onMediaSourceClose","_onMediaSourceEnded","mediaSrc","_initSourceBuffer","hasSourceTypes","getSourceBufferTypes","MEDIA_ATTACHING","onMediaAttaching","MANIFEST_PARSED","onManifestParsed","BUFFER_RESET","onBufferReset","BUFFER_APPENDING","onBufferAppending","BUFFER_CODECS","onBufferCodecs","BUFFER_EOS","onBufferEos","FRAG_PARSED","onFragParsed","FRAG_CHANGED","onFragChanged","codecEvents","altAudio","_ms$constructor","ms","objectUrl","createObjectURL","removeAttribute","MMS","disableRemotePlayback","removeSourceChildren","addSource","src","endOfStream","revokeObjectURL","MEDIA_DETACHED","resetBuffer","_this$mediaSource","removeBufferListeners","sourceBuffers","removeSourceBuffer","_this3","sourceBufferCount","trackNames","trackName","changeType","_trackCodec","_data$trackName","container","metadata","currentCodecFull","currentCodec","trackCodec","nextCodec","mimeType","appendChangeType","_this4","eventData","_this5","chunkMeta","chunkStats","bufferAppendingStart","fragBuffering","partBuffering","checkTimestampOffset","fragStart","executeStart","timestampOffset","appendExecutor","executeEnd","timeRanges","_type","BUFFER_APPENDED","MEDIA_ERROR","DOMException","QUOTA_EXCEEDED_ERR","appendErrorCount","appendErrorMaxRetry","_this6","flushOperation","removeExecutor","BUFFER_FLUSHED","_this7","buffersAppendedTo","onUnblocked","blockBuffers","trimBuffers","_this8","ending","ended","levelTargetDuration","backBufferLength","liveBackBufferLength","maxBackBufferLength","targetBackBufferPosition","flushBackBuffer","frontBufferFlushThreshold","frontBufferLength","maxBufferLength","maxFrontBufferLength","targetFrontBufferPosition","flushFrontBuffer","_this9","BACK_BUFFER_REACHED","LIVE_BACK_BUFFER_REACHED","_this10","numBufferedRanges","levelDuration","mediaDuration","msDuration","liveDurationInfinity","updateSeekableRange","setLiveSeekableRange","pendingTracksCount","createSourceBuffers","BUFFER_CREATED","BUFFER_INCOMPATIBLE_CODECS_ERROR","_this11","_track$levelCodec","addSourceBuffer","sbName","addBufferListener","_onSBUpdateStart","_onSBUpdateEnd","_onSBUpdateError","removedRanges","_this$mediaSource2","_this$mediaSource3","removeStart","removeEnd","remove","appendBuffer","_this12","then","blockingOperations","all","listener","l","_this$media","_this$media$querySele","querySelector","node","sourceChildren","querySelectorAll","removeChild","createElement","appendChild","CapLevelController","autoLevelCapping","restrictedLevels","clientRect","streamController","setStreamController","unregisterListener","stopCapping","FPS_DROP_LEVEL_CAPPING","onFpsDropLevelCapping","droppedLevel","isLevelAllowed","HTMLVideoElement","detectPlayerSize","capLevelToPlayerSize","startCapping","mediaHeight","mediaWidth","maxLevel","getMaxLevel","nextLevelSwitch","capLevelIndex","validLevels","getMaxLevelByMediaSize","getDimensions","boundsRect","getBoundingClientRect","bottom","top","restrictedLevel","atGreatestBandwidth","curLevel","maxLevelIndex","squareSize","contentScaleFactor","pixelRatio","ignoreDevicePixelRatio","devicePixelRatio","FPSController","isVideoPlaybackQualityAvailable","lastTime","lastDroppedFrames","lastDecodedFrames","capLevelOnFPSDrop","getVideoPlaybackQuality","checkFPSInterval","fpsDroppedMonitoringPeriod","checkFPS","decodedFrames","droppedFrames","currentPeriod","currentDropped","currentDecoded","droppedFPS","FPS_DROP","totalDroppedFrames","fpsDroppedMonitoringThreshold","currentLevel","videoPlaybackQuality","totalVideoFrames","droppedVideoFrames","webkitDecodedFrameCount","webkitDroppedFrameCount","PATHWAY_PENALTY_DURATION_MS","ContentSteeringController","pathwayPriority","timeToLoad","reloadTimer","started","penalizedPathways","onManifestLoaded","ttl","scheduleRefresh","loadSteeringManifest","removeLevel","levelToRemove","errorPathway","_pathwayId","getPathwayForGroupId","pathways","updatePathwayPriority","filterParsedLevels","pathwayLevels","getLevelsForPathway","_pathwayId2","_pathwayId3","selectedIndex","selectedLevel","levelAfterChange","defaultPathway","clonePathways","pathwayClones","audioGroupCloneMap","subtitleGroupCloneMap","pathwayClone","cloneId","baseId","uriReplacement","clonedVariants","baseLevel","clonedAudioGroupId","clonedSubtitleGroupId","performUriReplacement","clonedLevel","cloneRenditionGroups","protocol","throughput","bandwidthEstimate","steeringManifestLoadPolicy","callbacks","steeringData","VERSION","TTL","reloadUri","loadedSteeringData","steeringManifest","STEERING_MANIFEST_LOADED","getResponseHeader","retryAfter","ttlMs","_this3$hls","groupCloneMap","clonedTracks","clonedTrack","stableId","perOptionKey","perVariantUri","host","HOST","PARAMS","perOptionUris","AGE_HEADER_LINE_REGEX","XhrLoader","xhrSetup","requestTimeout","retryTimeout","abortInternal","onreadystatechange","onprogress","_this$callbacks","onAbort","loadInternal","xhr","XMLHttpRequest","catch","open","openAndSendXhr","status","headers","_config$loadPolicy","header","setRequestHeader","rangeEnd","rangeStart","readystatechange","loadprogress","loadtimeout","send","_status","useResponse","responseText","onProgress","responseURL","statusText","_this$context","lengthComputable","getAllResponseHeaders","ChunkCache","chunks","dataLength","chunk","flush","concatUint8Arrays","reset","fetchSupported","fetch","AbortController","ReadableStream","Request","FetchLoader","fetchSetup","request","controller","getRequest","initParams","getRequestParameters","signal","isArrayBuffer","LENGTH","ok","FetchError","getContentLength","highWaterMark","loadProgressively","arrayBuffer","json","responseData","chunkCache","reader","body","getReader","pump","read","done","ArrayBuffer","reject","credentials","Headers","getByteRangeLength","byteRangeHeader","contentRange","byteRangeLength","contentLength","chromeOrFirefox","_Error","hlsDefaultConfig","autoStartLoad","defaultAudioCodec","initialLiveManifestSize","maxBufferSize","maxBufferHole","highBufferWatchdogPeriod","nudgeOffset","nudgeMaxRetry","maxMaxBufferLength","enableWorker","workerPath","enableSoftwareAES","startLevel","startFragPrefetch","fLoader","licenseXhrSetup","licenseResponseCallback","abrController","bufferController","capLevelController","errorController","fpsController","stretchShortVideoTrack","maxAudioFramesDrift","forceKeyFrameOnDiscontinuity","abrEwmaDefaultEstimateMax","minAutoBitrate","emeEnabled","widevineLicenseUrl","drmSystems","drmSystemOptions","requestMediaKeySystemAccessFunc","testBandwidth","progressive","cmcd","useMediaCapabilities","certLoadPolicy","manifestLoadingTimeOut","manifestLoadingMaxRetry","manifestLoadingRetryDelay","manifestLoadingMaxRetryTimeout","levelLoadingTimeOut","levelLoadingMaxRetry","levelLoadingRetryDelay","levelLoadingMaxRetryTimeout","fragLoadingTimeOut","fragLoadingMaxRetry","fragLoadingRetryDelay","fragLoadingMaxRetryTimeout","timelineConfig","subtitleStreamController","subtitleTrackController","timelineController","audioStreamController","audioTrackController","emeController","cmcdController","contentSteeringController","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","LevelController","_BasePlaylistControll","_levels","_firstLevel","_maxAutoLevel","_startLevel","currentLevelIndex","manualLevelIndex","steering","onParsedComplete","resetLevels","redundantSet","generatePathwaySet","resolutionFound","videoCodecFound","audioCodecFound","levelParsed","_audioCodec","_videoCodec","FRAMERATE","HDCP","PATHWAY","RESOLUTION","VIDEO_RANGE","pathwayCount","filterAndSortMediaOptions","filteredLevels","assignTrackIdsByGroup","unsortedLevels","valueA","valueB","_valueA","_valueB","firstLevelInPlaylist","_this$hls$userConfig","firstLevelBitrate","startingBwEstimate","audioOnly","edata","forceStartLoad","MANIFEST_INCOMPATIBLE_CODECS_ERROR","el","_data$deliveryDirecti2","_data$deliveryDirecti","_this$currentLevel","f","checkMaxAutoUpdated","newLevel","OTHER_ERROR","lastLevelIndex","lastLevel","lastPathwayId","levelSwitchingData","audioGroupIds","textGroupIds","configStartLevel","FragmentState","NOT_LOADED","APPENDING","PARTIAL","OK","FragmentTracker","activePartLists","endListFragments","bufferPadding","hasGaps","onBufferAppended","getAppendedFrag","activeParts","activePart","appendedPTS","getBufferedFrag","fragmentEntity","detectEvictedFragments","elementaryStream","timeRange","playlistType","appendedPart","appendedPartSn","esData","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","snToRemove","removeAllFragments","_fragmentEntity$range","_fragmentEntity$range2","_fragmentEntity$range3","MIN_CHUNK_SIZE","FragmentLoader","partLoadTimeout","_onProgress","LoadError","FragmentILoader","DefaultILoader","tags","createGapLoadError","createLoaderContext","resetLoader","resetIV","INTERNAL_ABORTED","loadPart","updateStatsFromPart","partLoadedData","fragStats","partStats","partTotal","estTotalParts","estLoadedParts","estRemainingBytes","fragLoading","partLoading","segment","_frag$decryptdata","byteRangeStart","byteRangeEnd","fragmentLen","KeyLoader","keyUriToKeyInfo","_loader$context","detach","keyInfo","mediaKeySessionContext","createKeyLoadError","loadClear","loadingFrag","selectKeySystemFormat","keySystemFormat","_keyInfo","_keyInfo2","_keyInfo$mediaKeySess","keyLoadPromise","keyStatus","keyLoadedData","loadKeyHTTP","loadKeyEME","keySessionContextPromise","loadKey","keySessionContext","TaskLoop","_boundTick","_tickTimer","_tickInterval","_tickCallCount","tick","onHandlerDestroying","onHandlerDestroyed","clearNextTick","hasInterval","hasNextTick","millis","doTick","tickImmediate","ChunkMetadata","transmuxing","getNewPerformanceTiming","findFirstFragWithCC","_fragments$i","shouldAlignOnDiscontinuities","lastFrag","switchDetails","findDiscontinuousReferenceFrag","prevDetails","curDetails","prevFrags","curFrags","prevStartFrag","adjustFragmentStart","sliding","adjustSlidingStart","alignStream","alignDiscontinuities","alignMediaPlaylistByPDT","referenceFrag","refDetails","refFragments","refFrag","targetCC","refPDT","targetPDT","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_","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","browserCrypto","crypto","webkitSubtle","isSync","softwareDecrypt","decryptResult","webCryptoDecrypt","logOnce","currentChunk","getValidChunk","onWebCryptoError","aesKey","splitPoint","msg","TimeRanges","State","STOPPED","IDLE","KEY_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$levelLastLoaded","onMediaSeeking","onMediaEnded","resetLoadingState","tolerance","fragStartOffset","fragEndOffset","pastFragment","loadFragment","targetBufferTime","_loadFragForPlayback","progressCallback","fragContextChanged","_handleFragmentLoadProgress","_doFragLoad","_handleFragmentLoadComplete","resetFragmentLoading","clearTrackerIfNeeded","_this$mediaBuffer","getFwdBufferInfo","minForwardBufferLength","backtrackFragment","reduceMaxBufferLength","checkLiveUpdate","flushMainBuffer","flushScope","_loadInitSegment","decryptData","decryptedData","FRAG_DECRYPTED","tstart","tdecrypt","completeInitSegmentLoad","fragBufferedComplete","_frag$startPTS","_frag$endPTS","_this$fragCurrent","_this$fragPrevious","NaN","_this$levels","seekToStartPos","fragLoadedEndData","partsLoaded","complete","fragLoaded","keyLoadingPromise","KEY_LOADED","getNextPart","_result","doFragPartsLoad","handleFragLoadError","loadedEndOfParts","dataOnProgress","fragLoadedData","fromPart","initialPartList","loadedPart","nextPart","handleFragLoadAborted","_handleTransmuxerFlush","getCurrentContext","updateLevelTiming","bufferFragmentData","noBacktracking","_buffer","dropped","flushBufferGap","fragDuration","segmentFraction","bufferable","getLoadPosition","getFwdBufferInfoAtPos","bufferedFragAtPos","getMaxBufferLength","levelBitrate","maxBufLen","threshold","minLength","reducedLength","fragOrPart","getNextFragment","fragLen","getInitialLiveFragment","liveSyncPosition","getFragmentAtPosition","mapToInitFragWhenRequired","isLoopLoading","trackerState","getNextFragmentLoopLoading","gapStart","nextFragment","nextbufferInfo","contiguous","independentAttrOmitted","targetSN","liveStart","loadingParts","curSNIdx","fragState","nextFrag","synchronizeToLiveEdge","withinSlidingWindow","alignPlaylists","slidingStart","firstLevelLoad","aligned","alignedSlidingStart","waitForCdnTuneIn","advancePartLimit","setStartPosition","offsetInMultivariantPlaylist","onFragmentOrKeyLoadError","filterType","_this$fragCurrent2","gapTagEncountered","_ref2$retryCount","resetStartWhenNotLoaded","resetFragmentErrors","reduceLengthAndFlushBuffer","flushBuffer","afterBufferFlushed","bufferType","bufferedTimeRanges","resetWhenMissingContext","removeUnbufferedFrags","_this$transmuxer","parsedDuration","LEVEL_PTS_UPDATED","recoverWorkerError","nextState","previousState","getSourceBuffer","SourceBuffer","WebKitSourceBuffer","isMSESupported","codecsForVideoContainer","codecForAudioContainer","changeTypeSupported","_sourceBuffer$prototy","dummyTrack","inputTimeScale","pid","sequenceNumber","BaseAudioDemuxer","_audioTrack","_id3Track","frameIndex","cachedData","basePTS","lastPTS","resetInitSegment","trackDuration","resetTimeStamp","deaultTimestamp","resetContiguity","canParse","appendFrame","demux","lastDataIndex","initPTSFn","dts","partialData","videoTrack","demuxSampleAes","keyData","getAudioConfig","observer","adtsObjectType","adtsExtensionSamplingIndex","adtsChannelConfig","manifestCodec","adtsSamplingRates","adtsSamplingIndex","samplerate","channelCount","emit","isHeaderPattern$1","getHeaderLength","getFullFrameLength","canGetFrameLength","isHeader$1","canParse$1","probe$1","headerLength","frameLength","newOffset","initTrackConfig","getFrameDuration","parseFrameHeader","appendFrame$1","unit","stamp","_length","missing","_sample","chromeVersion$1","BitratesMap","SamplingRateMap","SamplesCoefficients","BytesInSlot","parseHeader","samplesPerFrame","sampleRate","mpegVersion","mpegLayer","bitRateIndex","sampleRateIndex","paddingBit","channelMode","bitRate","sampleCoefficient","bytesInSlot","isHeaderPattern","isHeader","probe","AACDemuxer","_BaseAudioDemuxer","segmentCodec","emsgSchemePattern","MP4Demuxer","txtTrack","captionTrack","_initData$video","_initData$audio","_id","_timescale","_codec","videoSamples","segmentedData","extractID3Track","emsgs","emsgInfo","getAudioBSID","bsid","numBits","mask","bits","BaseVideoParser","VideoSample","createVideoSample","units","getLastNalUnit","_VideoSample","lastUnit","pushAccessUnit","nbSamples","lastSample","ExpGolomb","bytesAvailable","bitsAvailable","loadWord","workingBytes","availableBytes","skipBits","count","skipBytes","readBits","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","ceil","readSliceType","AvcVideoParser","_BaseVideoParser","parseAVCPES","pes","parseAVCNALu","spsfound","audFound","_VideoSample2","iskey","sliceType","_track$pixelRatio","_track$pixelRatio2","sps","codecarray","codecstring","pps","overflow","naluState","lastState","lastUnitStart","lastUnitType","_unit","_lastUnit","SampleAesDecrypter","decryptBuffer","encryptedData","decryptAacSample","sampleIndex","callback","curUnit","encryptedBuffer","decryptedBuffer","decryptAacSamples","getAvcEncryptedData","decodedData","encryptedDataLen","Int8Array","outputPos","inputPos","getAvcDecryptedUnit","uint8DecryptedData","decryptAvcSample","unitIndex","decryptAvcSamples","curUnits","PACKET_LENGTH","TSDemuxer","typeSupported","sampleAes","pmtParsed","_duration","_pmtId","_videoTrack","_txtTrack","aacOverFlow","videoParser","syncOffset","scanwindow","foundPat","packetStart","tsPackets","parsePID","pesData","isSampleAes","videoPid","audioPid","id3Pid","audioData","unknownPID","pmtId","tsPacketErrors","stt","parsePES","parseAACPES","parseMPEGPES","parseID3PES","parsePAT","parsedPIDs","parsePMT","segmentVideoCodec","segmentAudioCodec","emitParsingError","demuxResult","extractRemainingSamples","frameMissingBytes","sampleLength","frameOverflowBytes","recoverable","frameDuration","parseAC3PES","id3Sample","tableEnd","esInfoLength","logEncryptedSamplesFoundInUnencryptedStream","mpeg","mp3","parsePos","remaining","descriptorLen","stream","pesLen","pesHdrLen","pesPts","pesDts","splice","pesFlags","payloadStartOffset","dataLen","MP3Demuxer","AAC","getSilentFrame","UINT32_MAX","MP4","types","avcC","btrt","dinf","dref","esds","ftyp","mdat","mdia","mfhd","minf","moov","dac3","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","audioStsd","ac3","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","AC3_SAMPLES_PER_FRAME","chromeVersion","safariWebkitVersion","MP4Remuxer","vendor","ISGenerated","_initPTS","_initDTS","nextAvcDts","nextAudioPts","videoSampleDuration","isAudioContiguous","isVideoContiguous","videoTrackConfig","defaultTimeStamp","resetNextTimestamp","getVideoStartPts","rolloverDetected","minPTS","normalizePts","remux","accurateTimeOffset","audioTimeOffset","videoTimeOffset","hasAudio","hasVideo","enoughAudioSamples","enoughVideoSamples","_videoTrack$pixelRati","_config$pixelRatio","_videoTrack$pixelRati2","_config$pixelRatio2","generateIS","firstKeyFramePTS","firstKeyFrameIndex","findKeyframeIndex","_startPTS","audiovideoTimestampDelta","remuxAudio","audioTrackLength","remuxVideo","firstKeyFrame","flushTextTrackMetadataCueSamples","flushTextTrackUserdataCueSamples","initDTS","audioSamples","computePTSDTS","firstDTS","lastDTS","inputSamples","outputSamples","mp4SampleDuration","maxPTS","NEGATIVE_INFINITY","sortSamples","initTime","deltadts","deltapts","inputDuration","averageSampleDuration","foundHole","foundOverlap","firstPTS","nbNalu","naluLen","dtsStep","nbUnits","sampleLen","mdatSize","MUX_ERROR","setUint32","stretchedLastFrame","minDtsDelta","minPtsDelta","maxDtsDelta","maxPtsDelta","VideoSampleUnits","mp4SampleLength","_j","_nbUnits","unitData","unitDataLen","ptsDelta","lastFrameDuration","gapTolerance","deltaToFrameEnd","compositionTimeOffset","Mp4Sample","nextDts","_pts","nextPts","nb","getSamplesPerFrame","scaleFactor","inputSampleDuration","rawMPEG","alignedWithVideo","timeOffsetMpegTS","newStamp","fillFrame","_j2","_nbSamples","audioSample","_pts2","unitLen","remuxEmptyAudio","init90kHz","silentFrame","reference","isKeyframe","PassThroughRemuxer","emitInitSegment","initTracks","lastEndTime","defaultInitPTS","generateInitSegment","getParsedTrackCodec","_initData","_initData2","decodeTime","isInvalidInitPts","minDuration","optionalSelf","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","_muxConfig$i$demux","Remuxer","Demuxer","encryptionType","TransmuxConfig","TransmuxState","eventemitter3","prefix","EE","once","addListener","emitter","evt","_events","_eventsCount","clearEvent","EventEmitter","eventNames","events","names","handlers","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","worker","Worker","loadWorker","scriptURL","location","TransmuxerInterface","onTransmuxComplete","onFlush","useWorker","workerContext","onwmsg","m2tsTypeSupported","onWorkerMessage","onerror","filename","lineno","resetWorker","_this$workerContext","terminate","_frag$initSegment","_lastFrag$initSegment","snDiff","partDiff","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","hasEnoughBuffer","noBufferGap","startJump","maxStartGapJump","partialOrGap","_trySkipBufferHole","tnow","stalledDuration","_reportStall","bufferedWithHoles","_tryFixBufferStall","_stalledDuration","stalledDurationMs","_tryNudgeBuffer","bufferStarved","waiting","gapLength","startGap","startFrag","startProvisioned","moreToLoad","provisioned","targetTime","TICK_INTERVAL","StreamController","_BaseStreamController","audioCodecSwap","gapController","_forceStartLoad","fragPlaying","onvplaying","onvseeked","fragLastKbps","couldBacktrack","audioCodecSwitch","videoBuffer","onFragLoadEmergencyAborted","AUDIO_TRACK_SWITCHING","onAudioTrackSwitching","AUDIO_TRACK_SWITCHED","onAudioTrackSwitched","onBufferCreated","onBufferFlushed","_currentLevel","doTickIdle","checkBuffer","checkFragmentChanged","getMainFwdBufferInfo","lastDetails","manualLevel","_this$backtrackFragme","backtrackFrag","_loadBitrateTestFrag","followingBufferedFrag","immediateLevelSwitch","abortCurrentFrag","fetchdelay","fragPlayingCurrent","bufferedFrag","nextBufferedFrag","maxStart","startPts","onMediaPlaying","onMediaSeeked","aac","heaac","_curLevel$details","newLevelId","_getAudioCodec","_handleTransmuxComplete","fromAltAudio","mediaTrack","alternate","swapAudioCodec","_id3$samples","mapFragment","_bufferInitSegment","FRAG_PARSING_INIT_SEGMENT","INIT_PTS_FOUND","isFirstFragment","isFirstInDiscontinuity","backtrack","_endPTS","_startDTS","_endDTS","emittedID3","emittedText","FRAG_PARSING_USERDATA","ua","audioMetadata","fragCurrentLevel","LEVEL_SWITCHED","currentFrag","epocMs","Hls","coreComponents","networkControllers","_emitter","_autoLevelCapping","_maxHdcpLevel","latencyController","levelController","_media","triggeringException","DefaultConfig","ConfigAbrController","ConfigBufferController","ConfigCapLevelController","ConfigErrorController","ConfigFpsController","playListLoader","id3TrackController","ConfigContentSteeringController","createController","AudioStreamControllerClass","SubtitleStreamControllerClass","ControllerClass","components","controllerInstance","eventObject","DESTROYING","detachMedia","component","attachMedia","loadSource","loadedSource","loadingSource","setAudioOption","audioOption","_this$audioTrackContr","setSubtitleOption","subtitleOption","_this$subtitleTrackCo","shouldStartCapping","newCapLevelToPlayerSize","currentProgramDateTime","audioTrackId","allSubtitleTracks","subtitleTrack","subtitleTrackId","subtitleDisplay","factory"],"sourceRoot":""}