From 54ef1dcc51917a4fed2ac40695f2906705de1dca Mon Sep 17 00:00:00 2001 From: Dylan Jhaveri Date: Tue, 27 Oct 2020 17:51:09 -0700 Subject: [PATCH 1/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea94f54..1782096 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "example": "examples" }, "dependencies": { - "hls.js": "^0.8.9" + "hls.js": "^0.14.16" }, "devDependencies": { "webpack": "2.4.1" From 437e638bf54c9ab2a3de5aa4e4f35eab0237adea Mon Sep 17 00:00:00 2001 From: Dylan Jhaveri Date: Tue, 27 Oct 2020 19:18:41 -0700 Subject: [PATCH 2/3] run npm install to update package-log.json --- package-lock.json | 1073 ++++++++++++++++++++++++--------------------- 1 file changed, 561 insertions(+), 512 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8bc27c9..ae4111e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,11 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, "fsevents": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", @@ -11,8 +16,8 @@ "dev": true, "optional": true, "requires": { - "nan": "2.8.0", - "node-pre-gyp": "0.6.39" + "nan": "^2.3.0", + "node-pre-gyp": "^0.6.39" }, "dependencies": { "abbrev": { @@ -27,14 +32,15 @@ "dev": true, "optional": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" } }, "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.1.1", @@ -48,8 +54,8 @@ "dev": true, "optional": true, "requires": { - "delegates": "1.0.0", - "readable-stream": "2.2.9" + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" } }, "asn1": { @@ -85,7 +91,8 @@ "balanced-match": { "version": "0.4.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "bcrypt-pbkdf": { "version": "1.0.1", @@ -93,38 +100,42 @@ "dev": true, "optional": true, "requires": { - "tweetnacl": "0.14.5" + "tweetnacl": "^0.14.3" } }, "block-stream": { "version": "0.0.9", "bundled": true, "dev": true, + "optional": true, "requires": { - "inherits": "2.0.3" + "inherits": "~2.0.0" } }, "boom": { "version": "2.10.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "brace-expansion": { "version": "1.1.7", "bundled": true, "dev": true, + "optional": true, "requires": { - "balanced-match": "0.4.2", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" } }, "buffer-shims": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "caseless": { "version": "0.12.0", @@ -141,37 +152,43 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "combined-stream": { "version": "1.0.5", "bundled": true, "dev": true, + "optional": true, "requires": { - "delayed-stream": "1.0.0" + "delayed-stream": "~1.0.0" } }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "cryptiles": { "version": "2.0.5", "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.10.1" + "boom": "2.x.x" } }, "dashdash": { @@ -180,7 +197,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -209,7 +226,8 @@ "delayed-stream": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "delegates": { "version": "1.0.0", @@ -229,7 +247,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "extend": { @@ -241,7 +259,8 @@ "extsprintf": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "forever-agent": { "version": "0.6.1", @@ -255,25 +274,27 @@ "dev": true, "optional": true, "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" } }, "fs.realpath": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "fstream": { "version": "1.0.11", "bundled": true, "dev": true, + "optional": true, "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" } }, "fstream-ignore": { @@ -282,9 +303,9 @@ "dev": true, "optional": true, "requires": { - "fstream": "1.0.11", - "inherits": "2.0.3", - "minimatch": "3.0.4" + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" } }, "gauge": { @@ -293,14 +314,14 @@ "dev": true, "optional": true, "requires": { - "aproba": "1.1.1", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "getpass": { @@ -309,7 +330,7 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "1.0.0" + "assert-plus": "^1.0.0" }, "dependencies": { "assert-plus": { @@ -324,19 +345,21 @@ "version": "7.1.2", "bundled": true, "dev": true, + "optional": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-fs": { "version": "4.1.11", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "har-schema": { "version": "1.0.5", @@ -350,8 +373,8 @@ "dev": true, "optional": true, "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" + "ajv": "^4.9.1", + "har-schema": "^1.0.5" } }, "has-unicode": { @@ -364,17 +387,19 @@ "version": "3.1.3", "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" } }, "hoek": { "version": "2.16.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "http-signature": { "version": "1.1.1", @@ -382,24 +407,26 @@ "dev": true, "optional": true, "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.0" + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" } }, "inflight": { "version": "1.0.6", "bundled": true, "dev": true, + "optional": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.4", @@ -411,8 +438,9 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "is-typedarray": { @@ -424,7 +452,8 @@ "isarray": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "isstream": { "version": "0.1.2", @@ -438,7 +467,7 @@ "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "~0.1.0" } }, "jsbn": { @@ -459,7 +488,7 @@ "dev": true, "optional": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" } }, "json-stringify-safe": { @@ -497,33 +526,38 @@ "mime-db": { "version": "1.27.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "mime-types": { "version": "2.1.15", "bundled": true, "dev": true, + "optional": true, "requires": { - "mime-db": "1.27.0" + "mime-db": "~1.27.0" } }, "minimatch": { "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { - "brace-expansion": "1.1.7" + "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "mkdirp": { "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -540,17 +574,17 @@ "dev": true, "optional": true, "requires": { - "detect-libc": "1.0.2", + "detect-libc": "^1.0.2", "hawk": "3.1.3", - "mkdirp": "0.5.1", - "nopt": "4.0.1", - "npmlog": "4.1.0", - "rc": "1.2.1", + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.0.2", + "rc": "^1.1.7", "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "tar-pack": "3.4.0" + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^2.2.1", + "tar-pack": "^3.4.0" } }, "nopt": { @@ -559,8 +593,8 @@ "dev": true, "optional": true, "requires": { - "abbrev": "1.1.0", - "osenv": "0.1.4" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npmlog": { @@ -569,16 +603,17 @@ "dev": true, "optional": true, "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "oauth-sign": { "version": "0.8.2", @@ -596,8 +631,9 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-homedir": { @@ -618,14 +654,15 @@ "dev": true, "optional": true, "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" } }, "path-is-absolute": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "performance-now": { "version": "0.2.0", @@ -636,7 +673,8 @@ "process-nextick-args": { "version": "1.0.7", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "punycode": { "version": "1.4.1", @@ -656,10 +694,10 @@ "dev": true, "optional": true, "requires": { - "deep-extend": "0.4.2", - "ini": "1.3.4", - "minimist": "1.2.0", - "strip-json-comments": "2.0.1" + "deep-extend": "~0.4.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, "dependencies": { "minimist": { @@ -674,14 +712,15 @@ "version": "2.2.9", "bundled": true, "dev": true, + "optional": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.1", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" } }, "request": { @@ -690,42 +729,44 @@ "dev": true, "optional": true, "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" } }, "rimraf": { "version": "2.6.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "glob": "7.1.2" + "glob": "^7.0.5" } }, "safe-buffer": { "version": "5.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "semver": { "version": "5.3.0", @@ -749,8 +790,9 @@ "version": "1.0.9", "bundled": true, "dev": true, + "optional": true, "requires": { - "hoek": "2.16.3" + "hoek": "2.x.x" } }, "sshpk": { @@ -759,15 +801,15 @@ "dev": true, "optional": true, "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jodid25519": "1.0.2", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jodid25519": "^1.0.0", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" }, "dependencies": { "assert-plus": { @@ -782,18 +824,20 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "string_decoder": { "version": "1.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "5.0.1" + "safe-buffer": "^5.0.1" } }, "stringstream": { @@ -806,8 +850,9 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } }, "strip-json-comments": { @@ -820,10 +865,11 @@ "version": "2.2.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" } }, "tar-pack": { @@ -832,14 +878,14 @@ "dev": true, "optional": true, "requires": { - "debug": "2.6.8", - "fstream": "1.0.11", - "fstream-ignore": "1.0.5", - "once": "1.4.0", - "readable-stream": "2.2.9", - "rimraf": "2.6.1", - "tar": "2.2.1", - "uid-number": "0.0.6" + "debug": "^2.2.0", + "fstream": "^1.0.10", + "fstream-ignore": "^1.0.5", + "once": "^1.3.3", + "readable-stream": "^2.1.4", + "rimraf": "^2.5.1", + "tar": "^2.2.1", + "uid-number": "^0.0.6" } }, "tough-cookie": { @@ -848,7 +894,7 @@ "dev": true, "optional": true, "requires": { - "punycode": "1.4.1" + "punycode": "^1.4.1" } }, "tunnel-agent": { @@ -857,7 +903,7 @@ "dev": true, "optional": true, "requires": { - "safe-buffer": "5.0.1" + "safe-buffer": "^5.0.1" } }, "tweetnacl": { @@ -875,7 +921,8 @@ "util-deprecate": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "uuid": { "version": "3.0.1", @@ -898,22 +945,24 @@ "dev": true, "optional": true, "requires": { - "string-width": "1.0.2" + "string-width": "^1.0.2" } }, "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, "hls.js": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-0.8.9.tgz", - "integrity": "sha1-2zZ8yZzlsJduo+BZodBE17B5Bpc=", + "version": "0.14.16", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-0.14.16.tgz", + "integrity": "sha512-VACiO99DQFBpflR4fI+6GVHUZn35R0SGGQo0XTDZOm2BUXbeuDHTghTC/k2/3wGln6KBmG8/bXIcDIzDsY2UEg==", "requires": { - "url-toolkit": "2.1.4" + "eventemitter3": "^4.0.3", + "url-toolkit": "^2.1.6" } }, "nan": { @@ -924,9 +973,9 @@ "optional": true }, "url-toolkit": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/url-toolkit/-/url-toolkit-2.1.4.tgz", - "integrity": "sha512-jAzm/85zNFfkW5Do/37GeGC7uGXBMMawToVdcf5SIpc+x9TmZDrRIUuLRPcvDMfqtt3m8VmDrYhCWh4UbsQLyg==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/url-toolkit/-/url-toolkit-2.2.1.tgz", + "integrity": "sha512-8+DzgrtDZYZGhHaAop5WGVghMdCfOLGbhcArsJD0qDll71FXa7EeKxi2hilPIscn2nwMz4PRjML32Sz4JTN0Xw==" }, "webpack": { "version": "2.4.1", @@ -934,27 +983,27 @@ "integrity": "sha1-FakdvjSWbYpLmcfWVu/ZKi5ab2o=", "dev": true, "requires": { - "acorn": "5.0.3", - "acorn-dynamic-import": "2.0.2", - "ajv": "4.11.7", - "ajv-keywords": "1.5.1", - "async": "2.3.0", - "enhanced-resolve": "3.1.0", - "interpret": "1.0.3", - "json-loader": "0.5.4", - "json5": "0.5.1", - "loader-runner": "2.3.0", - "loader-utils": "0.2.17", - "memory-fs": "0.4.1", - "mkdirp": "0.5.1", - "node-libs-browser": "2.0.0", - "source-map": "0.5.6", - "supports-color": "3.2.3", - "tapable": "0.2.6", - "uglify-js": "2.8.22", - "watchpack": "1.3.1", - "webpack-sources": "0.2.3", - "yargs": "6.6.0" + "acorn": "^5.0.0", + "acorn-dynamic-import": "^2.0.0", + "ajv": "^4.7.0", + "ajv-keywords": "^1.1.1", + "async": "^2.1.2", + "enhanced-resolve": "^3.0.0", + "interpret": "^1.0.0", + "json-loader": "^0.5.4", + "json5": "^0.5.1", + "loader-runner": "^2.3.0", + "loader-utils": "^0.2.16", + "memory-fs": "~0.4.1", + "mkdirp": "~0.5.0", + "node-libs-browser": "^2.0.0", + "source-map": "^0.5.3", + "supports-color": "^3.1.0", + "tapable": "~0.2.5", + "uglify-js": "^2.8.5", + "watchpack": "^1.3.1", + "webpack-sources": "^0.2.3", + "yargs": "^6.0.0" }, "dependencies": { "acorn": { @@ -969,7 +1018,7 @@ "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", "dev": true, "requires": { - "acorn": "4.0.11" + "acorn": "^4.0.3" }, "dependencies": { "acorn": { @@ -986,8 +1035,8 @@ "integrity": "sha1-hlWl2G0IJJhcxHGh2RP7Zymg7Eg=", "dev": true, "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" }, "dependencies": { "co": { @@ -1002,7 +1051,7 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "requires": { - "jsonify": "0.0.0" + "jsonify": "~0.0.0" }, "dependencies": { "jsonify": { @@ -1027,7 +1076,7 @@ "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "^4.14.0" }, "dependencies": { "lodash": { @@ -1044,10 +1093,10 @@ "integrity": "sha1-n0tib1dyRe3PSyrYPYbhf09CHew=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "memory-fs": "0.4.1", - "object-assign": "4.1.1", - "tapable": "0.2.6" + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "object-assign": "^4.0.1", + "tapable": "^0.2.5" }, "dependencies": { "graceful-fs": { @@ -1094,10 +1143,10 @@ "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", "dev": true, "requires": { - "big.js": "3.1.3", - "emojis-list": "2.1.0", - "json5": "0.5.1", - "object-assign": "4.1.1" + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" }, "dependencies": { "big.js": { @@ -1126,8 +1175,8 @@ "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "dev": true, "requires": { - "errno": "0.1.4", - "readable-stream": "2.2.9" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" }, "dependencies": { "errno": { @@ -1136,7 +1185,7 @@ "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", "dev": true, "requires": { - "prr": "0.0.0" + "prr": "~0.0.0" }, "dependencies": { "prr": { @@ -1153,13 +1202,13 @@ "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", "dev": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.0", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" }, "dependencies": { "buffer-shims": { @@ -1198,7 +1247,7 @@ "integrity": "sha1-8G9BFXtmTYYGn4S9vcmw2KsoFmc=", "dev": true, "requires": { - "buffer-shims": "1.0.0" + "buffer-shims": "~1.0.0" } }, "util-deprecate": { @@ -1234,28 +1283,28 @@ "integrity": "sha1-o6WeyXAkmFtG6Vg3lkb5bEthZkY=", "dev": true, "requires": { - "assert": "1.4.1", - "browserify-zlib": "0.1.4", - "buffer": "4.9.1", - "console-browserify": "1.1.0", - "constants-browserify": "1.0.0", - "crypto-browserify": "3.11.0", - "domain-browser": "1.1.7", - "events": "1.1.1", + "assert": "^1.1.1", + "browserify-zlib": "^0.1.4", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", "https-browserify": "0.0.1", - "os-browserify": "0.2.1", + "os-browserify": "^0.2.0", "path-browserify": "0.0.0", - "process": "0.11.9", - "punycode": "1.4.1", - "querystring-es3": "0.2.1", - "readable-stream": "2.2.9", - "stream-browserify": "2.0.1", - "stream-http": "2.7.0", - "string_decoder": "0.10.31", - "timers-browserify": "2.0.2", + "process": "^0.11.0", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.0.5", + "stream-browserify": "^2.0.1", + "stream-http": "^2.3.1", + "string_decoder": "^0.10.25", + "timers-browserify": "^2.0.2", "tty-browserify": "0.0.0", - "url": "0.11.0", - "util": "0.10.3", + "url": "^0.11.0", + "util": "^0.10.3", "vm-browserify": "0.0.4" }, "dependencies": { @@ -1274,7 +1323,7 @@ "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", "dev": true, "requires": { - "pako": "0.2.9" + "pako": "~0.2.0" }, "dependencies": { "pako": { @@ -1291,9 +1340,9 @@ "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { - "base64-js": "1.2.0", - "ieee754": "1.1.8", - "isarray": "1.0.0" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" }, "dependencies": { "base64-js": { @@ -1322,7 +1371,7 @@ "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", "dev": true, "requires": { - "date-now": "0.1.4" + "date-now": "^0.1.4" }, "dependencies": { "date-now": { @@ -1345,16 +1394,16 @@ "integrity": "sha1-NlKgkGq5sqfgw85mpAjpV6JIVSI=", "dev": true, "requires": { - "browserify-cipher": "1.0.0", - "browserify-sign": "4.0.4", - "create-ecdh": "4.0.0", - "create-hash": "1.1.2", - "create-hmac": "1.1.4", - "diffie-hellman": "5.0.2", - "inherits": "2.0.3", - "pbkdf2": "3.0.9", - "public-encrypt": "4.0.0", - "randombytes": "2.0.3" + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0" }, "dependencies": { "browserify-cipher": { @@ -1363,9 +1412,9 @@ "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", "dev": true, "requires": { - "browserify-aes": "1.0.6", - "browserify-des": "1.0.0", - "evp_bytestokey": "1.0.0" + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" }, "dependencies": { "browserify-aes": { @@ -1374,11 +1423,11 @@ "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", "dev": true, "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.3", - "create-hash": "1.1.2", - "evp_bytestokey": "1.0.0", - "inherits": "2.0.3" + "buffer-xor": "^1.0.2", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "inherits": "^2.0.1" }, "dependencies": { "buffer-xor": { @@ -1393,7 +1442,7 @@ "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } } } @@ -1404,9 +1453,9 @@ "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", "dev": true, "requires": { - "cipher-base": "1.0.3", - "des.js": "1.0.0", - "inherits": "2.0.3" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" }, "dependencies": { "cipher-base": { @@ -1415,7 +1464,7 @@ "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } }, "des.js": { @@ -1424,8 +1473,8 @@ "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", "dev": true, "requires": { - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" }, "dependencies": { "minimalistic-assert": { @@ -1444,7 +1493,7 @@ "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", "dev": true, "requires": { - "create-hash": "1.1.2" + "create-hash": "^1.1.1" } } } @@ -1455,13 +1504,13 @@ "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", "dev": true, "requires": { - "bn.js": "4.11.6", - "browserify-rsa": "4.0.1", - "create-hash": "1.1.2", - "create-hmac": "1.1.4", - "elliptic": "6.4.0", - "inherits": "2.0.3", - "parse-asn1": "5.1.0" + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" }, "dependencies": { "bn.js": { @@ -1476,8 +1525,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "4.11.6", - "randombytes": "2.0.3" + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" } }, "elliptic": { @@ -1486,13 +1535,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "4.11.6", - "brorand": "1.1.0", - "hash.js": "1.0.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" }, "dependencies": { "brorand": { @@ -1507,7 +1556,7 @@ "integrity": "sha1-EzL/ABVsCg/92CNgE9B7d6BFFXM=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } }, "hmac-drbg": { @@ -1516,9 +1565,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "1.0.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "minimalistic-assert": { @@ -1541,11 +1590,11 @@ "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", "dev": true, "requires": { - "asn1.js": "4.9.1", - "browserify-aes": "1.0.6", - "create-hash": "1.1.2", - "evp_bytestokey": "1.0.0", - "pbkdf2": "3.0.9" + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" }, "dependencies": { "asn1.js": { @@ -1554,9 +1603,9 @@ "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", "dev": true, "requires": { - "bn.js": "4.11.6", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" }, "dependencies": { "minimalistic-assert": { @@ -1573,11 +1622,11 @@ "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", "dev": true, "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.3", - "create-hash": "1.1.2", - "evp_bytestokey": "1.0.0", - "inherits": "2.0.3" + "buffer-xor": "^1.0.2", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "inherits": "^2.0.1" }, "dependencies": { "buffer-xor": { @@ -1592,7 +1641,7 @@ "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } } } @@ -1603,7 +1652,7 @@ "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", "dev": true, "requires": { - "create-hash": "1.1.2" + "create-hash": "^1.1.1" } } } @@ -1616,8 +1665,8 @@ "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", "dev": true, "requires": { - "bn.js": "4.11.6", - "elliptic": "6.4.0" + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" }, "dependencies": { "bn.js": { @@ -1632,13 +1681,13 @@ "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "dev": true, "requires": { - "bn.js": "4.11.6", - "brorand": "1.1.0", - "hash.js": "1.0.3", - "hmac-drbg": "1.0.1", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" }, "dependencies": { "brorand": { @@ -1653,7 +1702,7 @@ "integrity": "sha1-EzL/ABVsCg/92CNgE9B7d6BFFXM=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } }, "hmac-drbg": { @@ -1662,9 +1711,9 @@ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { - "hash.js": "1.0.3", - "minimalistic-assert": "1.0.0", - "minimalistic-crypto-utils": "1.0.1" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, "minimalistic-assert": { @@ -1689,10 +1738,10 @@ "integrity": "sha1-USEAYte7dHn2xlu0GpIgix1hq60=", "dev": true, "requires": { - "cipher-base": "1.0.3", - "inherits": "2.0.3", - "ripemd160": "1.0.1", - "sha.js": "2.4.8" + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "ripemd160": "^1.0.0", + "sha.js": "^2.3.6" }, "dependencies": { "cipher-base": { @@ -1701,7 +1750,7 @@ "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } }, "ripemd160": { @@ -1716,7 +1765,7 @@ "integrity": "sha1-NwaMLEdra69ALRSknGf1l5IfY08=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } } } @@ -1727,8 +1776,8 @@ "integrity": "sha1-0/tLolPriz9W456i+8uK90e9MXA=", "dev": true, "requires": { - "create-hash": "1.1.2", - "inherits": "2.0.3" + "create-hash": "^1.1.0", + "inherits": "^2.0.1" } }, "diffie-hellman": { @@ -1737,9 +1786,9 @@ "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", "dev": true, "requires": { - "bn.js": "4.11.6", - "miller-rabin": "4.0.0", - "randombytes": "2.0.3" + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" }, "dependencies": { "bn.js": { @@ -1754,8 +1803,8 @@ "integrity": "sha1-SmL7HUKTPAVYOYL0xxb2+55sbT0=", "dev": true, "requires": { - "bn.js": "4.11.6", - "brorand": "1.1.0" + "bn.js": "^4.0.0", + "brorand": "^1.0.1" }, "dependencies": { "brorand": { @@ -1780,7 +1829,7 @@ "integrity": "sha1-8sSyWmAAWLPDdzwIbDfbvuH/5pM=", "dev": true, "requires": { - "create-hmac": "1.1.4" + "create-hmac": "^1.1.2" } }, "public-encrypt": { @@ -1789,11 +1838,11 @@ "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", "dev": true, "requires": { - "bn.js": "4.11.6", - "browserify-rsa": "4.0.1", - "create-hash": "1.1.2", - "parse-asn1": "5.1.0", - "randombytes": "2.0.3" + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" }, "dependencies": { "bn.js": { @@ -1808,8 +1857,8 @@ "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { - "bn.js": "4.11.6", - "randombytes": "2.0.3" + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" } }, "parse-asn1": { @@ -1818,11 +1867,11 @@ "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", "dev": true, "requires": { - "asn1.js": "4.9.1", - "browserify-aes": "1.0.6", - "create-hash": "1.1.2", - "evp_bytestokey": "1.0.0", - "pbkdf2": "3.0.9" + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" }, "dependencies": { "asn1.js": { @@ -1831,9 +1880,9 @@ "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", "dev": true, "requires": { - "bn.js": "4.11.6", - "inherits": "2.0.3", - "minimalistic-assert": "1.0.0" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" }, "dependencies": { "minimalistic-assert": { @@ -1850,11 +1899,11 @@ "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", "dev": true, "requires": { - "buffer-xor": "1.0.3", - "cipher-base": "1.0.3", - "create-hash": "1.1.2", - "evp_bytestokey": "1.0.0", - "inherits": "2.0.3" + "buffer-xor": "^1.0.2", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "inherits": "^2.0.1" }, "dependencies": { "buffer-xor": { @@ -1869,7 +1918,7 @@ "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", "dev": true, "requires": { - "inherits": "2.0.3" + "inherits": "^2.0.1" } } } @@ -1880,7 +1929,7 @@ "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", "dev": true, "requires": { - "create-hash": "1.1.2" + "create-hash": "^1.1.1" } } } @@ -1949,13 +1998,13 @@ "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", "dev": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.0", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" }, "dependencies": { "buffer-shims": { @@ -1994,7 +2043,7 @@ "integrity": "sha1-8G9BFXtmTYYGn4S9vcmw2KsoFmc=", "dev": true, "requires": { - "buffer-shims": "1.0.0" + "buffer-shims": "~1.0.0" } }, "util-deprecate": { @@ -2011,8 +2060,8 @@ "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.2.9" + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" }, "dependencies": { "inherits": { @@ -2029,11 +2078,11 @@ "integrity": "sha1-zsH047SUvEqBtFGAiXD4sgtO1fY=", "dev": true, "requires": { - "builtin-status-codes": "3.0.0", - "inherits": "2.0.3", - "readable-stream": "2.2.9", - "to-arraybuffer": "1.0.1", - "xtend": "4.0.1" + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.2.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" }, "dependencies": { "builtin-status-codes": { @@ -2074,7 +2123,7 @@ "integrity": "sha1-q0iDz1l9zVCvIRNJoA+8pWrIa4Y=", "dev": true, "requires": { - "setimmediate": "1.0.5" + "setimmediate": "^1.0.4" }, "dependencies": { "setimmediate": { @@ -2163,7 +2212,7 @@ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" }, "dependencies": { "has-flag": { @@ -2186,9 +2235,9 @@ "integrity": "sha1-1Uk0d4qNoUkD+imjJvskwKtRoaA=", "dev": true, "requires": { - "source-map": "0.5.6", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" }, "dependencies": { "uglify-to-browserify": { @@ -2204,9 +2253,9 @@ "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", "window-size": "0.1.0" }, "dependencies": { @@ -2222,8 +2271,8 @@ "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", + "center-align": "^0.1.1", + "right-align": "^0.1.1", "wordwrap": "0.0.2" }, "dependencies": { @@ -2233,8 +2282,8 @@ "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", "dev": true, "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" }, "dependencies": { "align-text": { @@ -2243,9 +2292,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "3.2.0", - "longest": "1.0.1", - "repeat-string": "1.6.1" + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" }, "dependencies": { "kind-of": { @@ -2254,7 +2303,7 @@ "integrity": "sha1-tYq+TVwEStM3JqjBUltIz4kb/wc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" }, "dependencies": { "is-buffer": { @@ -2293,7 +2342,7 @@ "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, "requires": { - "align-text": "0.1.4" + "align-text": "^0.1.1" }, "dependencies": { "align-text": { @@ -2302,9 +2351,9 @@ "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, "requires": { - "kind-of": "3.2.0", - "longest": "1.0.1", - "repeat-string": "1.6.1" + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" }, "dependencies": { "kind-of": { @@ -2313,7 +2362,7 @@ "integrity": "sha1-tYq+TVwEStM3JqjBUltIz4kb/wc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" }, "dependencies": { "is-buffer": { @@ -2370,9 +2419,9 @@ "integrity": "sha1-fYaTkHsozmAT5/NhCqKhrPB9rYc=", "dev": true, "requires": { - "async": "2.3.0", - "chokidar": "1.6.1", - "graceful-fs": "4.1.11" + "async": "^2.1.2", + "chokidar": "^1.4.3", + "graceful-fs": "^4.1.2" }, "dependencies": { "chokidar": { @@ -2381,15 +2430,15 @@ "integrity": "sha1-L0RHq16W5Q+z14n9kNTHLg5McMI=", "dev": true, "requires": { - "anymatch": "1.3.0", - "async-each": "1.0.1", - "fsevents": "1.1.3", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" }, "dependencies": { "anymatch": { @@ -2398,8 +2447,8 @@ "integrity": "sha1-o+Uvo5FoyCX/V7AkgSbOWo/5VQc=", "dev": true, "requires": { - "arrify": "1.0.1", - "micromatch": "2.3.11" + "arrify": "^1.0.0", + "micromatch": "^2.1.5" }, "dependencies": { "arrify": { @@ -2414,19 +2463,19 @@ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.0", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.0", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.3" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" }, "dependencies": { "arr-diff": { @@ -2435,7 +2484,7 @@ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", "dev": true, "requires": { - "arr-flatten": "1.0.3" + "arr-flatten": "^1.0.1" }, "dependencies": { "arr-flatten": { @@ -2458,9 +2507,9 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" }, "dependencies": { "expand-range": { @@ -2469,7 +2518,7 @@ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { - "fill-range": "2.2.3" + "fill-range": "^2.1.0" }, "dependencies": { "fill-range": { @@ -2478,11 +2527,11 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true, "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.6", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^1.1.3", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" }, "dependencies": { "is-number": { @@ -2491,7 +2540,7 @@ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { - "kind-of": "3.2.0" + "kind-of": "^3.0.2" } }, "isobject": { @@ -2517,8 +2566,8 @@ "integrity": "sha1-EQ3Kv/OX6dz/fAeJzMCkmt8exbs=", "dev": true, "requires": { - "is-number": "2.1.0", - "kind-of": "3.2.0" + "is-number": "^2.0.2", + "kind-of": "^3.0.2" } }, "repeat-string": { @@ -2551,7 +2600,7 @@ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "is-posix-bracket": "0.1.1" + "is-posix-bracket": "^0.1.0" }, "dependencies": { "is-posix-bracket": { @@ -2568,7 +2617,7 @@ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" } }, "filename-regex": { @@ -2589,7 +2638,7 @@ "integrity": "sha1-tYq+TVwEStM3JqjBUltIz4kb/wc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "^1.1.5" }, "dependencies": { "is-buffer": { @@ -2606,7 +2655,7 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, "requires": { - "remove-trailing-separator": "1.0.1" + "remove-trailing-separator": "^1.0.1" }, "dependencies": { "remove-trailing-separator": { @@ -2623,8 +2672,8 @@ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", "dev": true, "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" }, "dependencies": { "for-own": { @@ -2633,7 +2682,7 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true, "requires": { - "for-in": "1.0.2" + "for-in": "^1.0.1" }, "dependencies": { "for-in": { @@ -2658,10 +2707,10 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true, "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.2", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" }, "dependencies": { "glob-base": { @@ -2670,8 +2719,8 @@ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" } }, "is-dotfile": { @@ -2688,8 +2737,8 @@ "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", "dev": true, "requires": { - "is-equal-shallow": "0.1.3", - "is-primitive": "2.0.0" + "is-equal-shallow": "^0.1.3", + "is-primitive": "^2.0.0" }, "dependencies": { "is-equal-shallow": { @@ -2698,7 +2747,7 @@ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", "dev": true, "requires": { - "is-primitive": "2.0.0" + "is-primitive": "^2.0.0" } }, "is-primitive": { @@ -2725,7 +2774,7 @@ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, "requires": { - "is-glob": "2.0.1" + "is-glob": "^2.0.0" } }, "inherits": { @@ -2740,7 +2789,7 @@ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "binary-extensions": "1.8.0" + "binary-extensions": "^1.0.0" }, "dependencies": { "binary-extensions": { @@ -2757,7 +2806,7 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "1.0.0" + "is-extglob": "^1.0.0" }, "dependencies": { "is-extglob": { @@ -2780,10 +2829,10 @@ "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.3", - "readable-stream": "2.2.9", - "set-immediate-shim": "1.0.1" + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" }, "dependencies": { "minimatch": { @@ -2792,7 +2841,7 @@ "integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=", "dev": true, "requires": { - "brace-expansion": "1.1.7" + "brace-expansion": "^1.0.0" }, "dependencies": { "brace-expansion": { @@ -2801,7 +2850,7 @@ "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", "dev": true, "requires": { - "balanced-match": "0.4.2", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" }, "dependencies": { @@ -2827,13 +2876,13 @@ "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", "dev": true, "requires": { - "buffer-shims": "1.0.0", - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "1.0.0", - "util-deprecate": "1.0.2" + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" }, "dependencies": { "buffer-shims": { @@ -2866,7 +2915,7 @@ "integrity": "sha1-8G9BFXtmTYYGn4S9vcmw2KsoFmc=", "dev": true, "requires": { - "buffer-shims": "1.0.0" + "buffer-shims": "~1.0.0" } }, "util-deprecate": { @@ -2901,8 +2950,8 @@ "integrity": "sha1-F8Yr+vE8cH+dAsR54Nzd6DgGl/s=", "dev": true, "requires": { - "source-list-map": "1.1.1", - "source-map": "0.5.6" + "source-list-map": "^1.1.1", + "source-map": "~0.5.3" }, "dependencies": { "source-list-map": { @@ -2919,19 +2968,19 @@ "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", "dev": true, "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "1.4.0", - "read-pkg-up": "1.0.1", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "1.0.2", - "which-module": "1.0.0", - "y18n": "3.2.1", - "yargs-parser": "4.2.1" + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^4.2.0" }, "dependencies": { "camelcase": { @@ -2946,9 +2995,9 @@ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" }, "dependencies": { "strip-ansi": { @@ -2957,7 +3006,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" }, "dependencies": { "ansi-regex": { @@ -2974,8 +3023,8 @@ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" } } } @@ -2998,7 +3047,7 @@ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { - "lcid": "1.0.0" + "lcid": "^1.0.0" }, "dependencies": { "lcid": { @@ -3007,7 +3056,7 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "1.0.0" + "invert-kv": "^1.0.0" }, "dependencies": { "invert-kv": { @@ -3026,8 +3075,8 @@ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" }, "dependencies": { "find-up": { @@ -3036,8 +3085,8 @@ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "path-exists": { @@ -3046,7 +3095,7 @@ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, "requires": { - "pinkie-promise": "2.0.1" + "pinkie-promise": "^2.0.0" } }, "pinkie-promise": { @@ -3055,7 +3104,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" }, "dependencies": { "pinkie": { @@ -3074,9 +3123,9 @@ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.3.8", - "path-type": "1.1.0" + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" }, "dependencies": { "load-json-file": { @@ -3085,11 +3134,11 @@ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" }, "dependencies": { "graceful-fs": { @@ -3104,7 +3153,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "^1.2.0" }, "dependencies": { "error-ex": { @@ -3113,7 +3162,7 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true, "requires": { - "is-arrayish": "0.2.1" + "is-arrayish": "^0.2.1" }, "dependencies": { "is-arrayish": { @@ -3138,7 +3187,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" }, "dependencies": { "pinkie": { @@ -3155,7 +3204,7 @@ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, "requires": { - "is-utf8": "0.2.1" + "is-utf8": "^0.2.0" }, "dependencies": { "is-utf8": { @@ -3174,10 +3223,10 @@ "integrity": "sha1-2Bntoqne29H/pWPqQHHZNngilbs=", "dev": true, "requires": { - "hosted-git-info": "2.4.2", - "is-builtin-module": "1.0.0", - "semver": "5.3.0", - "validate-npm-package-license": "3.0.1" + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" }, "dependencies": { "hosted-git-info": { @@ -3192,7 +3241,7 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { - "builtin-modules": "1.1.1" + "builtin-modules": "^1.0.0" }, "dependencies": { "builtin-modules": { @@ -3215,8 +3264,8 @@ "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true, "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" + "spdx-correct": "~1.0.0", + "spdx-expression-parse": "~1.0.0" }, "dependencies": { "spdx-correct": { @@ -3225,7 +3274,7 @@ "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true, "requires": { - "spdx-license-ids": "1.2.2" + "spdx-license-ids": "^1.0.2" }, "dependencies": { "spdx-license-ids": { @@ -3252,9 +3301,9 @@ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" }, "dependencies": { "graceful-fs": { @@ -3275,7 +3324,7 @@ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", "dev": true, "requires": { - "pinkie": "2.0.4" + "pinkie": "^2.0.0" }, "dependencies": { "pinkie": { @@ -3316,9 +3365,9 @@ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" }, "dependencies": { "code-point-at": { @@ -3333,7 +3382,7 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" }, "dependencies": { "number-is-nan": { @@ -3350,7 +3399,7 @@ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" }, "dependencies": { "ansi-regex": { @@ -3381,7 +3430,7 @@ "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", "dev": true, "requires": { - "camelcase": "3.0.0" + "camelcase": "^3.0.0" } } } From ff190cb9e1d07418b1141cc87717c0577982d82e Mon Sep 17 00:00:00 2001 From: Dylan Jhaveri Date: Tue, 27 Oct 2020 19:21:00 -0700 Subject: [PATCH 3/3] run 'npm run build' --- dist/videojs-contrib-hlsjs.min.js | 85 ++++++++++++++++++++++++++- dist/videojs-contrib-hlsjs.min.js.map | 2 +- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/dist/videojs-contrib-hlsjs.min.js b/dist/videojs-contrib-hlsjs.min.js index 96203fe..dfc3b49 100644 --- a/dist/videojs-contrib-hlsjs.min.js +++ b/dist/videojs-contrib-hlsjs.min.js @@ -1,2 +1,85 @@ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("video.js"));else if("function"==typeof define&&define.amd)define(["video.js"],e);else{var r=e("object"==typeof exports?require("video.js"):t.videojs);for(var i in r)("object"==typeof exports?exports:t)[i]=r[i]}}(this,function(t){return function(t){function e(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,r){!function(e,r){t.exports=r()}(0,function(){return function(t){function e(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=8)}([function(t,e,r){"use strict";function i(){}function a(t,e){return e="["+t+"] > "+e}function n(t){var e=self.console[t];return e?function(){for(var r=arguments.length,i=Array(r),n=0;n1?e-1:0),i=1;i0)return e.subarray(i,i+a)},t._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},t.getTimeStamp=function(e){for(var r=t.getID3Frames(e),i=0;i1&&void 0!==arguments[1]&&arguments[1],r=t.length,i=void 0,a=void 0,n=void 0,o="",s=0;s>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:a=t[s++],o+=String.fromCharCode((31&i)<<6|63&a);break;case 14:a=t[s++],n=t[s++],o+=String.fromCharCode((15&i)<<12|(63&a)<<6|(63&n)<<0)}}return o},t}(),n=a._utf8ArrayToStr;e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=function(){function t(e,r){i(this,t),this.subtle=e,this.aesIV=r}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}(),l=s,u=function(){function t(e,r){a(this,t),this.subtle=e,this.key=r}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}(),d=u,h=function(){function t(){n(this,t),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return t.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},t.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],h=s[3],c=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)c[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[f]=v,e[v]=f;var y=c[f],m=c[y],b=c[m],E=257*c[v]^16843008*v;i[f]=E<<24|E>>>8,a[f]=E<<16|E>>>16,n[f]=E<<8|E>>>24,o[f]=E,E=16843009*b^65537*m^257*y^16843008*f,l[v]=E<<24|E>>>8,u[v]=E<<16|E>>>16,d[v]=E<<8|E>>>24,h[v]=E,f?(f=y^c[c[c[b^y]]],p^=c[c[p]]):f=p=1}},t.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i0&&this._events[t].length>a&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),a||(a=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var a=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,a,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,a=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(n(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){a=s;break}if(a<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(a,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){!function(e){var r=/^((?:[^\/;?#]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/;?#]*)(.*)$/,a={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var n=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");return n.path=a.normalizePath(n.path),a.buildURLFromParts(n)}var o=this.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return r.alwaysNormalize?(o.path=a.normalizePath(o.path),a.buildURLFromParts(o)):e;var s=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(u.netLoc=s.netLoc,"/"!==o.path[0]))if(o.path){var d=s.path,h=d.substring(0,d.lastIndexOf("/")+1)+o.path;u.path=a.normalizePath(h)}else u.path=s.path,o.params||(u.params=s.params,o.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?a.normalizePath(o.path):o.path),a.buildURLFromParts(u)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(/(?:\/|^)\.(?=\/)/g,"");t.length!==(t=t.replace(/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=a}()},function(t,e,r){"use strict";function i(t,e,r,i){var a,n,o,s,l,u=navigator.userAgent.toLowerCase(),d=i,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return a=1+((192&e[r+2])>>>6),(n=(60&e[r+2])>>>2)>h.length-1?void t.trigger(Event.ERROR,{type:L.b.MEDIA_ERROR,details:L.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,w.b.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+n+"["+h[n]+"Hz],channelConfig:"+s),/firefox/i.test(u)?n>=6?(a=5,l=new Array(4),o=n-3):(a=2,l=new Array(2),o=n):-1!==u.indexOf("android")?(a=2,l=new Array(2),o=n):(a=5,l=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&n>=6?o=n-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(n>=6&&1===s||/vivaldi/i.test(u))||!i&&1===s)&&(a=2,l=new Array(2)),o=n)),l[0]=a<<3,l[0]|=(14&n)>>1,l[1]|=(1&n)<<7,l[1]|=s<<3,5===a&&(l[1]|=(14&o)>>1,l[2]=(1&o)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:h[n],channelCount:s,codec:"mp4a.40."+a,manifestCodec:d})}function a(t,e){return 255===t[e]&&240==(246&t[e+1])}function n(t,e){return 1&t[e+1]?7:9}function o(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function s(t,e){return!!(e+10&&e+s+l<=d)return u=r+i*a,{headerLength:s,frameLength:l,stamp:u}}function c(t,e,r,i,a){var n=d(t.samplerate),o=h(e,r,i,a,n);if(o){var s=o.stamp,l=o.headerLength,u=o.frameLength,c={unit:e.subarray(r+l,r+l+u),pts:s,dts:s};return t.samples.push(c),t.len+=u,{sample:c,length:u+l}}}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var S=r(1),L=r(2),_=r(4),w=r(0),D=r(3),I=function(){function t(e,r,i){f(this,t),this.observer=e,this.config=i,this.remuxer=r}return t.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){if(!t)return!1;for(var e=D.a.getID3Data(t,0)||[],r=e.length,i=t.length;r0},t.bin2str=function(t){return String.fromCharCode.apply(null,t)},t.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r<0?4294967296+r:r},t.writeUint32=function(t,e,r){t.data&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r},t.findBox=function(e,r){var i,a,n,o,s,l,u,d=[];if(e.data?(l=e.start,o=e.end,e=e.data):(l=0,o=e.byteLength),!r.length)return null;for(i=l;i1?i+a:o,n===r[0]&&(1===r.length?d.push({data:e,start:i+8,end:u}):(s=t.findBox({data:e,start:i+8,end:u},r.slice(1)),s.length&&(d=d.concat(s)))),i=u;return d},t.parseInitSegment=function(e){var r=[];return t.findBox(e,["moov","trak"]).forEach(function(e){var i=t.findBox(e,["tkhd"])[0];if(i){var a=i.data[i.start],n=0===a?12:20,o=t.readUint32(i,n),s=t.findBox(e,["mdia","mdhd"])[0];if(s){a=s.data[s.start],n=0===a?12:20;var l=t.readUint32(s,n),u=t.findBox(e,["mdia","hdlr"])[0];if(u){var d=t.bin2str(u.data.subarray(u.start+8,u.start+12)),h={soun:"audio",vide:"video"}[d];if(h){var c=t.findBox(e,["mdia","minf","stbl","stsd"]);if(c.length){c=c[0];var f=t.bin2str(c.data.subarray(c.start+12,c.start+16));w.b.log("MP4Demuxer:"+h+":"+f+" found")}r[o]={timescale:l,type:h},r[h]={timescale:l,id:o}}}}}}),r},t.getStartDTS=function(e,r){var i,a,n;return i=t.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return t.findBox(r,["tfhd"]).map(function(i){var a,n;return a=t.readUint32(i,4),n=e[a].timescale||9e4,t.findBox(r,["tfdt"]).map(function(e){var r,i;return r=e.data[e.start],i=t.readUint32(e,4),1===r&&(i*=Math.pow(2,32),i+=t.readUint32(e,8)),i})[0]/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0},t.offsetStartDTS=function(e,r,i){t.findBox(r,["moof","traf"]).map(function(r){return t.findBox(r,["tfhd"]).map(function(a){var n=t.readUint32(a,4),o=e[n].timescale||9e4;t.findBox(r,["tfdt"]).map(function(e){var r=e.data[e.start],a=t.readUint32(e,4);if(0===r)t.writeUint32(e,4,a-i*o);else{a*=Math.pow(2,32),a+=t.readUint32(e,8),a-=i*o,a=Math.max(a,0);var n=Math.floor(a/(O+1)),s=Math.floor(a%(O+1));t.writeUint32(e,4,n),t.writeUint32(e,8,s)}})})})},t.prototype.append=function(e,r,i,a){var n=this.initData;n||(this.resetInitSegment(e,this.audioCodec,this.videoCodec),n=this.initData);var o=void 0,s=this.initPTS;if(void 0===s){var l=t.getStartDTS(n,e);this.initPTS=s=l-r,this.observer.trigger(S.a.INIT_PTS_FOUND,{initPTS:s})}t.offsetStartDTS(n,e,s),o=t.getStartDTS(n,e),this.remuxer.remux(n.audio,n.video,null,null,o,i,a,e)},t.prototype.destroy=function(){},t}(),P=C,x={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],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(t,e,r,i,a){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength<=e.length){var o=9e4*n.samplesPerFrame/n.sampleRate,s=i+a*o,l={unit:e.subarray(r,r+n.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(l),t.len+=n.frameLength,{sample:l,length:n.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,a=t[e+2]>>4&15,n=t[e+2]>>2&3,o=t[e+2]>>1&1;if(1!==r&&0!==a&&15!==a&&3!==n){var s=3===r?3-i:3===i?3:4,l=1e3*x.BitratesMap[14*s+a-1],u=3===r?0:2===r?1:2,d=x.SamplingRateMap[3*u+n],h=t[e+3]>>6==3?1:2,c=x.SamplesCoefficients[r][i],f=x.BytesInSlot[i],p=8*c*f;return{sampleRate:d,channelCount:h,frameLength:parseInt(c*l/d+o,10)*f,samplesPerFrame:p}}},isHeaderPattern:function(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},t.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&w.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0&&this.bitsAvailable?r<>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},t.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},t.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},t.prototype.readBoolean=function(){return 1===this.readBits(1)},t.prototype.readUByte=function(){return this.readBits(8)},t.prototype.readUShort=function(){return this.readBits(16)},t.prototype.readUInt=function(){return this.readBits(32)},t.prototype.skipScalingList=function(t){var e,r,i=8,a=8;for(e=0;e=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},t.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,a=32;a<=t.length-16;a+=160,i+=16)r.set(t.subarray(a,a+16),i);return r},t.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(e.subarray(r,r+16),i);return t},t.prototype.decryptAvcSample=function(t,e,r,i,a,n){var o=this.discardEPB(a.data),s=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(s.buffer,function(s){a.data=l.getAvcDecryptedUnit(o,s),n||l.decryptAvcSamples(t,e,r+1,i)})},t.prototype.decryptAvcSamples=function(t,e,r,i){for(;;e++,r=0){if(e>=t.length)return void i();for(var a=t[e].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,i,n,o),!o)return}}}},t}(),B=U,G={video:0,audio:1,id3:2,text:3},j=function(){function t(e,r,i,a){y(this,t),this.observer=e,this.config=i,this.typeSupported=a,this.remuxer=r,this.sampleAes=null}return t.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new B(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},t.probe=function(e){var r=t._syncOffset(e);return!(r<0)&&(r&&w.b.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),!0)},t._syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),r=0;r>4>1){if((l=n+5+e[n+4])===n+188)continue}else l=n+4;switch(s){case v:o&&(E&&(u=D(E))&&I(u,!1),E={data:[],size:0}),E&&(E.data.push(e.subarray(l,n+188)),E.size+=n+188-l);break;case y:o&&(T&&(u=D(T))&&(p.isAAC?k(u):O(u)),T={data:[],size:0}),T&&(T.data.push(e.subarray(l,n+188)),T.size+=n+188-l);break;case m:o&&(R&&(u=D(R))&&C(u),R={data:[],size:0}),R&&(R.data.push(e.subarray(l,n+188)),R.size+=n+188-l);break;case 0:o&&(l+=e[l]+1),b=this._pmtId=A(e,l);break;case b:o&&(l+=e[l]+1);var x=_(e,l,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);v=x.avc,v>0&&(f.pid=v),y=x.audio,y>0&&(p.pid=y,p.isAAC=x.isAAC),m=x.id3,m>0&&(g.pid=m),h&&!c&&(w.b.log("reparse from beginning"),h=!1,n=P-188),c=this.pmtParsed=!0;break;case 17:case 8191:break;default:h=!0}}else this.observer.trigger(S.a.ERROR,{type:L.b.MEDIA_ERROR,details:L.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E&&(u=D(E))?(I(u,!0),f.pesData=null):f.pesData=E,T&&(u=D(T))?(p.isAAC?k(u):O(u),p.pesData=null):(T&&T.size&&w.b.log("last AAC PES packet truncated,might overlap between fragments"),p.pesData=T),R&&(u=D(R))?(C(u),g.pesData=null):g.pesData=R,null==this.sampleAes?this.remuxer.remux(p,f,g,this._txtTrack,r,i,a):this.decryptAndRemux(p,f,g,this._txtTrack,r,i,a)},t.prototype.decryptAndRemux=function(t,e,r,i,a,n,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,i,a,n,o)})}else this.decryptAndRemuxAvc(t,e,r,i,a,n,o)},t.prototype.decryptAndRemuxAvc=function(t,e,r,i,a,n,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,i,a,n,o)})}else this.remuxer.remux(t,e,r,i,a,n,o)},t.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},t.prototype._parsePMT=function(t,e,r,i){var a,n,o,s,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=(15&t[e+1])<<8|t[e+2],n=e+3+a-4,o=(15&t[e+10])<<8|t[e+11],e+=12+o;e1;){var h=new Uint8Array(d[0].length+d[1].length);h.set(d[0]),h.set(d[1],d[0].length),d[0]=h,d.splice(1,1)}if(e=d[0],1===(e[0]<<16)+(e[1]<<8)+e[2]){if((i=(e[4]<<8)+e[5])&&i>t.size-6)return null;r=e[7],192&r&&(o=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,o>4294967295&&(o-=8589934592),64&r?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,s>4294967295&&(s-=8589934592),o-s>54e5&&(w.b.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),a=e[8],l=a+9,t.size-=l,n=new Uint8Array(t.size);for(var c=0,f=d.length;cp){l-=p;continue}e=e.subarray(l),p-=l,l=0}n.set(e,u),u+=p}return i&&(i-=a+3),{data:n,pts:o,dts:s,len:i}}return null},t.prototype.pushAccesUnit=function(t,e){if(t.units.length&&t.frame){var r=e.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(i||this.contiguous)?(t.id=i,r.push(t)):e.dropped++}t.debug.length&&w.b.log(t.pts+"/"+t.dts+":"+t.debug)},t.prototype._parseAVCPES=function(t,e){var r,i,a,n=this,o=this._avcTrack,s=this._parseAVCNALu(t.data),l=this.avcSample,u=!1,d=this.pushAccesUnit.bind(this),h=function(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}};t.data=null,l&&s.length&&!o.audFound&&(d(l,o),l=this.avcSample=h(!1,t.pts,t.dts,"")),s.forEach(function(e){switch(e.type){case 1:i=!0,l||(l=n.avcSample=h(!0,t.pts,t.dts,"")),l.frame=!0;var s=e.data;if(u&&s.length>4){var c=new M(s).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(l.key=!0)}break;case 5:i=!0,l||(l=n.avcSample=h(!0,t.pts,t.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,r=new M(n.discardEPB(e.data)),r.readUByte();for(var f=0,p=0,g=!1,v=0;!g&&r.bytesAvailable>1;){f=0;do{v=r.readUByte(),f+=v}while(255===v);p=0;do{v=r.readUByte(),p+=v}while(255===v);if(4===f&&0!==r.bytesAvailable){g=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var y=r.readUByte(),m=r.readUByte(),b=31&y,E=[y,m];for(a=0;a0){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;i>=0;i--)if(e.pts=0)i={data:t.subarray(c,o-u-1),type:n},h.push(i);else{var f=this._getLastNalUnit();if(f&&(d&&o<=4-d&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-d)),(r=o-u-1)>0)){var p=new Uint8Array(f.data.byteLength+r);p.set(f.data,0),p.set(t.subarray(0,r),f.data.byteLength),f.data=p}}o=0&&u>=0&&(i={data:t.subarray(c,s),type:n,state:u},h.push(i)),0===h.length){var g=this._getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+t.byteLength);v.set(g.data,0),v.set(t,g.data.byteLength),g.data=v}}return l.naluState=u,h},t.prototype.discardEPB=function(t){for(var e,r,i=t.byteLength,a=[],n=1;n1&&(w.b.log("AAC: align PTS for overlapping frames by "+Math.round((m-h)/90)),h=m)}for(;i>24&255,e[1]=i>>16&255,e[2]=i>>8&255,e[3]=255&i,e.set(t,4),a=0,i=8;a>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))},t.moov=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(i))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(z+1)),a=Math.floor(r%(z+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,n)},t.sdtp=function(e){var r,i,a=e.samples||[],n=new Uint8Array(4+a.length);for(i=0;i>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r>>8&255),o.push(255&a),o=o.concat(Array.prototype.slice.call(i));var s=t.box(t.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(o))),l=e.width,u=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,a=e.width,n=e.height,o=Math.floor(i/(z+1)),s=Math.floor(i%(z+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),a=e.id,n=Math.floor(r/(z+1)),o=Math.floor(r%(z+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var i,a,n,o,s,l,u=e.samples||[],d=u.length,h=12+16*d,c=new Uint8Array(h);for(r+=8+h,c.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return t.box(t.types.trun,c)},t.initSegment=function(e){t.types||t.init();var r,i=t.moov(e);return r=new Uint8Array(t.FTYP.byteLength+i.byteLength),r.set(t.FTYP),r.set(i,t.FTYP.byteLength),r},t}(),q=X,Q=function(){function t(e,r,i,a){T(this,t),this.observer=e,this.config=r,this.typeSupported=i;var n=navigator.userAgent;this.isSafari=a&&a.indexOf("Apple")>-1&&n&&!n.match("CriOS"),this.ISGenerated=!1}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},t.prototype.resetInitSegment=function(){this.ISGenerated=!1},t.prototype.remux=function(t,e,r,i,a,n,o){if(this.ISGenerated||this.generateIS(t,e,a),this.ISGenerated){var s=t.samples.length,l=e.samples.length,u=a,d=a;if(s&&l){var h=(t.samples[0].dts-e.samples[0].dts)/e.inputTimeScale;u+=Math.max(0,h),d+=Math.max(0,-h)}if(s){t.timescale||(w.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,a));var c=this.remuxAudio(t,u,n,o);if(l){var f=void 0;c&&(f=c.endPTS-c.startPTS),e.timescale||(w.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,a)),this.remuxVideo(e,d,n,f,o)}}else{var p=void 0;l&&(p=this.remuxVideo(e,d,n,o)),p&&t.codec&&this.remuxEmptyAudio(t,u,n,p)}}r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(S.a.FRAG_PARSED)},t.prototype.generateIS=function(t,e,r){var i,a,n=this.observer,o=t.samples,s=e.samples,l=this.typeSupported,u="audio/mp4",d={},h={tracks:d},c=void 0===this._initPTS;if(c&&(i=a=1/0),t.config&&o.length&&(t.timescale=t.samplerate,w.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(l.mpeg?(u="audio/mpeg",t.codec=""):l.mp3&&(t.codec="mp3")),d.audio={container:u,codec:t.codec,initSegment:!t.isAAC&&l.mpeg?new Uint8Array:q.initSegment([t]),metadata:{channelCount:t.channelCount}},c&&(i=a=o[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&s.length){var f=e.inputTimeScale;e.timescale=f,d.video={container:"video/mp4",codec:e.codec,initSegment:q.initSegment([e]),metadata:{width:e.width,height:e.height}},c&&(i=Math.min(i,s[0].pts-f*r),a=Math.min(a,s[0].dts-f*r),this.observer.trigger(S.a.INIT_PTS_FOUND,{initPTS:i}))}Object.keys(d).length?(n.trigger(S.a.FRAG_PARSING_INIT_SEGMENT,h),this.ISGenerated=!0,c&&(this._initPTS=i,this._initDTS=a)):n.trigger(S.a.ERROR,{type:L.b.MEDIA_ERROR,details:L.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.prototype.remuxVideo=function(t,e,r,i,a){var n,o,s,l,u,d,h,c=8,f=t.timescale,p=t.samples,g=[],v=p.length,y=this._PTSNormalize,m=this._initDTS,b=this.nextAvcDts,E=this.isSafari;E&&(r|=p.length&&b&&(a&&Math.abs(e-b/f)<.1||Math.abs(p[0].pts-b-m)1?w.b.log("AVC:"+_+" ms hole between fragments detected,filling it"):_<-1&&w.b.log("AVC:"+-_+" ms overlapping between fragments detected"),u=b,p[0].dts=u,l=Math.max(l-_,b),p[0].pts=l,w.b.log("Video/PTS/DTS adjusted: "+Math.round(l/90)+"/"+Math.round(u/90)+",delta:"+_+" ms")),A=p[p.length-1],h=Math.max(A.dts,0),d=Math.max(A.pts,0,h),E&&(n=Math.round((h-u)/(p.length-1)));for(var D=0,I=0,k=0;k0?U-1:U].dts;if(X.stretchShortVideoTrack){var J=X.maxBufferHole,$=X.maxSeekHole,Z=Math.floor(Math.min(J,$)*f),tt=(i?l+i*f:this.nextAudioPts)-B.pts;tt>Z?(n=tt-Q,n<0&&(n=Q),w.b.log("It is approximately "+tt/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=Q}else n=Q}H=Math.round(B.pts-B.dts)}g.push({size:j,duration:n,cts:H,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:B.key?2:1,isNonSync:B.key?0:1}})}this.nextAvcDts=h+n;var et=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,g.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var rt=g[0].flags;rt.dependsOn=2,rt.isNonSync=0}t.samples=g,s=q.moof(t.sequenceNumber++,u,t),t.samples=[];var it={data1:s,data2:o,startPTS:l/f,endPTS:(d+n)/f,startDTS:u/f,endDTS:this.nextAvcDts/f,type:"video",nb:g.length,dropped:et};return this.observer.trigger(S.a.FRAG_PARSING_DATA,it),it},t.prototype.remuxAudio=function(t,e,r,i){var a,n,o,s,l,u,d,h=t.inputTimeScale,c=t.timescale,f=h/c,p=t.isAAC?1024:1152,g=p*f,v=this._PTSNormalize,y=this._initDTS,m=!t.isAAC&&this.typeSupported.mpeg,b=t.samples,E=[],T=this.nextAudioPts;if(r|=b.length&&T&&(i&&Math.abs(e-T/h)<.1||Math.abs(b[0].pts-T-y)<20*g),b.forEach(function(t){t.pts=t.dts=v(t.pts-y,e*h)}),b=b.filter(function(t){return t.pts>=0}),0!==b.length){if(r||(T=i?e*h:b[0].pts),t.isAAC)for(var R=this.config.maxAudioFramesDrift,A=0,_=T;A=R*g&&O<1e4&&_){var C=Math.round(D/g);w.b.warn("Injecting "+C+" audio frame @ "+(_/h).toFixed(3)+"s due to "+Math.round(1e3*D/h)+" ms gap.");for(var P=0;P0&&G<1e4)j=Math.round((B-T)/g),w.b.log(G+" ms hole between AAC samples detected,filling it"),j>0&&(o=Y.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),o||(o=U.subarray()),t.len+=j*o.length);else if(G<-12){w.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(T/h).toFixed(3)+"s/"+(B/h).toFixed(3)+"s/"+-G+"ms"),t.len-=U.byteLength;continue}B=T}if(u=B,!(t.len>0))return;var H=m?t.len:t.len+8;a=m?0:8;try{s=new Uint8Array(H)}catch(t){return void this.observer.trigger(S.a.ERROR,{type:L.b.MUX_ERROR,details:L.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating audio mdat "+H})}if(!m){new DataView(s.buffer).setUint32(0,H),s.set(q.types.mdat,4)}for(var K=0;K=2&&(V=E[z-2].duration,n.duration=V),z){this.nextAudioPts=T=d+f*V,t.len=0,t.samples=E,l=m?new Uint8Array:q.moof(t.sequenceNumber++,u/f,t),t.samples=[];var X=u/h,Q=T/h,J={data1:l,data2:s,startPTS:X,endPTS:Q,startDTS:X,endDTS:Q,type:"audio",nb:z};return this.observer.trigger(S.a.FRAG_PARSING_DATA,J),J}return null}},t.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,n=t.samplerate?t.samplerate:a,o=a/n,s=this.nextAudioPts,l=(void 0!==s?s:i.startDTS*a)+this._initDTS,u=i.endDTS*a+this._initDTS,d=1024*o,h=Math.ceil((u-l)/d),c=Y.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(w.b.warn("remux empty Audio"),!c)return void w.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var f=[],p=0;p4294967296;)t+=r;return t},t}(),J=Q,$=function(){function t(e){R(this,t),this.observer=e}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(){},t.prototype.resetInitSegment=function(){},t.prototype.remux=function(t,e,r,i,a,n,o,s){var l=this.observer,u="";t&&(u+="audio"),e&&(u+="video"),l.trigger(S.a.FRAG_PARSING_DATA,{data1:s,startPTS:a,startDTS:a,type:u,nb:1,dropped:0}),l.trigger(S.a.FRAG_PARSED)},t}(),Z=$,tt=function(){function t(e,r,i,a){A(this,t),this.observer=e,this.typeSupported=r,this.config=i,this.vendor=a}return t.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},t.prototype.push=function(t,e,r,i,a,n,o,s,l,u,d,h){if(t.byteLength>0&&null!=e&&null!=e.key&&"AES-128"===e.method){var c=this.decrypter;null==c&&(c=this.decrypter=new _.a(this.observer,this.config));var f,p=this;try{f=performance.now()}catch(t){f=Date.now()}c.decrypt(t,e.key.buffer,e.iv.buffer,function(t){var c;try{c=performance.now()}catch(t){c=Date.now()}p.observer.trigger(S.a.FRAG_DECRYPTED,{stats:{tstart:f,tdecrypt:c}}),p.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)})}else this.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)},t.prototype.pushDecrypted=function(t,e,r,i,a,n,o,s,l,u,d,h){var c=this.demuxer;if(!c||o&&!this.probe(t)){for(var f=this.observer,p=this.typeSupported,g=this.config,v=[{demux:H,remux:J},{demux:P,remux:Z},{demux:k,remux:J},{demux:W,remux:J}],y=0,m=v.length;ye?i.start+i.duration:Math.max(i.start-a.duration,0):r>e?(i.duration=n-i.start,i.duration<0&&Pt.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-n,a.duration<0&&Pt.b.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}function E(t,e,r,i,a,n){var o=r;if(!isNaN(e.startPTS)){var s=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=s:e.deltaPTS=Math.max(s,e.deltaPTS),o=Math.max(r,e.startPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),n=Math.max(n,e.endDTS)}var l=r-e.start;e.start=e.startPTS=r,e.maxStartPTS=o,e.endPTS=i,e.startDTS=a,e.endDTS=n,e.duration=i-r;var u=e.sn;if(!t||ut.endSN)return 0;var d,h,c;for(d=u-t.startSN,h=t.fragments,h[d]=e,c=d;c>0;c--)b(h,c,c-1);for(c=d;c=0&&ne?-1:0})}function S(t,e,r){var i=!1;return e&&e.details&&r&&(r.endCC>r.startCC||t&&t.cc59?e(r[1],r[2],0,r[4]):e(0,r[1],r[2],r[4]):null}function st(){this.values=Object.create(null)}function lt(t,e,r,i){var a=i?t.split(i):[t];for(var n in a)if("string"==typeof a[n]){var o=a[n].split(r);if(2===o.length){var s=o[0],l=o[1];e(s,l)}}}function ut(t,e,r){function i(){var e=ot(t);if(null===e)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function a(){t=t.replace(/^\s+/,"")}var n=t;if(a(),e.startTime=i(),a(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.substr(3),a(),e.endTime=i(),a(),function(t,e){var i=new st;lt(t,function(t,e){switch(t){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===e){i.set(t,r[a].region);break}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":var n=e.split(","),o=n[0];i.integer(t,o),i.percent(t,o)&&i.set("snapToLines",!1),i.alt(t,o,["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",Je,"end"]);break;case"position":n=e.split(","),i.percent(t,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",Je,"end","line-left","line-right","auto"]);break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",Je,"end","left","right"])}},/:/,/\s/),e.region=i.get("region",null),e.vertical=i.get("vertical","");var a=i.get("line","auto");"auto"===a&&-1===Qe.line&&(a=-1),e.line=a,e.lineAlign=i.get("lineAlign","start"),e.snapToLines=i.get("snapToLines",!0),e.size=i.get("size",100),e.align=i.get("align",Je);var n=i.get("position","auto");"auto"===n&&50===Qe.position&&(n="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=n}(t,e)}function dt(t){return t.replace(//gi,"\n")}function ht(t,e,r,i){for(var a,n,o,s,l,u=window.VTTCue||window.TextTrackCue,d=0;d=16?s--:s++,navigator.userAgent.match(/Firefox\//)?n.line=d+1:n.line=d>7?d-2:d+1,n.align="left",n.position=Math.max(0,Math.min(100,s/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),t.addCue(n)}}function ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gt(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function vt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function yt(t){if(t&&t.cues)for(;t.cues.length>0;)t.removeCue(t.cues[0])}function mt(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}function bt(t,e,r,i){return Math.min(e,i)-Math.max(t,r)}function Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tt(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Rt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function At(t){for(var e=[],r=0;r1?r-1:0),n=1;nNumber.MAX_SAFE_INTEGER?1/0:e},t.prototype.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var r=new Uint8Array(e.length/2),i=0;iNumber.MAX_SAFE_INTEGER?1/0:e},t.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},t.prototype.enumeratedString=function(t){return this[t]},t.prototype.decimalResolution=function(t){var e=Mt.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,r={};for(Ut.lastIndex=0;null!==(e=Ut.exec(t));){var i=e[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[e[1]]=i}return r},t}(),Gt=Bt,jt={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}},Ht=function(){function t(t,e){for(var r=0;r>8*(15-r)&255;return e},t.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&(r=new Yt,r.method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},t.prototype.cloneObj=function(t){return JSON.parse(JSON.stringify(t))},Ht(t,[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=kt.a.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(t){this._url=t}},{key:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=new Date(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{key:"byteRange",get:function(){if(!this._byteRange){var t=this._byteRange=[];if(this.rawByteRange){var e=this.rawByteRange.split("@",2);if(1===e.length){var r=this.lastByteRangeEndOffset;t[0]=r||0}else t[0]=parseInt(e[1]);t[1]=parseInt(e[0])+t[0]}}return this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}}]),t}(),Xt=function(t){function e(r){u(this,e);var i=s(this,t.call(this,r,Ot.a.MANIFEST_LOADING,Ot.a.LEVEL_LOADING,Ot.a.AUDIO_TRACK_LOADING,Ot.a.SUBTITLE_TRACK_LOADING));return i.loaders={},i}return l(e,t),e.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},Nt.prototype.destroy.call(this)},e.prototype.onManifestLoading=function(t){this.load(t.url,{type:"manifest"})},e.prototype.onLevelLoading=function(t){this.load(t.url,{type:"level",level:t.level,id:t.id})},e.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:"audioTrack",id:t.id})},e.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:"subtitleTrack",id:t.id})},e.prototype.load=function(t,e){var r=this.loaders[e.type];if(void 0!==r){var i=r.context;if(i&&i.url===t)return void Pt.b.trace("playlist request ongoing");Pt.b.warn("abort previous loader for type:"+e.type),r.abort()}var a=this.hls.config,n=void 0,o=void 0,s=void 0,l=void 0;"manifest"===e.type?(n=a.manifestLoadingMaxRetry,o=a.manifestLoadingTimeOut,s=a.manifestLoadingRetryDelay,l=a.manifestLoadingMaxRetryTimeout):"level"===e.type?(n=0,o=a.levelLoadingTimeOut):(n=a.levelLoadingMaxRetry,o=a.levelLoadingTimeOut,s=a.levelLoadingRetryDelay,l=a.levelLoadingMaxRetryTimeout,Pt.b.log("loading playlist for "+e.type+" "+(e.level||e.id))),r=this.loaders[e.type]=e.loader=void 0!==a.pLoader?new a.pLoader(a):new a.loader(a),e.url=t,e.responseType="";var u=void 0,d=void 0;u={timeout:o,maxRetry:n,retryDelay:s,maxRetryDelay:l},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},r.load(e,u,d)},e.prototype.resolve=function(t,e){return kt.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},e.prototype.parseMasterPlaylist=function(t,e){var r=[],i=void 0;for(Kt.lastIndex=0;null!=(i=Kt.exec(t));){var a={},o=a.attrs=new Gt(i[1]);a.url=this.resolve(i[2],e);var s=o.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),a.name=o.NAME,function(t,e){["video","audio"].forEach(function(r){var i=t.filter(function(t){return n(t,r)});if(i.length){var a=i.filter(function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)});e[r+"Codec"]=a.length>0?a[0]:i[0],t=t.filter(function(t){return-1===i.indexOf(t)})}}),e.unknownCodecs=t}([].concat((o.CODECS||"").split(/[ ,]+/)),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=this.avc1toavcoti(a.videoCodec)),r.push(a)}return r},e.prototype.parseMasterPlaylistMedia=function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=void 0,n=[],o=0;for(Wt.lastIndex=0;null!==(a=Wt.exec(t));){var s={},l=new Gt(a[1]);if(l.TYPE===r){if(s.groupId=l["GROUP-ID"],s.name=l.NAME,s.type=r,s.default="YES"===l.DEFAULT,s.autoselect="YES"===l.AUTOSELECT,s.forced="YES"===l.FORCED,l.URI&&(s.url=this.resolve(l.URI,e)),s.lang=l.LANGUAGE,s.name||(s.name=s.lang),i.length){var u=d(i,s.groupId);s.audioCodec=u?u.codec:i[0].codec}s.id=o++,n.push(s)}}return n},e.prototype.avc1toavcoti=function(t){var e,r=t.split(".");return r.length>2?(e=r.shift()+".",e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},e.prototype.parseLevelPlaylist=function(t,e,r,i){var a,n,o=0,s=0,l={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},u=new Yt,d=0,h=null,c=new zt;for(Vt.lastIndex=0;null!==(a=Vt.exec(t));){var f=a[1];if(f){c.duration=parseFloat(f);var p=(" "+a[2]).slice(1);c.title=p||null,c.tagList.push(p?["INF",f,p]:["INF",f])}else if(a[3]){if(!isNaN(c.duration)){var g=o++;c.type=i,c.start=s,c.levelkey=u,c.sn=g,c.level=r,c.cc=d,c.baseurl=e,c.relurl=(" "+a[3]).slice(1),l.fragments.push(c),h=c,s+=c.duration,c=new zt}}else if(a[4]){if(c.rawByteRange=(" "+a[4]).slice(1),h){var v=h.byteRangeEndOffset;v&&(c.lastByteRangeEndOffset=v)}}else if(a[5])c.rawProgramDateTime=(" "+a[5]).slice(1),c.tagList.push(["PROGRAM-DATE-TIME",c.rawProgramDateTime]),void 0===l.programDateTime&&(l.programDateTime=new Date(new Date(Date.parse(a[5]))-1e3*s));else{for(a=a[0].match(/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/),n=1;n=0&&(u.method=T,u.baseuri=e,u.reluri=R,u.key=null,u.iv=A));break;case"START":var S=y,L=new Gt(S),_=L.decimalFloatingPoint("TIME-OFFSET");isNaN(_)||(l.startTimeOffset=_);break;case"MAP":var w=new Gt(y);c.relurl=w.URI,c.rawByteRange=w.BYTERANGE,c.baseurl=e,c.level=r,c.type=i,c.sn="initSegment",l.initSegment=c,c=new zt;break;default:Pt.b.warn("line parsed but not handled: "+a)}}}return c=h,c&&!c.relurl&&(l.fragments.pop(),s-=c.duration),l.totalduration=s,l.averagetargetduration=s/l.fragments.length,l.endSN=o-1,l.startCC=l.fragments[0]?l.fragments[0].cc:0,l.endCC=d,l},e.prototype.loadsuccess=function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=t.data,n=t.url,o=r.type,s=r.id,l=r.level,u=this.hls;if(this.loaders[o]=void 0,void 0!==n&&0!==n.indexOf("data:")||(n=r.url),e.tload=performance.now(),0===a.indexOf("#EXTM3U"))if(a.indexOf("#EXTINF:")>0){var d="audioTrack"!==o&&"subtitleTrack"!==o,h=isNaN(l)?isNaN(s)?0:s:l,c=this.parseLevelPlaylist(a,n,h,"audioTrack"===o?"audio":"subtitleTrack"===o?"subtitle":"main");c.tload=e.tload,"manifest"===o&&u.trigger(Ot.a.MANIFEST_LOADED,{levels:[{url:n,details:c}],audioTracks:[],url:n,stats:e,networkDetails:i}),e.tparsed=performance.now(),c.targetduration?d?u.trigger(Ot.a.LEVEL_LOADED,{details:c,level:l||0,id:s||0,stats:e,networkDetails:i}):"audioTrack"===o?u.trigger(Ot.a.AUDIO_TRACK_LOADED,{details:c,id:s,stats:e,networkDetails:i}):"subtitleTrack"===o&&u.trigger(Ot.a.SUBTITLE_TRACK_LOADED,{details:c,id:s,stats:e,networkDetails:i}):u.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.MANIFEST_PARSING_ERROR,fatal:!0,url:n,reason:"invalid targetduration",networkDetails:i})}else{var f=this.parseMasterPlaylist(a,n);if(f.length){var p=f.map(function(t){return{id:t.attrs.AUDIO,codec:t.audioCodec}}),g=this.parseMasterPlaylistMedia(a,n,"AUDIO",p),v=this.parseMasterPlaylistMedia(a,n,"SUBTITLES");if(g.length){var y=!1;g.forEach(function(t){t.url||(y=!0)}),!1===y&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(Pt.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main"}))}u.trigger(Ot.a.MANIFEST_LOADED,{levels:f,audioTracks:g,subtitles:v,url:n,stats:e,networkDetails:i})}else u.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.MANIFEST_PARSING_ERROR,fatal:!0,url:n,reason:"no level found in manifest",networkDetails:i})}else u.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.MANIFEST_PARSING_ERROR,fatal:!0,url:n,reason:"no EXTM3U delimiter",networkDetails:i})},e.prototype.loaderror=function(t,e){var r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e.loader;switch(e.type){case"manifest":r=Ct.a.MANIFEST_LOAD_ERROR,i=!0;break;case"level":r=Ct.a.LEVEL_LOAD_ERROR,i=!1;break;case"audioTrack":r=Ct.a.AUDIO_TRACK_LOAD_ERROR,i=!1}n&&(n.abort(),this.loaders[e.type]=void 0),this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:r,fatal:i,url:n.url,loader:n,response:t,context:e,networkDetails:a})},e.prototype.loadtimeout=function(t,e){var r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e.loader;switch(e.type){case"manifest":r=Ct.a.MANIFEST_LOAD_TIMEOUT,i=!0;break;case"level":r=Ct.a.LEVEL_LOAD_TIMEOUT,i=!1;break;case"audioTrack":r=Ct.a.AUDIO_TRACK_LOAD_TIMEOUT,i=!1}n&&(n.abort(),this.loaders[e.type]=void 0),this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:r,fatal:i,url:n.url,loader:n,context:e,networkDetails:a})},e}(Nt),qt=Xt,Qt=function(t){function e(r){h(this,e);var i=c(this,t.call(this,r,Ot.a.FRAG_LOADING));return i.loaders={},i}return f(e,t),e.prototype.destroy=function(){var t=this.loaders;for(var e in t){var r=t[e];r&&r.destroy()}this.loaders={},Nt.prototype.destroy.call(this)},e.prototype.onFragLoading=function(t){var e=t.frag,r=e.type,i=this.loaders[r],a=this.hls.config;e.loaded=0,i&&(Pt.b.warn("abort previous fragment loader for type:"+r),i.abort()),i=this.loaders[r]=e.loader=void 0!==a.fLoader?new a.fLoader(a):new a.loader(a);var n=void 0,o=void 0,s=void 0;n={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var l=e.byteRangeStartOffset,u=e.byteRangeEndOffset;isNaN(l)||isNaN(u)||(n.rangeStart=l,n.rangeEnd=u),o={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},s={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},i.load(n,o,s)},e.prototype.loadsuccess=function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=t.data,n=r.frag;n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(Ot.a.FRAG_LOADED,{payload:a,frag:n,stats:e,networkDetails:i})},e.prototype.loaderror=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},e.prototype.loadtimeout=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},e.prototype.loadprogress=function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=e.frag;a.loaded=t.loaded,this.hls.trigger(Ot.a.FRAG_LOAD_PROGRESS,{frag:a,stats:t,networkDetails:i})},e}(Nt),Jt=Qt,$t=function(t){function e(r){p(this,e);var i=g(this,t.call(this,r,Ot.a.KEY_LOADING));return i.loaders={},i.decryptkey=null,i.decrypturl=null,i}return v(e,t),e.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},Nt.prototype.destroy.call(this)},e.prototype.onKeyLoading=function(t){var e=t.frag,r=e.type,i=this.loaders[r],a=e.decryptdata,n=a.uri;if(n!==this.decrypturl||null===this.decryptkey){var o=this.hls.config;i&&(Pt.b.warn("abort previous key loader for type:"+r),i.abort()),e.loader=this.loaders[r]=new o.loader(o),this.decrypturl=n,this.decryptkey=null;var s=void 0,l=void 0,u=void 0;s={url:n,frag:e,responseType:"arraybuffer"},l={timeout:o.fragLoadingTimeOut,maxRetry:o.fragLoadingMaxRetry,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},e.loader.load(s,l,u)}else this.decryptkey&&(a.key=this.decryptkey,this.hls.trigger(Ot.a.KEY_LOADED,{frag:e}))},e.prototype.loadsuccess=function(t,e,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(Ot.a.KEY_LOADED,{frag:i})},e.prototype.loaderror=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},e.prototype.loadtimeout=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(Ot.a.ERROR,{type:Ct.b.NETWORK_ERROR,details:Ct.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e}(Nt),Zt=$t,te={search:function(t,e){for(var r=0,i=t.length-1,a=null,n=null;r<=i;){a=(r+i)/2|0,n=t[a];var o=e(n);if(o>0)r=a+1;else{if(!(o<0))return n;i=a-1}}return null}},ee=te,re={isBuffered:function(t,e){try{if(t)for(var r=t.buffered,i=0;i=r.start(i)&&e<=r.end(i))return!0}catch(t){}return!1},bufferInfo:function(t,e,r){try{if(t){var i,a=t.buffered,n=[];for(i=0;id&&(l[u-1].end=t[s].end):l.push(t[s])}else l.push(t[s])}for(s=0,i=0,a=n=e;s=h&&e1?e-1:0),a=1;a1?e-1:0),a=1;a0&&-1===t&&(Pt.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=ge.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this.forceStartLoad=!0,this.state=ge.STOPPED},e.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=ge.STOPPED,this.forceStartLoad=!1},e.prototype.tick=function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)},e.prototype.doTick=function(){switch(this.state){case ge.ERROR:break;case ge.BUFFER_FLUSHING:this.fragLoadError=0;break;case ge.IDLE:this._doTickIdle();break;case ge.WAITING_LEVEL:var t=this.levels[this.level];t&&t.details&&(this.state=ge.IDLE);break;case ge.FRAG_LOADING_WAITING_RETRY:var e=performance.now(),r=this.retryDate;(!r||e>=r||this.media&&this.media.seeking)&&(Pt.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=ge.IDLE);break;case ge.ERROR:case ge.STOPPED:case ge.FRAG_LOADING:case ge.PARSING:case ge.PARSED:case ge.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},e.prototype._doTickIdle=function(){var t=this.hls,e=t.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&e.startFragPrefetch)){var i=void 0;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=t.nextLoadLevel,n=this.levels[a];if(n){var o=n.bitrate,s=void 0;s=o?Math.max(8*e.maxBufferSize/o,e.maxBufferLength):e.maxBufferLength,s=Math.min(s,e.maxMaxBufferLength);var l=ie.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,e.maxBufferHole),u=l.len;if(!(u>=s)){Pt.b.trace("buffer length of "+u.toFixed(3)+" is below max of "+s.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=a;var d=n.details;if(void 0===d||!0===d.live&&this.levelLastLoaded!==a)return void(this.state=ge.WAITING_LEVEL);var h=this.fragPrevious;if(!d.live&&h&&!h.backtracked&&h.sn===d.endSN&&!l.nextStart){if(Math.min(r.duration,h.start+h.duration)-Math.max(l.end,h.start)<=Math.max(.2,h.duration)){var c={};return this.altAudio&&(c.type="video"),this.hls.trigger(Ot.a.BUFFER_EOS,c),void(this.state=ge.ENDED)}}this._fetchPayloadOrEos(i,l,d)}}}},e.prototype._fetchPayloadOrEos=function(t,e,r){var i=this.fragPrevious,a=this.level,n=r.fragments,o=n.length;if(0!==o){var s=n[0].start,l=n[o-1].start+n[o-1].duration,u=e.end,d=void 0;if(r.initSegment&&!r.initSegment.data)d=r.initSegment;else if(r.live){var h=this.config.initialLiveManifestSize;if(oh&&(l.currentTime=h),this.nextLoadPosition=h}if(t.PTSKnown&&e>i&&l&&l.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(a){var c=a.sn+1;if(c>=t.startSN&&c<=t.endSN){var f=n[c-t.startSN];a.cc===f.cc&&(u=f,Pt.b.log("live playlist, switching playlist, load frag with next SN: "+u.sn))}u||(u=ee.search(n,function(t){return a.cc-t.cc}))&&Pt.b.log("live playlist, switching playlist, load frag with same CC: "+u.sn)}u||(u=n[Math.min(o-1,Math.round(o/2))],Pt.b.log("live playlist, switching playlist, unknown, load middle frag : "+u.sn))}return u},e.prototype._findFragment=function(t,e,r,i,a,n,o){var s=this.hls.config,l=void 0,u=void 0,d=s.maxFragLookUpTolerance,h=e?i[e.sn-i[0].sn+1]:void 0,c=function(t){var e=Math.min(d,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-e<=a?1:t.start-e>a&&t.start?-1:0};if(an-d&&(d=0),u=h&&!c(h)?h:ee.search(i,c)):u=i[r-1],u){l=u;var f=l.sn-o.startSN,p=e&&l.level===e.level,g=i[f-1],v=i[f+1];if(e&&l.sn===e.sn)if(p&&!l.backtracked)if(l.sns.maxBufferHole&&e.dropped&&f?(l=g,Pt.b.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),e.loadCounter--):(l=v,Pt.b.log("SN just loaded, load next one: "+l.sn))}else l=null;else l.backtracked&&(v&&v.backtracked?(Pt.b.warn("Already backtracked from fragment "+v.sn+", will not backtrack to fragment "+l.sn+". Loading fragment "+v.sn),l=v):(Pt.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),l.dropped=0,g?(g.loadCounter&&g.loadCounter--,l=g,l.backtracked=!0):f&&(l=null)))}return l},e.prototype._loadFragmentOrKey=function(t,e,r,i,a){var n=this.hls,o=n.config;if(!t.decryptdata||null==t.decryptdata.uri||null!=t.decryptdata.key){if(Pt.b.log("Loading "+t.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+e+", currentTime:"+i.toFixed(3)+",bufferEnd:"+a.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,t.loadCounter){t.loadCounter++;var s=o.fragLoadingLoopThreshold;if(t.loadCounter>s&&Math.abs(this.fragLoadIdx-t.loadIdx)e.endPTS?1:0})},e.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},e.prototype._checkFragmentChanged=function(){var t,e,r=this.media;if(r&&r.readyState&&!1===r.seeking&&(e=r.currentTime,e>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),ie.isBuffered(r,e)?t=this.getBufferedFrag(e):ie.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)){var i=t;if(i!==this.fragPlaying){this.hls.trigger(Ot.a.FRAG_CHANGED,{frag:i});var a=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(Ot.a.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}},e.prototype.immediateLevelSwitch=function(){if(Pt.b.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var t=this.media,e=void 0;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},e.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,ie.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},e.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var e=void 0,r=void 0,i=void 0;if(void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),r=this.getBufferedFrag(t.currentTime),r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),t.paused)e=0;else{var a=this.hls.nextLoadLevel,n=this.levels[a],o=this.fragLastKbps;e=o&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*o)+1:0}if((i=this.getBufferedFrag(t.currentTime+e))&&(i=this.followingBufferedFrag(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.maxStartPTS,Number.POSITIVE_INFINITY)}}},e.prototype.flushMainBuffer=function(t,e){this.state=ge.BUFFER_FLUSHING;var r={startOffset:t,endOffset:e};this.altAudio&&(r.type="video"),this.hls.trigger(Ot.a.BUFFER_FLUSHING,r)},e.prototype.onMediaAttached=function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)},e.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(Pt.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.levels;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0,t.backtracked=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("seeked",this.onvseeked),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},e.prototype.onMediaSeeking=function(){var t=this.media,e=t?t.currentTime:void 0,r=this.config;isNaN(e)||Pt.b.log("media seeking to "+e.toFixed(3));var i=this.mediaBuffer?this.mediaBuffer:t,a=ie.bufferInfo(i,e,this.config.maxBufferHole);if(this.state===ge.FRAG_LOADING){var n=this.fragCurrent;if(0===a.len&&n){var o=r.maxFragLookUpTolerance,s=n.start-o,l=n.start+n.duration+o;el?(n.loader&&(Pt.b.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=ge.IDLE):Pt.b.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===ge.ENDED&&(0===a.len&&(this.fragPrevious=0),this.state=ge.IDLE);t&&(this.lastCurrentTime=e),this.state!==ge.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=e),this.tick()},e.prototype.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:void 0;isNaN(e)||Pt.b.log("media seeked to "+e.toFixed(3)),this.tick()},e.prototype.onMediaEnded=function(){Pt.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestLoading=function(){Pt.b.log("trigger BUFFER_RESET"),this.hls.trigger(Ot.a.BUFFER_RESET),this._bufferedFrags=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestParsed=function(t){var e,r=!1,i=!1;t.levels.forEach(function(t){(e=t.audioCodec)&&(-1!==e.indexOf("mp4a.40.2")&&(r=!0),-1!==e.indexOf("mp4a.40.5")&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&Pt.b.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1;var a=this.config;(a.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(a.startPosition)},e.prototype.onLevelLoaded=function(t){var e=t.details,r=t.level,i=this.levels[this.levelLastLoaded],a=this.levels[r],n=e.totalduration,o=0;if(Pt.b.log("level "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+n),e.live){var s=a.details;s&&e.fragments.length>0?(T(s,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),e.PTSKnown&&!isNaN(o)?Pt.b.log("live playlist sliding:"+o.toFixed(3)):(Pt.b.log("live playlist - outdated PTS, unknown sliding"),w(this.fragPrevious,i,e))):(Pt.b.log("live playlist - first load, unknown sliding"),e.PTSKnown=!1,w(this.fragPrevious,i,e))}else e.PTSKnown=!1;if(a.details=e,this.levelLastLoaded=r,this.hls.trigger(Ot.a.LEVEL_UPDATED,{details:e,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var l=e.startTimeOffset;isNaN(l)?e.live?(this.startPosition=this.computeLivePosition(o,e),Pt.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(l<0&&(Pt.b.log("negative start time offset "+l+", count from end of last fragment"),l=o+n+l),Pt.b.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l),this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===ge.WAITING_LEVEL&&(this.state=ge.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===ge.KEY_LOADING&&(this.state=ge.IDLE,this.tick())},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===ge.FRAG_LOADING&&e&&"main"===r.type&&r.level===e.level&&r.sn===e.sn){var i=t.stats,a=this.levels[e.level],n=a.details;if(Pt.b.log("Loaded "+e.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+e.level),this.bitrateTest=!1,this.stats=i,!0===r.bitrateTest&&this.hls.nextLoadLevel)this.state=ge.IDLE,this.startFragRequested=!1,i.tparsed=i.tbuffered=performance.now(),this.hls.trigger(Ot.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else if("initSegment"===r.sn)this.state=ge.IDLE,i.tparsed=i.tbuffered=performance.now(),n.initSegment.data=t.payload,this.hls.trigger(Ot.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else{this.state=ge.PARSING;var o=n.totalduration,s=e.level,l=e.sn,u=this.config.defaultAudioCodec||a.audioCodec;this.audioCodecSwap&&(Pt.b.log("swapping playlist audio codec"),void 0===u&&(u=this.lastAudioCodec),u&&(u=-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,Pt.b.log("Parsing "+l+" of ["+n.startSN+" ,"+n.endSN+"],level "+s+", cc "+e.cc);var d=this.demuxer;d||(d=this.demuxer=new he(this.hls,"main"));var h=this.media,c=h&&h.seeking,f=!c&&(n.PTSKnown||!n.live),p=n.initSegment?n.initSegment.data:[];d.push(t.payload,p,u,a.videoCodec,e,o,f,void 0)}}this.fragLoadError=0},e.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===ge.PARSING){var i,a,n=t.tracks;if(n.audio&&this.altAudio&&delete n.audio,a=n.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(Pt.b.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==a.container&&(o="mp4a.40.2",Pt.b.log("Android: force audio codec to "+o)),a.levelCodec=o,a.id=t.id}a=n.video,a&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=t.id),this.hls.trigger(Ot.a.BUFFER_CODECS,n);for(i in n){a=n[i],Pt.b.log("main track:"+i+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var l=a.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(Ot.a.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}},e.prototype.onFragParsingData=function(t){var e=this,r=this.fragCurrent,i=t.frag;if(r&&"main"===t.id&&i.sn===r.sn&&i.level===r.level&&("audio"!==t.type||!this.altAudio)&&this.state===ge.PARSING){var a=this.levels[this.level],n=r;if(isNaN(t.endPTS)&&(t.endPTS=t.startPTS+r.duration,t.endDTS=t.startDTS+r.duration),Pt.b.log("Parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb+",dropped:"+(t.dropped||0)),"video"===t.type)if(n.dropped=t.dropped,n.dropped)if(n.backtracked)Pt.b.warn("Already backtracked on this fragment, appending with the gap");else{var o=a.details;if(!o||n.sn!==o.startSN)return Pt.b.warn("missing video frame(s), backtracking fragment"),n.backtracked=!0,this.nextLoadPosition=t.startPTS,this.state=ge.IDLE,this.fragPrevious=n,void this.tick();Pt.b.warn("missing video frame(s) on first frag, appending with gap")}else n.backtracked=!1;var s=E(a.details,n,t.startPTS,t.endPTS,t.startDTS,t.endDTS),l=this.hls;l.trigger(Ot.a.LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:s,type:t.type,start:t.startPTS,end:t.endPTS}),[t.data1,t.data2].forEach(function(r){r&&r.length&&e.state===ge.PARSING&&(e.appended=!0,e.pendingBuffering=!0,l.trigger(Ot.a.BUFFER_APPENDING,{type:t.type,data:r,parent:"main",content:"data"}))}),this.tick()}},e.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===ge.PARSING&&(this.stats.tparsed=performance.now(),this.state=ge.PARSED,this._checkAppendedParsed())},e.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,r=t.id;if(!e){if(this.mediaBuffer!==this.media){Pt.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(Pt.b.log("switching to main audio track, cancel main fragment load"),i.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=ge.IDLE}var a=this.hls;a.trigger(Ot.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),a.trigger(Ot.a.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},e.prototype.onAudioTrackSwitched=function(t){var e=t.id,r=!!this.hls.audioTracks[e].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(Pt.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},e.prototype.onBufferCreated=function(t){var e=t.tracks,r=void 0,i=void 0,a=!1;for(var n in e){var o=e[n];"main"===o.id?(i=n,r=o,"video"===n&&(this.videoBuffer=e[n].buffer)):a=!0}a&&r?(Pt.b.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.prototype.onBufferAppended=function(t){if("main"===t.parent){var e=this.state;e!==ge.PARSING&&e!==ge.PARSED||(this.pendingBuffering=t.pending>0,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==ge.PARSED||this.appended&&this.pendingBuffering)){var t=this.fragCurrent;if(t){var e=this.mediaBuffer?this.mediaBuffer:this.media;Pt.b.log("main buffered : "+fe.toString(e.buffered));var r=this._bufferedFrags.filter(function(t){return ie.isBuffered(e,(t.startPTS+t.endPTS)/2)});r.push(t),this._bufferedFrags=r.sort(function(t,e){return t.startPTS-e.startPTS}),this.fragPrevious=t;var i=this.stats;i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.total/(i.tbuffered-i.tfirst)),this.hls.trigger(Ot.a.FRAG_BUFFERED,{stats:i,frag:t,id:"main"}),this.state=ge.IDLE}this.tick()}},e.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r=!!this.media&&ie.isBuffered(this.media,this.media.currentTime)&&ie.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case Ct.a.FRAG_LOAD_ERROR:case Ct.a.FRAG_LOAD_TIMEOUT:case Ct.a.KEY_LOAD_ERROR:case Ct.a.KEY_LOAD_TIMEOUT:if(!t.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);e.loadCounter=0,Pt.b.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=ge.FRAG_LOADING_WAITING_RETRY}else Pt.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=ge.ERROR;break;case Ct.a.FRAG_LOOP_LOADING_ERROR:t.fatal||(r?(this._reduceMaxBufferLength(e.duration),this.state=ge.IDLE):e.autoLevel&&0!==e.level||(t.fatal=!0,this.state=ge.ERROR));break;case Ct.a.LEVEL_LOAD_ERROR:case Ct.a.LEVEL_LOAD_TIMEOUT:this.state!==ge.ERROR&&(t.fatal?(this.state=ge.ERROR,Pt.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==ge.WAITING_LEVEL||(this.state=ge.IDLE));break;case Ct.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==ge.PARSING&&this.state!==ge.PARSED||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=ge.IDLE):(Pt.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},e.prototype._reduceMaxBufferLength=function(t){var e=this.config;e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,Pt.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*e.fragLoadingLoopThreshold))},e.prototype._checkBuffer=function(){var t=this.media,e=this.config;if(t&&t.readyState){var r=t.currentTime,i=this.mediaBuffer?this.mediaBuffer:t,a=i.buffered;if(!this.loadedmetadata&&a.length){this.loadedmetadata=!0;var n=t.seeking?r:this.startPosition,o=ie.isBuffered(i,n),s=a.start(0),l=!o&&Math.abs(n-s)1e3*e.lowBufferWatchdogPeriod){this.stallReported||(this.stallReported=!0,Pt.b.warn("playback stalling in low buffer @"+r),f.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}));var y=u.nextStart,m=y-r;if(y&&m0){this.nudgeRetry=++v;var b=v*e.nudgeOffset;Pt.b.log("adjust currentTime from "+t.currentTime+" to next buffered @ "+y+" + nudge "+b),t.currentTime=y+b,this.stalled=void 0,f.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:y+b-r})}}else if(g>.5&&p>1e3*e.highBufferWatchdogPeriod)if(this.stallReported||(this.stallReported=!0,Pt.b.warn("playback stalling in high buffer @"+r),f.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:g})),this.stalled=void 0,this.nudgeRetry=++v,v"+t),this.hls.trigger(Ot.a.STREAM_STATE_TRANSITION,{previousState:e,nextState:t})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getBufferedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;return t?this.followingBufferedFrag(this.getBufferedFrag(t.currentTime)):null}},{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(t){this._liveSyncPosition=t}}]),e}(Nt),ye=ve,me=function(){function t(t,e){for(var r=0;r0){r=e[0].bitrate,e.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=e;for(var d=0;d0})}else this.hls.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},e.prototype.setLevelInternal=function(t){var e=this._levels,r=this.hls;if(t>=0&&t1&&s.loadError0&&(e=t.urlId,this.hls.trigger(Ot.a.LEVEL_LOADING,{url:t.url[e],level:this.currentLevelIndex,id:e}))},me(e,[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e=this._levels;e&&(t=Math.min(t,e.length-1),this.currentLevelIndex===t&&void 0!==e[t].details||this.setLevelInternal(t))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}]),e}(Nt),Ee=be,Te=r(3),Re=function(t){function e(r){x(this,e);var i=F(this,t.call(this,r,Ot.a.MEDIA_ATTACHED,Ot.a.MEDIA_DETACHING,Ot.a.FRAG_PARSING_METADATA));return i.id3Track=void 0,i.media=void 0,i}return N(e,t),e.prototype.destroy=function(){Nt.prototype.destroy.call(this)},e.prototype.onMediaAttached=function(t){this.media=t.media,this.media},e.prototype.onMediaDetaching=function(){this.media=void 0},e.prototype.onFragParsingMetadata=function(t){var e=t.frag,r=t.samples;this.id3Track||(this.id3Track=this.media.addTextTrack("metadata","id3"),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,a=0;a=this.minWeight_},t.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.prototype.destroy=function(){},t}(),we=_e,De=function(){function t(t,e){for(var r=0;r500*r.duration/s){var l=t.levels,u=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/o),d=l[r.level],h=d.realBitrate?Math.max(d.realBitrate,d.bitrate):d.bitrate,c=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*h/8)),f=e.currentTime,p=(c-n.loaded)/u,g=(ie.bufferInfo(e,f,t.config.maxBufferHole).end-f)/s;if(g<2*r.duration/s&&p>g){var v=void 0,y=void 0;for(y=r.level-1;y>a;y--){var m=l[y].realBitrate?Math.max(l[y].realBitrate,l[y].bitrate):l[y].bitrate;if((v=r.duration*m/(6.4*u))=i;u--){var d=l[u],h=d.details,c=h?h.totalduration/h.fragments.length:e,f=!!h&&h.live,p=void 0;p=u<=t?o*r:s*r;var g=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,v=g*c/p;if(Pt.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(p)+"/"+g+"/"+c+"/"+n+"/"+v),p>g&&(!v||f&&!this.bitrateTestDelay||v=0)return c;Pt.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var f=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,p=i.abrBandWidthFactor,g=i.abrBandWidthUpFactor;if(0===h){var v=this.bitrateTestDelay;if(v){f=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-v,Pt.b.trace("bitrate test took "+Math.round(1e3*v)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*f)+" ms"),p=g=1}}return c=this._findBestLevel(o,s,d,a,e,h+f,p,g,r),Math.max(c,0)}}]),e}(Nt),ke=Ie,Oe=y(),Ce=function(t){function e(r){K(this,e);var i=W(this,t.call(this,r,Ot.a.MEDIA_ATTACHING,Ot.a.MEDIA_DETACHING,Ot.a.MANIFEST_PARSED,Ot.a.BUFFER_RESET,Ot.a.BUFFER_APPENDING,Ot.a.BUFFER_CODECS,Ot.a.BUFFER_EOS,Ot.a.BUFFER_FLUSHING,Ot.a.LEVEL_PTS_UPDATED,Ot.a.LEVEL_UPDATED));return i._msDuration=null,i._levelDuration=null,i._live=null,i._objectUrl=null,i.onsbue=i.onSBUpdateEnd.bind(i),i.onsbe=i.onSBUpdateError.bind(i),i.pendingTracks={},i.tracks={},i}return V(e,t),e.prototype.destroy=function(){Nt.prototype.destroy.call(this)},e.prototype.onLevelPtsUpdated=function(t){var e=t.type,r=this.tracks.audio;if("audio"===e&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(Math.abs(i.timestampOffset-t.start)>.1){var a=i.updating;try{i.abort()}catch(t){a=!0,Pt.b.warn("can not abort audio buffer: "+t)}a?this.audioTimestampOffset=t.start:(Pt.b.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+t.start),i.timestampOffset=t.start)}}},e.prototype.onManifestParsed=function(t){var e=t.audio,r=t.video||t.levels.length&&t.audio,i=0;t.altAudio&&(e||r)&&(i=(e?1:0)+(r?1:0),Pt.b.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i},e.prototype.onMediaAttaching=function(t){var e=this.media=t.media;if(e){var r=this.mediaSource=new Oe;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),e.src=URL.createObjectURL(r),this._objectUrl=e.src}},e.prototype.onMediaDetaching=function(){Pt.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){Pt.b.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}t.removeEventListener("sourceopen",this.onmso),t.removeEventListener("sourceended",this.onmse),t.removeEventListener("sourceclose",this.onmsc),this.media&&(URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):Pt.b.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(Ot.a.MEDIA_DETACHED)},e.prototype.onMediaSourceOpen=function(){Pt.b.log("media source opened"),this.hls.trigger(Ot.a.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},e.prototype.checkPendingTracks=function(){var t=this.pendingTracks,e=Object.keys(t).length;e&&(this.sourceBufferNb<=e||0===this.sourceBufferNb)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},e.prototype.onMediaSourceClose=function(){Pt.b.log("media source closed")},e.prototype.onMediaSourceEnded=function(){Pt.b.log("media source ended")},e.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var t=this.sourceBuffer.audio;Pt.b.warn("change mpeg audio timestamp offset from "+t.timestampOffset+" to "+this.audioTimestampOffset),t.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var e=this.parent,r=this.segments.reduce(function(t,r){return r.parent===e?t+1:t},0);this.hls.trigger(Ot.a.BUFFER_APPENDED,{parent:e,pending:r}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},e.prototype.onSBUpdateError=function(t){Pt.b.error("sourceBuffer error:",t),this.hls.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferReset=function(){var t=this.sourceBuffer;for(var e in t){var r=t[e];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(t){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},e.prototype.onBufferCodecs=function(t){if(0===Object.keys(this.sourceBuffer).length){for(var e in t)this.pendingTracks[e]=t[e];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}},e.prototype.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;for(var i in t)if(!e[i]){var a=t[i],n=a.levelCodec||a.codec,o=a.container+";codecs="+n;Pt.b.log("creating sourceBuffer("+o+")");try{var s=e[i]=r.addSourceBuffer(o);s.addEventListener("updateend",this.onsbue),s.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=s}catch(t){Pt.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:o})}}this.hls.trigger(Ot.a.BUFFER_CREATED,{tracks:t})},e.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},e.prototype.onBufferAppendFail=function(t){Pt.b.error("sourceBuffer error:",t.event),this.hls.trigger(Ot.a.ERROR,{type:Ct.b.MEDIA_ERROR,details:Ct.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.prototype.onBufferEos=function(t){var e=this.sourceBuffer,r=t.type;for(var i in e)r&&i!==r||e[i].ended||(e[i].ended=!0,Pt.b.log(i+" sourceBuffer now EOS"));this.checkEos()},e.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(!e||"open"!==e.readyState)return void(this._needsEos=!1);for(var r in t){var i=t[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}Pt.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){Pt.b.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1},e.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},e.prototype.onLevelUpdated=function(t){var e=t.details;e.fragments.length>0&&(this._levelDuration=e.totalduration+e.fragments[0].start,this._live=e.live,this.updateMediaElementDuration())},e.prototype.updateMediaElementDuration=function(){var t=this.hls.config,e=void 0;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer)if(!0===this.sourceBuffer[r].updating)return;e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(Pt.b.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||e===1/0||isNaN(e))&&(Pt.b.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},e.prototype.doFlush=function(){for(;this.flushRange.length;){var t=this.flushRange[0];if(!this.flushBuffer(t.start,t.end,t.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var e=0,r=this.sourceBuffer;try{for(var i in r)e+=r[i].buffered.length}catch(t){Pt.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(Ot.a.BUFFER_FLUSHED)}},e.prototype.doAppending=function(){var t=this.hls,e=this.sourceBuffer,r=this.segments;if(Object.keys(e).length){if(this.media.error)return this.segments=[],void Pt.b.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var i=r.shift();try{var a=i.type,n=e[a];n?n.updating?r.unshift(i):(n.ended=!1,this.parent=i.parent,n.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(e){Pt.b.error("error while trying to append buffer:"+e.message),r.unshift(i);var o={type:Ct.b.MEDIA_ERROR,parent:i.parent};if(22===e.code)return this.segments=[],o.details=Ct.a.BUFFER_FULL_ERROR,o.fatal=!1,void t.trigger(Ot.a.ERROR,o);if(this.appendError?this.appendError++:this.appendError=1,o.details=Ct.a.BUFFER_APPEND_ERROR,this.appendError>t.config.appendErrorMaxRetry)return Pt.b.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],o.fatal=!0,void t.trigger(Ot.a.ERROR,o);o.fatal=!1,t.trigger(Ot.a.ERROR,o)}}}},e.prototype.flushBuffer=function(t,e,r){var i,a,n,o,s,l,u=this.sourceBuffer;if(Object.keys(u).length){if(Pt.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter.5)return this.flushBufferCounter++,Pt.b.log("flush "+d+" ["+s+","+l+"], of ["+n+","+o+"], pos:"+this.media.currentTime),i.remove(s,l),!1}catch(t){Pt.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else Pt.b.warn("abort flushing too many retries");Pt.b.log("buffer flushed")}return!0},e}(Nt),Pe=Ce,xe=function(){function t(t,e){for(var r=0;rthis.autoLevelCapping&&e.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},e.prototype.getMaxLevel=function(t){var r=this;if(!this.levels)return-1;var i=this.levels.filter(function(i,a){return e.isLevelAllowed(a,r.restrictedLevels)&&a<=t});return e.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},e.isLevelAllowed=function(t){return-1===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},e.getMaxLevelByMediaSize=function(t,e,r){if(!t||t&&!t.length)return-1;for(var i=t.length-1,a=0;a=e||n.height>=r)&&function(t,e){return!e||(t.width!==e.width||t.height!==e.height)}(n,t[a+1])){i=a;break}}return i},xe(e,[{key:"mediaWidth",get:function(){var t=void 0,r=this.media;return r&&(t=r.width||r.clientWidth||r.offsetWidth,t*=e.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,r=this.media;return r&&(t=r.height||r.clientHeight||r.offsetHeight,t*=e.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),e}(Nt),Ne=Fe,Me=function(t){function e(r){return q(this,e),Q(this,t.call(this,r,Ot.a.MEDIA_ATTACHING))}return J(e,t),e.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},e.prototype.onMediaAttaching=function(t){var e=this.hls.config;if(e.capLevelOnFPSDrop){"function"==typeof(this.video=t.media instanceof HTMLVideoElement?t.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),e.fpsDroppedMonitoringPeriod)}},e.prototype.checkFPS=function(t,e,r){var i=performance.now();if(e){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,o=e-this.lastDecodedFrames,s=1e3*n/a,l=this.hls;if(l.trigger(Ot.a.FPS_DROP,{currentDropped:n,currentDecoded:o,totalDroppedFrames:r}),s>0&&n>l.config.fpsDroppedMonitoringThreshold*o){var u=l.currentLevel;Pt.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(Ot.a.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},e.prototype.checkFPSInterval=function(){var t=this.video;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},e}(Nt),Ue=Me,Be=function(){function t(e){$(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return t.prototype.destroy=function(){this.abort(),this.loader=null},t.prototype.abort=function(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},t.prototype.loadInternal=function(){var t,e=this.context;t=this.loader=new XMLHttpRequest;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(t,e.url)}catch(r){t.open("GET",e.url,!0),i(t,e.url)}t.readyState||t.open("GET",e.url,!0)}catch(r){return void this.callbacks.onError({code:t.status,text:r.message},e,t)}e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),t.send()},t.prototype.readystatechange=function(t){var e=t.currentTarget,r=e.readyState,i=this.stats,a=this.context,n=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(performance.now(),i.trequest)),4===r){var o=e.status;if(o>=200&&o<300){i.tload=Math.max(i.tfirst,performance.now());var s=void 0,l=void 0;"arraybuffer"===a.responseType?(s=e.response,l=s.byteLength):(s=e.responseText,l=s.length),i.loaded=i.total=l;var u={url:e.responseURL,data:s};this.callbacks.onSuccess(u,i,a,e)}else i.retry>=n.maxRetry||o>=400&&o<499?(Pt.b.error(o+" while loading "+a.url),this.callbacks.onError({code:o,text:e.statusText},a,e)):(Pt.b.warn(o+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,n.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),n.timeout)},t.prototype.loadtimeout=function(){Pt.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.prototype.loadprogress=function(t){var e=t.currentTarget,r=this.stats;r.loaded=t.loaded,t.lengthComputable&&(r.total=t.total);var i=this.callbacks.onProgress;i&&i(r,this.context,null,e)},t}(),Ge=Be,je=function(){function t(t,e){for(var r=0;r1&&setTimeout(this.tick,1),this.ticks=0)},e.prototype.doTick=function(){this.updateTrack(this.trackId)},e.prototype.onError=function(t){t.fatal&&t.type===Ct.b.NETWORK_ERROR&&this.cleanTimer()},e.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},e.prototype.onManifestParsed=function(t){var e=this,r=t.audioTracks||[],i=!1;this.tracks=r,this.hls.trigger(Ot.a.AUDIO_TRACKS_UPDATED,{audioTracks:r});var a=0;r.forEach(function(t){if(t.default&&!i)return e.audioTrack=a,void(i=!0);a++}),!1===i&&r.length&&(Pt.b.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)},e.prototype.onAudioTrackLoaded=function(t){t.id=0&&t=0&&t0&&-1===t?(Pt.b.log("audio:override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=Ve.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:t,this.state=Ve.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=t,this.state=Ve.STOPPED},e.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=Ve.STOPPED},e.prototype.tick=function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)},e.prototype.doTick=function(){var t,e,r,i=this.hls,a=i.config;switch(this.state){case Ve.ERROR:case Ve.PAUSED:case Ve.BUFFER_FLUSHING:break;case Ve.STARTING:this.state=Ve.WAITING_TRACK,this.loadedmetadata=!1;break;case Ve.IDLE:var n=this.tracks;if(!n)break;if(!this.media&&(this.startFragRequested||!a.startFragPrefetch))break;if(this.loadedmetadata)t=this.media.currentTime;else if(void 0===(t=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,s=this.videoBuffer?this.videoBuffer:this.media,l=ie.bufferInfo(o,t,a.maxBufferHole),u=ie.bufferInfo(s,t,a.maxBufferHole),d=l.len,h=l.end,c=this.fragPrevious,f=Math.max(a.maxBufferLength,u.len),p=this.audioSwitch,g=this.trackId;if((dm||l.nextStart))return;Pt.b.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=m+.05}if(r.initSegment&&!r.initSegment.data)E=r.initSegment;else if(h<=m){if(E=v[0],null!==this.videoTrackCC&&E.cc!==this.videoTrackCC&&(E=A(v,this.videoTrackCC)),r.live&&E.loadIdx&&E.loadIdx===this.fragLoadIdx){var T=l.nextStart?l.nextStart:m;return Pt.b.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(T+.05)),void(this.media.currentTime=T+.05)}}else{var R=void 0,S=a.maxFragLookUpTolerance,L=c?v[c.sn-v[0].sn+1]:void 0,_=function(t){var e=Math.min(S,t.duration);return t.start+t.duration-e<=h?1:t.start-e>h&&t.start?-1:0};hb-S&&(S=0),R=L&&!_(L)?L:ee.search(v,_)):R=v[y-1],R&&(E=R,m=R.start,c&&E.level===c.level&&E.sn===c.sn&&(E.snw&&Math.abs(this.fragLoadIdx-E.loadIdx)=I||k)&&(Pt.b.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=Ve.IDLE);break;case Ve.WAITING_INIT_PTS:var O=this.videoTrackCC;if(void 0===this.initPTS[O])break;var C=this.waitingFragment;if(C){var P=C.frag.cc;O!==P?(e=this.tracks[this.trackId],e.details&&e.details.live&&(Pt.b.warn("Waiting fragment CC ("+P+") does not match video track CC ("+O+")"),this.waitingFragment=null,this.state=Ve.IDLE)):(this.state=Ve.FRAG_LOADING,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=Ve.IDLE;break;case Ve.STOPPED:case Ve.FRAG_LOADING:case Ve.PARSING:case Ve.PARSED:case Ve.ENDED:}},e.prototype.onMediaAttached=function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)},e.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(Pt.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.tracks;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.stopLoad()},e.prototype.onMediaSeeking=function(){this.state===Ve.ENDED&&(this.state=Ve.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()},e.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.prototype.onAudioTracksUpdated=function(t){Pt.b.log("audio tracks updated"),this.tracks=t.audioTracks},e.prototype.onAudioTrackSwitching=function(t){var e=!!t.url;this.trackId=t.id,this.fragCurrent=null,this.state=Ve.PAUSED,this.waitingFragment=null,e?this.timer||(this.timer=setInterval(this.ontick,100)):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),e&&(this.audioSwitch=!0,this.state=Ve.IDLE,void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold)),this.tick()},e.prototype.onAudioTrackLoaded=function(t){var e=t.details,r=t.id,i=this.tracks[r],a=e.totalduration,n=0;if(Pt.b.log("track "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+a),e.live){var o=i.details;o&&e.fragments.length>0?(T(o,e),n=e.fragments[0].start,e.PTSKnown?Pt.b.log("live audio playlist sliding:"+n.toFixed(3)):Pt.b.log("live audio playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,Pt.b.log("live audio playlist - first load, unknown sliding"))}else e.PTSKnown=!1;if(i.details=e,!this.startFragRequested){if(-1===this.startPosition){var s=e.startTimeOffset;isNaN(s)?this.startPosition=0:(Pt.b.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s)}this.nextLoadPosition=this.startPosition}this.state===Ve.WAITING_TRACK&&(this.state=Ve.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===Ve.KEY_LOADING&&(this.state=Ve.IDLE,this.tick())},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===Ve.FRAG_LOADING&&e&&"audio"===r.type&&r.level===e.level&&r.sn===e.sn){var i=this.tracks[this.trackId],a=i.details,n=a.totalduration,o=e.level,s=e.sn,l=e.cc,u=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",d=this.stats=t.stats;if("initSegment"===s)this.state=Ve.IDLE,d.tparsed=d.tbuffered=performance.now(),a.initSegment.data=t.payload,this.hls.trigger(Ot.a.FRAG_BUFFERED,{stats:d,frag:e,id:"audio"}),this.tick();else{this.state=Ve.PARSING,this.appended=!1,this.demuxer||(this.demuxer=new he(this.hls,"audio"));var h=this.initPTS[l],c=a.initSegment?a.initSegment.data:[];if(a.initSegment||void 0!==h){this.pendingBuffering=!0,Pt.b.log("Demuxing "+s+" of ["+a.startSN+" ,"+a.endSN+"],track "+o);this.demuxer.push(t.payload,c,u,null,e,n,!1,h)}else Pt.b.log("unknown video PTS for continuity counter "+l+", waiting for video PTS before demuxing audio frag "+s+" of ["+a.startSN+" ,"+a.endSN+"],track "+o),this.waitingFragment=t,this.state=Ve.WAITING_INIT_PTS}}this.fragLoadError=0},e.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===Ve.PARSING){var i=t.tracks,a=void 0;if(i.video&&delete i.video,a=i.audio){a.levelCodec=a.codec,a.id=t.id,this.hls.trigger(Ot.a.BUFFER_CODECS,i),Pt.b.log("audio track:audio,container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var n=a.initSegment;if(n){var o={type:"audio",data:n,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(Ot.a.BUFFER_APPENDING,o))}this.tick()}}},e.prototype.onFragParsingData=function(t){var e=this,r=this.fragCurrent,i=t.frag;if(r&&"audio"===t.id&&"audio"===t.type&&i.sn===r.sn&&i.level===r.level&&this.state===Ve.PARSING){var a=this.trackId,n=this.tracks[a],o=this.hls;isNaN(t.endPTS)&&(t.endPTS=t.startPTS+r.duration,t.endDTS=t.startDTS+r.duration),Pt.b.log("parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb),E(n.details,r,t.startPTS,t.endPTS);var s=this.audioSwitch,l=this.media,u=!1;if(s&&l)if(l.readyState){var d=l.currentTime;Pt.b.log("switching audio track : currentTime:"+d),d>=t.startPTS&&(Pt.b.log("switching audio track : flushing all audio"),this.state=Ve.BUFFER_FLUSHING,o.trigger(Ot.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),u=!0,this.audioSwitch=!1,o.trigger(Ot.a.AUDIO_TRACK_SWITCHED,{id:a}))}else this.audioSwitch=!1,o.trigger(Ot.a.AUDIO_TRACK_SWITCHED,{id:a});var h=this.pendingData;this.audioSwitch||([t.data1,t.data2].forEach(function(e){e&&e.length&&h.push({type:t.type,data:e,parent:"audio",content:"data"})}),!u&&h.length&&(h.forEach(function(t){e.state===Ve.PARSING&&(e.pendingBuffering=!0,e.hls.trigger(Ot.a.BUFFER_APPENDING,t))}),this.pendingData=[],this.appended=!0)),this.tick()}},e.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===Ve.PARSING&&(this.stats.tparsed=performance.now(),this.state=Ve.PARSED,this._checkAppendedParsed())},e.prototype.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.prototype.onBufferCreated=function(t){var e=t.tracks.audio;e&&(this.mediaBuffer=e.buffer,this.loadedmetadata=!0),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},e.prototype.onBufferAppended=function(t){if("audio"===t.parent){var e=this.state;e!==Ve.PARSING&&e!==Ve.PARSED||(this.pendingBuffering=t.pending>0,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==Ve.PARSED||this.appended&&this.pendingBuffering)){var t=this.fragCurrent,e=this.stats,r=this.hls;if(t){this.fragPrevious=t,e.tbuffered=performance.now(),r.trigger(Ot.a.FRAG_BUFFERED,{stats:e,frag:t,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;Pt.b.log("audio buffered : "+fe.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(Ot.a.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=Ve.IDLE}this.tick()}},e.prototype.onError=function(t){var e=t.frag;if(!e||"audio"===e.type)switch(t.details){case Ct.a.FRAG_LOAD_ERROR:case Ct.a.FRAG_LOAD_TIMEOUT:if(!t.fatal){var r=this.fragLoadError;r?r++:r=1;var i=this.config;if(r<=i.fragLoadingMaxRetry){this.fragLoadError=r,e.loadCounter=0;var a=Math.min(Math.pow(2,r-1)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);Pt.b.warn("audioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=Ve.FRAG_LOADING_WAITING_RETRY}else Pt.b.error("audioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=Ve.ERROR}break;case Ct.a.FRAG_LOOP_LOADING_ERROR:case Ct.a.AUDIO_TRACK_LOAD_ERROR:case Ct.a.AUDIO_TRACK_LOAD_TIMEOUT:case Ct.a.KEY_LOAD_ERROR:case Ct.a.KEY_LOAD_TIMEOUT:this.state!==Ve.ERROR&&(this.state=t.fatal?Ve.ERROR:Ve.IDLE,Pt.b.warn("audioStreamController: "+t.details+" while loading frag,switch to "+this.state+" state ..."));break;case Ct.a.BUFFER_FULL_ERROR:if("audio"===t.parent&&(this.state===Ve.PARSING||this.state===Ve.PARSED)){var n=this.mediaBuffer,o=this.media.currentTime;if(n&&ie.isBuffered(n,o)&&ie.isBuffered(n,o+.5)){var s=this.config;s.maxMaxBufferLength>=s.maxBufferLength&&(s.maxMaxBufferLength/=2,Pt.b.warn("audio:reduce max buffer length to "+s.maxMaxBufferLength+"s"),this.fragLoadIdx+=2*s.fragLoadingLoopThreshold),this.state=Ve.IDLE}else Pt.b.warn("buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Ve.BUFFER_FLUSHING,this.hls.trigger(Ot.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},e.prototype.onBufferFlushed=function(){var t=this,e=this.pendingData;e&&e.length?(Pt.b.log("appending pending audio data on Buffer Flushed"),e.forEach(function(e){t.hls.trigger(Ot.a.BUFFER_APPENDING,e)}),this.appended=!0,this.pendingData=[],this.state=Ve.PARSED):(this.state=Ve.IDLE,this.fragPrevious=null,this.tick())},We(e,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,Pt.b.log("audio stream:"+e+"->"+t)}},get:function(){return this._state}}]),e}(Nt),ze=Ye,Xe=function(){function t(t){return"string"==typeof t&&(!!n[t.toLowerCase()]&&t.toLowerCase())}function e(t){return"string"==typeof t&&(!!o[t.toLowerCase()]&&t.toLowerCase())}function r(t){for(var e=1;e100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",r({},u,{get:function(){return T},set:function(t){var r=e(t);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",r({},u,{get:function(){return R},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");R=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",r({},u,{get:function(){return A},set:function(t){var r=e(t);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");A=r,this.hasBeenReset=!0}})),s.displayState=void 0,l)return s}if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var a="auto",n={"":!0,lr:!0,rl:!0},o={start:!0,middle:!0,end:!0,left:!0,right:!0};return i.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},i}(),qe=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};st.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var i=0;i=0&&e<=100)&&(this.set(t,e),!0)}};var Qe=new Xe(0,0,0),Je="middle"===Qe.align?"middle":"center";nt.prototype={parse:function(t){function e(){var t=r.buffer,e=0;for(t=dt(t);e=r&&console.log(this.time+" ["+t+"] "+e)}},ur=function(t){for(var e=[],r=0;rrr&&(lr.log("ERROR","Too large cursor position "+this.pos),this.pos=rr)},t.prototype.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var r=this.pos+1;r=144&&this.backSpace();var e=tr(t);if(this.pos>=rr)return void lr.log("ERROR","Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1)},t.prototype.clearFromPos=function(t){var e;for(e=t;e0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},t.prototype.getTextAndFormat=function(){return this.rows},t}(),pr=function(){function t(e,r){ct(this,t),this.chNr=e,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new fr,this.nonDisplayedMemory=new fr,this.lastOutputScreen=new fr,this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return t.prototype.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},t.prototype.getHandler=function(){return this.outputFilter},t.prototype.setHandler=function(t){this.outputFilter=t},t.prototype.setPAC=function(t){this.writeScreen.setPAC(t)},t.prototype.setBkgData=function(t){this.writeScreen.setBkgData(t)},t.prototype.setMode=function(t){t!==this.mode&&(this.mode=t,lr.log("INFO","MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},t.prototype.insertChars=function(t){for(var e=0;e=46,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=i[r]}lr.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},t.prototype.outputDataUpdate=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=lr.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),!0===t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue()),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},t.prototype.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),gr=function(){function t(e,r,i){ct(this,t),this.field=e||1,this.outputs=[r,i],this.channels=[new pr(1,r),new pr(2,i)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}return t.prototype.getHandler=function(t){return this.channels[t].getHandler()},t.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)},t.prototype.addData=function(t,e){var r,i,a,n=!1;this.lastTime=t,lr.setTime(t);for(var o=0;o ("+ur([i,a])+")"),r=this.parseCmd(i,a),r||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(n=this.parseChars(i,a)))if(this.currChNr&&this.currChNr>=0){var s=this.channels[this.currChNr-1];s.insertChars(n)}else lr.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:n?this.dataCounters.char+=2:(this.dataCounters.other+=2,lr.log("WARNING","Couldn't parse cleaned data "+ur([i,a])+" orig: "+ur([e[o],e[o+1]])))}else this.dataCounters.padding+=2},t.prototype.parseCmd=function(t,e){var r=null,i=(20===t||28===t)&&32<=e&&e<=47,a=(23===t||31===t)&&33<=e&&e<=35;if(!i&&!a)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,lr.log("DEBUG","Repeated command ("+ur([t,e])+") is dropped"),!0;r=20===t||23===t?1:2;var n=this.channels[r-1];return 20===t||28===t?32===e?n.ccRCL():33===e?n.ccBS():34===e?n.ccAOF():35===e?n.ccAON():36===e?n.ccDER():37===e?n.ccRU(2):38===e?n.ccRU(3):39===e?n.ccRU(4):40===e?n.ccFON():41===e?n.ccRDC():42===e?n.ccTR():43===e?n.ccRTD():44===e?n.ccEDM():45===e?n.ccCR():46===e?n.ccENM():47===e&&n.ccEOC():n.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},t.prototype.parseMidrow=function(t,e){var r=null;if((17===t||25===t)&&32<=e&&e<=47){if((r=17===t?1:2)!==this.currChNr)return lr.log("ERROR","Mismatch channel in midrow parsing"),!1;return this.channels[r-1].ccMIDROW(e),lr.log("DEBUG","MIDROW ("+ur([t,e])+")"),!0}return!1},t.prototype.parsePAC=function(t,e){var r=null,i=null,a=(17<=t&&t<=23||25<=t&&t<=31)&&64<=e&&e<=127,n=(16===t||24===t)&&64<=e&&e<=95;if(!a&&!n)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=t<=23?1:2,i=64<=e&&e<=95?1===r?ir[t]:nr[t]:1===r?ar[t]:or[t];var o=this.interpretPAC(i,e);return this.channels[r-1].setPAC(o),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},t.prototype.interpretPAC=function(t,e){var r=e,i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},t.prototype.parseChars=function(t,e){var r=null,i=null,a=null;if(t>=25?(r=2,a=t-8):(r=1,a=t),17<=a&&a<=19){var n=e;n=17===a?e+80:18===a?e+112:e+144,lr.log("INFO","Special char '"+tr(n)+"' in channel "+r),i=[n]}else 32<=t&&t<=127&&(i=0===e?[t]:[t,e]);if(i){var o=ur(i);lr.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i},t.prototype.parseBackgroundAttributes=function(t,e){var r,i,a,n,o=(16===t||24===t)&&32<=e&&e<=47,s=(23===t||31===t)&&45<=e&&e<=47;return!(!o&&!s)&&(r={},16===t||24===t?(i=Math.floor((e-32)/2),r.background=sr[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0)),a=t<24?1:2,n=this.channels[a-1],n.setBkgData(r),this.lastCmdA=null,this.lastCmdB=null,!0)},t.prototype.reset=function(){for(var t=0;tt)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.track)},t}(),mr=yr,br=function(t,e,r){return t.substr(r||0,e.length)===e},Er=function(t){var e=parseInt(t.substr(-3)),r=parseInt(t.substr(-6,2)),i=parseInt(t.substr(-9,2)),a=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;return isNaN(e)||isNaN(r)||isNaN(i)||isNaN(a)?-1:(e+=1e3*r,e+=6e4*i,e+=36e5*a)},Tr=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()},Rr=function(t,e,r){var i=t[e],a=t[i.prevCC];if(!a||!a.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,void(i.new=!1);for(;a&&a.new;)t.ccOffset+=i.start-a.start,i.new=!1,i=a,a=t[i.prevCC];t.presentationOffset=r},Ar={parse:function(t,e,r,i,a,n){var o=Object(Te.b)(new Uint8Array(t)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s="00:00.000",l=0,u=0,d=0,h=[],c=void 0,f=!0,p=new $e;p.oncue=function(t){var e=r[i],a=r.ccOffset;e&&e.new&&(void 0!==u?a=r.ccOffset=e.start:Rr(r,i,d)),d&&(a=d+r.ccOffset-r.presentationOffset),t.startTime+=a-u,t.endTime+=a-u,t.id=Tr(t.startTime.toString())+Tr(t.endTime.toString())+Tr(t.text),t.text=decodeURIComponent(encodeURIComponent(t.text)),t.endTime>0&&h.push(t)},p.onparsingerror=function(t){c=t},p.onflush=function(){if(c&&n)return void n(c);a(h)},o.forEach(function(t){if(f){if(br(t,"X-TIMESTAMP-MAP=")){f=!1,t.substr(16).split(",").forEach(function(t){br(t,"LOCAL:")?s=t.substr(6):br(t,"MPEGTS:")&&(l=parseInt(t.substr(7)))});try{e=e<0?e+8589934592:e,l-=e,u=Er(s)/1e3,d=l/9e4,-1===u&&(c=new Error("Malformed X-TIMESTAMP-MAP: "+t))}catch(e){c=new Error("Malformed X-TIMESTAMP-MAP: "+t)}return}""===t&&(f=!1)}p.parse(t+"\n")}),p.flush()}},Sr=Ar,Lr=function(t){function e(r){pt(this,e);var i=gt(this,t.call(this,r,Ot.a.MEDIA_ATTACHING,Ot.a.MEDIA_DETACHING,Ot.a.FRAG_PARSING_USERDATA,Ot.a.FRAG_DECRYPTED,Ot.a.MANIFEST_LOADING,Ot.a.MANIFEST_LOADED,Ot.a.FRAG_LOADED,Ot.a.LEVEL_SWITCHING,Ot.a.INIT_PTS_FOUND));if(i.hls=r,i.config=r.config,i.enabled=!0,i.Cues=r.config.cueHandler,i.textTracks=[],i.tracks=[],i.unparsedVttFrags=[],i.initPTS=void 0,i.cueRanges=[],i.config.enableCEA708Captions){var a=new mr(i,1),n=new mr(i,2);i.cea608Parser=new vr(0,a,n)}return i}return vt(e,t),e.prototype.addCues=function(t,e,r,i){for(var a=this.cueRanges,n=!1,o=a.length;o--;){var s=a[o],l=bt(s[0],s[1],e,r);if(l>=0&&(s[0]=Math.min(s[0],e),s[1]=Math.max(s[1],r),n=!0,l/(r-e)>.5))return}n||a.push([e,r]),this.Cues.newCue(this[t],e,r,i)},e.prototype.onInitPtsFound=function(t){var e=this;void 0===this.initPTS&&(this.initPTS=t.initPTS),this.unparsedVttFrags.length&&(this.unparsedVttFrags.forEach(function(t){e.onFragLoaded(t)}),this.unparsedVttFrags=[])},e.prototype.getExistingTrack=function(t){var e=this.media;if(e)for(var r=0;r=this.tracks.length)){this.timer&&(clearInterval(this.timer),this.timer=null);var e=At(this.media.textTracks);if(-1!==this.trackId&&this.subtitleDisplay&&(e[this.trackId].mode="hidden"),this.trackId=t,Pt.b.log("switching to subtitle track "+t),this.hls.trigger(Ot.a.SUBTITLE_TRACK_SWITCH,{id:t}),-1!==t){var r=this.tracks[t];this.subtitleDisplay&&(e[t].mode="showing");var i=r.details;void 0!==i&&!0!==i.live||(Pt.b.log("(re)loading playlist for subtitle track "+t),this.hls.trigger(Ot.a.SUBTITLE_TRACK_LOADING,{url:r.url,id:t}))}}},wr(e,[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.trackId!==t&&this.setSubtitleTrackInternal(t)}}]),e}(Nt),Ir=Dr,kr=r(4),Or={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING"},Cr=function(t){function e(r){St(this,e);var i=Lt(this,t.call(this,r,Ot.a.MEDIA_ATTACHED,Ot.a.ERROR,Ot.a.KEY_LOADED,Ot.a.FRAG_LOADED,Ot.a.SUBTITLE_TRACKS_UPDATED,Ot.a.SUBTITLE_TRACK_SWITCH,Ot.a.SUBTITLE_TRACK_LOADED,Ot.a.SUBTITLE_FRAG_PROCESSED));return i.config=r.config,i.vttFragSNsProcessed={},i.vttFragQueues=void 0,i.currentlyProcessing=null,i.state=Or.STOPPED,i.currentTrackId=-1,i.ticks=0,i.decrypter=new kr.a(r.observer,r.config),i}return _t(e,t),e.prototype.destroy=function(){Nt.prototype.destroy.call(this),this.state=Or.STOPPED},e.prototype.clearVttFragQueues=function(){var t=this;this.vttFragQueues={},this.tracks.forEach(function(e){t.vttFragQueues[e.id]=[]})},e.prototype.nextFrag=function(){if(null===this.currentlyProcessing&&this.currentTrackId>-1&&this.vttFragQueues[this.currentTrackId].length){var t=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift();this.fragCurrent=t,this.hls.trigger(Ot.a.FRAG_LOADING,{frag:t}),this.state=Or.FRAG_LOADING}},e.prototype.onSubtitleFragProcessed=function(t){t.success&&this.vttFragSNsProcessed[t.frag.trackId].push(t.frag.sn),this.currentlyProcessing=null,this.state=Or.IDLE,this.nextFrag()},e.prototype.onMediaAttached=function(){this.state=Or.IDLE},e.prototype.onError=function(t){var e=t.frag;e&&"subtitle"!==e.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())},e.prototype.tick=function(){var t=this;1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(function(){t.tick()},1),this.ticks=0)},e.prototype.doTick=function(){var t=this;switch(this.state){case Or.IDLE:var e=this.tracks,r=this.currentTrackId,i=this.vttFragSNsProcessed[r],a=this.vttFragQueues[r],n=this.currentlyProcessing?this.currentlyProcessing.sn:-1,o=function(t){return i.indexOf(t.sn)>-1},s=function(t){return a.some(function(e){return e.sn===t.sn})};if(!e)break;var l;if(r0&&null!=r&&null!=r.key&&"AES-128"===r.method){var n;try{n=performance.now()}catch(t){n=Date.now()}this.decrypter.decrypt(t.payload,r.key.buffer,r.iv.buffer,function(t){var e;try{e=performance.now()}catch(t){e=Date.now()}a.trigger(Ot.a.FRAG_DECRYPTED,{frag:i,payload:t,stats:{tstart:n,tdecrypt:e}})})}},e}(Nt),Pr=Cr,xr={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ge,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,fetchSetup:void 0,abrController:ke,bufferController:Pe,capLevelController:Ne,fpsController:Ue,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0};xr.subtitleStreamController=Pr,xr.subtitleTrackController=Ir,xr.timelineController=_r,xr.cueHandler=Dt,xr.enableCEA708Captions=!0,xr.enableWebVTT=!0,xr.captionsTextTrack1Label="English",xr.captionsTextTrack1LanguageCode="en",xr.captionsTextTrack2Label="Spanish",xr.captionsTextTrack2LanguageCode="es",xr.audioStreamController=ze,xr.audioTrackController=Ke;var Fr=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};wt(this,t);var i=t.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var a in i)a in r||(r[a]=i[a]);if(void 0!==r.liveMaxLatencyDurationCount&&r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==r.liveMaxLatencyDuration&&(r.liveMaxLatencyDuration<=r.liveSyncDuration||void 0===r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(Pt.a)(r.debug),this.config=r,this._autoLevelCapping=-1;var n=this.observer=new oe.a;n.trigger=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i1?e-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:-1;Pt.b.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},t.prototype.stopLoad=function(){Pt.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},t.prototype.swapAudioCodec=function(){Pt.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.prototype.recoverMediaError=function(){Pt.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},Fr(t,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){Pt.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){Pt.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){Pt.b.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){Pt.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){Pt.b.log("set startLevel:"+t);var e=this;-1!==t&&(t=Math.max(t,e.minAutoLevel)),e.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){Pt.b.log("set autoLevelCapping:"+t),this._autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var t=this,e=t.levels,r=t.config.minAutoBitrate,i=e?e.length:0,a=0;ar)return a}return 0}},{key:"maxAutoLevel",get:function(){var t=this,e=t.levels,r=t.autoLevelCapping;return-1===r&&e&&e.length?e.length-1:r}},{key:"nextAutoLevel",get:function(){var t=this;return Math.min(Math.max(t.abrController.nextAutoLevel,t.minAutoLevel),t.maxAutoLevel)},set:function(t){var e=this;e.abrController.nextAutoLevel=Math.max(e.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}}]),t}();e.default=Nr},function(t,e,r){function i(t){function e(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e.oe=function(t){throw console.error(t),t};var i=e(e.s=ENTRY_MODULE);return i.default||i}function a(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function n(t){var e=[],r=t.toString(),i=r.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!i)return e;for(var n,o=i[1],s=new RegExp("(\\\\n|\\W)"+a(o)+"\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\w|/|@]+).*?\\)","g");n=s.exec(r);)e.push(n[3]);return e}function o(t,e){for(var r=[e],i=[],a={};r.length;){var o=r.pop();if(!a[o]&&t[o]){a[o]=!0,i.push(o);var s=n(t[o]);r=r.concat(s)}}return i}t.exports=function(t,e){e=e||{};var a=r.m,n=e.all?Object.keys(a):o(a,t),s="("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+n.map(function(t){return JSON.stringify(t)+": "+a[t].toString()}).join(",")+"})(self);",l=new window.Blob([s],{type:"text/javascript"});if(e.bare)return l;var u=window.URL||window.webkitURL||window.mozURL||window.msURL,d=u.createObjectURL(l),h=new window.Worker(d);return h.objectURL=d,h}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(7),a=r(1),n=r(0),o=r(5),s=r.n(o),l=function(t){var e=new s.a;e.trigger=function(t){for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;a1?r-1:0),a=1;a2e3?(t=r,s.recoverMediaError()):!e||r-e>2e3?(e=r,s.swapAudioCodec(),s.recoverMediaError()):console.error("Error loading media: File could not be played")}}var i=e.options_,n=e.el(),o=null,s=this.hls=new a(i.hlsjsConfig),l=r(),u=r();n.addEventListener("error",function(t){var e=t.currentTarget.error;e.code===e.MEDIA_ERR_DECODE?u():console.error("Error loading media: File could not be played")}),this.dispose=function(){s.destroy()},this.duration=function(){return o||n.duration||0},s.on(a.Events.LEVEL_LOADED,function(t,e){o=e.details.live?1/0:e.details.totalduration}),s.on(a.Events.ERROR,function(t,e){if(e.fatal)switch(e.type){case a.ErrorTypes.NETWORK_ERROR:s.startLoad();break;case a.ErrorTypes.MEDIA_ERROR:l();break;default:console.error("Error loading media: File could not be played")}}),Object.keys(a.Events).forEach(function(t){var r=a.Events[t];s.on(r,function(t,i){e.trigger(r,i)})}),e.featuresNativeTextTracks||(Object.defineProperty(n,"textTracks",{value:e.textTracks,writable:!1}),n.addTextTrack=function(){return e.addTextTrack.apply(e,arguments)}),s.attachMedia(n),s.loadSource(t.src)}var a=r(0);window.Hls||(window.Hls=a);var n=/^application\/(x-mpegURL|vnd\.apple\.mpegURL)$/i,o=/\.m3u8/i,s={canHandleSource:function(t){return t.skipContribHlsJs?"":n.test(t.type)?"probably":o.test(t.src)?"maybe":""},handleSource:function(t,e){return new i(t,e)},canPlayType:function(t){return n.test(t)?"probably":""}};if(a.isSupported()){var l=r(1);if(l=l&&l.default||l){var u=l.getTech&&l.getTech("Html5");u=u||l.getComponent&&l.getComponent("Html5"),u&&u.registerSourceHandler(s,0)}else console.warn("videojs-contrib-hls.js: Couldn't find find window.videojs nor require('video.js')")}}])}); +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("video.js"));else if("function"==typeof define&&define.amd)define(["video.js"],t);else{var r=t("object"==typeof exports?require("video.js"):e.videojs);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,function(e){return function(e){function t(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"undefined"!=typeof window&&function(t,r){e.exports=r()}(0,function(){return function(e){function t(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var a in e)t.d(i,a,function(t){return e[t]}.bind(null,a));return i},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":/*!*********************************************!*\ + !*** ./node_modules/eventemitter3/index.js ***! + \*********************************************/ +/*! no static exports found */ +/*! ModuleConcatenation bailout: Module is not an ECMAScript module */ +function(e,t,r){"use strict";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function n(e,t,r,i,n){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new a(r,i||e,n),o=u?u+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}var l=Object.prototype.hasOwnProperty,u="~";Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(u=!1)),o.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)l.call(e,t)&&r.push(u?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},o.prototype.listeners=function(e){var t=u?u+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,n=new Array(a);i0},!1)}function l(e,t){for(var r={main:[t]},i={main:[]},a={main:{}};o(r);)for(var n=Object.keys(r),l=0;l>>8^255&v^99,e[h]=v,t[v]=h;var m=f[h],y=f[m],E=f[y],T=257*f[v]^16843008*v;i[h]=T<<24|T>>>8,a[h]=T<<16|T>>>16,n[h]=T<<8|T>>>24,s[h]=T,T=16843009*E^65537*y^257*m^16843008*h,l[v]=T<<24|T>>>8,u[v]=T<<16|T>>>16,d[v]=T<<8|T>>>24,c[v]=T,h?(h=m^f[f[f[E^m]]],g^=f[f[g]]):h=g=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i>>6),(n=(60&t[r+2])>>>2)>c.length-1?void e.trigger(y.default.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(o=(1&t[r+2])<<2,o|=(192&t[r+3])>>>6,b.logger.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+n+"["+c[n]+"Hz],channelConfig:"+o),/firefox/i.test(u)?n>=6?(a=5,l=new Array(4),s=n-3):(a=2,l=new Array(2),s=n):-1!==u.indexOf("android")?(a=2,l=new Array(2),s=n):(a=5,l=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&n>=6?s=n-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(n>=6&&1===o||/vivaldi/i.test(u))||!i&&1===o)&&(a=2,l=new Array(2)),s=n)),l[0]=a<<3,l[0]|=(14&n)>>1,l[1]|=(1&n)<<7,l[1]|=o<<3,5===a&&(l[1]|=(14&s)>>1,l[2]=(1&s)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:c[n],channelCount:o,codec:"mp4a.40."+a,manifestCodec:d})}function a(e,t){return 255===e[t]&&240==(246&e[t+1])}function n(e,t){return 1&e[t+1]?7:9}function s(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function o(e,t){return!!(t+1=e.length)return!1;var i=s(e,t);if(i<=r)return!1;var l=t+i;if(l===e.length||l+10&&t+o+l<=d)return u=r+i*a,{headerLength:o,frameLength:l,stamp:u}}function f(e,t,r,i,a){var n=d(e.samplerate),s=c(t,r,i,a,n);if(s){var o=s.stamp,l=s.headerLength,u=s.frameLength,f={unit:t.subarray(r+l,r+l+u),pts:o,dts:o};return e.samples.push(f),{sample:f,length:u+l}}}function h(e,t,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var a=e*t*r;return i?Math.round(a):a}function g(e,t){return void 0===t&&(t=!1),h(e,1e3,1/V,t)}function p(e,t){return void 0===t&&(t=1),h(e,V,1/t)}function v(e,t){var r;if(void 0===t)return e;for(r=t4294967296;)e+=r;return e}r.r(t);var m,y=r("./src/events.js"),E=r("./src/errors.ts"),T=r("./src/crypt/decrypter.js"),S=r("./src/polyfills/number.js"),b=r("./src/utils/logger.js"),_=r("./src/utils/get-self-scope.js"),A=r("./src/demux/id3.js"),R=function(){function e(e,t,r){this.observer=e,this.config=r,this.remuxer=t}var t=e.prototype;return t.resetInitSegment=function(e,t,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:t,duration:i,inputTimeScale:9e4}},t.resetTimeStamp=function(){},e.probe=function(e){if(!e)return!1;for(var t=A.default.getID3Data(e,0)||[],r=t.length,i=e.length;rt.length)){var n=this.parseHeader(t,r);if(n&&r+n.frameLength<=t.length){var s=9e4*n.samplesPerFrame/n.sampleRate,o=i+a*s,l={unit:t.subarray(r,r+n.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(l),{sample:l,length:n.frameLength}}}},parseHeader:function(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,a=e[t+2]>>4&15,n=e[t+2]>>2&3,s=e[t+2]>>1&1;if(1!==r&&0!==a&&15!==a&&3!==n){var o=3===r?3-i:3===i?3:4,l=1e3*k.BitratesMap[14*o+a-1],u=3===r?0:2===r?1:2,d=k.SamplingRateMap[3*u+n],c=e[t+3]>>6==3?1:2,f=k.SamplesCoefficients[r][i],h=k.BytesInSlot[i],g=8*f*h;return{sampleRate:d,channelCount:c,frameLength:parseInt(f*l/d+s,10)*h,samplesPerFrame:g}}},isHeaderPattern:function(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])},isHeader:function(e,t){return!!(t+1e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&b.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0&&this.bitsAvailable?r<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){var t,r,i=8,a=8;for(t=0;t=e.length)return void r();if(!(e[t].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,i),!i)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,a=32;a<=e.length-16;a+=160,i+=16)r.set(e.subarray(a,a+16),i);return r},t.getAvcDecryptedUnit=function(e,t){t=new Uint8Array(t);for(var r=0,i=32;i<=e.length-16;i+=160,r+=16)e.set(t.subarray(r,r+16),i);return e},t.decryptAvcSample=function(e,t,r,i,a,n){var s=this.discardEPB(a.data),o=this.getAvcEncryptedData(s),l=this;this.decryptBuffer(o.buffer,function(o){a.data=l.getAvcDecryptedUnit(s,o),n||l.decryptAvcSamples(e,t,r+1,i)})},t.decryptAvcSamples=function(e,t,r,i){for(;;t++,r=0){if(t>=e.length)return void i();for(var a=e[t].units;!(r>=a.length);r++){var n=a[r];if(!(n.data.length<=48||1!==n.type&&5!==n.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,i,n,s),!s)return}}}},e}(),P=C,x={video:1,audio:2,id3:3,text:4},F=function(){function e(e,t,r,i){this.observer=e,this.config=r,this.typeSupported=i,this.remuxer=t,this.sampleAes=null,this.pmtUnknownTypes={}}var t=e.prototype;return t.setDecryptData=function(e){null!=e&&null!=e.key&&"SAMPLE-AES"===e.method?this.sampleAes=new P(this.observer,this.config,e,this.discardEPB):this.sampleAes=null},e.probe=function(t){var r=e._syncOffset(t);return!(r<0)&&(r&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),!0)},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r>4>1){if((l=n+5+t[n+4])===n+188)continue}else l=n+4;switch(o){case v:s&&(_&&(u=k(_))&&w(u,!1),_={data:[],size:0}),_&&(_.data.push(t.subarray(l,n+188)),_.size+=n+188-l);break;case m:s&&(A&&(u=k(A))&&(g.isAAC?I(u):O(u)),A={data:[],size:0}),A&&(A.data.push(t.subarray(l,n+188)),A.size+=n+188-l);break;case T:s&&(R&&(u=k(R))&&C(u),R={data:[],size:0}),R&&(R.data.push(t.subarray(l,n+188)),R.size+=n+188-l);break;case 0:s&&(l+=t[l]+1),S=this._pmtId=D(t,l);break;case S:s&&(l+=t[l]+1);var x=L(t,l,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);v=x.avc,v>0&&(h.pid=v),m=x.audio,m>0&&(g.pid=m,g.isAAC=x.isAAC),T=x.id3,T>0&&(p.pid=T),c&&!f&&(b.logger.log("reparse from beginning"),c=!1,n=P-188),f=this.pmtParsed=!0;break;case 17:case 8191:break;default:c=!0}}else this.observer.trigger(y.default.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_&&(u=k(_))?(w(u,!0),h.pesData=null):h.pesData=_,A&&(u=k(A))?(g.isAAC?I(u):O(u),g.pesData=null):(A&&A.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=A),R&&(u=k(R))?(C(u),p.pesData=null):p.pesData=R,null==this.sampleAes?this.remuxer.remux(g,h,p,this._txtTrack,r,i,a):this.decryptAndRemux(g,h,p,this._txtTrack,r,i,a)},t.decryptAndRemux=function(e,t,r,i,a,n,s){if(e.samples&&e.isAAC){var o=this;this.sampleAes.decryptAacSamples(e.samples,0,function(){o.decryptAndRemuxAvc(e,t,r,i,a,n,s)})}else this.decryptAndRemuxAvc(e,t,r,i,a,n,s)},t.decryptAndRemuxAvc=function(e,t,r,i,a,n,s){if(t.samples){var o=this;this.sampleAes.decryptAvcSamples(t.samples,0,0,function(){o.remuxer.remux(e,t,r,i,a,n,s)})}else this.remuxer.remux(e,t,r,i,a,n,s)},t.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t._parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},t._trackUnknownPmt=function(e,t,r){var i=this.pmtUnknownTypes[e]||0;return 0===i&&(this.pmtUnknownTypes[e]=0,t.call(b.logger,r)),this.pmtUnknownTypes[e]++,i},t._parsePMT=function(e,t,r,i){var a,n,s,o,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=(15&e[t+1])<<8|e[t+2],n=t+3+a-4,s=(15&e[t+10])<<8|e[t+11],t+=12+s;t1;){var c=new Uint8Array(d[0].length+d[1].length);c.set(d[0]),c.set(d[1],d[0].length),d[0]=c,d.splice(1,1)}if(t=d[0],1===(t[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;if(r=t[7],192&r&&(s=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&r?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,s-o>54e5&&(b.logger.warn(Math.round((s-o)/9e4)+"s delta between PTS and DTS, align them"),s=o)):o=s),a=t[8],l=a+9,e.size<=l)return null;e.size-=l,n=new Uint8Array(e.size);for(var f=0,h=d.length;fg){l-=g;continue}t=t.subarray(l),g-=l,l=0}n.set(t,u),u+=g}return i&&(i-=a+3),{data:n,pts:s,dts:o,len:i}}return null},t.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var r=t.samples,i=r.length;if(isNaN(e.pts)){if(!i)return void t.dropped++;var a=r[i-1];e.pts=a.pts,e.dts=a.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&b.logger.log(e.pts+"/"+e.dts+":"+e.debug)},t._parseAVCPES=function(e,t){var r,i,a,n=this,s=this._avcTrack,o=this._parseAVCNALu(e.data),l=this.avcSample,u=!1,d=this.pushAccesUnit.bind(this),c=function(e,t,r,i){return{key:e,pts:t,dts:r,units:[],debug:i}};e.data=null,l&&o.length&&!s.audFound&&(d(l,s),l=this.avcSample=c(!1,e.pts,e.dts,"")),o.forEach(function(t){switch(t.type){case 1:i=!0,l||(l=n.avcSample=c(!0,e.pts,e.dts,"")),l.frame=!0;var o=t.data;if(u&&o.length>4){var f=new O(o).readSliceType();2!==f&&4!==f&&7!==f&&9!==f||(l.key=!0)}break;case 5:i=!0,l||(l=n.avcSample=c(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,r=new O(n.discardEPB(t.data)),r.readUByte();for(var h=0,g=0,p=!1,v=0;!p&&r.bytesAvailable>1;){h=0;do{v=r.readUByte(),h+=v}while(255===v);g=0;do{v=r.readUByte(),g+=v}while(255===v);if(4===h&&0!==r.bytesAvailable){p=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var m=r.readUByte(),y=r.readUByte(),E=31&m,T=[m,y];for(a=0;a16){var S=[];for(a=0;a<16;a++)S.push(r.readUByte().toString(16)),3!==a&&5!==a&&7!==a&&9!==a||S.push("-");var b=g-16,_=new Uint8Array(b);for(a=0;a0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts=0)i={data:e.subarray(f,s-u-1),type:n},c.push(i);else{var h=this._getLastNalUnit();if(h&&(d&&s<=4-d&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-d)),(r=s-u-1)>0)){var g=new Uint8Array(h.data.byteLength+r);g.set(h.data,0),g.set(e.subarray(0,r),h.data.byteLength),h.data=g}}s=0&&u>=0&&(i={data:e.subarray(f,o),type:n,state:u},c.push(i)),0===c.length){var p=this._getLastNalUnit();if(p){var v=new Uint8Array(p.data.byteLength+e.byteLength);v.set(p.data,0),v.set(e,p.data.byteLength),p.data=v}}return l.naluState=u,c},t.discardEPB=function(e){for(var t,r,i=e.byteLength,a=[],n=1;n1&&(b.logger.log("AAC: align PTS for overlapping frames by "+Math.round((T-c)/90)),c=T)}for(;i>24&255,t[1]=i>>16&255,t[2]=i>>8&255,t[3]=255&i,t.set(e,4),a=0,i=8;a>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))},e.moov=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(j+1)),a=Math.floor(r%(j+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,n)},e.sdtp=function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(i=0;i>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),l=t.width,u=t.height,d=t.pixelRatio[0],c=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,c>>24,c>>16&255,c>>8&255,255&c])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,n=t.height,s=Math.floor(i/(j+1)),o=Math.floor(i%(j+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),a=t.id,n=Math.floor(r/(j+1)),s=Math.floor(r%(j+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var i,a,n,s,o,l,u=t.samples||[],d=u.length,c=12+16*d,f=new Uint8Array(c);for(r+=8+c,f.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var r,i=e.moov(t);return r=new Uint8Array(e.FTYP.byteLength+i.byteLength),r.set(e.FTYP),r.set(i,e.FTYP.byteLength),r},e}(),H=K,V=9e4,Y=p(10),W=p(.2),q=null,X=function(){function e(e,t,r,i){if(this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===q){var a=navigator.userAgent.match(/Chrome\/(\d+)/i);q=a?parseInt(a[1]):0}}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this._initPTS=this._initDTS=e},t.resetInitSegment=function(){this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,r=e.reduce(function(e,r){var i=r.pts-e;return i<-4294967296?(t=!0,v(e,r.pts)):i>0?e:r.pts},e[0].pts);return t&&b.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,i,a,n,s){if(this.ISGenerated||this.generateIS(e,t,a),this.ISGenerated){var o=e.samples.length,l=t.samples.length,u=a,d=a;if(o&&l){var c=this.getVideoStartPts(t.samples),f=v(e.samples[0].pts,c)-c,h=f/t.inputTimeScale;u+=Math.max(0,h),d+=Math.max(0,-h)}if(o){e.timescale||(b.logger.warn("regenerate InitSegment as audio detected"),this.generateIS(e,t,a));var g=this.remuxAudio(e,u,n,s);if(l){var p;g&&(p=g.endPTS-g.startPTS),t.timescale||(b.logger.warn("regenerate InitSegment as video detected"),this.generateIS(e,t,a)),this.remuxVideo(t,d,n,p)}}else if(l){var m=this.remuxVideo(t,d,n,0,s);m&&e.codec&&this.remuxEmptyAudio(e,u,n,m)}}r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(y.default.FRAG_PARSED)},t.generateIS=function(e,t,r){var i,a,n=this.observer,s=e.samples,o=t.samples,l=this.typeSupported,u="audio/mp4",d={},c={tracks:d},f=void 0===this._initPTS;if(f&&(i=a=1/0),e.config&&s.length&&(e.timescale=e.samplerate,b.logger.log("audio sampling rate : "+e.samplerate),e.isAAC||(l.mpeg?(u="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3")),d.audio={container:u,codec:e.codec,initSegment:!e.isAAC&&l.mpeg?new Uint8Array:H.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(i=a=s[0].pts-Math.round(e.inputTimeScale*r))),t.sps&&t.pps&&o.length){var h=t.inputTimeScale;if(t.timescale=h,d.video={container:"video/mp4",codec:t.codec,initSegment:H.initSegment([t]),metadata:{width:t.width,height:t.height}},f){var g=this.getVideoStartPts(o),p=Math.round(h*r);a=Math.min(a,v(o[0].dts,g)-p),i=Math.min(i,g-p),this.observer.trigger(y.default.INIT_PTS_FOUND,{initPTS:i})}}else f&&d.audio&&this.observer.trigger(y.default.INIT_PTS_FOUND,{initPTS:i});Object.keys(d).length?(n.trigger(y.default.FRAG_PARSING_INIT_SEGMENT,c),this.ISGenerated=!0,f&&(this._initPTS=i,this._initDTS=a)):n.trigger(y.default.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.remuxVideo=function(e,t,r,i){var a,n,s,o,l,u=e.timescale,d=e.samples,c=[],f=d.length,h=this._initPTS,p=8,m=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,S=0,_=!1,A=this.nextAvcDts;if(0!==f){if(!r){A=t*u-(d[0].pts-v(d[0].dts,d[0].pts))}for(var R=0;RD.pts&&(S=Math.max(Math.min(S,D.pts-D.dts),-1*W)),D.dts0?R-1:R].dts&&(_=!0)}_&&d.sort(function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i||e.id-t.id}),o=d[0].dts,l=d[f-1].dts;var L=Math.round((l-o)/(f-1));if(S<0){if(S<-2*L){b.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+g(-L,!0)+" ms");for(var k=S,w=0;wL,P=O<-1;if(C||P){C?b.logger.warn("AVC: "+g(O,!0)+" ms ("+O+"dts) hole between fragments detected, filling it"):b.logger.warn("AVC: "+g(-O,!0)+" ms ("+O+"dts) overlapping between fragments detected"),o=A;var x=d[0].pts-O;d[0].dts=o,d[0].pts=x,b.logger.log("Video: First PTS/DTS adjusted: "+g(x,!0)+"/"+g(o,!0)+", delta: "+g(O,!0)+" ms")}}q&&q<75&&(o=Math.max(0,o));for(var F=0,N=0,M=0;M0?X-1:X].dts;if(ae.stretchShortVideoTrack){var se=ae.maxBufferHole,oe=Math.floor(se*u),le=(i?m+i*u:this.nextAudioPts)-z.pts;le>oe?(a=le-ne,a<0&&(a=ne),b.logger.log("It is approximately "+g(le,!1)+" ms to the next segment; using duration "+g(a,!1)+" ms for the last video frame.")):a=ne}else a=ne}J=Math.round(z.pts-z.dts),c.push({size:$,duration:a,cts:J,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:z.key?2:1,isNonSync:z.key?0:1}})}this.nextAvcDts=l+a;var ue=e.dropped;if(e.nbNalu=0,e.dropped=0,c.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var de=c[0].flags;de.dependsOn=2,de.isNonSync=0}e.samples=c,s=H.moof(e.sequenceNumber++,o,e),e.samples=[];var ce={data1:s,data2:n,startPTS:m/u,endPTS:(T+a)/u,startDTS:o/u,endDTS:this.nextAvcDts/u,type:"video",hasAudio:!1,hasVideo:!0,nb:c.length,dropped:ue};return this.observer.trigger(y.default.FRAG_PARSING_DATA,ce),ce}},t.remuxAudio=function(e,t,r,i){var a,n,s,o,l,u,d=e.inputTimeScale,c=e.timescale,f=d/c,h=e.isAAC?1024:1152,p=h*f,m=this._initPTS,T=!e.isAAC&&this.typeSupported.mpeg,S=T?0:8,_=e.samples,A=[],R=this.nextAudioPts;if(r|=_.length&&R&&(i&&Math.abs(t-R/d)<.1||Math.abs(_[0].pts-R-m)<20*p),_.forEach(function(e){e.pts=e.dts=v(e.pts-m,t*d)}),_=_.filter(function(e){return e.pts>=0}),0!==_.length){if(r||(R=i?Math.max(0,t*d):_[0].pts),e.isAAC)for(var D=this.config.maxAudioFramesDrift,L=0,k=R;L<_.length;){var w=_[L],I=w.pts,O=I-k;if(O<=-D*p)r||L>0?(b.logger.warn("Dropping 1 audio frame @ "+g(k,!0)/1e3+"s due to "+g(O,!0)+" ms overlap."),_.splice(L,1)):(b.logger.warn("Audio frame @ "+g(I,!0)/1e3+"s overlaps nextAudioPts by "+g(O,!0)+" ms."),k=I+p,L++);else if(O>=D*p&&O0&&V0&&(n=G.getSilentFrame(e.manifestCodec||e.codec,e.channelCount),n||(n=j.subarray()),N+=W*n.length);else if(V<-12){b.logger.log("drop overlapping AAC sample, expected/parsed/delta: "+g(R,!0)+" ms / "+g(K,!0)+" ms / "+g(-V,!0)+" ms"),N-=j.byteLength;continue}K=R}if(l=K,!(N>0))return;N+=S;try{s=new Uint8Array(N)}catch(e){return void this.observer.trigger(y.default.ERROR,{type:E.ErrorTypes.MUX_ERROR,details:E.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating audio mdat "+N})}if(!T){new DataView(s.buffer).setUint32(0,N),s.set(H.types.mdat,4)}for(var q=0;q=2&&(z=A[F-2].duration,a.duration=z),F){this.nextAudioPts=R=u+f*z,e.samples=A,o=T?new Uint8Array:H.moof(e.sequenceNumber++,l/f,e),e.samples=[];var Q=l/d,$=R/d,J={data1:o,data2:s,startPTS:Q,endPTS:$,startDTS:Q,endDTS:$,type:"audio",hasAudio:!0,hasVideo:!1,nb:F};return this.observer.trigger(y.default.FRAG_PARSING_DATA,J),J}return null}},t.remuxEmptyAudio=function(e,t,r,i){var a=e.inputTimeScale,n=e.samplerate?e.samplerate:a,s=a/n,o=this.nextAudioPts,l=(void 0!==o?o:i.startDTS*a)+this._initDTS,u=i.endDTS*a+this._initDTS,d=1024*s,c=Math.ceil((u-l)/d),f=G.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(b.logger.warn("remux empty Audio"),!f)return void b.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var h=[],g=0;g0&&null!=t&&null!=t.key&&"AES-128"===t.method){var h=this.decrypter;null==h&&(h=this.decrypter=new T.default(this.observer,this.config));var g=m();h.decrypt(e,t.key.buffer,t.iv.buffer,function(e){var h=m();f.observer.trigger(y.default.FRAG_DECRYPTED,{stats:{tstart:g,tdecrypt:h}}),f.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),i,a,n,s,o,l,u,d,c)})}else this.pushDecrypted(new Uint8Array(e),t,new Uint8Array(r),i,a,n,s,o,l,u,d,c)},t.pushDecrypted=function(e,t,r,i,a,n,s,o,l,u,d,c){var f=this.demuxer,h=this.remuxer;if(!f||s||o){for(var g,p=this.observer,v=this.typeSupported,m=this.config,T=[{demux:N,remux:z},{demux:L.default,remux:$},{demux:D,remux:z},{demux:U,remux:z}],S=0,b=T.length;S1?r-1:0),a=1;a1?r-1:0),a=1;a0)return t.subarray(i,i+a)},e._readSize=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},e.getTimeStamp=function(t){for(var r=e.getID3Frames(t),i=0;i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:d+=String.fromCharCode(s);break;case 12:case 13:o=e[c++],d+=String.fromCharCode((31&s)<<6|63&o);break;case 14:o=e[c++],l=e[c++],d+=String.fromCharCode((15&s)<<12|(63&o)<<6|(63&l)<<0)}}return d},e}(),o=s._utf8ArrayToStr;t.default=s},"./src/demux/mp4demuxer.js":/*!*********************************!*\ + !*** ./src/demux/mp4demuxer.js ***! + \*********************************/ +/*! exports provided: default */ +function(e,t,r){"use strict";r.r(t);var i=r(/*! ../utils/logger */"./src/utils/logger.js"),a=r(/*! ../events */"./src/events.js"),n=Math.pow(2,32)-1,s=function(){function e(e,t){this.observer=e,this.remuxer=t}var t=e.prototype;return t.resetTimeStamp=function(e){this.initPTS=e},t.resetInitSegment=function(t,r,i,n){if(t&&t.byteLength){var s=this.initData=e.parseInitSegment(t);null==r&&(r="mp4a.40.5"),null==i&&(i="avc1.42e01e");var o={};s.audio&&s.video?o.audiovideo={container:"video/mp4",codec:r+","+i,initSegment:n?t:null}:(s.audio&&(o.audio={container:"audio/mp4",codec:r,initSegment:n?t:null}),s.video&&(o.video={container:"video/mp4",codec:i,initSegment:n?t:null})),this.observer.trigger(a.default.FRAG_PARSING_INIT_SEGMENT,{tracks:o})}else r&&(this.audioCodec=r),i&&(this.videoCodec=i)},e.probe=function(t){return e.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.bin2str=function(e){return String.fromCharCode.apply(null,e)},e.readUint16=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r},e.readUint32=function(e,t){e.data&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r},e.writeUint32=function(e,t,r){e.data&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},e.findBox=function(t,r){var i,a,n,s,o,l,u,d=[];if(t.data?(l=t.start,s=t.end,t=t.data):(l=0,s=t.byteLength),!r.length)return null;for(i=l;i1?i+a:s,n===r[0]&&(1===r.length?d.push({data:t,start:i+8,end:u}):(o=e.findBox({data:t,start:i+8,end:u},r.slice(1)),o.length&&(d=d.concat(o)))),i=u;return d},e.parseSegmentIndex=function(t){var r,i=e.findBox(t,["moov"])[0],a=i?i.end:null,n=0,s=e.findBox(t,["sidx"]);if(!s||!s[0])return null;r=[],s=s[0];var o=s.data[0];n=0===o?8:16;var l=e.readUint32(s,n);n+=4;n+=0===o?8:16,n+=2;var u=s.end+0,d=e.readUint16(s,n);n+=2;for(var c=0;c>>31)return void console.warn("SIDX has hierarchical references (not supported)");var p=e.readUint32(s,f);f+=4,r.push({referenceSize:g,subsegmentDuration:p,info:{duration:p/l,start:u,end:u+g-1}}),u+=g,f+=4,n=f}return{earliestPresentationTime:0,timescale:l,version:o,referencesCount:d,references:r,moovEndOffset:a}},e.parseInitSegment=function(t){var r=[];return e.findBox(t,["moov","trak"]).forEach(function(t){var a=e.findBox(t,["tkhd"])[0];if(a){var n=a.data[a.start],s=0===n?12:20,o=e.readUint32(a,s),l=e.findBox(t,["mdia","mdhd"])[0];if(l){n=l.data[l.start],s=0===n?12:20;var u=e.readUint32(l,s),d=e.findBox(t,["mdia","hdlr"])[0];if(d){var c=e.bin2str(d.data.subarray(d.start+8,d.start+12)),f={soun:"audio",vide:"video"}[c];if(f){var h=e.findBox(t,["mdia","minf","stbl","stsd"]);if(h.length){h=h[0];var g=e.bin2str(h.data.subarray(h.start+12,h.start+16));i.logger.log("MP4Demuxer:"+f+":"+g+" found")}r[o]={timescale:u,type:f},r[f]={timescale:u,id:o}}}}}}),r},e.getStartDTS=function(t,r){var i,a,n;return i=e.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return e.findBox(r,["tfhd"]).map(function(i){var a,n;return a=e.readUint32(i,4),n=t[a].timescale||9e4,e.findBox(r,["tfdt"]).map(function(t){var r,i;return r=t.data[t.start],i=e.readUint32(t,4),1===r&&(i*=Math.pow(2,32),i+=e.readUint32(t,8)),i})[0]/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0},e.offsetStartDTS=function(t,r,i){e.findBox(r,["moof","traf"]).map(function(r){return e.findBox(r,["tfhd"]).map(function(a){var s=e.readUint32(a,4),o=t[s].timescale||9e4;e.findBox(r,["tfdt"]).map(function(t){var r=t.data[t.start],a=e.readUint32(t,4);if(0===r)e.writeUint32(t,4,a-i*o);else{a*=Math.pow(2,32),a+=e.readUint32(t,8),a-=i*o,a=Math.max(a,0);var s=Math.floor(a/(n+1)),l=Math.floor(a%(n+1));e.writeUint32(t,4,s),e.writeUint32(t,8,l)}})})})},t.append=function(t,r,i,n){var s=this.initData;s||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),s=this.initData);var o,l=this.initPTS;if(void 0===l){var u=e.getStartDTS(s,t);this.initPTS=l=u-r,this.observer.trigger(a.default.INIT_PTS_FOUND,{initPTS:l})}e.offsetStartDTS(s,t,l),o=e.getStartDTS(s,t),this.remuxer.remux(s.audio,s.video,null,null,o,i,n,t)},t.destroy=function(){},e}();t.default=s},"./src/errors.ts":/*!***********************!*\ + !*** ./src/errors.ts ***! + \***********************/ +/*! exports provided: ErrorTypes, ErrorDetails */ +function(e,t,r){"use strict";r.r(t),r.d(t,"ErrorTypes",function(){return i}),r.d(t,"ErrorDetails",function(){return a});var i;!function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(i||(i={}));var a;!function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException"}(a||(a={}))},"./src/events.js":/*!***********************!*\ + !*** ./src/events.js ***! + \***********************/ +/*! exports provided: default */ +function(e,t,r){"use strict";r.r(t);var i={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVELS_UPDATED:"hlsLevelsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",CUES_PARSED:"hlsCuesParsed",NON_NATIVE_TEXT_TRACKS_FOUND:"hlsNonNativeTextTracksFound",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition",LIVE_BACK_BUFFER_REACHED:"hlsLiveBackBufferReached"};t.default=i},"./src/hls.ts":/*!*********************************!*\ + !*** ./src/hls.ts + 50 modules ***! + \*********************************/ +/*! exports provided: default */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */ +/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */ +/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */ +function(e,t,r){"use strict";function i(e,t){for(var r=0;r=0;i--){var a=e[i];a.programDateTime=r.programDateTime-1e3*a.duration,r=a}}function f(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):(null===t||void 0===t?void 0:t.programDateTime)&&(e.programDateTime=t.endProgramDateTime),Object(Je.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function g(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function m(){return window.MediaSource||window.WebKitMediaSource}function y(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function E(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}}function T(e,t,r){var i=e[t],a=e[r],n=a.startPTS;if(Object(Je.isFiniteNumber)(n))r>t?(i.duration=n-i.start,i.duration<0&&et.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-n,a.duration<0&&et.logger.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"));else if(r>t){var s=i.cc===a.cc;a.start=i.start+(s&&i.minEndPTS?i.minEndPTS-i.start:i.duration)}else a.start=Math.max(i.start-a.duration,0)}function S(e,t,r,i,a,n){var s=r,o=i;if(Object(Je.isFiniteNumber)(t.startPTS)){var l=Math.abs(t.startPTS-r);Object(Je.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(l,t.deltaPTS):t.deltaPTS=l,s=Math.max(r,t.startPTS),r=Math.min(r,t.startPTS),o=Math.min(i,t.endPTS),i=Math.max(i,t.endPTS),a=Math.min(a,t.startDTS),n=Math.max(n,t.endDTS)}var u=r-t.start;t.start=t.startPTS=r,t.maxStartPTS=s,t.endPTS=i,t.minEndPTS=o,t.startDTS=a,t.endDTS=n,t.duration=i-r;var d=t.sn;if(!e||de.endSN)return 0;var c,f,h;for(c=d-e.startSN,f=e.fragments,f[c]=t,h=c;h>0;h--)T(f,h,h-1);for(h=c;hi.length))for(var n=0;nt?-1:0})}function w(e,t,r){var i=!1;return t&&t.details&&r&&(r.endCC>r.startCC||e&&e.cc=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;ie&&r.start?-1:0}function U(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function j(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function K(e,t){for(var r=0;r0;)e.removeCue(e.cues[0])}function Q(e,t){if(te[e.length-1].endTime)return e[e.length-1];for(var r=0,i=e.length-1;r<=i;){var a=Math.floor((i+r)/2);if(te[a].endTime))return e[a];r=a+1}}return e[r].endTime-t59?t(r[1],r[2],0,r[4]):t(0,r[1],r[2],r[4]):null}function ve(){this.values=Object.create(null)}function me(e,t,r,i){var a=i?e.split(i):[e];for(var n in a)if("string"==typeof a[n]){var s=a[n].split(r);if(2===s.length){var o=s[0],l=s[1];t(o,l)}}}function ye(e,t,r){function i(){var t=pe(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}var n=e;if(a(),t.startTime=i(),a(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=i(),a(),function(e,t){var i=new ve;me(e,function(e,t){switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){i.set(e,r[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),s=n[0];i.integer(e,s),i.percent(e,s)&&i.set("snapToLines",!1),i.alt(e,s,["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",wr,"end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",wr,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",wr,"end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var a=i.get("line","auto");"auto"===a&&-1===kr.line&&(a=-1),t.line=a,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",wr);var n=i.get("position","auto");"auto"===n&&50===kr.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}(e,t)}function Ee(e){return e.replace(//gi,"\n")}function Te(e,t,r,i){for(var a,n,s,o,l,u=[],d=window.VTTCue||TextTrackCue,c=0;c=16?o--:o++,navigator.userAgent.match(/Firefox\//)?n.line=c+1:n.line=c>7?c-2:c+1,n.align="left",n.position=Math.max(0,Math.min(100,o/32*100)),u.push(n),e&&e.addCue(n)}return u}function Se(e,t,r){r.a=e,r.b=t}function be(e,t,r){return r.a===e&&r.b===t}function _e(){return{a:null,b:null}}function Ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function De(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}function Le(e,t,r,i){return Math.min(t,i)-Math.max(e,r)}function ke(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}function we(e,t){for(var r=0;r1?t-1:0),i=1;i>8*(15-r)&255;return t},t.setDecryptDataFromLevelKey=function(e,t){var r=e;return(null===e||void 0===e?void 0:e.method)&&e.uri&&!e.iv&&(r=new ot(e.baseuri,e.reluri),r.method=e.method,r.iv=this.createInitializationVector(t)),r},s(e,[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=Object(Qe.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(e){this._url=e}},{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&et.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(Je.isFiniteNumber)(this.programDateTime))return null;var e=Object(Je.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}]),e}(),dt=function(){function e(e){this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=e,this.version=null}return l(e,[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(Je.isFiniteNumber)(this.fragments[0].programDateTime))}}]),e}(),ct=/^(\d+)x(\d+)$/,ft=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,ht=function(){function e(t){"string"==typeof t&&(t=e.parseAttrList(t));for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;iNumber.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.enumeratedString=function(e){return this[e]},t.decimalResolution=function(e){var t=ct.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(ft.lastIndex=0;null!==(t=ft.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1]]=i}return r},e}(),gt=ht,pt={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}},vt=/(?:#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)|#EXT-X-SESSION-DATA:([^\n\r]*)[\r\n]+)/g,mt=/#EXT-X-MEDIA:(.*)/g,yt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)([\S+ ?]+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),Et=/\.(mp4|m4s|m4v|m4a)$/i,Tt=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t},e.resolve=function(e,t){return Qe.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,r){var i=[],a={},n=!1;vt.lastIndex=0;for(var s;null!=(s=vt.exec(t));)if(s[1]){var o={},l=o.attrs=new gt(s[1]);o.url=e.resolve(s[2],r);var d=l.decimalResolution("RESOLUTION");d&&(o.width=d.width,o.height=d.height),o.bitrate=l.decimalInteger("AVERAGE-BANDWIDTH")||l.decimalInteger("BANDWIDTH"),o.name=l.NAME,function(e,t){["video","audio"].forEach(function(r){var i=e.filter(function(e){return u(e,r)});if(i.length){var a=i.filter(function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)});t[r+"Codec"]=a.length>0?a[0]:i[0],e=e.filter(function(e){return-1===i.indexOf(e)})}}),t.unknownCodecs=e}([].concat((l.CODECS||"").split(/[ ,]+/)),o),o.videoCodec&&-1!==o.videoCodec.indexOf("avc1")&&(o.videoCodec=e.convertAVC1ToAVCOTI(o.videoCodec)),i.push(o)}else if(s[3]){var c=new gt(s[3]);c["DATA-ID"]&&(n=!0,a[c["DATA-ID"]]=c)}return{levels:i,sessionData:n?a:null}},e.parseMasterPlaylistMedia=function(t,r,i,a){void 0===a&&(a=[]);var n,s=[],o=0;for(mt.lastIndex=0;null!==(n=mt.exec(t));){var l=new gt(n[1]);if(l.TYPE===i){var u={attrs:l,id:o++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE,type:i,default:"YES"===l.DEFAULT,autoselect:"YES"===l.AUTOSELECT,forced:"YES"===l.FORCED,lang:l.LANGUAGE};if(l.URI&&(u.url=e.resolve(l.URI,r)),a.length){var d=e.findGroup(a,u.groupId);u.audioCodec=d?d.codec:a[0].codec}s.push(u)}}return s},e.parseLevelPlaylist=function(e,t,r,i,a){var n,s,o,l=0,u=0,d=new dt(t),h=0,g=null,p=new ut,v=null;for(yt.lastIndex=0;null!==(n=yt.exec(e));){var m=n[1];if(m){p.duration=parseFloat(m);var y=(" "+n[2]).slice(1);p.title=y||null,p.tagList.push(y?["INF",m,y]:["INF",m])}else if(n[3]){if(Object(Je.isFiniteNumber)(p.duration)){var E=l++;p.type=i,p.start=u,o&&(p.levelkey=o),p.sn=E,p.level=r,p.cc=h,p.urlId=a,p.baseurl=t,p.relurl=(" "+n[3]).slice(1),f(p,g),d.fragments.push(p),g=p,u+=p.duration,p=new ut}}else if(n[4]){var T=(" "+n[4]).slice(1);g?p.setByteRange(T,g):p.setByteRange(T)}else if(n[5])p.rawProgramDateTime=(" "+n[5]).slice(1),p.tagList.push(["PROGRAM-DATE-TIME",p.rawProgramDateTime]),null===v&&(v=d.fragments.length);else{if(!(n=n[0].match(/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/))){et.logger.warn("No matches on slow regex match for level playlist!");continue}for(s=1;s=0&&(o.method=R,o.key=null,o.iv=L));break;case"START":var w=new gt(S),I=w.decimalFloatingPoint("TIME-OFFSET");Object(Je.isFiniteNumber)(I)&&(d.startTimeOffset=I);break;case"MAP":var O=new gt(S);p.relurl=O.URI,O.BYTERANGE&&p.setByteRange(O.BYTERANGE),p.baseurl=t,p.level=r,p.type=i,p.sn="initSegment",d.initSegment=p,p=new ut,p.rawProgramDateTime=d.initSegment.rawProgramDateTime;break;default:et.logger.warn("line parsed but not handled: "+n)}}}return p=g,p&&!p.relurl&&(d.fragments.pop(),u-=p.duration),d.totalduration=u,d.averagetargetduration=u/d.fragments.length,d.endSN=l-1,d.startCC=d.fragments[0]?d.fragments[0].cc:0,d.endCC=h,!d.initSegment&&d.fragments.length&&d.fragments.every(function(e){return Et.test(e.relurl)})&&(et.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),p=new ut,p.relurl=d.fragments[0].relurl,p.baseurl=t,p.level=r,p.type=i,p.sn="initSegment",d.initSegment=p,d.needSidxRanges=!0),v&&c(d.fragments,v),d},e}(),St=window,bt=St.performance,_t=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MANIFEST_LOADING,Ze.default.LEVEL_LOADING,Ze.default.AUDIO_TRACK_LOADING,Ze.default.SUBTITLE_TRACK_LOADING)||this,r.loaders={},r}h(t,e),t.canHaveQualityLevels=function(e){return e!==ze.AUDIO_TRACK&&e!==ze.SUBTITLE_TRACK},t.mapContextToLevelType=function(e){switch(e.type){case ze.AUDIO_TRACK:return at.AUDIO;case ze.SUBTITLE_TRACK:return at.SUBTITLE;default:return at.MAIN}},t.getResponseUrl=function(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r};var r=t.prototype;return r.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,a=r||i,n=new a(t);return e.loader=n,this.loaders[e.type]=n,n},r.getInternalLoader=function(e){return this.loaders[e.type]},r.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},r.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},r.destroy=function(){this.destroyInternalLoaders(),e.prototype.destroy.call(this)},r.onManifestLoading=function(e){this.load({url:e.url,type:ze.MANIFEST,level:0,id:null,responseType:"text"})},r.onLevelLoading=function(e){this.load({url:e.url,type:ze.LEVEL,level:e.level,id:e.id,responseType:"text"})},r.onAudioTrackLoading=function(e){this.load({url:e.url,type:ze.AUDIO_TRACK,level:null,id:e.id,responseType:"text"})},r.onSubtitleTrackLoading=function(e){this.load({url:e.url,type:ze.SUBTITLE_TRACK,level:null,id:e.id,responseType:"text"})},r.load=function(e){var t=this.hls.config;et.logger.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var r=this.getInternalLoader(e);if(r){var i=r.context;if(i&&i.url===e.url)return et.logger.trace("playlist request ongoing"),!1;et.logger.warn("aborting previous loader for type: "+e.type),r.abort()}var a,n,s,o;switch(e.type){case ze.MANIFEST:a=t.manifestLoadingMaxRetry,n=t.manifestLoadingTimeOut,s=t.manifestLoadingRetryDelay,o=t.manifestLoadingMaxRetryTimeout;break;case ze.LEVEL:a=0,o=0,s=0,n=t.levelLoadingTimeOut;break;default:a=t.levelLoadingMaxRetry,n=t.levelLoadingTimeOut,s=t.levelLoadingRetryDelay,o=t.levelLoadingMaxRetryTimeout}r=this.createInternalLoader(e);var l={timeout:n,maxRetry:a,retryDelay:s,maxRetryDelay:o},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return et.logger.debug("Calling internal loader delegate for URL: "+e.url),r.load(e,l,u),!0},r.loadsuccess=function(e,t,r,i){if(void 0===i&&(i=null),r.isSidxRequest)return this._handleSidxRequest(e,r),void this._handlePlaylistLoaded(e,t,r,i);if(this.resetInternalLoader(r.type),"string"!=typeof e.data)throw new Error('expected responseType of "text" for PlaylistLoader');var a=e.data;if(t.tload=bt.now(),0!==a.indexOf("#EXTM3U"))return void this._handleManifestParsingError(e,r,"no EXTM3U delimiter",i);a.indexOf("#EXTINF:")>0||a.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(e,t,r,i):this._handleMasterPlaylist(e,t,r,i)},r.loaderror=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!1,e)},r.loadtimeout=function(e,t,r){void 0===r&&(r=null),this._handleNetworkError(t,r,!0)},r._handleMasterPlaylist=function(e,r,i,a){var n=this.hls,s=e.data,o=t.getResponseUrl(e,i),l=Tt.parseMasterPlaylist(s,o),u=l.levels,d=l.sessionData;if(!u.length)return void this._handleManifestParsingError(e,i,"no level found in manifest",a);var c=u.map(function(e){return{id:e.attrs.AUDIO,codec:e.audioCodec}}),f=Tt.parseMasterPlaylistMedia(s,o,"AUDIO",c),h=Tt.parseMasterPlaylistMedia(s,o,"SUBTITLES"),g=Tt.parseMasterPlaylistMedia(s,o,"CLOSED-CAPTIONS");if(f.length){var p=!1;f.forEach(function(e){e.url||(p=!0)}),!1===p&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(et.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:{},url:""}))}n.trigger(Ze.default.MANIFEST_LOADED,{levels:u,audioTracks:f,subtitles:h,captions:g,url:o,stats:r,networkDetails:a,sessionData:d})},r._handleTrackOrLevelPlaylist=function(e,r,i,a){var n=this.hls,s=i.id,o=i.level,l=i.type,u=t.getResponseUrl(e,i),d=Object(Je.isFiniteNumber)(s)?s:0,c=Object(Je.isFiniteNumber)(o)?o:d,f=t.mapContextToLevelType(i),h=Tt.parseLevelPlaylist(e.data,u,c,f,d);if(h.tload=r.tload,!h.fragments.length)return void n.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0});if(l===ze.MANIFEST){var g={url:u,details:h};n.trigger(Ze.default.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:u,stats:r,networkDetails:a,sessionData:null})}if(r.tparsed=bt.now(),h.needSidxRanges){var p=h.initSegment.url;return void this.load({url:p,isSidxRequest:!0,type:l,level:o,levelDetails:h,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}i.levelDetails=h,this._handlePlaylistLoaded(e,r,i,a)},r._handleSidxRequest=function(e,t){if("string"==typeof e.data)throw new Error("sidx request must be made with responseType of array buffer");var r=st.default.parseSegmentIndex(new Uint8Array(e.data));if(r){var i=r.references,a=t.levelDetails;i.forEach(function(e,t){var r=e.info;if(a){var i=a.fragments[t];0===i.byteRange.length&&i.setByteRange(String(1+r.end-r.start)+"@"+String(r.start))}}),a&&a.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}},r._handleManifestParsingError=function(e,t,r,i){this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:e.url,reason:r,networkDetails:i})},r._handleNetworkError=function(e,t,r,i){void 0===r&&(r=!1),void 0===i&&(i=null),et.logger.info("A network error occured while loading a "+e.type+"-type playlist");var a,n,s=this.getInternalLoader(e);switch(e.type){case ze.MANIFEST:a=r?$e.ErrorDetails.MANIFEST_LOAD_TIMEOUT:$e.ErrorDetails.MANIFEST_LOAD_ERROR,n=!0;break;case ze.LEVEL:a=r?$e.ErrorDetails.LEVEL_LOAD_TIMEOUT:$e.ErrorDetails.LEVEL_LOAD_ERROR,n=!1;break;case ze.AUDIO_TRACK:a=r?$e.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:$e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,n=!1;break;default:n=!1}s&&(s.abort(),this.resetInternalLoader(e.type));var o={type:$e.ErrorTypes.NETWORK_ERROR,details:a,fatal:n,url:e.url,loader:s,context:e,networkDetails:t};i&&(o.response=i),this.hls.trigger(Ze.default.ERROR,o)},r._handlePlaylistLoaded=function(e,r,i,a){var n=i.type,s=i.level,o=i.id,l=i.levelDetails;if(!l||!l.targetduration)return void this._handleManifestParsingError(e,i,"invalid target duration",a);if(t.canHaveQualityLevels(i.type))this.hls.trigger(Ze.default.LEVEL_LOADED,{details:l,level:s||0,id:o||0,stats:r,networkDetails:a});else switch(n){case ze.AUDIO_TRACK:this.hls.trigger(Ze.default.AUDIO_TRACK_LOADED,{details:l,id:o,stats:r,networkDetails:a});break;case ze.SUBTITLE_TRACK:this.hls.trigger(Ze.default.SUBTITLE_TRACK_LOADED,{details:l,id:o,stats:r,networkDetails:a})}},t}(it),At=_t,Rt=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.FRAG_LOADING)||this,r.loaders={},r}g(t,e);var r=t.prototype;return r.destroy=function(){var t=this.loaders;for(var r in t){var i=t[r];i&&i.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onFragLoading=function(e){var t=e.frag,r=t.type,i=this.loaders,a=this.hls.config,n=a.fLoader,s=a.loader;t.loaded=0;var o=i[r];o&&(et.logger.warn("abort previous fragment loader for type: "+r),o.abort()),o=i[r]=t.loader=a.fLoader?new n(a):new s(a);var l,u,d;l={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var c=t.byteRangeStartOffset,f=t.byteRangeEndOffset;Object(Je.isFiniteNumber)(c)&&Object(Je.isFiniteNumber)(f)&&(l.rangeStart=c,l.rangeEnd=f),u={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},o.load(l,u,d)},r.loadsuccess=function(e,t,r,i){void 0===i&&(i=null);var a=e.data,n=r.frag;n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(Ze.default.FRAG_LOADED,{payload:a,frag:n,stats:t,networkDetails:i})},r.loaderror=function(e,t,r){void 0===r&&(r=null);var i=t.frag,a=i.loader;a&&a.abort(),this.loaders[i.type]=void 0,this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e,networkDetails:r})},r.loadtimeout=function(e,t,r){void 0===r&&(r=null);var i=t.frag,a=i.loader;a&&a.abort(),this.loaders[i.type]=void 0,this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t.frag,networkDetails:r})},r.loadprogress=function(e,t,r,i){void 0===i&&(i=null);var a=t.frag;a.loaded=e.loaded,this.hls.trigger(Ze.default.FRAG_LOAD_PROGRESS,{frag:a,stats:e,networkDetails:i})},t}(it),Dt=Rt,Lt=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.KEY_LOADING)||this,r.loaders={},r.decryptkey=null,r.decrypturl=null,r}p(t,e);var r=t.prototype;return r.destroy=function(){for(var t in this.loaders){var r=this.loaders[t];r&&r.destroy()}this.loaders={},e.prototype.destroy.call(this)},r.onKeyLoading=function(e){var t=e.frag,r=t.type,i=this.loaders[r];if(!t.decryptdata)return void et.logger.warn("Missing decryption data on fragment in onKeyLoading");var a=t.decryptdata.uri;if(a!==this.decrypturl||null===this.decryptkey){var n=this.hls.config;if(i&&(et.logger.warn("abort previous key loader for type:"+r),i.abort()),!a)return void et.logger.warn("key uri is falsy");t.loader=this.loaders[r]=new n.loader(n),this.decrypturl=a,this.decryptkey=null;var s={url:a,frag:t,responseType:"arraybuffer"},o={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.loader.load(s,o,l)}else this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(Ze.default.KEY_LOADED,{frag:t}))},r.loadsuccess=function(e,t,r){var i=r.frag;if(!i.decryptdata)return void et.logger.error("after key load, decryptdata unset");this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=void 0,delete this.loaders[i.type],this.hls.trigger(Ze.default.KEY_LOADED,{frag:i})},r.loaderror=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),delete this.loaders[r.type],this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},r.loadtimeout=function(e,t){var r=t.frag,i=r.loader;i&&i.abort(),delete this.loaders[r.type],this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.NETWORK_ERROR,details:$e.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},t}(it),kt=Lt,wt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},It=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.BUFFER_APPENDED,Ze.default.FRAG_BUFFERED,Ze.default.FRAG_LOADED)||this,r.bufferPadding=.2,r.fragments=Object.create(null),r.timeRanges=Object.create(null),r.config=t.config,r}v(t,e);var r=t.prototype;return r.destroy=function(){this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.config=null,it.prototype.destroy.call(this),e.prototype.destroy.call(this)},r.getBufferedFrag=function(e,t){var r=this.fragments,i=Object.keys(r).filter(function(i){var a=r[i];if(a.body.type!==t)return!1;if(!a.buffered)return!1;var n=a.body;return n.startPTS<=e&&e<=n.endPTS});if(0===i.length)return null;var a=i.pop();return r[a].body},r.detectEvictedFragments=function(e,t){var r=this;Object.keys(this.fragments).forEach(function(i){var a=r.fragments[i];if(a&&a.buffered){var n=a.range[e];if(n)for(var s=n.time,o=0;o=i&&t<=a){n.push({startPTS:Math.max(e,r.start(o)),endPTS:Math.min(t,r.end(o))});break}if(ei)n.push({startPTS:Math.max(e,r.start(o)),endPTS:Math.min(t,r.end(o))}),s=!0;else if(t<=i)break}return{time:n,partial:s}},r.getFragmentKey=function(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn},r.getPartialFragment=function(e){var t,r,i,a=this,n=null,s=0;return Object.keys(this.fragments).forEach(function(o){var l=a.fragments[o];a.isPartial(l)&&(r=l.body.startPTS-a.bufferPadding,i=l.body.endPTS+a.bufferPadding,e>=r&&e<=i&&(t=Math.min(e-r,i-e),s<=t&&(n=l.body,s=t)))}),n},r.getState=function(e){var t=this.getFragmentKey(e),r=this.fragments[t],i=wt.NOT_LOADED;return void 0!==r&&(i=r.buffered?!0===this.isPartial(r)?wt.PARTIAL:wt.OK:wt.APPENDING),i},r.isPartial=function(e){return!0===e.buffered&&(void 0!==e.range.video&&!0===e.range.video.partial||void 0!==e.range.audio&&!0===e.range.audio.partial)},r.isTimeBuffered=function(e,t,r){for(var i,a,n=0;n=i&&t<=a)return!0;if(t<=i)return!1}return!1},r.onFragLoaded=function(e){var t=e.frag;Object(Je.isFiniteNumber)(t.sn)&&!t.bitrateTest&&(this.fragments[this.getFragmentKey(t)]={body:t,range:Object.create(null),buffered:!1})},r.onBufferAppended=function(e){var t=this;this.timeRanges=e.timeRanges,Object.keys(this.timeRanges).forEach(function(e){var r=t.timeRanges[e];t.detectEvictedFragments(e,r)})},r.onFragBuffered=function(e){this.detectPartialFragments(e.frag)},r.hasFragment=function(e){var t=this.getFragmentKey(e);return void 0!==this.fragments[t]},r.removeFragment=function(e){var t=this.getFragmentKey(e);delete this.fragments[t]},r.removeAllFragments=function(){this.fragments=Object.create(null)},t}(it),Ot={search:function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){a=(r+i)/2|0,n=e[a];var s=t(n);if(s>0)r=a+1;else{if(!(s<0))return n;i=a-1}}return null}},Ct=Ot,Pt=function(){function e(){}return e.isBuffered=function(e,t){try{if(e)for(var r=e.buffered,i=0;i=r.start(i)&&t<=r.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(e,t,r){try{if(e){var i,a=e.buffered,n=[];for(i=0;is&&(i[n-1].end=e[a].end):i.push(e[a])}else i.push(e[a])}else i=e;for(var o,l=0,u=t,d=t,c=0;c=f&&t1?t-1:0),i=1;i0,d=l.nextStart||0;if(u||d){if(n){var c=l.len>2,f=!d||d-a>2&&!this.fragmentTracker.getPartialFragment(a);if(c||f)return;this.moved=!1}if(!this.moved&&this.stalled){var h=Math.max(d,l.start||0)-a;if(h>0&&h<=2)return void this._trySkipBufferHole(null)}var g=self.performance.now();if(null===i)return void(this.stalled=g);var p=g-i;!n&&p>=250&&this._reportStall(l.len);var v=Pt.bufferInfo(r,a,t.maxBufferHole);this._tryFixBufferStall(v,p)}}}else if(this.moved=!0,null!==i){if(this.stallReported){var m=self.performance.now()-i;et.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var r=this.config,i=this.fragmentTracker,a=this.media,n=a.currentTime,s=i.getPartialFragment(n);if(s){if(this._trySkipBufferHole(s))return}e.len>r.maxBufferHole&&t>1e3*r.highBufferWatchdogPeriod&&(et.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,et.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.MEDIA_ERROR,details:$e.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,r=this.hls,i=this.media,a=i.currentTime,n=0,s=0;s=n&&a1?i-1:0),n=1;n1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},r.doTick=function(){},t}(it),qt={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},Xt=function(e){function t(){return e.apply(this,arguments)||this}j(t,e);var r=t.prototype;return r.doTick=function(){},r.startLoad=function(){},r.stopLoad=function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragmentTracker.removeFragment(e)),this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=qt.STOPPED},r._streamEnded=function(e,t){var r=this.fragCurrent,i=this.fragmentTracker;if(!t.live&&r&&!r.backtracked&&r.sn===t.endSN&&!e.nextStart){var a=i.getState(r);return a===wt.PARTIAL||a===wt.OK}return!1},r.onMediaSeeking=function(){var e=this.config,t=this.media,r=this.mediaBuffer,i=this.state,a=t?t.currentTime:null,n=Pt.bufferInfo(r||t,a,this.config.maxBufferHole);if(et.logger.log("media seeking to "+(Object(Je.isFiniteNumber)(a)?a.toFixed(3):a)),i===qt.FRAG_LOADING){var s=this.fragCurrent;if(0===n.len&&s){var o=e.maxFragLookUpTolerance,l=s.start-o,u=s.start+s.duration+o;au?(s.loader&&(et.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),s.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=qt.IDLE):et.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else i===qt.ENDED&&(0===n.len&&(this.fragPrevious=null,this.fragCurrent=null),this.state=qt.IDLE);t&&(this.lastCurrentTime=a),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=a),this.tick()},r.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},r.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},r.onHandlerDestroyed=function(){this.state=qt.STOPPED,this.fragmentTracker=null},r.computeLivePosition=function(e,t){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;return e+Math.max(0,t.totalduration-r)},t}(Wt),zt=function(e){function t(t,r){var i;return i=e.call(this,t,Ze.default.MEDIA_ATTACHED,Ze.default.MEDIA_DETACHING,Ze.default.MANIFEST_LOADING,Ze.default.MANIFEST_PARSED,Ze.default.LEVEL_LOADED,Ze.default.LEVELS_UPDATED,Ze.default.KEY_LOADED,Ze.default.FRAG_LOADED,Ze.default.FRAG_LOAD_EMERGENCY_ABORTED,Ze.default.FRAG_PARSING_INIT_SEGMENT,Ze.default.FRAG_PARSING_DATA,Ze.default.FRAG_PARSED,Ze.default.ERROR,Ze.default.AUDIO_TRACK_SWITCHING,Ze.default.AUDIO_TRACK_SWITCHED,Ze.default.BUFFER_CREATED,Ze.default.BUFFER_APPENDED,Ze.default.BUFFER_FLUSHED)||this,i.fragmentTracker=r,i.config=t.config,i.audioCodecSwap=!1,i._state=qt.STOPPED,i.stallReported=!1,i.gapController=null,i.altAudio=!1,i.audioOnly=!1,i.bitrateTest=!1,i}V(t,e);var r=t.prototype;return r.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;-1===i&&(r.config.testBandwidth?(i=0,this.bitrateTest=!0):i=r.nextAutoLevel),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}t>0&&-1===e&&(et.logger.log("override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=qt.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this.forceStartLoad=!0,this.state=qt.STOPPED},r.stopLoad=function(){this.forceStartLoad=!1,e.prototype.stopLoad.call(this)},r.doTick=function(){switch(this.state){case qt.BUFFER_FLUSHING:this.fragLoadError=0;break;case qt.IDLE:this._doTickIdle();break;case qt.WAITING_LEVEL:var e=this.levels[this.level];e&&e.details&&(this.state=qt.IDLE);break;case qt.FRAG_LOADING_WAITING_RETRY:var t=window.performance.now(),r=this.retryDate;(!r||t>=r||this.media&&this.media.seeking)&&(et.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=qt.IDLE);break;case qt.ERROR:case qt.STOPPED:case qt.FRAG_LOADING:case qt.PARSING:case qt.PARSED:case qt.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},r._doTickIdle=function(){var e=this.hls,t=e.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&t.startFragPrefetch)){if(this.altAudio&&this.audioOnly)return void(this.demuxer.frag=null);var i;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=e.nextLoadLevel,n=this.levels[a];if(n){var s,o=n.bitrate;s=o?Math.max(8*t.maxBufferSize/o,t.maxBufferLength):t.maxBufferLength,s=Math.min(s,t.maxMaxBufferLength);var l=i=s)){et.logger.trace("buffer length of "+d.toFixed(3)+" is below max of "+s.toFixed(3)+". checking for more payload ..."),this.level=e.nextLoadLevel=a;var c=n.details;if(!c||c.live&&this.levelLastLoaded!==a)return void(this.state=qt.WAITING_LEVEL);if(this._streamEnded(u,c)){var f={};return this.altAudio&&(f.type="video"),this.hls.trigger(Ze.default.BUFFER_EOS,f),void(this.state=qt.ENDED)}this._fetchPayloadOrEos(i,u,c)}}}},r._fetchPayloadOrEos=function(e,t,r){var i=this.fragPrevious,a=(this.level,r.fragments),n=a.length;if(0!==n){var s,o=a[0].start,l=a[n-1].start+a[n-1].duration,u=t.end;if(r.initSegment&&!r.initSegment.data)s=r.initSegment;else if(r.live){var d=this.config.initialLiveManifestSize;if(nd&&d>l.currentTime&&(et.logger.log("buffer end: "+t.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+d.toFixed(3)),l.currentTime=d),this.nextLoadPosition=d}if(e.PTSKnown&&t>i&&l&&l.readyState)return null;if(this.startFragRequested&&!e.PTSKnown&&a)if(e.hasProgramDateTime)et.logger.log("live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),s=F(n,a.endProgramDateTime,o.maxFragLookUpTolerance);else{var c=a.sn+1;if(c>=e.startSN&&c<=e.endSN){var f=n[c-e.startSN];a.cc===f.cc&&(s=f,et.logger.log("live playlist, switching playlist, load frag with next SN: "+s.sn))}s||(s=Ct.search(n,function(e){return a.cc-e.cc}))&&et.logger.log("live playlist, switching playlist, load frag with same CC: "+s.sn)}return s},r._findFragment=function(e,t,r,i,a,n,s){var o,l=this.hls.config;if(an-l.maxFragLookUpTolerance?0:l.maxFragLookUpTolerance)}else o=i[r-1];if(o){var u=o.sn-s.startSN,d=t&&o.level===t.level,c=i[u-1],f=i[u+1];if(t&&o.sn===t.sn)if(d&&!o.backtracked)if(o.snl.maxBufferHole&&t.dropped&&u?(o=c,et.logger.warn("Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this")):(o=f,this.fragmentTracker.getState(o)!==wt.OK&&et.logger.log("Re-loading fragment with SN: "+o.sn))}else o=null;else o.backtracked&&(f&&f.backtracked?(et.logger.warn("Already backtracked from fragment "+f.sn+", will not backtrack to fragment "+o.sn+". Loading fragment "+f.sn),o=f):(et.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),o.dropped=0,c?(o=c,o.backtracked=!0):u&&(o=null)))}return o},r._loadKey=function(e,t){et.logger.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level),this.state=qt.KEY_LOADING,this.hls.trigger(Ze.default.KEY_LOADING,{frag:e})},r._loadFragment=function(e,t,r,i){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,"initSegment"!==e.sn&&(this.startFragRequested=!0),Object(Je.isFiniteNumber)(e.sn)&&!e.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),e.backtracked||a===wt.NOT_LOADED||a===wt.PARTIAL?(e.autoLevel=this.hls.autoLevelEnabled,e.bitrateTest=this.bitrateTest,et.logger.log("Loading "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], level "+this.level+", "+(this.loadedmetadata?"currentTime":"nextLoadPosition")+": "+parseFloat(r.toFixed(3))+", bufferEnd: "+parseFloat(i.toFixed(3))),this.hls.trigger(Ze.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=new Kt(this.hls,"main")),this.state=qt.FRAG_LOADING):a===wt.APPENDING&&this._reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e)},r.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,at.MAIN)},r.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.endPTS+.5):null},r._checkFragmentChanged=function(){var e,t,r=this.media;if(r&&r.readyState&&!1===r.seeking&&(t=r.currentTime,t>this.lastCurrentTime&&(this.lastCurrentTime=t),Pt.isBuffered(r,t)?e=this.getBufferedFrag(t):Pt.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){var i=e;if(i!==this.fragPlaying){this.hls.trigger(Ze.default.FRAG_CHANGED,{frag:i});var a=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(Ze.default.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}},r.immediateLevelSwitch=function(){if(et.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e,t=this.media;t?(e=t.paused)||t.pause():e=!0,this.previouslyPaused=e}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},r.immediateLevelSwitchEnd=function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,e.currentTime>0&&Pt.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())},r.nextLevelSwitch=function(){var e=this.media;if(e&&e.readyState){var t,r=this.getBufferedFrag(e.currentTime);if(r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),e.paused)t=0;else{var i=this.hls.nextLoadLevel,a=this.levels[i],n=this.fragLastKbps;t=n&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*n)+1:0}var s=this.getBufferedFrag(e.currentTime+t);if(s){var o=this.followingBufferedFrag(s);if(o){var l=this.fragCurrent;l&&l.loader&&l.loader.abort(),this.fragCurrent=null;var u=Math.max(s.endPTS,o.maxStartPTS+Math.min(this.config.maxFragLookUpTolerance,o.duration));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},r.flushMainBuffer=function(e,t){this.state=qt.BUFFER_FLUSHING;var r={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(Ze.default.BUFFER_FLUSHING,r)},r.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition),this.gapController=new Yt(r,t,this.fragmentTracker,this.hls)},r.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(et.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.backtracked=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.fragmentTracker.removeAllFragments(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},r.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:void 0;Object(Je.isFiniteNumber)(t)&&et.logger.log("media seeked to "+t.toFixed(3)),this.tick()},r.onManifestLoading=function(){et.logger.log("trigger BUFFER_RESET"),this.hls.trigger(Ze.default.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},r.onManifestParsed=function(e){var t,r=!1,i=!1;e.levels.forEach(function(e){(t=e.audioCodec)&&(-1!==t.indexOf("mp4a.40.2")&&(r=!0),-1!==t.indexOf("mp4a.40.5")&&(i=!0))}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&et.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.altAudio=e.altAudio,this.levels=e.levels,this.startFragRequested=!1;var a=this.config;(a.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(a.startPosition)},r.onLevelLoaded=function(e){var t=e.details,r=e.level,i=this.levels[this.levelLastLoaded],a=this.levels[r],n=t.totalduration,s=0;if(et.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+n),t.live||a.details&&a.details.live){var o=a.details;o&&t.fragments.length>0?(b(o,t),s=t.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(s,o),t.PTSKnown&&Object(Je.isFiniteNumber)(s)?et.logger.log("live playlist sliding:"+s.toFixed(3)):(et.logger.log("live playlist - outdated PTS, unknown sliding"),C(this.fragPrevious,i,t))):(et.logger.log("live playlist - first load, unknown sliding"),t.PTSKnown=!1,C(this.fragPrevious,i,t))}else t.PTSKnown=!1;if(a.details=t,this.levelLastLoaded=r,this.hls.trigger(Ze.default.LEVEL_UPDATED,{details:t,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var l=t.startTimeOffset;Object(Je.isFiniteNumber)(l)?(l<0&&(et.logger.log("negative start time offset "+l+", count from end of last fragment"),l=s+n+l),et.logger.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l):t.live?(this.startPosition=this.computeLivePosition(s,t),et.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===qt.WAITING_LEVEL&&(this.state=qt.IDLE),this.tick()},r.onKeyLoaded=function(){this.state===qt.KEY_LOADING&&(this.state=qt.IDLE,this.tick())},r.onFragLoaded=function(e){var t=this.fragCurrent,r=this.hls,i=this.levels,a=this.media,n=e.frag;if(this.state===qt.FRAG_LOADING&&t&&"main"===n.type&&n.level===t.level&&n.sn===t.sn){var s=e.stats,o=i[t.level],l=o.details;if(this.bitrateTest=!1,this.stats=s,et.logger.log("Loaded "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level),n.bitrateTest&&r.nextLoadLevel)this.state=qt.IDLE,this.startFragRequested=!1,s.tparsed=s.tbuffered=window.performance.now(),r.trigger(Ze.default.FRAG_BUFFERED,{stats:s,frag:t,id:"main"}),this.tick();else if("initSegment"===n.sn)this.state=qt.IDLE,s.tparsed=s.tbuffered=window.performance.now(),l.initSegment.data=e.payload,r.trigger(Ze.default.FRAG_BUFFERED,{stats:s,frag:t,id:"main"}),this.tick();else{et.logger.log("Parsing "+t.sn+" of ["+l.startSN+" ,"+l.endSN+"],level "+t.level+", cc "+t.cc),this.state=qt.PARSING,this.pendingBuffering=!0,this.appended=!1,n.bitrateTest&&(n.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:n}));var u=!(a&&a.seeking)&&(l.PTSKnown||!l.live),d=l.initSegment?l.initSegment.data:[],c=this._getAudioCodec(o),f=this.demuxer=this.demuxer||new Kt(this.hls,"main");f.push(e.payload,d,c,o.videoCodec,t,l.totalduration,u)}}this.fragLoadError=0},r.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===qt.PARSING){var i,a,n=e.tracks;if(this.audioOnly=n.audio&&!n.video,this.altAudio&&!this.audioOnly&&delete n.audio,a=n.audio){var s=this.levels[this.level].audioCodec,o=navigator.userAgent.toLowerCase();s&&this.audioCodecSwap&&(et.logger.log("swapping playlist audio codec"),s=-1!==s.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===o.indexOf("firefox")&&(s="mp4a.40.5"),-1!==o.indexOf("android")&&"audio/mpeg"!==a.container&&(s="mp4a.40.2",et.logger.log("Android: force audio codec to "+s)),a.levelCodec=s,a.id=e.id}a=n.video,a&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=e.id),this.hls.trigger(Ze.default.BUFFER_CODECS,n);for(i in n){a=n[i],et.logger.log("main track:"+i+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var l=a.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(Ze.default.BUFFER_APPENDING,{type:i,data:l,parent:"main",content:"initSegment"}))}this.tick()}},r.onFragParsingData=function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"main"===e.id&&i.sn===r.sn&&i.level===r.level&&("audio"!==e.type||!this.altAudio)&&this.state===qt.PARSING){var a=this.levels[this.level],n=r;if(Object(Je.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),!0===e.hasAudio&&n.addElementaryStream(nt.AUDIO),!0===e.hasVideo&&n.addElementaryStream(nt.VIDEO),et.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(n.dropped=e.dropped,n.dropped)if(n.backtracked)et.logger.warn("Already backtracked on this fragment, appending with the gap",n.sn);else{var s=a.details;if(!s||n.sn!==s.startSN)return et.logger.warn("missing video frame(s), backtracking fragment",n.sn),this.fragmentTracker.removeFragment(n),n.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=qt.IDLE,this.fragPrevious=n,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),void this.tick();et.logger.warn("missing video frame(s) on first frag, appending with gap",n.sn)}else n.backtracked=!1;var o=S(a.details,n,e.startPTS,e.endPTS,e.startDTS,e.endDTS),l=this.hls;l.trigger(Ze.default.LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:o,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach(function(r){r&&r.length&&t.state===qt.PARSING&&(t.appended=!0,t.pendingBuffering=!0,l.trigger(Ze.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"main",content:"data"}))}),this.tick()}},r.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"main"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===qt.PARSING&&(this.stats.tparsed=window.performance.now(),this.state=qt.PARSED,this._checkAppendedParsed())},r.onAudioTrackSwitching=function(e){var t=this.altAudio,r=!!e.url,i=e.id;if(!r){if(this.mediaBuffer!==this.media){et.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a.loader&&(et.logger.log("switching to main audio track, cancel main fragment load"),a.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=qt.IDLE}var n=this.hls;t&&n.trigger(Ze.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),n.trigger(Ze.default.AUDIO_TRACK_SWITCHED,{id:i})}},r.onAudioTrackSwitched=function(e){var t=e.id,r=!!this.hls.audioTracks[t].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(et.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},r.onBufferCreated=function(e){var t,r,i=e.tracks,a=!1;for(var n in i){var s=i[n];"main"===s.id?(r=n,t=s,"video"===n&&(this.videoBuffer=i[n].buffer)):a=!0}a&&t?(et.logger.log("alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=t.buffer):this.mediaBuffer=this.media},r.onBufferAppended=function(e){if("main"===e.parent){var t=this.state;t!==qt.PARSING&&t!==qt.PARSED||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},r._checkAppendedParsed=function(){if(!(this.state!==qt.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent;if(e){var t=this.mediaBuffer?this.mediaBuffer:this.media;et.logger.log("main buffered : "+Vt.toString(t.buffered)),this.fragPrevious=e;var r=this.stats;r.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(Ze.default.FRAG_BUFFERED,{stats:r,frag:e,id:"main"}),this.state=qt.IDLE}(this.loadedmetadata||this.startPosition<=0)&&this.tick()}},r.onError=function(e){var t=e.frag||this.fragCurrent;if(!t||"main"===t.type){var r=!!this.media&&Pt.isBuffered(this.media,this.media.currentTime)&&Pt.isBuffered(this.media,this.media.currentTime+.5);switch(e.details){case $e.ErrorDetails.FRAG_LOAD_ERROR:case $e.ErrorDetails.FRAG_LOAD_TIMEOUT:case $e.ErrorDetails.KEY_LOAD_ERROR:case $e.ErrorDetails.KEY_LOAD_TIMEOUT:if(!e.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);et.logger.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=window.performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=qt.FRAG_LOADING_WAITING_RETRY}else et.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=qt.ERROR;break;case $e.ErrorDetails.LEVEL_LOAD_ERROR:case $e.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==qt.ERROR&&(e.fatal?(this.state=qt.ERROR,et.logger.warn("streamController: "+e.details+",switch to "+this.state+" state ...")):e.levelRetry||this.state!==qt.WAITING_LEVEL||(this.state=qt.IDLE));break;case $e.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.parent||this.state!==qt.PARSING&&this.state!==qt.PARSED||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=qt.IDLE):(et.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},r._reduceMaxBufferLength=function(e){var t=this.config;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,et.logger.warn("main:reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},r._checkBuffer=function(){var e=this.media;if(e&&0!==e.readyState){var t=this.mediaBuffer?this.mediaBuffer:e,r=t.buffered;!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,r)}},r.onFragLoadEmergencyAborted=function(){this.state=qt.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},r.onBufferFlushed=function(){var e=this.mediaBuffer?this.mediaBuffer:this.media;if(e){var t=this.audioOnly?nt.AUDIO:nt.VIDEO;this.fragmentTracker.detectEvictedFragments(t,e.buffered)}this.state=qt.IDLE,this.fragPrevious=null},r.onLevelsUpdated=function(e){this.levels=e.levels},r.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},r._seekToStartPos=function(){var e=this.media,t=e.currentTime,r=this.startPosition;if(t!==r&&r>=0){if(e.seeking)return void et.logger.log("could not seek to "+r+", already seeking at "+t);var i=e.buffered.length?e.buffered.start(0):0,a=i-r;a>0&&a"+e),this.hls.trigger(Ze.default.STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getBufferedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?this.followingBufferedFrag(this.getBufferedFrag(e.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(e){this._liveSyncPosition=e}}]),t}(Xt),Qt=zt,$t=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MANIFEST_LOADED,Ze.default.LEVEL_LOADED,Ze.default.AUDIO_TRACK_SWITCHED,Ze.default.FRAG_LOADED,Ze.default.ERROR)||this,r.canload=!1,r.currentLevelIndex=null,r.manualLevelIndex=-1,r.timer=null,lt=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),r}q(t,e);var r=t.prototype;return r.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},r.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},r.startLoad=function(){var e=this._levels;this.canload=!0,this.levelRetryCount=0,e&&e.forEach(function(e){e.loadError=0;var t=e.details;t&&t.live&&(e.details=void 0)}),null!==this.timer&&this.loadLevel()},r.stopLoad=function(){this.canload=!1},r.onManifestLoaded=function(e){var t,r=[],i=[],a={},n=null,s=!1,o=!1;if(e.levels.forEach(function(e){var t=e.attrs;e.loadError=0,e.fragmentError=!1,s=s||!!e.videoCodec,o=o||!!e.audioCodec,lt&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),n=a[e.bitrate],n?n.url.push(e.url):(e.url=[e.url],e.urlId=0,a[e.bitrate]=e,r.push(e)),t&&(t.AUDIO&&E(n||e,"audio",t.AUDIO),t.SUBTITLES&&E(n||e,"text",t.SUBTITLES))}),s&&o&&(r=r.filter(function(e){return!!e.videoCodec})),r=r.filter(function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||d(t,"audio"))&&(!r||d(r,"video"))}),e.audioTracks&&(i=e.audioTracks.filter(function(e){return!e.audioCodec||d(e.audioCodec,"audio")}),i.forEach(function(e,t){e.id=t})),r.length>0){t=r[0].bitrate,r.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=r;for(var l=0;l=0&&e1&&d.loadError0){var t=this.currentLevelIndex,r=e.urlId,i=e.url[r];et.logger.log("Attempt loading level index "+t+" with URL-id "+r),this.hls.trigger(Ze.default.LEVEL_LOADING,{url:i,level:t,id:r})}}},r.removeLevel=function(e,t){var r=this.levels.filter(function(r,i){return i!==e||r.url.length>1&&void 0!==t&&(r.url=r.url.filter(function(e,r){return r!==t}),r.urlId=0,!0)}).map(function(e,t){var r=e.details;return r&&r.fragments&&r.fragments.forEach(function(e){e.level=t}),e});this._levels=r,this.hls.trigger(Ze.default.LEVELS_UPDATED,{levels:r})},W(t,[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;t&&(e=Math.min(e,t.length-1),this.currentLevelIndex===e&&t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),t}(it),Jt=r("./src/demux/id3.js"),Zt=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MEDIA_ATTACHED,Ze.default.MEDIA_DETACHING,Ze.default.FRAG_PARSING_METADATA,Ze.default.LIVE_BACK_BUFFER_REACHED)||this,r.id3Track=void 0,r.media=void 0,r}$(t,e);var r=t.prototype;return r.destroy=function(){it.prototype.destroy.call(this)},r.onMediaAttached=function(e){this.media=e.media,this.media},r.onMediaDetaching=function(){z(this.id3Track),this.id3Track=void 0,this.media=void 0},r.getID3Track=function(e){for(var t=0;t=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}(),ar=ir,nr=window,sr=nr.performance,or=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.FRAG_LOADING,Ze.default.FRAG_LOADED,Ze.default.FRAG_BUFFERED,Ze.default.ERROR)||this,r.lastLoadedFragLevel=0,r._nextAutoLevel=-1,r.hls=t,r.timer=null,r._bwEstimator=null,r.onCheck=r._abandonRulesCheck.bind(te(r)),r}re(t,e);var r=t.prototype;return r.destroy=function(){this.clearTimer(),it.prototype.destroy.call(this)},r.onFragLoading=function(e){var t=e.frag;if("main"===t.type&&(this.timer||(this.fragCurrent=t,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var r,i,a=this.hls,n=a.config,s=t.level,o=a.levels[s].details.live;o?(r=n.abrEwmaFastLive,i=n.abrEwmaSlowLive):(r=n.abrEwmaFastVoD,i=n.abrEwmaSlowVoD),this._bwEstimator=new ar(a,i,r,n.abrEwmaDefaultEstimate)}},r._abandonRulesCheck=function(){var e=this.hls,t=e.media,r=this.fragCurrent;if(r){var i=r.loader;if(!i||i.stats&&i.stats.aborted)return et.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var a=i.stats;if(t&&a&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var n=sr.now()-a.trequest,s=Math.abs(t.playbackRate);if(n>500*r.duration/s){var o=e.levels,l=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/n),u=o[r.level];if(!u)return;var d=u.realBitrate?Math.max(u.realBitrate,u.bitrate):u.bitrate,c=a.total?a.total:Math.max(a.loaded,Math.round(r.duration*d/8)),f=t.currentTime,h=(c-a.loaded)/l,g=(Pt.bufferInfo(t,f,e.config.maxBufferHole).end-f)/s;if(g<2*r.duration/s&&h>g){var p,v,m=e.minAutoLevel;for(v=r.level-1;v>m;v--){var y=o[v].realBitrate?Math.max(o[v].realBitrate,o[v].bitrate):o[v].bitrate;if(r.duration*y/(6.4*l)=i;u--){var d=l[u];if(d){var c=d.details,f=c?c.totalduration/c.fragments.length:t,h=!!c&&c.live,g=void 0;g=u<=e?s*r:o*r;var p=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,v=p*f/g;if(et.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(g)+"/"+p+"/"+f+"/"+n+"/"+v),g>p&&(!v||h&&!this.bitrateTestDelay||v=0)return f;et.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var h=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,p=i.abrBandWidthUpFactor;if(0===c){var v=this.bitrateTestDelay;if(v){h=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-v,et.logger.trace("bitrate test took "+Math.round(1e3*v)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),g=p=1}}return f=this._findBestLevel(s,o,d,a,t,c+h,g,p,r),Math.max(f,0)}}]),t}(it),lr=or,ur=m(),dr=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MEDIA_ATTACHING,Ze.default.MEDIA_DETACHING,Ze.default.MANIFEST_PARSED,Ze.default.BUFFER_RESET,Ze.default.BUFFER_APPENDING,Ze.default.BUFFER_CODECS,Ze.default.BUFFER_EOS,Ze.default.BUFFER_FLUSHING,Ze.default.LEVEL_PTS_UPDATED,Ze.default.LEVEL_UPDATED)||this,r._msDuration=null,r._levelDuration=null,r._levelTargetDuration=10,r._live=null,r._objectUrl=null,r._needsFlush=!1,r._needsEos=!1,r.config=void 0,r.audioTimestampOffset=void 0,r.bufferCodecEventsExpected=0,r._bufferCodecEventsTotal=0,r.media=null,r.mediaSource=null,r.segments=[],r.parent=void 0,r.appending=!1,r.appended=0,r.appendError=0,r.flushBufferCounter=0,r.tracks={},r.pendingTracks={},r.sourceBuffer={},r.flushRange=[],r._onMediaSourceOpen=function(){et.logger.log("media source opened"),r.hls.trigger(Ze.default.MEDIA_ATTACHED,{media:r.media});var e=r.mediaSource;e&&e.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},r._onMediaSourceClose=function(){et.logger.log("media source closed")},r._onMediaSourceEnded=function(){et.logger.log("media source ended")},r._onSBUpdateEnd=function(){if(r.audioTimestampOffset&&r.sourceBuffer.audio){var e=r.sourceBuffer.audio;et.logger.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+r.audioTimestampOffset),e.timestampOffset=r.audioTimestampOffset,delete r.audioTimestampOffset}r._needsFlush&&r.doFlush(),r._needsEos&&r.checkEos(),r.appending=!1;var t=r.parent,i=r.segments.reduce(function(e,r){return r.parent===t?e+1:e},0),a={},n=r.sourceBuffer;for(var s in n){var o=n[s];if(!o)throw Error("handling source buffer update end error: source buffer for "+s+" uninitilized and unable to update buffered TimeRanges.");a[s]=o.buffered}r.hls.trigger(Ze.default.BUFFER_APPENDED,{parent:t,pending:i,timeRanges:a}),r._needsFlush||r.doAppending(),r.updateMediaElementDuration(),0===i&&r.flushLiveBackBuffer()},r._onSBUpdateError=function(e){et.logger.error("sourceBuffer error:",e),r.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.MEDIA_ERROR,details:$e.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})},r.config=t.config,r}ie(t,e);var r=t.prototype;return r.destroy=function(){it.prototype.destroy.call(this)},r.onLevelPtsUpdated=function(e){var t=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(!i)throw Error("Level PTS Updated and source buffer for audio uninitalized");if(Math.abs(i.timestampOffset-e.start)>.1){var a=i.updating;try{i.abort()}catch(e){et.logger.warn("can not abort audio buffer: "+e)}a?this.audioTimestampOffset=e.start:(et.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}},r.onManifestParsed=function(e){var t=2;(e.audio&&!e.video||!e.altAudio)&&(t=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=t,et.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},r.onMediaAttaching=function(e){var t=this.media=e.media;if(t&&ur){var r=this.mediaSource=new ur;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),t.src=window.URL.createObjectURL(r),this._objectUrl=t.src}},r.onMediaDetaching=function(){et.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(e){et.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.media&&(this._objectUrl&&window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):et.logger.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.hls.trigger(Ze.default.MEDIA_DETACHED)},r.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.pendingTracks,r=Object.keys(t).length;(r&&!e||2===r)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},r.onBufferReset=function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{r&&(this.mediaSource&&this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this._onSBUpdateEnd),r.removeEventListener("error",this._onSBUpdateError))}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},r.onBufferCodecs=function(e){var t=this;Object.keys(this.sourceBuffer).length||(Object.keys(e).forEach(function(r){t.pendingTracks[r]=e[r]}),this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},r.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(var i in e)if(!t[i]){var a=e[i];if(!a)throw Error("source buffer exists for track "+i+", however track does not");var n=a.levelCodec||a.codec,s=a.container+";codecs="+n;et.logger.log("creating sourceBuffer("+s+")");try{var o=t[i]=r.addSourceBuffer(s);o.addEventListener("updateend",this._onSBUpdateEnd),o.addEventListener("error",this._onSBUpdateError),this.tracks[i]={buffer:o,codec:n,id:a.id,container:a.container,levelCodec:a.levelCodec}}catch(e){et.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.MEDIA_ERROR,details:$e.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:s})}}this.hls.trigger(Ze.default.BUFFER_CREATED,{tracks:this.tracks})},r.onBufferAppending=function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())},r.onBufferEos=function(e){for(var t in this.sourceBuffer)if(!e.type||e.type===t){var r=this.sourceBuffer[t];r&&!r.ended&&(r.ended=!0,et.logger.log(t+" sourceBuffer now EOS"))}this.checkEos()},r.checkEos=function(){var e=this.sourceBuffer,t=this.mediaSource;if(!t||"open"!==t.readyState)return void(this._needsEos=!1);for(var r in e){var i=e[r];if(i){if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}}et.logger.log("all media data are available, signal endOfStream() to MediaSource and stop loading fragment");try{t.endOfStream()}catch(e){et.logger.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1},r.onBufferFlushing=function(e){e.type?this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}):(this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"video"}),this.flushRange.push({start:e.startOffset,end:e.endOffset,type:"audio"})),this.flushBufferCounter=0,this.doFlush()},r.flushLiveBackBuffer=function(){if(this._live){var e=this.config.liveBackBufferLength;if(isFinite(e)&&!(e<0)){if(!this.media)return void et.logger.error("flushLiveBackBuffer called without attaching media");for(var t=this.media.currentTime,r=this.sourceBuffer,i=Object.keys(r),a=t-Math.max(e,this._levelTargetDuration),n=i.length-1;n>=0;n--){var s=i[n],o=r[s];if(o){var l=o.buffered;l.length>0&&a>l.start(0)&&this.removeBufferRange(s,o,0,a)&&this.hls.trigger(Ze.default.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a})}}}}},r.onLevelUpdated=function(e){var t=e.details;t.fragments.length>0&&(this._levelDuration=t.totalduration+t.fragments[0].start,this._levelTargetDuration=t.averagetargetduration||t.targetduration||10,this._live=t.live,this.updateMediaElementDuration())},r.updateMediaElementDuration=function(){var e,t=this.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer){var i=this.sourceBuffer[r];if(i&&!0===i.updating)return}e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(et.logger.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||!Object(Je.isFiniteNumber)(e))&&(et.logger.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},r.doFlush=function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;try{for(var i in r){var a=r[i];a&&(t+=a.buffered.length)}}catch(e){et.logger.error("error while accessing sourceBuffer.buffered")}this.appended=t,this.hls.trigger(Ze.default.BUFFER_FLUSHED)}},r.doAppending=function(){var e=this.config,t=this.hls,r=this.segments,i=this.sourceBuffer;if(Object.keys(i).length){if(!this.media||this.media.error)return this.segments=[],void et.logger.error("trying to append although a media error occured, flush segment and abort");if(!this.appending){var a=r.shift();if(a)try{var n=i[a.type];if(!n)return void this._onSBUpdateEnd();if(n.updating)return void r.unshift(a);n.ended=!1,this.parent=a.parent,n.appendBuffer(a.data),this.appendError=0,this.appended++,this.appending=!0}catch(i){et.logger.error("error while trying to append buffer:"+i.message),r.unshift(a);var s={type:$e.ErrorTypes.MEDIA_ERROR,parent:a.parent,details:"",fatal:!1};22===i.code?(this.segments=[],s.details=$e.ErrorDetails.BUFFER_FULL_ERROR):(this.appendError++,s.details=$e.ErrorDetails.BUFFER_APPEND_ERROR,this.appendError>e.appendErrorMaxRetry&&(et.logger.log("fail "+e.appendErrorMaxRetry+" times to append segment in sourceBuffer"),this.segments=[],s.fatal=!0)),t.trigger(Ze.default.ERROR,s)}}}},r.flushBuffer=function(e,t,r){var i=this.sourceBuffer;if(!Object.keys(i).length)return!0;var a="null";if(this.media&&(a=this.media.currentTime.toFixed(3)),et.logger.log("flushBuffer,pos/start/end: "+a+"/"+e+"/"+t),this.flushBufferCounter>=this.appended)return et.logger.warn("abort flushing too many retries"),!0;var n=i[r];if(n){if(n.ended=!1,n.updating)return et.logger.warn("cannot flush, sb updating in progress"),!1;if(this.removeBufferRange(r,n,e,t))return this.flushBufferCounter++,!1}return et.logger.log("buffer flushed"),!0},r.removeBufferRange=function(e,t,r,i){try{for(var a=0;a.5){var u="null";return this.media&&(u=this.media.currentTime.toString()),et.logger.log("sb remove "+e+" ["+o+","+l+"], of ["+n+","+s+"], pos:"+u),t.remove(o,l),!0}}}catch(e){et.logger.warn("removeBufferRange failed",e)}return!1},t}(it),cr=dr,fr=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.FPS_DROP_LEVEL_CAPPING,Ze.default.MEDIA_ATTACHING,Ze.default.MANIFEST_PARSED,Ze.default.LEVELS_UPDATED,Ze.default.BUFFER_CODECS,Ze.default.MEDIA_DETACHING)||this,r.autoLevelCapping=Number.POSITIVE_INFINITY,r.firstLevel=null,r.levels=[],r.media=null,r.restrictedLevels=[],r.timer=null,r.clientRect=null,r}se(t,e);var r=t.prototype;return r.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.clientRect=null,this.stopCapping())},r.onFpsDropLevelCapping=function(e){t.isLevelAllowed(e.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(e.droppedLevel)},r.onMediaAttaching=function(e){this.media=e.media instanceof window.HTMLVideoElement?e.media:null},r.onManifestParsed=function(e){var t=this.hls;this.restrictedLevels=[],this.levels=e.levels,this.firstLevel=e.firstLevel,t.config.capLevelToPlayerSize&&e.video&&this.startCapping()},r.onBufferCodecs=function(e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},r.onLevelsUpdated=function(e){this.levels=e.levels},r.onMediaDetaching=function(){this.stopCapping()},r.detectPlayerSize=function(){if(this.media){var e=this.levels?this.levels.length:0;if(e){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e-1),t.autoLevelCapping>this.autoLevelCapping&&t.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},r.getMaxLevel=function(e){var r=this;if(!this.levels)return-1;var i=this.levels.filter(function(i,a){return t.isLevelAllowed(a,r.restrictedLevels)&&a<=e});return this.clientRect=null,t.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},r.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},r.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},r.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},t.getMaxLevelByMediaSize=function(e,t,r){if(!e||e&&!e.length)return-1;for(var i=e.length-1,a=0;a=t||n.height>=r)&&function(e,t){return!t||(e.width!==t.width||e.height!==t.height)}(n,e[a+1])){i=a;break}}return i},ne(t,[{key:"mediaWidth",get:function(){return this.getDimensions().width*t.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*t.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}}]),t}(it),hr=fr,gr=window,pr=gr.performance,vr=function(e){function t(t){return e.call(this,t,Ze.default.MEDIA_ATTACHING)||this}oe(t,e);var r=t.prototype;return r.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},r.onMediaAttaching=function(e){var t=this.hls.config;if(t.capLevelOnFPSDrop){"function"==typeof(this.video=e.media instanceof window.HTMLVideoElement?e.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),t.fpsDroppedMonitoringPeriod)}},r.checkFPS=function(e,t,r){var i=pr.now();if(t){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*n/a,l=this.hls;if(l.trigger(Ze.default.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),o>0&&n>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;et.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(Ze.default.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},r.checkFPSInterval=function(){var e=this.video;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},t}(it),mr=vr,yr=function(){function e(e){e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}var t=e.prototype;return t.destroy=function(){this.abort(),this.loader=null},t.abort=function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},t.load=function(e,t,r){this.context=e,this.config=t,this.callbacks=r,this.stats={trequest:window.performance.now(),retry:0},this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e,t=this.context;e=this.loader=new window.XMLHttpRequest;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,t.url)}catch(r){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},t.readystatechange=function(e){var t=e.currentTarget,r=t.readyState,i=this.stats,a=this.context,n=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(window.performance.now(),i.trequest)),4===r){var s=t.status;if(s>=200&&s<300){i.tload=Math.max(i.tfirst,window.performance.now());var o,l;"arraybuffer"===a.responseType?(o=t.response,l=o.byteLength):(o=t.responseText,l=o.length),i.loaded=i.total=l;var u={url:t.responseURL,data:o};this.callbacks.onSuccess(u,i,a,t)}else i.retry>=n.maxRetry||s>=400&&s<499?(et.logger.error(s+" while loading "+a.url),this.callbacks.onError({code:s,text:t.statusText},a,t)):(et.logger.warn(s+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,n.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),n.timeout)},t.loadtimeout=function(){et.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.loadprogress=function(e){var t=e.currentTarget,r=this.stats;r.loaded=e.loaded,e.lengthComputable&&(r.total=e.total);var i=this.callbacks.onProgress;i&&i(r,this.context,null,t)},e}(),Er=yr,Tr=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MANIFEST_LOADING,Ze.default.MANIFEST_PARSED,Ze.default.AUDIO_TRACK_LOADED,Ze.default.AUDIO_TRACK_SWITCHED,Ze.default.LEVEL_LOADED,Ze.default.ERROR)||this,r._trackId=-1,r._selectDefaultTrack=!0,r.tracks=[],r.trackIdBlacklist=Object.create(null),r.audioGroupId=null,r}de(t,e);var r=t.prototype;return r.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},r.onManifestParsed=function(e){var t=this.tracks=e.audioTracks||[];this.hls.trigger(Ze.default.AUDIO_TRACKS_UPDATED,{audioTracks:t}),this._selectAudioGroup(this.hls.nextLoadLevel)},r.onAudioTrackLoaded=function(e){if(e.id>=this.tracks.length)return void et.logger.warn("Invalid audio track id:",e.id);if(et.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.hasInterval()){var t=1e3*e.details.targetduration;this.setInterval(t)}!e.details.live&&this.hasInterval()&&this.clearInterval()},r.onAudioTrackSwitched=function(e){var t=this.tracks[e.id].groupId;t&&this.audioGroupId!==t&&(this.audioGroupId=t)},r.onLevelLoaded=function(e){this._selectAudioGroup(e.level)},r.onError=function(e){e.type===$e.ErrorTypes.NETWORK_ERROR&&(e.fatal&&this.clearInterval(),e.details===$e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR&&(et.logger.warn("Network failure on audio-track id:",e.context.id),this._handleLoadError()))},r._setAudioTrack=function(e){if(this._trackId===e&&this.tracks[this._trackId].details)return void et.logger.debug("Same id as current audio-track passed, and track details available -> no-op");if(e<0||e>=this.tracks.length)return void et.logger.warn("Invalid id passed to audio-track controller");var t=this.tracks[e];et.logger.log("Now switching to audio-track index "+e),this.clearInterval(),this._trackId=e;var r=t.url,i=t.type,a=t.id;this.hls.trigger(Ze.default.AUDIO_TRACK_SWITCHING,{id:a,type:i,url:r}),this._loadTrackDetailsIfNeeded(t)},r.doTick=function(){this._updateTrack(this._trackId)},r._selectAudioGroup=function(e){var t=this.hls.levels[e];if(t&&t.audioGroupIds){var r=t.audioGroupIds[t.urlId];this.audioGroupId!==r&&(this.audioGroupId=r,this._selectInitialAudioTrack())}},r._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var r=this.tracks[this._trackId],i=null;if(r&&(i=r.name),this._selectDefaultTrack){var a=t.filter(function(e){return e.default});a.length?t=a:et.logger.warn("No default audio tracks defined")}var n=!1,s=function(){t.forEach(function(t){n||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e._setAudioTrack(t.id),n=!0)})};s(),n||(i=null,s()),n||(et.logger.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.MEDIA_ERROR,details:$e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},r._needsTrackLoading=function(e){var t=e.details,r=e.url;return!(t&&!t.live)&&!!r},r._loadTrackDetailsIfNeeded=function(e){if(this._needsTrackLoading(e)){var t=e.url,r=e.id;et.logger.log("loading audio-track playlist for id: "+r),this.hls.trigger(Ze.default.AUDIO_TRACK_LOADING,{url:t,id:r})}},r._updateTrack=function(e){if(!(e<0||e>=this.tracks.length)){this.clearInterval(),this._trackId=e,et.logger.log("trying to update audio-track "+e);var t=this.tracks[e];this._loadTrackDetailsIfNeeded(t)}},r._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var e=this._trackId,t=this.tracks[e],r=t.name,i=t.language,a=t.groupId;et.logger.warn("Loading failed on audio track id: "+e+", group-id: "+a+', name/language: "'+r+'" / "'+i+'"');for(var n=e,s=0;s0&&-1===e?(et.logger.log("audio:override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=qt.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=qt.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=e,this.state=qt.STOPPED},r.doTick=function(){var e,t,r,i=this.hls,a=i.config;switch(this.state){case qt.ERROR:case qt.PAUSED:case qt.BUFFER_FLUSHING:break;case qt.STARTING:this.state=qt.WAITING_TRACK,this.loadedmetadata=!1;break;case qt.IDLE:var n=this.tracks;if(!n)break;if(!this.media&&(this.startFragRequested||!a.startFragPrefetch))break;if(this.loadedmetadata)e=this.media.currentTime;else if(void 0===(e=this.nextLoadPosition))break;var s=this.mediaBuffer?this.mediaBuffer:this.media,o=this.videoBuffer?this.videoBuffer:this.media,l=eS||u.nextStart))return;et.logger.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=S+.05}if(r.initSegment&&!r.initSegment.data)y=r.initSegment;else if(f<=S){if(y=E[0],null!==this.videoTrackCC&&y.cc!==this.videoTrackCC&&(y=k(E,this.videoTrackCC)),r.live&&y.loadIdx&&y.loadIdx===this.fragLoadIdx){var _=u.nextStart?u.nextStart:S;return et.logger.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(_+.05)),void(this.media.currentTime=_+.05)}}else{var A,R=a.maxFragLookUpTolerance,D=h?E[h.sn-E[0].sn+1]:void 0;fb-R&&(R=0),A=D&&!M(f,R,D)?D:Ct.search(E,function(e){return M(f,R,e)})):A=E[T-1],A&&(y=A,S=A.start,h&&y.level===h.level&&y.sn===h.sn&&(y.sn=w||I)&&(et.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=qt.IDLE);break;case qt.WAITING_INIT_PTS:var O=this.waitingFragment;if(O){var C=O.frag.cc;if(void 0!==this.initPTS[C])this.waitingFragment=null,this.state=qt.FRAG_LOADING,this.onFragLoaded(O);else if(this.videoTrackCC!==this.waitingVideoCC)et.logger.log("Waiting fragment cc ("+C+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var P=Pt.bufferInfo(this.mediaBuffer,this.media.currentTime,a.maxBufferHole),x=M(P.end,a.maxFragLookUpTolerance,O.frag);x<0&&(et.logger.log("Waiting fragment cc ("+C+") @ "+O.frag.start+" cancelled because another fragment at "+P.end+" is needed"),this.clearWaitingFragment())}}else this.state=qt.IDLE;break;case qt.STOPPED:case qt.FRAG_LOADING:case qt.PARSING:case qt.PARSED:case qt.ENDED:}},r.clearWaitingFragment=function(){var e=this.waitingFragment;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingFragment=null,this.waitingVideoCC=null,this.state=qt.IDLE)},r.onMediaAttached=function(e){var t=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)},r.onMediaDetaching=function(){var e=this.media;e&&e.ended&&(et.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},r.onAudioTracksUpdated=function(e){et.logger.log("audio tracks updated"),this.tracks=e.audioTracks},r.onAudioTrackSwitching=function(e){var t=!!e.url;this.trackId=e.id,this.fragCurrent=null,this.clearWaitingFragment(),this.state=qt.PAUSED,t?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),t&&(this.audioSwitch=!0,this.state=qt.IDLE),this.tick()},r.onAudioTrackLoaded=function(e){var t=e.details,r=e.id,i=this.tracks[r],a=i.details,n=t.totalduration,s=0;if(et.logger.log("track "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+n),t.live||a&&a.live?a&&t.fragments.length>0?(b(a,t),s=t.fragments[0].start,t.PTSKnown?et.logger.log("live audio playlist sliding:"+s.toFixed(3)):et.logger.log("live audio playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,et.logger.log("live audio playlist - first load, unknown sliding")):t.PTSKnown=!1,i.details=t,!this.startFragRequested){if(-1===this.startPosition){var o=t.startTimeOffset;Object(Je.isFiniteNumber)(o)?(et.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o):t.live?(this.startPosition=this.computeLivePosition(s,t),et.logger.log("compute startPosition for audio-track to "+this.startPosition)):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===qt.WAITING_TRACK&&(this.state=qt.IDLE),this.tick()},r.onKeyLoaded=function(){this.state===qt.KEY_LOADING&&(this.state=qt.IDLE,this.tick())},r.onFragLoaded=function(e){var t=this.fragCurrent,r=e.frag;if(this.state===qt.FRAG_LOADING&&t&&"audio"===r.type&&r.level===t.level&&r.sn===t.sn){var i=this.tracks[this.trackId],a=i.details,n=a.totalduration,s=t.level,o=t.sn,l=t.cc,u=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",d=this.stats=e.stats;if("initSegment"===o)this.state=qt.IDLE,d.tparsed=d.tbuffered=_r.now(),a.initSegment.data=e.payload,this.hls.trigger(Ze.default.FRAG_BUFFERED,{stats:d,frag:t,id:"audio"}),this.tick();else{this.state=qt.PARSING,this.appended=!1,this.demuxer||(this.demuxer=new Kt(this.hls,"audio"));var c=this.initPTS[l],f=a.initSegment?a.initSegment.data:[];if(void 0!==c){this.pendingBuffering=!0,et.logger.log("Demuxing "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s);this.demuxer.push(e.payload,f,u,null,t,n,!1,c)}else et.logger.log("Unknown video PTS for cc "+l+", waiting for video PTS before demuxing audio frag "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s),this.waitingFragment=e,this.waitingVideoCC=this.videoTrackCC,this.state=qt.WAITING_INIT_PTS}}this.fragLoadError=0},r.onFragParsingInitSegment=function(e){var t=this.fragCurrent,r=e.frag;if(t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===qt.PARSING){var i,a=e.tracks;if(a.video&&delete a.video,i=a.audio){i.levelCodec=i.codec,i.id=e.id,this.hls.trigger(Ze.default.BUFFER_CODECS,a),et.logger.log("audio track:audio,container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var n=i.initSegment;if(n){var s={type:"audio",data:n,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[s]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(Ze.default.BUFFER_APPENDING,s))}this.tick()}}},r.onFragParsingData=function(e){var t=this,r=this.fragCurrent,i=e.frag;if(r&&"audio"===e.id&&"audio"===e.type&&i.sn===r.sn&&i.level===r.level&&this.state===qt.PARSING){var a=this.trackId,n=this.tracks[a],s=this.hls;Object(Je.isFiniteNumber)(e.endPTS)||(e.endPTS=e.startPTS+r.duration,e.endDTS=e.startDTS+r.duration),r.addElementaryStream(nt.AUDIO),et.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),S(n.details,r,e.startPTS,e.endPTS);var o=this.media,l=!1;if(this.audioSwitch)if(o&&o.readyState){var u=o.currentTime;et.logger.log("switching audio track : currentTime:"+u),u>=e.startPTS&&(et.logger.log("switching audio track : flushing all audio"),this.state=qt.BUFFER_FLUSHING,s.trigger(Ze.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),l=!0,this.audioSwitch=!1,s.trigger(Ze.default.AUDIO_TRACK_SWITCHED,{id:a}))}else this.audioSwitch=!1,s.trigger(Ze.default.AUDIO_TRACK_SWITCHED,{id:a});var d=this.pendingData;if(!d)return et.logger.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void s.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach(function(t){t&&t.length&&d.push({type:e.type,data:t,parent:"audio",content:"data"})}),!l&&d.length&&(d.forEach(function(e){t.state===qt.PARSING&&(t.pendingBuffering=!0,t.hls.trigger(Ze.default.BUFFER_APPENDING,e))}),this.pendingData=[],this.appended=!0)),this.tick()}},r.onFragParsed=function(e){var t=this.fragCurrent,r=e.frag;t&&"audio"===e.id&&r.sn===t.sn&&r.level===t.level&&this.state===qt.PARSING&&(this.stats.tparsed=_r.now(),this.state=qt.PARSED,this._checkAppendedParsed())},r.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},r.onBufferCreated=function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},r.onBufferAppended=function(e){if("audio"===e.parent){var t=this.state;t!==qt.PARSING&&t!==qt.PARSED||(this.pendingBuffering=e.pending>0,this._checkAppendedParsed())}},r._checkAppendedParsed=function(){if(!(this.state!==qt.PARSED||this.appended&&this.pendingBuffering)){var e=this.fragCurrent,t=this.stats,r=this.hls;if(e){this.fragPrevious=e,t.tbuffered=_r.now(),r.trigger(Ze.default.FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;i&&et.logger.log("audio buffered : "+Vt.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(Ze.default.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=qt.IDLE}this.tick()}},r.onError=function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case $e.ErrorDetails.FRAG_LOAD_ERROR:case $e.ErrorDetails.FRAG_LOAD_TIMEOUT:var r=e.frag;if(r&&"audio"!==r.type)break;if(!e.fatal){var i=this.fragLoadError;i?i++:i=1;var a=this.config;if(i<=a.fragLoadingMaxRetry){this.fragLoadError=i;var n=Math.min(Math.pow(2,i-1)*a.fragLoadingRetryDelay,a.fragLoadingMaxRetryTimeout);et.logger.warn("AudioStreamController: frag loading failed, retry in "+n+" ms"),this.retryDate=_r.now()+n,this.state=qt.FRAG_LOADING_WAITING_RETRY}else et.logger.error("AudioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.state=qt.ERROR}break;case $e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case $e.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case $e.ErrorDetails.KEY_LOAD_ERROR:case $e.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==qt.ERROR&&(this.state=e.fatal?qt.ERROR:qt.IDLE,et.logger.warn("AudioStreamController: "+e.details+" while loading frag, now switching to "+this.state+" state ..."));break;case $e.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===e.parent&&(this.state===qt.PARSING||this.state===qt.PARSED)){var s=this.mediaBuffer,o=this.media.currentTime;if(s&&Pt.isBuffered(s,o)&&Pt.isBuffered(s,o+.5)){var l=this.config;l.maxMaxBufferLength>=l.maxBufferLength&&(l.maxMaxBufferLength/=2,et.logger.warn("AudioStreamController: reduce max buffer length to "+l.maxMaxBufferLength+"s")),this.state=qt.IDLE}else et.logger.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=qt.BUFFER_FLUSHING,this.hls.trigger(Ze.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},r.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(et.logger.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach(function(t){e.hls.trigger(Ze.default.BUFFER_APPENDING,t)}),this.appended=!0,this.pendingData=[],this.state=qt.PARSED):(this.state=qt.IDLE,this.fragPrevious=null,this.tick())},fe(t,[{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,et.logger.log("audio stream:"+t+"->"+e)}},get:function(){return this._state}}]),t}(Xt),Rr=Ar,Dr=function(){function e(e){return"string"==typeof e&&(!!n[e.toLowerCase()]&&e.toLowerCase())}function t(e){return"string"==typeof e&&(!!s[e.toLowerCase()]&&e.toLowerCase())}function r(e){for(var t=1;t100)throw new Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},l,{get:function(){return T},set:function(e){var r=t(e);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},l,{get:function(){return S},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");S=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},l,{get:function(){return b},set:function(e){var r=t(e);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");b=r,this.hasBeenReset=!0}})),o.displayState=void 0}if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var a="auto",n={"":!0,lr:!0,rl:!0},s={start:!0,middle:!0,end:!0,left:!0,right:!0};return i.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},i}(),Lr=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}};ve.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,r){for(var i=0;i=0&&t<=100)&&(this.set(e,t),!0)}};var kr=new Dr(0,0,0),wr="middle"===kr.align?"middle":"center";ge.prototype={parse:function(e){function t(){var e=r.buffer,t=0;for(e=Ee(e);t=e&&et.logger.log(this.time+" ["+e+"] "+t)},e}(),Hr=function(e){for(var t=[],r=0;rFr&&(this.logger.log(Ir.DEBUG,"Too large cursor position "+this.pos),this.pos=Fr)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r=144&&this.backSpace();var t=Pr(e);if(this.pos>=Fr)return void this.logger.log(Ir.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)},t.clearFromPos=function(e){var t;for(t=e;t0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},t.getTextAndFormat=function(){return this.rows},e}(),Xr=function(){function e(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new qr(r),this.nonDisplayedMemory=new qr(r),this.lastOutputScreen=new qr(r),this.currRollUpRow=this.displayedMemory.rows[xr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[xr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(Ir.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}this.logger.log(Ir.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),zr=function(){function e(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var i=new Kr;this.channels=[null,new Xr(e,t,i),new Xr(e+1,r,i)],this.cmdHistory=_e(),this.logger=i}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var r,i,a,n=!1;this.logger.time=e;for(var s=0;s ("+Hr([i,a])+")"),r=this.parseCmd(i,a),r||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(n=this.parseChars(i,a))){var o=this.currentChannel;if(o&&o>0){var l=this.channels[o];l.insertChars(n)}else this.logger.log(Ir.WARNING,"No channel found yet. TEXT-MODE?")}r||n||this.logger.log(Ir.WARNING,"Couldn't parse cleaned data "+Hr([i,a])+" orig: "+Hr([t[s],t[s+1]]))}},t.parseCmd=function(e,t){var r=this.cmdHistory,i=(20===e||28===e||21===e||29===e)&&t>=32&&t<=47,a=(23===e||31===e)&&t>=33&&t<=35;if(!i&&!a)return!1;if(be(e,t,r))return Se(null,null,r),this.logger.log(Ir.DEBUG,"Repeated command ("+Hr([e,t])+") is dropped"),!0;var n=20===e||21===e||23===e?1:2,s=this.channels[n];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),Se(e,t,r),this.currentChannel=n,!0},t.parseMidrow=function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(Ir.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(Ir.DEBUG,"MIDROW ("+Hr([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var r,i=this.cmdHistory,a=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(16===e||24===e)&&t>=64&&t<=95;if(!a&&!n)return!1;if(be(e,t,i))return Se(null,null,i),!0;var s=e<=23?1:2;r=t>=64&&t<=95?1===s?Nr[e]:Ur[e]:1===s?Mr[e]:Br[e];var o=this.channels[s];return!!o&&(o.setPAC(this.interpretPAC(r,t)),Se(e,t,i),this.currentChannel=s,!0)},t.interpretPAC=function(e,t){var r=t,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},t.parseChars=function(e,t){var r,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),a>=17&&a<=19){var n=t;n=17===a?t+80:18===a?t+112:t+144,this.logger.log(Ir.INFO,"Special char '"+Pr(n)+"' in channel "+r),i=[n]}else e>=32&&e<=127&&(i=0===t?[e]:[e,t]);if(i){var s=Hr(i);this.logger.log(Ir.DEBUG,"Char codes = "+s.join(",")),Se(e,t,this.cmdHistory)}return i},t.parseBackgroundAttributes=function(e,t){var r=(16===e||24===e)&&t>=32&&t<=47,i=(23===e||31===e)&&t>=45&&t<=47;if(!r&&!i)return!1;var a,n={};16===e||24===e?(a=Math.floor((t-32)/2),n.background=Gr[a],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));var s=e<=23?1:2;return this.channels[s].setBkgData(n),Se(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}(),Jr=function(e,t,r){return e.substr(r||0,t.length)===t},Zr=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(Je.isFiniteNumber)(t)&&Object(Je.isFiniteNumber)(r)&&Object(Je.isFiniteNumber)(i)&&Object(Je.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,t+=6e4*i,t+=36e5*a},ei=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()},ti=function(e,t,r){var i=e[t],a=e[i.prevCC];if(!a||!a.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;a&&a.new;)e.ccOffset+=i.start-a.start,i.new=!1,i=a,a=e[i.prevCC];e.presentationOffset=r},ri={parse:function(e,t,r,i,a,n){var s,o=Object(Jt.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),l="00:00.000",u=0,d=0,c=0,f=[],h=!0,g=!1,p=new Or;p.oncue=function(e){var t=r[i],a=r.ccOffset;t&&t.new&&(void 0!==d?a=r.ccOffset=t.start:ti(r,i,c)),c&&(a=c-r.presentationOffset),g&&(e.startTime+=a-d,e.endTime+=a-d),e.id=ei(e.startTime.toString())+ei(e.endTime.toString())+ei(e.text),e.text=decodeURIComponent(encodeURIComponent(e.text)),e.endTime>0&&f.push(e)},p.onparsingerror=function(e){s=e},p.onflush=function(){if(s&&n)return void n(s);a(f)},o.forEach(function(e){if(h){if(Jr(e,"X-TIMESTAMP-MAP=")){h=!1,g=!0,e.substr(16).split(",").forEach(function(e){Jr(e,"LOCAL:")?l=e.substr(6):Jr(e,"MPEGTS:")&&(u=parseInt(e.substr(7)))});try{t+(9e4*r[i].start||0)<0&&(t+=8589934592),u-=t,d=Zr(l)/1e3,c=u/9e4}catch(e){g=!1,s=e}return}""===e&&(h=!1)}p.parse(e+"\n")}),p.flush()}},ii=ri,ai=function(e){function t(t){var r;if(r=e.call(this,t,Ze.default.MEDIA_ATTACHING,Ze.default.MEDIA_DETACHING,Ze.default.FRAG_PARSING_USERDATA,Ze.default.FRAG_DECRYPTED,Ze.default.MANIFEST_LOADING,Ze.default.MANIFEST_LOADED,Ze.default.FRAG_LOADED,Ze.default.INIT_PTS_FOUND)||this,r.media=null,r.config=void 0,r.enabled=!0,r.Cues=void 0,r.textTracks=[],r.tracks=[],r.initPTS=[],r.unparsedVttFrags=[],r.captionsTracks={},r.nonNativeCaptionsTracks={},r.captionsProperties=void 0,r.cea608Parser1=void 0,r.cea608Parser2=void 0,r.lastSn=-1,r.prevCC=-1,r.vttCCs=ke(),r.hls=t,r.config=t.config,r.Cues=t.config.cueHandler,r.captionsProperties={textTrack1:{label:r.config.captionsTextTrack1Label,languageCode:r.config.captionsTextTrack1LanguageCode},textTrack2:{label:r.config.captionsTextTrack2Label,languageCode:r.config.captionsTextTrack2LanguageCode},textTrack3:{label:r.config.captionsTextTrack3Label,languageCode:r.config.captionsTextTrack3LanguageCode},textTrack4:{label:r.config.captionsTextTrack4Label,languageCode:r.config.captionsTextTrack4LanguageCode}},r.config.enableCEA708Captions){var i=new $r(Ae(r),"textTrack1"),a=new $r(Ae(r),"textTrack2"),n=new $r(Ae(r),"textTrack3"),s=new $r(Ae(r),"textTrack4");r.cea608Parser1=new Qr(1,i,a),r.cea608Parser2=new Qr(3,n,s)}return r}Re(t,e);var r=t.prototype;return r.addCues=function(e,t,r,i,a){for(var n=!1,s=a.length;s--;){var o=a[s],l=Le(o[0],o[1],t,r);if(l>=0&&(o[0]=Math.min(o[0],t),o[1]=Math.max(o[1],r),n=!0,l/(r-t)>.5))return}if(n||a.push([t,r]),this.config.renderTextTracksNatively)this.Cues.newCue(this.captionsTracks[e],t,r,i);else{var u=this.Cues.newCue(null,t,r,i);this.hls.trigger(Ze.default.CUES_PARSED,{type:"captions",cues:u,track:e})}},r.onInitPtsFound=function(e){var t=this,r=e.frag,i=e.id,a=e.initPTS,n=this.unparsedVttFrags;"main"===i&&(this.initPTS[r.cc]=a),n.length&&(this.unparsedVttFrags=[],n.forEach(function(e){t.onFragLoaded(e)}))},r.getExistingTrack=function(e){var t=this.media;if(t)for(var r=0;r=n.length||r!==a||!s||this.stopped)return void this._clearReloadTimer();if(et.logger.log("subtitle track "+r+" loaded"),i.live){var o=D(s.details,i,e.stats.trequest);et.logger.log("Reloading live subtitle playlist in "+o+"ms"),this.timer=setTimeout(function(){t._loadCurrentTrack()},o)}else this._clearReloadTimer()},r.startLoad=function(){this.stopped=!1,this._loadCurrentTrack()},r.stopLoad=function(){this.stopped=!0,this._clearReloadTimer()},r._clearReloadTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},r._loadCurrentTrack=function(){var e=this.trackId,t=this.tracks,r=this.hls,i=t[e];e<0||!i||i.details&&!i.details.live||(et.logger.log("Loading subtitle track "+e),r.trigger(Ze.default.SUBTITLE_TRACK_LOADING,{url:i.url,id:e}))},r._toggleTrackModes=function(e){var t=this.media,r=this.subtitleDisplay,i=this.trackId;if(t){var a=Ce(t.textTracks);if(-1===e)[].slice.call(a).forEach(function(e){e.mode="disabled"});else{var n=a[i];n&&(n.mode="disabled")}var s=a[e];s&&(s.mode=r?"showing":"hidden")}},r._setSubtitleTrackInternal=function(e){var t=this.hls,r=this.tracks;!Object(Je.isFiniteNumber)(e)||e<-1||e>=r.length||(this.trackId=e,et.logger.log("Switching to subtitle track "+e),t.trigger(Ze.default.SUBTITLE_TRACK_SWITCH,{id:e}),this._loadCurrentTrack())},r._onTextTracksChanged=function(){if(this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=Ce(this.media.textTracks),r=0;r=i[s].start&&n<=i[s].end){a=i[s];break}var o=t.start+t.duration;a?a.end=o:(a={start:n,end:o},i.push(a))}}},r.onMediaAttached=function(e){var t=e.media;this.media=t,t.addEventListener("seeking",this._onMediaSeeking),this.state=qt.IDLE},r.onMediaDetaching=function(){var e=this;this.media&&(this.media.removeEventListener("seeking",this._onMediaSeeking),this.fragmentTracker.removeAllFragments(),this.currentTrackId=-1,this.tracks.forEach(function(t){e.tracksBuffered[t.id]=[]}),this.media=null,this.state=qt.STOPPED)},r.onError=function(e){var t=e.frag;t&&"subtitle"===t.type&&(this.fragCurrent&&this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.state=qt.IDLE)},r.onSubtitleTracksUpdated=function(e){var t=this;et.logger.log("subtitle tracks updated"),this.tracksBuffered=[],this.tracks=e.subtitleTracks,this.tracks.forEach(function(e){t.tracksBuffered[e.id]=[]})},r.onSubtitleTrackSwitch=function(e){if(this.currentTrackId=e.id,!this.tracks||!this.tracks.length||-1===this.currentTrackId)return void this.clearInterval();var t=this.tracks[this.currentTrackId];t&&t.details&&this.setInterval(500)},r.onSubtitleTrackLoaded=function(e){var t=e.id,r=e.details,i=this.currentTrackId,a=this.tracks,n=a[i];t>=a.length||t!==i||!n||(r.live&&_(n.details,r,this.lastAVStart),n.details=r,this.setInterval(500))},r.onKeyLoaded=function(){this.state===qt.KEY_LOADING&&(this.state=qt.IDLE)},r.onFragLoaded=function(e){var t=this.fragCurrent,r=e.frag.decryptdata,i=e.frag,a=this.hls;if(this.state===qt.FRAG_LOADING&&t&&"subtitle"===e.frag.type&&t.sn===e.frag.sn&&e.payload.byteLength>0&&r&&r.key&&"AES-128"===r.method){var n=di.now();this.decrypter.decrypt(e.payload,r.key.buffer,r.iv.buffer,function(e){var t=di.now();a.trigger(Ze.default.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:n,tdecrypt:t}})})}},r.onLevelUpdated=function(e){var t=e.details,r=t.fragments;this.lastAVStart=r.length?r[0].start:0},r.doTick=function(){if(!this.media)return void(this.state=qt.IDLE);switch(this.state){case qt.IDLE:var e=this.config,t=this.currentTrackId,r=this.fragmentTracker,i=this.media,a=this.tracks;if(!a||!a[t]||!a[t].details)break;var n=e.maxBufferHole,s=e.maxFragLookUpTolerance,o=Math.min(e.maxBufferLength,e.maxMaxBufferLength),l=Pt.bufferedInfo(this._getBuffered(),i.currentTime,n),u=l.end,d=l.len,c=a[t].details,f=c.fragments,h=f.length,g=f[h-1].start+f[h-1].duration;if(d>o)return;var p,v=this.fragPrevious;ui)&&(this.fragCurrent.loader&&this.fragCurrent.loader.abort(),this.fragmentTracker.removeFragment(this.fragCurrent),this.fragCurrent=null,this.fragPrevious=null,this.state=qt.IDLE,this.tick())}},t}(Xt);!function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(jr||(jr={}));var fi=function(){return"undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null}(),hi=function(e,t,r){var i={audioCapabilities:[],videoCapabilities:[]};return e.forEach(function(e){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:r.audioRobustness||""})}),t.forEach(function(e){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:r.videoRobustness||""})}),[i]},gi=function(e,t,r,i){switch(e){case jr.WIDEVINE:return hi(t,r,i);default:throw new Error("Unknown key-system: "+e)}},pi=function(e){function t(t){var r;return r=e.call(this,t,Ze.default.MEDIA_ATTACHED,Ze.default.MEDIA_DETACHED,Ze.default.MANIFEST_PARSED)||this,r._widevineLicenseUrl=void 0,r._licenseXhrSetup=void 0,r._emeEnabled=void 0,r._requestMediaKeySystemAccess=void 0,r._drmSystemOptions=void 0,r._config=void 0,r._mediaKeysList=[],r._media=null,r._hasSetMediaKeys=!1,r._requestLicenseFailureCount=0,r.mediaKeysPromise=null,r._onMediaEncrypted=function(e){if(et.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),!r.mediaKeysPromise)return et.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void r.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var t=function(t){r._media&&(r._attemptSetMediaKeys(t),r._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};r.mediaKeysPromise.then(t).catch(t)},r._config=t.config,r._widevineLicenseUrl=r._config.widevineLicenseUrl,r._licenseXhrSetup=r._config.licenseXhrSetup,r._emeEnabled=r._config.emeEnabled,r._requestMediaKeySystemAccess=r._config.requestMediaKeySystemAccessFunc,r._drmSystemOptions=t.config.drmSystemOptions,r}Me(t,e);var r=t.prototype;return r.getLicenseServerUrl=function(e){switch(e){case jr.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},r._attemptKeySystemAccess=function(e,t,r){var i=this,a=gi(e,t,r,this._drmSystemOptions);et.logger.log("Requesting encrypted media key-system access");var n=this.requestMediaKeySystemAccess(e,a);this.mediaKeysPromise=n.then(function(t){return i._onMediaKeySystemAccessObtained(e,t)}),n.catch(function(t){et.logger.error('Failed to obtain key-system "'+e+'" access:',t)})},r._onMediaKeySystemAccessObtained=function(e,t){var r=this;et.logger.log('Access for key-system "'+e+'" obtained');var i={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i);var a=Promise.resolve().then(function(){return t.createMediaKeys()}).then(function(t){return i.mediaKeys=t,et.logger.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated(),t});return a.catch(function(e){et.logger.error("Failed to create media-keys:",e)}),a},r._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))})},r._onNewMediaKeySession=function(e){var t=this;et.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",function(r){t._onKeySessionMessage(e,r.message)},!1)},r._onKeySessionMessage=function(e,t){et.logger.log("Got EME message event, creating license request"),this._requestLicense(t,function(t){et.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)})},r._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return et.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});et.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(e,t){var r=this,i=this._mediaKeysList[0];if(!i)return et.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(i.mediaKeysSessionInitialized)return void et.logger.warn("Key-Session already initialized but requested again");var a=i.mediaKeysSession;return a?t?(et.logger.log('Generating key-session request for "'+e+'" init data type'),i.mediaKeysSessionInitialized=!0,void a.generateRequest(e,t).then(function(){et.logger.debug("Key-session generation succeeded")}).catch(function(e){et.logger.error("Error generating key-session request:",e),r.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})):(et.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0})):(et.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0}))},r._createLicenseXhr=function(e,t,r){var i=new XMLHttpRequest,a=this._licenseXhrSetup;try{if(a)try{a(i,e)}catch(t){i.open("POST",e,!0),a(i,e)}i.readyState||i.open("POST",e,!0)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,r),i},r._onLicenseRequestReadyStageChange=function(e,t,r,i){switch(e.readyState){case 4:if(200===e.status)this._requestLicenseFailureCount=0,et.logger.log("License request succeeded"),"arraybuffer"!==e.responseType&&et.logger.warn("xhr response type was not set to the expected arraybuffer for license request"),i(e.response);else{if(et.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),++this._requestLicenseFailureCount>3)return void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var a=3-this._requestLicenseFailureCount+1;et.logger.warn("Retrying license request, "+a+" attempts left"),this._requestLicense(r,i)}}},r._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case jr.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},r._requestLicense=function(e,t){et.logger.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return et.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var i=this.getLicenseServerUrl(r.mediaKeySystemDomain),a=this._createLicenseXhr(i,e,t);et.logger.log("Sending license request to URL: "+i);var n=this._generateLicenseRequestChallenge(r,e);a.send(n)}catch(e){et.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(Ze.default.ERROR,{type:$e.ErrorTypes.KEY_SYSTEM_ERROR,details:$e.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(e){if(this._emeEnabled){var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)}},r.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map(function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch(function(){})})).then(function(){return e.setMediaKeys(null)}).catch(function(){}))},r.onManifestParsed=function(e){if(this._emeEnabled){var t=e.levels.map(function(e){return e.audioCodec}),r=e.levels.map(function(e){return e.videoCodec});this._attemptKeySystemAccess(jr.WIDEVINE,t,r)}},Ne(t,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),t}(it),vi=pi,mi=Be(Be({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,liveBackBufferLength:1/0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Er,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:lr,bufferController:cr,capLevelController:hr,fpsController:mr,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:fi,testBandwidth:!0},function(){return{cueHandler:Xe,enableCEA708Captions:!0,enableWebVTT:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}()),{},{subtitleStreamController:ci,subtitleTrackController:oi,timelineController:ni,audioStreamController:Rr,audioTrackController:Sr,emeController:vi}),yi=function(e){function t(r){var i;void 0===r&&(r={}),i=e.call(this)||this,i.config=void 0,i._autoLevelCapping=void 0,i.abrController=void 0,i.capLevelController=void 0,i.levelController=void 0,i.streamController=void 0,i.networkControllers=void 0,i.audioTrackController=void 0,i.subtitleTrackController=void 0,i.emeController=void 0,i.coreComponents=void 0,i.media=null,i.url=null;var a=t.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");i.config=Ke(Ke({},a),r);var n=Ve(i),s=n.config;if(void 0!==s.liveMaxLatencyDurationCount&&s.liveMaxLatencyDurationCount<=s.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==s.liveMaxLatencyDuration&&(void 0===s.liveSyncDuration||s.liveMaxLatencyDuration<=s.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(et.enableLogs)(s.debug),i._autoLevelCapping=-1;var o=i.abrController=new s.abrController(Ve(i)),l=new s.bufferController(Ve(i)),u=i.capLevelController=new s.capLevelController(Ve(i)),d=new s.fpsController(Ve(i)),c=new At(Ve(i)),f=new Dt(Ve(i)),h=new kt(Ve(i)),g=new er(Ve(i)),p=i.levelController=new $t(Ve(i)),v=new It(Ve(i)),m=i.streamController=new Qt(Ve(i),v),y=[p,m],E=s.audioStreamController;E&&y.push(new E(Ve(i),v)),i.networkControllers=y;var T=[c,f,h,o,l,u,d,g,v];if(E=s.audioTrackController){var S=new E(Ve(i));i.audioTrackController=S,T.push(S)}if(E=s.subtitleTrackController){var b=new E(Ve(i));i.subtitleTrackController=b,y.push(b)}if(E=s.emeController){var _=new E(Ve(i));i.emeController=_,T.push(_)}return E=s.subtitleStreamController,E&&y.push(new E(Ve(i),v)),E=s.timelineController,E&&T.push(new E(Ve(i))),i.coreComponents=T,i}qe(t,e),t.isSupported=function(){return J()},We(t,null,[{key:"version",get:function(){return"0.14.16"}},{key:"Events",get:function(){return Ze.default}},{key:"ErrorTypes",get:function(){return $e.ErrorTypes}},{key:"ErrorDetails",get:function(){return $e.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:mi},set:function(e){t.defaultConfig=e}}]);var r=t.prototype;return r.destroy=function(){et.logger.log("destroy"),this.trigger(Ze.default.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(e){e.destroy()}),this.url=null,this.removeAllListeners(),this._autoLevelCapping=-1},r.attachMedia=function(e){et.logger.log("attachMedia"),this.media=e,this.trigger(Ze.default.MEDIA_ATTACHING,{media:e})},r.detachMedia=function(){et.logger.log("detachMedia"),this.trigger(Ze.default.MEDIA_DETACHING),this.media=null},r.loadSource=function(e){e=Qe.buildAbsoluteURL(window.location.href,e,{alwaysNormalize:!0}),et.logger.log("loadSource:"+e),this.url=e,this.trigger(Ze.default.MANIFEST_LOADING,{url:e})},r.startLoad=function(e){void 0===e&&(e=-1),et.logger.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},r.stopLoad=function(){et.logger.log("stopLoad"),this.networkControllers.forEach(function(e){e.stopLoad()})},r.swapAudioCodec=function(){et.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},r.recoverMediaError=function(){et.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),e&&this.attachMedia(e)},r.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},We(t,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){et.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){et.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){et.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){et.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){et.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){et.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e}},{key:"bandwidthEstimate",get:function(){var e=this.abrController._bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var e=this.levels,t=this.config.minAutoBitrate,r=e?e.length:0,i=0;it)return i}return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}}]),t}(Ut);yi.defaultConfig=void 0},"./src/polyfills/number.js":/*!*********************************!*\ + !*** ./src/polyfills/number.js ***! + \*********************************/ +/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */ +function(e,t,r){"use strict";r.r(t),r.d(t,"isFiniteNumber",function(){return i}),r.d(t,"MAX_SAFE_INTEGER",function(){return a});var i=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},a=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/utils/get-self-scope.js":/*!*************************************!*\ + !*** ./src/utils/get-self-scope.js ***! + \*************************************/ +/*! exports provided: getSelfScope */ +function(e,t,r){"use strict";function i(){return"undefined"==typeof window?self:window}r.r(t),r.d(t,"getSelfScope",function(){return i})},"./src/utils/logger.js":/*!*****************************!*\ + !*** ./src/utils/logger.js ***! + \*****************************/ +/*! exports provided: enableLogs, logger */ +function(e,t,r){"use strict";function i(){}function a(e,t){return t="["+e+"] > "+t}function n(e){var t=d.console[e];return t?function(){for(var r=arguments.length,i=new Array(r),n=0;n1?t-1:0),i=1;i2e3?(e=r,o.recoverMediaError()):!t||r-t>2e3?(t=r,o.swapAudioCodec(),o.recoverMediaError()):console.error("Error loading media: File could not be played")}}var i=t.options_,n=t.el(),s=null,o=this.hls=new a(i.hlsjsConfig),l=r(),u=r();n.addEventListener("error",function(e){var t=e.currentTarget.error;t.code===t.MEDIA_ERR_DECODE?u():console.error("Error loading media: File could not be played")}),this.dispose=function(){o.destroy()},this.duration=function(){return s||n.duration||0},o.on(a.Events.LEVEL_LOADED,function(e,t){s=t.details.live?1/0:t.details.totalduration}),o.on(a.Events.ERROR,function(e,t){if(t.fatal)switch(t.type){case a.ErrorTypes.NETWORK_ERROR:o.startLoad();break;case a.ErrorTypes.MEDIA_ERROR:l();break;default:console.error("Error loading media: File could not be played")}}),Object.keys(a.Events).forEach(function(e){var r=a.Events[e];o.on(r,function(e,i){t.trigger(r,i)})}),t.featuresNativeTextTracks||(Object.defineProperty(n,"textTracks",{value:t.textTracks,writable:!1}),n.addTextTrack=function(){return t.addTextTrack.apply(t,arguments)}),o.attachMedia(n),o.loadSource(e.src)}var a=r(0);window.Hls||(window.Hls=a);var n=/^application\/(x-mpegURL|vnd\.apple\.mpegURL)$/i,s=/\.m3u8/i,o={canHandleSource:function(e){return e.skipContribHlsJs?"":n.test(e.type)?"probably":s.test(e.src)?"maybe":""},handleSource:function(e,t){return new i(e,t)},canPlayType:function(e){return n.test(e)?"probably":""}};if(a.isSupported()){var l=r(1);if(l=l&&l.default||l){var u=l.getTech&&l.getTech("Html5");u=u||l.getComponent&&l.getComponent("Html5"),u&&u.registerSourceHandler(o,0)}else console.warn("videojs-contrib-hls.js: Couldn't find find window.videojs nor require('video.js')")}}])}); //# sourceMappingURL=videojs-contrib-hlsjs.min.js.map \ No newline at end of file diff --git a/dist/videojs-contrib-hlsjs.min.js.map b/dist/videojs-contrib-hlsjs.min.js.map index cf243be..b4582ee 100644 --- a/dist/videojs-contrib-hlsjs.min.js.map +++ b/dist/videojs-contrib-hlsjs.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///videojs-contrib-hlsjs.min.js","webpack:///webpack/bootstrap 9797e5f4aff93dafed55","webpack:///./~/hls.js/dist/hls.js","webpack:///external {\"commonjs\":\"video.js\",\"commonjs2\":\"video.js\",\"amd\":\"video.js\",\"root\":\"videojs\"}","webpack:///./src/videojs.hlsjs.js"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","noop","formatMsg","type","msg","consolePrintFn","func","self","console","_len","arguments","length","args","Array","_key","apply","exportLoggerFunctions","debugConfig","_len2","functions","_key2","forEach","exportedLogger","bind","enableLogs","logger","_typeof","Symbol","iterator","obj","constructor","fakeLogger","trace","debug","log","warn","info","error","e","MEDIA_ATTACHING","MEDIA_ATTACHED","MEDIA_DETACHING","MEDIA_DETACHED","BUFFER_RESET","BUFFER_CODECS","BUFFER_CREATED","BUFFER_APPENDING","BUFFER_APPENDED","BUFFER_EOS","BUFFER_FLUSHING","BUFFER_FLUSHED","MANIFEST_LOADING","MANIFEST_LOADED","MANIFEST_PARSED","LEVEL_SWITCH","LEVEL_SWITCHING","LEVEL_SWITCHED","LEVEL_LOADING","LEVEL_LOADED","LEVEL_UPDATED","LEVEL_PTS_UPDATED","AUDIO_TRACKS_UPDATED","AUDIO_TRACK_SWITCH","AUDIO_TRACK_SWITCHING","AUDIO_TRACK_SWITCHED","AUDIO_TRACK_LOADING","AUDIO_TRACK_LOADED","SUBTITLE_TRACKS_UPDATED","SUBTITLE_TRACK_SWITCH","SUBTITLE_TRACK_LOADING","SUBTITLE_TRACK_LOADED","SUBTITLE_FRAG_PROCESSED","INIT_PTS_FOUND","FRAG_LOADING","FRAG_LOAD_PROGRESS","FRAG_LOAD_EMERGENCY_ABORTED","FRAG_LOADED","FRAG_DECRYPTED","FRAG_PARSING_INIT_SEGMENT","FRAG_PARSING_USERDATA","FRAG_PARSING_METADATA","FRAG_PARSING_DATA","FRAG_PARSED","FRAG_BUFFERED","FRAG_CHANGED","FPS_DROP","FPS_DROP_LEVEL_CAPPING","ERROR","DESTROYING","KEY_LOADING","KEY_LOADED","STREAM_STATE_TRANSITION","ErrorTypes","ErrorDetails","NETWORK_ERROR","MEDIA_ERROR","MUX_ERROR","OTHER_ERROR","MANIFEST_LOAD_ERROR","MANIFEST_LOAD_TIMEOUT","MANIFEST_PARSING_ERROR","MANIFEST_INCOMPATIBLE_CODECS_ERROR","LEVEL_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","LEVEL_SWITCH_ERROR","AUDIO_TRACK_LOAD_ERROR","AUDIO_TRACK_LOAD_TIMEOUT","FRAG_LOAD_ERROR","FRAG_LOOP_LOADING_ERROR","FRAG_LOAD_TIMEOUT","FRAG_DECRYPT_ERROR","FRAG_PARSING_ERROR","REMUX_ALLOC_ERROR","KEY_LOAD_ERROR","KEY_LOAD_TIMEOUT","BUFFER_ADD_CODEC_ERROR","BUFFER_APPEND_ERROR","BUFFER_APPENDING_ERROR","BUFFER_STALLED_ERROR","BUFFER_FULL_ERROR","BUFFER_SEEK_OVER_HOLE","BUFFER_NUDGE_ON_STALL","INTERNAL_EXCEPTION","_classCallCheck","instance","Constructor","TypeError","utf8ArrayToStr","ID3","isHeader","data","offset","isFooter","getID3Data","front","_readSize","subarray","size","getTimeStamp","frames","getID3Frames","frame","isTimeStampFrame","_readTimeStamp","key","_getFrameData","String","fromCharCode","id3Data","end","frameData","_decodeFrame","push","_decodePrivFrame","_decodeTextFrame","_decodeURLFrame","timeStampFrame","byteLength","Uint8Array","pts33Bit","timestamp","Math","round","owner","_utf8ArrayToStr","privateData","buffer","index","description","text","url","array","exitOnNull","undefined","len","char2","char3","out","fast_aes_key__classCallCheck","aes_decryptor__classCallCheck","decrypter__classCallCheck","AESCrypto","subtle","iv","aesIV","decrypt","aes_crypto","FastAESKey","expandKey","importKey","fast_aes_key","AESDecryptor","rcon","subMix","Uint32Array","invSubMix","sBox","invSBox","initTable","uint8ArrayToUint32Array_","arrayBuffer","view","DataView","newArray","getUint32","subMix0","subMix1","subMix2","subMix3","invSubMix0","invSubMix1","invSubMix2","invSubMix3","x","xi","sx","x2","x4","x8","t","keyBuffer","sameKey","keySize","Error","ksRows","ksRow","invKsRow","keySchedule","invKeySchedule","sbox","prev","networkToHostOrderSwap","word","inputArrayBuffer","nRounds","invSBOX","initVector","initVector0","initVector1","initVector2","initVector3","inputInt32","Int32Array","outputInt32","t0","t1","t2","t3","s0","s1","s2","s3","inputWords0","inputWords1","inputWords2","inputWords3","swapWord","destroy","aes_decryptor","errors","decrypter_Decrypter","Decrypter","observer","config","logEnabled","browserCrypto","crypto","webkitSubtle","disableWebCrypto","isSync","enableSoftwareAES","callback","_this","decryptor","fastAesKey","then","aesKey","catch","err","onWebCryptoError","result","message","trigger","Event","details","fatal","reason","EventEmitter","_events","_maxListeners","isFunction","arg","isNumber","isObject","isUndefined","defaultMaxListeners","setMaxListeners","isNaN","emit","er","handler","listeners","context","slice","addListener","listener","newListener","warned","on","once","g","removeListener","fired","list","position","splice","removeAllListeners","listenerCount","evlistener","emitter","URL_REGEX","FIRST_SEGMENT_REGEX","URLToolkit","buildAbsoluteURL","baseURL","relativeURL","opts","trim","alwaysNormalize","basePartsForNormalise","parseURL","baseParts","path","normalizePath","buildURLFromParts","relativeParts","scheme","netLoc","pathParts","exec","builtParts","params","query","fragment","baseURLPath","newPath","substring","lastIndexOf","parts","split","reverse","join","replace","getAudioConfig","audioCodec","adtsObjectType","adtsSampleingIndex","adtsExtensionSampleingIndex","adtsChanelConfig","userAgent","navigator","toLowerCase","manifestCodec","adtsSampleingRates","test","indexOf","samplerate","channelCount","codec","isHeaderPattern","getHeaderLength","getFullFrameLength","adts_probe","headerLength","frameLength","newOffset","initTrackConfig","track","getFrameDuration","parseFrameHeader","pts","frameIndex","frameDuration","stamp","appendFrame","header","aacSample","unit","dts","samples","sample","mp4demuxer__classCallCheck","exp_golomb__classCallCheck","sample_aes__classCallCheck","tsdemuxer__classCallCheck","mp3demuxer__classCallCheck","aac__classCallCheck","mp4_generator__classCallCheck","mp4_remuxer__classCallCheck","passthrough_remuxer__classCallCheck","demuxer_inline__classCallCheck","events","crypt_decrypter","id3","aacdemuxer_AACDemuxer","AACDemuxer","remuxer","resetInitSegment","initSegment","videoCodec","duration","_audioTrack","container","id","sequenceNumber","isAAC","inputTimeScale","resetTimeStamp","probe","append","timeOffset","contiguous","accurateTimeOffset","id3Samples","remux","aacdemuxer","UINT32_MAX","pow","mp4demuxer_MP4Demuxer","MP4Demuxer","initPTS","initData","parseInitSegment","tracks","audio","video","audiovideo","findBox","start","min","bin2str","readUint32","val","writeUint32","subresults","endbox","results","concat","trak","tkhd","version","trackId","mdhd","timescale","hdlr","hdlrType","soun","vide","codecBox","codecType","getStartDTS","trafs","baseTimes","map","traf","tfhd","scale","tfdt","isFinite","offsetStartDTS","baseMediaDecodeTime","max","upper","floor","lower","startDTS","_startDTS","mp4demuxer","MpegAudio","BitratesMap","SamplingRateMap","SamplesCoefficients","BytesInSlot","parseHeader","samplesPerFrame","sampleRate","headerB","headerC","headerE","headerF","headerG","columnInBitrates","bitRate","columnInSampleRates","sampleCoefficient","bytesInSlot","parseInt","mpegaudio","exp_golomb_ExpGolomb","ExpGolomb","bytesAvailable","bitsAvailable","loadWord","workingBytes","availableBytes","set","skipBits","count","skipBytes","readBits","bits","valu","skipLZ","leadingZeroCount","skipUEG","skipEG","readUEG","clz","readEG","readBoolean","readUByte","readUShort","readUInt","skipScalingList","j","deltaScale","lastScale","nextScale","readSPS","profileIdc","numRefFramesInPicOrderCntCycle","picWidthInMbsMinus1","picHeightInMapUnitsMinus1","frameMbsOnlyFlag","scalingListCount","frameCropLeftOffset","frameCropRightOffset","frameCropTopOffset","frameCropBottomOffset","chromaFormatIdc","picOrderCntType","pixelRatio","width","ceil","height","readSliceType","exp_golomb","sample_aes_SampleAesDecrypter","SampleAesDecrypter","decryptdata","discardEPB","decrypter","decryptBuffer","encryptedData","decryptAacSample","sampleIndex","sync","curUnit","encryptedBuffer","byteOffset","localthis","decryptedData","decryptAacSamples","getAvcEncryptedData","decodedData","encryptedDataLen","Int8Array","outputPos","inputPos","getAvcDecryptedUnit","decryptAvcSample","unitIndex","decryptAvcSamples","curUnits","units","sample_aes","RemuxerTrackIdConfig","tsdemuxer_TSDemuxer","TSDemuxer","typeSupported","sampleAes","setDecryptData","method","syncOffset","_syncOffset","scanwindow","createTrack","pid","dropped","pmtParsed","_pmtId","_avcTrack","_id3Track","_txtTrack","aacOverFlow","aacLastPTS","avcSample","_duration","stt","pes","unknownPIDs","avcTrack","audioTrack","id3Track","avcId","audioId","id3Id","pmtId","avcData","pesData","audioData","parsePAT","_parsePAT","parsePMT","_parsePMT","parsePES","_parsePES","parseAVCPES","_parseAVCPES","parseAACPES","_parseAACPES","parseMPEGPES","_parseMPEGPES","parseID3PES","_parseID3PES","parsedPIDs","mpeg","mp3","avc","decryptAndRemux","videoTrack","textTrack","decryptAndRemuxAvc","_initPTS","_initDTS","mpegSupported","isSampleAes","sectionLength","tableEnd","programInfoLength","stream","frag","pesFlags","pesLen","pesHdrLen","pesPts","pesDts","payloadStartOffset","newData","dataLen","pushAccesUnit","nbSamples","forceKeyFrameOnDiscontinuity","sps","last","expGolombDecoder","_parseAVCNALu","spsfound","createAVCSample","audFound","sliceType","payloadType","payloadSize","endOfCaptions","b","firstByte","secondByte","totalCCs","byteArray","_insertSampleInOrder","bytes","codecarray","codecstring","h","toString","pps","arr","pos","_getLastNalUnit","lastUnit","overflow","unitType","lastUnitType","state","naluState","lastState","lastUnitStart","tmp","_lastUnit","_tmp","newLength","EPBPositions","sourceIndex","shift","newPTS","abs","tsdemuxer","mp3demuxer_MP3Demuxer","MP3Demuxer","mp3demuxer","AAC","getSilentFrame","aac","mp4_generator_UINT32_MAX","MP4","init","types","avc1","avcC","btrt","dinf","dref","esds","ftyp","mdat","mdia","mfhd","minf","moof","moov","mp4a",".mp3","mvex","mvhd","pasp","sdtp","stbl","stco","stsc","stsd","stsz","stts","trun","trex","vmhd","smhd","charCodeAt","videoHdlr","audioHdlr","HDLR_TYPES","STTS","STSC","STCO","STSZ","VMHD","SMHD","STSD","majorBrand","avc1Brand","minorVersion","FTYP","box","DINF","payload","upperWordDuration","lowerWordDuration","sn","boxes","flags","dependsOn","isDependedOn","hasRedundancy","avcc","hSpacing","vSpacing","configlen","sampleDependencyTable","upperWordBaseMediaDecodeTime","lowerWordBaseMediaDecodeTime","cts","arraylen","isLeading","paddingValue","isNonSync","degradPrio","movie","mp4_generator","mp4_remuxer_MP4Remuxer","MP4Remuxer","vendor","isSafari","match","ISGenerated","defaultTimeStamp","generateIS","nbAudioSamples","nbVideoSamples","audioTimeOffset","videoTimeOffset","audiovideoDeltaDts","remuxAudio","audioTrackLength","endPTS","startPTS","remuxVideo","videoData","remuxEmptyAudio","remuxID3","remuxText","initDTS","audioSamples","videoSamples","computePTSDTS","Infinity","metadata","keys","mp4SampleDuration","firstPTS","firstDTS","lastPTS","lastDTS","timeScale","inputSamples","outputSamples","ptsNormalize","_PTSNormalize","nextAvcDts","sort","deltadts","deltapts","PTSDTSshift","reduce","curr","delta","nbNalu","naluLen","_i","_sample","nbUnits","sampleLen","mdatSize","setUint32","_i2","avcSampleUnits","mp4SampleLength","compositionTimeOffset","_j","_nbUnits","unitData","unitDataLen","lastFrameDuration","stretchShortVideoTrack","maxBufferHole","maxSeekHole","gapTolerance","deltaToFrameEnd","nextAudioPts","data1","data2","endDTS","nb","mp4Sample","fillFrame","mp4timeScale","scaleFactor","inputSampleDuration","rawMPEG","filter","maxAudioFramesDrift","nextPts","toFixed","missing","newStamp","_j2","_nbSamples","audioSample","_pts","_delta","numMissingFrames","_i3","unitLen","lastSampleDuration","silentFrame","reference","mp4_remuxer","passthrough_remuxer_PassThroughRemuxer","PassThroughRemuxer","rawData","streamType","passthrough_remuxer","demuxer_inline_DemuxerInline","DemuxerInline","demuxer","discontinuity","trackSwitch","defaultInitPTS","startTime","performance","now","Date","endTime","stats","tstart","tdecrypt","pushDecrypted","muxConfig","demux","mux","_remuxer","attr_list__classCallCheck","isCodecType","typeCodes","sampleEntryCodesISO","isCodecSupportedInMp4","MediaSource","isTypeSupported","_possibleConstructorReturn","ReferenceError","_inherits","subClass","superClass","create","writable","setPrototypeOf","__proto__","playlist_loader__classCallCheck","findGroup","groups","mediaGroupId","matchingGroup","group","fragment_loader__classCallCheck","fragment_loader__possibleConstructorReturn","fragment_loader__inherits","key_loader__classCallCheck","key_loader__possibleConstructorReturn","key_loader__inherits","getMediaSource","window","WebKitMediaSource","demuxer__classCallCheck","updatePTS","fragments","fromIdx","toIdx","fragFrom","fragTo","fragToPTS","level","updateFragPTSDTS","maxStartPTS","deltaPTS","drift","startSN","endSN","fragIdx","PTSKnown","mergeDetails","oldDetails","newDetails","PTSFrag","oldfragments","newfragments","ccOffset","oldFrag","newFrag","cc","backtracked","sliding","findFirstFragWithCC","firstFrag","currentFrag","findFragWithCC","CC","binary_search","search","candidate","shouldAlignOnDiscontinuities","lastFrag","lastLevel","shouldAlign","endCC","startCC","findDiscontinuousReferenceFrag","prevDetails","curDetails","prevFrags","curFrags","prevStartFrag","adjustPts","alignDiscontinuities","referenceFrag","lastPDT","programDateTime","newPDT","stream_controller__classCallCheck","stream_controller__possibleConstructorReturn","stream_controller__inherits","level_controller__classCallCheck","level_controller__possibleConstructorReturn","level_controller__inherits","id3_track_controller__classCallCheck","id3_track_controller__possibleConstructorReturn","id3_track_controller__inherits","is_supported_isSupported","mediaSource","sourceBuffer","SourceBuffer","WebKitSourceBuffer","sourceBufferValidAPI","appendBuffer","remove","ewma__classCallCheck","ewma_bandwidth_estimator__classCallCheck","abr_controller__classCallCheck","abr_controller__possibleConstructorReturn","abr_controller__inherits","buffer_controller__classCallCheck","buffer_controller__possibleConstructorReturn","buffer_controller__inherits","cap_level_controller__classCallCheck","cap_level_controller__possibleConstructorReturn","cap_level_controller__inherits","fps_controller__classCallCheck","fps_controller__possibleConstructorReturn","fps_controller__inherits","xhr_loader__classCallCheck","audio_track_controller__classCallCheck","audio_track_controller__possibleConstructorReturn","audio_track_controller__inherits","audio_stream_controller__classCallCheck","audio_stream_controller__possibleConstructorReturn","audio_stream_controller__inherits","VTTParser","decoder","StringDecoder","regionList","parseTimeStamp","input","computeSeconds","f","Settings","values","parseOptions","keyValueDelim","groupDelim","kv","k","v","parseCue","cue","consumeTimeStamp","ts","oInput","skipWhitespace","substr","settings","region","alt","vals","vals0","integer","percent","center","vertical","line","defaults","lineAlign","snapToLines","align","fixLineBreaks","newCue","captionScreen","row","indenting","indent","VTTCue","TextTrackCue","r","rows","isEmpty","chars","uchar","cueStartTime","addCue","cea_608_parser__classCallCheck","output_filter__classCallCheck","timeline_controller__classCallCheck","timeline_controller__possibleConstructorReturn","timeline_controller__inherits","clearCurrentCues","cues","removeCue","reuseVttTextTrack","inUseTrack","manifestTrack","label","textTrack1","textTrack2","intersection","x1","y1","y2","subtitle_track_controller__classCallCheck","subtitle_track_controller__possibleConstructorReturn","subtitle_track_controller__inherits","filterSubtitleTracks","textTrackList","kind","subtitle_stream_controller__classCallCheck","subtitle_stream_controller__possibleConstructorReturn","subtitle_stream_controller__inherits","hls__classCallCheck","cues_namespaceObject","url_toolkit","url_toolkit_default","event_handler_EventHandler","EventHandler","hls","onEvent","handledEvents","useGenericHandler","registerListeners","unregisterListeners","isEventHandler","event","off","onEventGeneric","eventToFunction","funcName","event_handler","DECIMAL_RESOLUTION_REGEX","ATTR_LIST_REGEX","AttrList","attrs","parseAttrList","attr","decimalInteger","attrName","intValue","Number","MAX_SAFE_INTEGER","hexadecimalInteger","stringValue","hexadecimalIntegerAsNumber","decimalFloatingPoint","parseFloat","enumeratedString","decimalResolution","res","lastIndex","attr_list","a3ds","ac-3","ac-4","alac","alaw","dra1","dts+","dts-","dtsc","dtse","dtsh","ec-3","enca","g719","g726","m4ae","mha1","mha2","mhm1","mhm2","mlpa","raw ","Opus","samr","sawb","sawp","sevc","sqcp","ssmv","twos","ulaw","avc2","avc3","avc4","avcp","drac","dvav","dvhe","encv","hev1","hvc1","mjp2","mp4v","mvc1","mvc2","mvc3","mvc4","resv","rv60","s263","svc1","svc2","vc-1","vp08","vp09","_createClass","defineProperties","target","props","descriptor","protoProps","staticProps","MASTER_PLAYLIST_REGEX","MASTER_PLAYLIST_MEDIA_REGEX","LEVEL_PLAYLIST_REGEX_FAST","RegExp","source","playlist_loader_LevelKey","LevelKey","_uri","reluri","baseuri","playlist_loader_Fragment","Fragment","_url","_byteRange","_decryptdata","tagList","createInitializationVector","segmentNumber","uint8View","fragmentDecryptdataFromLevelkey","levelkey","uri","cloneObj","JSON","parse","stringify","relurl","baseurl","_programDateTime","rawProgramDateTime","byteRange","rawByteRange","lastByteRangeEndOffset","playlist_loader_PlaylistLoader","_EventHandler","PlaylistLoader","loaders","loaderName","loader","onManifestLoading","load","onLevelLoading","onAudioTrackLoading","onSubtitleTrackLoading","loaderContext","abort","maxRetry","timeout","retryDelay","maxRetryDelay","manifestLoadingMaxRetry","manifestLoadingTimeOut","manifestLoadingRetryDelay","manifestLoadingMaxRetryTimeout","levelLoadingTimeOut","levelLoadingMaxRetry","levelLoadingRetryDelay","levelLoadingMaxRetryTimeout","pLoader","responseType","loaderConfig","loaderCallbacks","onSuccess","loadsuccess","onError","loaderror","onTimeout","loadtimeout","resolve","baseUrl","parseMasterPlaylist","string","levels","resolution","bitrate","NAME","codecs","filtered","preferred","unknownCodecs","CODECS","avc1toavcoti","parseMasterPlaylistMedia","audioGroups","medias","media","TYPE","groupId","default","DEFAULT","autoselect","AUTOSELECT","forced","FORCED","URI","lang","LANGUAGE","groupCodec","avcdata","parseLevelPlaylist","currentSN","totalduration","live","prevFrag","title","byteRangeEndOffset","value1","value2","toUpperCase","targetduration","decryptparams","keyAttrs","decryptmethod","decrypturi","decryptiv","startParams","startAttrs","startTimeOffset","mapAttrs","BYTERANGE","pop","averagetargetduration","response","networkDetails","tload","isLevel","levelId","levelDetails","audioTracks","tparsed","AUDIO","subtitles","embeddedAudioFound","unshift","playlist_loader","fragment_loader_FragmentLoader","FragmentLoader","onFragLoading","loaded","fLoader","progressData","byteRangeStartOffset","rangeStart","rangeEnd","fragLoadingTimeOut","fragLoadingMaxRetryTimeout","onProgress","loadprogress","fragment_loader","key_loader_KeyLoader","KeyLoader","decryptkey","decrypturl","onKeyLoading","fragLoadingMaxRetry","fragLoadingRetryDelay","key_loader","BinarySearch","comparisonFunction","minIndex","maxIndex","currentIndex","currentElement","comparisonResult","BufferHelper","isBuffered","buffered","bufferInfo","maxHoleDuration","vbuffered","bufferedInfo","nextStart","bufferLen","bufferStart","bufferEnd","bufferStartNext","buffered2","diff","buf2len","buf2end","buffer_helper","demuxer_inline","events_events","events_default","webworkify_webpack","webworkify_webpack_default","demuxer_MediaSource","demuxer_Demuxer","Demuxer","forwardMessage","ev","mp4","enableWorker","Worker","w","onwmsg","onWorkerMessage","addEventListener","onerror","filename","lineno","postMessage","cmd","URL","revokeObjectURL","objectURL","removeEventListener","terminate","nextSN","ArrayBuffer","demux_demuxer","TimeRanges","timeRanges","stream_controller__createClass","State","STOPPED","IDLE","FRAG_LOADING_WAITING_RETRY","WAITING_LEVEL","PARSING","PARSED","ENDED","stream_controller_StreamController","StreamController","audioCodecSwap","ticks","_state","ontick","tick","stopLoad","timer","clearInterval","startLoad","startPosition","lastCurrentTime","setInterval","fragLoadError","startFragRequested","startLevel","bitrateTest","nextLoadLevel","loadedmetadata","nextLoadPosition","forceStartLoad","fragCurrent","fragPrevious","doTick","setTimeout","_doTickIdle","retryDate","seeking","_checkBuffer","_checkFragmentChanged","levelLastLoaded","startFragPrefetch","currentTime","levelInfo","levelBitrate","maxBufLen","maxBufferSize","maxBufferLength","maxMaxBufferLength","mediaBuffer","altAudio","_fetchPayloadOrEos","fragLen","initialLiveManifestSize","_ensureFragmentAtLivePoint","_findFragment","_loadFragmentOrKey","maxLatency","liveMaxLatencyDuration","liveMaxLatencyDurationCount","maxFragLookUpTolerance","liveSyncPosition","computeLivePosition","readyState","targetSN","fragNext","foundFrag","fragmentWithinToleranceTest","candidateLookupTolerance","curSNIdx","sameLevel","nextFrag","loadCounter","fragLoadIdx","maxThreshold","fragLoadingLoopThreshold","loadIdx","autoLevel","autoLevelEnabled","getBufferedFrag","_bufferedFrags","followingBufferedFrag","fragPlayingCurrent","playbackRate","fragPlaying","fragPlayingLevel","immediateLevelSwitch","immediateSwitch","previouslyPaused","paused","pause","flushMainBuffer","POSITIVE_INFINITY","immediateLevelSwitchEnd","play","nextLevelSwitch","fetchdelay","nextBufferedFrag","nextLevelId","nextLevel","fragLastKbps","startOffset","endOffset","flushScope","onMediaAttached","onvseeking","onMediaSeeking","onvseeked","onMediaSeeked","onvended","onMediaEnded","autoStartLoad","onMediaDetaching","ended","tolerance","fragStartOffset","fragEndOffset","stalled","onManifestParsed","heaac","audioCodecSwitch","onLevelLoaded","newLevelId","curLevel","onKeyLoaded","onFragLoaded","fragLoaded","currentLevel","tbuffered","defaultAudioCodec","lastAudioCodec","pendingBuffering","appended","mediaSeeking","initSegmentData","onFragParsingInitSegment","fragNew","trackName","ua","levelCodec","parent","content","onFragParsingData","_this2","onFragParsed","_checkAppendedParsed","onAudioTrackSwitching","onAudioTrackSwitched","videoBuffer","onBufferCreated","mediaTrack","alternate","onBufferAppended","pending","bufferedFrags","total","tfirst","mediaBuffered","delay","_reduceMaxBufferLength","levelRetry","minLength","startPositionBuffered","firstbufferedPosition","startNotBufferedButClose","expectedPlaying","playheadMoving","stallReported","nudgeRetry","tnow","stalledDuration","lowBufferWatchdogPeriod","nextBufferStart","nudgeOffset","hole","highBufferWatchdogPeriod","nudgeMaxRetry","_currentTime","targetTime","onFragLoadEmergencyAborted","onBufferFlushed","swapAudioCodec","targetLatency","liveSyncDuration","liveSyncDurationCount","nextState","previousState","_liveSyncPosition","stream_controller","level_controller__createClass","level_controller_LevelController","LevelController","canload","currentLevelIndex","manualLevelIndex","cleanTimer","clearTimeout","_levels","levelRetryCount","loadError","loadLevel","onManifestLoaded","bitrateStart","levelSet","levelFromSet","videoCodecFound","audioCodecFound","chromeOrFirefox","fragmentError","urlId","_ref","_ref2","_firstLevel","firstLevel","setLevelInternal","newLevel","levelProperties","levelError","levelIndex","recoverLevel","errorEvent","errorDetails","redundantLevels","nextAutoLevel","_ref3","_this3","reloadInterval","trequest","urlIndex","_startLevel","configStartLevel","level_controller","id3_track_controller_ID3TrackController","ID3TrackController","onFragParsingMetadata","addTextTrack","mode","Cue","WebKitDataCue","id3_track_controller","EWMA","halfLife","alpha_","exp","estimate_","totalWeight_","weight","adjAlpha","getTotalWeight","getEstimate","zeroFactor","ewma","ewma_bandwidth_estimator_EwmaBandWidthEstimator","EwmaBandWidthEstimator","slow","fast","defaultEstimate","defaultEstimate_","minWeight_","minDelayMs_","slow_","fast_","durationMs","numBytes","bandwidth","canEstimate","ewma_bandwidth_estimator","abr_controller__createClass","abr_controller_AbrController","AbrController","lastLoadedFragLevel","_nextAutoLevel","_bwEstimator","onCheck","_abandonRulesCheck","clearTimer","isLive","ewmaFast","ewmaSlow","abrEwmaFastLive","abrEwmaSlowLive","abrEwmaFastVoD","abrEwmaSlowVoD","abrEwmaDefaultEstimate","minAutoLevel","aborted","requestDelay","loadRate","bw","realBitrate","expectedLen","fragLoadedDelay","bufferStarvationDelay","fragLevelNextLoadedDelay","levelNextBitrate","abrMaxWithRealBitrate","loadedBytes","loadedDuration","onFragBuffered","fragLoadingProcessingMs","bwEstimate","bitrateTestDelay","_findBestLevel","currentFragDuration","currentBw","maxAutoLevel","maxFetchDuration","bwFactor","bwUpFactor","avgDuration","adjustedbw","fetchDuration","forcedAutoLevel","bwEstimator","nextABRAutoLevel","_nextABRAutoLevel","avgbw","bestLevel","abrBandWidthFactor","abrBandWidthUpFactor","maxStarvationDelay","maxLoadingDelay","abr_controller","buffer_controller_MediaSource","buffer_controller_BufferController","BufferController","_msDuration","_levelDuration","_live","_objectUrl","onsbue","onSBUpdateEnd","onsbe","onSBUpdateError","pendingTracks","onLevelPtsUpdated","audioBuffer","timestampOffset","updating","audioTimestampOffset","audioExpected","videoExpected","sourceBufferNb","onMediaAttaching","ms","onmso","onMediaSourceOpen","onmse","onMediaSourceEnded","onmsc","onMediaSourceClose","src","createObjectURL","endOfStream","removeAttribute","flushRange","segments","checkPendingTracks","pendingTracksNb","createSourceBuffers","doAppending","_needsFlush","doFlush","_needsEos","checkEos","appending","counter","segment","updateMediaElementDuration","onBufferReset","sb","removeSourceBuffer","onBufferCodecs","mimeType","addSourceBuffer","onBufferAppending","onBufferAppendFail","onBufferEos","dataType","sbobj","onBufferFlushing","flushBufferCounter","onLevelUpdated","liveDurationInfinity","range","flushBuffer","appendError","code","appendErrorMaxRetry","typeIn","bufStart","bufEnd","flushStart","flushEnd","buffer_controller","cap_level_controller__createClass","cap_level_controller_CapLevelController","CapLevelController","capLevelToPlayerSize","restrictedLevels","autoLevelCapping","onFpsDropLevelCapping","isLevelAllowed","droppedLevel","HTMLVideoElement","getMaxLevel","detectPlayerSize","levelsLength","streamController","capLevelIndex","validLevels","getMaxLevelByMediaSize","mediaWidth","mediaHeight","maxLevelIndex","clientWidth","offsetWidth","contentScaleFactor","clientHeight","offsetHeight","devicePixelRatio","cap_level_controller","fps_controller_FPSController","FPSController","isVideoPlaybackQualityAvailable","capLevelOnFPSDrop","getVideoPlaybackQuality","checkFPSInterval","fpsDroppedMonitoringPeriod","checkFPS","decodedFrames","droppedFrames","lastTime","currentPeriod","currentDropped","lastDroppedFrames","currentDecoded","lastDecodedFrames","droppedFPS","totalDroppedFrames","fpsDroppedMonitoringThreshold","videoPlaybackQuality","totalVideoFrames","droppedVideoFrames","webkitDecodedFrameCount","webkitDroppedFrameCount","fps_controller","xhr_loader_XhrLoader","XhrLoader","xhrSetup","requestTimeout","retryTimeout","callbacks","retry","loadInternal","xhr","XMLHttpRequest","open","status","setRequestHeader","onreadystatechange","readystatechange","onprogress","send","currentTarget","responseText","responseURL","statusText","lengthComputable","xhr_loader","audio_track_controller__createClass","audio_track_controller_AudioTrackController","AudioTrackController","updateTrack","defaultFound","onAudioTrackLoaded","setAudioTrackInternal","newId","eventObj","audioTrackId","audio_track_controller","audio_stream_controller__createClass","audio_stream_controller_State","STARTING","PAUSED","WAITING_TRACK","WAITING_INIT_PTS","audio_stream_controller_AudioStreamController","AudioStreamController","waitingFragment","videoTrackCC","onInitPtsFound","demuxerId","trackDetails","mainBufferInfo","audioSwitch","nextBuffered","isSeeking","waitingFrag","waitingFragCC","onAudioTracksUpdated","appendObj","pendingData","appendOnBufferFlush","_config","audio_stream_controller","vttcue","findDirectionSetting","directionSetting","findAlignSetting","alignSetting","extend","cobj","isIE8","baseObj","document","createElement","hasBeenReset","_id","_pauseOnExit","_startTime","_endTime","_text","_region","_vertical","_snapToLines","_line","_lineAlign","_position","_positionAlign","_size","_align","setting","SyntaxError","autoKeyword","displayState","","lr","rl","middle","left","right","getCueAsHTML","WebVTT","convertCueToDOMTree","decode","decodeURIComponent","encodeURIComponent","dflt","defaultKey","has","collectNextLine","alreadyCollectedLine","hasSubstring","oncue","flush","onflush","vttparser","specialCea608CharsCodes","42","92","94","95","96","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153","154","155","156","157","158","159","160","161","162","163","164","165","166","167","168","169","170","171","172","173","174","175","176","177","178","179","180","181","182","183","184","185","186","187","188","189","190","191","192","193","194","195","196","197","198","199","200","201","202","203","204","205","206","207","getCharForByte","byte","charCode","NR_ROWS","NR_COLS","rowsLowCh1","17","18","21","22","23","16","19","20","rowsHighCh1","rowsLowCh2","25","26","29","30","31","24","27","28","rowsHighCh2","backgroundColors","cea_608_parser_logger","verboseFilter","DATA","DEBUG","INFO","WARNING","TEXT","time","verboseLevel","setTime","newTime","severity","minLevel","numArrayToHexArray","numArray","hexArray","PenState","foreground","underline","italics","background","flash","reset","setStyles","styles","attribs","style","isDefault","equals","other","copy","newPenState","StyledUnicodeChar","penState","setChar","setPenState","newChar","Row","currPenState","equal","empty","setCursor","absPos","moveCursor","relPos","newPos","backSpace","insertChar","char","clearFromPos","startPos","clear","clearToEndOfRow","getTextString","setPenStyles","CaptionScreen","currRow","nrRollUpRows","setPen","setPAC","pacData","newRow","topRowIndex","lastOutputScreen","prevLineTime","prevPos","color","setBkgData","bkgData","setRollUpRows","nrRows","rollUp","getDisplayText","topRow","asOneRow","displayText","rowNr","rowText","getTextAndFormat","Cea608Channel","channelNumber","outputFilter","chNr","verbose","displayedMemory","nonDisplayedMemory","currRollUpRow","writeScreen","lastCueEndTime","getHandler","setHandler","newHandler","setMode","newMode","insertChars","screen","outputDataUpdate","ccRCL","ccBS","ccAOF","ccAON","ccDER","ccRU","ccFON","ccRDC","ccTR","ccRTD","ccEDM","ccCR","ccENM","ccEOC","ccTO","nrCols","ccMIDROW","colorIndex","colors","dispatch","dispatchCue","cueSplitAtTime","Cea608Parser","field","out1","out2","outputs","channels","currChNr","lastCmdA","lastCmdB","bufferedData","dataCounters","padding","addData","byteList","cmdFound","charsFound","parseCmd","parseMidrow","parsePAC","parseBackgroundAttributes","parseChars","channel","cond1","cond2","case1","case2","interpretPAC","pacIndex","channelNr","charCodes","charCode1","oneCode","hexCodes","cea_608_parser","OutputFilter","timelineController","addCues","createCaptionsTrack","output_filter","startsWith","inputString","searchString","cueString2millis","timeString","secs","mins","hours","hash","calculateOffset","vttCCs","presentationTime","currCC","prevCC","new","presentationOffset","WebVTTParser","vttByteArray","syncPTS","callBack","errorCallBack","vttLines","cueTime","mpegTs","localTime","parsingError","inHeader","parser","cueOffset","onparsingerror","webvtt_parser","timeline_controller_TimelineController","TimelineController","enabled","Cues","cueHandler","textTracks","unparsedVttFrags","cueRanges","enableCEA708Captions","channel1","channel2","cea608Parser","ranges","merged","cueRange","overlap","getExistingTrack","propName","sendAddTrackEvent","createEvent","initEvent","dispatchEvent","trackVar","existingTrack","createTextTrack","captionsTextTrack1LanguageCode","_cleanTracks","lastSn","enableWebVTT","inUseTracks","onLevelSwitching","closedCaptions","decryptData","_parseVTTs","success","currentTrack","getCueById","textTrackCue","onFragDecrypted","onFragParsingUserdata","ccdatas","extractCea608Data","tmpByte","ccbyte1","ccbyte2","ccValid","ccType","actualCCBytes","timeline_controller","subtitle_track_controller__createClass","subtitle_track_controller_SubtitleTrackController","SubtitleTrackController","subtitleDisplay","_onTextTracksChanged","subtitleTrack","queuedDefaultTrack","trackChangeListener","useTextTrackPolling","subtitlePollingInterval","subtitleTracks","onTick","onSubtitleTrackLoaded","_this4","setSubtitleTrackInternal","subtitleTrackId","subtitle_track_controller","subtitle_stream_controller_State","subtitle_stream_controller_SubtitleStreamController","SubtitleStreamController","vttFragSNsProcessed","vttFragQueues","currentlyProcessing","currentTrackId","clearVttFragQueues","onSubtitleFragProcessed","processedFragSNs","fragQueue","currentFragSN","alreadyProcessed","alreadyInQueue","some","fragInQueue","onSubtitleTracksUpdated","_this5","onSubtitleTrackSwitch","subtitle_stream_controller","hlsDefaultConfig","fetchSetup","abrController","bufferController","capLevelController","fpsController","minAutoBitrate","subtitleStreamController","subtitleTrackController","captionsTextTrack1Label","captionsTextTrack2Label","captionsTextTrack2LanguageCode","audioStreamController","audioTrackController","hls__createClass","hls_Hls","Hls","defaultConfig","DefaultConfig","prop","_autoLevelCapping","playListLoader","fragmentLoader","keyLoader","id3TrackController","levelController","networkControllers","Controller","coreComponents","isSupported","detachMedia","component","attachMedia","loadSource","location","href","controller","recoverMediaError","manualLevel","webpackBootstrapFunc","oe","ENTRY_MODULE","quoteRegExp","str","getModuleDependencies","retval","fnString","wrapperSignature","webpackRequireName","re","getRequiredModules","sources","modulesQueue","requiredModules","seenModules","moduleToCheck","newModules","options","all","blob","Blob","bare","webkitURL","mozURL","msURL","workerUrl","worker","__WEBPACK_IMPORTED_MODULE_0__demux_demuxer_inline__","__WEBPACK_IMPORTED_MODULE_1__events__","__WEBPACK_IMPORTED_MODULE_2__utils_logger__","__WEBPACK_IMPORTED_MODULE_3_events__","__WEBPACK_IMPORTED_MODULE_3_events___default","DemuxerWorker","transferable","Html5HlsJS","tech","errorHandlerFactory","_recoverDecodingErrorDate","_recoverAudioCodecErrorDate","options_","el","hlsjsConfig","hlsjsErrorHandler","videoTagErrorHandler","mediaError","MEDIA_ERR_DECODE","dispose","Events","eventName","featuresNativeTextTracks","hlsTypeRE","hlsExtRE","HlsSourceHandler","canHandleSource","skipContribHlsJs","handleSource","canPlayType","videojs","html5Tech","getTech","getComponent","registerSourceHandler"],"mappings":"CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EA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D,MAAA23E,EAAAh4E,aAKA0kC,EAAA2wC,YAAAgD,GACA3zC,EAAA4wC,WAAAxqC,EAAAgjB,KAtHA,GAAAumB,GAAAx2E,EAAA,EAEAy7B,QAAA+6C,MACA/6C,OAAA+6C,MAsHA,IAAA0E,GAAA,kDACAC,EAAA,UAEAC,GACAC,gBAAA,SAAApuC,GACA,MAAAA,GAAAquC,iBACA,GAEAJ,EAAA7iE,KAAA40B,EAAArrC,MACA,WAEAu5E,EAAA9iE,KAAA40B,EAAAgjB,KACA,QAGA,IAGAsrB,aAAA,SAAAtuC,EAAAktC,GACA,UAAAD,GAAAjtC,EAAAktC,IAEAqB,YAAA,SAAA55E,GACA,MAAAs5E,GAAA7iE,KAAAzW,GACA,WAGA,IAIA,IAAA40E,EAAAa,cAAA,CACA,GAAAoE,GAAAz7E,EAAA,EAKA,IAFAy7E,OAAAppC,SAAAopC,EAEA,CACA,GAAAC,GAAAD,EAAAE,SAAAF,EAAAE,QAAA,QACAD,MAAAD,EAAAG,cAAAH,EAAAG,aAAA,SAEAF,GACAA,EAAAG,sBAAAT,EAAA,OAIAn5E,SAAA2B,KAAA","file":"videojs-contrib-hlsjs.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"video.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"video.js\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"video.js\")) : factory(root[\"videojs\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"video.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"video.js\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"video.js\")) : factory(root[\"videojs\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 2);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Hls\"] = factory();\n\telse\n\t\troot[\"Hls\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return enableLogs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return logger; });\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nfunction noop() {}\n\nvar fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\n\nvar exportedLogger = fakeLogger;\n\n/*globals self: false */\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\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\n\nfunction consolePrintFn(type) {\n var func = self.console[type];\n if (func) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n func.apply(self.console, args);\n };\n }\n return noop;\n}\n\nfunction exportLoggerFunctions(debugConfig) {\n for (var _len2 = arguments.length, functions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n functions[_key2 - 1] = arguments[_key2];\n }\n\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\n\nvar enableLogs = function enableLogs(debugConfig) {\n if (debugConfig === true || (typeof debugConfig === 'undefined' ? 'undefined' : _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();\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n } else {\n exportedLogger = fakeLogger;\n }\n};\n\nvar logger = exportedLogger;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony default export */ __webpack_exports__[\"a\"] = ({\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be reset - data: { }\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when sourcebuffers have been created - data: { tracks : tracks }\n BUFFER_CREATED: 'hlsBufferCreated',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer - data : { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent}\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data - data: { }\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data { startOffset, endOffset }\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media buffer has been flushed - data: { }\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels], audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels], firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level switch is requested - data: { level : id of new level } // deprecated in favor LEVEL_SWITCHING\n LEVEL_SWITCH: 'hlsLevelSwitch',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCHING: 'hlsLevelSwitching',\n // fired when a level switch is effective - data: { level : id of new level }\n LEVEL_SWITCHED: 'hlsLevelSwitched',\n // fired when a level playlist loading starts - data: { url : level URL, level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired to notify that audio track lists has been updated - data: { audioTracks : audioTracks }\n AUDIO_TRACKS_UPDATED: 'hlsAudioTracksUpdated',\n // fired when an audio track switch occurs - data: { id : audio track id } // deprecated in favor AUDIO_TRACK_SWITCHING\n AUDIO_TRACK_SWITCH: 'hlsAudioTrackSwitch',\n // fired when an audio track switching is requested - data: { id : audio track id }\n AUDIO_TRACK_SWITCHING: 'hlsAudioTrackSwitching',\n // fired when an audio track switch actually occurs - data: { id : audio track id }\n AUDIO_TRACK_SWITCHED: 'hlsAudioTrackSwitched',\n // fired when an audio track loading starts - data: { url : audio track URL, id : audio track id }\n AUDIO_TRACK_LOADING: 'hlsAudioTrackLoading',\n // fired when an audio track loading finishes - data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } }\n AUDIO_TRACK_LOADED: 'hlsAudioTrackLoaded',\n // fired to notify that subtitle track lists has been updated - data: { subtitleTracks : subtitleTracks }\n SUBTITLE_TRACKS_UPDATED: 'hlsSubtitleTracksUpdated',\n // fired when an subtitle track switch occurs - data: { id : subtitle track id }\n SUBTITLE_TRACK_SWITCH: 'hlsSubtitleTrackSwitch',\n // fired when a subtitle track loading starts - data: { url : subtitle track URL, id : subtitle track id }\n SUBTITLE_TRACK_LOADING: 'hlsSubtitleTrackLoading',\n // fired when a subtitle track loading finishes - data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } }\n SUBTITLE_TRACK_LOADED: 'hlsSubtitleTrackLoaded',\n // fired when a subtitle fragment has been processed - data: { success : boolean, frag : the processed frag }\n SUBTITLE_FRAG_PROCESSED: 'hlsSubtitleFragProcessed',\n // fired when the first timestamp is found - data: { id : demuxer id, initPTS: initPTS, frag : fragment object }\n INIT_PTS_FOUND: 'hlsInitPtsFound',\n // fired when a fragment loading starts - data: { frag : fragment object }\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded } }\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: { frag : fragment object }\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length } }\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when a fragment has finished decrypting - data: { id : demuxer id, frag: fragment object, payload : fragment payload, stats : { tstart, tdecrypt } }\n FRAG_DECRYPTED: 'hlsFragDecrypted',\n // fired when Init Segment has been extracted from fragment - data: { id : demuxer id, frag: fragment object, moov : moov MP4 box, codecs : codecs found while parsing fragment }\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { id : demuxer id, frag: fragment object, samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { id : demuxer id, frag: fragment object, data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: { id : demuxer id, frag: fragment object }\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { id : demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length, bwEstimate } }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { id : demuxer id, frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: { curentDropped, currentDecoded, totalDroppedFrames }\n FPS_DROP: 'hlsFpsDrop',\n //triggered when FPS drop triggers auto level capping - data: { level, droppedlevel }\n FPS_DROP_LEVEL_CAPPING: 'hlsFpsDropLevelCapping',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data }\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example - data: { }\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object }\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length } }\n KEY_LOADED: 'hlsKeyLoaded',\n // fired upon stream controller state transitions - data: { previousState, nextState }\n STREAM_STATE_TRANSITION: 'hlsStreamStateTransition'\n});\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return ErrorTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return ErrorDetails; });\nvar ErrorTypes = {\n // Identifier for a network error (loading error / timeout ...)\n NETWORK_ERROR: 'networkError',\n // Identifier for a media Error (video/parsing/mediasource error)\n MEDIA_ERROR: 'mediaError',\n // Identifier for a mux Error (demuxing/remuxing)\n MUX_ERROR: 'muxError',\n // Identifier for all other errors\n OTHER_ERROR: 'otherError'\n};\n\nvar ErrorDetails = {\n // Identifier for a manifest load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_ERROR: 'manifestLoadError',\n // Identifier for a manifest load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut',\n // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason}\n MANIFEST_PARSING_ERROR: 'manifestParsingError',\n // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason}\n MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError',\n // Identifier for a level load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_ERROR: 'levelLoadError',\n // Identifier for a level load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut',\n // Identifier for a level switch error - data: { level : faulty level Id, event : error description}\n LEVEL_SWITCH_ERROR: 'levelSwitchError',\n // Identifier for an audio track load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_ERROR: 'audioTrackLoadError',\n // Identifier for an audio track load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_TIMEOUT: 'audioTrackLoadTimeOut',\n // Identifier for fragment load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n FRAG_LOAD_ERROR: 'fragLoadError',\n // Identifier for fragment loop loading error - data: { frag : fragment object}\n FRAG_LOOP_LOADING_ERROR: 'fragLoopLoadingError',\n // Identifier for fragment load timeout error - data: { frag : fragment object}\n FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut',\n // Identifier for a fragment decryption error event - data: {id : demuxer Id,frag: fragment object, reason : parsing error description }\n FRAG_DECRYPT_ERROR: 'fragDecryptError',\n // Identifier for a fragment parsing error event - data: { id : demuxer Id, reason : parsing error description }\n // will be renamed DEMUX_PARSING_ERROR and switched to MUX_ERROR in the next major release\n FRAG_PARSING_ERROR: 'fragParsingError',\n // Identifier for a remux alloc error event - data: { id : demuxer Id, frag : fragment object, bytes : nb of bytes on which allocation failed , reason : error text }\n REMUX_ALLOC_ERROR: 'remuxAllocError',\n // Identifier for decrypt key load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n KEY_LOAD_ERROR: 'keyLoadError',\n // Identifier for decrypt key load timeout error - data: { frag : fragment object}\n KEY_LOAD_TIMEOUT: 'keyLoadTimeOut',\n // Triggered when an exception occurs while adding a sourceBuffer to MediaSource - data : { err : exception , mimeType : mimeType }\n BUFFER_ADD_CODEC_ERROR: 'bufferAddCodecError',\n // Identifier for a buffer append error - data: append error description\n BUFFER_APPEND_ERROR: 'bufferAppendError',\n // Identifier for a buffer appending error event - data: appending error description\n BUFFER_APPENDING_ERROR: 'bufferAppendingError',\n // Identifier for a buffer stalled error event\n BUFFER_STALLED_ERROR: 'bufferStalledError',\n // Identifier for a buffer full event\n BUFFER_FULL_ERROR: 'bufferFullError',\n // Identifier for a buffer seek over hole event\n BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',\n // Identifier for a buffer nudge on stall (playback is stuck although currentTime is in a buffered area)\n BUFFER_NUDGE_ON_STALL: 'bufferNudgeOnStall',\n // Identifier for an internal exception happening inside hls.js while handling an event\n INTERNAL_EXCEPTION: 'internalException'\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return utf8ArrayToStr; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * ID3 parser\n */\nvar ID3 = function () {\n function ID3() {\n _classCallCheck(this, ID3);\n }\n\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 header is found\n */\n ID3.isHeader = 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\n return false;\n };\n\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 footer is found\n */\n\n\n ID3.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\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 {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {Uint8Array} - The block of data containing any ID3 tags found\n */\n\n\n ID3.getID3Data = function getID3Data(data, offset) {\n var front = offset;\n var length = 0;\n\n while (ID3.isHeader(data, offset)) {\n //ID3 header is 10 bytes\n length += 10;\n\n var size = ID3._readSize(data, offset + 6);\n length += size;\n\n if (ID3.isFooter(data, offset + 10)) {\n //ID3 footer is 10 bytes\n length += 10;\n }\n\n offset += length;\n }\n\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n\n return undefined;\n };\n\n ID3._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\n /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param {Uint8Array} data - Block of data containing one or more ID3 tags\n * @return {number} - The timestamp\n */\n\n\n ID3.getTimeStamp = function getTimeStamp(data) {\n var frames = ID3.getID3Frames(data);\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if (ID3.isTimeStampFrame(frame)) {\n return ID3._readTimeStamp(frame);\n }\n }\n\n return undefined;\n };\n\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n * @param {ID3 frame} frame\n */\n\n\n ID3.isTimeStampFrame = function isTimeStampFrame(frame) {\n return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';\n };\n\n ID3._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 = ID3._readSize(data, 4);\n\n //skip frame id, size, and flags\n var offset = 10;\n\n return { type: type, size: size, data: data.subarray(offset, offset + size) };\n };\n\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags\n * @return {ID3 frame[]} - Array of ID3 frame objects\n */\n\n\n ID3.getID3Frames = function getID3Frames(id3Data) {\n var offset = 0;\n var frames = [];\n\n while (ID3.isHeader(id3Data, offset)) {\n var size = ID3._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 = ID3._getFrameData(id3Data.subarray(offset));\n var frame = ID3._decodeFrame(frameData);\n if (frame) {\n frames.push(frame);\n }\n //skip frame header and frame data\n offset += frameData.size + 10;\n }\n\n if (ID3.isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n\n return frames;\n };\n\n ID3._decodeFrame = function _decodeFrame(frame) {\n if (frame.type === 'PRIV') {\n return ID3._decodePrivFrame(frame);\n } else if (frame.type[0] === 'T') {\n return ID3._decodeTextFrame(frame);\n } else if (frame.type[0] === 'W') {\n return ID3._decodeURLFrame(frame);\n }\n\n return undefined;\n };\n\n ID3._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\n if (pts33Bit) {\n timestamp += 47721858.84; // 2^32 / 90\n }\n\n return Math.round(timestamp);\n }\n\n return undefined;\n };\n\n ID3._decodePrivFrame = function _decodePrivFrame(frame) {\n /*\n Format: \\0\n */\n if (frame.size < 2) {\n return undefined;\n }\n\n var owner = ID3._utf8ArrayToStr(frame.data, true);\n var privateData = new Uint8Array(frame.data.subarray(owner.length + 1));\n\n return { key: frame.type, info: owner, data: privateData.buffer };\n };\n\n ID3._decodeTextFrame = function _decodeTextFrame(frame) {\n if (frame.size < 2) {\n return undefined;\n }\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 = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return { key: frame.type, info: description, data: value };\n } else {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = ID3._utf8ArrayToStr(frame.data.subarray(1));\n return { key: frame.type, data: text };\n }\n };\n\n ID3._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\n var index = 1;\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return { key: frame.type, info: description, data: value };\n } else {\n /*\n Format:\n [0-?] = {URL}\n */\n var url = ID3._utf8ArrayToStr(frame.data);\n return { key: frame.type, data: url };\n }\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 \n * Version: 1.0\n * LastModified: Dec 25 1999\n * This library is free. You can redistribute it and/or modify it.\n */\n\n\n ID3._utf8ArrayToStr = function _utf8ArrayToStr(array) {\n var exitOnNull = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n\n var len = array.length;\n var c = void 0;\n var char2 = void 0;\n var char3 = void 0;\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:case 1:case 2:case 3:case 4:case 5:case 6:case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c);\n break;\n case 12: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 default:\n }\n }\n return out;\n };\n\n return ID3;\n}();\n\nvar utf8ArrayToStr = ID3._utf8ArrayToStr;\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ID3);\n\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// CONCATENATED MODULE: ./src/crypt/aes-crypto.js\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar AESCrypto = function () {\n function AESCrypto(subtle, iv) {\n _classCallCheck(this, AESCrypto);\n\n this.subtle = subtle;\n this.aesIV = iv;\n }\n\n AESCrypto.prototype.decrypt = function decrypt(data, key) {\n return this.subtle.decrypt({ name: 'AES-CBC', iv: this.aesIV }, key, data);\n };\n\n return AESCrypto;\n}();\n\n/* harmony default export */ var aes_crypto = (AESCrypto);\n// CONCATENATED MODULE: ./src/crypt/fast-aes-key.js\nfunction fast_aes_key__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar FastAESKey = function () {\n function FastAESKey(subtle, key) {\n fast_aes_key__classCallCheck(this, FastAESKey);\n\n this.subtle = subtle;\n this.key = key;\n }\n\n FastAESKey.prototype.expandKey = function expandKey() {\n return this.subtle.importKey('raw', this.key, { name: 'AES-CBC' }, false, ['encrypt', 'decrypt']);\n };\n\n return FastAESKey;\n}();\n\n/* harmony default export */ var fast_aes_key = (FastAESKey);\n// CONCATENATED MODULE: ./src/crypt/aes-decryptor.js\nfunction aes_decryptor__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar AESDecryptor = function () {\n function AESDecryptor() {\n aes_decryptor__classCallCheck(this, AESDecryptor);\n\n // Static after running initTable\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\n // Changes during runtime\n this.key = new Uint32Array(0);\n\n this.initTable();\n }\n\n // Using view.getUint32() also swaps the byte order.\n\n\n AESDecryptor.prototype.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\n AESDecryptor.prototype.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\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\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\n AESDecryptor.prototype.expandKey = function expandKey(keyBuffer) {\n // convert keyBuffer to Uint32Array\n var key = this.uint8ArrayToUint32Array_(keyBuffer);\n var sameKey = true;\n var offset = 0;\n\n while (offset < key.length && sameKey) {\n sameKey = key[offset] === this.key[offset];\n offset++;\n }\n\n if (sameKey) {\n return;\n }\n\n this.key = key;\n var keySize = this.keySize = key.length;\n\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\n\n var ksRows = this.ksRows = (keySize + 6 + 1) * 4;\n var ksRow = void 0;\n var invKsRow = void 0;\n\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\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\n var prev = void 0;\n var t = void 0;\n\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n t = prev;\n\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\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\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\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\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n };\n\n // Adding this as a method greatly improves performance.\n\n\n AESDecryptor.prototype.networkToHostOrderSwap = function networkToHostOrderSwap(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n\n AESDecryptor.prototype.decrypt = function decrypt(inputArrayBuffer, offset, aesIV) {\n var nRounds = this.keySize + 6;\n var invKeySchedule = this.invKeySchedule;\n var invSBOX = this.invSBox;\n\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\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\n var inputInt32 = new Int32Array(inputArrayBuffer);\n var outputInt32 = new Int32Array(inputInt32.length);\n\n var t0 = void 0,\n t1 = void 0,\n t2 = void 0,\n t3 = void 0;\n var s0 = void 0,\n s1 = void 0,\n s2 = void 0,\n s3 = void 0;\n var inputWords0 = void 0,\n inputWords1 = void 0,\n inputWords2 = void 0,\n inputWords3 = void 0;\n\n var ksRow, i;\n var swapWord = this.networkToHostOrderSwap;\n\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\n s0 = inputWords0 ^ invKeySchedule[0];\n s1 = inputWords3 ^ invKeySchedule[1];\n s2 = inputWords2 ^ invKeySchedule[2];\n s3 = inputWords1 ^ invKeySchedule[3];\n\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\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 ksRow = 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\n offset = offset + 4;\n }\n\n return outputInt32.buffer;\n };\n\n AESDecryptor.prototype.destroy = function destroy() {\n this.key = undefined;\n this.keySize = undefined;\n this.ksRows = undefined;\n\n this.sBox = undefined;\n this.invSBox = undefined;\n this.subMix = undefined;\n this.invSubMix = undefined;\n this.keySchedule = undefined;\n this.invKeySchedule = undefined;\n\n this.rcon = undefined;\n };\n\n return AESDecryptor;\n}();\n\n/* harmony default export */ var aes_decryptor = (AESDecryptor);\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/crypt/decrypter.js\nfunction decrypter__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\n\n\n\n/*globals self: false */\n\nvar decrypter_Decrypter = function () {\n function Decrypter(observer, config) {\n decrypter__classCallCheck(this, Decrypter);\n\n this.observer = observer;\n this.config = config;\n this.logEnabled = true;\n try {\n var browserCrypto = crypto ? crypto : self.crypto;\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n } catch (e) {}\n this.disableWebCrypto = !this.subtle;\n }\n\n Decrypter.prototype.isSync = function isSync() {\n return this.disableWebCrypto && this.config.enableSoftwareAES;\n };\n\n Decrypter.prototype.decrypt = function decrypt(data, key, iv, callback) {\n var _this = this;\n\n if (this.disableWebCrypto && this.config.enableSoftwareAES) {\n if (this.logEnabled) {\n logger[\"b\" /* logger */].log('JS AES decrypt');\n this.logEnabled = false;\n }\n var decryptor = this.decryptor;\n if (!decryptor) {\n this.decryptor = decryptor = new aes_decryptor();\n }\n decryptor.expandKey(key);\n callback(decryptor.decrypt(data, 0, iv));\n } else {\n if (this.logEnabled) {\n logger[\"b\" /* logger */].log('WebCrypto AES decrypt');\n this.logEnabled = false;\n }\n var subtle = this.subtle;\n if (this.key !== key) {\n this.key = key;\n this.fastAesKey = new fast_aes_key(subtle, key);\n }\n\n this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n var crypto = new aes_crypto(subtle, iv);\n crypto.decrypt(data, aesKey).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n }).then(function (result) {\n callback(result);\n });\n }).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n };\n\n Decrypter.prototype.onWebCryptoError = function onWebCryptoError(err, data, key, iv, callback) {\n if (this.config.enableSoftwareAES) {\n logger[\"b\" /* logger */].log('WebCrypto Error, disable WebCrypto API');\n this.disableWebCrypto = true;\n this.logEnabled = true;\n this.decrypt(data, key, iv, callback);\n } else {\n logger[\"b\" /* logger */].error('decrypting error : ' + err.message);\n this.observer.trigger(Event.ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_DECRYPT_ERROR, fatal: true, reason: err.message });\n }\n };\n\n Decrypter.prototype.destroy = function destroy() {\n var decryptor = this.decryptor;\n if (decryptor) {\n decryptor.destroy();\n this.decryptor = undefined;\n }\n };\n\n return Decrypter;\n}();\n\n/* harmony default export */ var decrypter = __webpack_exports__[\"a\"] = (decrypter_Decrypter);\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// see https://tools.ietf.org/html/rfc1808\r\n\r\n/* jshint ignore:start */\r\n(function(root) { \r\n/* jshint ignore:end */\r\n\r\n var URL_REGEX = /^((?:[^\\/;?#]+:)?)(\\/\\/[^\\/\\;?#]*)?(.*?)??(;.*?)?(\\?.*?)?(#.*?)?$/;\r\n var FIRST_SEGMENT_REGEX = /^([^\\/;?#]*)(.*)$/;\r\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\r\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/).*?(?=\\/)/g;\r\n\r\n var URLToolkit = { // jshint ignore:line\r\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\r\n // E.g\r\n // With opts.alwaysNormalize = false (default, spec compliant)\r\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\r\n // With opts.alwaysNormalize = true (default, not spec compliant)\r\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\r\n buildAbsoluteURL: function(baseURL, relativeURL, opts) {\r\n opts = opts || {};\r\n // remove any remaining space and CRLF\r\n baseURL = baseURL.trim();\r\n relativeURL = relativeURL.trim();\r\n if (!relativeURL) {\r\n // 2a) If the embedded URL is entirely empty, it inherits the\r\n // entire base URL (i.e., is set equal to the base URL)\r\n // and we are done.\r\n if (!opts.alwaysNormalize) {\r\n return baseURL;\r\n }\r\n var basePartsForNormalise = this.parseURL(baseURL);\r\n if (!baseParts) {\r\n throw new Error('Error trying to parse base URL.');\r\n }\r\n basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path);\r\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\r\n }\r\n var relativeParts = this.parseURL(relativeURL);\r\n if (!relativeParts) {\r\n throw new Error('Error trying to parse relative URL.');\r\n }\r\n if (relativeParts.scheme) {\r\n // 2b) If the embedded URL starts with a scheme name, it is\r\n // interpreted as an absolute URL and we are done.\r\n if (!opts.alwaysNormalize) {\r\n return relativeURL;\r\n }\r\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\r\n return URLToolkit.buildURLFromParts(relativeParts);\r\n }\r\n var baseParts = this.parseURL(baseURL);\r\n if (!baseParts) {\r\n throw new Error('Error trying to parse base URL.');\r\n }\r\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\r\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\r\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\r\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\r\n baseParts.netLoc = pathParts[1];\r\n baseParts.path = pathParts[2];\r\n }\r\n if (baseParts.netLoc && !baseParts.path) {\r\n baseParts.path = '/';\r\n }\r\n var builtParts = {\r\n // 2c) Otherwise, the embedded URL inherits the scheme of\r\n // the base URL.\r\n scheme: baseParts.scheme,\r\n netLoc: relativeParts.netLoc,\r\n path: null,\r\n params: relativeParts.params,\r\n query: relativeParts.query,\r\n fragment: relativeParts.fragment\r\n };\r\n if (!relativeParts.netLoc) {\r\n // 3) If the embedded URL's is non-empty, we skip to\r\n // Step 7. Otherwise, the embedded URL inherits the \r\n // (if any) of the base URL.\r\n builtParts.netLoc = baseParts.netLoc;\r\n // 4) If the embedded URL path is preceded by a slash \"/\", the\r\n // path is not relative and we skip to Step 7.\r\n if (relativeParts.path[0] !== '/') {\r\n if (!relativeParts.path) {\r\n // 5) If the embedded URL path is empty (and not preceded by a\r\n // slash), then the embedded URL inherits the base URL path\r\n builtParts.path = baseParts.path;\r\n // 5a) if the embedded URL's is non-empty, we skip to\r\n // step 7; otherwise, it inherits the of the base\r\n // URL (if any) and\r\n if (!relativeParts.params) {\r\n builtParts.params = baseParts.params;\r\n // 5b) if the embedded URL's is non-empty, we skip to\r\n // step 7; otherwise, it inherits the of the base\r\n // URL (if any) and we skip to step 7.\r\n if (!relativeParts.query) {\r\n builtParts.query = baseParts.query;\r\n }\r\n }\r\n } else {\r\n // 6) The last segment of the base URL's path (anything\r\n // following the rightmost slash \"/\", or the entire path if no\r\n // slash is present) is removed and the embedded URL's path is\r\n // appended in its place.\r\n var baseURLPath = baseParts.path;\r\n var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path;\r\n builtParts.path = URLToolkit.normalizePath(newPath);\r\n }\r\n }\r\n }\r\n if (builtParts.path === null) {\r\n builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path;\r\n }\r\n return URLToolkit.buildURLFromParts(builtParts);\r\n },\r\n parseURL: function(url) {\r\n var parts = URL_REGEX.exec(url);\r\n if (!parts) {\r\n return null;\r\n }\r\n return {\r\n scheme: parts[1] || '',\r\n netLoc: parts[2] || '',\r\n path: parts[3] || '',\r\n params: parts[4] || '',\r\n query: parts[5] || '',\r\n fragment: parts[6] || ''\r\n };\r\n },\r\n normalizePath: function(path) {\r\n // The following operations are\r\n // then applied, in order, to the new path:\r\n // 6a) All occurrences of \"./\", where \".\" is a complete path\r\n // segment, are removed.\r\n // 6b) If the path ends with \".\" as a complete path segment,\r\n // that \".\" is removed.\r\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\r\n // 6c) All occurrences of \"/../\", where is a\r\n // complete path segment not equal to \"..\", are removed.\r\n // Removal of these path segments is performed iteratively,\r\n // removing the leftmost matching pattern on each iteration,\r\n // until no matching pattern remains.\r\n // 6d) If the path ends with \"/..\", where is a\r\n // complete path segment not equal to \"..\", that\r\n // \"/..\" is removed.\r\n while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} // jshint ignore:line\r\n return path.split('').reverse().join('');\r\n },\r\n buildURLFromParts: function(parts) {\r\n return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;\r\n }\r\n };\r\n\r\n/* jshint ignore:start */\r\n if(true)\r\n module.exports = URLToolkit;\r\n else if(typeof define === 'function' && define.amd)\r\n define([], function() { return URLToolkit; });\r\n else if(typeof exports === 'object')\r\n exports[\"URLToolkit\"] = URLToolkit;\r\n else\r\n root[\"URLToolkit\"] = URLToolkit;\r\n})(this);\r\n/* jshint ignore:end */\r\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar crypt_decrypter = __webpack_require__(4);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/demux/adts.js\n/**\n * ADTS parser helper\n */\n\n\n\nfunction getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType,\n // :int\n adtsSampleingIndex,\n // :int\n adtsExtensionSampleingIndex,\n // :int\n adtsChanelConfig,\n // :int\n config,\n userAgent = navigator.userAgent.toLowerCase(),\n manifestCodec = audioCodec,\n adtsSampleingRates = [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 adtsSampleingIndex = (data[offset + 2] & 0x3C) >>> 2;\n if (adtsSampleingIndex > adtsSampleingRates.length - 1) {\n observer.trigger(Event.ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: true, reason: 'invalid ADTS sampling index:' + adtsSampleingIndex });\n return;\n }\n adtsChanelConfig = (data[offset + 2] & 0x01) << 2;\n // byte 3\n adtsChanelConfig |= (data[offset + 3] & 0xC0) >>> 6;\n logger[\"b\" /* logger */].log('manifest codec:' + audioCodec + ',ADTS data:type:' + adtsObjectType + ',sampleingIndex:' + adtsSampleingIndex + '[' + adtsSampleingRates[adtsSampleingIndex] + 'Hz],channelConfig:' + adtsChanelConfig);\n // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n if (/firefox/i.test(userAgent)) {\n if (adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n // Android : always use AAC\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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 && adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 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 && (adtsSampleingIndex >= 6 && adtsChanelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChanelConfig === 1) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7;\n // channelConfiguration\n config[1] |= adtsChanelConfig << 3;\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 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 { config: config, samplerate: adtsSampleingRates[adtsSampleingIndex], channelCount: adtsChanelConfig, codec: 'mp4a.40.' + adtsObjectType, manifestCodec: manifestCodec };\n}\n\nfunction isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n}\n\nfunction getHeaderLength(data, offset) {\n return !!(data[offset + 1] & 0x01) ? 7 : 9;\n}\n\nfunction getFullFrameLength(data, offset) {\n return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5;\n}\n\nfunction isHeader(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 if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n}\n\nfunction adts_probe(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 (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n // ADTS frame Length\n var frameLength = headerLength;\n if (offset + 5 < data.length) {\n frameLength = getFullFrameLength(data, offset);\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || newOffset + 1 < data.length && isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n return false;\n}\n\nfunction initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\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[\"b\" /* logger */].log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount);\n }\n}\n\nfunction getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n}\n\nfunction parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {\n var headerLength, frameLength, stamp;\n var length = data.length;\n\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = getHeaderLength(data, offset);\n // retrieve frame size\n frameLength = getFullFrameLength(data, offset);\n frameLength -= headerLength;\n\n if (frameLength > 0 && offset + headerLength + frameLength <= length) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n return { headerLength: headerLength, frameLength: frameLength, stamp: stamp };\n }\n\n return undefined;\n}\n\nfunction appendFrame(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);\n if (header) {\n var stamp = header.stamp;\n var headerLength = header.headerLength;\n var frameLength = header.frameLength;\n\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n var aacSample = {\n unit: data.subarray(offset + headerLength, offset + headerLength + frameLength),\n pts: stamp,\n dts: stamp\n };\n\n track.samples.push(aacSample);\n track.len += frameLength;\n\n return { sample: aacSample, length: frameLength + headerLength };\n }\n\n return undefined;\n}\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(3);\n\n// CONCATENATED MODULE: ./src/demux/aacdemuxer.js\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * AAC demuxer\n */\n\n\n\n\nvar aacdemuxer_AACDemuxer = function () {\n function AACDemuxer(observer, remuxer, config) {\n _classCallCheck(this, AACDemuxer);\n\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n AACDemuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/adts', type: 'audio', id: 0, sequenceNumber: 0, isAAC: true, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n\n AACDemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n AACDemuxer.probe = function probe(data) {\n if (!data) {\n return false;\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 = id3[\"a\" /* default */].getID3Data(data, 0) || [];\n var offset = id3Data.length;\n\n for (var length = data.length; offset < length; offset++) {\n if (adts_probe(data, offset)) {\n logger[\"b\" /* logger */].log('ADTS sync word found !');\n return true;\n }\n }\n return false;\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n AACDemuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var track = this._audioTrack;\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0) || [];\n var timestamp = id3[\"a\" /* default */].getTimeStamp(id3Data);\n var pts = timestamp ? 90 * timestamp : timeOffset * 90000;\n var frameIndex = 0;\n var stamp = pts;\n var length = data.length;\n var offset = id3Data.length;\n\n var id3Samples = [{ pts: stamp, dts: stamp, data: id3Data }];\n\n while (offset < length - 1) {\n if (isHeader(data, offset) && offset + 5 < length) {\n initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n logger[\"b\" /* logger */].log('Unable to parse AAC frame');\n break;\n }\n } else if (id3[\"a\" /* default */].isHeader(data, offset)) {\n id3Data = id3[\"a\" /* default */].getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n AACDemuxer.prototype.destroy = function destroy() {};\n\n return AACDemuxer;\n}();\n\n/* harmony default export */ var aacdemuxer = (aacdemuxer_AACDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp4demuxer.js\nfunction mp4demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * MP4 demuxer\n */\n\n\n\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar mp4demuxer_MP4Demuxer = function () {\n function MP4Demuxer(observer, remuxer) {\n mp4demuxer__classCallCheck(this, MP4Demuxer);\n\n this.observer = observer;\n this.remuxer = remuxer;\n }\n\n MP4Demuxer.prototype.resetTimeStamp = function resetTimeStamp(initPTS) {\n this.initPTS = initPTS;\n };\n\n MP4Demuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n //jshint unused:false\n if (initSegment && initSegment.byteLength) {\n var initData = this.initData = MP4Demuxer.parseInitSegment(initSegment);\n\n // default audio codec if nothing specified\n // TODO : extract that from initsegment\n if (audioCodec == null) {\n audioCodec = 'mp4a.40.5';\n }\n if (videoCodec == null) {\n videoCodec = 'avc1.42e01e';\n }\n var tracks = {};\n if (initData.audio && initData.video) {\n tracks.audiovideo = { container: 'video/mp4', codec: audioCodec + ',' + videoCodec, initSegment: duration ? initSegment : null };\n } else {\n if (initData.audio) {\n tracks.audio = { container: 'audio/mp4', codec: audioCodec, initSegment: duration ? initSegment : null };\n }\n if (initData.video) {\n tracks.video = { container: 'video/mp4', codec: videoCodec, initSegment: duration ? initSegment : null };\n }\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, { tracks: tracks });\n } else {\n if (audioCodec) {\n this.audioCodec = audioCodec;\n }\n if (videoCodec) {\n this.videoCodec = videoCodec;\n }\n }\n };\n\n MP4Demuxer.probe = function probe(data) {\n // ensure we find a moof box in the first 16 kB\n return MP4Demuxer.findBox({ data: data, start: 0, end: Math.min(data.length, 16384) }, ['moof']).length > 0;\n };\n\n MP4Demuxer.bin2str = function bin2str(buffer) {\n return String.fromCharCode.apply(null, buffer);\n };\n\n MP4Demuxer.readUint32 = function readUint32(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];\n return val < 0 ? 4294967296 + val : val;\n };\n\n MP4Demuxer.writeUint32 = function writeUint32(buffer, offset, value) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n buffer[offset] = value >> 24;\n buffer[offset + 1] = value >> 16 & 0xff;\n buffer[offset + 2] = value >> 8 & 0xff;\n buffer[offset + 3] = value & 0xff;\n };\n\n // Find the data for a box specified by its path\n\n\n MP4Demuxer.findBox = function findBox(data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults,\n start,\n endbox;\n\n if (data.data) {\n start = data.start;\n end = data.end;\n data = data.data;\n } else {\n start = 0;\n end = data.byteLength;\n }\n\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n\n for (i = start; i < end;) {\n size = MP4Demuxer.readUint32(data, i);\n type = MP4Demuxer.bin2str(data.subarray(i + 4, i + 8));\n endbox = size > 1 ? i + size : end;\n\n if (type === path[0]) {\n\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: data, start: i + 8, end: endbox });\n } else {\n // recursively search for the next box along the path\n subresults = MP4Demuxer.findBox({ data: data, start: i + 8, end: endbox }, path.slice(1));\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n i = endbox;\n }\n\n // we've finished searching all of data\n return results;\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 init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n\n\n MP4Demuxer.parseInitSegment = function parseInitSegment(initSegment) {\n var result = [];\n var traks = MP4Demuxer.findBox(initSegment, ['moov', 'trak']);\n\n traks.forEach(function (trak) {\n var tkhd = MP4Demuxer.findBox(trak, ['tkhd'])[0];\n if (tkhd) {\n var version = tkhd.data[tkhd.start];\n var index = version === 0 ? 12 : 20;\n var trackId = MP4Demuxer.readUint32(tkhd, index);\n\n var mdhd = MP4Demuxer.findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n version = mdhd.data[mdhd.start];\n index = version === 0 ? 12 : 20;\n var timescale = MP4Demuxer.readUint32(mdhd, index);\n\n var hdlr = MP4Demuxer.findBox(trak, ['mdia', 'hdlr'])[0];\n if (hdlr) {\n var hdlrType = MP4Demuxer.bin2str(hdlr.data.subarray(hdlr.start + 8, hdlr.start + 12));\n var type = { 'soun': 'audio', 'vide': 'video' }[hdlrType];\n if (type) {\n // extract codec info. TODO : parse codec details to be able to build MIME type\n var codecBox = MP4Demuxer.findBox(trak, ['mdia', 'minf', 'stbl', 'stsd']);\n if (codecBox.length) {\n codecBox = codecBox[0];\n var codecType = MP4Demuxer.bin2str(codecBox.data.subarray(codecBox.start + 12, codecBox.start + 16));\n logger[\"b\" /* logger */].log('MP4Demuxer:' + type + ':' + codecType + ' found');\n }\n result[trackId] = { timescale: timescale, type: type };\n result[type] = { timescale: timescale, id: trackId };\n }\n }\n }\n }\n });\n return result;\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 timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n\n\n MP4Demuxer.getStartDTS = function getStartDTS(initData, fragment) {\n var trafs, baseTimes, result;\n\n // we need info from two childrend of each track fragment box\n trafs = MP4Demuxer.findBox(fragment, ['moof', 'traf']);\n\n // determine the start times for each track\n baseTimes = [].concat.apply([], trafs.map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n var id, scale, baseTime;\n\n // get the track id from the tfhd\n id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n scale = initData[id].timescale || 90e3;\n\n // get the base media decode time from the tfdt\n baseTime = MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version, result;\n\n version = tfdt.data[tfdt.start];\n result = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 1) {\n result *= Math.pow(2, 32);\n\n result += MP4Demuxer.readUint32(tfdt, 8);\n }\n return result;\n })[0];\n // convert base time to seconds\n return baseTime / scale;\n });\n }));\n\n // return the minimum\n result = Math.min.apply(null, baseTimes);\n return isFinite(result) ? result : 0;\n };\n\n MP4Demuxer.offsetStartDTS = function offsetStartDTS(initData, fragment, timeOffset) {\n MP4Demuxer.findBox(fragment, ['moof', 'traf']).map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n // get the track id from the tfhd\n var id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n var timescale = initData[id].timescale || 90e3;\n\n // get the base media decode time from the tfdt\n MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt.data[tfdt.start];\n var baseMediaDecodeTime = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 0) {\n MP4Demuxer.writeUint32(tfdt, 4, baseMediaDecodeTime - timeOffset * timescale);\n } else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += MP4Demuxer.readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n MP4Demuxer.writeUint32(tfdt, 4, upper);\n MP4Demuxer.writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n MP4Demuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var initData = this.initData;\n if (!initData) {\n this.resetInitSegment(data, this.audioCodec, this.videoCodec);\n initData = this.initData;\n }\n var startDTS = void 0,\n initPTS = this.initPTS;\n if (initPTS === undefined) {\n var _startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.initPTS = initPTS = _startDTS - timeOffset;\n this.observer.trigger(events[\"a\" /* default */].INIT_PTS_FOUND, { initPTS: initPTS });\n }\n MP4Demuxer.offsetStartDTS(initData, data, initPTS);\n startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.remuxer.remux(initData.audio, initData.video, null, null, startDTS, contiguous, accurateTimeOffset, data);\n };\n\n MP4Demuxer.prototype.destroy = function destroy() {};\n\n return MP4Demuxer;\n}();\n\n/* harmony default export */ var mp4demuxer = (mp4demuxer_MP4Demuxer);\n// CONCATENATED MODULE: ./src/demux/mpegaudio.js\n/**\n * MPEG parser helper\n */\n\nvar MpegAudio = {\n\n 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\n SamplingRateMap: [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000],\n\n SamplesCoefficients: [\n // MPEG 2.5\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ],\n // Reserved\n [0, // Reserved\n 0, // Layer3\n 0, // Layer2\n 0 // Layer1\n ],\n // MPEG 2\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ],\n // MPEG 1\n [0, // Reserved\n 144, // Layer3\n 144, // Layer2\n 12 // Layer1\n ]],\n\n BytesInSlot: [0, // Reserved\n 1, // Layer3\n 1, // Layer2\n 4 // Layer1\n ],\n\n appendFrame: 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 undefined;\n }\n\n var header = this.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 = { unit: data.subarray(offset, offset + header.frameLength), pts: stamp, dts: stamp };\n\n track.config = [];\n track.channelCount = header.channelCount;\n track.samplerate = header.sampleRate;\n track.samples.push(sample);\n track.len += header.frameLength;\n\n return { sample: sample, length: header.frameLength };\n }\n\n return undefined;\n },\n\n parseHeader: function parseHeader(data, offset) {\n var headerB = data[offset + 1] >> 3 & 3;\n var headerC = data[offset + 1] >> 1 & 3;\n var headerE = data[offset + 2] >> 4 & 15;\n var headerF = data[offset + 2] >> 2 & 3;\n var headerG = data[offset + 2] >> 1 & 1;\n if (headerB !== 1 && headerE !== 0 && headerE !== 15 && headerF !== 3) {\n var columnInBitrates = headerB === 3 ? 3 - headerC : headerC === 3 ? 3 : 4;\n var bitRate = MpegAudio.BitratesMap[columnInBitrates * 14 + headerE - 1] * 1000;\n var columnInSampleRates = headerB === 3 ? 0 : headerB === 2 ? 1 : 2;\n var sampleRate = MpegAudio.SamplingRateMap[columnInSampleRates * 3 + headerF];\n var channelCount = data[offset + 3] >> 6 === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n var sampleCoefficient = MpegAudio.SamplesCoefficients[headerB][headerC];\n var bytesInSlot = MpegAudio.BytesInSlot[headerC];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = parseInt(sampleCoefficient * bitRate / sampleRate + headerG, 10) * bytesInSlot;\n\n return { sampleRate: sampleRate, channelCount: channelCount, frameLength: frameLength, samplesPerFrame: samplesPerFrame };\n }\n\n return undefined;\n },\n\n isHeaderPattern: function isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n },\n\n isHeader: 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 if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n },\n\n probe: 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 && this.isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4;\n // MPEG frame Length\n var header = this.parseHeader(data, offset);\n var frameLength = headerLength;\n if (header && header.frameLength) {\n frameLength = header.frameLength;\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || newOffset + 1 < data.length && this.isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n return false;\n }\n};\n\n/* harmony default export */ var mpegaudio = (MpegAudio);\n// CONCATENATED MODULE: ./src/demux/exp-golomb.js\nfunction exp_golomb__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\n\n\nvar exp_golomb_ExpGolomb = function () {\n function ExpGolomb(data) {\n exp_golomb__classCallCheck(this, ExpGolomb);\n\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\n\n ExpGolomb.prototype.loadWord = function loadWord() {\n var data = this.data,\n bytesAvailable = this.bytesAvailable,\n position = data.byteLength - bytesAvailable,\n workingBytes = new Uint8Array(4),\n 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\n ExpGolomb.prototype.skipBits = function skipBits(count) {\n var skipBytes; // :int\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\n ExpGolomb.prototype.readBits = function readBits(size) {\n var bits = Math.min(this.bitsAvailable, size),\n // :uint\n valu = this.word >>> 32 - bits; // :uint\n if (size > 32) {\n logger[\"b\" /* 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 }\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\n ExpGolomb.prototype.skipLZ = function skipLZ() {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if (0 !== (this.word & 0x80000000 >>> leadingZeroCount)) {\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\n ExpGolomb.prototype.skipUEG = function skipUEG() {\n this.skipBits(1 + this.skipLZ());\n };\n\n // ():void\n\n\n ExpGolomb.prototype.skipEG = function skipEG() {\n this.skipBits(1 + this.skipLZ());\n };\n\n // ():uint\n\n\n ExpGolomb.prototype.readUEG = function readUEG() {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n };\n\n // ():int\n\n\n ExpGolomb.prototype.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\n ExpGolomb.prototype.readBoolean = function readBoolean() {\n return 1 === this.readBits(1);\n };\n\n // ():int\n\n\n ExpGolomb.prototype.readUByte = function readUByte() {\n return this.readBits(8);\n };\n\n // ():int\n\n\n ExpGolomb.prototype.readUShort = function readUShort() {\n return this.readBits(16);\n };\n // ():int\n\n\n ExpGolomb.prototype.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 {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n\n\n ExpGolomb.prototype.skipScalingList = function skipScalingList(count) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n for (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 * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n\n\n ExpGolomb.prototype.readSPS = function readSPS() {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n profileIdc,\n profileCompat,\n levelIdc,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i,\n readUByte = this.readUByte.bind(this),\n readBits = this.readBits.bind(this),\n readUEG = this.readUEG.bind(this),\n readBoolean = this.readBoolean.bind(this),\n skipBits = this.skipBits.bind(this),\n skipEG = this.skipEG.bind(this),\n skipUEG = this.skipUEG.bind(this),\n skipScalingList = this.skipScalingList.bind(this);\n\n readUByte();\n profileIdc = readUByte(); // profile_idc\n profileCompat = readBits(5); // constraint_set[0-4]_flag, u(5)\n skipBits(3); // reserved_zero_3bits u(3),\n levelIdc = 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); // 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(); // offset_for_ref_frame[ i ]\n }\n }\n skipUEG(); // max_num_ref_frames\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n picWidthInMbsMinus1 = readUEG();\n picHeightInMapUnitsMinus1 = readUEG();\n frameMbsOnlyFlag = readBits(1);\n if (frameMbsOnlyFlag === 0) {\n skipBits(1); // 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];break;\n case 2:\n pixelRatio = [12, 11];break;\n case 3:\n pixelRatio = [10, 11];break;\n case 4:\n pixelRatio = [16, 11];break;\n case 5:\n pixelRatio = [40, 33];break;\n case 6:\n pixelRatio = [24, 11];break;\n case 7:\n pixelRatio = [20, 11];break;\n case 8:\n pixelRatio = [32, 11];break;\n case 9:\n pixelRatio = [80, 33];break;\n case 10:\n pixelRatio = [18, 11];break;\n case 11:\n pixelRatio = [15, 11];break;\n case 12:\n pixelRatio = [64, 33];break;\n case 13:\n pixelRatio = [160, 99];break;\n case 14:\n pixelRatio = [4, 3];break;\n case 15:\n pixelRatio = [3, 2];break;\n case 16:\n pixelRatio = [2, 1];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\n ExpGolomb.prototype.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\n return ExpGolomb;\n}();\n\n/* harmony default export */ var exp_golomb = (exp_golomb_ExpGolomb);\n// CONCATENATED MODULE: ./src/demux/sample-aes.js\nfunction sample_aes__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * SAMPLE-AES decrypter\n*/\n\n\n\nvar sample_aes_SampleAesDecrypter = function () {\n function SampleAesDecrypter(observer, config, decryptdata, discardEPB) {\n sample_aes__classCallCheck(this, SampleAesDecrypter);\n\n this.decryptdata = decryptdata;\n this.discardEPB = discardEPB;\n this.decrypter = new crypt_decrypter[\"a\" /* default */](observer, config);\n }\n\n SampleAesDecrypter.prototype.decryptBuffer = function decryptBuffer(encryptedData, callback) {\n this.decrypter.decrypt(encryptedData, this.decryptdata.key.buffer, this.decryptdata.iv.buffer, callback);\n };\n\n // AAC - encrypt all full 16 bytes blocks starting from offset 16\n\n\n SampleAesDecrypter.prototype.decryptAacSample = function decryptAacSample(samples, sampleIndex, callback, sync) {\n var curUnit = samples[sampleIndex].unit;\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n\n var localthis = this;\n this.decryptBuffer(encryptedBuffer, function (decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n curUnit.set(decryptedData, 16);\n\n if (!sync) {\n localthis.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\n });\n };\n\n SampleAesDecrypter.prototype.decryptAacSamples = function decryptAacSamples(samples, sampleIndex, callback) {\n for (;; sampleIndex++) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n\n this.decryptAacSample(samples, sampleIndex, callback, sync);\n\n if (!sync) {\n return;\n }\n }\n };\n\n // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n\n\n SampleAesDecrypter.prototype.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\n SampleAesDecrypter.prototype.getAvcDecryptedUnit = function getAvcDecryptedUnit(decodedData, decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n for (var outputPos = 32; outputPos <= decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(decryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return decodedData;\n };\n\n SampleAesDecrypter.prototype.decryptAvcSample = function decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync) {\n var decodedData = this.discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n var localthis = this;\n\n this.decryptBuffer(encryptedData.buffer, function (decryptedData) {\n curUnit.data = localthis.getAvcDecryptedUnit(decodedData, decryptedData);\n\n if (!sync) {\n localthis.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n\n SampleAesDecrypter.prototype.decryptAvcSamples = function decryptAvcSamples(samples, sampleIndex, unitIndex, callback) {\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n var curUnits = samples[sampleIndex].units;\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n\n var curUnit = curUnits[unitIndex];\n if (curUnit.length <= 48 || curUnit.type !== 1 && curUnit.type !== 5) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync);\n\n if (!sync) {\n return;\n }\n }\n }\n };\n\n return SampleAesDecrypter;\n}();\n\n/* harmony default export */ var sample_aes = (sample_aes_SampleAesDecrypter);\n// CONCATENATED MODULE: ./src/demux/tsdemuxer.js\nfunction tsdemuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n\n\n\n\n\n// import Hex from '../utils/hex';\n\n\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.\nvar RemuxerTrackIdConfig = {\n video: 0,\n audio: 1,\n id3: 2,\n text: 3\n};\n\nvar tsdemuxer_TSDemuxer = function () {\n function TSDemuxer(observer, remuxer, config, typeSupported) {\n tsdemuxer__classCallCheck(this, TSDemuxer);\n\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.remuxer = remuxer;\n this.sampleAes = null;\n }\n\n TSDemuxer.prototype.setDecryptData = function setDecryptData(decryptdata) {\n if (decryptdata != null && decryptdata.key != null && decryptdata.method === 'SAMPLE-AES') {\n this.sampleAes = new sample_aes(this.observer, this.config, decryptdata, this.discardEPB);\n } else {\n this.sampleAes = null;\n }\n };\n\n TSDemuxer.probe = function probe(data) {\n var syncOffset = TSDemuxer._syncOffset(data);\n if (syncOffset < 0) {\n return false;\n } else {\n if (syncOffset) {\n logger[\"b\" /* logger */].warn('MPEG2-TS detected but first sync word found @ offset ' + syncOffset + ', junk ahead ?');\n }\n return true;\n }\n };\n\n TSDemuxer._syncOffset = function _syncOffset(data) {\n // scan 1000 first bytes\n var scanwindow = Math.min(1000, data.length - 3 * 188);\n var i = 0;\n while (i < scanwindow) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data[i] === 0x47 && data[i + 188] === 0x47 && data[i + 2 * 188] === 0x47) {\n return i;\n } else {\n i++;\n }\n }\n return -1;\n };\n\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n *\n * @param {string} type 'audio' | 'video' | 'id3' | 'text'\n * @param {number} duration\n * @return {object} TSDemuxer's internal track model\n */\n\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 len: 0,\n dropped: type === 'video' ? 0 : undefined,\n isAAC: type === 'audio' ? true : undefined,\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 * @override Implements generic demuxing/remuxing interface (see DemuxerInline)\n * @param {object} initSegment\n * @param {string} audioCodec\n * @param {string} videoCodec\n * @param {number} duration (in TS timescale = 90kHz)\n */\n\n\n TSDemuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n\n this._avcTrack = TSDemuxer.createTrack('video', duration);\n this._audioTrack = TSDemuxer.createTrack('audio', duration);\n this._id3Track = TSDemuxer.createTrack('id3', duration);\n this._txtTrack = TSDemuxer.createTrack('text', duration);\n\n // flush any partial content\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcSample = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = duration;\n };\n\n /**\n * \n * @override\n */\n\n\n TSDemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n // feed incoming data to the front of the parsing pipeline\n\n\n TSDemuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var start,\n len = data.length,\n stt,\n pid,\n atf,\n offset,\n pes,\n unknownPIDs = false;\n this.contiguous = contiguous;\n var pmtParsed = this.pmtParsed,\n avcTrack = this._avcTrack,\n audioTrack = this._audioTrack,\n id3Track = this._id3Track,\n avcId = avcTrack.pid,\n audioId = audioTrack.pid,\n id3Id = id3Track.pid,\n pmtId = this._pmtId,\n avcData = avcTrack.pesData,\n audioData = audioTrack.pesData,\n id3Data = id3Track.pesData,\n parsePAT = this._parsePAT,\n parsePMT = this._parsePMT,\n parsePES = this._parsePES,\n parseAVCPES = this._parseAVCPES.bind(this),\n parseAACPES = this._parseAACPES.bind(this),\n parseMPEGPES = this._parseMPEGPES.bind(this),\n parseID3PES = this._parseID3PES.bind(this);\n\n var syncOffset = TSDemuxer._syncOffset(data);\n\n // don't parse last TS packet if incomplete\n len -= (len + syncOffset) % 188;\n\n // loop through TS packets\n for (start = syncOffset; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === start + 188) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, false);\n }\n avcData = { data: [], size: 0 };\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n break;\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n }\n audioData = { data: [], size: 0 };\n }\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + 188));\n audioData.size += start + 188 - offset;\n }\n break;\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(pes);\n }\n id3Data = { data: [], size: 0 };\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n break;\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n pmtId = this._pmtId = parsePAT(data, offset);\n break;\n case pmtId:\n if (stt) {\n offset += data[offset] + 1;\n }\n var parsedPIDs = parsePMT(data, offset, this.typeSupported.mpeg === true || this.typeSupported.mp3 === true, this.sampleAes != null);\n\n // only update track id if track PID found while parsing PMT\n // this is to avoid resetting the PID to -1 in case\n // track PID transiently disappears from the stream\n // this could happen in case of transient missing audio samples for example\n // NOTE this is only the PID of the track as found in TS,\n // but we are not using this for MP4 track IDs.\n avcId = parsedPIDs.avc;\n if (avcId > 0) {\n avcTrack.pid = avcId;\n }\n audioId = parsedPIDs.audio;\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.isAAC = parsedPIDs.isAAC;\n }\n id3Id = parsedPIDs.id3;\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n if (unknownPIDs && !pmtParsed) {\n logger[\"b\" /* logger */].log('reparse from beginning');\n unknownPIDs = false;\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 case 17:\n case 0x1fff:\n break;\n default:\n unknownPIDs = true;\n break;\n }\n } else {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47' });\n }\n }\n // try to parse last PES packets\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, true);\n avcTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n avcTrack.pesData = avcData;\n }\n\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n audioTrack.pesData = null;\n } else {\n if (audioData && audioData.size) {\n logger[\"b\" /* logger */].log('last AAC PES packet truncated,might overlap between fragments');\n }\n // either audioData null or PES truncated, keep it for next frag parsing\n audioTrack.pesData = audioData;\n }\n\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(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 if (this.sampleAes == null) {\n this.remuxer.remux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n } else {\n this.decryptAndRemux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.decryptAndRemux = function decryptAndRemux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (audioTrack.samples && audioTrack.isAAC) {\n var localthis = this;\n this.sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n localthis.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.decryptAndRemuxAvc = function decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (videoTrack.samples) {\n var localthis = this;\n this.sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n localthis.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.destroy = function destroy() {\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n };\n\n TSDemuxer.prototype._parsePAT = 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 //logger.log('PMT PID:' + this._pmtId);\n };\n\n TSDemuxer.prototype._parsePMT = function _parsePMT(data, offset, mpegSupported, isSampleAes) {\n var sectionLength,\n tableEnd,\n programInfoLength,\n pid,\n result = { audio: -1, avc: -1, id3: -1, isAAC: true };\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n 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 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 pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n //logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n break;\n\n // Packetized metadata (ID3)\n case 0x15:\n //logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n break;\n\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n //logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n break;\n\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n case 0x03:\n case 0x04:\n //logger.log('MPEG PID:' + pid);\n if (!mpegSupported) {\n logger[\"b\" /* logger */].log('MPEG audio found, not supported in this browser for now');\n } else if (result.audio === -1) {\n result.audio = pid;\n result.isAAC = false;\n }\n break;\n\n case 0x24:\n logger[\"b\" /* logger */].warn('HEVC stream type found, not supported for now');\n break;\n\n default:\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n return result;\n };\n\n TSDemuxer.prototype._parsePES = function _parsePES(stream) {\n var i = 0,\n frag,\n pesFlags,\n pesPrefix,\n pesLen,\n pesHdrLen,\n pesData,\n pesPts,\n pesDts,\n payloadStartOffset,\n data = stream.data;\n // safety check\n if (!stream || stream.size === 0) {\n return null;\n }\n\n // we might need up to 19 bytes to read PES header\n // if first chunk of data is less than 19 bytes, let's merge it with following ones until we get 19 bytes\n // usually only one merge is needed (and this is rare ...)\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n }\n //retrieve PTS/DTS from first fragment\n frag = data[0];\n 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 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 + // 1 << 29\n (frag[10] & 0xFF) * 4194304 + // 1 << 22\n (frag[11] & 0xFE) * 16384 + // 1 << 14\n (frag[12] & 0xFF) * 128 + // 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29\n (frag[15] & 0xFF) * 4194304 + // 1 << 22\n (frag[16] & 0xFE) * 16384 + // 1 << 14\n (frag[17] & 0xFF) * 128 + // 1 << 7\n (frag[18] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n if (pesPts - pesDts > 60 * 90000) {\n logger[\"b\" /* 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 payloadStartOffset = pesHdrLen + 9;\n\n stream.size -= payloadStartOffset;\n //reassemble PES packet\n 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 { data: pesData, pts: pesPts, dts: pesDts, len: pesLen };\n } else {\n return null;\n }\n };\n\n TSDemuxer.prototype.pushAccesUnit = function pushAccesUnit(avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length;\n // only push AVC sample if starting with a keyframe is not mandatory OR\n // if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n if (!this.config.forceKeyFrameOnDiscontinuity || avcSample.key === true || avcTrack.sps && (nbSamples || this.contiguous)) {\n avcSample.id = nbSamples;\n samples.push(avcSample);\n } else {\n // dropped samples, track it\n avcTrack.dropped++;\n }\n }\n if (avcSample.debug.length) {\n logger[\"b\" /* logger */].log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n };\n\n TSDemuxer.prototype._parseAVCPES = function _parseAVCPES(pes, last) {\n var _this = this;\n\n //logger.log('parse new PES');\n var track = this._avcTrack,\n units = this._parseAVCNALu(pes.data),\n debug = false,\n expGolombDecoder,\n avcSample = this.avcSample,\n push,\n spsfound = false,\n i,\n pushAccesUnit = this.pushAccesUnit.bind(this),\n createAVCSample = function createAVCSample(key, pts, dts, debug) {\n return { key: key, pts: pts, dts: dts, units: [], debug: debug };\n };\n //free pes.data to save up some memory\n pes.data = null;\n\n // if new NAL units found and last sample still there, let's push ...\n // this helps parsing streams with missing AUD (only do this if AUD never found)\n if (avcSample && units.length && !track.audFound) {\n pushAccesUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n\n units.forEach(function (unit) {\n switch (unit.type) {\n //NDR\n case 1:\n push = true;\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'NDR ';\n }\n avcSample.frame = 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 exp_golomb(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 avcSample.key = true;\n }\n }\n break;\n //IDR\n case 5:\n push = true;\n // handle PES not starting with AUD\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'IDR ';\n }\n avcSample.key = true;\n avcSample.frame = true;\n break;\n //SEI\n case 6:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'SEI ';\n }\n expGolombDecoder = new exp_golomb(_this.discardEPB(unit.data));\n\n // skip frameType\n expGolombDecoder.readUByte();\n\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n\n while (!endOfCaptions && expGolombDecoder.bytesAvailable > 1) {\n payloadType = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadType += b;\n } while (b === 0xFF);\n\n // Parse payload size.\n payloadSize = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadSize += b;\n } while (b === 0xFF);\n\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4 && expGolombDecoder.bytesAvailable !== 0) {\n\n endOfCaptions = true;\n\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181) {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49) {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934) {\n var userDataType = expGolombDecoder.readUByte();\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3) {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i = 0; i < totalCCs; i++) {\n // 3 bytes per CC\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, { type: 3, pts: pes.pts, bytes: byteArray });\n }\n }\n }\n }\n } else if (payloadSize < expGolombDecoder.bytesAvailable) {\n for (i = 0; i < payloadSize; i++) {\n expGolombDecoder.readUByte();\n }\n }\n }\n break;\n //SPS\n case 7:\n push = true;\n spsfound = true;\n if (debug && avcSample) {\n avcSample.debug += 'SPS ';\n }\n if (!track.sps) {\n expGolombDecoder = new exp_golomb(unit.data);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [unit.data];\n track.duration = _this._duration;\n var codecarray = unit.data.subarray(1, 4);\n var codecstring = 'avc1.';\n for (i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecstring += h;\n }\n track.codec = codecstring;\n }\n break;\n //PPS\n case 8:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'PPS ';\n }\n if (!track.pps) {\n track.pps = [unit.data];\n }\n break;\n // AUD\n case 9:\n push = false;\n track.audFound = true;\n if (avcSample) {\n pushAccesUnit(avcSample, track);\n }\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, debug ? 'AUD ' : '');\n break;\n // Filler Data\n case 12:\n push = false;\n break;\n default:\n push = false;\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n break;\n }\n if (avcSample && push) {\n var _units = avcSample.units;\n _units.push(unit);\n }\n });\n // if last PES packet, push samples\n if (last && avcSample) {\n pushAccesUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n\n TSDemuxer.prototype._insertSampleInOrder = function _insertSampleInOrder(arr, data) {\n var len = arr.length;\n if (len > 0) {\n if (data.pts >= arr[len - 1].pts) {\n arr.push(data);\n } else {\n for (var pos = len - 1; pos >= 0; pos--) {\n if (data.pts < arr[pos].pts) {\n arr.splice(pos, 0, data);\n break;\n }\n }\n }\n } else {\n arr.push(data);\n }\n };\n\n TSDemuxer.prototype._getLastNalUnit = function _getLastNalUnit() {\n var avcSample = this.avcSample,\n lastUnit = void 0;\n // try to fallback to previous sample if current one is empty\n if (!avcSample || avcSample.units.length === 0) {\n var track = this._avcTrack,\n samples = track.samples;\n avcSample = samples[samples.length - 1];\n }\n if (avcSample) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n return lastUnit;\n };\n\n TSDemuxer.prototype._parseAVCNALu = function _parseAVCNALu(array) {\n var i = 0,\n len = array.byteLength,\n value,\n overflow,\n track = this._avcTrack,\n state = track.naluState || 0,\n lastState = state;\n var units = [],\n unit,\n unitType,\n lastUnitStart = -1,\n lastUnitType;\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\n while (i < len) {\n value = array[i++];\n // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n }\n // here we have state either equal to 2 or 3\n if (!value) {\n state = 3;\n } else if (value === 1) {\n if (lastUnitStart >= 0) {\n unit = { data: array.subarray(lastUnitStart, i - state - 1), type: lastUnitType };\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();\n if (lastUnit) {\n if (lastState && i <= 4 - lastState) {\n // start delimiter overlapping between PES packets\n // strip start delimiter bytes from the end of last NAL unit\n // check if lastUnit had a state different from zero\n if (lastUnit.state) {\n // strip last bytes\n lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState);\n }\n }\n // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n overflow = i - state - 1;\n if (overflow > 0) {\n //logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\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 unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state };\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();\n if (_lastUnit) {\n var _tmp = new Uint8Array(_lastUnit.data.byteLength + array.byteLength);\n _tmp.set(_lastUnit.data, 0);\n _tmp.set(array, _lastUnit.data.byteLength);\n _lastUnit.data = _tmp;\n }\n }\n track.naluState = state;\n return units;\n };\n\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n\n\n TSDemuxer.prototype.discardEPB = function discardEPB(data) {\n var length = data.byteLength,\n EPBPositions = [],\n i = 1,\n newLength,\n newData;\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 newLength = length - EPBPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\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\n TSDemuxer.prototype._parseAACPES = function _parseAACPES(pes) {\n var track = this._audioTrack,\n data = pes.data,\n pts = pes.pts,\n startOffset = 0,\n aacOverFlow = this.aacOverFlow,\n aacLastPTS = this.aacLastPTS,\n frameDuration,\n frameIndex,\n offset,\n stamp,\n len;\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength);\n //logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n data = tmp;\n }\n // look for ADTS header (0xFFFx)\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (isHeader(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) {\n var reason, fatal;\n if (offset < len - 1) {\n reason = 'AAC PES did not start with ADTS header,offset:' + offset;\n fatal = false;\n } else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n logger[\"b\" /* logger */].warn('parsing error:' + reason);\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: fatal, reason: reason });\n if (fatal) {\n return;\n }\n }\n\n initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n frameIndex = 0;\n frameDuration = getFrameDuration(track.samplerate);\n\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 if (aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS + frameDuration;\n if (Math.abs(newPTS - pts) > 1) {\n logger[\"b\" /* logger */].log('AAC: align PTS for overlapping frames by ' + Math.round((newPTS - pts) / 90));\n pts = newPTS;\n }\n }\n\n //scan for aac samples\n while (offset < len) {\n if (isHeader(data, offset) && offset + 5 < len) {\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n //logger.log(`${Math.round(frame.sample.pts)} : AAC`);\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n //logger.log('Unable to parse AAC frame');\n break;\n }\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n //logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n };\n\n TSDemuxer.prototype._parseMPEGPES = function _parseMPEGPES(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\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(this._audioTrack, 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\n TSDemuxer.prototype._parseID3PES = function _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n };\n\n return TSDemuxer;\n}();\n\n/* harmony default export */ var tsdemuxer = (tsdemuxer_TSDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp3demuxer.js\nfunction mp3demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * MP3 demuxer\n */\n\n\n\n\nvar mp3demuxer_MP3Demuxer = function () {\n function MP3Demuxer(observer, remuxer, config) {\n mp3demuxer__classCallCheck(this, MP3Demuxer);\n\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n MP3Demuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/mpeg', type: 'audio', id: -1, sequenceNumber: 0, isAAC: false, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n\n MP3Demuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n MP3Demuxer.probe = function probe(data) {\n // check if data contains ID3 timestamp and MPEG sync word\n var offset, length;\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0);\n if (id3Data && id3[\"a\" /* default */].getTimeStamp(id3Data) !== undefined) {\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 for (offset = id3Data.length, length = Math.min(data.length - 1, offset + 100); offset < length; offset++) {\n if (mpegaudio.probe(data, offset)) {\n logger[\"b\" /* logger */].log('MPEG Audio sync word found !');\n return true;\n }\n }\n }\n return false;\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n MP3Demuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0);\n var timestamp = id3[\"a\" /* default */].getTimeStamp(id3Data);\n var pts = timestamp ? 90 * timestamp : timeOffset * 90000;\n var offset = id3Data.length;\n var length = data.length;\n var frameIndex = 0,\n stamp = 0;\n var track = this._audioTrack;\n\n var id3Samples = [{ pts: pts, dts: pts, data: id3Data }];\n\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n //logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n } else if (id3[\"a\" /* default */].isHeader(data, offset)) {\n id3Data = id3[\"a\" /* default */].getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n MP3Demuxer.prototype.destroy = function destroy() {};\n\n return MP3Demuxer;\n}();\n\n/* harmony default export */ var mp3demuxer = (mp3demuxer_MP3Demuxer);\n// CONCATENATED MODULE: ./src/helper/aac.js\nfunction aac__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * AAC helper\n */\n\nvar AAC = function () {\n function AAC() {\n aac__classCallCheck(this, AAC);\n }\n\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 null;\n };\n\n return AAC;\n}();\n\n/* harmony default export */ var aac = (AAC);\n// CONCATENATED MODULE: ./src/remux/mp4-generator.js\nfunction mp4_generator__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Generate MP4 Box\n*/\n\n//import Hex from '../utils/hex';\n\nvar mp4_generator_UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4 = function () {\n function MP4() {\n mp4_generator__classCallCheck(this, MP4);\n }\n\n MP4.init = function init() {\n MP4.types = {\n avc1: [], // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n\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\n var videoHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n\n var audioHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n\n MP4.HDLR_TYPES = {\n 'video': videoHdlr,\n 'audio': audioHdlr\n };\n\n var dref = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n\n var stco = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n\n MP4.STSZ = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00]);\n MP4.VMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]);\n\n MP4.STSD = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // 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\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\n MP4.box = function box(type) {\n var payload = Array.prototype.slice.call(arguments, 1),\n size = 8,\n i = payload.length,\n len = i,\n result;\n // calculate the total size we need to allocate\n while (i--) {\n size += payload[i].byteLength;\n }\n 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\n MP4.hdlr = function hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n\n MP4.mdat = function mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n };\n\n MP4.mdhd = function mdhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.mdhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xFF, upperWordDuration >> 8 & 0xFF, upperWordDuration & 0xFF, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xFF, lowerWordDuration >> 8 & 0xFF, lowerWordDuration & 0xFF, 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00]));\n };\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\n MP4.mfhd = function mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags\n sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF]) // sequence_number\n );\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\n MP4.moof = function moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n };\n /**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n\n\n MP4.moov = function moov(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\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\n MP4.mvex = function mvex(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\n\n MP4.mvhd = function mvhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n var bytes = new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // 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, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // 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, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n };\n\n MP4.sdtp = function sdtp(track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i;\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\n return MP4.box(MP4.types.sdtp, bytes);\n };\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\n MP4.avc1 = function avc1(track) {\n var sps = [],\n pps = [],\n i,\n data,\n 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 sps = sps.concat(Array.prototype.slice.call(data)); // SPS\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\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version\n sps[3], // profile\n sps[4], // profile compat\n sps[5], // level\n 0xfc | 3, // 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))),\n // \"PPS\"\n width = track.width,\n height = track.height,\n hSpacing = track.pixelRatio[0],\n vSpacing = track.pixelRatio[1];\n //console.log('avcc:' + Hex.hexDump(avcc));\n return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n width >> 8 & 0xFF, width & 0xff, // width\n height >> 8 & 0xFF, height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x12, 0x64, 0x61, 0x69, 0x6C, //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, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]), // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])), // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24, // hSpacing\n hSpacing >> 16 & 0xFF, hSpacing >> 8 & 0xFF, hSpacing & 0xFF, vSpacing >> 24, // vSpacing\n vSpacing >> 16 & 0xFF, vSpacing >> 8 & 0xFF, vSpacing & 0xFF])));\n };\n\n MP4.esds = function esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n\n 0x03, // descriptor_type\n 0x17 + configlen, // length\n 0x00, 0x01, //es_id\n 0x00, // stream_priority\n\n 0x04, // descriptor_type\n 0x0f + configlen, // length\n 0x40, //codec : mpeg4_audio\n 0x15, // stream_type\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n\n MP4.mp4a = function mp4a(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n\n MP4.mp3 = function mp3(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]));\n };\n\n MP4.stsd = function stsd(track) {\n if (track.type === 'audio') {\n if (!track.isAAC && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));\n } else {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));\n }\n };\n\n MP4.tkhd = function tkhd(track) {\n var id = track.id,\n duration = track.duration * track.timescale,\n width = track.width,\n height = track.height,\n upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1)),\n lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // 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, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x00, 0x00, // non-audio track volume\n 0x00, 0x00, // 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, // transformation: unity matrix\n width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width\n height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height\n ]));\n };\n\n MP4.traf = function traf(track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track),\n id = track.id,\n upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (mp4_generator_UINT32_MAX + 1)),\n lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF]) // track_ID\n ), MP4.box(MP4.types.tfdt, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // 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 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n };\n\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n\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\n MP4.trex = function trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n\n MP4.trun = function trun(track, offset) {\n var samples = track.samples || [],\n len = samples.length,\n arraylen = 12 + 16 * len,\n array = new Uint8Array(arraylen),\n i,\n sample,\n duration,\n size,\n flags,\n cts;\n offset += 8 + arraylen;\n array.set([0x00, // version 0\n 0x00, 0x0f, 0x01, // flags\n len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // 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, // sample_duration\n size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // 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, // 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\n MP4.initSegment = function initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n var movie = MP4.moov(tracks),\n result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n\n return MP4;\n}();\n\n/* harmony default export */ var mp4_generator = (MP4);\n// CONCATENATED MODULE: ./src/remux/mp4-remuxer.js\nfunction mp4_remuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n* fMP4 remuxer\n*/\n\n\n\n\n\n\n\n// 10 seconds\nvar MAX_SILENT_FRAME_DURATION = 10 * 1000;\n\nvar mp4_remuxer_MP4Remuxer = function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n mp4_remuxer__classCallCheck(this, MP4Remuxer);\n\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n var userAgent = navigator.userAgent;\n this.isSafari = vendor && vendor.indexOf('Apple') > -1 && userAgent && !userAgent.match('CriOS');\n this.ISGenerated = false;\n }\n\n MP4Remuxer.prototype.destroy = function destroy() {};\n\n MP4Remuxer.prototype.resetTimeStamp = function resetTimeStamp(defaultTimeStamp) {\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n\n MP4Remuxer.prototype.resetInitSegment = function resetInitSegment() {\n this.ISGenerated = false;\n };\n\n MP4Remuxer.prototype.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n if (this.ISGenerated) {\n var nbAudioSamples = audioTrack.samples.length;\n var nbVideoSamples = videoTrack.samples.length;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n if (nbAudioSamples && nbVideoSamples) {\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 audiovideoDeltaDts = (audioTrack.samples[0].dts - videoTrack.samples[0].dts) / videoTrack.inputTimeScale;\n audioTimeOffset += Math.max(0, audiovideoDeltaDts);\n videoTimeOffset += Math.max(0, -audiovideoDeltaDts);\n }\n // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is\n // calculated in remuxAudio.\n //logger.log('nb AAC samples:' + audioTrack.samples.length);\n if (nbAudioSamples) {\n // if initSegment was generated without video samples, regenerate it again\n if (!audioTrack.timescale) {\n logger[\"b\" /* logger */].warn('regenerate InitSegment as audio detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n var audioData = this.remuxAudio(audioTrack, audioTimeOffset, contiguous, accurateTimeOffset);\n //logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var audioTrackLength = void 0;\n if (audioData) {\n audioTrackLength = audioData.endPTS - audioData.startPTS;\n }\n // if initSegment was generated without video samples, regenerate it again\n if (!videoTrack.timescale) {\n logger[\"b\" /* logger */].warn('regenerate InitSegment as video detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n this.remuxVideo(videoTrack, videoTimeOffset, contiguous, audioTrackLength, accurateTimeOffset);\n }\n } else {\n var videoData = void 0;\n //logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n videoData = this.remuxVideo(videoTrack, videoTimeOffset, contiguous, accurateTimeOffset);\n }\n if (videoData && audioTrack.codec) {\n this.remuxEmptyAudio(audioTrack, audioTimeOffset, contiguous, videoData);\n }\n }\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (id3Track.samples.length) {\n this.remuxID3(id3Track, timeOffset);\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (textTrack.samples.length) {\n this.remuxText(textTrack, timeOffset);\n }\n //notify end of parsing\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSED);\n };\n\n MP4Remuxer.prototype.generateIS = function generateIS(audioTrack, videoTrack, timeOffset) {\n var observer = this.observer,\n audioSamples = audioTrack.samples,\n videoSamples = videoTrack.samples,\n typeSupported = this.typeSupported,\n container = 'audio/mp4',\n tracks = {},\n data = { tracks: tracks },\n computePTSDTS = this._initPTS === undefined,\n initPTS,\n initDTS;\n\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 logger[\"b\" /* logger */].log('audio sampling rate : ' + audioTrack.samplerate);\n if (!audioTrack.isAAC) {\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 }\n tracks.audio = {\n container: container,\n codec: audioTrack.codec,\n initSegment: !audioTrack.isAAC && typeSupported.mpeg ? new Uint8Array() : mp4_generator.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - audioTrack.inputTimeScale * timeOffset;\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 var inputTimeScale = videoTrack.inputTimeScale;\n videoTrack.timescale = inputTimeScale;\n tracks.video = {\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: mp4_generator.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n if (computePTSDTS) {\n initPTS = Math.min(initPTS, videoSamples[0].pts - inputTimeScale * timeOffset);\n initDTS = Math.min(initDTS, videoSamples[0].dts - inputTimeScale * timeOffset);\n this.observer.trigger(events[\"a\" /* default */].INIT_PTS_FOUND, { initPTS: initPTS });\n }\n }\n\n if (Object.keys(tracks).length) {\n observer.trigger(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, data);\n this.ISGenerated = true;\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n } else {\n observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' });\n }\n };\n\n MP4Remuxer.prototype.remuxVideo = function remuxVideo(track, timeOffset, contiguous, audioTrackLength, accurateTimeOffset) {\n var offset = 8,\n timeScale = track.timescale,\n mp4SampleDuration,\n mdat,\n moof,\n firstPTS,\n firstDTS,\n nextDTS,\n lastPTS,\n lastDTS,\n inputSamples = track.samples,\n outputSamples = [],\n nbSamples = inputSamples.length,\n ptsNormalize = this._PTSNormalize,\n initDTS = this._initDTS;\n\n // for (let i = 0; i < track.samples.length; i++) {\n // let avcSample = track.samples[i];\n // let units = avcSample.units;\n // let unitsString = '';\n // for (let j = 0; j < units.length ; j++) {\n // unitsString += units[j].type + ',';\n // if (units[j].data.length < 500) {\n // unitsString += Hex.hexDump(units[j].data);\n // }\n // }\n // logger.log(avcSample.pts + '/' + avcSample.dts + ',' + unitsString + avcSample.units.length);\n // }\n\n // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n var nextAvcDts = this.nextAvcDts;\n\n var isSafari = this.isSafari;\n\n // Safari does not like overlapping DTS on consecutive fragments. let's use nextAvcDts to overcome this if fragments are consecutive\n if (isSafari) {\n // 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 200 ms PTS gaps (timeScale/5)\n contiguous |= inputSamples.length && nextAvcDts && (accurateTimeOffset && Math.abs(timeOffset - nextAvcDts / timeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAvcDts - initDTS) < timeScale / 5);\n }\n\n if (!contiguous) {\n // if not contiguous, let's use target timeOffset\n nextAvcDts = timeOffset * timeScale;\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 inputSamples.forEach(function (sample) {\n sample.pts = ptsNormalize(sample.pts - initDTS, nextAvcDts);\n sample.dts = ptsNormalize(sample.dts - initDTS, nextAvcDts);\n });\n\n // sort video samples by DTS then PTS then demux id order\n inputSamples.sort(function (a, b) {\n var deltadts = a.dts - b.dts;\n var deltapts = a.pts - b.pts;\n return deltadts ? deltadts : deltapts ? deltapts : a.id - b.id;\n });\n\n // handle broken streams with PTS < DTS, tolerance up 200ms (18000 in 90kHz timescale)\n var PTSDTSshift = inputSamples.reduce(function (prev, curr) {\n return Math.max(Math.min(prev, curr.pts - curr.dts), -18000);\n }, 0);\n if (PTSDTSshift < 0) {\n logger[\"b\" /* logger */].warn('PTS < DTS detected in video samples, shifting DTS by ' + Math.round(PTSDTSshift / 90) + ' ms to overcome this issue');\n for (var i = 0; i < inputSamples.length; i++) {\n inputSamples[i].dts += PTSDTSshift;\n }\n }\n\n // compute first DTS and last DTS, normalize them against reference value\n var sample = inputSamples[0];\n firstDTS = Math.max(sample.dts, 0);\n firstPTS = Math.max(sample.pts, 0);\n\n // check timestamp continuity accross consecutive fragments (this is to remove inter-fragment gap/hole)\n var delta = Math.round((firstDTS - nextAvcDts) / 90);\n // if fragment are contiguous, detect hole/overlapping between fragments\n if (contiguous) {\n if (delta) {\n if (delta > 1) {\n logger[\"b\" /* logger */].log('AVC:' + delta + ' ms hole between fragments detected,filling it');\n } else if (delta < -1) {\n logger[\"b\" /* logger */].log('AVC:' + -delta + ' ms overlapping between fragments detected');\n }\n // remove hole/gap : set DTS to next expected DTS\n firstDTS = nextAvcDts;\n inputSamples[0].dts = firstDTS;\n // offset PTS as well, ensure that PTS is smaller or equal than new DTS\n firstPTS = Math.max(firstPTS - delta, nextAvcDts);\n inputSamples[0].pts = firstPTS;\n logger[\"b\" /* logger */].log('Video/PTS/DTS adjusted: ' + Math.round(firstPTS / 90) + '/' + Math.round(firstDTS / 90) + ',delta:' + delta + ' ms');\n }\n }\n nextDTS = firstDTS;\n\n // compute lastPTS/lastDTS\n sample = inputSamples[inputSamples.length - 1];\n lastDTS = Math.max(sample.dts, 0);\n lastPTS = Math.max(sample.pts, 0, lastDTS);\n\n // on Safari let's signal the same sample duration for all samples\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 if (isSafari) {\n mp4SampleDuration = Math.round((lastDTS - firstDTS) / (inputSamples.length - 1));\n }\n\n var nbNalu = 0,\n naluLen = 0;\n for (var _i = 0; _i < nbSamples; _i++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i],\n units = _sample.units,\n nbUnits = units.length,\n 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 // normalize PTS/DTS\n if (isSafari) {\n // sample DTS is computed using a constant decoding offset (mp4SampleDuration) between samples\n _sample.dts = firstDTS + _i * mp4SampleDuration;\n } else {\n // ensure sample monotonic DTS\n _sample.dts = Math.max(_sample.dts, firstDTS);\n }\n // ensure that computed value is greater or equal than sample DTS\n _sample.pts = Math.max(_sample.pts, _sample.dts);\n }\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 try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MUX_ERROR, details: errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: 'fail allocating video mdat ' + mdatSize });\n return;\n }\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n var avcSample = inputSamples[_i2],\n avcSampleUnits = avcSample.units,\n mp4SampleLength = 0,\n compositionTimeOffset = void 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n for (var _j = 0, _nbUnits = avcSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = avcSampleUnits[_j],\n unitData = unit.data,\n 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 if (!isSafari) {\n // expected sample duration is the Decoding Timestamp diff of consecutive samples\n if (_i2 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i2 + 1].dts - avcSample.dts;\n } else {\n var config = this.config,\n lastFrameDuration = avcSample.dts - inputSamples[_i2 > 0 ? _i2 - 1 : _i2].dts;\n if (config.stretchShortVideoTrack) {\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 the minimum of maxBufferHole and\n // maxSeekHole. 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 maxBufferHole = config.maxBufferHole,\n maxSeekHole = config.maxSeekHole,\n gapTolerance = Math.floor(Math.min(maxBufferHole, maxSeekHole) * timeScale),\n deltaToFrameEnd = (audioTrackLength ? firstPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n if (deltaToFrameEnd > gapTolerance) {\n // We subtract lastFrameDuration from deltaToFrameEnd to try to prevent any video\n // frame overlap. maxBufferHole/maxSeekHole should be >> lastFrameDuration anyway.\n mp4SampleDuration = deltaToFrameEnd - lastFrameDuration;\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n }\n logger[\"b\" /* logger */].log('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 compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts);\n } else {\n compositionTimeOffset = Math.max(0, mp4SampleDuration * Math.round((avcSample.pts - avcSample.dts) / mp4SampleDuration));\n }\n\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n outputSamples.push({\n size: mp4SampleLength,\n // constant duration\n duration: mp4SampleDuration,\n cts: compositionTimeOffset,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: avcSample.key ? 2 : 1,\n isNonSync: avcSample.key ? 0 : 1\n }\n });\n }\n // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n this.nextAvcDts = lastDTS + mp4SampleDuration;\n var dropped = track.dropped;\n track.len = 0;\n track.nbNalu = 0;\n track.dropped = 0;\n if (outputSamples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var flags = outputSamples[0].flags;\n // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n track.samples = outputSamples;\n moof = mp4_generator.moof(track.sequenceNumber++, firstDTS, track);\n track.samples = [];\n\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: firstPTS / timeScale,\n endPTS: (lastPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: this.nextAvcDts / timeScale,\n type: 'video',\n nb: outputSamples.length,\n dropped: dropped\n };\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, data);\n return data;\n };\n\n MP4Remuxer.prototype.remuxAudio = function remuxAudio(track, timeOffset, contiguous, accurateTimeOffset) {\n var inputTimeScale = track.inputTimeScale,\n mp4timeScale = track.timescale,\n scaleFactor = inputTimeScale / mp4timeScale,\n mp4SampleDuration = track.isAAC ? 1024 : 1152,\n inputSampleDuration = mp4SampleDuration * scaleFactor,\n ptsNormalize = this._PTSNormalize,\n initDTS = this._initDTS,\n rawMPEG = !track.isAAC && this.typeSupported.mpeg;\n\n var offset,\n mp4Sample,\n fillFrame,\n mdat,\n moof,\n firstPTS,\n lastPTS,\n inputSamples = track.samples,\n outputSamples = [],\n nextAudioPts = this.nextAudioPts;\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 contiguous |= inputSamples.length && nextAudioPts && (accurateTimeOffset && Math.abs(timeOffset - nextAudioPts / inputTimeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAudioPts - initDTS) < 20 * inputSampleDuration);\n\n // compute normalized PTS\n inputSamples.forEach(function (sample) {\n sample.pts = sample.dts = ptsNormalize(sample.pts - initDTS, timeOffset * inputTimeScale);\n });\n\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 === 0) {\n return;\n }\n\n if (!contiguous) {\n if (!accurateTimeOffset) {\n // if frag are mot contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n } else {\n // if timeOffset is accurate, let's use it as predicted next audio PTS\n nextAudioPts = timeOffset * inputTimeScale;\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.isAAC) {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length;) {\n // First, let's see how far off this frame is from where we expect it to be\n var sample = inputSamples[i],\n delta;\n var pts = sample.pts;\n delta = pts - nextPts;\n\n //console.log(Math.round(pts) + '/' + Math.round(nextPts) + '/' + Math.round(delta));\n var duration = Math.abs(1000 * delta / inputTimeScale);\n\n // If we're overlapping by more than a duration, drop this sample\n if (delta <= -maxAudioFramesDrift * inputSampleDuration) {\n logger[\"b\" /* logger */].warn('Dropping 1 audio frame @ ' + (nextPts / inputTimeScale).toFixed(3) + 's due to ' + Math.round(duration) + ' ms overlap.');\n inputSamples.splice(i, 1);\n track.len -= sample.unit.length;\n // Don't touch nextPtsNorm or i\n }\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 else if (delta >= maxAudioFramesDrift * inputSampleDuration && duration < MAX_SILENT_FRAME_DURATION && nextPts) {\n var missing = Math.round(delta / inputSampleDuration);\n logger[\"b\" /* logger */].warn('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 fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger[\"b\" /* logger */].log('Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n inputSamples.splice(i, 0, { unit: fillFrame, pts: newStamp, dts: newStamp });\n track.len += fillFrame.length;\n nextPts += inputSampleDuration;\n i++;\n }\n\n // Adjust sample to next expected pts\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n } else {\n // Otherwise, just adjust pts\n if (Math.abs(delta) > 0.1 * inputSampleDuration) {\n //logger.log(`Invalid frame delta ${Math.round(delta + inputSampleDuration)} at PTS ${Math.round(pts / 90)} (should be ${Math.round(inputSampleDuration)}).`);\n }\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n }\n }\n\n for (var _j2 = 0, _nbSamples = inputSamples.length; _j2 < _nbSamples; _j2++) {\n var audioSample = inputSamples[_j2];\n var unit = audioSample.unit;\n var _pts = audioSample.pts;\n //logger.log(`Audio/PTS:${Math.round(pts/90)}`);\n // if not first sample\n if (lastPTS !== undefined) {\n mp4Sample.duration = Math.round((_pts - lastPTS) / scaleFactor);\n } else {\n var _delta = Math.round(1000 * (_pts - nextAudioPts) / inputTimeScale),\n numMissingFrames = 0;\n // if fragment are contiguous, detect hole/overlapping between fragments\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n if (contiguous && track.isAAC) {\n // log delta\n if (_delta) {\n if (_delta > 0 && _delta < MAX_SILENT_FRAME_DURATION) {\n numMissingFrames = Math.round((_pts - nextAudioPts) / inputSampleDuration);\n logger[\"b\" /* logger */].log(_delta + ' ms hole between AAC samples detected,filling it');\n if (numMissingFrames > 0) {\n fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n fillFrame = unit.subarray();\n }\n track.len += numMissingFrames * fillFrame.length;\n }\n // if we have frame overlap, overlapping for more than half a frame duraion\n } else if (_delta < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger[\"b\" /* logger */].log('drop overlapping AAC sample, expected/parsed/delta:' + (nextAudioPts / inputTimeScale).toFixed(3) + 's/' + (_pts / inputTimeScale).toFixed(3) + 's/' + -_delta + 'ms');\n track.len -= unit.byteLength;\n continue;\n }\n // set PTS/DTS to expected PTS/DTS\n _pts = nextAudioPts;\n }\n }\n // remember first PTS of our audioSamples\n firstPTS = _pts;\n if (track.len > 0) {\n /* concatenate the audio data and construct the mdat in place\n (need 8 more bytes to fill length and mdat type) */\n var mdatSize = rawMPEG ? track.len : track.len + 8;\n offset = rawMPEG ? 0 : 8;\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MUX_ERROR, details: errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: 'fail allocating audio mdat ' + mdatSize });\n return;\n }\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n }\n } else {\n // no audio samples\n return;\n }\n for (var _i3 = 0; _i3 < numMissingFrames; _i3++) {\n fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger[\"b\" /* logger */].log('Unable to get silent frame for given audio codec; duplicating this frame instead.');\n fillFrame = unit.subarray();\n }\n mdat.set(fillFrame, offset);\n offset += fillFrame.byteLength;\n mp4Sample = {\n size: fillFrame.byteLength,\n cts: 0,\n duration: 1024,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n }\n }\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen;\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${audioSample.pts}/${audioSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(audioSample.pts/4294967296).toFixed(3)}');\n mp4Sample = {\n size: unitLen,\n cts: 0,\n duration: 0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n lastPTS = _pts;\n }\n var lastSampleDuration = 0;\n var nbSamples = outputSamples.length;\n //set last sample duration as being identical to previous sample\n if (nbSamples >= 2) {\n lastSampleDuration = outputSamples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n if (nbSamples) {\n // next audio sample PTS should be equal to last sample PTS + duration\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSampleDuration;\n //logger.log('Audio/PTS/PTSend:' + audioSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n track.len = 0;\n track.samples = outputSamples;\n if (rawMPEG) {\n moof = new Uint8Array();\n } else {\n moof = mp4_generator.moof(track.sequenceNumber++, firstPTS / scaleFactor, track);\n }\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: 'audio',\n nb: nbSamples\n };\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, audioData);\n return audioData;\n }\n return null;\n };\n\n MP4Remuxer.prototype.remuxEmptyAudio = function remuxEmptyAudio(track, timeOffset, contiguous, videoData) {\n var inputTimeScale = track.inputTimeScale,\n mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale,\n scaleFactor = inputTimeScale / mp4timeScale,\n nextAudioPts = this.nextAudioPts,\n\n\n // sync with video's timestamp\n startDTS = (nextAudioPts !== undefined ? nextAudioPts : videoData.startDTS * inputTimeScale) + this._initDTS,\n endDTS = videoData.endDTS * inputTimeScale + this._initDTS,\n\n // one sample's duration value\n sampleDuration = 1024,\n frameDuration = scaleFactor * sampleDuration,\n\n\n // samples count of this segment's duration\n nbSamples = Math.ceil((endDTS - startDTS) / frameDuration),\n\n\n // silent frame\n silentFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n logger[\"b\" /* logger */].warn('remux empty Audio');\n // Can't remux if we can't generate a silent frame...\n if (!silentFrame) {\n logger[\"b\" /* logger */].trace('Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!');\n return;\n }\n\n var samples = [];\n for (var i = 0; i < nbSamples; i++) {\n var stamp = startDTS + i * frameDuration;\n samples.push({ unit: silentFrame, pts: stamp, dts: stamp });\n track.len += silentFrame.length;\n }\n track.samples = samples;\n\n this.remuxAudio(track, timeOffset, contiguous);\n };\n\n MP4Remuxer.prototype.remuxID3 = function remuxID3(track, timeOffset) {\n var length = track.samples.length,\n sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n var initDTS = this._initDTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n 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 = (sample.pts - initPTS) / inputTimeScale;\n sample.dts = (sample.dts - initDTS) / inputTimeScale;\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_METADATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n };\n\n MP4Remuxer.prototype.remuxText = function remuxText(track, timeOffset) {\n track.samples.sort(function (a, b) {\n return a.pts - b.pts;\n });\n\n var length = track.samples.length,\n sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n 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 = (sample.pts - initPTS) / inputTimeScale;\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_USERDATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n };\n\n MP4Remuxer.prototype._PTSNormalize = function _PTSNormalize(value, reference) {\n var offset;\n if (reference === undefined) {\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\n return MP4Remuxer;\n}();\n\n/* harmony default export */ var mp4_remuxer = (mp4_remuxer_MP4Remuxer);\n// CONCATENATED MODULE: ./src/remux/passthrough-remuxer.js\nfunction passthrough_remuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * passthrough remuxer\n*/\n\n\nvar passthrough_remuxer_PassThroughRemuxer = function () {\n function PassThroughRemuxer(observer) {\n passthrough_remuxer__classCallCheck(this, PassThroughRemuxer);\n\n this.observer = observer;\n }\n\n PassThroughRemuxer.prototype.destroy = function destroy() {};\n\n PassThroughRemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n PassThroughRemuxer.prototype.resetInitSegment = function resetInitSegment() {};\n\n PassThroughRemuxer.prototype.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset, rawData) {\n var observer = this.observer;\n var streamType = '';\n if (audioTrack) {\n streamType += 'audio';\n }\n if (videoTrack) {\n streamType += 'video';\n }\n observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: streamType,\n nb: 1,\n dropped: 0\n });\n //notify end of parsing\n observer.trigger(events[\"a\" /* default */].FRAG_PARSED);\n };\n\n return PassThroughRemuxer;\n}();\n\n/* harmony default export */ var passthrough_remuxer = (passthrough_remuxer_PassThroughRemuxer);\n// CONCATENATED MODULE: ./src/demux/demuxer-inline.js\nfunction demuxer_inline__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/* inline demuxer.\n * probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n */\n\n\n\n\n\n\n\n\n\n\n\nvar demuxer_inline_DemuxerInline = function () {\n function DemuxerInline(observer, typeSupported, config, vendor) {\n demuxer_inline__classCallCheck(this, DemuxerInline);\n\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n }\n\n DemuxerInline.prototype.destroy = function destroy() {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n }\n };\n\n DemuxerInline.prototype.push = function push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n if (data.byteLength > 0 && decryptdata != null && decryptdata.key != null && decryptdata.method === 'AES-128') {\n var decrypter = this.decrypter;\n if (decrypter == null) {\n decrypter = this.decrypter = new crypt_decrypter[\"a\" /* default */](this.observer, this.config);\n }\n var localthis = this;\n // performance.now() not available on WebWorker, at least on Safari Desktop\n var startTime;\n try {\n startTime = performance.now();\n } catch (error) {\n startTime = Date.now();\n }\n decrypter.decrypt(data, decryptdata.key.buffer, decryptdata.iv.buffer, function (decryptedData) {\n var endTime;\n try {\n endTime = performance.now();\n } catch (error) {\n endTime = Date.now();\n }\n localthis.observer.trigger(events[\"a\" /* default */].FRAG_DECRYPTED, { stats: { tstart: startTime, tdecrypt: endTime } });\n localthis.pushDecrypted(new Uint8Array(decryptedData), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n });\n } else {\n this.pushDecrypted(new Uint8Array(data), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n };\n\n DemuxerInline.prototype.pushDecrypted = function pushDecrypted(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var demuxer = this.demuxer;\n if (!demuxer ||\n // in case of continuity change, we might switch from content type (AAC container to TS container for example)\n // so let's check that current demuxer is still valid\n discontinuity && !this.probe(data)) {\n var observer = this.observer;\n var typeSupported = this.typeSupported;\n var config = this.config;\n // probing order is TS/AAC/MP3/MP4\n var muxConfig = [{ demux: tsdemuxer, remux: mp4_remuxer }, { demux: mp4demuxer, remux: passthrough_remuxer }, { demux: aacdemuxer, remux: mp4_remuxer }, { demux: mp3demuxer, remux: mp4_remuxer }];\n\n // probe for content type\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n var mux = muxConfig[i];\n var probe = mux.demux.probe;\n if (probe(data)) {\n var _remuxer = this.remuxer = new mux.remux(observer, config, typeSupported, this.vendor);\n demuxer = new mux.demux(observer, _remuxer, config, typeSupported);\n this.probe = probe;\n break;\n }\n }\n if (!demuxer) {\n observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: true, reason: 'no demux matching with content found' });\n return;\n }\n this.demuxer = demuxer;\n }\n var remuxer = this.remuxer;\n\n if (discontinuity || trackSwitch) {\n demuxer.resetInitSegment(initSegment, audioCodec, videoCodec, duration);\n remuxer.resetInitSegment();\n }\n if (discontinuity) {\n demuxer.resetTimeStamp(defaultInitPTS);\n remuxer.resetTimeStamp(defaultInitPTS);\n }\n if (typeof demuxer.setDecryptData === 'function') {\n demuxer.setDecryptData(decryptdata);\n }\n demuxer.append(data, timeOffset, contiguous, accurateTimeOffset);\n };\n\n return DemuxerInline;\n}();\n\n/* harmony default export */ var demuxer_inline = __webpack_exports__[\"a\"] = (demuxer_inline_DemuxerInline);\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\nvar cues_namespaceObject = {};\n__webpack_require__.d(cues_namespaceObject, \"newCue\", function() { return newCue; });\n\n// EXTERNAL MODULE: ./node_modules/url-toolkit/src/url-toolkit.js\nvar url_toolkit = __webpack_require__(6);\nvar url_toolkit_default = /*#__PURE__*/__webpack_require__.n(url_toolkit);\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/event-handler.js\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\n\n\n\n\nvar event_handler_EventHandler = function () {\n function EventHandler(hls) {\n _classCallCheck(this, EventHandler);\n\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n\n for (var _len = arguments.length, events = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n this.handledEvents = events;\n this.useGenericHandler = true;\n\n this.registerListeners();\n }\n\n EventHandler.prototype.destroy = function destroy() {\n this.unregisterListeners();\n };\n\n EventHandler.prototype.isEventHandler = function isEventHandler() {\n return _typeof(this.handledEvents) === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n };\n\n EventHandler.prototype.registerListeners = function registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n if (event === 'hlsEventGeneric') {\n throw new Error('Forbidden event name: ' + event);\n }\n this.hls.on(event, this.onEvent);\n }, this);\n }\n };\n\n EventHandler.prototype.unregisterListeners = function unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n this.hls.off(event, this.onEvent);\n }, this);\n }\n };\n\n /**\n * arguments: event (string), data (any)\n */\n\n\n EventHandler.prototype.onEvent = function onEvent(event, data) {\n this.onEventGeneric(event, data);\n };\n\n EventHandler.prototype.onEventGeneric = function onEventGeneric(event, data) {\n var eventToFunction = function eventToFunction(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n if (typeof this[funcName] !== 'function') {\n throw new Error('Event ' + event + ' has no generic handler in this ' + this.constructor.name + ' class (tried ' + funcName + ')');\n }\n return this[funcName].bind(this, data);\n };\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger[\"b\" /* logger */].error('internal error happened while processing ' + event + ':' + err.message);\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR, details: errors[\"a\" /* ErrorDetails */].INTERNAL_EXCEPTION, fatal: false, event: event, err: err });\n }\n };\n\n return EventHandler;\n}();\n\n/* harmony default export */ var event_handler = (event_handler_EventHandler);\n// CONCATENATED MODULE: ./src/utils/attr-list.js\nfunction attr_list__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/;\nvar ATTR_LIST_REGEX = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g;\n\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\n\nvar AttrList = function () {\n function AttrList(attrs) {\n attr_list__classCallCheck(this, AttrList);\n\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n\n AttrList.prototype.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\n AttrList.prototype.hexadecimalInteger = function hexadecimalInteger(attrName) {\n if (this[attrName]) {\n var stringValue = (this[attrName] || '0x').slice(2);\n stringValue = (stringValue.length & 1 ? '0' : '') + stringValue;\n\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\n AttrList.prototype.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\n AttrList.prototype.decimalFloatingPoint = function decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n };\n\n AttrList.prototype.enumeratedString = function enumeratedString(attrName) {\n return this[attrName];\n };\n\n AttrList.prototype.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\n AttrList.parseAttrList = function parseAttrList(input) {\n var match,\n attrs = {};\n ATTR_LIST_REGEX.lastIndex = 0;\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2],\n quote = '\"';\n\n if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) {\n value = value.slice(1, -1);\n }\n attrs[match[1]] = value;\n }\n return attrs;\n };\n\n return AttrList;\n}();\n\n/* harmony default export */ var attr_list = (AttrList);\n// CONCATENATED MODULE: ./src/utils/codecs.js\n// from http://mp4ra.org/codecs.html\nvar sampleEntryCodesISO = {\n audio: {\n 'a3ds': true,\n 'ac-3': true,\n 'ac-4': true,\n 'alac': true,\n 'alaw': true,\n 'dra1': true,\n 'dts+': true,\n 'dts-': true,\n 'dtsc': true,\n 'dtse': true,\n 'dtsh': true,\n 'ec-3': true,\n 'enca': true,\n 'g719': true,\n 'g726': true,\n 'm4ae': true,\n 'mha1': true,\n 'mha2': true,\n 'mhm1': true,\n 'mhm2': true,\n 'mlpa': true,\n 'mp4a': true,\n 'raw ': true,\n 'Opus': true,\n 'samr': true,\n 'sawb': true,\n 'sawp': true,\n 'sevc': true,\n 'sqcp': true,\n 'ssmv': true,\n 'twos': true,\n 'ulaw': true\n },\n video: {\n 'avc1': true,\n 'avc2': true,\n 'avc3': true,\n 'avc4': true,\n 'avcp': true,\n 'drac': true,\n 'dvav': true,\n 'dvhe': true,\n 'encv': true,\n 'hev1': true,\n 'hvc1': true,\n 'mjp2': true,\n 'mp4v': true,\n 'mvc1': true,\n 'mvc2': true,\n 'mvc3': true,\n 'mvc4': true,\n 'resv': true,\n 'rv60': true,\n 's263': true,\n 'svc1': true,\n 'svc2': true,\n 'vc-1': true,\n 'vp08': true,\n 'vp09': true\n }\n};\n\nfunction isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n}\n\nfunction isCodecSupportedInMp4(codec, type) {\n return MediaSource.isTypeSupported((type || 'video') + '/mp4;codecs=\"' + codec + '\"');\n}\n\n\n// CONCATENATED MODULE: ./src/loader/playlist-loader.js\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction playlist_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Playlist Loader\n*/\n\n\n\n\n\n\n\n\n\n// https://regex101.com is your friend\nvar MASTER_PLAYLIST_REGEX = /#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)/g;\nvar MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\n\nvar LEVEL_PLAYLIST_REGEX_FAST = new RegExp([/#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source, // duration (#EXTINF:,), group 1 => duration, group 2 => title\n/|(?!#)(\\S+)/.source, // segment URI, group 3 => the URI (note newline is not eaten)\n/|#EXT-X-BYTERANGE:*(.+)/.source, // next segment's byterange, group 4 => range spec (x@y)\n/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, // 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\nvar LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\\d+))|(?:#EXT-X-(TARGETDURATION): *(\\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\\r?\\n?/;\n\nvar playlist_loader_LevelKey = function () {\n function LevelKey() {\n playlist_loader__classCallCheck(this, LevelKey);\n\n this.method = null;\n this.key = null;\n this.iv = null;\n this._uri = null;\n }\n\n _createClass(LevelKey, [{\n key: 'uri',\n get: function get() {\n if (!this._uri && this.reluri) {\n this._uri = url_toolkit_default.a.buildAbsoluteURL(this.baseuri, this.reluri, { alwaysNormalize: true });\n }\n return this._uri;\n }\n }]);\n\n return LevelKey;\n}();\n\nvar playlist_loader_Fragment = function () {\n function Fragment() {\n playlist_loader__classCallCheck(this, Fragment);\n\n this._url = null;\n this._byteRange = null;\n this._decryptdata = null;\n this.tagList = [];\n }\n\n /**\n * Utility method for parseLevelPlaylist to create an initialization vector for a given segment\n * @returns {Uint8Array}\n */\n Fragment.prototype.createInitializationVector = function createInitializationVector(segmentNumber) {\n var uint8View = new Uint8Array(16);\n\n for (var i = 12; i < 16; i++) {\n uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff;\n }\n\n return uint8View;\n };\n\n /**\n * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data\n * @param levelkey - a playlist's encryption info\n * @param segmentNumber - the fragment's segment number\n * @returns {*} - an object to be applied as a fragment's decryptdata\n */\n\n\n Fragment.prototype.fragmentDecryptdataFromLevelkey = function fragmentDecryptdataFromLevelkey(levelkey, segmentNumber) {\n var decryptdata = levelkey;\n\n if (levelkey && levelkey.method && levelkey.uri && !levelkey.iv) {\n decryptdata = new playlist_loader_LevelKey();\n decryptdata.method = levelkey.method;\n decryptdata.baseuri = levelkey.baseuri;\n decryptdata.reluri = levelkey.reluri;\n decryptdata.iv = this.createInitializationVector(segmentNumber);\n }\n\n return decryptdata;\n };\n\n Fragment.prototype.cloneObj = function cloneObj(obj) {\n return JSON.parse(JSON.stringify(obj));\n };\n\n _createClass(Fragment, [{\n key: 'url',\n get: function get() {\n if (!this._url && this.relurl) {\n this._url = url_toolkit_default.a.buildAbsoluteURL(this.baseurl, this.relurl, { alwaysNormalize: true });\n }\n return this._url;\n },\n set: function set(value) {\n this._url = value;\n }\n }, {\n key: 'programDateTime',\n get: function get() {\n if (!this._programDateTime && this.rawProgramDateTime) {\n this._programDateTime = new Date(Date.parse(this.rawProgramDateTime));\n }\n return this._programDateTime;\n }\n }, {\n key: 'byteRange',\n get: function get() {\n if (!this._byteRange) {\n var byteRange = this._byteRange = [];\n if (this.rawByteRange) {\n var params = this.rawByteRange.split('@', 2);\n if (params.length === 1) {\n var lastByteRangeEndOffset = this.lastByteRangeEndOffset;\n byteRange[0] = lastByteRangeEndOffset ? lastByteRangeEndOffset : 0;\n } else {\n byteRange[0] = parseInt(params[1]);\n }\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n }\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: 'decryptdata',\n get: function get() {\n if (!this._decryptdata) {\n this._decryptdata = this.fragmentDecryptdataFromLevelkey(this.levelkey, this.sn);\n }\n return this._decryptdata;\n }\n }]);\n\n return Fragment;\n}();\n\nfunction findGroup(groups, mediaGroupId) {\n if (!groups) {\n return null;\n }\n\n var matchingGroup = null;\n\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n if (group.id === mediaGroupId) {\n matchingGroup = group;\n }\n }\n\n return matchingGroup;\n}\n\nvar playlist_loader_PlaylistLoader = function (_EventHandler) {\n _inherits(PlaylistLoader, _EventHandler);\n\n function PlaylistLoader(hls) {\n playlist_loader__classCallCheck(this, PlaylistLoader);\n\n var _this = _possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].LEVEL_LOADING, events[\"a\" /* default */].AUDIO_TRACK_LOADING, events[\"a\" /* default */].SUBTITLE_TRACK_LOADING));\n\n _this.loaders = {};\n return _this;\n }\n\n PlaylistLoader.prototype.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n PlaylistLoader.prototype.onManifestLoading = function onManifestLoading(data) {\n this.load(data.url, { type: 'manifest' });\n };\n\n PlaylistLoader.prototype.onLevelLoading = function onLevelLoading(data) {\n this.load(data.url, { type: 'level', level: data.level, id: data.id });\n };\n\n PlaylistLoader.prototype.onAudioTrackLoading = function onAudioTrackLoading(data) {\n this.load(data.url, { type: 'audioTrack', id: data.id });\n };\n\n PlaylistLoader.prototype.onSubtitleTrackLoading = function onSubtitleTrackLoading(data) {\n this.load(data.url, { type: 'subtitleTrack', id: data.id });\n };\n\n PlaylistLoader.prototype.load = function load(url, context) {\n var loader = this.loaders[context.type];\n if (loader !== undefined) {\n var loaderContext = loader.context;\n if (loaderContext && loaderContext.url === url) {\n logger[\"b\" /* logger */].trace('playlist request ongoing');\n return;\n } else {\n logger[\"b\" /* logger */].warn('abort previous loader for type:' + context.type);\n loader.abort();\n }\n }\n var config = this.hls.config,\n maxRetry = void 0,\n timeout = void 0,\n retryDelay = void 0,\n maxRetryDelay = void 0;\n if (context.type === 'manifest') {\n maxRetry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n maxRetryDelay = config.manifestLoadingMaxRetryTimeout;\n } else if (context.type === 'level') {\n // Disable internal loader retry logic, since we are managing retries in Level Controller\n maxRetry = 0;\n timeout = config.levelLoadingTimeOut;\n } else {\n // TODO Introduce retry settings for audio-track and subtitle-track, it should not use level retry config\n maxRetry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n maxRetryDelay = config.levelLoadingMaxRetryTimeout;\n logger[\"b\" /* logger */].log('loading playlist for ' + context.type + ' ' + (context.level || context.id));\n }\n loader = this.loaders[context.type] = context.loader = typeof config.pLoader !== 'undefined' ? new config.pLoader(config) : new config.loader(config);\n context.url = url;\n context.responseType = '';\n\n var loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderConfig = { timeout: timeout, maxRetry: maxRetry, retryDelay: retryDelay, maxRetryDelay: maxRetryDelay };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) };\n loader.load(context, loaderConfig, loaderCallbacks);\n };\n\n PlaylistLoader.prototype.resolve = function resolve(url, baseUrl) {\n return url_toolkit_default.a.buildAbsoluteURL(baseUrl, url, { alwaysNormalize: true });\n };\n\n PlaylistLoader.prototype.parseMasterPlaylist = function parseMasterPlaylist(string, baseurl) {\n var levels = [],\n result = void 0;\n MASTER_PLAYLIST_REGEX.lastIndex = 0;\n\n function setCodecs(codecs, level) {\n ['video', 'audio'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) {\n return isCodecType(codec, type);\n });\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + 'Codec'] = preferred.length > 0 ? preferred[0] : filtered[0];\n\n // remove from list\n codecs = codecs.filter(function (codec) {\n return filtered.indexOf(codec) === -1;\n });\n }\n });\n\n level.unknownCodecs = codecs;\n }\n\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n var level = {};\n\n var attrs = level.attrs = new attr_list(result[1]);\n level.url = this.resolve(result[2], baseurl);\n\n var resolution = attrs.decimalResolution('RESOLUTION');\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n\n setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);\n\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = this.avc1toavcoti(level.videoCodec);\n }\n\n levels.push(level);\n }\n return levels;\n };\n\n PlaylistLoader.prototype.parseMasterPlaylistMedia = function parseMasterPlaylistMedia(string, baseurl, type) {\n var audioGroups = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n\n var result = void 0;\n var medias = [];\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var media = {};\n var attrs = new attr_list(result[1]);\n if (attrs.TYPE === type) {\n media.groupId = attrs['GROUP-ID'];\n media.name = attrs.NAME;\n media.type = type;\n media.default = attrs.DEFAULT === 'YES';\n media.autoselect = attrs.AUTOSELECT === 'YES';\n media.forced = attrs.FORCED === 'YES';\n if (attrs.URI) {\n media.url = this.resolve(attrs.URI, baseurl);\n }\n media.lang = attrs.LANGUAGE;\n if (!media.name) {\n media.name = media.lang;\n }\n if (audioGroups.length) {\n var groupCodec = findGroup(audioGroups, media.groupId);\n media.audioCodec = groupCodec ? groupCodec.codec : audioGroups[0].codec;\n }\n media.id = id++;\n medias.push(media);\n }\n }\n return medias;\n };\n\n PlaylistLoader.prototype.avc1toavcoti = function avc1toavcoti(codec) {\n var result,\n avcdata = codec.split('.');\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n } else {\n result = codec;\n }\n return result;\n };\n\n PlaylistLoader.prototype.parseLevelPlaylist = function parseLevelPlaylist(string, baseurl, id, type) {\n var currentSN = 0,\n totalduration = 0,\n level = { type: null, version: null, url: baseurl, fragments: [], live: true, startSN: 0 },\n levelkey = new playlist_loader_LevelKey(),\n cc = 0,\n prevFrag = null,\n frag = new playlist_loader_Fragment(),\n result,\n i;\n\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\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 ? title : null;\n frag.tagList.push(title ? ['INF', duration, title] : ['INF', duration]);\n } else if (result[3]) {\n // url\n if (!isNaN(frag.duration)) {\n var sn = currentSN++;\n frag.type = type;\n frag.start = totalduration;\n frag.levelkey = levelkey;\n frag.sn = sn;\n frag.level = id;\n frag.cc = cc;\n frag.baseurl = baseurl;\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n frag.relurl = (' ' + result[3]).slice(1);\n\n level.fragments.push(frag);\n prevFrag = frag;\n totalduration += frag.duration;\n\n frag = new playlist_loader_Fragment();\n }\n } else if (result[4]) {\n // X-BYTERANGE\n frag.rawByteRange = (' ' + result[4]).slice(1);\n if (prevFrag) {\n var lastByteRangeEndOffset = prevFrag.byteRangeEndOffset;\n if (lastByteRangeEndOffset) {\n frag.lastByteRangeEndOffset = lastByteRangeEndOffset;\n }\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 (level.programDateTime === undefined) {\n level.programDateTime = new Date(new Date(Date.parse(result[5])) - 1000 * totalduration);\n }\n } else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n for (i = 1; i < result.length; i++) {\n if (result[i] !== undefined) {\n break;\n }\n }\n\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = (' ' + result[i + 2]).slice(1);\n\n switch (result[i]) {\n case '#':\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n break;\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 'TARGETDURATION':\n level.targetduration = parseFloat(value1);\n break;\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n case 'EXTM3U':\n break;\n case 'ENDLIST':\n level.live = false;\n break;\n case 'DIS':\n cc++;\n frag.tagList.push(['DIS']);\n break;\n case 'DISCONTINUITY-SEQ':\n cc = parseInt(value1);\n break;\n case 'KEY':\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-3.4.4\n var decryptparams = value1;\n var keyAttrs = new attr_list(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD'),\n decrypturi = keyAttrs.URI,\n decryptiv = keyAttrs.hexadecimalInteger('IV');\n if (decryptmethod) {\n levelkey = new playlist_loader_LevelKey();\n if (decrypturi && ['AES-128', 'SAMPLE-AES'].indexOf(decryptmethod) >= 0) {\n levelkey.method = decryptmethod;\n // URI to get the key\n levelkey.baseuri = baseurl;\n levelkey.reluri = decrypturi;\n levelkey.key = null;\n // Initialization Vector (IV)\n levelkey.iv = decryptiv;\n }\n }\n break;\n case 'START':\n var startParams = value1;\n var startAttrs = new attr_list(startParams);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET');\n //TIME-OFFSET can be 0\n if (!isNaN(startTimeOffset)) {\n level.startTimeOffset = startTimeOffset;\n }\n break;\n case 'MAP':\n var mapAttrs = new attr_list(value1);\n frag.relurl = mapAttrs.URI;\n frag.rawByteRange = mapAttrs.BYTERANGE;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n frag = new playlist_loader_Fragment();\n break;\n default:\n logger[\"b\" /* logger */].warn('line parsed but not handled: ' + result);\n break;\n }\n }\n }\n frag = prevFrag;\n //logger.log('found ' + level.fragments.length + ' fragments');\n if (frag && !frag.relurl) {\n level.fragments.pop();\n totalduration -= frag.duration;\n }\n level.totalduration = totalduration;\n level.averagetargetduration = totalduration / level.fragments.length;\n level.endSN = currentSN - 1;\n level.startCC = level.fragments[0] ? level.fragments[0].cc : 0;\n level.endCC = cc;\n return level;\n };\n\n PlaylistLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n var string = response.data,\n url = response.url,\n type = context.type,\n id = context.id,\n level = context.level,\n hls = this.hls;\n\n this.loaders[type] = undefined;\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 stats.tload = performance.now();\n //stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n if (string.indexOf('#EXTM3U') === 0) {\n if (string.indexOf('#EXTINF:') > 0) {\n var isLevel = type !== 'audioTrack' && type !== 'subtitleTrack',\n levelId = !isNaN(level) ? level : !isNaN(id) ? id : 0,\n levelDetails = this.parseLevelPlaylist(string, url, levelId, type === 'audioTrack' ? 'audio' : type === 'subtitleTrack' ? 'subtitle' : 'main');\n levelDetails.tload = stats.tload;\n if (type === 'manifest') {\n // first request, stream manifest (no master playlist), fire manifest loaded event with level details\n hls.trigger(events[\"a\" /* default */].MANIFEST_LOADED, { levels: [{ url: url, details: levelDetails }], audioTracks: [], url: url, stats: stats, networkDetails: networkDetails });\n }\n stats.tparsed = performance.now();\n if (levelDetails.targetduration) {\n if (isLevel) {\n hls.trigger(events[\"a\" /* default */].LEVEL_LOADED, { details: levelDetails, level: level || 0, id: id || 0, stats: stats, networkDetails: networkDetails });\n } else {\n if (type === 'audioTrack') {\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADED, { details: levelDetails, id: id, stats: stats, networkDetails: networkDetails });\n } else if (type === 'subtitleTrack') {\n hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADED, { details: levelDetails, id: id, stats: stats, networkDetails: networkDetails });\n }\n }\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'invalid targetduration', networkDetails: networkDetails });\n }\n } else {\n var levels = this.parseMasterPlaylist(string, url);\n // multi level playlist, parse level info\n if (levels.length) {\n var audioGroups = levels.map(function (l) {\n return { id: l.attrs.AUDIO, codec: l.audioCodec };\n });\n var audioTracks = this.parseMasterPlaylistMedia(string, url, 'AUDIO', audioGroups);\n var subtitles = this.parseMasterPlaylistMedia(string, url, 'SUBTITLES');\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 = false;\n audioTracks.forEach(function (audioTrack) {\n if (!audioTrack.url) {\n embeddedAudioFound = true;\n }\n });\n // if no embedded audio track defined, but audio codec signaled in quality level, we need to signal this main audio track\n // this could happen with playlists with alt audio rendition in which quality levels (main) contains both audio+video. but with mixed audio track not signaled\n if (embeddedAudioFound === false && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger[\"b\" /* logger */].log('audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({ type: 'main', name: 'main' });\n }\n }\n hls.trigger(events[\"a\" /* default */].MANIFEST_LOADED, { levels: levels, audioTracks: audioTracks, subtitles: subtitles, url: url, stats: stats, networkDetails: networkDetails });\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no level found in manifest', networkDetails: networkDetails });\n }\n }\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no EXTM3U delimiter', networkDetails: networkDetails });\n }\n };\n\n PlaylistLoader.prototype.loaderror = function loaderror(response, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var details,\n fatal,\n loader = context.loader;\n switch (context.type) {\n case 'manifest':\n details = errors[\"a\" /* ErrorDetails */].MANIFEST_LOAD_ERROR;\n fatal = true;\n break;\n case 'level':\n details = errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR;\n fatal = false;\n break;\n case 'audioTrack':\n details = errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_ERROR;\n fatal = false;\n break;\n }\n if (loader) {\n loader.abort();\n this.loaders[context.type] = undefined;\n }\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: details, fatal: fatal, url: loader.url, loader: loader, response: response, context: context, networkDetails: networkDetails });\n };\n\n PlaylistLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var details,\n fatal,\n loader = context.loader;\n switch (context.type) {\n case 'manifest':\n details = errors[\"a\" /* ErrorDetails */].MANIFEST_LOAD_TIMEOUT;\n fatal = true;\n break;\n case 'level':\n details = errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT;\n fatal = false;\n break;\n case 'audioTrack':\n details = errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_TIMEOUT;\n fatal = false;\n break;\n }\n if (loader) {\n loader.abort();\n this.loaders[context.type] = undefined;\n }\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: details, fatal: fatal, url: loader.url, loader: loader, context: context, networkDetails: networkDetails });\n };\n\n return PlaylistLoader;\n}(event_handler);\n\n/* harmony default export */ var playlist_loader = (playlist_loader_PlaylistLoader);\n// CONCATENATED MODULE: ./src/loader/fragment-loader.js\nfunction fragment_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction fragment_loader__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction fragment_loader__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Fragment Loader\n*/\n\n\n\n\n\n\nvar fragment_loader_FragmentLoader = function (_EventHandler) {\n fragment_loader__inherits(FragmentLoader, _EventHandler);\n\n function FragmentLoader(hls) {\n fragment_loader__classCallCheck(this, FragmentLoader);\n\n var _this = fragment_loader__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FRAG_LOADING));\n\n _this.loaders = {};\n return _this;\n }\n\n FragmentLoader.prototype.destroy = function destroy() {\n var loaders = this.loaders;\n for (var loaderName in loaders) {\n var loader = loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n FragmentLoader.prototype.onFragLoading = function onFragLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loader = this.loaders[type],\n config = this.hls.config;\n\n frag.loaded = 0;\n if (loader) {\n logger[\"b\" /* logger */].warn('abort previous fragment loader for type:' + type);\n loader.abort();\n }\n loader = this.loaders[type] = frag.loader = typeof config.fLoader !== 'undefined' ? new config.fLoader(config) : new config.loader(config);\n\n var loaderContext = void 0,\n loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderContext = { url: frag.url, frag: frag, responseType: 'arraybuffer', progressData: false };\n var start = frag.byteRangeStartOffset,\n end = frag.byteRangeEndOffset;\n if (!isNaN(start) && !isNaN(end)) {\n loaderContext.rangeStart = start;\n loaderContext.rangeEnd = end;\n }\n loaderConfig = { timeout: config.fragLoadingTimeOut, maxRetry: 0, retryDelay: 0, maxRetryDelay: config.fragLoadingMaxRetryTimeout };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this), onProgress: this.loadprogress.bind(this) };\n loader.load(loaderContext, loaderConfig, loaderCallbacks);\n };\n\n FragmentLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n var payload = response.data,\n frag = context.frag;\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOADED, { payload: payload, frag: frag, stats: stats, networkDetails: networkDetails });\n };\n\n FragmentLoader.prototype.loaderror = function loaderror(response, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var loader = context.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR, fatal: false, frag: context.frag, response: response, networkDetails: networkDetails });\n };\n\n FragmentLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var loader = context.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT, fatal: false, frag: context.frag, networkDetails: networkDetails });\n };\n\n // data will be used for progressive parsing\n\n\n FragmentLoader.prototype.loadprogress = function loadprogress(stats, context, data) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n // jshint ignore:line\n var frag = context.frag;\n frag.loaded = stats.loaded;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOAD_PROGRESS, { frag: frag, stats: stats, networkDetails: networkDetails });\n };\n\n return FragmentLoader;\n}(event_handler);\n\n/* harmony default export */ var fragment_loader = (fragment_loader_FragmentLoader);\n// CONCATENATED MODULE: ./src/loader/key-loader.js\nfunction key_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction key_loader__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction key_loader__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Decrypt key Loader\n*/\n\n\n\n\n\n\nvar key_loader_KeyLoader = function (_EventHandler) {\n key_loader__inherits(KeyLoader, _EventHandler);\n\n function KeyLoader(hls) {\n key_loader__classCallCheck(this, KeyLoader);\n\n var _this = key_loader__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].KEY_LOADING));\n\n _this.loaders = {};\n _this.decryptkey = null;\n _this.decrypturl = null;\n return _this;\n }\n\n KeyLoader.prototype.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n KeyLoader.prototype.onKeyLoading = function onKeyLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loader = this.loaders[type],\n decryptdata = frag.decryptdata,\n uri = decryptdata.uri;\n // if uri is different from previous one or if decrypt key not retrieved yet\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n\n if (loader) {\n logger[\"b\" /* logger */].warn('abort previous key loader for type:' + type);\n loader.abort();\n }\n frag.loader = this.loaders[type] = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n\n var loaderContext = void 0,\n loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderContext = { url: uri, frag: frag, responseType: 'arraybuffer' };\n loaderConfig = { timeout: config.fragLoadingTimeOut, maxRetry: config.fragLoadingMaxRetry, retryDelay: config.fragLoadingRetryDelay, maxRetryDelay: config.fragLoadingMaxRetryTimeout };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) };\n frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);\n } else if (this.decryptkey) {\n // we already loaded this key, return it\n decryptdata.key = this.decryptkey;\n this.hls.trigger(events[\"a\" /* default */].KEY_LOADED, { frag: frag });\n }\n };\n\n KeyLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var frag = context.frag;\n this.decryptkey = frag.decryptdata.key = new Uint8Array(response.data);\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].KEY_LOADED, { frag: frag });\n };\n\n KeyLoader.prototype.loaderror = function loaderror(response, context) {\n var frag = context.frag,\n loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR, fatal: false, frag: frag, response: response });\n };\n\n KeyLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var frag = context.frag,\n loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT, fatal: false, frag: frag });\n };\n\n return KeyLoader;\n}(event_handler);\n\n/* harmony default export */ var key_loader = (key_loader_KeyLoader);\n// CONCATENATED MODULE: ./src/utils/binary-search.js\nvar 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 {Array} list The array to search.\n * @param {Function} comparisonFunction\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 * @return {*} The object if it is found or null otherwise.\n */\n search: function search(list, comparisonFunction) {\n var minIndex = 0;\n var maxIndex = list.length - 1;\n var currentIndex = null;\n var currentElement = null;\n\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n\n var comparisonResult = comparisonFunction(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\n return null;\n }\n};\n\n/* harmony default export */ var binary_search = (BinarySearch);\n// CONCATENATED MODULE: ./src/helper/buffer-helper.js\n/**\n * Buffer Helper utils, providing methods dealing buffer length retrieval\n*/\n\nvar BufferHelper = {\n isBuffered: function isBuffered(media, position) {\n try {\n if (media) {\n var buffered = media.buffered;\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\n bufferInfo: function bufferInfo(media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = media.buffered,\n buffered = [],\n i;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({ start: vbuffered.start(i), end: vbuffered.end(i) });\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 { len: 0, start: pos, end: pos, nextStart: undefined };\n },\n\n bufferedInfo: function bufferedInfo(buffered, pos, maxHoleDuration) {\n var buffered2 = [],\n\n // bufferStart and bufferEnd are buffer boundaries around current video position\n bufferLen,\n bufferStart,\n bufferEnd,\n bufferStartNext,\n i;\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 // 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 (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 for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {\n var start = buffered2[i].start,\n 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 { len: bufferLen, start: bufferStart, end: bufferEnd, nextStart: bufferStartNext };\n }\n};\n\n/* harmony default export */ var buffer_helper = (BufferHelper);\n// EXTERNAL MODULE: ./src/demux/demuxer-inline.js + 12 modules\nvar demuxer_inline = __webpack_require__(7);\n\n// EXTERNAL MODULE: ./node_modules/events/events.js\nvar events_events = __webpack_require__(5);\nvar events_default = /*#__PURE__*/__webpack_require__.n(events_events);\n\n// EXTERNAL MODULE: ./node_modules/webworkify-webpack/index.js\nvar webworkify_webpack = __webpack_require__(9);\nvar webworkify_webpack_default = /*#__PURE__*/__webpack_require__.n(webworkify_webpack);\n\n// CONCATENATED MODULE: ./src/helper/mediasource-helper.js\n/**\n * MediaSource helper\n */\n\nfunction getMediaSource() {\n if (typeof window !== 'undefined') {\n return window.MediaSource || window.WebKitMediaSource;\n }\n}\n// CONCATENATED MODULE: ./src/demux/demuxer.js\nfunction demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\n\n\n\n\nvar demuxer_MediaSource = getMediaSource();\n\nvar demuxer_Demuxer = function () {\n function Demuxer(hls, id) {\n demuxer__classCallCheck(this, Demuxer);\n\n this.hls = hls;\n this.id = id;\n // observer setup\n var observer = this.observer = new events_default.a();\n var config = hls.config;\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function (ev, data) {\n data = data || {};\n data.frag = this.frag;\n data.id = this.id;\n hls.trigger(ev, data);\n }.bind(this);\n\n // forward events to main thread\n observer.on(events[\"a\" /* default */].FRAG_DECRYPTED, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_DATA, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSED, forwardMessage);\n observer.on(events[\"a\" /* default */].ERROR, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events[\"a\" /* default */].INIT_PTS_FOUND, forwardMessage);\n\n var typeSupported = {\n mp4: demuxer_MediaSource.isTypeSupported('video/mp4'),\n mpeg: demuxer_MediaSource.isTypeSupported('audio/mpeg'),\n mp3: demuxer_MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n };\n // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n var vendor = navigator.vendor;\n if (config.enableWorker && typeof Worker !== 'undefined') {\n logger[\"b\" /* logger */].log('demuxing in webworker');\n var w = void 0;\n try {\n w = this.w = webworkify_webpack_default()(/*require.resolve*/(10));\n this.onwmsg = this.onWorkerMessage.bind(this);\n w.addEventListener('message', this.onwmsg);\n w.onerror = function (event) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR, details: errors[\"a\" /* ErrorDetails */].INTERNAL_EXCEPTION, fatal: true, event: 'demuxerWorker', err: { message: event.message + ' (' + event.filename + ':' + event.lineno + ')' } });\n };\n w.postMessage({ cmd: 'init', typeSupported: typeSupported, vendor: vendor, id: id, config: JSON.stringify(config) });\n } catch (err) {\n logger[\"b\" /* logger */].error('error while initializing DemuxerWorker, fallback on DemuxerInline');\n if (w) {\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n URL.revokeObjectURL(w.objectURL);\n }\n this.demuxer = new demuxer_inline[\"a\" /* default */](observer, typeSupported, config, vendor);\n this.w = undefined;\n }\n } else {\n this.demuxer = new demuxer_inline[\"a\" /* default */](observer, typeSupported, config, vendor);\n }\n }\n\n Demuxer.prototype.destroy = function destroy() {\n var w = this.w;\n if (w) {\n w.removeEventListener('message', this.onwmsg);\n w.terminate();\n this.w = null;\n } else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n this.demuxer = null;\n }\n }\n var observer = this.observer;\n if (observer) {\n observer.removeAllListeners();\n this.observer = null;\n }\n };\n\n Demuxer.prototype.push = function push(data, initSegment, audioCodec, videoCodec, frag, duration, accurateTimeOffset, defaultInitPTS) {\n var w = this.w;\n var timeOffset = !isNaN(frag.startDTS) ? frag.startDTS : frag.start;\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && frag.cc === lastFrag.cc);\n var trackSwitch = !(lastFrag && frag.level === lastFrag.level);\n var nextSN = lastFrag && frag.sn === lastFrag.sn + 1;\n var contiguous = !trackSwitch && nextSN;\n if (discontinuity) {\n logger[\"b\" /* logger */].log(this.id + ':discontinuity detected');\n }\n if (trackSwitch) {\n logger[\"b\" /* logger */].log(this.id + ':switch detected');\n }\n this.frag = frag;\n if (w) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n w.postMessage({ cmd: 'demux', data: data, decryptdata: decryptdata, initSegment: initSegment, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, discontinuity: discontinuity, trackSwitch: trackSwitch, contiguous: contiguous, duration: duration, accurateTimeOffset: accurateTimeOffset, defaultInitPTS: defaultInitPTS }, data instanceof ArrayBuffer ? [data] : []);\n } else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n }\n };\n\n Demuxer.prototype.onWorkerMessage = function onWorkerMessage(ev) {\n var data = ev.data,\n hls = this.hls;\n //console.log('onWorkerMessage:' + data.event);\n switch (data.event) {\n case 'init':\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n URL.revokeObjectURL(this.w.objectURL);\n break;\n // special case for FRAG_PARSING_DATA: data1 and data2 are transferable objects\n case events[\"a\" /* default */].FRAG_PARSING_DATA:\n data.data.data1 = new Uint8Array(data.data1);\n if (data.data2) {\n data.data.data2 = new Uint8Array(data.data2);\n }\n /* falls through */\n default:\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 return Demuxer;\n}();\n\n/* harmony default export */ var demux_demuxer = (demuxer_Demuxer);\n// CONCATENATED MODULE: ./src/helper/level-helper.js\n/**\n * Level Helper class, providing methods dealing with playlist sliding and drift\n*/\n\n\n\nfunction updatePTS(fragments, fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],\n fragTo = fragments[toIdx],\n fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if (!isNaN(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS - fragFrom.start;\n if (fragFrom.duration < 0) {\n logger[\"b\" /* logger */].warn('negative duration computed for frag ' + fragFrom.sn + ',level ' + fragFrom.level + ', there should be some duration drift between playlist and fragment!');\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if (fragTo.duration < 0) {\n logger[\"b\" /* logger */].warn('negative duration computed for frag ' + fragTo.sn + ',level ' + fragTo.level + ', there should be some duration drift between playlist and fragment!');\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n } else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n}\n\nfunction updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n // update frag PTS/DTS\n var maxStartPTS = startPTS;\n if (!isNaN(frag.startPTS)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(frag.startPTS - startPTS);\n if (isNaN(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n } else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n maxStartPTS = Math.max(startPTS, frag.startPTS);\n startPTS = Math.min(startPTS, frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS, frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n\n var drift = startPTS - frag.start;\n frag.start = frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.endPTS = endPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n\n var sn = frag.sn;\n // exit if sn out of range\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n var fragIdx, fragments, i;\n fragIdx = sn - details.startSN;\n 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 happpen 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 updatePTS(fragments, i, i - 1);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updatePTS(fragments, i, i + 1);\n }\n details.PTSKnown = true;\n //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`);\n\n return drift;\n}\n\nfunction mergeDetails(oldDetails, newDetails) {\n var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN,\n end = Math.min(oldDetails.endSN, newDetails.endSN) - newDetails.startSN,\n delta = newDetails.startSN - oldDetails.startSN,\n oldfragments = oldDetails.fragments,\n newfragments = newDetails.fragments,\n ccOffset = 0,\n PTSFrag;\n\n // check if old/new playlists have fragments in common\n if (end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for (var i = start; i <= end; i++) {\n var oldFrag = oldfragments[delta + i],\n newFrag = newfragments[i];\n if (newFrag && oldFrag) {\n ccOffset = oldFrag.cc - newFrag.cc;\n if (!isNaN(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n newFrag.backtracked = oldFrag.backtracked;\n newFrag.dropped = oldFrag.dropped;\n PTSFrag = newFrag;\n }\n }\n }\n\n if (ccOffset) {\n logger[\"b\" /* logger */].log('discontinuity sliding from playlist, take drift into account');\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].cc += ccOffset;\n }\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 if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n}\n// CONCATENATED MODULE: ./src/utils/timeRanges.js\n/**\n * TimeRanges to string helper\n */\n\nvar TimeRanges = {\n toString: function toString(r) {\n var log = '',\n 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/* harmony default export */ var timeRanges = (TimeRanges);\n// CONCATENATED MODULE: ./src/utils/discontinuities.js\n\n\n\nfunction findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n\n for (var i = 0; i < fragments.length; i += 1) {\n var currentFrag = fragments[i];\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n\n return firstFrag;\n}\n\nfunction findFragWithCC(fragments, CC) {\n return binary_search.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\nfunction shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n var shouldAlign = false;\n if (lastLevel && lastLevel.details && details) {\n if (details.endCC > details.startCC || lastFrag && lastFrag.cc < details.startCC) {\n shouldAlign = true;\n }\n }\n return shouldAlign;\n}\n\n// Find the first frag in the previous level which matches the CC of the first frag of the new level\nfunction findDiscontinuousReferenceFrag(prevDetails, curDetails) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n\n if (!curFrags.length || !prevFrags.length) {\n logger[\"b\" /* logger */].log('No fragments to align');\n return;\n }\n\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n\n if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {\n logger[\"b\" /* logger */].log('No frag in previous level to align on');\n return;\n }\n\n return prevStartFrag;\n}\n\nfunction adjustPts(sliding, details) {\n details.fragments.forEach(function (frag) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n });\n details.PTSKnown = true;\n}\n\n// If a change in CC is detected, the PTS can no longer be relied upon\n// Attempt to align the level by using the last level - find the last frag matching the current CC and use it's PTS\n// as a reference\nfunction alignDiscontinuities(lastFrag, lastLevel, details) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n if (referenceFrag) {\n logger[\"b\" /* logger */].log('Adjusting PTS using last level due to CC increase within current level');\n adjustPts(referenceFrag.start, details);\n }\n }\n // try to align using programDateTime attribute (if available)\n if (details.PTSKnown === false && lastLevel && lastLevel.details) {\n // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n var lastPDT = lastLevel.details.programDateTime;\n var newPDT = details.programDateTime;\n // date diff is in ms. frag.start is in seconds\n var sliding = (newPDT - lastPDT) / 1000 + lastLevel.details.fragments[0].start;\n if (!isNaN(sliding)) {\n logger[\"b\" /* logger */].log('adjusting PTS using programDateTime delta, sliding:' + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}\n// CONCATENATED MODULE: ./src/controller/stream-controller.js\nvar stream_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\nvar 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_LEVEL: 'WAITING_LEVEL',\n PARSING: 'PARSING',\n PARSED: 'PARSED',\n BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR'\n};\n\nvar stream_controller_StreamController = function (_EventHandler) {\n stream_controller__inherits(StreamController, _EventHandler);\n\n function StreamController(hls) {\n stream_controller__classCallCheck(this, StreamController);\n\n var _this = stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].LEVEL_LOADED, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_LOAD_EMERGENCY_ABORTED, events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, events[\"a\" /* default */].FRAG_PARSING_DATA, events[\"a\" /* default */].FRAG_PARSED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, events[\"a\" /* default */].BUFFER_CREATED, events[\"a\" /* default */].BUFFER_APPENDED, events[\"a\" /* default */].BUFFER_FLUSHED));\n\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this.ticks = 0;\n _this._state = State.STOPPED;\n _this.ontick = _this.tick.bind(_this);\n return _this;\n }\n\n StreamController.prototype.destroy = function destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n event_handler.prototype.destroy.call(this);\n this.state = State.STOPPED;\n };\n\n StreamController.prototype.startLoad = function startLoad(startPosition) {\n if (this.levels) {\n var lastCurrentTime = this.lastCurrentTime,\n hls = this.hls;\n this.stopLoad();\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.level = -1;\n this.fragLoadError = 0;\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls.startLevel;\n if (startLevel === -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 }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n }\n // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"b\" /* logger */].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\n StreamController.prototype.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = State.STOPPED;\n this.forceStartLoad = false;\n };\n\n StreamController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n StreamController.prototype.doTick = function doTick() {\n switch (this.state) {\n case State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n break;\n case State.BUFFER_FLUSHING:\n // in buffer flushing state, reset fragLoadError counter\n this.fragLoadError = 0;\n break;\n case State.IDLE:\n this._doTickIdle();\n break;\n case State.WAITING_LEVEL:\n var level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = State.IDLE;\n }\n break;\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = 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.seeking) {\n logger[\"b\" /* logger */].log('mediaController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n break;\n case State.ERROR:\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n };\n\n // Ironically the \"idle\" state is the on we do the most logic in it seems ....\n // NOTE: Maybe we could rather schedule a check for buffer length after half of the currently\n // played segment, or on pause/play/seek instead of naively checking every 100ms?\n\n\n StreamController.prototype._doTickIdle = function _doTickIdle() {\n var hls = this.hls,\n config = hls.config,\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 disable\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 (this.levelLastLoaded === undefined || !media && (this.startFragRequested || !config.startFragPrefetch)) {\n return;\n }\n\n // if we have not yet loaded any fragment, start loading from start position\n var pos = void 0;\n if (this.loadedmetadata) {\n pos = media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n }\n // determine next load level\n var level = hls.nextLoadLevel,\n levelInfo = this.levels[level];\n\n if (!levelInfo) {\n return;\n }\n\n var levelBitrate = levelInfo.bitrate,\n maxBufLen = void 0;\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 if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n\n // determine next candidate fragment to be loaded, based on current position and end of buffer position\n // ensure up to `config.maxMaxBufferLength` of buffer upfront\n\n var bufferInfo = buffer_helper.bufferInfo(this.mediaBuffer ? this.mediaBuffer : media, pos, config.maxBufferHole),\n bufferLen = bufferInfo.len;\n // Stay idle if we are still with buffer margins\n if (bufferLen >= maxBufLen) {\n return;\n }\n\n // if buffer length is less than maxBufLen try to load a new fragment ...\n logger[\"b\" /* logger */].trace('buffer length of ' + bufferLen.toFixed(3) + ' is below max of ' + maxBufLen.toFixed(3) + '. checking for more payload ...');\n\n // set next load level : this will trigger a playlist load if needed\n this.level = hls.nextLoadLevel = level;\n\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 === undefined || levelDetails.live === true && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n return;\n }\n\n // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n // dont switch to ENDED if we need to backtrack last fragment\n var fragPrevious = this.fragPrevious;\n if (!levelDetails.live && fragPrevious && !fragPrevious.backtracked && fragPrevious.sn === levelDetails.endSN && !bufferInfo.nextStart) {\n // fragPrevious is last fragment. retrieve level duration using last frag start offset + duration\n // real duration might be lower than initial duration if there are drifts between real frag duration and playlist signaling\n var duration = Math.min(media.duration, fragPrevious.start + fragPrevious.duration);\n // if everything (almost) til the end is buffered, let's signal eos\n // we don't compare exactly media.duration === bufferInfo.end as there could be some subtle media duration difference (audio/video offsets...)\n // tolerate up to one frag duration to cope with these cases.\n // also cope with almost zero last frag duration (max last frag duration with 200ms) refer to https://github.com/video-dev/hls.js/pull/657\n if (duration - Math.max(bufferInfo.end, fragPrevious.start) <= Math.max(0.2, fragPrevious.duration)) {\n // Finalize the media stream\n var data = {};\n if (this.altAudio) {\n data.type = 'video';\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_EOS, data);\n this.state = State.ENDED;\n return;\n }\n }\n\n // if we have the levelDetails for the selected variant, lets continue enrichen our stream (load keys/fragments or trigger EOS, etc..)\n this._fetchPayloadOrEos(pos, bufferInfo, levelDetails);\n };\n\n StreamController.prototype._fetchPayloadOrEos = function _fetchPayloadOrEos(pos, bufferInfo, levelDetails) {\n var fragPrevious = this.fragPrevious,\n level = this.level,\n fragments = levelDetails.fragments,\n fragLen = fragments.length;\n\n // empty playlist\n if (fragLen === 0) {\n return;\n }\n\n // find fragment index, contiguous with end of buffer position\n var start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n bufferEnd = bufferInfo.end,\n frag = void 0;\n\n if (levelDetails.initSegment && !levelDetails.initSegment.data) {\n frag = levelDetails.initSegment;\n } else {\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n var initialLiveManifestSize = this.config.initialLiveManifestSize;\n if (fragLen < initialLiveManifestSize) {\n logger[\"b\" /* logger */].warn('Can not start playback of a level, reason: not enough fragments ' + fragLen + ' < ' + initialLiveManifestSize);\n return;\n }\n\n frag = this._ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen);\n // if it explicitely returns null don't load any fragment and exit function now\n if (frag === null) {\n return;\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n }\n if (!frag) {\n frag = this._findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails);\n }\n if (frag) {\n this._loadFragmentOrKey(frag, level, levelDetails, pos, bufferEnd);\n }\n return;\n };\n\n StreamController.prototype._ensureFragmentAtLivePoint = function _ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen) {\n var config = this.hls.config,\n media = this.media;\n\n var frag = void 0;\n\n // check if requested position is within seekable boundaries :\n //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n\n if (bufferEnd < Math.max(start - config.maxFragLookUpTolerance, end - maxLatency)) {\n var liveSyncPosition = this.liveSyncPosition = this.computeLivePosition(start, levelDetails);\n logger[\"b\" /* logger */].log('buffer end: ' + bufferEnd.toFixed(3) + ' is located too far from the end of live sliding playlist, reset currentTime to : ' + liveSyncPosition.toFixed(3));\n bufferEnd = liveSyncPosition;\n if (media && media.readyState && media.duration > liveSyncPosition) {\n media.currentTime = liveSyncPosition;\n }\n this.nextLoadPosition = liveSyncPosition;\n }\n\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n // don't return null in case media not loaded yet (readystate === 0)\n if (levelDetails.PTSKnown && bufferEnd > end && media && media.readyState) {\n return null;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n logger[\"b\" /* logger */].log('live playlist, switching playlist, load frag with next SN: ' + frag.sn);\n }\n }\n // next frag SN not available (or not with same continuity counter)\n // look for a frag sharing the same CC\n if (!frag) {\n frag = binary_search.search(fragments, function (frag) {\n return fragPrevious.cc - frag.cc;\n });\n if (frag) {\n logger[\"b\" /* logger */].log('live playlist, switching playlist, load frag with same CC: ' + frag.sn);\n }\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger[\"b\" /* logger */].log('live playlist, switching playlist, unknown, load middle frag : ' + frag.sn);\n }\n }\n return frag;\n };\n\n StreamController.prototype._findFragment = function _findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails) {\n var config = this.hls.config;\n var frag = void 0;\n var foundFrag = void 0;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n var fragmentWithinToleranceTest = function fragmentWithinToleranceTest(candidate) {\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 } // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n return -1;\n }\n return 0;\n };\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, fragmentWithinToleranceTest);\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n if (foundFrag) {\n frag = foundFrag;\n var curSNIdx = frag.sn - levelDetails.startSN;\n var sameLevel = fragPrevious && frag.level === fragPrevious.level;\n var prevFrag = fragments[curSNIdx - 1];\n var nextFrag = fragments[curSNIdx + 1];\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.sn === fragPrevious.sn) {\n if (sameLevel && !frag.backtracked) {\n if (frag.sn < levelDetails.endSN) {\n var deltaPTS = fragPrevious.deltaPTS;\n // if there is a significant delta between audio and video, larger than max allowed hole,\n // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped)\n // let's try to load previous fragment again to get last keyframe\n // then we will reload again current fragment (that way we should be able to fill the buffer hole ...)\n if (deltaPTS && deltaPTS > config.maxBufferHole && fragPrevious.dropped && curSNIdx) {\n frag = prevFrag;\n logger[\"b\" /* logger */].warn('SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this');\n // decrement previous frag load counter to avoid frag loop loading error when next fragment will get reloaded\n fragPrevious.loadCounter--;\n } else {\n frag = nextFrag;\n logger[\"b\" /* logger */].log('SN just loaded, load next one: ' + frag.sn);\n }\n } else {\n frag = null;\n }\n } else if (frag.backtracked) {\n // Only backtrack a max of 1 consecutive fragment to prevent sliding back too far when little or no frags start with keyframes\n if (nextFrag && nextFrag.backtracked) {\n logger[\"b\" /* logger */].warn('Already backtracked from fragment ' + nextFrag.sn + ', will not backtrack to fragment ' + frag.sn + '. Loading fragment ' + nextFrag.sn);\n frag = nextFrag;\n } else {\n // If a fragment has dropped frames and it's in a same level/sequence, load the previous fragment to try and find the keyframe\n // Reset the dropped count now since it won't be reset until we parse the fragment again, which prevents infinite backtracking on the same segment\n logger[\"b\" /* logger */].warn('Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe');\n frag.dropped = 0;\n if (prevFrag) {\n if (prevFrag.loadCounter) {\n prevFrag.loadCounter--;\n }\n frag = prevFrag;\n frag.backtracked = true;\n } else if (curSNIdx) {\n // can't backtrack on very first fragment\n frag = null;\n }\n }\n }\n }\n }\n return frag;\n };\n\n StreamController.prototype._loadFragmentOrKey = function _loadFragmentOrKey(frag, level, levelDetails, pos, bufferEnd) {\n var hls = this.hls,\n config = hls.config;\n\n //logger.log('loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level);\n this.state = State.KEY_LOADING;\n hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n logger[\"b\" /* logger */].log('Loading ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level + ', currentTime:' + pos.toFixed(3) + ',bufferEnd:' + bufferEnd.toFixed(3));\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n var maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag });\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n frag.autoLevel = hls.autoLevelEnabled;\n frag.bitrateTest = this.bitrateTest;\n\n this.fragCurrent = frag;\n this.startFragRequested = true;\n // Don't update nextLoadPosition for fragments which are not buffered\n if (!isNaN(frag.sn) && !frag.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n // lazy demuxer init, as this could take some time ... do it during frag loading\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(hls, 'main');\n }\n this.state = State.FRAG_LOADING;\n return;\n }\n };\n\n StreamController.prototype.getBufferedFrag = function getBufferedFrag(position) {\n return binary_search.search(this._bufferedFrags, function (frag) {\n if (position < frag.startPTS) {\n return -1;\n } else if (position > frag.endPTS) {\n return 1;\n }\n return 0;\n });\n };\n\n StreamController.prototype.followingBufferedFrag = function followingBufferedFrag(frag) {\n if (frag) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferedFrag(frag.endPTS + 0.5);\n }\n return null;\n };\n\n StreamController.prototype._checkFragmentChanged = function _checkFragmentChanged() {\n var fragPlayingCurrent,\n currentTime,\n video = this.media;\n if (video && video.readyState && video.seeking === false) {\n 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 if (currentTime > video.playbackRate * this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (buffer_helper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getBufferedFrag(currentTime);\n } else if (buffer_helper.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.getBufferedFrag(currentTime + 0.1);\n }\n if (fragPlayingCurrent) {\n var fragPlaying = fragPlayingCurrent;\n if (fragPlaying !== this.fragPlaying) {\n this.hls.trigger(events[\"a\" /* default */].FRAG_CHANGED, { frag: fragPlaying });\n var fragPlayingLevel = fragPlaying.level;\n if (!this.fragPlaying || this.fragPlaying.level !== fragPlayingLevel) {\n this.hls.trigger(events[\"a\" /* default */].LEVEL_SWITCHED, { level: fragPlayingLevel });\n }\n this.fragPlaying = fragPlaying;\n }\n }\n }\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\n\n StreamController.prototype.immediateLevelSwitch = function immediateLevelSwitch() {\n logger[\"b\" /* logger */].log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n var media = this.media,\n previouslyPaused = void 0;\n if (media) {\n previouslyPaused = media.paused;\n media.pause();\n } else {\n // don't restart playback after instant level switch in case media not attached\n previouslyPaused = true;\n }\n this.previouslyPaused = previouslyPaused;\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n };\n\n /*\n on immediate level switch end, after new fragment has been buffered :\n - nudge video decoder by slightly adjusting video currentTime (if currentTime buffered)\n - resume the playback if needed\n */\n\n\n StreamController.prototype.immediateLevelSwitchEnd = function immediateLevelSwitchEnd() {\n var media = this.media;\n if (media && media.buffered.length) {\n this.immediateSwitch = false;\n if (buffer_helper.isBuffered(media, media.currentTime)) {\n // only nudge if currentTime is buffered\n media.currentTime -= 0.0001;\n }\n if (!this.previouslyPaused) {\n media.play();\n }\n }\n };\n\n StreamController.prototype.nextLevelSwitch = function nextLevelSwitch() {\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 var media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media && media.readyState) {\n var fetchdelay = void 0,\n fragPlayingCurrent = void 0,\n nextBufferedFrag = void 0;\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n fragPlayingCurrent = this.getBufferedFrag(media.currentTime);\n if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 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.startPTS - 1);\n }\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,\n nextLevel = this.levels[nextLevelId],\n fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n //logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextBufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n if (nextBufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n nextBufferedFrag = this.followingBufferedFrag(nextBufferedFrag);\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // start flush position is the start PTS of next buffered frag.\n // we use frag.naxStartPTS which is max(audio startPTS, video startPTS).\n // in case there is a small PTS Delta between audio and video, using maxStartPTS avoids flushing last samples from current fragment\n this.flushMainBuffer(nextBufferedFrag.maxStartPTS, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n\n StreamController.prototype.flushMainBuffer = function flushMainBuffer(startOffset, endOffset) {\n this.state = State.BUFFER_FLUSHING;\n var flushScope = { startOffset: startOffset, endOffset: endOffset };\n // if alternate audio tracks are used, only flush video, otherwise flush everything\n if (this.altAudio) {\n flushScope.type = 'video';\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, flushScope);\n };\n\n StreamController.prototype.onMediaAttached = function onMediaAttached(data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n if (this.levels && config.autoStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n StreamController.prototype.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger[\"b\" /* logger */].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var levels = this.levels;\n if (levels) {\n // reset fragment load counter\n levels.forEach(function (level) {\n if (level.details) {\n level.details.fragments.forEach(function (fragment) {\n fragment.loadCounter = undefined;\n fragment.backtracked = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n StreamController.prototype.onMediaSeeking = function onMediaSeeking() {\n var media = this.media,\n currentTime = media ? media.currentTime : undefined,\n config = this.config;\n if (!isNaN(currentTime)) {\n logger[\"b\" /* logger */].log('media seeking to ' + currentTime.toFixed(3));\n }\n var mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media;\n var bufferInfo = buffer_helper.bufferInfo(mediaBuffer, currentTime, this.config.maxBufferHole);\n if (this.state === State.FRAG_LOADING) {\n var fragCurrent = this.fragCurrent;\n // check if we are seeking to a unbuffered area AND if frag loading is in progress\n if (bufferInfo.len === 0 && fragCurrent) {\n var tolerance = config.maxFragLookUpTolerance,\n fragStartOffset = fragCurrent.start - tolerance,\n fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance;\n // check if we seek position will be out of currently loaded frag range : if out cancel frag load, if in, don't do anything\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (fragCurrent.loader) {\n logger[\"b\" /* logger */].log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n } else {\n logger[\"b\" /* logger */].log('seeking outside of buffer but within currently loaded fragment range');\n }\n }\n } else if (this.state === State.ENDED) {\n // if seeking to unbuffered area, clean up fragPrevious\n if (bufferInfo.len === 0) {\n this.fragPrevious = 0;\n }\n // switch to IDLE state to check for potential new fragment\n this.state = State.IDLE;\n }\n if (media) {\n this.lastCurrentTime = currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.state !== State.FRAG_LOADING && this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * config.fragLoadingLoopThreshold;\n }\n // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n if (!this.loadedmetadata) {\n this.nextLoadPosition = this.startPosition = currentTime;\n }\n // tick to speed up processing\n this.tick();\n };\n\n StreamController.prototype.onMediaSeeked = function onMediaSeeked() {\n var media = this.media,\n currentTime = media ? media.currentTime : undefined;\n if (!isNaN(currentTime)) {\n logger[\"b\" /* logger */].log('media seeked to ' + currentTime.toFixed(3));\n }\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n };\n\n StreamController.prototype.onMediaEnded = function onMediaEnded() {\n logger[\"b\" /* logger */].log('media ended');\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n StreamController.prototype.onManifestLoading = function onManifestLoading() {\n // reset buffer on manifest loading\n logger[\"b\" /* logger */].log('trigger BUFFER_RESET');\n this.hls.trigger(events[\"a\" /* default */].BUFFER_RESET);\n this._bufferedFrags = [];\n this.stalled = false;\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n StreamController.prototype.onManifestParsed = function onManifestParsed(data) {\n var aac = false,\n heaac = false,\n codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = aac && heaac;\n if (this.audioCodecSwitch) {\n logger[\"b\" /* logger */].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 var config = this.config;\n if (config.autoStartLoad || this.forceStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n StreamController.prototype.onLevelLoaded = function onLevelLoaded(data) {\n var newDetails = data.details;\n var newLevelId = data.level;\n var lastLevel = this.levels[this.levelLastLoaded];\n var curLevel = this.levels[newLevelId];\n var duration = newDetails.totalduration;\n var sliding = 0;\n\n logger[\"b\" /* logger */].log('level ' + newLevelId + ' loaded [' + newDetails.startSN + ',' + newDetails.endSN + '],duration:' + duration);\n\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown && !isNaN(sliding)) {\n logger[\"b\" /* logger */].log('live playlist sliding:' + sliding.toFixed(3));\n } else {\n logger[\"b\" /* logger */].log('live playlist - outdated PTS, unknown sliding');\n alignDiscontinuities(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n logger[\"b\" /* logger */].log('live playlist - first load, unknown sliding');\n newDetails.PTSKnown = false;\n alignDiscontinuities(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(events[\"a\" /* default */].LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n\n if (this.startFragRequested === false) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1 || this.lastCurrentTime === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (!isNaN(startTimeOffset)) {\n if (startTimeOffset < 0) {\n logger[\"b\" /* logger */].log('negative start time offset ' + startTimeOffset + ', count from end of last fragment');\n startTimeOffset = sliding + duration + startTimeOffset;\n }\n logger[\"b\" /* logger */].log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"b\" /* logger */].log('configure startPosition to ' + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n this.lastCurrentTime = this.startPosition;\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n }\n //trigger handler right now\n this.tick();\n };\n\n StreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n StreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'main' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var stats = data.stats,\n currentLevel = this.levels[fragCurrent.level],\n details = currentLevel.details;\n logger[\"b\" /* logger */].log('Loaded ' + fragCurrent.sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + fragCurrent.level);\n // reset frag bitrate test in any case after frag loaded event\n this.bitrateTest = false;\n this.stats = stats;\n // if this frag was loaded to perform a bitrate test AND if hls.nextLoadLevel is greater than 0\n // then this means that we should be able to load a fragment at a higher quality level\n if (fragLoaded.bitrateTest === true && this.hls.nextLoadLevel) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.startFragRequested = false;\n stats.tparsed = stats.tbuffered = performance.now();\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n } else if (fragLoaded.sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n } else {\n this.state = State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n var duration = details.totalduration,\n level = fragCurrent.level,\n sn = fragCurrent.sn,\n audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n if (this.audioCodecSwap) {\n logger[\"b\" /* logger */].log('swapping playlist audio codec');\n if (audioCodec === undefined) {\n audioCodec = this.lastAudioCodec;\n }\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 }\n this.pendingBuffering = true;\n this.appended = false;\n logger[\"b\" /* logger */].log('Parsing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + level + ', cc ' + fragCurrent.cc);\n var demuxer = this.demuxer;\n if (!demuxer) {\n demuxer = this.demuxer = new demux_demuxer(this.hls, 'main');\n }\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live) and if media is not seeking (this is to overcome potential timestamp drifts between playlists and fragments)\n var media = this.media;\n var mediaSeeking = media && media.seeking;\n var accurateTimeOffset = !mediaSeeking && (details.PTSKnown || !details.live);\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n demuxer.push(data.payload, initSegmentData, audioCodec, currentLevel.videoCodec, fragCurrent, duration, accurateTimeOffset, undefined);\n }\n }\n this.fragLoadError = 0;\n };\n\n StreamController.prototype.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n trackName,\n track;\n\n // if audio track is expected to come from audio stream controller, discard any coming from main\n if (tracks.audio && this.altAudio) {\n delete tracks.audio;\n }\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n if (audioCodec && this.audioCodecSwap) {\n logger[\"b\" /* logger */].log('swapping playlist 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 // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if (track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if (ua.indexOf('android') !== -1 && track.container !== 'audio/mpeg') {\n // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n logger[\"b\" /* logger */].log('Android: force audio codec to ' + audioCodec);\n }\n track.levelCodec = audioCodec;\n track.id = data.id;\n }\n track = tracks.video;\n if (track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n track.id = data.id;\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CODECS, tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger[\"b\" /* logger */].log('main track:' + trackName + ',container:' + track.container + ',codecs[level/parsed]=[' + track.levelCodec + '/' + track.codec + ']');\n var initSegment = track.initSegment;\n if (initSegment) {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, { type: trackName, data: initSegment, parent: 'main', content: 'initSegment' });\n }\n }\n //trigger handler right now\n this.tick();\n }\n };\n\n StreamController.prototype.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && !(data.type === 'audio' && this.altAudio) && // filter out main audio if audio track is loaded through audio stream controller\n this.state === State.PARSING) {\n var level = this.levels[this.level],\n frag = fragCurrent;\n if (isNaN(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n logger[\"b\" /* logger */].log('Parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb + ',dropped:' + (data.dropped || 0));\n\n // Detect gaps in a fragment and try to fix it by finding a keyframe in the previous fragment (see _findFragments)\n if (data.type === 'video') {\n frag.dropped = data.dropped;\n if (frag.dropped) {\n if (!frag.backtracked) {\n var levelDetails = level.details;\n if (levelDetails && frag.sn === levelDetails.startSN) {\n logger[\"b\" /* logger */].warn('missing video frame(s) on first frag, appending with gap');\n } else {\n logger[\"b\" /* logger */].warn('missing video frame(s), backtracking fragment');\n // Return back to the IDLE state without appending to buffer\n // Causes findFragments to backtrack a segment and find the keyframe\n // Audio fragments arriving before video sets the nextLoadPosition, causing _findFragments to skip the backtracked fragment\n frag.backtracked = true;\n this.nextLoadPosition = data.startPTS;\n this.state = State.IDLE;\n this.fragPrevious = frag;\n this.tick();\n return;\n }\n } else {\n logger[\"b\" /* logger */].warn('Already backtracked on this fragment, appending with the gap');\n }\n } else {\n // Only reset the backtracked flag if we've loaded the frag without any dropped frames\n frag.backtracked = false;\n }\n }\n\n var drift = updateFragPTSDTS(level.details, frag, data.startPTS, data.endPTS, data.startDTS, data.endDTS),\n hls = this.hls;\n hls.trigger(events[\"a\" /* default */].LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift, type: data.type, start: data.startPTS, end: data.endPTS });\n\n // has remuxer dropped video frames located before first keyframe ?\n [data.data1, data.data2].forEach(function (buffer) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (buffer && buffer.length && _this2.state === State.PARSING) {\n _this2.appended = true;\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, { type: data.type, data: buffer, parent: 'main', content: 'data' });\n }\n });\n //trigger handler right now\n this.tick();\n }\n };\n\n StreamController.prototype.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = State.PARSED;\n this._checkAppendedParsed();\n }\n };\n\n StreamController.prototype.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url,\n trackId = data.id;\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 logger[\"b\" /* logger */].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.loader) {\n logger[\"b\" /* logger */].log('switching to main audio track, cancel main fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // destroy demuxer to force init segment generation (following audio switch)\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n }\n var hls = this.hls;\n // switching to main audio, flush all audio and trigger track switched\n hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n this.altAudio = false;\n }\n };\n\n StreamController.prototype.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var trackId = data.id,\n 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 logger[\"b\" /* logger */].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\n StreamController.prototype.onBufferCreated = function onBufferCreated(data) {\n var tracks = data.tracks,\n mediaTrack = void 0,\n name = void 0,\n 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 this.videoBuffer = tracks[type].buffer;\n }\n } else {\n alternate = true;\n }\n }\n if (alternate && mediaTrack) {\n logger[\"b\" /* logger */].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\n StreamController.prototype.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'main') {\n var state = this.state;\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n this._checkAppendedParsed();\n }\n }\n };\n\n StreamController.prototype._checkAppendedParsed = function _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent;\n if (frag) {\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"b\" /* logger */].log('main buffered : ' + timeRanges.toString(media.buffered));\n // filter fragments potentially evicted from buffer. this is to avoid memleak on live streams\n var bufferedFrags = this._bufferedFrags.filter(function (frag) {\n return buffer_helper.isBuffered(media, (frag.startPTS + frag.endPTS) / 2);\n });\n // push new range\n bufferedFrags.push(frag);\n // sort frags, as we use BinarySearch for lookup in getBufferedFrag ...\n this._bufferedFrags = bufferedFrags.sort(function (a, b) {\n return a.startPTS - b.startPTS;\n });\n this.fragPrevious = frag;\n var stats = this.stats;\n stats.tbuffered = performance.now();\n // we should get rid of this.fragLastKbps\n this.fragLastKbps = Math.round(8 * stats.total / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: frag, id: 'main' });\n this.state = State.IDLE;\n }\n this.tick();\n }\n };\n\n StreamController.prototype.onError = function onError(data) {\n var frag = data.frag || this.fragCurrent;\n // don't handle frag error not related to main fragment\n if (frag && frag.type !== 'main') {\n return;\n }\n // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n var mediaBuffered = !!this.media && buffer_helper.isBuffered(this.media, this.media.currentTime) && buffer_helper.isBuffered(this.media, this.media.currentTime + 0.5);\n\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n if (!data.fatal) {\n // keep retrying until the limit will be reached\n if (this.fragLoadError + 1 <= this.config.fragLoadingMaxRetry) {\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, this.fragLoadError) * this.config.fragLoadingRetryDelay, this.config.fragLoadingMaxRetryTimeout);\n // reset load counter to avoid frag loop loading error\n frag.loadCounter = 0;\n logger[\"b\" /* logger */].warn('mediaController: frag loading failed, retry in ' + delay + ' ms');\n this.retryDate = performance.now() + delay;\n // retry loading state\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.fragLoadError++;\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"b\" /* logger */].error('mediaController: ' + data.details + ' reaches max retry, redispatch as fatal ...');\n // switch error to fatal\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n if (!data.fatal) {\n // if buffer is not empty\n if (mediaBuffered) {\n // try to reduce max buffer length : rationale is that we could get\n // frag loop loading error because of buffer eviction\n this._reduceMaxBufferLength(frag.duration);\n this.state = State.IDLE;\n } else {\n // buffer empty. report as fatal if in manual mode or if lowest level.\n // level controller takes care of emergency switch down logic\n if (!frag.autoLevel || frag.level === 0) {\n // switch error to fatal\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT:\n if (this.state !== State.ERROR) {\n if (data.fatal) {\n // if fatal error, stop processing\n this.state = State.ERROR;\n logger[\"b\" /* logger */].warn('streamController: ' + data.details + ',switch to ' + this.state + ' state ...');\n } else {\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) {\n this.state = State.IDLE;\n }\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'main' && (this.state === State.PARSING || this.state === State.PARSED)) {\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n this._reduceMaxBufferLength(this.config.maxBufferLength);\n this.state = State.IDLE;\n } else {\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 buffer to recover\n logger[\"b\" /* logger */].warn('buffer full error also media.currentTime is not buffered, flush everything');\n this.fragCurrent = null;\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n }\n break;\n default:\n break;\n }\n };\n\n StreamController.prototype._reduceMaxBufferLength = function _reduceMaxBufferLength(minLength) {\n var config = this.config;\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger[\"b\" /* logger */].warn('main:reduce max buffer length to ' + config.maxMaxBufferLength + 's');\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * config.fragLoadingLoopThreshold;\n }\n }\n };\n\n StreamController.prototype._checkBuffer = function _checkBuffer() {\n var media = this.media,\n config = this.config;\n // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek\n if (media && media.readyState) {\n var currentTime = media.currentTime,\n mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media,\n buffered = mediaBuffer.buffered;\n // adjust currentTime to start position on loaded metadata\n if (!this.loadedmetadata && buffered.length) {\n this.loadedmetadata = true;\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 var startPosition = media.seeking ? currentTime : this.startPosition,\n startPositionBuffered = buffer_helper.isBuffered(mediaBuffer, startPosition),\n firstbufferedPosition = buffered.start(0),\n startNotBufferedButClose = !startPositionBuffered && Math.abs(startPosition - firstbufferedPosition) < config.maxSeekHole;\n // if currentTime not matching with expected startPosition or startPosition not buffered but close to first buffered\n if (currentTime !== startPosition || startNotBufferedButClose) {\n logger[\"b\" /* logger */].log('target start position:' + startPosition);\n // if startPosition not buffered, let's seek to buffered.start(0)\n if (startNotBufferedButClose) {\n startPosition = firstbufferedPosition;\n logger[\"b\" /* logger */].log('target start position not buffered, seek to buffered.start(0) ' + startPosition);\n }\n logger[\"b\" /* logger */].log('adjust currentTime from ' + currentTime + ' to ' + startPosition);\n media.currentTime = startPosition;\n }\n } else if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n } else {\n var bufferInfo = buffer_helper.bufferInfo(media, currentTime, 0),\n expectedPlaying = !(media.paused || // not playing when media is paused\n media.ended || // not playing when media is ended\n media.buffered.length === 0),\n // not playing if nothing buffered\n jumpThreshold = 0.5,\n // tolerance needed as some browsers stalls playback before reaching buffered range end\n playheadMoving = currentTime !== this.lastCurrentTime;\n\n if (playheadMoving) {\n // played moving, but was previously stalled => now not stuck anymore\n if (this.stallReported) {\n logger[\"b\" /* logger */].warn('playback not stuck anymore @' + currentTime + ', after ' + Math.round(performance.now() - this.stalled) + 'ms');\n this.stallReported = false;\n }\n this.stalled = undefined;\n this.nudgeRetry = 0;\n } else {\n // playhead not moving\n if (expectedPlaying) {\n // playhead not moving BUT media expected to play\n var tnow = performance.now();\n var hls = this.hls;\n if (!this.stalled) {\n // stall just detected, store current time\n this.stalled = tnow;\n this.stallReported = false;\n } else {\n // playback already stalled, check stalling duration\n // if stalling for more than a given threshold, let's try to recover\n var stalledDuration = tnow - this.stalled;\n var bufferLen = bufferInfo.len;\n var nudgeRetry = this.nudgeRetry || 0;\n // have we reached stall deadline ?\n if (bufferLen <= jumpThreshold && stalledDuration > config.lowBufferWatchdogPeriod * 1000) {\n // report stalled error once\n if (!this.stallReported) {\n this.stallReported = true;\n logger[\"b\" /* logger */].warn('playback stalling in low buffer @' + currentTime);\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: false, buffer: bufferLen });\n }\n // if buffer len is below threshold, try to jump to start of next buffer range if close\n // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)\n var nextBufferStart = bufferInfo.nextStart,\n delta = nextBufferStart - currentTime;\n if (nextBufferStart && delta < config.maxSeekHole && delta > 0) {\n this.nudgeRetry = ++nudgeRetry;\n var nudgeOffset = nudgeRetry * config.nudgeOffset;\n // next buffer is close ! adjust currentTime to nextBufferStart\n // this will ensure effective video decoding\n logger[\"b\" /* logger */].log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart + ' + nudge ' + nudgeOffset);\n media.currentTime = nextBufferStart + nudgeOffset;\n // reset stalled so to rearm watchdog timer\n this.stalled = undefined;\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_SEEK_OVER_HOLE, fatal: false, hole: nextBufferStart + nudgeOffset - currentTime });\n }\n } else if (bufferLen > jumpThreshold && stalledDuration > config.highBufferWatchdogPeriod * 1000) {\n // report stalled error once\n if (!this.stallReported) {\n this.stallReported = true;\n logger[\"b\" /* logger */].warn('playback stalling in high buffer @' + currentTime);\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: false, buffer: bufferLen });\n }\n // reset stalled so to rearm watchdog timer\n this.stalled = undefined;\n this.nudgeRetry = ++nudgeRetry;\n if (nudgeRetry < config.nudgeMaxRetry) {\n var _currentTime = media.currentTime;\n var targetTime = _currentTime + nudgeRetry * config.nudgeOffset;\n logger[\"b\" /* logger */].log('adjust currentTime from ' + _currentTime + ' to ' + targetTime);\n // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n media.currentTime = targetTime;\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_NUDGE_ON_STALL, fatal: false });\n } else {\n logger[\"b\" /* logger */].error('still stuck in high buffer @' + currentTime + ' after ' + config.nudgeMaxRetry + ', raise fatal error');\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: true });\n }\n }\n }\n }\n }\n }\n }\n };\n\n StreamController.prototype.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.tick();\n };\n\n StreamController.prototype.onBufferFlushed = function onBufferFlushed() {\n /* after successful buffer flushing, filter flushed fragments from bufferedFrags\n use mediaBuffered instead of media (so that we will check against video.buffered ranges in case of alt audio track)\n */\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n this._bufferedFrags = this._bufferedFrags.filter(function (frag) {\n return buffer_helper.isBuffered(media, (frag.startPTS + frag.endPTS) / 2);\n });\n\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n };\n\n StreamController.prototype.swapAudioCodec = function swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n };\n\n StreamController.prototype.computeLivePosition = function computeLivePosition(sliding, levelDetails) {\n var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * levelDetails.targetduration;\n return sliding + Math.max(0, levelDetails.totalduration - targetLatency);\n };\n\n stream_controller__createClass(StreamController, [{\n key: 'state',\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"b\" /* logger */].log('main stream:' + previousState + '->' + nextState);\n this.hls.trigger(events[\"a\" /* default */].STREAM_STATE_TRANSITION, { previousState: previousState, nextState: nextState });\n }\n },\n get: function get() {\n return this._state;\n }\n }, {\n key: 'currentLevel',\n get: function get() {\n var media = this.media;\n if (media) {\n var frag = this.getBufferedFrag(media.currentTime);\n if (frag) {\n return frag.level;\n }\n }\n return -1;\n }\n }, {\n key: 'nextBufferedFrag',\n get: function get() {\n var media = this.media;\n if (media) {\n // first get end range of current fragment\n return this.followingBufferedFrag(this.getBufferedFrag(media.currentTime));\n } else {\n return null;\n }\n }\n }, {\n key: 'nextLevel',\n get: function get() {\n var frag = this.nextBufferedFrag;\n if (frag) {\n return frag.level;\n } else {\n return -1;\n }\n }\n }, {\n key: 'liveSyncPosition',\n get: function get() {\n return this._liveSyncPosition;\n },\n set: function set(value) {\n this._liveSyncPosition = value;\n }\n }]);\n\n return StreamController;\n}(event_handler);\n\n/* harmony default export */ var stream_controller = (stream_controller_StreamController);\n// CONCATENATED MODULE: ./src/controller/level-controller.js\nvar level_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction level_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction level_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction level_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Level Controller\n*/\n\n\n\n\n\n\n\nvar level_controller_LevelController = function (_EventHandler) {\n level_controller__inherits(LevelController, _EventHandler);\n\n function LevelController(hls) {\n level_controller__classCallCheck(this, LevelController);\n\n var _this = level_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].LEVEL_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].ERROR));\n\n _this.canload = false;\n _this.currentLevelIndex = null;\n _this.manualLevelIndex = -1;\n _this.timer = null;\n return _this;\n }\n\n LevelController.prototype.destroy = function destroy() {\n this.cleanTimer();\n this.manualLevelIndex = -1;\n };\n\n LevelController.prototype.cleanTimer = function cleanTimer() {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n LevelController.prototype.startLoad = function startLoad() {\n var levels = this._levels;\n\n this.canload = true;\n this.levelRetryCount = 0;\n\n // clean up live level details to force reload them, and reset load errors\n if (levels) {\n levels.forEach(function (level) {\n level.loadError = 0;\n var levelDetails = level.details;\n if (levelDetails && levelDetails.live) {\n level.details = undefined;\n }\n });\n }\n // speed up live playlist refresh if timer exists\n if (this.timer !== null) {\n this.loadLevel();\n }\n };\n\n LevelController.prototype.stopLoad = function stopLoad() {\n this.canload = false;\n };\n\n LevelController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var levels = [];\n var bitrateStart = void 0;\n var levelSet = {};\n var levelFromSet = null;\n var videoCodecFound = false;\n var audioCodecFound = false;\n var chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());\n var audioTracks = [];\n\n // regroup redundant levels together\n data.levels.forEach(function (level) {\n level.loadError = 0;\n level.fragmentError = false;\n\n videoCodecFound = videoCodecFound || !!level.videoCodec;\n audioCodecFound = audioCodecFound || !!level.audioCodec || !!(level.attrs && level.attrs.AUDIO);\n\n // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n if (chromeOrFirefox === true && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {\n level.audioCodec = undefined;\n }\n\n levelFromSet = levelSet[level.bitrate];\n\n if (levelFromSet === undefined) {\n level.url = [level.url];\n level.urlId = 0;\n levelSet[level.bitrate] = level;\n levels.push(level);\n } else {\n levelFromSet.url.push(level.url);\n }\n });\n\n // remove audio-only level if we also have levels with audio+video codecs signalled\n if (videoCodecFound === true && audioCodecFound === true) {\n levels = levels.filter(function (_ref) {\n var videoCodec = _ref.videoCodec;\n return !!videoCodec;\n });\n }\n\n // only keep levels with supported audio/video codecs\n levels = levels.filter(function (_ref2) {\n var audioCodec = _ref2.audioCodec,\n videoCodec = _ref2.videoCodec;\n\n return (!audioCodec || isCodecSupportedInMp4(audioCodec)) && (!videoCodec || isCodecSupportedInMp4(videoCodec));\n });\n\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio');\n });\n }\n\n if (levels.length > 0) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate;\n // sort level on bitrate\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels;\n // find index of first level in sorted levels\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger[\"b\" /* logger */].log('manifest loaded,' + levels.length + ' level(s) found, first bitrate:' + bitrateStart);\n break;\n }\n }\n this.hls.trigger(events[\"a\" /* default */].MANIFEST_PARSED, {\n levels: levels,\n audioTracks: audioTracks,\n firstLevel: this._firstLevel,\n stats: data.stats,\n audio: audioCodecFound,\n video: videoCodecFound,\n altAudio: audioTracks.length > 0\n });\n } else {\n this.hls.trigger(events[\"a\" /* default */].ERROR, {\n type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR,\n details: errors[\"a\" /* ErrorDetails */].MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: this.hls.url,\n reason: 'no level with compatible codecs found in manifest'\n });\n }\n };\n\n LevelController.prototype.setLevelInternal = function setLevelInternal(newLevel) {\n var levels = this._levels;\n var hls = this.hls;\n // check if level idx is valid\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n if (this.currentLevelIndex !== newLevel) {\n logger[\"b\" /* logger */].log('switching to level ' + newLevel);\n this.currentLevelIndex = newLevel;\n var levelProperties = levels[newLevel];\n levelProperties.level = newLevel;\n // LEVEL_SWITCH to be deprecated in next major release\n hls.trigger(events[\"a\" /* default */].LEVEL_SWITCH, levelProperties);\n hls.trigger(events[\"a\" /* default */].LEVEL_SWITCHING, levelProperties);\n }\n var level = levels[newLevel],\n levelDetails = level.details;\n // check if we need to load playlist for this level\n if (!levelDetails || levelDetails.live === true) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var urlId = level.urlId;\n hls.trigger(events[\"a\" /* default */].LEVEL_LOADING, { url: level.url[urlId], level: newLevel, id: urlId });\n }\n } else {\n // invalid level id given, trigger error\n hls.trigger(events[\"a\" /* default */].ERROR, {\n type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR,\n details: errors[\"a\" /* ErrorDetails */].LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: false,\n reason: 'invalid level idx'\n });\n }\n };\n\n LevelController.prototype.onError = function onError(data) {\n if (data.fatal === true) {\n if (data.type === errors[\"b\" /* ErrorTypes */].NETWORK_ERROR) {\n this.cleanTimer();\n }\n return;\n }\n\n var levelError = false,\n fragmentError = false;\n var levelIndex = void 0;\n\n // try to recover not fatal errors\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n levelIndex = data.frag.level;\n fragmentError = true;\n break;\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT:\n levelIndex = data.context.level;\n levelError = true;\n break;\n case errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR:\n levelIndex = data.level;\n levelError = true;\n break;\n }\n\n if (levelIndex !== undefined) {\n this.recoverLevel(data, levelIndex, levelError, fragmentError);\n }\n };\n\n /**\n * Switch to a redundant stream if any available.\n * If redundant stream is not available, emergency switch down if ABR mode is enabled.\n *\n * @param {Object} errorEvent\n * @param {Number} levelIndex current level index\n * @param {Boolean} levelError\n * @param {Boolean} fragmentError\n */\n // FIXME Find a better abstraction where fragment/level retry management is well decoupled\n\n\n LevelController.prototype.recoverLevel = function recoverLevel(errorEvent, levelIndex, levelError, fragmentError) {\n var _this2 = this;\n\n var config = this.hls.config;\n var errorDetails = errorEvent.details;\n\n var level = this._levels[levelIndex];\n var redundantLevels = void 0,\n delay = void 0,\n nextLevel = void 0;\n\n level.loadError++;\n level.fragmentError = fragmentError;\n\n if (levelError === true) {\n if (this.levelRetryCount + 1 <= config.levelLoadingMaxRetry) {\n // exponential backoff capped to max retry timeout\n delay = Math.min(Math.pow(2, this.levelRetryCount) * config.levelLoadingRetryDelay, config.levelLoadingMaxRetryTimeout);\n // Schedule level reload\n this.timer = setTimeout(function () {\n return _this2.loadLevel();\n }, delay);\n // boolean used to inform stream controller not to switch back to IDLE on non fatal error\n errorEvent.levelRetry = true;\n this.levelRetryCount++;\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ', retry in ' + delay + ' ms, current retry count is ' + this.levelRetryCount);\n } else {\n logger[\"b\" /* logger */].error('level controller, cannot recover from ' + errorDetails + ' error');\n this.currentLevelIndex = null;\n // stopping live reloading timer if any\n this.cleanTimer();\n // switch error to fatal\n errorEvent.fatal = true;\n return;\n }\n }\n\n // Try any redundant streams if available for both errors: level and fragment\n // If level.loadError reaches redundantLevels it means that we tried them all, no hope => let's switch down\n if (levelError === true || fragmentError === true) {\n redundantLevels = level.url.length;\n\n if (redundantLevels > 1 && level.loadError < redundantLevels) {\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ' for level ' + levelIndex + ': switching to redundant stream id ' + level.urlId);\n level.urlId = (level.urlId + 1) % redundantLevels;\n level.details = undefined;\n } else {\n // Search for available level\n if (this.manualLevelIndex === -1) {\n // When lowest level has been reached, let's start hunt from the top\n nextLevel = levelIndex === 0 ? this._levels.length - 1 : levelIndex - 1;\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ': switch to ' + nextLevel);\n this.hls.nextAutoLevel = this.currentLevelIndex = nextLevel;\n } else if (fragmentError === true) {\n // Allow fragment retry as long as configuration allows.\n // reset this._level so that another call to set level() will trigger again a frag load\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ': reload a fragment');\n this.currentLevelIndex = null;\n }\n }\n }\n };\n\n // reset errors on the successful load of a fragment\n\n\n LevelController.prototype.onFragLoaded = function onFragLoaded(_ref3) {\n var frag = _ref3.frag;\n\n if (frag !== undefined && frag.type === 'main') {\n var level = this._levels[frag.level];\n if (level !== undefined) {\n level.fragmentError = false;\n level.loadError = 0;\n this.levelRetryCount = 0;\n }\n }\n };\n\n LevelController.prototype.onLevelLoaded = function onLevelLoaded(data) {\n var _this3 = this;\n\n var levelId = data.level;\n // only process level loaded events matching with expected level\n if (levelId === this.currentLevelIndex) {\n var curLevel = this._levels[levelId];\n // reset level load error counter on successful level loaded only if there is no issues with fragments\n if (curLevel.fragmentError === false) {\n curLevel.loadError = 0;\n this.levelRetryCount = 0;\n }\n var newDetails = data.details;\n // if current playlist is a live playlist, arm a timer to reload it\n if (newDetails.live) {\n var reloadInterval = 1000 * (newDetails.averagetargetduration ? newDetails.averagetargetduration : newDetails.targetduration),\n curDetails = curLevel.details;\n if (curDetails && newDetails.endSN === curDetails.endSN) {\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 logger[\"b\" /* logger */].log('same live playlist, reload twice faster');\n }\n // decrement reloadInterval with level loading delay\n reloadInterval -= performance.now() - data.stats.trequest;\n // in any case, don't reload more than every second\n reloadInterval = Math.max(1000, Math.round(reloadInterval));\n logger[\"b\" /* logger */].log('live playlist, reload in ' + reloadInterval + ' ms');\n this.timer = setTimeout(function () {\n return _this3.loadLevel();\n }, reloadInterval);\n } else {\n this.cleanTimer();\n }\n }\n };\n\n LevelController.prototype.loadLevel = function loadLevel() {\n var level = void 0,\n urlIndex = void 0;\n\n if (this.currentLevelIndex !== null && this.canload === true) {\n level = this._levels[this.currentLevelIndex];\n if (level !== undefined && level.url.length > 0) {\n urlIndex = level.urlId;\n this.hls.trigger(events[\"a\" /* default */].LEVEL_LOADING, { url: level.url[urlIndex], level: this.currentLevelIndex, id: urlIndex });\n }\n }\n };\n\n level_controller__createClass(LevelController, [{\n key: 'levels',\n get: function get() {\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) {\n newLevel = Math.min(newLevel, levels.length - 1);\n if (this.currentLevelIndex !== newLevel || levels[newLevel].details === undefined) {\n this.setLevelInternal(newLevel);\n }\n }\n }\n }, {\n key: 'manualLevel',\n get: function get() {\n return this.manualLevelIndex;\n },\n set: function set(newLevel) {\n this.manualLevelIndex = newLevel;\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n }, {\n key: 'firstLevel',\n get: function get() {\n return this._firstLevel;\n },\n set: function set(newLevel) {\n this._firstLevel = newLevel;\n }\n }, {\n key: 'startLevel',\n get: function get() {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n if (configStartLevel !== undefined) {\n return configStartLevel;\n } else {\n return this._firstLevel;\n }\n } else {\n return this._startLevel;\n }\n },\n set: function set(newLevel) {\n this._startLevel = newLevel;\n }\n }, {\n key: 'nextLoadLevel',\n get: function get() {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n } else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function set(nextLevel) {\n this.level = nextLevel;\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n }\n }]);\n\n return LevelController;\n}(event_handler);\n\n/* harmony default export */ var level_controller = (level_controller_LevelController);\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(3);\n\n// CONCATENATED MODULE: ./src/controller/id3-track-controller.js\nfunction id3_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction id3_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction id3_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * id3 metadata track controller\n*/\n\n\n\n\n\nvar id3_track_controller_ID3TrackController = function (_EventHandler) {\n id3_track_controller__inherits(ID3TrackController, _EventHandler);\n\n function ID3TrackController(hls) {\n id3_track_controller__classCallCheck(this, ID3TrackController);\n\n var _this = id3_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].FRAG_PARSING_METADATA));\n\n _this.id3Track = undefined;\n _this.media = undefined;\n return _this;\n }\n\n ID3TrackController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n // Add ID3 metatadata text track.\n\n\n ID3TrackController.prototype.onMediaAttached = function onMediaAttached(data) {\n this.media = data.media;\n if (!this.media) {\n return;\n }\n };\n\n ID3TrackController.prototype.onMediaDetaching = function onMediaDetaching() {\n this.media = undefined;\n };\n\n ID3TrackController.prototype.onFragParsingMetadata = function onFragParsingMetadata(data) {\n var fragment = data.frag;\n var samples = data.samples;\n\n // create track dynamically\n if (!this.id3Track) {\n this.id3Track = this.media.addTextTrack('metadata', 'id3');\n this.id3Track.mode = 'hidden';\n }\n\n // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n var Cue = window.WebKitDataCue || window.VTTCue || window.TextTrackCue;\n\n for (var i = 0; i < samples.length; i++) {\n var frames = id3[\"a\" /* default */].getID3Frames(samples[i].data);\n if (frames) {\n var startTime = samples[i].pts;\n var endTime = i < samples.length - 1 ? samples[i + 1].pts : fragment.endPTS;\n\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\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 (!id3[\"a\" /* default */].isTimeStampFrame(frame)) {\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n\n return ID3TrackController;\n}(event_handler);\n\n/* harmony default export */ var id3_track_controller = (id3_track_controller_ID3TrackController);\n// CONCATENATED MODULE: ./src/helper/is-supported.js\n\n\nfunction is_supported_isSupported() {\n var mediaSource = getMediaSource();\n var sourceBuffer = window.SourceBuffer || window.WebKitSourceBuffer;\n var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"');\n\n // if SourceBuffer is exposed ensure its API is valid\n // safari and old version of Chrome doe not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n return !!isTypeSupported && !!sourceBufferValidAPI;\n}\n// CONCATENATED MODULE: ./src/utils/ewma.js\nfunction ewma__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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\nvar EWMA = function () {\n\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife) {\n ewma__classCallCheck(this, EWMA);\n\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_ = 0;\n this.totalWeight_ = 0;\n }\n\n EWMA.prototype.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\n EWMA.prototype.getTotalWeight = function getTotalWeight() {\n return this.totalWeight_;\n };\n\n EWMA.prototype.getEstimate = function getEstimate() {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n return this.estimate_ / zeroFactor;\n } else {\n return this.estimate_;\n }\n };\n\n return EWMA;\n}();\n\n/* harmony default export */ var ewma = (EWMA);\n// CONCATENATED MODULE: ./src/utils/ewma-bandwidth-estimator.js\nfunction ewma_bandwidth_estimator__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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\n\nvar ewma_bandwidth_estimator_EwmaBandWidthEstimator = function () {\n function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) {\n ewma_bandwidth_estimator__classCallCheck(this, EwmaBandWidthEstimator);\n\n this.hls = hls;\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 }\n\n EwmaBandWidthEstimator.prototype.sample = function sample(durationMs, numBytes) {\n durationMs = Math.max(durationMs, this.minDelayMs_);\n var bandwidth = 8000 * numBytes / durationMs,\n\n //console.log('instant bw:'+ Math.round(bandwidth));\n // we weight sample using loading duration....\n weight = durationMs / 1000;\n this.fast_.sample(weight, bandwidth);\n this.slow_.sample(weight, bandwidth);\n };\n\n EwmaBandWidthEstimator.prototype.canEstimate = function canEstimate() {\n var fast = this.fast_;\n return fast && fast.getTotalWeight() >= this.minWeight_;\n };\n\n EwmaBandWidthEstimator.prototype.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\n EwmaBandWidthEstimator.prototype.destroy = function destroy() {};\n\n return EwmaBandWidthEstimator;\n}();\n\n/* harmony default export */ var ewma_bandwidth_estimator = (ewma_bandwidth_estimator_EwmaBandWidthEstimator);\n// CONCATENATED MODULE: ./src/controller/abr-controller.js\nvar abr_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction abr_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction abr_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction abr_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\n\n\n\n\n\n\n\n\nvar abr_controller_AbrController = function (_EventHandler) {\n abr_controller__inherits(AbrController, _EventHandler);\n\n function AbrController(hls) {\n abr_controller__classCallCheck(this, AbrController);\n\n var _this = abr_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FRAG_LOADING, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_BUFFERED, events[\"a\" /* default */].ERROR));\n\n _this.lastLoadedFragLevel = 0;\n _this._nextAutoLevel = -1;\n _this.hls = hls;\n _this.timer = null;\n _this._bwEstimator = null;\n _this.onCheck = _this._abandonRulesCheck.bind(_this);\n return _this;\n }\n\n AbrController.prototype.destroy = function destroy() {\n this.clearTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n AbrController.prototype.onFragLoading = function onFragLoading(data) {\n var frag = data.frag;\n if (frag.type === 'main') {\n if (!this.timer) {\n this.timer = setInterval(this.onCheck, 100);\n }\n // lazy init of bw Estimator, rationale is that we use different params for Live/VoD\n // so we need to wait for stream manifest / playlist type to instantiate it.\n if (!this._bwEstimator) {\n var hls = this.hls,\n level = data.frag.level,\n isLive = hls.levels[level].details.live,\n config = hls.config,\n ewmaFast = void 0,\n ewmaSlow = void 0;\n\n if (isLive) {\n ewmaFast = config.abrEwmaFastLive;\n ewmaSlow = config.abrEwmaSlowLive;\n } else {\n ewmaFast = config.abrEwmaFastVoD;\n ewmaSlow = config.abrEwmaSlowVoD;\n }\n this._bwEstimator = new ewma_bandwidth_estimator(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate);\n }\n this.fragCurrent = frag;\n }\n };\n\n AbrController.prototype._abandonRulesCheck = function _abandonRulesCheck() {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n var hls = this.hls,\n v = hls.media,\n frag = this.fragCurrent,\n loader = frag.loader,\n minAutoLevel = hls.minAutoLevel;\n\n // if loader has been destroyed or loading has been aborted, stop timer and return\n if (!loader || loader.stats && loader.stats.aborted) {\n logger[\"b\" /* logger */].warn('frag loader destroy or aborted, disarm abandonRules');\n this.clearTimer();\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n return;\n }\n var stats = loader.stats;\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n if (v && stats && (!v.paused && v.playbackRate !== 0 || !v.readyState) && frag.autoLevel && frag.level) {\n var requestDelay = performance.now() - stats.trequest,\n playbackRate = Math.abs(v.playbackRate);\n // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n if (requestDelay > 500 * frag.duration / playbackRate) {\n var levels = hls.levels,\n loadRate = Math.max(1, stats.bw ? stats.bw / 8 : stats.loaded * 1000 / requestDelay),\n // byte/s; at least 1 byte/s to avoid division by zero\n // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size\n level = levels[frag.level],\n levelBitrate = level.realBitrate ? Math.max(level.realBitrate, level.bitrate) : level.bitrate,\n expectedLen = stats.total ? stats.total : Math.max(stats.loaded, Math.round(frag.duration * levelBitrate / 8)),\n pos = v.currentTime,\n fragLoadedDelay = (expectedLen - stats.loaded) / loadRate,\n bufferStarvationDelay = (buffer_helper.bufferInfo(v, pos, hls.config.maxBufferHole).end - pos) / playbackRate;\n // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n if (bufferStarvationDelay < 2 * frag.duration / playbackRate && fragLoadedDelay > bufferStarvationDelay) {\n var fragLevelNextLoadedDelay = void 0,\n nextLoadLevel = void 0;\n // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].realBitrate ? Math.max(levels[nextLoadLevel].realBitrate, levels[nextLoadLevel].bitrate) : levels[nextLoadLevel].bitrate;\n fragLevelNextLoadedDelay = frag.duration * levelNextBitrate / (8 * 0.8 * loadRate);\n if (fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n }\n // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n logger[\"b\" /* logger */].warn('loading too slow, abort fragment loading and switch to level ' + nextLoadLevel + ':fragLoadedDelay[' + nextLoadLevel + ']<fragLoadedDelay[' + (frag.level - 1) + '];bufferStarvationDelay:' + fragLevelNextLoadedDelay.toFixed(1) + '<' + fragLoadedDelay.toFixed(1) + ':' + bufferStarvationDelay.toFixed(1));\n // force next load level in auto mode\n hls.nextLoadLevel = nextLoadLevel;\n // update bw estimate for this fragment before cancelling load (this will help reducing the bw)\n this._bwEstimator.sample(requestDelay, stats.loaded);\n //abort fragment loading\n loader.abort();\n // stop abandon rules timer\n this.clearTimer();\n hls.trigger(events[\"a\" /* default */].FRAG_LOAD_EMERGENCY_ABORTED, { frag: frag, stats: stats });\n }\n }\n }\n }\n };\n\n AbrController.prototype.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag;\n if (frag.type === 'main' && !isNaN(frag.sn)) {\n // stop monitoring bw once frag loaded\n this.clearTimer();\n // store level id after successful fragment load\n this.lastLoadedFragLevel = frag.level;\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n\n // compute level average bitrate\n if (this.hls.config.abrMaxWithRealBitrate) {\n var level = this.hls.levels[frag.level];\n var loadedBytes = (level.loaded ? level.loaded.bytes : 0) + data.stats.loaded;\n var loadedDuration = (level.loaded ? level.loaded.duration : 0) + data.frag.duration;\n level.loaded = { bytes: loadedBytes, duration: loadedDuration };\n level.realBitrate = Math.round(8 * loadedBytes / loadedDuration);\n }\n // if fragment has been loaded to perform a bitrate test,\n if (data.frag.bitrateTest) {\n var stats = data.stats;\n stats.tparsed = stats.tbuffered = stats.tload;\n this.onFragBuffered(data);\n }\n }\n };\n\n AbrController.prototype.onFragBuffered = function onFragBuffered(data) {\n var stats = data.stats,\n frag = data.frag;\n // only update stats on first frag buffering\n // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly\n // and leading to wrong bw estimation\n // on bitrate test, also only update stats once (if tload = tbuffered == on FRAG_LOADED)\n if (stats.aborted !== true && frag.loadCounter === 1 && frag.type === 'main' && !isNaN(frag.sn) && (!frag.bitrateTest || stats.tload === stats.tbuffered)) {\n // use tparsed-trequest instead of tbuffered-trequest to compute fragLoadingProcessing; rationale is that buffer appending only happens once media is attached\n // in case we use config.startFragPrefetch while media is not attached yet, fragment might be parsed while media not attached yet, but it will only be buffered on media attached\n // as a consequence it could happen really late in the process. meaning that appending duration might appears huge ... leading to underestimated throughput estimation\n var fragLoadingProcessingMs = stats.tparsed - stats.trequest;\n logger[\"b\" /* logger */].log('latency/loading/parsing/append/kbps:' + Math.round(stats.tfirst - stats.trequest) + '/' + Math.round(stats.tload - stats.tfirst) + '/' + Math.round(stats.tparsed - stats.tload) + '/' + Math.round(stats.tbuffered - stats.tparsed) + '/' + Math.round(8 * stats.loaded / (stats.tbuffered - stats.trequest)));\n this._bwEstimator.sample(fragLoadingProcessingMs, stats.loaded);\n stats.bwEstimate = this._bwEstimator.getEstimate();\n // if fragment has been loaded to perform a bitrate test, (hls.startLevel = -1), store bitrate test delay duration\n if (frag.bitrateTest) {\n this.bitrateTestDelay = fragLoadingProcessingMs / 1000;\n } else {\n this.bitrateTestDelay = 0;\n }\n }\n };\n\n AbrController.prototype.onError = function onError(data) {\n // stop timer in case of frag loading error\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n this.clearTimer();\n break;\n default:\n break;\n }\n };\n\n AbrController.prototype.clearTimer = function clearTimer() {\n clearInterval(this.timer);\n this.timer = null;\n };\n\n // return next auto level\n\n\n AbrController.prototype._findBestLevel = function _findBestLevel(currentLevel, currentFragDuration, currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor, levels) {\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i],\n levelDetails = levelInfo.details,\n avgDuration = levelDetails ? levelDetails.totalduration / levelDetails.fragments.length : currentFragDuration,\n live = levelDetails ? levelDetails.live : false,\n adjustedbw = void 0;\n // follow algorithm captured from stagefright :\n // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp\n // Pick the highest bandwidth stream below or equal to estimated bandwidth.\n // consider only 80% of the available bandwidth, but if we are switching up,\n // be even more conservative (70%) to avoid overestimating and immediately\n // switching back.\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n var bitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate,\n fetchDuration = bitrate * avgDuration / adjustedbw;\n\n logger[\"b\" /* logger */].trace('level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: ' + i + '/' + Math.round(adjustedbw) + '/' + bitrate + '/' + avgDuration + '/' + maxFetchDuration + '/' + fetchDuration);\n // if adjusted bw is greater than level bitrate AND\n if (adjustedbw > bitrate && (\n // fragment fetchDuration unknown OR live stream OR fragment fetchDuration less than max allowed fetch duration, then this level matches\n // we don't account for max Fetch Duration for live streams, this is to avoid switching down when near the edge of live sliding window ...\n // special case to support startLevel = -1 (bitrateTest) on live streams : in that case we should not exit loop so that _findBestLevel will return -1\n !fetchDuration || live && !this.bitrateTestDelay || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n }\n // not enough time budget even with quality level 0 ... rebuffering might happen\n return -1;\n };\n\n abr_controller__createClass(AbrController, [{\n key: 'nextAutoLevel',\n get: function get() {\n var forcedAutoLevel = this._nextAutoLevel;\n var bwEstimator = this._bwEstimator;\n // in case next auto level has been forced, and bw not available or not reliable, return forced value\n if (forcedAutoLevel !== -1 && (!bwEstimator || !bwEstimator.canEstimate())) {\n return forcedAutoLevel;\n }\n // compute next level using ABR logic\n var nextABRAutoLevel = this._nextABRAutoLevel;\n // if forced auto level has been defined, use it to cap ABR computed quality level\n if (forcedAutoLevel !== -1) {\n nextABRAutoLevel = Math.min(forcedAutoLevel, nextABRAutoLevel);\n }\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n }, {\n key: '_nextABRAutoLevel',\n get: function get() {\n var hls = this.hls,\n maxAutoLevel = hls.maxAutoLevel,\n levels = hls.levels,\n config = hls.config,\n minAutoLevel = hls.minAutoLevel;\n var v = hls.media,\n currentLevel = this.lastLoadedFragLevel,\n currentFragDuration = this.fragCurrent ? this.fragCurrent.duration : 0,\n pos = v ? v.currentTime : 0,\n\n // playbackRate is the absolute value of the playback rate; if v.playbackRate is 0, we use 1 to load as\n // if we're playing back at the normal rate.\n playbackRate = v && v.playbackRate !== 0 ? Math.abs(v.playbackRate) : 1.0,\n avgbw = this._bwEstimator ? this._bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate,\n\n // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n bufferStarvationDelay = (buffer_helper.bufferInfo(v, pos, config.maxBufferHole).end - pos) / playbackRate;\n\n // First, look to see if we can find a level matching with our avg bandwidth AND that could also guarantee no rebuffering at all\n var bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, config.abrBandWidthFactor, config.abrBandWidthUpFactor, levels);\n if (bestLevel >= 0) {\n return bestLevel;\n } else {\n logger[\"b\" /* logger */].trace('rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering');\n // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay,\n bwFactor = config.abrBandWidthFactor,\n bwUpFactor = config.abrBandWidthUpFactor;\n if (bufferStarvationDelay === 0) {\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[\"b\" /* logger */].trace('bitrate test took ' + Math.round(1000 * bitrateTestDelay) + 'ms, set first fragment max fetchDuration to ' + Math.round(1000 * maxStarvationDelay) + ' ms');\n // don't use conservative factor on bitrate test\n bwFactor = bwUpFactor = 1;\n }\n }\n bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor, levels);\n return Math.max(bestLevel, 0);\n }\n }\n }]);\n\n return AbrController;\n}(event_handler);\n\n/* harmony default export */ var abr_controller = (abr_controller_AbrController);\n// CONCATENATED MODULE: ./src/controller/buffer-controller.js\nfunction buffer_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction buffer_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction buffer_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Buffer Controller\n*/\n\n\n\n\n\n\n\nvar buffer_controller_MediaSource = getMediaSource();\n\nvar buffer_controller_BufferController = function (_EventHandler) {\n buffer_controller__inherits(BufferController, _EventHandler);\n\n function BufferController(hls) {\n buffer_controller__classCallCheck(this, BufferController);\n\n // the value that we have set mediasource.duration to\n // (the actual duration may be tweaked slighly by the browser)\n var _this = buffer_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].BUFFER_RESET, events[\"a\" /* default */].BUFFER_APPENDING, events[\"a\" /* default */].BUFFER_CODECS, events[\"a\" /* default */].BUFFER_EOS, events[\"a\" /* default */].BUFFER_FLUSHING, events[\"a\" /* default */].LEVEL_PTS_UPDATED, events[\"a\" /* default */].LEVEL_UPDATED));\n\n _this._msDuration = null;\n // the value that we want to set mediaSource.duration to\n _this._levelDuration = null;\n // current stream state: true - for live broadcast, false - for VoD content\n _this._live = null;\n // cache the self generated object url to detect hijack of video tag\n _this._objectUrl = null;\n\n // Source Buffer listeners\n _this.onsbue = _this.onSBUpdateEnd.bind(_this);\n _this.onsbe = _this.onSBUpdateError.bind(_this);\n _this.pendingTracks = {};\n _this.tracks = {};\n return _this;\n }\n\n BufferController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n BufferController.prototype.onLevelPtsUpdated = function onLevelPtsUpdated(data) {\n var type = data.type;\n var audioTrack = this.tracks.audio;\n\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). At the time of change we issue\n // `SourceBuffer.abort()` and adjusting `SourceBuffer.timestampOffset` if `SourceBuffer.updating` is false or awaiting `updateend`\n // event if SB is in updating state.\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n\n if (type === 'audio' && audioTrack && audioTrack.container === 'audio/mpeg') {\n // Chrome audio mp3 track\n var audioBuffer = this.sourceBuffer.audio;\n var delta = Math.abs(audioBuffer.timestampOffset - data.start);\n\n // adjust timestamp offset if time delta is greater than 100ms\n if (delta > 0.1) {\n var updating = audioBuffer.updating;\n\n try {\n audioBuffer.abort();\n } catch (err) {\n updating = true;\n logger[\"b\" /* logger */].warn('can not abort audio buffer: ' + err);\n }\n\n if (!updating) {\n logger[\"b\" /* logger */].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + data.start);\n audioBuffer.timestampOffset = data.start;\n } else {\n this.audioTimestampOffset = data.start;\n }\n }\n }\n };\n\n BufferController.prototype.onManifestParsed = function onManifestParsed(data) {\n var audioExpected = data.audio,\n videoExpected = data.video || data.levels.length && data.audio,\n sourceBufferNb = 0;\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 if (data.altAudio && (audioExpected || videoExpected)) {\n sourceBufferNb = (audioExpected ? 1 : 0) + (videoExpected ? 1 : 0);\n logger[\"b\" /* logger */].log(sourceBufferNb + ' sourceBuffer(s) expected');\n }\n this.sourceBufferNb = sourceBufferNb;\n };\n\n BufferController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n var media = this.media = data.media;\n if (media) {\n // setup the media source\n var ms = this.mediaSource = new buffer_controller_MediaSource();\n //Media Source listeners\n this.onmso = this.onMediaSourceOpen.bind(this);\n this.onmse = this.onMediaSourceEnded.bind(this);\n this.onmsc = this.onMediaSourceClose.bind(this);\n ms.addEventListener('sourceopen', this.onmso);\n ms.addEventListener('sourceended', this.onmse);\n ms.addEventListener('sourceclose', this.onmsc);\n // link video and media Source\n media.src = URL.createObjectURL(ms);\n // cache the locally generated object url\n this._objectUrl = media.src;\n }\n };\n\n BufferController.prototype.onMediaDetaching = function onMediaDetaching() {\n logger[\"b\" /* logger */].log('media source detaching');\n var ms = this.mediaSource;\n if (ms) {\n if (ms.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 ms.endOfStream();\n } catch (err) {\n logger[\"b\" /* logger */].warn('onMediaDetaching:' + err.message + ' while calling endOfStream');\n }\n }\n ms.removeEventListener('sourceopen', this.onmso);\n ms.removeEventListener('sourceended', this.onmse);\n ms.removeEventListener('sourceclose', this.onmsc);\n\n // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n if (this.media) {\n URL.revokeObjectURL(this._objectUrl);\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.media.src === this._objectUrl) {\n this.media.removeAttribute('src');\n this.media.load();\n } else {\n logger[\"b\" /* logger */].warn('media.src was changed by a third party - skip cleanup');\n }\n }\n\n this.mediaSource = null;\n this.media = null;\n this._objectUrl = null;\n this.pendingTracks = {};\n this.tracks = {};\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n }\n this.onmso = this.onmse = this.onmsc = null;\n this.hls.trigger(events[\"a\" /* default */].MEDIA_DETACHED);\n };\n\n BufferController.prototype.onMediaSourceOpen = function onMediaSourceOpen() {\n logger[\"b\" /* logger */].log('media source opened');\n this.hls.trigger(events[\"a\" /* default */].MEDIA_ATTACHED, { media: this.media });\n var mediaSource = this.mediaSource;\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', this.onmso);\n }\n this.checkPendingTracks();\n };\n\n BufferController.prototype.checkPendingTracks = function checkPendingTracks() {\n // if any buffer codecs pending, check if we have enough to create sourceBuffers\n var pendingTracks = this.pendingTracks,\n pendingTracksNb = Object.keys(pendingTracks).length;\n // if any pending tracks and (if nb of pending tracks gt or equal than expected nb or if unknown expected nb)\n if (pendingTracksNb && (this.sourceBufferNb <= pendingTracksNb || this.sourceBufferNb === 0)) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {};\n // append any pending segments now !\n this.doAppending();\n }\n };\n\n BufferController.prototype.onMediaSourceClose = function onMediaSourceClose() {\n logger[\"b\" /* logger */].log('media source closed');\n };\n\n BufferController.prototype.onMediaSourceEnded = function onMediaSourceEnded() {\n logger[\"b\" /* logger */].log('media source ended');\n };\n\n BufferController.prototype.onSBUpdateEnd = function onSBUpdateEnd() {\n // update timestampOffset\n if (this.audioTimestampOffset) {\n var audioBuffer = this.sourceBuffer.audio;\n logger[\"b\" /* logger */].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + this.audioTimestampOffset);\n audioBuffer.timestampOffset = this.audioTimestampOffset;\n delete this.audioTimestampOffset;\n }\n\n if (this._needsFlush) {\n this.doFlush();\n }\n\n if (this._needsEos) {\n this.checkEos();\n }\n this.appending = false;\n var parent = this.parent;\n // count nb of pending segments waiting for appending on this sourcebuffer\n var pending = this.segments.reduce(function (counter, segment) {\n return segment.parent === parent ? counter + 1 : counter;\n }, 0);\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDED, { parent: parent, pending: pending });\n\n // don't append in flushing mode\n if (!this._needsFlush) {\n this.doAppending();\n }\n\n this.updateMediaElementDuration();\n };\n\n BufferController.prototype.onSBUpdateError = function onSBUpdateError(event) {\n logger[\"b\" /* logger */].error('sourceBuffer error:', event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_APPENDING_ERROR, fatal: false });\n // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n };\n\n BufferController.prototype.onBufferReset = function onBufferReset() {\n var sourceBuffer = this.sourceBuffer;\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n try {\n this.mediaSource.removeSourceBuffer(sb);\n sb.removeEventListener('updateend', this.onsbue);\n sb.removeEventListener('error', this.onsbe);\n } catch (err) {}\n }\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n };\n\n BufferController.prototype.onBufferCodecs = function onBufferCodecs(tracks) {\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n // if sourcebuffers already created, do nothing ...\n if (Object.keys(this.sourceBuffer).length === 0) {\n for (var trackName in tracks) {\n this.pendingTracks[trackName] = tracks[trackName];\n }\n var mediaSource = this.mediaSource;\n if (mediaSource && mediaSource.readyState === 'open') {\n // try to create sourcebuffers if mediasource opened\n this.checkPendingTracks();\n }\n }\n };\n\n BufferController.prototype.createSourceBuffers = function createSourceBuffers(tracks) {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n // use levelCodec as first priority\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + ';codecs=' + codec;\n logger[\"b\" /* logger */].log('creating sourceBuffer(' + mimeType + ')');\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this.onsbue);\n sb.addEventListener('error', this.onsbe);\n this.tracks[trackName] = { codec: codec, container: track.container };\n track.buffer = sb;\n } catch (err) {\n logger[\"b\" /* logger */].error('error while trying to add sourceBuffer:' + err.message);\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_ADD_CODEC_ERROR, fatal: false, err: err, mimeType: mimeType });\n }\n }\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CREATED, { tracks: tracks });\n };\n\n BufferController.prototype.onBufferAppending = function onBufferAppending(data) {\n if (!this._needsFlush) {\n if (!this.segments) {\n this.segments = [data];\n } else {\n this.segments.push(data);\n }\n this.doAppending();\n }\n };\n\n BufferController.prototype.onBufferAppendFail = function onBufferAppendFail(data) {\n logger[\"b\" /* logger */].error('sourceBuffer error:', data.event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_APPENDING_ERROR, fatal: false });\n };\n\n // on BUFFER_EOS mark matching sourcebuffer(s) as ended and trigger checkEos()\n\n\n BufferController.prototype.onBufferEos = function onBufferEos(data) {\n var sb = this.sourceBuffer;\n var dataType = data.type;\n for (var type in sb) {\n if (!dataType || type === dataType) {\n if (!sb[type].ended) {\n sb[type].ended = true;\n logger[\"b\" /* logger */].log(type + ' sourceBuffer now EOS');\n }\n }\n }\n this.checkEos();\n };\n\n // if all source buffers are marked as ended, signal endOfStream() to MediaSource.\n\n\n BufferController.prototype.checkEos = function checkEos() {\n var sb = this.sourceBuffer,\n mediaSource = this.mediaSource;\n if (!mediaSource || mediaSource.readyState !== 'open') {\n this._needsEos = false;\n return;\n }\n for (var type in sb) {\n var sbobj = sb[type];\n if (!sbobj.ended) {\n return;\n }\n if (sbobj.updating) {\n this._needsEos = true;\n return;\n }\n }\n logger[\"b\" /* logger */].log('all media data available, signal endOfStream() to MediaSource and stop loading fragment');\n //Notify the media element that it now has all of the media data\n try {\n mediaSource.endOfStream();\n } catch (e) {\n logger[\"b\" /* logger */].warn('exception while calling mediaSource.endOfStream()');\n }\n this._needsEos = false;\n };\n\n BufferController.prototype.onBufferFlushing = function onBufferFlushing(data) {\n this.flushRange.push({ start: data.startOffset, end: data.endOffset, type: data.type });\n // attempt flush immediately\n this.flushBufferCounter = 0;\n this.doFlush();\n };\n\n BufferController.prototype.onLevelUpdated = function onLevelUpdated(_ref) {\n var details = _ref.details;\n\n if (details.fragments.length > 0) {\n this._levelDuration = details.totalduration + details.fragments[0].start;\n this._live = details.live;\n this.updateMediaElementDuration();\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\n\n BufferController.prototype.updateMediaElementDuration = function updateMediaElementDuration() {\n var config = this.hls.config;\n\n var duration = void 0;\n\n if (this._levelDuration === null || !this.media || !this.mediaSource || !this.sourceBuffer || this.media.readyState === 0 || this.mediaSource.readyState !== 'open') {\n return;\n }\n\n for (var type in this.sourceBuffer) {\n if (this.sourceBuffer[type].updating === true) {\n // can't set duration whilst a buffer is updating\n return;\n }\n }\n\n duration = this.media.duration;\n // initialise to the value that the media source is reporting\n if (this._msDuration === null) {\n this._msDuration = this.mediaSource.duration;\n }\n\n if (this._live === true && config.liveDurationInfinity === true) {\n // Override duration to Infinity\n logger[\"b\" /* logger */].log('Media Source duration is set to Infinity');\n this._msDuration = this.mediaSource.duration = Infinity;\n } else if (this._levelDuration > this._msDuration && this._levelDuration > duration || duration === Infinity || isNaN(duration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger[\"b\" /* logger */].log('Updating Media Source duration to ' + this._levelDuration.toFixed(3));\n this._msDuration = this.mediaSource.duration = this._levelDuration;\n }\n };\n\n BufferController.prototype.doFlush = function doFlush() {\n // loop through all buffer ranges to flush\n while (this.flushRange.length) {\n var range = this.flushRange[0];\n // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n if (this.flushBuffer(range.start, range.end, range.type)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n } else {\n this._needsFlush = true;\n // avoid looping, wait for SB update end to retrigger a flush\n return;\n }\n }\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false;\n\n // let's recompute this.appended, which is used to avoid flush looping\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n try {\n for (var type in sourceBuffer) {\n appended += sourceBuffer[type].buffered.length;\n }\n } catch (error) {\n // error could be thrown while accessing buffered, in case sourcebuffer has already been removed from MediaSource\n // this is harmess at this stage, catch this to avoid reporting an internal exception\n logger[\"b\" /* logger */].error('error while accessing sourceBuffer.buffered');\n }\n this.appended = appended;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHED);\n }\n };\n\n BufferController.prototype.doAppending = function doAppending() {\n var hls = this.hls,\n sourceBuffer = this.sourceBuffer,\n segments = this.segments;\n if (Object.keys(sourceBuffer).length) {\n if (this.media.error) {\n this.segments = [];\n logger[\"b\" /* logger */].error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n if (this.appending) {\n //logger.log(`sb appending in progress`);\n return;\n }\n if (segments && segments.length) {\n var segment = segments.shift();\n try {\n var type = segment.type,\n sb = sourceBuffer[type];\n if (sb) {\n if (!sb.updating) {\n // reset sourceBuffer ended flag before appending segment\n sb.ended = false;\n //logger.log(`appending ${segment.content} ${type} SB, size:${segment.data.length}, ${segment.parent}`);\n this.parent = segment.parent;\n sb.appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n this.appending = true;\n } else {\n segments.unshift(segment);\n }\n } else {\n // in case we don't have any source buffer matching with this segment type,\n // it means that Mediasource fails to create sourcebuffer\n // discard this segment, and trigger update end\n this.onSBUpdateEnd();\n }\n } catch (err) {\n // in case any error occured while appending, put back segment in segments table\n logger[\"b\" /* logger */].error('error while trying to append buffer:' + err.message);\n segments.unshift(segment);\n var event = { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, parent: segment.parent };\n if (err.code !== 22) {\n if (this.appendError) {\n this.appendError++;\n } else {\n this.appendError = 1;\n }\n event.details = errors[\"a\" /* 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 help recovering this\n */\n if (this.appendError > hls.config.appendErrorMaxRetry) {\n logger[\"b\" /* logger */].log('fail ' + hls.config.appendErrorMaxRetry + ' times to append segment in sourceBuffer');\n segments = [];\n event.fatal = true;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n return;\n } else {\n event.fatal = false;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n }\n } else {\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 this.segments = [];\n event.details = errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR;\n event.fatal = false;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n return;\n }\n }\n }\n }\n };\n\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n\n\n BufferController.prototype.flushBuffer = function flushBuffer(startOffset, endOffset, typeIn) {\n var sb,\n i,\n bufStart,\n bufEnd,\n flushStart,\n flushEnd,\n sourceBuffer = this.sourceBuffer;\n if (Object.keys(sourceBuffer).length) {\n logger[\"b\" /* logger */].log('flushBuffer,pos/start/end: ' + this.media.currentTime.toFixed(3) + '/' + startOffset + '/' + endOffset);\n // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n if (this.flushBufferCounter < this.appended) {\n for (var type in sourceBuffer) {\n // check if sourcebuffer type is defined (typeIn): if yes, let's only flush this one\n // if no, let's flush all sourcebuffers\n if (typeIn && type !== typeIn) {\n continue;\n }\n sb = sourceBuffer[type];\n // we are going to flush buffer, mark source buffer as 'not ended'\n sb.ended = false;\n if (!sb.updating) {\n try {\n for (i = 0; i < sb.buffered.length; i++) {\n bufStart = sb.buffered.start(i);\n bufEnd = sb.buffered.end(i);\n // workaround firefox not able to properly flush multiple buffered range.\n if (navigator.userAgent.toLowerCase().indexOf('firefox') !== -1 && endOffset === Number.POSITIVE_INFINITY) {\n flushStart = startOffset;\n flushEnd = endOffset;\n } else {\n flushStart = Math.max(bufStart, startOffset);\n flushEnd = Math.min(bufEnd, endOffset);\n }\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n if (Math.min(flushEnd, bufEnd) - flushStart > 0.5) {\n this.flushBufferCounter++;\n logger[\"b\" /* logger */].log('flush ' + type + ' [' + flushStart + ',' + flushEnd + '], of [' + bufStart + ',' + bufEnd + '], pos:' + this.media.currentTime);\n sb.remove(flushStart, flushEnd);\n return false;\n }\n }\n } catch (e) {\n logger[\"b\" /* logger */].warn('exception while accessing sourcebuffer, it might have been removed from MediaSource');\n }\n } else {\n //logger.log('abort ' + type + ' append in progress');\n // this will abort any appending in progress\n //sb.abort();\n logger[\"b\" /* logger */].warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n } else {\n logger[\"b\" /* logger */].warn('abort flushing too many retries');\n }\n logger[\"b\" /* logger */].log('buffer flushed');\n }\n // everything flushed !\n return true;\n };\n\n return BufferController;\n}(event_handler);\n\n/* harmony default export */ var buffer_controller = (buffer_controller_BufferController);\n// CONCATENATED MODULE: ./src/controller/cap-level-controller.js\nvar cap_level_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction cap_level_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction cap_level_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction cap_level_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * cap stream level to media size dimension controller\n*/\n\n\n\n\nvar cap_level_controller_CapLevelController = function (_EventHandler) {\n cap_level_controller__inherits(CapLevelController, _EventHandler);\n\n function CapLevelController(hls) {\n cap_level_controller__classCallCheck(this, CapLevelController);\n\n return cap_level_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FPS_DROP_LEVEL_CAPPING, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MANIFEST_PARSED));\n }\n\n CapLevelController.prototype.destroy = function destroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = this.restrictedLevels = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n }\n }\n };\n\n CapLevelController.prototype.onFpsDropLevelCapping = function onFpsDropLevelCapping(data) {\n // Don't add a restricted level more than once\n if (CapLevelController.isLevelAllowed(data.droppedLevel, this.restrictedLevels)) {\n this.restrictedLevels.push(data.droppedLevel);\n }\n };\n\n CapLevelController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media instanceof HTMLVideoElement ? data.media : null;\n };\n\n CapLevelController.prototype.onManifestParsed = function onManifestParsed(data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n if (hls.config.capLevelToPlayerSize) {\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.levels = data.levels;\n hls.firstLevel = this.getMaxLevel(data.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n }\n };\n\n CapLevelController.prototype.detectPlayerSize = function detectPlayerSize() {\n if (this.media) {\n var levelsLength = this.levels ? this.levels.length : 0;\n if (levelsLength) {\n var hls = this.hls;\n hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n if (hls.autoLevelCapping > this.autoLevelCapping) {\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 hls.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\n\n CapLevelController.prototype.getMaxLevel = function getMaxLevel(capLevelIndex) {\n var _this2 = this;\n\n if (!this.levels) {\n return -1;\n }\n\n var validLevels = this.levels.filter(function (level, index) {\n return CapLevelController.isLevelAllowed(index, _this2.restrictedLevels) && index <= capLevelIndex;\n });\n\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\n\n CapLevelController.isLevelAllowed = function isLevelAllowed(level) {\n var restrictedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n return restrictedLevels.indexOf(level) === -1;\n };\n\n CapLevelController.getMaxLevelByMediaSize = function getMaxLevelByMediaSize(levels, width, height) {\n if (!levels || levels && !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 atGreatestBandiwdth = function atGreatestBandiwdth(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\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n if ((level.width >= width || level.height >= height) && atGreatestBandiwdth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n\n return maxLevelIndex;\n };\n\n cap_level_controller__createClass(CapLevelController, [{\n key: 'mediaWidth',\n get: function get() {\n var width = void 0;\n var media = this.media;\n if (media) {\n width = media.width || media.clientWidth || media.offsetWidth;\n width *= CapLevelController.contentScaleFactor;\n }\n return width;\n }\n }, {\n key: 'mediaHeight',\n get: function get() {\n var height = void 0;\n var media = this.media;\n if (media) {\n height = media.height || media.clientHeight || media.offsetHeight;\n height *= CapLevelController.contentScaleFactor;\n }\n return height;\n }\n }], [{\n key: 'contentScaleFactor',\n get: function get() {\n var pixelRatio = 1;\n try {\n pixelRatio = window.devicePixelRatio;\n } catch (e) {}\n return pixelRatio;\n }\n }]);\n\n return CapLevelController;\n}(event_handler);\n\n/* harmony default export */ var cap_level_controller = (cap_level_controller_CapLevelController);\n// CONCATENATED MODULE: ./src/controller/fps-controller.js\nfunction fps_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction fps_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction fps_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * FPS Controller\n*/\n\n\n\n\n\nvar fps_controller_FPSController = function (_EventHandler) {\n fps_controller__inherits(FPSController, _EventHandler);\n\n function FPSController(hls) {\n fps_controller__classCallCheck(this, FPSController);\n\n return fps_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING));\n }\n\n FPSController.prototype.destroy = function destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.isVideoPlaybackQualityAvailable = false;\n };\n\n FPSController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n var config = this.hls.config;\n if (config.capLevelOnFPSDrop) {\n var video = this.video = data.media instanceof HTMLVideoElement ? data.media : null;\n if (typeof video.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n clearInterval(this.timer);\n this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n\n FPSController.prototype.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 currentDropped = droppedFrames - this.lastDroppedFrames,\n currentDecoded = decodedFrames - this.lastDecodedFrames,\n droppedFPS = 1000 * currentDropped / currentPeriod,\n hls = this.hls;\n hls.trigger(events[\"a\" /* default */].FPS_DROP, { currentDropped: currentDropped, currentDecoded: currentDecoded, totalDroppedFrames: droppedFrames });\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[\"b\" /* 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[\"a\" /* default */].FPS_DROP_LEVEL_CAPPING, { level: currentLevel, droppedLevel: hls.currentLevel });\n hls.autoLevelCapping = currentLevel;\n hls.streamController.nextLevelSwitch();\n }\n }\n }\n }\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n\n FPSController.prototype.checkFPSInterval = function checkFPSInterval() {\n var video = this.video;\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n } else {\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n\n return FPSController;\n}(event_handler);\n\n/* harmony default export */ var fps_controller = (fps_controller_FPSController);\n// CONCATENATED MODULE: ./src/utils/xhr-loader.js\nfunction xhr_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * XHR based logger\n*/\n\n\n\nvar xhr_loader_XhrLoader = function () {\n function XhrLoader(config) {\n xhr_loader__classCallCheck(this, XhrLoader);\n\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n\n XhrLoader.prototype.destroy = function destroy() {\n this.abort();\n this.loader = null;\n };\n\n XhrLoader.prototype.abort = function abort() {\n var loader = this.loader;\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n\n window.clearTimeout(this.requestTimeout);\n this.requestTimeout = null;\n window.clearTimeout(this.retryTimeout);\n this.retryTimeout = null;\n };\n\n XhrLoader.prototype.load = function load(context, config, callbacks) {\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.stats = { trequest: performance.now(), retry: 0 };\n this.retryDelay = config.retryDelay;\n this.loadInternal();\n };\n\n XhrLoader.prototype.loadInternal = function loadInternal() {\n var xhr,\n context = this.context;\n xhr = this.loader = new XMLHttpRequest();\n\n var stats = this.stats;\n stats.tfirst = 0;\n stats.loaded = 0;\n var xhrSetup = this.xhrSetup;\n\n try {\n if (xhrSetup) {\n try {\n xhrSetup(xhr, context.url);\n } catch (e) {\n // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader(\"Content-Language\", \"test\");}\n // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN\n xhr.open('GET', context.url, true);\n xhrSetup(xhr, context.url);\n }\n }\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n } catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n this.callbacks.onError({ code: xhr.status, text: e.message }, context, xhr);\n return;\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\n // setup timeout before we perform request\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);\n xhr.send();\n };\n\n XhrLoader.prototype.readystatechange = function readystatechange(event) {\n var xhr = event.currentTarget,\n readyState = xhr.readyState,\n stats = this.stats,\n context = this.context,\n 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 // clear xhr timeout and rearm it if readyState less than 4\n window.clearTimeout(this.requestTimeout);\n if (stats.tfirst === 0) {\n stats.tfirst = Math.max(performance.now(), stats.trequest);\n }\n if (readyState === 4) {\n var status = xhr.status;\n // http status between 200 to 299 are all successful\n if (status >= 200 && status < 300) {\n stats.tload = Math.max(stats.tfirst, performance.now());\n var data = void 0,\n len = void 0;\n if (context.responseType === 'arraybuffer') {\n data = xhr.response;\n len = data.byteLength;\n } else {\n data = xhr.responseText;\n len = data.length;\n }\n stats.loaded = stats.total = len;\n var response = { url: xhr.responseURL, data: data };\n this.callbacks.onSuccess(response, stats, context, xhr);\n } else {\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (stats.retry >= config.maxRetry || status >= 400 && status < 499) {\n logger[\"b\" /* logger */].error(status + ' while loading ' + context.url);\n this.callbacks.onError({ code: status, text: xhr.statusText }, context, xhr);\n } else {\n // retry\n logger[\"b\" /* logger */].warn(status + ' while loading ' + context.url + ', retrying in ' + this.retryDelay + '...');\n // aborts and resets internal state\n this.destroy();\n // schedule retry\n this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay);\n // set exponential backoff\n this.retryDelay = Math.min(2 * this.retryDelay, config.maxRetryDelay);\n stats.retry++;\n }\n }\n } else {\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), config.timeout);\n }\n }\n };\n\n XhrLoader.prototype.loadtimeout = function loadtimeout() {\n logger[\"b\" /* logger */].warn('timeout while loading ' + this.context.url);\n this.callbacks.onTimeout(this.stats, this.context, null);\n };\n\n XhrLoader.prototype.loadprogress = function loadprogress(event) {\n var xhr = event.currentTarget,\n stats = this.stats;\n\n stats.loaded = event.loaded;\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n var onProgress = this.callbacks.onProgress;\n if (onProgress) {\n // third arg is to provide on progress data\n onProgress(stats, this.context, null, xhr);\n }\n };\n\n return XhrLoader;\n}();\n\n/* harmony default export */ var xhr_loader = (xhr_loader_XhrLoader);\n// CONCATENATED MODULE: ./src/controller/audio-track-controller.js\nvar audio_track_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction audio_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction audio_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction audio_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * audio track controller\n*/\n\n\n\n\n\n\nvar audio_track_controller_AudioTrackController = function (_EventHandler) {\n audio_track_controller__inherits(AudioTrackController, _EventHandler);\n\n function AudioTrackController(hls) {\n audio_track_controller__classCallCheck(this, AudioTrackController);\n\n var _this = audio_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].AUDIO_TRACK_LOADED, events[\"a\" /* default */].ERROR));\n\n _this.ticks = 0;\n _this.ontick = _this.tick.bind(_this);\n return _this;\n }\n\n AudioTrackController.prototype.destroy = function destroy() {\n this.cleanTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n AudioTrackController.prototype.cleanTimer = function cleanTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n AudioTrackController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n AudioTrackController.prototype.doTick = function doTick() {\n this.updateTrack(this.trackId);\n };\n\n AudioTrackController.prototype.onError = function onError(data) {\n if (data.fatal && data.type === errors[\"b\" /* ErrorTypes */].NETWORK_ERROR) {\n this.cleanTimer();\n }\n };\n\n AudioTrackController.prototype.onManifestLoading = function onManifestLoading() {\n // reset audio tracks on manifest loading\n this.tracks = [];\n this.trackId = -1;\n };\n\n AudioTrackController.prototype.onManifestParsed = function onManifestParsed(data) {\n var _this2 = this;\n\n var tracks = data.audioTracks || [];\n var defaultFound = false;\n this.tracks = tracks;\n this.hls.trigger(events[\"a\" /* default */].AUDIO_TRACKS_UPDATED, { audioTracks: tracks });\n // loop through available audio tracks and autoselect default if needed\n var id = 0;\n tracks.forEach(function (track) {\n if (track.default && !defaultFound) {\n _this2.audioTrack = id;\n defaultFound = true;\n return;\n }\n id++;\n });\n if (defaultFound === false && tracks.length) {\n logger[\"b\" /* logger */].log('no default audio track defined, use first audio track as default');\n this.audioTrack = 0;\n }\n };\n\n AudioTrackController.prototype.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n if (data.id < this.tracks.length) {\n logger[\"b\" /* logger */].log('audioTrack ' + data.id + ' loaded');\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(this.ontick, 1000 * data.details.targetduration);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n this.cleanTimer();\n }\n }\n };\n\n /** get alternate audio tracks list from playlist **/\n\n\n AudioTrackController.prototype.setAudioTrackInternal = function setAudioTrackInternal(newId) {\n // check if level idx is valid\n if (newId >= 0 && newId < this.tracks.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n this.trackId = newId;\n logger[\"b\" /* logger */].log('switching to audioTrack ' + newId);\n var audioTrack = this.tracks[newId],\n hls = this.hls,\n type = audioTrack.type,\n url = audioTrack.url,\n eventObj = { id: newId, type: type, url: url };\n // keep AUDIO_TRACK_SWITCH for legacy reason\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCH, eventObj);\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, eventObj);\n // check if we need to load playlist for this audio Track\n var details = audioTrack.details;\n if (url && (details === undefined || details.live === true)) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for audioTrack ' + newId);\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADING, { url: url, id: newId });\n }\n }\n };\n\n AudioTrackController.prototype.updateTrack = function updateTrack(newId) {\n // check if level idx is valid\n if (newId >= 0 && newId < this.tracks.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n this.trackId = newId;\n logger[\"b\" /* logger */].log('updating audioTrack ' + newId);\n var audioTrack = this.tracks[newId],\n url = audioTrack.url;\n // check if we need to load playlist for this audio Track\n var details = audioTrack.details;\n if (url && (details === undefined || details.live === true)) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for audioTrack ' + newId);\n this.hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADING, { url: url, id: newId });\n }\n }\n };\n\n audio_track_controller__createClass(AudioTrackController, [{\n key: 'audioTracks',\n get: function get() {\n return this.tracks;\n }\n\n /** get index of the selected audio track (index in audio track lists) **/\n\n }, {\n key: 'audioTrack',\n get: function get() {\n return this.trackId;\n }\n\n /** select an audio track, based on its index in audio track lists**/\n ,\n set: function set(audioTrackId) {\n if (this.trackId !== audioTrackId || this.tracks[audioTrackId].details === undefined) {\n this.setAudioTrackInternal(audioTrackId);\n }\n }\n }]);\n\n return AudioTrackController;\n}(event_handler);\n\n/* harmony default export */ var audio_track_controller = (audio_track_controller_AudioTrackController);\n// CONCATENATED MODULE: ./src/controller/audio-stream-controller.js\nvar audio_stream_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction audio_stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction audio_stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction audio_stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Audio Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\nvar audio_stream_controller_State = {\n STOPPED: 'STOPPED',\n STARTING: 'STARTING',\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\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 BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS'\n};\n\nvar audio_stream_controller_AudioStreamController = function (_EventHandler) {\n audio_stream_controller__inherits(AudioStreamController, _EventHandler);\n\n function AudioStreamController(hls) {\n audio_stream_controller__classCallCheck(this, AudioStreamController);\n\n var _this = audio_stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].AUDIO_TRACKS_UPDATED, events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, events[\"a\" /* default */].AUDIO_TRACK_LOADED, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, events[\"a\" /* default */].FRAG_PARSING_DATA, events[\"a\" /* default */].FRAG_PARSED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].BUFFER_RESET, events[\"a\" /* default */].BUFFER_CREATED, events[\"a\" /* default */].BUFFER_APPENDED, events[\"a\" /* default */].BUFFER_FLUSHED, events[\"a\" /* default */].INIT_PTS_FOUND));\n\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this.ticks = 0;\n _this._state = audio_stream_controller_State.STOPPED;\n _this.ontick = _this.tick.bind(_this);\n _this.initPTS = [];\n _this.waitingFragment = null;\n _this.videoTrackCC = null;\n return _this;\n }\n\n AudioStreamController.prototype.destroy = function destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n event_handler.prototype.destroy.call(this);\n this.state = audio_stream_controller_State.STOPPED;\n };\n\n //Signal that video PTS was found\n\n\n AudioStreamController.prototype.onInitPtsFound = function onInitPtsFound(data) {\n var demuxerId = data.id,\n cc = data.frag.cc,\n initPTS = data.initPTS;\n if (demuxerId === 'main') {\n //Always update the new INIT PTS\n //Can change due level switch\n this.initPTS[cc] = initPTS;\n this.videoTrackCC = cc;\n logger[\"b\" /* logger */].log('InitPTS for cc:' + cc + ' found from video track:' + initPTS);\n\n //If we are waiting we need to demux/remux the waiting frag\n //With the new initPTS\n if (this.state === audio_stream_controller_State.WAITING_INIT_PTS) {\n this.tick();\n }\n }\n };\n\n AudioStreamController.prototype.startLoad = function startLoad(startPosition) {\n if (this.tracks) {\n var lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.fragLoadError = 0;\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"b\" /* logger */].log('audio:override startPosition with lastCurrentTime @' + lastCurrentTime.toFixed(3));\n this.state = audio_stream_controller_State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = audio_stream_controller_State.STARTING;\n }\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n this.startPosition = startPosition;\n this.state = audio_stream_controller_State.STOPPED;\n }\n };\n\n AudioStreamController.prototype.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = audio_stream_controller_State.STOPPED;\n };\n\n AudioStreamController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n AudioStreamController.prototype.doTick = function doTick() {\n var pos,\n track,\n trackDetails,\n hls = this.hls,\n config = hls.config;\n //logger.log('audioStream:' + this.state);\n switch (this.state) {\n case audio_stream_controller_State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n case audio_stream_controller_State.PAUSED:\n //don't do anything in paused state either ...\n case audio_stream_controller_State.BUFFER_FLUSHING:\n break;\n case audio_stream_controller_State.STARTING:\n this.state = audio_stream_controller_State.WAITING_TRACK;\n this.loadedmetadata = false;\n break;\n case audio_stream_controller_State.IDLE:\n var tracks = this.tracks;\n // audio tracks not received => exit loop\n if (!tracks) {\n break;\n }\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media && (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n if (pos === undefined) {\n break;\n }\n }\n var media = this.mediaBuffer ? this.mediaBuffer : this.media,\n videoBuffer = this.videoBuffer ? this.videoBuffer : this.media,\n bufferInfo = buffer_helper.bufferInfo(media, pos, config.maxBufferHole),\n mainBufferInfo = buffer_helper.bufferInfo(videoBuffer, pos, config.maxBufferHole),\n bufferLen = bufferInfo.len,\n bufferEnd = bufferInfo.end,\n fragPrevious = this.fragPrevious,\n\n // ensure we buffer at least config.maxBufferLength (default 30s)\n // once we reach that threshold, don't buffer more than video (mainBufferInfo.len)\n maxBufLen = Math.max(config.maxBufferLength, mainBufferInfo.len),\n audioSwitch = this.audioSwitch,\n trackId = this.trackId;\n\n // if buffer length is less than maxBufLen try to load a new fragment\n if ((bufferLen < maxBufLen || audioSwitch) && trackId < tracks.length) {\n trackDetails = tracks[trackId].details;\n // if track info not retrieved yet, switch state and wait for track retrieval\n if (typeof trackDetails === 'undefined') {\n this.state = audio_stream_controller_State.WAITING_TRACK;\n break;\n }\n\n // check if we need to finalize media stream\n // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n if (!audioSwitch && !trackDetails.live && fragPrevious && fragPrevious.sn === trackDetails.endSN && !bufferInfo.nextStart) {\n // if we are not seeking or if we are seeking but everything (almost) til the end is buffered, let's signal eos\n // we don't compare exactly media.duration === bufferInfo.end as there could be some subtle media duration difference when switching\n // between different renditions. using half frag duration should help cope with these cases.\n if (!this.media.seeking || this.media.duration - bufferEnd < fragPrevious.duration / 2) {\n // Finalize the media stream\n this.hls.trigger(events[\"a\" /* default */].BUFFER_EOS, { type: 'audio' });\n this.state = audio_stream_controller_State.ENDED;\n break;\n }\n }\n\n // find fragment index, contiguous with end of buffer position\n var fragments = trackDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n frag = void 0;\n\n // When switching audio track, reload audio as close as possible to currentTime\n if (audioSwitch) {\n if (trackDetails.live && !trackDetails.PTSKnown) {\n logger[\"b\" /* logger */].log('switching audiotrack, live stream, unknown PTS,load first fragment');\n bufferEnd = 0;\n } else {\n bufferEnd = pos;\n // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime\n if (trackDetails.PTSKnown && pos < start) {\n // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start\n if (bufferInfo.end > start || bufferInfo.nextStart) {\n logger[\"b\" /* logger */].log('alt audio track ahead of main track, seek to start of alt audio track');\n this.media.currentTime = start + 0.05;\n } else {\n return;\n }\n }\n }\n }\n if (trackDetails.initSegment && !trackDetails.initSegment.data) {\n frag = trackDetails.initSegment;\n }\n // if bufferEnd before start of playlist, load first fragment\n else if (bufferEnd <= start) {\n frag = fragments[0];\n if (this.videoTrackCC !== null && frag.cc !== this.videoTrackCC) {\n // Ensure we find a fragment which matches the continuity of the video track\n frag = findFragWithCC(fragments, this.videoTrackCC);\n }\n if (trackDetails.live && frag.loadIdx && frag.loadIdx === this.fragLoadIdx) {\n // we just loaded this first fragment, and we are still lagging behind the start of the live playlist\n // let's force seek to start\n var nextBuffered = bufferInfo.nextStart ? bufferInfo.nextStart : start;\n logger[\"b\" /* logger */].log('no alt audio available @currentTime:' + this.media.currentTime + ', seeking @' + (nextBuffered + 0.05));\n this.media.currentTime = nextBuffered + 0.05;\n return;\n }\n } else {\n var foundFrag = void 0;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n var fragmentWithinToleranceTest = function fragmentWithinToleranceTest(candidate) {\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);\n if (candidate.start + candidate.duration - candidateLookupTolerance <= bufferEnd) {\n return 1;\n } // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n return -1;\n }\n return 0;\n };\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, fragmentWithinToleranceTest);\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < trackDetails.endSN) {\n frag = fragments[frag.sn + 1 - trackDetails.startSN];\n logger[\"b\" /* logger */].log('SN just loaded, load next one: ' + frag.sn);\n } else {\n frag = null;\n }\n }\n }\n }\n if (frag) {\n //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn + ' of [' + trackDetails.startSN + ' ,' + trackDetails.endSN + '],track ' + trackId);\n this.state = audio_stream_controller_State.KEY_LOADING;\n hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n logger[\"b\" /* logger */].log('Loading ' + frag.sn + ', cc: ' + frag.cc + ' of [' + trackDetails.startSN + ' ,' + trackDetails.endSN + '],track ' + trackId + ', currentTime:' + pos + ',bufferEnd:' + bufferEnd.toFixed(3));\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n var maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag });\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n this.fragCurrent = frag;\n this.startFragRequested = true;\n if (!isNaN(frag.sn)) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n this.state = audio_stream_controller_State.FRAG_LOADING;\n }\n }\n }\n break;\n case audio_stream_controller_State.WAITING_TRACK:\n track = this.tracks[this.trackId];\n // check if playlist is already loaded\n if (track && track.details) {\n this.state = audio_stream_controller_State.IDLE;\n }\n break;\n case audio_stream_controller_State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n media = this.media;\n var isSeeking = media && media.seeking;\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 || isSeeking) {\n logger[\"b\" /* logger */].log('audioStreamController: retryDate reached, switch back to IDLE state');\n this.state = audio_stream_controller_State.IDLE;\n }\n break;\n case audio_stream_controller_State.WAITING_INIT_PTS:\n var videoTrackCC = this.videoTrackCC;\n if (this.initPTS[videoTrackCC] === undefined) {\n break;\n }\n\n // Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS\n var waitingFrag = this.waitingFragment;\n if (waitingFrag) {\n var waitingFragCC = waitingFrag.frag.cc;\n if (videoTrackCC !== waitingFragCC) {\n track = this.tracks[this.trackId];\n if (track.details && track.details.live) {\n logger[\"b\" /* logger */].warn('Waiting fragment CC (' + waitingFragCC + ') does not match video track CC (' + videoTrackCC + ')');\n this.waitingFragment = null;\n this.state = audio_stream_controller_State.IDLE;\n }\n } else {\n this.state = audio_stream_controller_State.FRAG_LOADING;\n this.onFragLoaded(this.waitingFragment);\n this.waitingFragment = null;\n }\n } else {\n this.state = audio_stream_controller_State.IDLE;\n }\n\n break;\n case audio_stream_controller_State.STOPPED:\n case audio_stream_controller_State.FRAG_LOADING:\n case audio_stream_controller_State.PARSING:\n case audio_stream_controller_State.PARSED:\n case audio_stream_controller_State.ENDED:\n break;\n default:\n break;\n }\n };\n\n AudioStreamController.prototype.onMediaAttached = function onMediaAttached(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.tracks && config.autoStartLoad) {\n this.startLoad(config.startPosition);\n }\n };\n\n AudioStreamController.prototype.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger[\"b\" /* logger */].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var tracks = this.tracks;\n if (tracks) {\n // reset fragment load counter\n tracks.forEach(function (track) {\n if (track.details) {\n track.details.fragments.forEach(function (fragment) {\n fragment.loadCounter = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n AudioStreamController.prototype.onMediaSeeking = function onMediaSeeking() {\n if (this.state === audio_stream_controller_State.ENDED) {\n // switch to IDLE state to check for potential new fragment\n this.state = audio_stream_controller_State.IDLE;\n }\n if (this.media) {\n this.lastCurrentTime = this.media.currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // tick to speed up processing\n this.tick();\n };\n\n AudioStreamController.prototype.onMediaEnded = function onMediaEnded() {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n AudioStreamController.prototype.onAudioTracksUpdated = function onAudioTracksUpdated(data) {\n logger[\"b\" /* logger */].log('audio tracks updated');\n this.tracks = data.audioTracks;\n };\n\n AudioStreamController.prototype.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url;\n this.trackId = data.id;\n\n this.fragCurrent = null;\n this.state = audio_stream_controller_State.PAUSED;\n this.waitingFragment = null;\n // destroy useless demuxer when switching audio to main\n if (!altAudio) {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n } else {\n // switching to audio track, start timer if not already started\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n }\n\n //should we switch tracks ?\n if (altAudio) {\n this.audioSwitch = true;\n //main audio track are handled by stream-controller, just do something if switching to alt audio track\n this.state = audio_stream_controller_State.IDLE;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n }\n this.tick();\n };\n\n AudioStreamController.prototype.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n var newDetails = data.details,\n trackId = data.id,\n track = this.tracks[trackId],\n duration = newDetails.totalduration,\n sliding = 0;\n\n logger[\"b\" /* logger */].log('track ' + trackId + ' loaded [' + newDetails.startSN + ',' + newDetails.endSN + '],duration:' + duration);\n\n if (newDetails.live) {\n var curDetails = track.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n // TODO\n //this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown) {\n logger[\"b\" /* logger */].log('live audio playlist sliding:' + sliding.toFixed(3));\n } else {\n logger[\"b\" /* logger */].log('live audio playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger[\"b\" /* logger */].log('live audio playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n track.details = newDetails;\n\n // compute start position\n if (!this.startFragRequested) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (!isNaN(startTimeOffset)) {\n logger[\"b\" /* logger */].log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n this.startPosition = 0;\n }\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for track to start downloading a new fragment\n if (this.state === audio_stream_controller_State.WAITING_TRACK) {\n this.state = audio_stream_controller_State.IDLE;\n }\n //trigger handler right now\n this.tick();\n };\n\n AudioStreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === audio_stream_controller_State.KEY_LOADING) {\n this.state = audio_stream_controller_State.IDLE;\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n if (this.state === audio_stream_controller_State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'audio' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var track = this.tracks[this.trackId],\n details = track.details,\n duration = details.totalduration,\n trackId = fragCurrent.level,\n sn = fragCurrent.sn,\n cc = fragCurrent.cc,\n audioCodec = this.config.defaultAudioCodec || track.audioCodec || 'mp4a.40.2',\n stats = this.stats = data.stats;\n if (sn === 'initSegment') {\n this.state = audio_stream_controller_State.IDLE;\n\n stats.tparsed = stats.tbuffered = performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'audio' });\n this.tick();\n } else {\n this.state = audio_stream_controller_State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.appended = false;\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'audio');\n }\n //Check if we have video initPTS\n // If not we need to wait for it\n var initPTS = this.initPTS[cc];\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n if (details.initSegment || initPTS !== undefined) {\n this.pendingBuffering = true;\n logger[\"b\" /* logger */].log('Demuxing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],track ' + trackId);\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n var accurateTimeOffset = false; //details.PTSKnown || !details.live;\n this.demuxer.push(data.payload, initSegmentData, audioCodec, null, fragCurrent, duration, accurateTimeOffset, initPTS);\n } else {\n logger[\"b\" /* logger */].log('unknown video PTS for continuity counter ' + cc + ', waiting for video PTS before demuxing audio frag ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],track ' + trackId);\n this.waitingFragment = data;\n this.state = audio_stream_controller_State.WAITING_INIT_PTS;\n }\n }\n }\n this.fragLoadError = 0;\n };\n\n AudioStreamController.prototype.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n var tracks = data.tracks,\n track = void 0;\n\n // delete any video track found on audio demuxer\n if (tracks.video) {\n delete tracks.video;\n }\n\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n track.levelCodec = track.codec;\n track.id = data.id;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CODECS, tracks);\n logger[\"b\" /* logger */].log('audio track:audio,container:' + track.container + ',codecs[level/parsed]=[' + track.levelCodec + '/' + track.codec + ']');\n var initSegment = track.initSegment;\n if (initSegment) {\n var appendObj = { type: 'audio', data: initSegment, parent: 'audio', content: 'initSegment' };\n if (this.audioSwitch) {\n this.pendingData = [appendObj];\n } else {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n }\n }\n //trigger handler right now\n this.tick();\n }\n }\n };\n\n AudioStreamController.prototype.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && data.type === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n var trackId = this.trackId,\n track = this.tracks[trackId],\n hls = this.hls;\n\n if (isNaN(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n logger[\"b\" /* logger */].log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb);\n updateFragPTSDTS(track.details, fragCurrent, data.startPTS, data.endPTS);\n\n var audioSwitch = this.audioSwitch,\n media = this.media,\n appendOnBufferFlush = false;\n //Only flush audio from old audio tracks when PTS is known on new audio track\n if (audioSwitch && media) {\n if (media.readyState) {\n var currentTime = media.currentTime;\n logger[\"b\" /* logger */].log('switching audio track : currentTime:' + currentTime);\n if (currentTime >= data.startPTS) {\n logger[\"b\" /* logger */].log('switching audio track : flushing all audio');\n this.state = audio_stream_controller_State.BUFFER_FLUSHING;\n hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n appendOnBufferFlush = true;\n //Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n } else {\n //Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n }\n\n var pendingData = this.pendingData;\n if (!this.audioSwitch) {\n [data.data1, data.data2].forEach(function (buffer) {\n if (buffer && buffer.length) {\n pendingData.push({ type: data.type, data: buffer, parent: 'audio', content: 'data' });\n }\n });\n if (!appendOnBufferFlush && pendingData.length) {\n pendingData.forEach(function (appendObj) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (_this2.state === audio_stream_controller_State.PARSING) {\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n _this2.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n }\n });\n this.pendingData = [];\n this.appended = true;\n }\n }\n //trigger handler right now\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = audio_stream_controller_State.PARSED;\n this._checkAppendedParsed();\n }\n };\n\n AudioStreamController.prototype.onBufferReset = function onBufferReset() {\n // reset reference to sourcebuffers\n this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n };\n\n AudioStreamController.prototype.onBufferCreated = function onBufferCreated(data) {\n var audioTrack = data.tracks.audio;\n if (audioTrack) {\n this.mediaBuffer = audioTrack.buffer;\n this.loadedmetadata = true;\n }\n if (data.tracks.video) {\n this.videoBuffer = data.tracks.video.buffer;\n }\n };\n\n AudioStreamController.prototype.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'audio') {\n var state = this.state;\n if (state === audio_stream_controller_State.PARSING || state === audio_stream_controller_State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n this._checkAppendedParsed();\n }\n }\n };\n\n AudioStreamController.prototype._checkAppendedParsed = function _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === audio_stream_controller_State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent,\n stats = this.stats,\n hls = this.hls;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: frag, id: 'audio' });\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"b\" /* logger */].log('audio buffered : ' + timeRanges.toString(media.buffered));\n if (this.audioSwitch && this.appended) {\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: this.trackId });\n }\n this.state = audio_stream_controller_State.IDLE;\n }\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onError = function onError(data) {\n var frag = data.frag;\n // don't handle frag error not related to audio fragment\n if (frag && frag.type !== 'audio') {\n return;\n }\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n if (!data.fatal) {\n var loadError = this.fragLoadError;\n if (loadError) {\n loadError++;\n } else {\n loadError = 1;\n }\n var config = this.config;\n if (loadError <= config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // reset load counter to avoid frag loop loading error\n frag.loadCounter = 0;\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, loadError - 1) * config.fragLoadingRetryDelay, config.fragLoadingMaxRetryTimeout);\n logger[\"b\" /* logger */].warn('audioStreamController: frag loading failed, retry in ' + delay + ' ms');\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = audio_stream_controller_State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"b\" /* logger */].error('audioStreamController: ' + data.details + ' reaches max retry, redispatch as fatal ...');\n // switch error to fatal\n data.fatal = true;\n this.state = audio_stream_controller_State.ERROR;\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n case errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if (this.state !== audio_stream_controller_State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? audio_stream_controller_State.ERROR : audio_stream_controller_State.IDLE;\n logger[\"b\" /* logger */].warn('audioStreamController: ' + data.details + ' while loading frag,switch to ' + this.state + ' state ...');\n }\n break;\n case errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'audio' && (this.state === audio_stream_controller_State.PARSING || this.state === audio_stream_controller_State.PARSED)) {\n var media = this.mediaBuffer,\n currentTime = this.media.currentTime,\n mediaBuffered = media && buffer_helper.isBuffered(media, currentTime) && buffer_helper.isBuffered(media, currentTime + 0.5);\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n var _config = this.config;\n if (_config.maxMaxBufferLength >= _config.maxBufferLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n _config.maxMaxBufferLength /= 2;\n logger[\"b\" /* logger */].warn('audio:reduce max buffer length to ' + _config.maxMaxBufferLength + 's');\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * _config.fragLoadingLoopThreshold;\n }\n this.state = audio_stream_controller_State.IDLE;\n } else {\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 logger[\"b\" /* logger */].warn('buffer full error also media.currentTime is not buffered, flush audio buffer');\n this.fragCurrent = null;\n // flush everything\n this.state = audio_stream_controller_State.BUFFER_FLUSHING;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n }\n }\n break;\n default:\n break;\n }\n };\n\n AudioStreamController.prototype.onBufferFlushed = function onBufferFlushed() {\n var _this3 = this;\n\n var pendingData = this.pendingData;\n if (pendingData && pendingData.length) {\n logger[\"b\" /* logger */].log('appending pending audio data on Buffer Flushed');\n pendingData.forEach(function (appendObj) {\n _this3.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n });\n this.appended = true;\n this.pendingData = [];\n this.state = audio_stream_controller_State.PARSED;\n } else {\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = audio_stream_controller_State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n this.tick();\n }\n };\n\n audio_stream_controller__createClass(AudioStreamController, [{\n key: 'state',\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"b\" /* logger */].log('audio stream:' + previousState + '->' + nextState);\n }\n },\n get: function get() {\n return this._state;\n }\n }]);\n\n return AudioStreamController;\n}(event_handler);\n\n/* harmony default export */ var audio_stream_controller = (audio_stream_controller_AudioStreamController);\n// CONCATENATED MODULE: ./src/utils/vttcue.js\n/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* harmony default export */ var vttcue = ((function () {\n if (typeof window !== 'undefined' && window.VTTCue) {\n return window.VTTCue;\n }\n\n var autoKeyword = 'auto';\n var directionSetting = {\n '': true,\n lr: true,\n rl: true\n };\n var alignSetting = {\n start: true,\n middle: true,\n end: true,\n left: true,\n right: true\n };\n\n function findDirectionSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n\n function findAlignSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n\n function extend(obj) {\n var i = 1;\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n\n return obj;\n }\n\n function VTTCue(startTime, endTime, text) {\n var cue = this;\n var isIE8 = function () {\n if (typeof navigator === 'undefined') {\n return;\n }\n return (/MSIE\\s8\\.0/.test(navigator.userAgent)\n );\n }();\n var baseObj = {};\n\n if (isIE8) {\n cue = document.createElement('custom');\n } else {\n baseObj.enumerable = true;\n }\n\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n cue.hasBeenReset = false;\n\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = '';\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = '';\n var _snapToLines = true;\n var _line = 'auto';\n var _lineAlign = 'start';\n var _position = 50;\n var _positionAlign = 'middle';\n var _size = 50;\n var _align = 'middle';\n\n Object.defineProperty(cue, 'id', extend({}, baseObj, {\n get: function get() {\n return _id;\n },\n set: function set(value) {\n _id = '' + value;\n }\n }));\n\n Object.defineProperty(cue, 'pauseOnExit', extend({}, baseObj, {\n get: function get() {\n return _pauseOnExit;\n },\n set: function set(value) {\n _pauseOnExit = !!value;\n }\n }));\n\n Object.defineProperty(cue, 'startTime', extend({}, baseObj, {\n get: function get() {\n return _startTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('Start time must be set to a number.');\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'endTime', extend({}, baseObj, {\n get: function get() {\n return _endTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('End time must be set to a number.');\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'text', extend({}, baseObj, {\n get: function get() {\n return _text;\n },\n set: function set(value) {\n _text = '' + value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'region', extend({}, baseObj, {\n get: function get() {\n return _region;\n },\n set: function set(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'vertical', extend({}, baseObj, {\n get: function get() {\n return _vertical;\n },\n set: function set(value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'snapToLines', extend({}, baseObj, {\n get: function get() {\n return _snapToLines;\n },\n set: function set(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'line', extend({}, baseObj, {\n get: function get() {\n return _line;\n },\n set: function set(value) {\n if (typeof value !== 'number' && value !== autoKeyword) {\n throw new SyntaxError('An invalid number or illegal string was specified.');\n }\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'lineAlign', extend({}, baseObj, {\n get: function get() {\n return _lineAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'position', extend({}, baseObj, {\n get: function get() {\n return _position;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Position must be between 0 and 100.');\n }\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'positionAlign', extend({}, baseObj, {\n get: function get() {\n return _positionAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'size', extend({}, baseObj, {\n get: function get() {\n return _size;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Size must be between 0 and 100.');\n }\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'align', extend({}, baseObj, {\n get: function get() {\n return _align;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n\n /**\n * Other <track> spec defined properties\n */\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n cue.displayState = undefined;\n\n if (isIE8) {\n return cue;\n }\n }\n\n /**\n * VTTCue methods\n */\n\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n var WebVTT = window.WebVTT;\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n\n return VTTCue;\n})());\n// CONCATENATED MODULE: ./src/utils/vttparser.js\n/*\n * Source: https://github.com/mozilla/vtt.js/blob/master/dist/vtt.js#L1716\n */\n\n\n\nvar StringDecoder = function StringDecoder() {\n return {\n decode: function decode(data) {\n if (!data) {\n return '';\n }\n if (typeof data !== 'string') {\n throw new Error('Error - expected string data.');\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nfunction VTTParser() {\n this.window = window;\n this.state = 'INITIAL';\n this.buffer = '';\n this.decoder = new StringDecoder();\n this.regionList = [];\n}\n\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(':', ''), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = Object.create(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function set(k, v) {\n if (!this.get(k) && v !== '') {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function get(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function has(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function alt(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function integer(k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function percent(k, v) {\n var m;\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n\n// Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== 'string') {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\n\nvar defaults = new vttcue(0, 0, 0);\n// 'middle' was changed to 'center' in the spec: https://github.com/w3c/webvtt/pull/244\n// Safari doesn't yet support this change, but FF and Chrome do.\nvar center = defaults.align === 'middle' ? 'middle' : 'center';\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new Error('Malformed timestamp: ' + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, '');\n return ts;\n }\n\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'region':\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case 'vertical':\n settings.alt(k, v, ['rl', 'lr']);\n break;\n case 'line':\n var vals = v.split(','),\n vals0 = vals[0];\n settings.integer(k, vals0);\n if (settings.percent(k, vals0)) {\n settings.set('snapToLines', false);\n }\n settings.alt(k, vals0, ['auto']);\n if (vals.length === 2) {\n settings.alt('lineAlign', vals[1], ['start', center, 'end']);\n }\n break;\n case 'position':\n vals = v.split(',');\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt('positionAlign', vals[1], ['start', center, 'end', 'line-left', 'line-right', 'auto']);\n }\n break;\n case 'size':\n settings.percent(k, v);\n break;\n case 'align':\n settings.alt(k, v, ['start', center, 'end', 'left', 'right']);\n break;\n }\n }, /:/, /\\s/);\n\n // Apply default values for any missing fields.\n cue.region = settings.get('region', null);\n cue.vertical = settings.get('vertical', '');\n var line = settings.get('line', 'auto');\n if (line === 'auto' && defaults.line === -1) {\n // set numeric line number for Safari\n line = -1;\n }\n cue.line = line;\n cue.lineAlign = settings.get('lineAlign', 'start');\n cue.snapToLines = settings.get('snapToLines', true);\n cue.size = settings.get('size', 100);\n cue.align = settings.get('align', center);\n var position = settings.get('position', 'auto');\n if (position === 'auto' && defaults.position === 50) {\n // set numeric position for Safari\n position = cue.align === 'start' || cue.align === 'left' ? 0 : cue.align === 'end' || cue.align === 'right' ? 100 : 50;\n }\n cue.position = position;\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, '');\n }\n\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== '-->') {\n // (3) next characters must match '-->'\n throw new Error('Malformed time stamp (time stamps must be separated by \\'-->\\'): ' + oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\nfunction fixLineBreaks(input) {\n return input.replace(/<br(?: \\/)?>/gi, '\\n');\n}\n\nVTTParser.prototype = {\n parse: function parse(data) {\n var self = this;\n\n // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, { stream: true });\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n\n buffer = fixLineBreaks(buffer);\n\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'Region':\n // 3.3 WebVTT region metadata header syntax\n console.log('parse region', v);\n //parseRegion(v);\n break;\n }\n }, /:/);\n }\n\n // 5.1 WebVTT file parsing.\n try {\n var line;\n if (self.state === 'INITIAL') {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine();\n // strip of UTF-8 BOM if any\n // https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n var m = line.match(/^()?WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new Error('Malformed WebVTT signature.');\n }\n\n self.state = 'HEADER';\n }\n\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case 'HEADER':\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = 'ID';\n }\n continue;\n case 'NOTE':\n // Ignore NOTE blocks.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n case 'ID':\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = 'NOTE';\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new vttcue(0, 0, '');\n self.state = 'CUE';\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf('-->') === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /*falls through*/\n case 'CUE':\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = 'BADCUE';\n continue;\n }\n self.state = 'CUETEXT';\n continue;\n case 'CUETEXT':\n var hasSubstring = line.indexOf('-->') !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n if (self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n self.state = 'ID';\n continue;\n }\n if (self.cue.text) {\n self.cue.text += '\\n';\n }\n self.cue.text += line;\n continue;\n case 'BADCUE':\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n }\n }\n } catch (e) {\n\n // If we are currently parsing a cue, report what we have.\n if (self.state === 'CUETEXT' && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === 'INITIAL' ? 'BADWEBVTT' : 'BADCUE';\n }\n return this;\n },\n flush: function flush() {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === 'HEADER') {\n self.buffer += '\\n\\n';\n self.parse();\n }\n // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n if (self.state === 'INITIAL') {\n throw new Error('Malformed WebVTT signature.');\n }\n } catch (e) {\n throw e;\n }\n if (self.onflush) {\n self.onflush();\n }\n return this;\n }\n};\n\n\n\n/* harmony default export */ var vttparser = (VTTParser);\n// CONCATENATED MODULE: ./src/utils/cues.js\n\n\nfunction newCue(track, startTime, endTime, captionScreen) {\n var row;\n var cue;\n var indenting;\n var indent;\n var text;\n var VTTCue = window.VTTCue || window.TextTrackCue;\n\n for (var r = 0; r < captionScreen.rows.length; r++) {\n row = captionScreen.rows[r];\n indenting = true;\n indent = 0;\n text = '';\n\n if (!row.isEmpty()) {\n for (var c = 0; c < row.chars.length; c++) {\n if (row.chars[c].uchar.match(/\\s/) && indenting) {\n indent++;\n } else {\n text += row.chars[c].uchar;\n indenting = false;\n }\n }\n //To be used for cleaning-up orphaned roll-up captions\n row.cueStartTime = startTime;\n\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n\n cue = new VTTCue(startTime, endTime, fixLineBreaks(text.trim()));\n\n if (indent >= 16) {\n indent--;\n } else {\n indent++;\n }\n\n // VTTCue.line get's flakey when using controls, so let's now include line 13&14\n // also, drop line 1 since it's to close to the top\n if (navigator.userAgent.match(/Firefox\\//)) {\n cue.line = r + 1;\n } else {\n cue.line = r > 7 ? r - 2 : r + 1;\n }\n cue.align = 'left';\n // Clamp the position between 0 and 100 - if out of these bounds, Firefox throws an exception and captions break\n cue.position = Math.max(0, Math.min(100, 100 * (indent / 32) + (navigator.userAgent.match(/Firefox\\//) ? 50 : 0)));\n track.addCue(cue);\n }\n }\n}\n// CONCATENATED MODULE: ./src/utils/cea-608-parser.js\nfunction cea_608_parser__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\n\nvar specialCea608CharsCodes = {\n 0x2a: 0xe1, // lowercase a, acute accent\n 0x5c: 0xe9, // lowercase e, acute accent\n 0x5e: 0xed, // lowercase i, acute accent\n 0x5f: 0xf3, // lowercase o, acute accent\n 0x60: 0xfa, // lowercase u, acute accent\n 0x7b: 0xe7, // lowercase c with cedilla\n 0x7c: 0xf7, // division symbol\n 0x7d: 0xd1, // uppercase N tilde\n 0x7e: 0xf1, // lowercase n tilde\n 0x7f: 0x2588, // Full block\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae, // Registered symbol (R)\n 0x81: 0xb0, // degree sign\n 0x82: 0xbd, // 1/2 symbol\n 0x83: 0xbf, // Inverted (open) question mark\n 0x84: 0x2122, // Trademark symbol (TM)\n 0x85: 0xa2, // Cents symbol\n 0x86: 0xa3, // Pounds sterling\n 0x87: 0x266a, // Music 8'th note\n 0x88: 0xe0, // lowercase a, grave accent\n 0x89: 0x20, // transparent space (regular)\n 0x8a: 0xe8, // lowercase e, grave accent\n 0x8b: 0xe2, // lowercase a, circumflex accent\n 0x8c: 0xea, // lowercase e, circumflex accent\n 0x8d: 0xee, // lowercase i, circumflex accent\n 0x8e: 0xf4, // lowercase o, circumflex accent\n 0x8f: 0xfb, // lowercase u, circumflex accent\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1, // capital letter A with acute\n 0x91: 0xc9, // capital letter E with acute\n 0x92: 0xd3, // capital letter O with acute\n 0x93: 0xda, // capital letter U with acute\n 0x94: 0xdc, // capital letter U with diaresis\n 0x95: 0xfc, // lowercase letter U with diaeresis\n 0x96: 0x2018, // opening single quote\n 0x97: 0xa1, // inverted exclamation mark\n 0x98: 0x2a, // asterisk\n 0x99: 0x2019, // closing single quote\n 0x9a: 0x2501, // box drawings heavy horizontal\n 0x9b: 0xa9, // copyright sign\n 0x9c: 0x2120, // Service mark\n 0x9d: 0x2022, // (round) bullet\n 0x9e: 0x201c, // Left double quotation mark\n 0x9f: 0x201d, // Right double quotation mark\n 0xa0: 0xc0, // uppercase A, grave accent\n 0xa1: 0xc2, // uppercase A, circumflex\n 0xa2: 0xc7, // uppercase C with cedilla\n 0xa3: 0xc8, // uppercase E, grave accent\n 0xa4: 0xca, // uppercase E, circumflex\n 0xa5: 0xcb, // capital letter E with diaresis\n 0xa6: 0xeb, // lowercase letter e with diaresis\n 0xa7: 0xce, // uppercase I, circumflex\n 0xa8: 0xcf, // uppercase I, with diaresis\n 0xa9: 0xef, // lowercase i, with diaresis\n 0xaa: 0xd4, // uppercase O, circumflex\n 0xab: 0xd9, // uppercase U, grave accent\n 0xac: 0xf9, // lowercase u, grave accent\n 0xad: 0xdb, // uppercase U, circumflex\n 0xae: 0xab, // left-pointing double angle quotation mark\n 0xaf: 0xbb, // right-pointing double angle quotation mark\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3, // Uppercase A, tilde\n 0xb1: 0xe3, // Lowercase a, tilde\n 0xb2: 0xcd, // Uppercase I, acute accent\n 0xb3: 0xcc, // Uppercase I, grave accent\n 0xb4: 0xec, // Lowercase i, grave accent\n 0xb5: 0xd2, // Uppercase O, grave accent\n 0xb6: 0xf2, // Lowercase o, grave accent\n 0xb7: 0xd5, // Uppercase O, tilde\n 0xb8: 0xf5, // Lowercase o, tilde\n 0xb9: 0x7b, // Open curly brace\n 0xba: 0x7d, // Closing curly brace\n 0xbb: 0x5c, // Backslash\n 0xbc: 0x5e, // Caret\n 0xbd: 0x5f, // Underscore\n 0xbe: 0x7c, // Pipe (vertical line)\n 0xbf: 0x223c, // Tilde operator\n 0xc0: 0xc4, // Uppercase A, umlaut\n 0xc1: 0xe4, // Lowercase A, umlaut\n 0xc2: 0xd6, // Uppercase O, umlaut\n 0xc3: 0xf6, // Lowercase o, umlaut\n 0xc4: 0xdf, // Esszett (sharp S)\n 0xc5: 0xa5, // Yen symbol\n 0xc6: 0xa4, // Generic currency sign\n 0xc7: 0x2503, // Box drawings heavy vertical\n 0xc8: 0xc5, // Uppercase A, ring\n 0xc9: 0xe5, // Lowercase A, ring\n 0xca: 0xd8, // Uppercase O, stroke\n 0xcb: 0xf8, // Lowercase o, strok\n 0xcc: 0x250f, // Box drawings heavy down and right\n 0xcd: 0x2513, // Box drawings heavy down and left\n 0xce: 0x2517, // Box drawings heavy up and right\n 0xcf: 0x251b // Box drawings heavy up and left\n};\n\n/**\n * Utils\n */\nvar getCharForByte = function getCharForByte(byte) {\n var charCode = byte;\n if (specialCea608CharsCodes.hasOwnProperty(byte)) {\n charCode = specialCea608CharsCodes[byte];\n }\n return String.fromCharCode(charCode);\n};\n\nvar NR_ROWS = 15,\n NR_COLS = 100;\n// Tables to look up row from PAC data\nvar rowsLowCh1 = { 0x11: 1, 0x12: 3, 0x15: 5, 0x16: 7, 0x17: 9, 0x10: 11, 0x13: 12, 0x14: 14 };\nvar rowsHighCh1 = { 0x11: 2, 0x12: 4, 0x15: 6, 0x16: 8, 0x17: 10, 0x13: 13, 0x14: 15 };\nvar rowsLowCh2 = { 0x19: 1, 0x1A: 3, 0x1D: 5, 0x1E: 7, 0x1F: 9, 0x18: 11, 0x1B: 12, 0x1C: 14 };\nvar rowsHighCh2 = { 0x19: 2, 0x1A: 4, 0x1D: 6, 0x1E: 8, 0x1F: 10, 0x1B: 13, 0x1C: 15 };\n\nvar backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent'];\n\n/**\n * Simple logger class to be able to write with time-stamps and filter on level.\n */\nvar cea_608_parser_logger = {\n verboseFilter: { 'DATA': 3, 'DEBUG': 3, 'INFO': 2, 'WARNING': 2, 'TEXT': 1, 'ERROR': 0 },\n time: null,\n verboseLevel: 0, // Only write errors\n setTime: function setTime(newTime) {\n this.time = newTime;\n },\n log: function log(severity, msg) {\n var minLevel = this.verboseFilter[severity];\n if (this.verboseLevel >= minLevel) {\n console.log(this.time + ' [' + severity + '] ' + msg);\n }\n }\n};\n\nvar numArrayToHexArray = function numArrayToHexArray(numArray) {\n var hexArray = [];\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n return hexArray;\n};\n\nvar PenState = function () {\n function PenState(foreground, underline, italics, background, flash) {\n cea_608_parser__classCallCheck(this, PenState);\n\n this.foreground = foreground || 'white';\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || 'black';\n this.flash = flash || false;\n }\n\n PenState.prototype.reset = function reset() {\n this.foreground = 'white';\n this.underline = false;\n this.italics = false;\n this.background = 'black';\n this.flash = false;\n };\n\n PenState.prototype.setStyles = function setStyles(styles) {\n var attribs = ['foreground', 'underline', 'italics', 'background', 'flash'];\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n };\n\n PenState.prototype.isDefault = function isDefault() {\n return this.foreground === 'white' && !this.underline && !this.italics && this.background === 'black' && !this.flash;\n };\n\n PenState.prototype.equals = function equals(other) {\n return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash;\n };\n\n PenState.prototype.copy = function copy(newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n };\n\n PenState.prototype.toString = function toString() {\n return 'color=' + this.foreground + ', underline=' + this.underline + ', italics=' + this.italics + ', background=' + this.background + ', flash=' + this.flash;\n };\n\n return PenState;\n}();\n\n/**\n * Unicode character with styling and background.\n * @constructor\n */\n\n\nvar StyledUnicodeChar = function () {\n function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n cea_608_parser__classCallCheck(this, StyledUnicodeChar);\n\n this.uchar = uchar || ' '; // unicode character\n this.penState = new PenState(foreground, underline, italics, background, flash);\n }\n\n StyledUnicodeChar.prototype.reset = function reset() {\n this.uchar = ' ';\n this.penState.reset();\n };\n\n StyledUnicodeChar.prototype.setChar = function setChar(uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n };\n\n StyledUnicodeChar.prototype.setPenState = function setPenState(newPenState) {\n this.penState.copy(newPenState);\n };\n\n StyledUnicodeChar.prototype.equals = function equals(other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n };\n\n StyledUnicodeChar.prototype.copy = function copy(newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n };\n\n StyledUnicodeChar.prototype.isEmpty = function isEmpty() {\n return this.uchar === ' ' && this.penState.isDefault();\n };\n\n return StyledUnicodeChar;\n}();\n\n/**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\n\n\nvar Row = function () {\n function Row() {\n cea_608_parser__classCallCheck(this, Row);\n\n this.chars = [];\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n this.pos = 0;\n this.currPenState = new PenState();\n }\n\n Row.prototype.equals = function equals(other) {\n var equal = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n\n Row.prototype.copy = function copy(other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n };\n\n Row.prototype.isEmpty = function isEmpty() {\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n\n /**\n * Set the cursor to a valid column.\n */\n\n\n Row.prototype.setCursor = function setCursor(absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n if (this.pos < 0) {\n cea_608_parser_logger.log('ERROR', 'Negative cursor position ' + this.pos);\n this.pos = 0;\n } else if (this.pos > NR_COLS) {\n cea_608_parser_logger.log('ERROR', 'Too large cursor position ' + this.pos);\n this.pos = NR_COLS;\n }\n };\n\n /**\n * Move the cursor relative to current position.\n */\n\n\n Row.prototype.moveCursor = function moveCursor(relPos) {\n var newPos = this.pos + relPos;\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n this.setCursor(newPos);\n };\n\n /**\n * Backspace, move one step back and clear character.\n */\n\n\n Row.prototype.backSpace = function backSpace() {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(' ', this.currPenState);\n };\n\n Row.prototype.insertChar = function insertChar(byte) {\n if (byte >= 0x90) {\n //Extended char\n this.backSpace();\n }\n var char = getCharForByte(byte);\n if (this.pos >= NR_COLS) {\n cea_608_parser_logger.log('ERROR', 'Cannot insert ' + byte.toString(16) + ' (' + char + ') at position ' + this.pos + '. Skipping it!');\n return;\n }\n this.chars[this.pos].setChar(char, this.currPenState);\n this.moveCursor(1);\n };\n\n Row.prototype.clearFromPos = function clearFromPos(startPos) {\n var i;\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n };\n\n Row.prototype.clear = function clear() {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n };\n\n Row.prototype.clearToEndOfRow = function clearToEndOfRow() {\n this.clearFromPos(this.pos);\n };\n\n Row.prototype.getTextString = function getTextString() {\n var chars = [];\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n var char = this.chars[i].uchar;\n if (char !== ' ') {\n empty = false;\n }\n chars.push(char);\n }\n if (empty) {\n return '';\n } else {\n return chars.join('');\n }\n };\n\n Row.prototype.setPenStyles = function setPenStyles(styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n };\n\n return Row;\n}();\n\n/**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n*/\n\n\nvar CaptionScreen = function () {\n function CaptionScreen() {\n cea_608_parser__classCallCheck(this, CaptionScreen);\n\n this.rows = [];\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row()); // Note that we use zero-based numbering (0-14)\n }\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.reset();\n }\n\n CaptionScreen.prototype.reset = function reset() {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n this.currRow = NR_ROWS - 1;\n };\n\n CaptionScreen.prototype.equals = function equals(other) {\n var equal = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n\n CaptionScreen.prototype.copy = function copy(other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n };\n\n CaptionScreen.prototype.isEmpty = function isEmpty() {\n var empty = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n\n CaptionScreen.prototype.backSpace = function backSpace() {\n var row = this.rows[this.currRow];\n row.backSpace();\n };\n\n CaptionScreen.prototype.clearToEndOfRow = function clearToEndOfRow() {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n };\n\n /**\n * Insert a character (without styling) in the current row.\n */\n\n\n CaptionScreen.prototype.insertChar = function insertChar(char) {\n var row = this.rows[this.currRow];\n row.insertChar(char);\n };\n\n CaptionScreen.prototype.setPen = function setPen(styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n };\n\n CaptionScreen.prototype.moveCursor = function moveCursor(relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n };\n\n CaptionScreen.prototype.setCursor = function setCursor(absPos) {\n cea_608_parser_logger.log('INFO', 'setCursor: ' + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n };\n\n CaptionScreen.prototype.setPAC = function setPAC(pacData) {\n cea_608_parser_logger.log('INFO', 'pacData = ' + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n }\n\n //Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n if (this.nrRollUpRows && this.currRow !== newRow) {\n //clear all rows first\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n\n //Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n //topRowIndex - the start of rows to copy (inclusive index)\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n //We only copy if the last position was already shown.\n //We use the cueStartTime value to check this.\n var lastOutputScreen = this.lastOutputScreen;\n if (lastOutputScreen) {\n var prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime;\n if (prevLineTime && prevLineTime < cea_608_parser_logger.time) {\n for (var _i = 0; _i < this.nrRollUpRows; _i++) {\n this.rows[newRow - this.nrRollUpRows + _i + 1].copy(lastOutputScreen.rows[topRowIndex + _i]);\n }\n }\n }\n }\n\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n var styles = { foreground: pacData.color, underline: pacData.underline, italics: pacData.italics, background: 'black', flash: false };\n this.setPen(styles);\n };\n\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n\n\n CaptionScreen.prototype.setBkgData = function setBkgData(bkgData) {\n\n cea_608_parser_logger.log('INFO', 'bkgData = ' + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); //Space\n };\n\n CaptionScreen.prototype.setRollUpRows = function setRollUpRows(nrRows) {\n this.nrRollUpRows = nrRows;\n };\n\n CaptionScreen.prototype.rollUp = function rollUp() {\n if (this.nrRollUpRows === null) {\n cea_608_parser_logger.log('DEBUG', 'roll_up but nrRollUpRows not set yet');\n return; //Not properly setup\n }\n cea_608_parser_logger.log('TEXT', this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n cea_608_parser_logger.log('INFO', 'Rolling up');\n //logger.log('TEXT', this.get_display_text())\n };\n\n /**\n * Get all non-empty rows with as unicode text.\n */\n\n\n CaptionScreen.prototype.getDisplayText = function getDisplayText(asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = '';\n var rowNr = -1;\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n if (rowText) {\n rowNr = i + 1;\n if (asOneRow) {\n displayText.push('Row ' + rowNr + ': \\'' + rowText + '\\'');\n } else {\n displayText.push(rowText.trim());\n }\n }\n }\n if (displayText.length > 0) {\n if (asOneRow) {\n text = '[' + displayText.join(' | ') + ']';\n } else {\n text = displayText.join('\\n');\n }\n }\n return text;\n };\n\n CaptionScreen.prototype.getTextAndFormat = function getTextAndFormat() {\n return this.rows;\n };\n\n return CaptionScreen;\n}();\n\n//var modes = ['MODE_ROLL-UP', 'MODE_POP-ON', 'MODE_PAINT-ON', 'MODE_TEXT'];\n\nvar Cea608Channel = function () {\n function Cea608Channel(channelNumber, outputFilter) {\n cea_608_parser__classCallCheck(this, Cea608Channel);\n\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen();\n this.nonDisplayedMemory = new CaptionScreen();\n this.lastOutputScreen = new CaptionScreen();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n }\n\n Cea608Channel.prototype.reset = function reset() {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n this.lastCueEndTime = null;\n };\n\n Cea608Channel.prototype.getHandler = function getHandler() {\n return this.outputFilter;\n };\n\n Cea608Channel.prototype.setHandler = function setHandler(newHandler) {\n this.outputFilter = newHandler;\n };\n\n Cea608Channel.prototype.setPAC = function setPAC(pacData) {\n this.writeScreen.setPAC(pacData);\n };\n\n Cea608Channel.prototype.setBkgData = function setBkgData(bkgData) {\n this.writeScreen.setBkgData(bkgData);\n };\n\n Cea608Channel.prototype.setMode = function setMode(newMode) {\n if (newMode === this.mode) {\n return;\n }\n this.mode = newMode;\n cea_608_parser_logger.log('INFO', 'MODE=' + newMode);\n if (this.mode === 'MODE_POP-ON') {\n this.writeScreen = this.nonDisplayedMemory;\n } else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n if (this.mode !== 'MODE_ROLL-UP') {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n this.mode = newMode;\n };\n\n Cea608Channel.prototype.insertChars = function insertChars(chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n var screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';\n cea_608_parser_logger.log('INFO', screen + ': ' + this.writeScreen.getDisplayText(true));\n if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n cea_608_parser_logger.log('TEXT', 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n };\n\n Cea608Channel.prototype.ccRCL = function ccRCL() {\n // Resume Caption Loading (switch mode to Pop On)\n cea_608_parser_logger.log('INFO', 'RCL - Resume Caption Loading');\n this.setMode('MODE_POP-ON');\n };\n\n Cea608Channel.prototype.ccBS = function ccBS() {\n // BackSpace\n cea_608_parser_logger.log('INFO', 'BS - BackSpace');\n if (this.mode === 'MODE_TEXT') {\n return;\n }\n this.writeScreen.backSpace();\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n };\n\n Cea608Channel.prototype.ccAOF = function ccAOF() {\n // Reserved (formerly Alarm Off)\n return;\n };\n\n Cea608Channel.prototype.ccAON = function ccAON() {\n // Reserved (formerly Alarm On)\n return;\n };\n\n Cea608Channel.prototype.ccDER = function ccDER() {\n // Delete to End of Row\n cea_608_parser_logger.log('INFO', 'DER- Delete to End of Row');\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n };\n\n Cea608Channel.prototype.ccRU = function ccRU(nrRows) {\n //Roll-Up Captions-2,3,or 4 Rows\n cea_608_parser_logger.log('INFO', 'RU(' + nrRows + ') - Roll Up');\n this.writeScreen = this.displayedMemory;\n this.setMode('MODE_ROLL-UP');\n this.writeScreen.setRollUpRows(nrRows);\n };\n\n Cea608Channel.prototype.ccFON = function ccFON() {\n //Flash On\n cea_608_parser_logger.log('INFO', 'FON - Flash On');\n this.writeScreen.setPen({ flash: true });\n };\n\n Cea608Channel.prototype.ccRDC = function ccRDC() {\n // Resume Direct Captioning (switch mode to PaintOn)\n cea_608_parser_logger.log('INFO', 'RDC - Resume Direct Captioning');\n this.setMode('MODE_PAINT-ON');\n };\n\n Cea608Channel.prototype.ccTR = function ccTR() {\n // Text Restart in text mode (not supported, however)\n cea_608_parser_logger.log('INFO', 'TR');\n this.setMode('MODE_TEXT');\n };\n\n Cea608Channel.prototype.ccRTD = function ccRTD() {\n // Resume Text Display in Text mode (not supported, however)\n cea_608_parser_logger.log('INFO', 'RTD');\n this.setMode('MODE_TEXT');\n };\n\n Cea608Channel.prototype.ccEDM = function ccEDM() {\n // Erase Displayed Memory\n cea_608_parser_logger.log('INFO', 'EDM - Erase Displayed Memory');\n this.displayedMemory.reset();\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccCR = function ccCR() {\n // Carriage Return\n cea_608_parser_logger.log('CR - Carriage Return');\n this.writeScreen.rollUp();\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccENM = function ccENM() {\n //Erase Non-Displayed Memory\n cea_608_parser_logger.log('INFO', 'ENM - Erase Non-displayed Memory');\n this.nonDisplayedMemory.reset();\n };\n\n Cea608Channel.prototype.ccEOC = function ccEOC() {\n //End of Caption (Flip Memories)\n cea_608_parser_logger.log('INFO', 'EOC - End Of Caption');\n if (this.mode === 'MODE_POP-ON') {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n cea_608_parser_logger.log('TEXT', 'DISP: ' + this.displayedMemory.getDisplayText());\n }\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccTO = function ccTO(nrCols) {\n // Tab Offset 1,2, or 3 columns\n cea_608_parser_logger.log('INFO', 'TO(' + nrCols + ') - Tab Offset');\n this.writeScreen.moveCursor(nrCols);\n };\n\n Cea608Channel.prototype.ccMIDROW = function ccMIDROW(secondByte) {\n // Parse MIDROW command\n var styles = { flash: false };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta'];\n styles.foreground = colors[colorIndex];\n } else {\n styles.foreground = 'white';\n }\n cea_608_parser_logger.log('INFO', 'MIDROW: ' + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n };\n\n Cea608Channel.prototype.outputDataUpdate = function outputDataUpdate() {\n var dispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var t = cea_608_parser_logger.time;\n if (t === null) {\n return;\n }\n if (this.outputFilter) {\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n // Start of a new cue\n this.cueStartTime = t;\n } else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen);\n if (dispatch === true && this.outputFilter.dispatchCue) {\n this.outputFilter.dispatchCue();\n }\n }\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : t;\n }\n }\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n };\n\n Cea608Channel.prototype.cueSplitAtTime = function cueSplitAtTime(t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n this.cueStartTime = t;\n }\n }\n };\n\n return Cea608Channel;\n}();\n\nvar Cea608Parser = function () {\n function Cea608Parser(field, out1, out2) {\n cea_608_parser__classCallCheck(this, Cea608Parser);\n\n this.field = field || 1;\n this.outputs = [out1, out2];\n this.channels = [new Cea608Channel(1, out1), new Cea608Channel(2, out2)];\n this.currChNr = -1; // Will be 1 or 2\n this.lastCmdA = null; // First byte of last command\n this.lastCmdB = null; // Second byte of last command\n this.bufferedData = [];\n this.startTime = null;\n this.lastTime = null;\n this.dataCounters = { 'padding': 0, 'char': 0, 'cmd': 0, 'other': 0 };\n }\n\n Cea608Parser.prototype.getHandler = function getHandler(index) {\n return this.channels[index].getHandler();\n };\n\n Cea608Parser.prototype.setHandler = function setHandler(index, newHandler) {\n this.channels[index].setHandler(newHandler);\n };\n\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n\n\n Cea608Parser.prototype.addData = function addData(t, byteList) {\n var cmdFound,\n a,\n b,\n charsFound = false;\n\n this.lastTime = t;\n cea_608_parser_logger.setTime(t);\n\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n if (a === 0 && b === 0) {\n this.dataCounters.padding += 2;\n continue;\n } else {\n cea_608_parser_logger.log('DATA', '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');\n }\n cmdFound = this.parseCmd(a, b);\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n if (charsFound) {\n if (this.currChNr && this.currChNr >= 0) {\n var channel = this.channels[this.currChNr - 1];\n channel.insertChars(charsFound);\n } else {\n cea_608_parser_logger.log('WARNING', 'No channel found yet. TEXT-MODE?');\n }\n }\n }\n if (cmdFound) {\n this.dataCounters.cmd += 2;\n } else if (charsFound) {\n this.dataCounters.char += 2;\n } else {\n this.dataCounters.other += 2;\n cea_608_parser_logger.log('WARNING', 'Couldn\\'t parse cleaned data ' + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n };\n\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n\n\n Cea608Parser.prototype.parseCmd = function parseCmd(a, b) {\n var chNr = null;\n\n var cond1 = (a === 0x14 || a === 0x1C) && 0x20 <= b && b <= 0x2F;\n var cond2 = (a === 0x17 || a === 0x1F) && 0x21 <= b && b <= 0x23;\n if (!(cond1 || cond2)) {\n return false;\n }\n\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null; // Repeated commands are dropped (once)\n cea_608_parser_logger.log('DEBUG', 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');\n return true;\n }\n\n if (a === 0x14 || a === 0x17) {\n chNr = 1;\n } else {\n chNr = 2; // (a === 0x1C || a=== 0x1f)\n }\n\n var channel = this.channels[chNr - 1];\n\n if (a === 0x14 || a === 0x1C) {\n if (b === 0x20) {\n channel.ccRCL();\n } else if (b === 0x21) {\n channel.ccBS();\n } else if (b === 0x22) {\n channel.ccAOF();\n } else if (b === 0x23) {\n channel.ccAON();\n } else if (b === 0x24) {\n channel.ccDER();\n } else if (b === 0x25) {\n channel.ccRU(2);\n } else if (b === 0x26) {\n channel.ccRU(3);\n } else if (b === 0x27) {\n channel.ccRU(4);\n } else if (b === 0x28) {\n channel.ccFON();\n } else if (b === 0x29) {\n channel.ccRDC();\n } else if (b === 0x2A) {\n channel.ccTR();\n } else if (b === 0x2B) {\n channel.ccRTD();\n } else if (b === 0x2C) {\n channel.ccEDM();\n } else if (b === 0x2D) {\n channel.ccCR();\n } else if (b === 0x2E) {\n channel.ccENM();\n } else if (b === 0x2F) {\n channel.ccEOC();\n }\n } else {\n //a == 0x17 || a == 0x1F\n channel.ccTO(b - 0x20);\n }\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n\n\n Cea608Parser.prototype.parseMidrow = function parseMidrow(a, b) {\n var chNr = null;\n\n if ((a === 0x11 || a === 0x19) && 0x20 <= b && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n } else {\n chNr = 2;\n }\n if (chNr !== this.currChNr) {\n cea_608_parser_logger.log('ERROR', 'Mismatch channel in midrow parsing');\n return false;\n }\n var channel = this.channels[chNr - 1];\n channel.ccMIDROW(b);\n cea_608_parser_logger.log('DEBUG', 'MIDROW (' + numArrayToHexArray([a, b]) + ')');\n return true;\n }\n return false;\n };\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n\n\n Cea608Parser.prototype.parsePAC = function parsePAC(a, b) {\n\n var chNr = null;\n var row = null;\n\n var case1 = (0x11 <= a && a <= 0x17 || 0x19 <= a && a <= 0x1F) && 0x40 <= b && b <= 0x7F;\n var case2 = (a === 0x10 || a === 0x18) && 0x40 <= b && b <= 0x5F;\n if (!(case1 || case2)) {\n return false;\n }\n\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true; // Repeated commands are dropped (once)\n }\n\n chNr = a <= 0x17 ? 1 : 2;\n\n if (0x40 <= b && b <= 0x5F) {\n row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];\n } else {\n // 0x60 <= b <= 0x7F\n row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n var pacData = this.interpretPAC(row, b);\n var channel = this.channels[chNr - 1];\n channel.setPAC(pacData);\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n\n\n Cea608Parser.prototype.interpretPAC = function interpretPAC(row, byte) {\n var pacIndex = byte;\n var pacData = { color: null, italics: false, indent: null, underline: false, row: row };\n\n if (byte > 0x5F) {\n pacIndex = byte - 0x60;\n } else {\n pacIndex = byte - 0x40;\n }\n pacData.underline = (pacIndex & 1) === 1;\n if (pacIndex <= 0xd) {\n pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)];\n } else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = 'white';\n } else {\n pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4;\n }\n return pacData; // Note that row has zero offset. The spec uses 1.\n };\n\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n\n\n Cea608Parser.prototype.parseChars = function parseChars(a, b) {\n\n var channelNr = null,\n charCodes = null,\n charCode1 = null;\n\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n } else {\n channelNr = 1;\n charCode1 = a;\n }\n if (0x11 <= charCode1 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n } else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n } else {\n oneCode = b + 0x90;\n }\n cea_608_parser_logger.log('INFO', 'Special char \\'' + getCharForByte(oneCode) + '\\' in channel ' + channelNr);\n charCodes = [oneCode];\n } else if (0x20 <= a && a <= 0x7f) {\n charCodes = b === 0 ? [a] : [a, b];\n }\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n cea_608_parser_logger.log('DEBUG', 'Char codes = ' + hexCodes.join(','));\n this.lastCmdA = null;\n this.lastCmdB = null;\n }\n return charCodes;\n };\n\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns{Boolean} Tells if background attributes are found\n */\n\n\n Cea608Parser.prototype.parseBackgroundAttributes = function parseBackgroundAttributes(a, b) {\n var bkgData, index, chNr, channel;\n\n var case1 = (a === 0x10 || a === 0x18) && 0x20 <= b && b <= 0x2f;\n var case2 = (a === 0x17 || a === 0x1f) && 0x2d <= b && b <= 0x2f;\n if (!(case1 || case2)) {\n return false;\n }\n bkgData = {};\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + '_semi';\n }\n } else if (b === 0x2d) {\n bkgData.background = 'transparent';\n } else {\n bkgData.foreground = 'black';\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n chNr = a < 0x18 ? 1 : 2;\n channel = this.channels[chNr - 1];\n channel.setBkgData(bkgData);\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true;\n };\n\n /**\n * Reset state of parser and its channels.\n */\n\n\n Cea608Parser.prototype.reset = function reset() {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].reset();\n }\n }\n this.lastCmdA = null;\n this.lastCmdB = null;\n };\n\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n\n\n Cea608Parser.prototype.cueSplitAtTime = function cueSplitAtTime(t) {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].cueSplitAtTime(t);\n }\n }\n };\n\n return Cea608Parser;\n}();\n\n/* harmony default export */ var cea_608_parser = (Cea608Parser);\n// CONCATENATED MODULE: ./src/utils/output-filter.js\nfunction output_filter__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar OutputFilter = function () {\n function OutputFilter(timelineController, track) {\n output_filter__classCallCheck(this, OutputFilter);\n\n this.timelineController = timelineController;\n this.track = track;\n this.startTime = null;\n this.endTime = null;\n this.screen = null;\n }\n\n OutputFilter.prototype.dispatchCue = function dispatchCue() {\n if (this.startTime === null) {\n return;\n }\n this.timelineController.addCues('textTrack' + this.track, this.startTime, this.endTime, this.screen);\n this.startTime = null;\n };\n\n OutputFilter.prototype.newCue = function newCue(startTime, endTime, screen) {\n if (this.startTime === null || this.startTime > startTime) {\n this.startTime = startTime;\n }\n this.endTime = endTime;\n this.screen = screen;\n this.timelineController.createCaptionsTrack(this.track);\n };\n\n return OutputFilter;\n}();\n\n/* harmony default export */ var output_filter = (OutputFilter);\n// CONCATENATED MODULE: ./src/utils/webvtt-parser.js\n\n\n\n// String.prototype.startsWith is not supported in IE11\nvar startsWith = function startsWith(inputString, searchString, position) {\n return inputString.substr(position || 0, searchString.length) === searchString;\n};\n\nvar cueString2millis = function cueString2millis(timeString) {\n var ts = parseInt(timeString.substr(-3));\n var secs = parseInt(timeString.substr(-6, 2));\n var mins = parseInt(timeString.substr(-9, 2));\n var hours = timeString.length > 9 ? parseInt(timeString.substr(0, timeString.indexOf(':'))) : 0;\n\n if (isNaN(ts) || isNaN(secs) || isNaN(mins) || isNaN(hours)) {\n return -1;\n }\n\n ts += 1000 * secs;\n ts += 60 * 1000 * mins;\n ts += 60 * 60 * 1000 * hours;\n\n return ts;\n};\n\n// From https://github.com/darkskyapp/string-hash\nvar hash = function hash(text) {\n var hash = 5381;\n var i = text.length;\n while (i) {\n hash = hash * 33 ^ text.charCodeAt(--i);\n }\n return (hash >>> 0).toString();\n};\n\nvar calculateOffset = function calculateOffset(vttCCs, cc, presentationTime) {\n var currCC = vttCCs[cc];\n var prevCC = vttCCs[currCC.prevCC];\n\n // This is the first discontinuity or cues have been processed since the last discontinuity\n // Offset = current discontinuity time\n if (!prevCC || !prevCC.new && currCC.new) {\n vttCCs.ccOffset = vttCCs.presentationOffset = currCC.start;\n currCC.new = false;\n return;\n }\n\n // There have been discontinuities since cues were last parsed.\n // Offset = time elapsed\n while (prevCC && prevCC.new) {\n vttCCs.ccOffset += currCC.start - prevCC.start;\n currCC.new = false;\n currCC = prevCC;\n prevCC = vttCCs[currCC.prevCC];\n }\n\n vttCCs.presentationOffset = presentationTime;\n};\n\nvar WebVTTParser = {\n parse: function parse(vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {\n // Convert byteArray into string, replacing any somewhat exotic linefeeds with \"\\n\", then split on that character.\n var re = /\\r\\n|\\n\\r|\\n|\\r/g;\n // Uint8Array.prototype.reduce is not implemented in IE11\n var vttLines = Object(id3[\"b\" /* utf8ArrayToStr */])(new Uint8Array(vttByteArray)).trim().replace(re, '\\n').split('\\n');\n\n var cueTime = '00:00.000';\n var mpegTs = 0;\n var localTime = 0;\n var presentationTime = 0;\n var cues = [];\n var parsingError = void 0;\n var inHeader = true;\n // let VTTCue = VTTCue || window.TextTrackCue;\n\n // Create parser object using VTTCue with TextTrackCue fallback on certain browsers.\n var parser = new vttparser();\n\n parser.oncue = function (cue) {\n // Adjust cue timing; clamp cues to start no earlier than - and drop cues that don't end after - 0 on timeline.\n var currCC = vttCCs[cc];\n var cueOffset = vttCCs.ccOffset;\n\n // Update offsets for new discontinuities\n if (currCC && currCC.new) {\n if (localTime !== undefined) {\n // When local time is provided, offset = discontinuity start time - local time\n cueOffset = vttCCs.ccOffset = currCC.start;\n } else {\n calculateOffset(vttCCs, cc, presentationTime);\n }\n }\n\n if (presentationTime) {\n // If we have MPEGTS, offset = presentation time + discontinuity offset\n cueOffset = presentationTime + vttCCs.ccOffset - vttCCs.presentationOffset;\n }\n\n cue.startTime += cueOffset - localTime;\n cue.endTime += cueOffset - localTime;\n\n // Create a unique hash id for a cue based on start/end times and text.\n // This helps timeline-controller to avoid showing repeated captions.\n cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text);\n\n // Fix encoding of special characters. TODO: Test with all sorts of weird characters.\n cue.text = decodeURIComponent(encodeURIComponent(cue.text));\n if (cue.endTime > 0) {\n cues.push(cue);\n }\n };\n\n parser.onparsingerror = function (e) {\n parsingError = e;\n };\n\n parser.onflush = function () {\n if (parsingError && errorCallBack) {\n errorCallBack(parsingError);\n return;\n }\n callBack(cues);\n };\n\n // Go through contents line by line.\n vttLines.forEach(function (line) {\n if (inHeader) {\n // Look for X-TIMESTAMP-MAP in header.\n if (startsWith(line, 'X-TIMESTAMP-MAP=')) {\n // Once found, no more are allowed anyway, so stop searching.\n inHeader = false;\n // Extract LOCAL and MPEGTS.\n line.substr(16).split(',').forEach(function (timestamp) {\n if (startsWith(timestamp, 'LOCAL:')) {\n cueTime = timestamp.substr(6);\n } else if (startsWith(timestamp, 'MPEGTS:')) {\n mpegTs = parseInt(timestamp.substr(7));\n }\n });\n try {\n // Calculate subtitle offset in milliseconds.\n // If sync PTS is less than zero, we have a 33-bit wraparound, which is fixed by adding 2^33 = 8589934592.\n syncPTS = syncPTS < 0 ? syncPTS + 8589934592 : syncPTS;\n // Adjust MPEGTS by sync PTS.\n mpegTs -= syncPTS;\n // Convert cue time to seconds\n localTime = cueString2millis(cueTime) / 1000;\n // Convert MPEGTS to seconds from 90kHz.\n presentationTime = mpegTs / 90000;\n\n if (localTime === -1) {\n parsingError = new Error('Malformed X-TIMESTAMP-MAP: ' + line);\n }\n } catch (e) {\n parsingError = new Error('Malformed X-TIMESTAMP-MAP: ' + line);\n }\n // Return without parsing X-TIMESTAMP-MAP line.\n return;\n } else if (line === '') {\n inHeader = false;\n }\n }\n // Parse line by default.\n parser.parse(line + '\\n');\n });\n\n parser.flush();\n }\n};\n\n/* harmony default export */ var webvtt_parser = (WebVTTParser);\n// CONCATENATED MODULE: ./src/controller/timeline-controller.js\nfunction timeline_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction timeline_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction timeline_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Timeline Controller\n*/\n\n\n\n\n\n\n\n\nfunction clearCurrentCues(track) {\n if (track && track.cues) {\n while (track.cues.length > 0) {\n track.removeCue(track.cues[0]);\n }\n }\n}\n\nfunction reuseVttTextTrack(inUseTrack, manifestTrack) {\n return inUseTrack && inUseTrack.label === manifestTrack.name && !(inUseTrack.textTrack1 || inUseTrack.textTrack2);\n}\n\nfunction intersection(x1, x2, y1, y2) {\n return Math.min(x2, y2) - Math.max(x1, y1);\n}\n\nvar timeline_controller_TimelineController = function (_EventHandler) {\n timeline_controller__inherits(TimelineController, _EventHandler);\n\n function TimelineController(hls) {\n timeline_controller__classCallCheck(this, TimelineController);\n\n var _this = timeline_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].FRAG_PARSING_USERDATA, events[\"a\" /* default */].FRAG_DECRYPTED, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].LEVEL_SWITCHING, events[\"a\" /* default */].INIT_PTS_FOUND));\n\n _this.hls = hls;\n _this.config = hls.config;\n _this.enabled = true;\n _this.Cues = hls.config.cueHandler;\n _this.textTracks = [];\n _this.tracks = [];\n _this.unparsedVttFrags = [];\n _this.initPTS = undefined;\n _this.cueRanges = [];\n\n if (_this.config.enableCEA708Captions) {\n var channel1 = new output_filter(_this, 1);\n var channel2 = new output_filter(_this, 2);\n\n _this.cea608Parser = new cea_608_parser(0, channel1, channel2);\n }\n return _this;\n }\n\n TimelineController.prototype.addCues = function addCues(channel, startTime, endTime, screen) {\n // skip cues which overlap more than 50% with previously parsed time ranges\n var ranges = this.cueRanges;\n var merged = false;\n for (var i = ranges.length; i--;) {\n var cueRange = ranges[i];\n var overlap = intersection(cueRange[0], cueRange[1], startTime, endTime);\n if (overlap >= 0) {\n cueRange[0] = Math.min(cueRange[0], startTime);\n cueRange[1] = Math.max(cueRange[1], endTime);\n merged = true;\n if (overlap / (endTime - startTime) > 0.5) {\n return;\n }\n }\n }\n if (!merged) {\n ranges.push([startTime, endTime]);\n }\n this.Cues.newCue(this[channel], startTime, endTime, screen);\n };\n\n // Triggered when an initial PTS is found; used for synchronisation of WebVTT.\n\n\n TimelineController.prototype.onInitPtsFound = function onInitPtsFound(data) {\n var _this2 = this;\n\n if (typeof this.initPTS === 'undefined') {\n this.initPTS = data.initPTS;\n }\n\n // Due to asynchrony, initial PTS may arrive later than the first VTT fragments are loaded.\n // Parse any unparsed fragments upon receiving the initial PTS.\n if (this.unparsedVttFrags.length) {\n this.unparsedVttFrags.forEach(function (frag) {\n _this2.onFragLoaded(frag);\n });\n this.unparsedVttFrags = [];\n }\n };\n\n TimelineController.prototype.getExistingTrack = function getExistingTrack(channelNumber) {\n var media = this.media;\n if (media) {\n for (var i = 0; i < media.textTracks.length; i++) {\n var textTrack = media.textTracks[i];\n var propName = 'textTrack' + channelNumber;\n if (textTrack[propName] === true) {\n return textTrack;\n }\n }\n }\n return null;\n };\n\n TimelineController.prototype.sendAddTrackEvent = function sendAddTrackEvent(track, media) {\n var e = null;\n try {\n e = new window.Event('addtrack');\n } catch (err) {\n //for IE11\n e = document.createEvent('Event');\n e.initEvent('addtrack', false, false);\n }\n e.track = track;\n media.dispatchEvent(e);\n };\n\n TimelineController.prototype.createCaptionsTrack = function createCaptionsTrack(track) {\n var trackVar = 'textTrack' + track;\n if (!this[trackVar]) {\n //Enable reuse of existing text track.\n var existingTrack = this.getExistingTrack(track);\n if (!existingTrack) {\n var textTrack = this.createTextTrack('captions', this.config['captionsTextTrack' + track + 'Label'], this.config.captionsTextTrack1LanguageCode);\n if (textTrack) {\n textTrack[trackVar] = true;\n this[trackVar] = textTrack;\n }\n } else {\n this[trackVar] = existingTrack;\n clearCurrentCues(this[trackVar]);\n\n this.sendAddTrackEvent(this[trackVar], this.media);\n }\n }\n };\n\n TimelineController.prototype.createTextTrack = function createTextTrack(kind, label, lang) {\n var media = this.media;\n if (media) {\n return media.addTextTrack(kind, label, lang);\n }\n };\n\n TimelineController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n TimelineController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media;\n this._cleanTracks();\n };\n\n TimelineController.prototype.onMediaDetaching = function onMediaDetaching() {\n clearCurrentCues(this.textTrack1);\n clearCurrentCues(this.textTrack2);\n };\n\n TimelineController.prototype.onManifestLoading = function onManifestLoading() {\n this.lastSn = -1; // Detect discontiguity in fragment parsing\n this.prevCC = -1;\n this.vttCCs = { ccOffset: 0, presentationOffset: 0 }; // Detect discontinuity in subtitle manifests\n this._cleanTracks();\n };\n\n TimelineController.prototype._cleanTracks = function _cleanTracks() {\n // clear outdated subtitles\n var media = this.media;\n if (media) {\n var textTracks = media.textTracks;\n if (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n clearCurrentCues(textTracks[i]);\n }\n }\n }\n };\n\n TimelineController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n this.textTracks = [];\n this.unparsedVttFrags = this.unparsedVttFrags || [];\n this.initPTS = undefined;\n this.cueRanges = [];\n\n if (this.config.enableWebVTT) {\n this.tracks = data.subtitles || [];\n var inUseTracks = this.media ? this.media.textTracks : [];\n\n this.tracks.forEach(function (track, index) {\n var textTrack = void 0;\n if (index < inUseTracks.length) {\n var inUseTrack = inUseTracks[index];\n // Reuse tracks with the same label, but do not reuse 608/708 tracks\n if (reuseVttTextTrack(inUseTrack, track)) {\n textTrack = inUseTrack;\n }\n }\n if (!textTrack) {\n textTrack = _this3.createTextTrack('subtitles', track.name, track.lang);\n }\n textTrack.mode = track.default ? 'showing' : 'hidden';\n _this3.textTracks.push(textTrack);\n });\n }\n };\n\n TimelineController.prototype.onLevelSwitching = function onLevelSwitching() {\n this.enabled = this.hls.currentLevel.closedCaptions !== 'NONE';\n };\n\n TimelineController.prototype.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag,\n payload = data.payload;\n if (frag.type === 'main') {\n var sn = frag.sn;\n // if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack\n if (sn !== this.lastSn + 1) {\n var cea608Parser = this.cea608Parser;\n if (cea608Parser) {\n cea608Parser.reset();\n }\n }\n this.lastSn = sn;\n }\n // If fragment is subtitle type, parse as WebVTT.\n else if (frag.type === 'subtitle') {\n if (payload.byteLength) {\n // We need an initial synchronisation PTS. Store fragments as long as none has arrived.\n if (typeof this.initPTS === 'undefined') {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n var decryptData = frag.decryptdata;\n // If the subtitles are not encrypted, parse VTTs now. Otherwise, we need to wait.\n if (decryptData == null || decryptData.key == null || decryptData.method !== 'AES-128') {\n this._parseVTTs(frag, payload);\n }\n } else {\n // In case there is no payload, finish unsuccessfully.\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n }\n }\n };\n\n TimelineController.prototype._parseVTTs = function _parseVTTs(frag, payload) {\n var vttCCs = this.vttCCs;\n if (!vttCCs[frag.cc]) {\n vttCCs[frag.cc] = { start: frag.start, prevCC: this.prevCC, new: true };\n this.prevCC = frag.cc;\n }\n var textTracks = this.textTracks,\n hls = this.hls;\n\n // Parse the WebVTT file contents.\n webvtt_parser.parse(payload, this.initPTS, vttCCs, frag.cc, function (cues) {\n var currentTrack = textTracks[frag.trackId];\n // Add cues and trigger event with success true.\n cues.forEach(function (cue) {\n // Sometimes there are cue overlaps on segmented vtts so the same\n // cue can appear more than once in different vtt files.\n // This avoid showing duplicated cues with same timecode and text.\n if (!currentTrack.cues.getCueById(cue.id)) {\n try {\n currentTrack.addCue(cue);\n } catch (err) {\n var textTrackCue = new window.TextTrackCue(cue.startTime, cue.endTime, cue.text);\n textTrackCue.id = cue.id;\n currentTrack.addCue(textTrackCue);\n }\n }\n });\n hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: true, frag: frag });\n }, function (e) {\n // Something went wrong while parsing. Trigger event with success false.\n logger[\"b\" /* logger */].log('Failed to parse VTT cue: ' + e);\n hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n });\n };\n\n TimelineController.prototype.onFragDecrypted = function onFragDecrypted(data) {\n var decryptedData = data.payload,\n frag = data.frag;\n\n if (frag.type === 'subtitle') {\n if (typeof this.initPTS === 'undefined') {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n this._parseVTTs(frag, decryptedData);\n }\n };\n\n TimelineController.prototype.onFragParsingUserdata = function onFragParsingUserdata(data) {\n // push all of the CEA-708 messages into the interpreter\n // immediately. It will create the proper timestamps based on our PTS value\n if (this.enabled && this.config.enableCEA708Captions) {\n for (var i = 0; i < data.samples.length; i++) {\n var ccdatas = this.extractCea608Data(data.samples[i].bytes);\n this.cea608Parser.addData(data.samples[i].pts, ccdatas);\n }\n }\n };\n\n TimelineController.prototype.extractCea608Data = function extractCea608Data(byteArray) {\n var count = byteArray[0] & 31;\n var position = 2;\n var tmpByte, ccbyte1, ccbyte2, ccValid, ccType;\n var actualCCBytes = [];\n\n for (var j = 0; j < count; j++) {\n tmpByte = byteArray[position++];\n ccbyte1 = 0x7F & byteArray[position++];\n ccbyte2 = 0x7F & byteArray[position++];\n ccValid = (4 & tmpByte) !== 0;\n ccType = 3 & tmpByte;\n\n if (ccbyte1 === 0 && ccbyte2 === 0) {\n continue;\n }\n\n if (ccValid) {\n if (ccType === 0) // || ccType === 1\n {\n actualCCBytes.push(ccbyte1);\n actualCCBytes.push(ccbyte2);\n }\n }\n }\n return actualCCBytes;\n };\n\n return TimelineController;\n}(event_handler);\n\n/* harmony default export */ var timeline_controller = (timeline_controller_TimelineController);\n// CONCATENATED MODULE: ./src/controller/subtitle-track-controller.js\nvar subtitle_track_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction subtitle_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction subtitle_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction subtitle_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * subtitle track controller\n*/\n\n\n\n\n\nfunction filterSubtitleTracks(textTrackList) {\n var tracks = [];\n for (var i = 0; i < textTrackList.length; i++) {\n if (textTrackList[i].kind === 'subtitles') {\n tracks.push(textTrackList[i]);\n }\n }\n return tracks;\n}\n\nvar subtitle_track_controller_SubtitleTrackController = function (_EventHandler) {\n subtitle_track_controller__inherits(SubtitleTrackController, _EventHandler);\n\n function SubtitleTrackController(hls) {\n subtitle_track_controller__classCallCheck(this, SubtitleTrackController);\n\n var _this = subtitle_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].SUBTITLE_TRACK_LOADED));\n\n _this.tracks = [];\n _this.trackId = -1;\n _this.media = undefined;\n _this.subtitleDisplay = false;\n return _this;\n }\n\n SubtitleTrackController.prototype._onTextTracksChanged = function _onTextTracksChanged() {\n // Media is undefined when switching streams via loadSource()\n if (!this.media) {\n return;\n }\n\n var trackId = -1;\n var tracks = filterSubtitleTracks(this.media.textTracks);\n for (var id = 0; id < tracks.length; id++) {\n if (tracks[id].mode === 'showing') {\n trackId = id;\n }\n }\n\n // Setting current subtitleTrack will invoke code.\n this.subtitleTrack = trackId;\n };\n\n SubtitleTrackController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n // Listen for subtitle track change, then extract the current track ID.\n\n\n SubtitleTrackController.prototype.onMediaAttached = function onMediaAttached(data) {\n var _this2 = this;\n\n this.media = data.media;\n if (!this.media) {\n return;\n }\n\n if (this.queuedDefaultTrack !== undefined) {\n this.subtitleTrack = this.queuedDefaultTrack;\n delete this.queuedDefaultTrack;\n }\n\n this.trackChangeListener = this._onTextTracksChanged.bind(this);\n\n this.useTextTrackPolling = !(this.media.textTracks && 'onchange' in this.media.textTracks);\n if (this.useTextTrackPolling) {\n this.subtitlePollingInterval = setInterval(function () {\n _this2.trackChangeListener();\n }, 500);\n } else {\n this.media.textTracks.addEventListener('change', this.trackChangeListener);\n }\n };\n\n SubtitleTrackController.prototype.onMediaDetaching = function onMediaDetaching() {\n if (!this.media) {\n return;\n }\n if (this.useTextTrackPolling) {\n clearInterval(this.subtitlePollingInterval);\n } else {\n this.media.textTracks.removeEventListener('change', this.trackChangeListener);\n }\n\n this.media = undefined;\n };\n\n // Reset subtitle tracks on manifest loading\n\n\n SubtitleTrackController.prototype.onManifestLoading = function onManifestLoading() {\n this.tracks = [];\n this.trackId = -1;\n };\n\n // Fired whenever a new manifest is loaded.\n\n\n SubtitleTrackController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n var tracks = data.subtitles || [];\n this.tracks = tracks;\n this.trackId = -1;\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACKS_UPDATED, { subtitleTracks: tracks });\n\n // loop through available subtitle tracks and autoselect default if needed\n // TODO: improve selection logic to handle forced, etc\n tracks.forEach(function (track) {\n if (track.default) {\n // setting this.subtitleTrack will trigger internal logic\n // if media has not been attached yet, it will fail\n // we keep a reference to the default track id\n // and we'll set subtitleTrack when onMediaAttached is triggered\n if (_this3.media) {\n _this3.subtitleTrack = track.id;\n } else {\n _this3.queuedDefaultTrack = track.id;\n }\n }\n });\n };\n\n // Trigger subtitle track playlist reload.\n\n\n SubtitleTrackController.prototype.onTick = function onTick() {\n var trackId = this.trackId;\n var subtitleTrack = this.tracks[trackId];\n if (!subtitleTrack) {\n return;\n }\n\n var details = subtitleTrack.details;\n // check if we need to load playlist for this subtitle Track\n if (details === undefined || details.live === true) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for subtitle track ' + trackId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: trackId });\n }\n };\n\n SubtitleTrackController.prototype.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var _this4 = this;\n\n if (data.id < this.tracks.length) {\n logger[\"b\" /* logger */].log('subtitle track ' + data.id + ' loaded');\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(function () {\n _this4.onTick();\n }, 1000 * data.details.targetduration, this);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n clearInterval(this.timer);\n this.timer = null;\n }\n }\n };\n\n /** get alternate subtitle tracks list from playlist **/\n\n\n SubtitleTrackController.prototype.setSubtitleTrackInternal = function setSubtitleTrackInternal(newId) {\n // check if level idx is valid\n if (newId < -1 || newId >= this.tracks.length) {\n return;\n }\n\n // stopping live reloading timer if any\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n\n var textTracks = filterSubtitleTracks(this.media.textTracks);\n\n // hide currently enabled subtitle track\n if (this.trackId !== -1 && this.subtitleDisplay) {\n textTracks[this.trackId].mode = 'hidden';\n }\n\n this.trackId = newId;\n logger[\"b\" /* logger */].log('switching to subtitle track ' + newId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_SWITCH, { id: newId });\n\n if (newId === -1) {\n return;\n }\n\n var subtitleTrack = this.tracks[newId];\n if (this.subtitleDisplay) {\n textTracks[newId].mode = 'showing';\n }\n\n // check if we need to load playlist for this subtitle Track\n var details = subtitleTrack.details;\n if (details === undefined || details.live === true) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for subtitle track ' + newId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: newId });\n }\n };\n\n subtitle_track_controller__createClass(SubtitleTrackController, [{\n key: 'subtitleTracks',\n get: function get() {\n return this.tracks;\n }\n\n /** get index of the selected subtitle track (index in subtitle track lists) **/\n\n }, {\n key: 'subtitleTrack',\n get: function get() {\n return this.trackId;\n }\n\n /** select a subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n if (this.trackId !== subtitleTrackId) {\n // || this.tracks[subtitleTrackId].details === undefined) {\n this.setSubtitleTrackInternal(subtitleTrackId);\n }\n }\n }]);\n\n return SubtitleTrackController;\n}(event_handler);\n\n/* harmony default export */ var subtitle_track_controller = (subtitle_track_controller_SubtitleTrackController);\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar decrypter = __webpack_require__(4);\n\n// CONCATENATED MODULE: ./src/controller/subtitle-stream-controller.js\nfunction subtitle_stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction subtitle_stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction subtitle_stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Subtitle Stream Controller\n*/\n\n\n\n\n\n\nvar subtitle_stream_controller_State = {\n STOPPED: 'STOPPED',\n IDLE: 'IDLE',\n KEY_LOADING: 'KEY_LOADING',\n FRAG_LOADING: 'FRAG_LOADING'\n};\n\nvar subtitle_stream_controller_SubtitleStreamController = function (_EventHandler) {\n subtitle_stream_controller__inherits(SubtitleStreamController, _EventHandler);\n\n function SubtitleStreamController(hls) {\n subtitle_stream_controller__classCallCheck(this, SubtitleStreamController);\n\n var _this = subtitle_stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].SUBTITLE_TRACKS_UPDATED, events[\"a\" /* default */].SUBTITLE_TRACK_SWITCH, events[\"a\" /* default */].SUBTITLE_TRACK_LOADED, events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED));\n\n _this.config = hls.config;\n _this.vttFragSNsProcessed = {};\n _this.vttFragQueues = undefined;\n _this.currentlyProcessing = null;\n _this.state = subtitle_stream_controller_State.STOPPED;\n _this.currentTrackId = -1;\n _this.ticks = 0;\n _this.decrypter = new decrypter[\"a\" /* default */](hls.observer, hls.config);\n return _this;\n }\n\n SubtitleStreamController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n this.state = subtitle_stream_controller_State.STOPPED;\n };\n\n // Remove all queued items and create a new, empty queue for each track.\n\n\n SubtitleStreamController.prototype.clearVttFragQueues = function clearVttFragQueues() {\n var _this2 = this;\n\n this.vttFragQueues = {};\n this.tracks.forEach(function (track) {\n _this2.vttFragQueues[track.id] = [];\n });\n };\n\n // If no frag is being processed and queue isn't empty, initiate processing of next frag in line.\n\n\n SubtitleStreamController.prototype.nextFrag = function nextFrag() {\n if (this.currentlyProcessing === null && this.currentTrackId > -1 && this.vttFragQueues[this.currentTrackId].length) {\n var frag = this.currentlyProcessing = this.vttFragQueues[this.currentTrackId].shift();\n this.fragCurrent = frag;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n this.state = subtitle_stream_controller_State.FRAG_LOADING;\n }\n };\n\n // When fragment has finished processing, add sn to list of completed if successful.\n\n\n SubtitleStreamController.prototype.onSubtitleFragProcessed = function onSubtitleFragProcessed(data) {\n if (data.success) {\n this.vttFragSNsProcessed[data.frag.trackId].push(data.frag.sn);\n }\n this.currentlyProcessing = null;\n this.state = subtitle_stream_controller_State.IDLE;\n this.nextFrag();\n };\n\n SubtitleStreamController.prototype.onMediaAttached = function onMediaAttached() {\n this.state = subtitle_stream_controller_State.IDLE;\n };\n\n // If something goes wrong, procede to next frag, if we were processing one.\n\n\n SubtitleStreamController.prototype.onError = function onError(data) {\n var frag = data.frag;\n // don't handle frag error not related to subtitle fragment\n if (frag && frag.type !== 'subtitle') {\n return;\n }\n if (this.currentlyProcessing) {\n this.currentlyProcessing = null;\n this.nextFrag();\n }\n };\n\n SubtitleStreamController.prototype.tick = function tick() {\n var _this3 = this;\n\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(function () {\n _this3.tick();\n }, 1);\n }\n this.ticks = 0;\n }\n };\n\n SubtitleStreamController.prototype.doTick = function doTick() {\n var _this4 = this;\n\n switch (this.state) {\n case subtitle_stream_controller_State.IDLE:\n var tracks = this.tracks;\n var trackId = this.currentTrackId;\n\n var processedFragSNs = this.vttFragSNsProcessed[trackId],\n fragQueue = this.vttFragQueues[trackId],\n currentFragSN = !!this.currentlyProcessing ? this.currentlyProcessing.sn : -1;\n\n var alreadyProcessed = function alreadyProcessed(frag) {\n return processedFragSNs.indexOf(frag.sn) > -1;\n };\n\n var alreadyInQueue = function alreadyInQueue(frag) {\n return fragQueue.some(function (fragInQueue) {\n return fragInQueue.sn === frag.sn;\n });\n };\n\n // exit if tracks don't exist\n if (!tracks) {\n break;\n }\n var trackDetails;\n\n if (trackId < tracks.length) {\n trackDetails = tracks[trackId].details;\n }\n\n if (typeof trackDetails === 'undefined') {\n break;\n }\n\n // Add all fragments that haven't been, aren't currently being and aren't waiting to be processed, to queue.\n trackDetails.fragments.forEach(function (frag) {\n if (!(alreadyProcessed(frag) || frag.sn === currentFragSN || alreadyInQueue(frag))) {\n // Load key if subtitles are encrypted\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn);\n _this4.state = subtitle_stream_controller_State.KEY_LOADING;\n _this4.hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n // Frags don't know their subtitle track ID, so let's just add that...\n frag.trackId = trackId;\n fragQueue.push(frag);\n _this4.nextFrag();\n }\n }\n });\n }\n };\n\n // Got all new subtitle tracks.\n\n\n SubtitleStreamController.prototype.onSubtitleTracksUpdated = function onSubtitleTracksUpdated(data) {\n var _this5 = this;\n\n logger[\"b\" /* logger */].log('subtitle tracks updated');\n this.tracks = data.subtitleTracks;\n this.clearVttFragQueues();\n this.vttFragSNsProcessed = {};\n this.tracks.forEach(function (track) {\n _this5.vttFragSNsProcessed[track.id] = [];\n });\n };\n\n SubtitleStreamController.prototype.onSubtitleTrackSwitch = function onSubtitleTrackSwitch(data) {\n this.currentTrackId = data.id;\n this.clearVttFragQueues();\n };\n\n // Got a new set of subtitle fragments.\n\n\n SubtitleStreamController.prototype.onSubtitleTrackLoaded = function onSubtitleTrackLoaded() {\n this.tick();\n };\n\n SubtitleStreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === subtitle_stream_controller_State.KEY_LOADING) {\n this.state = subtitle_stream_controller_State.IDLE;\n this.tick();\n }\n };\n\n SubtitleStreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n decryptData = data.frag.decryptdata;\n var fragLoaded = data.frag,\n hls = this.hls;\n if (this.state === subtitle_stream_controller_State.FRAG_LOADING && fragCurrent && data.frag.type === 'subtitle' && fragCurrent.sn === data.frag.sn) {\n // check to see if the payload needs to be decrypted\n if (data.payload.byteLength > 0 && decryptData != null && decryptData.key != null && decryptData.method === 'AES-128') {\n var startTime;\n try {\n startTime = performance.now();\n } catch (error) {\n startTime = Date.now();\n }\n // decrypt the subtitles\n this.decrypter.decrypt(data.payload, decryptData.key.buffer, decryptData.iv.buffer, function (decryptedData) {\n var endTime;\n try {\n endTime = performance.now();\n } catch (error) {\n endTime = Date.now();\n }\n hls.trigger(events[\"a\" /* default */].FRAG_DECRYPTED, { frag: fragLoaded, payload: decryptedData, stats: { tstart: startTime, tdecrypt: endTime } });\n });\n }\n }\n };\n\n return SubtitleStreamController;\n}(event_handler);\n\n/* harmony default export */ var subtitle_stream_controller = (subtitle_stream_controller_SubtitleStreamController);\n// CONCATENATED MODULE: ./src/config.js\n/**\n * HLS config\n */\n\n\n\n\n\n\n//import FetchLoader from './utils/fetch-loader';\n\n\n\n\n\n\n\n\n\nvar hlsDefaultConfig = {\n autoStartLoad: true, // used by stream-controller\n startPosition: -1, // used by stream-controller\n defaultAudioCodec: undefined, // used by stream-controller\n debug: false, // used by logger\n capLevelOnFPSDrop: false, // used by fps-controller\n capLevelToPlayerSize: false, // used by cap-level-controller\n initialLiveManifestSize: 1, // used by stream-controller\n maxBufferLength: 30, // used by stream-controller\n maxBufferSize: 60 * 1000 * 1000, // used by stream-controller\n maxBufferHole: 0.5, // used by stream-controller\n maxSeekHole: 2, // used by stream-controller\n lowBufferWatchdogPeriod: 0.5, // used by stream-controller\n highBufferWatchdogPeriod: 3, // used by stream-controller\n nudgeOffset: 0.1, // used by stream-controller\n nudgeMaxRetry: 3, // used by stream-controller\n maxFragLookUpTolerance: 0.25, // used by stream-controller\n liveSyncDurationCount: 3, // used by stream-controller\n liveMaxLatencyDurationCount: Infinity, // used by stream-controller\n liveSyncDuration: undefined, // used by stream-controller\n liveMaxLatencyDuration: undefined, // used by stream-controller\n liveDurationInfinity: false, // used by buffer-controller\n maxMaxBufferLength: 600, // used by stream-controller\n enableWorker: true, // used by demuxer\n enableSoftwareAES: true, // used by decrypter\n manifestLoadingTimeOut: 10000, // used by playlist-loader\n manifestLoadingMaxRetry: 1, // used by playlist-loader\n manifestLoadingRetryDelay: 1000, // used by playlist-loader\n manifestLoadingMaxRetryTimeout: 64000, // used by playlist-loader\n startLevel: undefined, // used by level-controller\n levelLoadingTimeOut: 10000, // used by playlist-loader\n levelLoadingMaxRetry: 4, // used by playlist-loader\n levelLoadingRetryDelay: 1000, // used by playlist-loader\n levelLoadingMaxRetryTimeout: 64000, // used by playlist-loader\n fragLoadingTimeOut: 20000, // used by fragment-loader\n fragLoadingMaxRetry: 6, // used by fragment-loader\n fragLoadingRetryDelay: 1000, // used by fragment-loader\n fragLoadingMaxRetryTimeout: 64000, // used by fragment-loader\n fragLoadingLoopThreshold: 3, // used by stream-controller\n startFragPrefetch: false, // used by stream-controller\n fpsDroppedMonitoringPeriod: 5000, // used by fps-controller\n fpsDroppedMonitoringThreshold: 0.2, // used by fps-controller\n appendErrorMaxRetry: 3, // used by buffer-controller\n loader: xhr_loader,\n //loader: FetchLoader,\n fLoader: undefined,\n pLoader: undefined,\n xhrSetup: undefined,\n fetchSetup: undefined,\n abrController: abr_controller,\n bufferController: buffer_controller,\n capLevelController: cap_level_controller,\n fpsController: fps_controller,\n stretchShortVideoTrack: false, // used by mp4-remuxer\n maxAudioFramesDrift: 1, // used by mp4-remuxer\n forceKeyFrameOnDiscontinuity: true, // used by ts-demuxer\n abrEwmaFastLive: 3, // used by abr-controller\n abrEwmaSlowLive: 9, // used by abr-controller\n abrEwmaFastVoD: 3, // used by abr-controller\n abrEwmaSlowVoD: 9, // used by abr-controller\n abrEwmaDefaultEstimate: 5e5, // 500 kbps // used by abr-controller\n abrBandWidthFactor: 0.95, // used by abr-controller\n abrBandWidthUpFactor: 0.7, // used by abr-controller\n abrMaxWithRealBitrate: false, // used by abr-controller\n maxStarvationDelay: 4, // used by abr-controller\n maxLoadingDelay: 4, // used by abr-controller\n minAutoBitrate: 0 // used by hls\n};\n\nif (true) {\n hlsDefaultConfig.subtitleStreamController = subtitle_stream_controller;\n hlsDefaultConfig.subtitleTrackController = subtitle_track_controller;\n hlsDefaultConfig.timelineController = timeline_controller;\n hlsDefaultConfig.cueHandler = cues_namespaceObject;\n hlsDefaultConfig.enableCEA708Captions = true; // used by timeline-controller\n hlsDefaultConfig.enableWebVTT = true; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack1Label = 'English'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack1LanguageCode = 'en'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack2Label = 'Spanish'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack2LanguageCode = 'es'; // used by timeline-controller\n}\n\nif (true) {\n hlsDefaultConfig.audioStreamController = audio_stream_controller;\n hlsDefaultConfig.audioTrackController = audio_track_controller;\n}\n// CONCATENATED MODULE: ./src/hls.js\nvar hls__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction hls__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * HLS interface\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar hls_Hls = function () {\n Hls.isSupported = function isSupported() {\n return is_supported_isSupported();\n };\n\n hls__createClass(Hls, null, [{\n key: 'version',\n get: function get() {\n return \"0.8.9\";\n }\n }, {\n key: 'Events',\n get: function get() {\n return events[\"a\" /* default */];\n }\n }, {\n key: 'ErrorTypes',\n get: function get() {\n return errors[\"b\" /* ErrorTypes */];\n }\n }, {\n key: 'ErrorDetails',\n get: function get() {\n return errors[\"a\" /* ErrorDetails */];\n }\n }, {\n key: 'DefaultConfig',\n get: function get() {\n if (!Hls.defaultConfig) {\n return hlsDefaultConfig;\n }\n return Hls.defaultConfig;\n },\n set: function set(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n }]);\n\n function Hls() {\n var _this = this;\n\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n hls__classCallCheck(this, Hls);\n\n var defaultConfig = Hls.DefaultConfig;\n\n if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) {\n throw new Error('Illegal hls.js config: don\\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration');\n }\n\n for (var prop in defaultConfig) {\n if (prop in config) {\n continue;\n }\n config[prop] = defaultConfig[prop];\n }\n\n if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n Object(logger[\"a\" /* enableLogs */])(config.debug);\n this.config = config;\n this._autoLevelCapping = -1;\n // observer setup\n var observer = this.observer = new events_default.a();\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n this.on = observer.on.bind(observer);\n this.off = observer.off.bind(observer);\n this.trigger = observer.trigger.bind(observer);\n\n // core controllers and network loaders\n var abrController = this.abrController = new config.abrController(this);\n var bufferController = new config.bufferController(this);\n var capLevelController = new config.capLevelController(this);\n var fpsController = new config.fpsController(this);\n var playListLoader = new playlist_loader(this);\n var fragmentLoader = new fragment_loader(this);\n var keyLoader = new key_loader(this);\n var id3TrackController = new id3_track_controller(this);\n\n // network controllers\n var levelController = this.levelController = new level_controller(this);\n var streamController = this.streamController = new stream_controller(this);\n var networkControllers = [levelController, streamController];\n\n // optional audio stream controller\n var Controller = config.audioStreamController;\n if (Controller) {\n networkControllers.push(new Controller(this));\n }\n this.networkControllers = networkControllers;\n\n var coreComponents = [playListLoader, fragmentLoader, keyLoader, abrController, bufferController, capLevelController, fpsController, id3TrackController];\n\n // optional audio track and subtitle controller\n Controller = config.audioTrackController;\n if (Controller) {\n var audioTrackController = new Controller(this);\n this.audioTrackController = audioTrackController;\n coreComponents.push(audioTrackController);\n }\n\n Controller = config.subtitleTrackController;\n if (Controller) {\n var subtitleTrackController = new Controller(this);\n this.subtitleTrackController = subtitleTrackController;\n coreComponents.push(subtitleTrackController);\n }\n\n // optional subtitle controller\n [config.subtitleStreamController, config.timelineController].forEach(function (Controller) {\n if (Controller) {\n coreComponents.push(new Controller(_this));\n }\n });\n this.coreComponents = coreComponents;\n }\n\n Hls.prototype.destroy = function destroy() {\n logger[\"b\" /* logger */].log('destroy');\n this.trigger(events[\"a\" /* default */].DESTROYING);\n this.detachMedia();\n this.coreComponents.concat(this.networkControllers).forEach(function (component) {\n component.destroy();\n });\n this.url = null;\n this.observer.removeAllListeners();\n this._autoLevelCapping = -1;\n };\n\n Hls.prototype.attachMedia = function attachMedia(media) {\n logger[\"b\" /* logger */].log('attachMedia');\n this.media = media;\n this.trigger(events[\"a\" /* default */].MEDIA_ATTACHING, { media: media });\n };\n\n Hls.prototype.detachMedia = function detachMedia() {\n logger[\"b\" /* logger */].log('detachMedia');\n this.trigger(events[\"a\" /* default */].MEDIA_DETACHING);\n this.media = null;\n };\n\n Hls.prototype.loadSource = function loadSource(url) {\n url = url_toolkit_default.a.buildAbsoluteURL(window.location.href, url, { alwaysNormalize: true });\n logger[\"b\" /* logger */].log('loadSource:' + url);\n this.url = url;\n // when attaching to a source URL, trigger a playlist load\n this.trigger(events[\"a\" /* default */].MANIFEST_LOADING, { url: url });\n };\n\n Hls.prototype.startLoad = function startLoad() {\n var startPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n\n logger[\"b\" /* logger */].log('startLoad(' + startPosition + ')');\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n };\n\n Hls.prototype.stopLoad = function stopLoad() {\n logger[\"b\" /* logger */].log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n };\n\n Hls.prototype.swapAudioCodec = function swapAudioCodec() {\n logger[\"b\" /* logger */].log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n };\n\n Hls.prototype.recoverMediaError = function recoverMediaError() {\n logger[\"b\" /* logger */].log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n this.attachMedia(media);\n };\n\n /** Return all quality levels **/\n\n\n hls__createClass(Hls, [{\n key: 'levels',\n get: function get() {\n return this.levelController.levels;\n }\n\n /** Return current playback quality level **/\n\n }, {\n key: 'currentLevel',\n get: function get() {\n return this.streamController.currentLevel;\n }\n\n /* set quality level immediately (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set currentLevel:' + newLevel);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n\n /** Return next playback quality level (quality level of next fragment) **/\n\n }, {\n key: 'nextLevel',\n get: function get() {\n return this.streamController.nextLevel;\n }\n\n /* set quality level for next fragment (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set nextLevel:' + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n\n /** Return the quality level of current/last loaded fragment **/\n\n }, {\n key: 'loadLevel',\n get: function get() {\n return this.levelController.level;\n }\n\n /* set quality level for current/next loaded fragment (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set loadLevel:' + newLevel);\n this.levelController.manualLevel = newLevel;\n }\n\n /** Return the quality level of next loaded fragment **/\n\n }, {\n key: 'nextLoadLevel',\n get: function get() {\n return this.levelController.nextLoadLevel;\n }\n\n /** set quality level of next loaded fragment **/\n ,\n set: function set(level) {\n this.levelController.nextLoadLevel = level;\n }\n\n /** Return first level (index of first level referenced in manifest)\n **/\n\n }, {\n key: 'firstLevel',\n get: function get() {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n }\n\n /** set first level (index of first level referenced in manifest)\n **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set firstLevel:' + newLevel);\n this.levelController.firstLevel = newLevel;\n }\n\n /** Return start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n\n }, {\n key: 'startLevel',\n get: function get() {\n return this.levelController.startLevel;\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 (determined from download of first segment)\n **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set startLevel:' + newLevel);\n var hls = this;\n // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, hls.minAutoLevel);\n }\n hls.levelController.startLevel = newLevel;\n }\n\n /** Return the capping/max level value that could be used by automatic level selection algorithm **/\n\n }, {\n key: 'autoLevelCapping',\n get: function get() {\n return this._autoLevelCapping;\n }\n\n /** set the capping/max level value that could be used by automatic level selection algorithm **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set autoLevelCapping:' + newLevel);\n this._autoLevelCapping = newLevel;\n }\n\n /* check if we are in automatic level selection mode */\n\n }, {\n key: 'autoLevelEnabled',\n get: function get() {\n return this.levelController.manualLevel === -1;\n }\n\n /* return manual level */\n\n }, {\n key: 'manualLevel',\n get: function get() {\n return this.levelController.manualLevel;\n }\n\n /* return min level selectable in auto mode according to config.minAutoBitrate */\n\n }, {\n key: 'minAutoLevel',\n get: function get() {\n var hls = this,\n levels = hls.levels,\n minAutoBitrate = hls.config.minAutoBitrate,\n len = levels ? levels.length : 0;\n for (var i = 0; i < len; i++) {\n var levelNextBitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n if (levelNextBitrate > minAutoBitrate) {\n return i;\n }\n }\n return 0;\n }\n\n /* return max level selectable in auto mode according to autoLevelCapping */\n\n }, {\n key: 'maxAutoLevel',\n get: function get() {\n var hls = this;\n var levels = hls.levels;\n var autoLevelCapping = hls.autoLevelCapping;\n var maxAutoLevel = void 0;\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n } else {\n maxAutoLevel = autoLevelCapping;\n }\n return maxAutoLevel;\n }\n\n // return next auto level\n\n }, {\n key: 'nextAutoLevel',\n get: function get() {\n var hls = this;\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(hls.abrController.nextAutoLevel, hls.minAutoLevel), hls.maxAutoLevel);\n }\n\n // this setter is used to force next auto level\n // this is useful to force a switch down in auto mode : 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 succesful frag loading at forced level, this value will be resetted to -1 by ABR controller\n ,\n set: function set(nextLevel) {\n var hls = this;\n hls.abrController.nextAutoLevel = Math.max(hls.minAutoLevel, nextLevel);\n }\n\n /** get alternate audio tracks list from playlist **/\n\n }, {\n key: 'audioTracks',\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n }\n\n /** get 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 /** select 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 key: 'liveSyncPosition',\n get: function get() {\n return this.streamController.liveSyncPosition;\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 /** get 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\n /** select an subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n }\n }, {\n key: 'subtitleDisplay',\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n },\n set: function set(value) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n }\n }]);\n\n return Hls;\n}();\n\n/* harmony default export */ var src_hls = __webpack_exports__[\"default\"] = (hls_Hls);\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction webpackBootstrapFunc (modules) {\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __webpack_require__.i = function(value) { return value; };\n\n/******/ // define getter function for harmony exports\n/******/ __webpack_require__.d = function(exports, name, getter) {\n/******/ if(!__webpack_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __webpack_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __webpack_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"/\";\n\n/******/ // on error function for async loading\n/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE)\n return f.default || f // try to call default if defined to also support babel esmodule exports\n}\n\n// http://stackoverflow.com/a/2593661/130442\nfunction quoteRegExp (str) {\n return (str + '').replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&')\n}\n\nfunction getModuleDependencies (module) {\n var retval = []\n var fnString = module.toString()\n var wrapperSignature = fnString.match(/^function\\s?\\(\\w+,\\s*\\w+,\\s*(\\w+)\\)/)\n if (!wrapperSignature) return retval\n\n var webpackRequireName = wrapperSignature[1]\n var re = new RegExp('(\\\\\\\\n|\\\\W)' + quoteRegExp(webpackRequireName) + '\\\\((\\/\\\\*.*?\\\\*\\/)?\\s?.*?([\\\\.|\\\\-|\\\\w|\\/|@]+).*?\\\\)', 'g') // additional chars when output.pathinfo is true\n var match\n while ((match = re.exec(fnString))) {\n retval.push(match[3])\n }\n return retval\n}\n\nfunction getRequiredModules (sources, moduleId) {\n var modulesQueue = [moduleId]\n var requiredModules = []\n var seenModules = {}\n\n while (modulesQueue.length) {\n var moduleToCheck = modulesQueue.pop()\n if (seenModules[moduleToCheck] || !sources[moduleToCheck]) continue\n seenModules[moduleToCheck] = true\n requiredModules.push(moduleToCheck)\n var newModules = getModuleDependencies(sources[moduleToCheck])\n modulesQueue = modulesQueue.concat(newModules)\n }\n\n return requiredModules\n}\n\nmodule.exports = function (moduleId, options) {\n options = options || {}\n var sources = __webpack_require__.m\n\n var requiredModules = options.all ? Object.keys(sources) : getRequiredModules(sources, moduleId)\n var src = '(' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[id].toString() }).join(',') + '})(self);'\n\n var blob = new window.Blob([src], { type: 'text/javascript' })\n if (options.bare) { return blob }\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL\n\n var workerUrl = URL.createObjectURL(blob)\n var worker = new window.Worker(workerUrl)\n worker.objectURL = workerUrl\n\n return worker\n}\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__demux_demuxer_inline__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_logger__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_events__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_events___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_events__);\n/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\n\n\n\n\n\n\nvar DemuxerWorker = function DemuxerWorker(self) {\n // observer setup\n var observer = new __WEBPACK_IMPORTED_MODULE_3_events___default.a();\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function forwardMessage(ev, data) {\n self.postMessage({ event: ev, data: data });\n };\n\n self.addEventListener('message', function (ev) {\n var data = ev.data;\n //console.log('demuxer cmd:' + data.cmd);\n switch (data.cmd) {\n case 'init':\n var config = JSON.parse(data.config);\n self.demuxer = new __WEBPACK_IMPORTED_MODULE_0__demux_demuxer_inline__[\"a\" /* default */](observer, data.typeSupported, config, data.vendor);\n try {\n Object(__WEBPACK_IMPORTED_MODULE_2__utils_logger__[\"a\" /* enableLogs */])(config.debug === true);\n } catch (err) {\n console.warn('demuxerWorker: unable to enable logs');\n }\n // signal end of worker init\n forwardMessage('init', null);\n break;\n case 'demux':\n self.demuxer.push(data.data, data.decryptdata, data.initSegment, data.audioCodec, data.videoCodec, data.timeOffset, data.discontinuity, data.trackSwitch, data.contiguous, data.duration, data.accurateTimeOffset, data.defaultInitPTS);\n break;\n default:\n break;\n }\n });\n\n // forward events to main thread\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_DECRYPTED, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSED, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].ERROR, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].INIT_PTS_FOUND, forwardMessage);\n\n // special case for FRAG_PARSING_DATA: pass data1/data2 as transferable object (no copy)\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_DATA, function (ev, data) {\n var transferable = [];\n var message = { event: ev, data: data };\n if (data.data1) {\n message.data1 = data.data1.buffer;\n transferable.push(data.data1.buffer);\n delete data.data1;\n }\n if (data.data2) {\n message.data2 = data.data2.buffer;\n transferable.push(data.data2.buffer);\n delete data.data2;\n }\n self.postMessage(message, transferable);\n });\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (DemuxerWorker);\n\n/***/ })\n/******/ ])[\"default\"];\n});\n//# sourceMappingURL=hls.js.map\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Hls = __webpack_require__(0);\n\nif (!window.Hls) {\n window.Hls = Hls; // expose hls.js constructor\n}\n\n/**\n * hls.js source handler\n * @param source\n * @param tech\n * @constructor\n */\nfunction Html5HlsJS(source, tech) {\n var options = tech.options_;\n var el = tech.el();\n var duration = null;\n var hls = this.hls = new Hls(options.hlsjsConfig);\n\n /**\n * creates an error handler function\n * @returns {Function}\n */\n function errorHandlerFactory() {\n var _recoverDecodingErrorDate = null;\n var _recoverAudioCodecErrorDate = null;\n\n return function() {\n var now = Date.now();\n\n if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) {\n _recoverDecodingErrorDate = now;\n hls.recoverMediaError();\n }\n else if (!_recoverAudioCodecErrorDate || (now - _recoverAudioCodecErrorDate) > 2000) {\n _recoverAudioCodecErrorDate = now;\n hls.swapAudioCodec();\n hls.recoverMediaError();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n };\n }\n\n // create separate error handlers for hlsjs and the video tag\n var hlsjsErrorHandler = errorHandlerFactory();\n var videoTagErrorHandler = errorHandlerFactory();\n\n // listen to error events coming from the video tag\n el.addEventListener('error', function(e) {\n var mediaError = e.currentTarget.error;\n\n if (mediaError.code === mediaError.MEDIA_ERR_DECODE) {\n videoTagErrorHandler();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n });\n\n /**\n * Destroys the Hls instance\n */\n this.dispose = function() {\n hls.destroy();\n };\n\n /**\n * returns the duration of the stream, or Infinity if live video\n * @returns {Infinity|number}\n */\n this.duration = function() {\n return duration || el.duration || 0;\n };\n\n // update live status on level load\n hls.on(Hls.Events.LEVEL_LOADED, function(event, data) {\n duration = data.details.live ? Infinity : data.details.totalduration;\n });\n\n // try to recover on fatal errors\n hls.on(Hls.Events.ERROR, function(event, data) {\n if (data.fatal) {\n switch (data.type) {\n case Hls.ErrorTypes.NETWORK_ERROR:\n hls.startLoad();\n break;\n case Hls.ErrorTypes.MEDIA_ERROR:\n hlsjsErrorHandler();\n break;\n default:\n console.error('Error loading media: File could not be played');\n break;\n }\n }\n });\n\n Object.keys(Hls.Events).forEach(function(key) {\n var eventName = Hls.Events[key];\n hls.on(eventName, function(event, data) {\n tech.trigger(eventName, data);\n });\n });\n\n // Intercept native TextTrack calls and route to video.js directly only\n // if native text tracks are not supported on this browser.\n if (!tech.featuresNativeTextTracks) {\n Object.defineProperty(el, 'textTracks', {\n value: tech.textTracks,\n writable: false\n });\n el.addTextTrack = function() {\n return tech.addTextTrack.apply(tech, arguments);\n };\n }\n\n // attach hlsjs to videotag\n hls.attachMedia(el);\n hls.loadSource(source.src);\n}\n\nvar hlsTypeRE = /^application\\/(x-mpegURL|vnd\\.apple\\.mpegURL)$/i;\nvar hlsExtRE = /\\.m3u8/i;\n\nvar HlsSourceHandler = {\n canHandleSource: function(source) {\n if (source.skipContribHlsJs) {\n return '';\n }\n else if (hlsTypeRE.test(source.type)) {\n return 'probably';\n }\n else if (hlsExtRE.test(source.src)) {\n return 'maybe';\n }\n else {\n return '';\n }\n },\n handleSource: function(source, tech) {\n return new Html5HlsJS(source, tech);\n },\n canPlayType: function(type) {\n if (hlsTypeRE.test(type)) {\n return 'probably';\n }\n\n return '';\n }\n};\n\nif (Hls.isSupported()) {\n var videojs = __webpack_require__(1); // resolved UMD-wise through webpack\n\n // support es6 style import\n videojs = videojs && videojs.default || videojs;\n\n if (videojs) {\n var html5Tech = videojs.getTech && videojs.getTech('Html5'); // videojs6 (partially on videojs5 too)\n html5Tech = html5Tech || (videojs.getComponent && videojs.getComponent('Html5')); // videojs5\n\n if (html5Tech) {\n html5Tech.registerSourceHandler(HlsSourceHandler, 0);\n }\n }\n else {\n console.warn('videojs-contrib-hls.js: Couldn\\'t find find window.videojs nor require(\\'video.js\\')');\n }\n}\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// videojs-contrib-hlsjs.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9797e5f4aff93dafed55","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Hls\"] = factory();\n\telse\n\t\troot[\"Hls\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return enableLogs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return logger; });\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nfunction noop() {}\n\nvar fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\n\nvar exportedLogger = fakeLogger;\n\n/*globals self: false */\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\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\n\nfunction consolePrintFn(type) {\n var func = self.console[type];\n if (func) {\n return function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n func.apply(self.console, args);\n };\n }\n return noop;\n}\n\nfunction exportLoggerFunctions(debugConfig) {\n for (var _len2 = arguments.length, functions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n functions[_key2 - 1] = arguments[_key2];\n }\n\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\n\nvar enableLogs = function enableLogs(debugConfig) {\n if (debugConfig === true || (typeof debugConfig === 'undefined' ? 'undefined' : _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();\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n } else {\n exportedLogger = fakeLogger;\n }\n};\n\nvar logger = exportedLogger;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony default export */ __webpack_exports__[\"a\"] = ({\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be reset - data: { }\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when sourcebuffers have been created - data: { tracks : tracks }\n BUFFER_CREATED: 'hlsBufferCreated',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer - data : { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent}\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data - data: { }\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data { startOffset, endOffset }\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media buffer has been flushed - data: { }\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels], audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels], firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level switch is requested - data: { level : id of new level } // deprecated in favor LEVEL_SWITCHING\n LEVEL_SWITCH: 'hlsLevelSwitch',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCHING: 'hlsLevelSwitching',\n // fired when a level switch is effective - data: { level : id of new level }\n LEVEL_SWITCHED: 'hlsLevelSwitched',\n // fired when a level playlist loading starts - data: { url : level URL, level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired to notify that audio track lists has been updated - data: { audioTracks : audioTracks }\n AUDIO_TRACKS_UPDATED: 'hlsAudioTracksUpdated',\n // fired when an audio track switch occurs - data: { id : audio track id } // deprecated in favor AUDIO_TRACK_SWITCHING\n AUDIO_TRACK_SWITCH: 'hlsAudioTrackSwitch',\n // fired when an audio track switching is requested - data: { id : audio track id }\n AUDIO_TRACK_SWITCHING: 'hlsAudioTrackSwitching',\n // fired when an audio track switch actually occurs - data: { id : audio track id }\n AUDIO_TRACK_SWITCHED: 'hlsAudioTrackSwitched',\n // fired when an audio track loading starts - data: { url : audio track URL, id : audio track id }\n AUDIO_TRACK_LOADING: 'hlsAudioTrackLoading',\n // fired when an audio track loading finishes - data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } }\n AUDIO_TRACK_LOADED: 'hlsAudioTrackLoaded',\n // fired to notify that subtitle track lists has been updated - data: { subtitleTracks : subtitleTracks }\n SUBTITLE_TRACKS_UPDATED: 'hlsSubtitleTracksUpdated',\n // fired when an subtitle track switch occurs - data: { id : subtitle track id }\n SUBTITLE_TRACK_SWITCH: 'hlsSubtitleTrackSwitch',\n // fired when a subtitle track loading starts - data: { url : subtitle track URL, id : subtitle track id }\n SUBTITLE_TRACK_LOADING: 'hlsSubtitleTrackLoading',\n // fired when a subtitle track loading finishes - data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } }\n SUBTITLE_TRACK_LOADED: 'hlsSubtitleTrackLoaded',\n // fired when a subtitle fragment has been processed - data: { success : boolean, frag : the processed frag }\n SUBTITLE_FRAG_PROCESSED: 'hlsSubtitleFragProcessed',\n // fired when the first timestamp is found - data: { id : demuxer id, initPTS: initPTS, frag : fragment object }\n INIT_PTS_FOUND: 'hlsInitPtsFound',\n // fired when a fragment loading starts - data: { frag : fragment object }\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded } }\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: { frag : fragment object }\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length } }\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when a fragment has finished decrypting - data: { id : demuxer id, frag: fragment object, payload : fragment payload, stats : { tstart, tdecrypt } }\n FRAG_DECRYPTED: 'hlsFragDecrypted',\n // fired when Init Segment has been extracted from fragment - data: { id : demuxer id, frag: fragment object, moov : moov MP4 box, codecs : codecs found while parsing fragment }\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { id : demuxer id, frag: fragment object, samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { id : demuxer id, frag: fragment object, data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: { id : demuxer id, frag: fragment object }\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { id : demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length, bwEstimate } }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { id : demuxer id, frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: { curentDropped, currentDecoded, totalDroppedFrames }\n FPS_DROP: 'hlsFpsDrop',\n //triggered when FPS drop triggers auto level capping - data: { level, droppedlevel }\n FPS_DROP_LEVEL_CAPPING: 'hlsFpsDropLevelCapping',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data }\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example - data: { }\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object }\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length } }\n KEY_LOADED: 'hlsKeyLoaded',\n // fired upon stream controller state transitions - data: { previousState, nextState }\n STREAM_STATE_TRANSITION: 'hlsStreamStateTransition'\n});\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return ErrorTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return ErrorDetails; });\nvar ErrorTypes = {\n // Identifier for a network error (loading error / timeout ...)\n NETWORK_ERROR: 'networkError',\n // Identifier for a media Error (video/parsing/mediasource error)\n MEDIA_ERROR: 'mediaError',\n // Identifier for a mux Error (demuxing/remuxing)\n MUX_ERROR: 'muxError',\n // Identifier for all other errors\n OTHER_ERROR: 'otherError'\n};\n\nvar ErrorDetails = {\n // Identifier for a manifest load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_ERROR: 'manifestLoadError',\n // Identifier for a manifest load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n MANIFEST_LOAD_TIMEOUT: 'manifestLoadTimeOut',\n // Identifier for a manifest parsing error - data: { url : faulty URL, reason : error reason}\n MANIFEST_PARSING_ERROR: 'manifestParsingError',\n // Identifier for a manifest with only incompatible codecs error - data: { url : faulty URL, reason : error reason}\n MANIFEST_INCOMPATIBLE_CODECS_ERROR: 'manifestIncompatibleCodecsError',\n // Identifier for a level load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_ERROR: 'levelLoadError',\n // Identifier for a level load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n LEVEL_LOAD_TIMEOUT: 'levelLoadTimeOut',\n // Identifier for a level switch error - data: { level : faulty level Id, event : error description}\n LEVEL_SWITCH_ERROR: 'levelSwitchError',\n // Identifier for an audio track load error - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_ERROR: 'audioTrackLoadError',\n // Identifier for an audio track load timeout - data: { url : faulty URL, response : { code: error code, text: error text }}\n AUDIO_TRACK_LOAD_TIMEOUT: 'audioTrackLoadTimeOut',\n // Identifier for fragment load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n FRAG_LOAD_ERROR: 'fragLoadError',\n // Identifier for fragment loop loading error - data: { frag : fragment object}\n FRAG_LOOP_LOADING_ERROR: 'fragLoopLoadingError',\n // Identifier for fragment load timeout error - data: { frag : fragment object}\n FRAG_LOAD_TIMEOUT: 'fragLoadTimeOut',\n // Identifier for a fragment decryption error event - data: {id : demuxer Id,frag: fragment object, reason : parsing error description }\n FRAG_DECRYPT_ERROR: 'fragDecryptError',\n // Identifier for a fragment parsing error event - data: { id : demuxer Id, reason : parsing error description }\n // will be renamed DEMUX_PARSING_ERROR and switched to MUX_ERROR in the next major release\n FRAG_PARSING_ERROR: 'fragParsingError',\n // Identifier for a remux alloc error event - data: { id : demuxer Id, frag : fragment object, bytes : nb of bytes on which allocation failed , reason : error text }\n REMUX_ALLOC_ERROR: 'remuxAllocError',\n // Identifier for decrypt key load error - data: { frag : fragment object, response : { code: error code, text: error text }}\n KEY_LOAD_ERROR: 'keyLoadError',\n // Identifier for decrypt key load timeout error - data: { frag : fragment object}\n KEY_LOAD_TIMEOUT: 'keyLoadTimeOut',\n // Triggered when an exception occurs while adding a sourceBuffer to MediaSource - data : { err : exception , mimeType : mimeType }\n BUFFER_ADD_CODEC_ERROR: 'bufferAddCodecError',\n // Identifier for a buffer append error - data: append error description\n BUFFER_APPEND_ERROR: 'bufferAppendError',\n // Identifier for a buffer appending error event - data: appending error description\n BUFFER_APPENDING_ERROR: 'bufferAppendingError',\n // Identifier for a buffer stalled error event\n BUFFER_STALLED_ERROR: 'bufferStalledError',\n // Identifier for a buffer full event\n BUFFER_FULL_ERROR: 'bufferFullError',\n // Identifier for a buffer seek over hole event\n BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',\n // Identifier for a buffer nudge on stall (playback is stuck although currentTime is in a buffered area)\n BUFFER_NUDGE_ON_STALL: 'bufferNudgeOnStall',\n // Identifier for an internal exception happening inside hls.js while handling an event\n INTERNAL_EXCEPTION: 'internalException'\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return utf8ArrayToStr; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * ID3 parser\n */\nvar ID3 = function () {\n function ID3() {\n _classCallCheck(this, ID3);\n }\n\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 header is found\n */\n ID3.isHeader = 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\n return false;\n };\n\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 footer is found\n */\n\n\n ID3.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\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 {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {Uint8Array} - The block of data containing any ID3 tags found\n */\n\n\n ID3.getID3Data = function getID3Data(data, offset) {\n var front = offset;\n var length = 0;\n\n while (ID3.isHeader(data, offset)) {\n //ID3 header is 10 bytes\n length += 10;\n\n var size = ID3._readSize(data, offset + 6);\n length += size;\n\n if (ID3.isFooter(data, offset + 10)) {\n //ID3 footer is 10 bytes\n length += 10;\n }\n\n offset += length;\n }\n\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n\n return undefined;\n };\n\n ID3._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\n /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param {Uint8Array} data - Block of data containing one or more ID3 tags\n * @return {number} - The timestamp\n */\n\n\n ID3.getTimeStamp = function getTimeStamp(data) {\n var frames = ID3.getID3Frames(data);\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if (ID3.isTimeStampFrame(frame)) {\n return ID3._readTimeStamp(frame);\n }\n }\n\n return undefined;\n };\n\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n * @param {ID3 frame} frame\n */\n\n\n ID3.isTimeStampFrame = function isTimeStampFrame(frame) {\n return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';\n };\n\n ID3._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 = ID3._readSize(data, 4);\n\n //skip frame id, size, and flags\n var offset = 10;\n\n return { type: type, size: size, data: data.subarray(offset, offset + size) };\n };\n\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags\n * @return {ID3 frame[]} - Array of ID3 frame objects\n */\n\n\n ID3.getID3Frames = function getID3Frames(id3Data) {\n var offset = 0;\n var frames = [];\n\n while (ID3.isHeader(id3Data, offset)) {\n var size = ID3._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 = ID3._getFrameData(id3Data.subarray(offset));\n var frame = ID3._decodeFrame(frameData);\n if (frame) {\n frames.push(frame);\n }\n //skip frame header and frame data\n offset += frameData.size + 10;\n }\n\n if (ID3.isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n\n return frames;\n };\n\n ID3._decodeFrame = function _decodeFrame(frame) {\n if (frame.type === 'PRIV') {\n return ID3._decodePrivFrame(frame);\n } else if (frame.type[0] === 'T') {\n return ID3._decodeTextFrame(frame);\n } else if (frame.type[0] === 'W') {\n return ID3._decodeURLFrame(frame);\n }\n\n return undefined;\n };\n\n ID3._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\n if (pts33Bit) {\n timestamp += 47721858.84; // 2^32 / 90\n }\n\n return Math.round(timestamp);\n }\n\n return undefined;\n };\n\n ID3._decodePrivFrame = function _decodePrivFrame(frame) {\n /*\n Format: <text string>\\0<binary data>\n */\n if (frame.size < 2) {\n return undefined;\n }\n\n var owner = ID3._utf8ArrayToStr(frame.data, true);\n var privateData = new Uint8Array(frame.data.subarray(owner.length + 1));\n\n return { key: frame.type, info: owner, data: privateData.buffer };\n };\n\n ID3._decodeTextFrame = function _decodeTextFrame(frame) {\n if (frame.size < 2) {\n return undefined;\n }\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 = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return { key: frame.type, info: description, data: value };\n } else {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = ID3._utf8ArrayToStr(frame.data.subarray(1));\n return { key: frame.type, data: text };\n }\n };\n\n ID3._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\n var index = 1;\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n index += description.length + 1;\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return { key: frame.type, info: description, data: value };\n } else {\n /*\n Format:\n [0-?] = {URL}\n */\n var url = ID3._utf8ArrayToStr(frame.data);\n return { key: frame.type, data: url };\n }\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\n\n ID3._utf8ArrayToStr = function _utf8ArrayToStr(array) {\n var exitOnNull = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n\n var len = array.length;\n var c = void 0;\n var char2 = void 0;\n var char3 = void 0;\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:case 1:case 2:case 3:case 4:case 5:case 6:case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c);\n break;\n case 12: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 default:\n }\n }\n return out;\n };\n\n return ID3;\n}();\n\nvar utf8ArrayToStr = ID3._utf8ArrayToStr;\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ID3);\n\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// CONCATENATED MODULE: ./src/crypt/aes-crypto.js\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar AESCrypto = function () {\n function AESCrypto(subtle, iv) {\n _classCallCheck(this, AESCrypto);\n\n this.subtle = subtle;\n this.aesIV = iv;\n }\n\n AESCrypto.prototype.decrypt = function decrypt(data, key) {\n return this.subtle.decrypt({ name: 'AES-CBC', iv: this.aesIV }, key, data);\n };\n\n return AESCrypto;\n}();\n\n/* harmony default export */ var aes_crypto = (AESCrypto);\n// CONCATENATED MODULE: ./src/crypt/fast-aes-key.js\nfunction fast_aes_key__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar FastAESKey = function () {\n function FastAESKey(subtle, key) {\n fast_aes_key__classCallCheck(this, FastAESKey);\n\n this.subtle = subtle;\n this.key = key;\n }\n\n FastAESKey.prototype.expandKey = function expandKey() {\n return this.subtle.importKey('raw', this.key, { name: 'AES-CBC' }, false, ['encrypt', 'decrypt']);\n };\n\n return FastAESKey;\n}();\n\n/* harmony default export */ var fast_aes_key = (FastAESKey);\n// CONCATENATED MODULE: ./src/crypt/aes-decryptor.js\nfunction aes_decryptor__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar AESDecryptor = function () {\n function AESDecryptor() {\n aes_decryptor__classCallCheck(this, AESDecryptor);\n\n // Static after running initTable\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\n // Changes during runtime\n this.key = new Uint32Array(0);\n\n this.initTable();\n }\n\n // Using view.getUint32() also swaps the byte order.\n\n\n AESDecryptor.prototype.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\n AESDecryptor.prototype.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\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\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\n AESDecryptor.prototype.expandKey = function expandKey(keyBuffer) {\n // convert keyBuffer to Uint32Array\n var key = this.uint8ArrayToUint32Array_(keyBuffer);\n var sameKey = true;\n var offset = 0;\n\n while (offset < key.length && sameKey) {\n sameKey = key[offset] === this.key[offset];\n offset++;\n }\n\n if (sameKey) {\n return;\n }\n\n this.key = key;\n var keySize = this.keySize = key.length;\n\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\n\n var ksRows = this.ksRows = (keySize + 6 + 1) * 4;\n var ksRow = void 0;\n var invKsRow = void 0;\n\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\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\n var prev = void 0;\n var t = void 0;\n\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n t = prev;\n\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\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\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\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\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n };\n\n // Adding this as a method greatly improves performance.\n\n\n AESDecryptor.prototype.networkToHostOrderSwap = function networkToHostOrderSwap(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n\n AESDecryptor.prototype.decrypt = function decrypt(inputArrayBuffer, offset, aesIV) {\n var nRounds = this.keySize + 6;\n var invKeySchedule = this.invKeySchedule;\n var invSBOX = this.invSBox;\n\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\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\n var inputInt32 = new Int32Array(inputArrayBuffer);\n var outputInt32 = new Int32Array(inputInt32.length);\n\n var t0 = void 0,\n t1 = void 0,\n t2 = void 0,\n t3 = void 0;\n var s0 = void 0,\n s1 = void 0,\n s2 = void 0,\n s3 = void 0;\n var inputWords0 = void 0,\n inputWords1 = void 0,\n inputWords2 = void 0,\n inputWords3 = void 0;\n\n var ksRow, i;\n var swapWord = this.networkToHostOrderSwap;\n\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\n s0 = inputWords0 ^ invKeySchedule[0];\n s1 = inputWords3 ^ invKeySchedule[1];\n s2 = inputWords2 ^ invKeySchedule[2];\n s3 = inputWords1 ^ invKeySchedule[3];\n\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\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 ksRow = 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\n offset = offset + 4;\n }\n\n return outputInt32.buffer;\n };\n\n AESDecryptor.prototype.destroy = function destroy() {\n this.key = undefined;\n this.keySize = undefined;\n this.ksRows = undefined;\n\n this.sBox = undefined;\n this.invSBox = undefined;\n this.subMix = undefined;\n this.invSubMix = undefined;\n this.keySchedule = undefined;\n this.invKeySchedule = undefined;\n\n this.rcon = undefined;\n };\n\n return AESDecryptor;\n}();\n\n/* harmony default export */ var aes_decryptor = (AESDecryptor);\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/crypt/decrypter.js\nfunction decrypter__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\n\n\n\n/*globals self: false */\n\nvar decrypter_Decrypter = function () {\n function Decrypter(observer, config) {\n decrypter__classCallCheck(this, Decrypter);\n\n this.observer = observer;\n this.config = config;\n this.logEnabled = true;\n try {\n var browserCrypto = crypto ? crypto : self.crypto;\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n } catch (e) {}\n this.disableWebCrypto = !this.subtle;\n }\n\n Decrypter.prototype.isSync = function isSync() {\n return this.disableWebCrypto && this.config.enableSoftwareAES;\n };\n\n Decrypter.prototype.decrypt = function decrypt(data, key, iv, callback) {\n var _this = this;\n\n if (this.disableWebCrypto && this.config.enableSoftwareAES) {\n if (this.logEnabled) {\n logger[\"b\" /* logger */].log('JS AES decrypt');\n this.logEnabled = false;\n }\n var decryptor = this.decryptor;\n if (!decryptor) {\n this.decryptor = decryptor = new aes_decryptor();\n }\n decryptor.expandKey(key);\n callback(decryptor.decrypt(data, 0, iv));\n } else {\n if (this.logEnabled) {\n logger[\"b\" /* logger */].log('WebCrypto AES decrypt');\n this.logEnabled = false;\n }\n var subtle = this.subtle;\n if (this.key !== key) {\n this.key = key;\n this.fastAesKey = new fast_aes_key(subtle, key);\n }\n\n this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n var crypto = new aes_crypto(subtle, iv);\n crypto.decrypt(data, aesKey).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n }).then(function (result) {\n callback(result);\n });\n }).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n };\n\n Decrypter.prototype.onWebCryptoError = function onWebCryptoError(err, data, key, iv, callback) {\n if (this.config.enableSoftwareAES) {\n logger[\"b\" /* logger */].log('WebCrypto Error, disable WebCrypto API');\n this.disableWebCrypto = true;\n this.logEnabled = true;\n this.decrypt(data, key, iv, callback);\n } else {\n logger[\"b\" /* logger */].error('decrypting error : ' + err.message);\n this.observer.trigger(Event.ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_DECRYPT_ERROR, fatal: true, reason: err.message });\n }\n };\n\n Decrypter.prototype.destroy = function destroy() {\n var decryptor = this.decryptor;\n if (decryptor) {\n decryptor.destroy();\n this.decryptor = undefined;\n }\n };\n\n return Decrypter;\n}();\n\n/* harmony default export */ var decrypter = __webpack_exports__[\"a\"] = (decrypter_Decrypter);\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports) {\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// see https://tools.ietf.org/html/rfc1808\r\n\r\n/* jshint ignore:start */\r\n(function(root) { \r\n/* jshint ignore:end */\r\n\r\n var URL_REGEX = /^((?:[^\\/;?#]+:)?)(\\/\\/[^\\/\\;?#]*)?(.*?)??(;.*?)?(\\?.*?)?(#.*?)?$/;\r\n var FIRST_SEGMENT_REGEX = /^([^\\/;?#]*)(.*)$/;\r\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\r\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/).*?(?=\\/)/g;\r\n\r\n var URLToolkit = { // jshint ignore:line\r\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\r\n // E.g\r\n // With opts.alwaysNormalize = false (default, spec compliant)\r\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\r\n // With opts.alwaysNormalize = true (default, not spec compliant)\r\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\r\n buildAbsoluteURL: function(baseURL, relativeURL, opts) {\r\n opts = opts || {};\r\n // remove any remaining space and CRLF\r\n baseURL = baseURL.trim();\r\n relativeURL = relativeURL.trim();\r\n if (!relativeURL) {\r\n // 2a) If the embedded URL is entirely empty, it inherits the\r\n // entire base URL (i.e., is set equal to the base URL)\r\n // and we are done.\r\n if (!opts.alwaysNormalize) {\r\n return baseURL;\r\n }\r\n var basePartsForNormalise = this.parseURL(baseURL);\r\n if (!baseParts) {\r\n throw new Error('Error trying to parse base URL.');\r\n }\r\n basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path);\r\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\r\n }\r\n var relativeParts = this.parseURL(relativeURL);\r\n if (!relativeParts) {\r\n throw new Error('Error trying to parse relative URL.');\r\n }\r\n if (relativeParts.scheme) {\r\n // 2b) If the embedded URL starts with a scheme name, it is\r\n // interpreted as an absolute URL and we are done.\r\n if (!opts.alwaysNormalize) {\r\n return relativeURL;\r\n }\r\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\r\n return URLToolkit.buildURLFromParts(relativeParts);\r\n }\r\n var baseParts = this.parseURL(baseURL);\r\n if (!baseParts) {\r\n throw new Error('Error trying to parse base URL.');\r\n }\r\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\r\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\r\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\r\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\r\n baseParts.netLoc = pathParts[1];\r\n baseParts.path = pathParts[2];\r\n }\r\n if (baseParts.netLoc && !baseParts.path) {\r\n baseParts.path = '/';\r\n }\r\n var builtParts = {\r\n // 2c) Otherwise, the embedded URL inherits the scheme of\r\n // the base URL.\r\n scheme: baseParts.scheme,\r\n netLoc: relativeParts.netLoc,\r\n path: null,\r\n params: relativeParts.params,\r\n query: relativeParts.query,\r\n fragment: relativeParts.fragment\r\n };\r\n if (!relativeParts.netLoc) {\r\n // 3) If the embedded URL's <net_loc> is non-empty, we skip to\r\n // Step 7. Otherwise, the embedded URL inherits the <net_loc>\r\n // (if any) of the base URL.\r\n builtParts.netLoc = baseParts.netLoc;\r\n // 4) If the embedded URL path is preceded by a slash \"/\", the\r\n // path is not relative and we skip to Step 7.\r\n if (relativeParts.path[0] !== '/') {\r\n if (!relativeParts.path) {\r\n // 5) If the embedded URL path is empty (and not preceded by a\r\n // slash), then the embedded URL inherits the base URL path\r\n builtParts.path = baseParts.path;\r\n // 5a) if the embedded URL's <params> is non-empty, we skip to\r\n // step 7; otherwise, it inherits the <params> of the base\r\n // URL (if any) and\r\n if (!relativeParts.params) {\r\n builtParts.params = baseParts.params;\r\n // 5b) if the embedded URL's <query> is non-empty, we skip to\r\n // step 7; otherwise, it inherits the <query> of the base\r\n // URL (if any) and we skip to step 7.\r\n if (!relativeParts.query) {\r\n builtParts.query = baseParts.query;\r\n }\r\n }\r\n } else {\r\n // 6) The last segment of the base URL's path (anything\r\n // following the rightmost slash \"/\", or the entire path if no\r\n // slash is present) is removed and the embedded URL's path is\r\n // appended in its place.\r\n var baseURLPath = baseParts.path;\r\n var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path;\r\n builtParts.path = URLToolkit.normalizePath(newPath);\r\n }\r\n }\r\n }\r\n if (builtParts.path === null) {\r\n builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path;\r\n }\r\n return URLToolkit.buildURLFromParts(builtParts);\r\n },\r\n parseURL: function(url) {\r\n var parts = URL_REGEX.exec(url);\r\n if (!parts) {\r\n return null;\r\n }\r\n return {\r\n scheme: parts[1] || '',\r\n netLoc: parts[2] || '',\r\n path: parts[3] || '',\r\n params: parts[4] || '',\r\n query: parts[5] || '',\r\n fragment: parts[6] || ''\r\n };\r\n },\r\n normalizePath: function(path) {\r\n // The following operations are\r\n // then applied, in order, to the new path:\r\n // 6a) All occurrences of \"./\", where \".\" is a complete path\r\n // segment, are removed.\r\n // 6b) If the path ends with \".\" as a complete path segment,\r\n // that \".\" is removed.\r\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\r\n // 6c) All occurrences of \"<segment>/../\", where <segment> is a\r\n // complete path segment not equal to \"..\", are removed.\r\n // Removal of these path segments is performed iteratively,\r\n // removing the leftmost matching pattern on each iteration,\r\n // until no matching pattern remains.\r\n // 6d) If the path ends with \"<segment>/..\", where <segment> is a\r\n // complete path segment not equal to \"..\", that\r\n // \"<segment>/..\" is removed.\r\n while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {} // jshint ignore:line\r\n return path.split('').reverse().join('');\r\n },\r\n buildURLFromParts: function(parts) {\r\n return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;\r\n }\r\n };\r\n\r\n/* jshint ignore:start */\r\n if(true)\r\n module.exports = URLToolkit;\r\n else if(typeof define === 'function' && define.amd)\r\n define([], function() { return URLToolkit; });\r\n else if(typeof exports === 'object')\r\n exports[\"URLToolkit\"] = URLToolkit;\r\n else\r\n root[\"URLToolkit\"] = URLToolkit;\r\n})(this);\r\n/* jshint ignore:end */\r\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar crypt_decrypter = __webpack_require__(4);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/demux/adts.js\n/**\n * ADTS parser helper\n */\n\n\n\nfunction getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType,\n // :int\n adtsSampleingIndex,\n // :int\n adtsExtensionSampleingIndex,\n // :int\n adtsChanelConfig,\n // :int\n config,\n userAgent = navigator.userAgent.toLowerCase(),\n manifestCodec = audioCodec,\n adtsSampleingRates = [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 adtsSampleingIndex = (data[offset + 2] & 0x3C) >>> 2;\n if (adtsSampleingIndex > adtsSampleingRates.length - 1) {\n observer.trigger(Event.ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: true, reason: 'invalid ADTS sampling index:' + adtsSampleingIndex });\n return;\n }\n adtsChanelConfig = (data[offset + 2] & 0x01) << 2;\n // byte 3\n adtsChanelConfig |= (data[offset + 3] & 0xC0) >>> 6;\n logger[\"b\" /* logger */].log('manifest codec:' + audioCodec + ',ADTS data:type:' + adtsObjectType + ',sampleingIndex:' + adtsSampleingIndex + '[' + adtsSampleingRates[adtsSampleingIndex] + 'Hz],channelConfig:' + adtsChanelConfig);\n // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n if (/firefox/i.test(userAgent)) {\n if (adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n }\n // Android : always use AAC\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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 && adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 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 && (adtsSampleingIndex >= 6 && adtsChanelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChanelConfig === 1) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7;\n // channelConfiguration\n config[1] |= adtsChanelConfig << 3;\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 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 { config: config, samplerate: adtsSampleingRates[adtsSampleingIndex], channelCount: adtsChanelConfig, codec: 'mp4a.40.' + adtsObjectType, manifestCodec: manifestCodec };\n}\n\nfunction isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n}\n\nfunction getHeaderLength(data, offset) {\n return !!(data[offset + 1] & 0x01) ? 7 : 9;\n}\n\nfunction getFullFrameLength(data, offset) {\n return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5;\n}\n\nfunction isHeader(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 if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n}\n\nfunction adts_probe(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 (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n // ADTS frame Length\n var frameLength = headerLength;\n if (offset + 5 < data.length) {\n frameLength = getFullFrameLength(data, offset);\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || newOffset + 1 < data.length && isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n return false;\n}\n\nfunction initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\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[\"b\" /* logger */].log('parsed codec:' + track.codec + ',rate:' + config.samplerate + ',nb channel:' + config.channelCount);\n }\n}\n\nfunction getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n}\n\nfunction parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {\n var headerLength, frameLength, stamp;\n var length = data.length;\n\n // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n headerLength = getHeaderLength(data, offset);\n // retrieve frame size\n frameLength = getFullFrameLength(data, offset);\n frameLength -= headerLength;\n\n if (frameLength > 0 && offset + headerLength + frameLength <= length) {\n stamp = pts + frameIndex * frameDuration;\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n return { headerLength: headerLength, frameLength: frameLength, stamp: stamp };\n }\n\n return undefined;\n}\n\nfunction appendFrame(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);\n if (header) {\n var stamp = header.stamp;\n var headerLength = header.headerLength;\n var frameLength = header.frameLength;\n\n //logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n var aacSample = {\n unit: data.subarray(offset + headerLength, offset + headerLength + frameLength),\n pts: stamp,\n dts: stamp\n };\n\n track.samples.push(aacSample);\n track.len += frameLength;\n\n return { sample: aacSample, length: frameLength + headerLength };\n }\n\n return undefined;\n}\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(3);\n\n// CONCATENATED MODULE: ./src/demux/aacdemuxer.js\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * AAC demuxer\n */\n\n\n\n\nvar aacdemuxer_AACDemuxer = function () {\n function AACDemuxer(observer, remuxer, config) {\n _classCallCheck(this, AACDemuxer);\n\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n AACDemuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/adts', type: 'audio', id: 0, sequenceNumber: 0, isAAC: true, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n\n AACDemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n AACDemuxer.probe = function probe(data) {\n if (!data) {\n return false;\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 = id3[\"a\" /* default */].getID3Data(data, 0) || [];\n var offset = id3Data.length;\n\n for (var length = data.length; offset < length; offset++) {\n if (adts_probe(data, offset)) {\n logger[\"b\" /* logger */].log('ADTS sync word found !');\n return true;\n }\n }\n return false;\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n AACDemuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var track = this._audioTrack;\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0) || [];\n var timestamp = id3[\"a\" /* default */].getTimeStamp(id3Data);\n var pts = timestamp ? 90 * timestamp : timeOffset * 90000;\n var frameIndex = 0;\n var stamp = pts;\n var length = data.length;\n var offset = id3Data.length;\n\n var id3Samples = [{ pts: stamp, dts: stamp, data: id3Data }];\n\n while (offset < length - 1) {\n if (isHeader(data, offset) && offset + 5 < length) {\n initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n logger[\"b\" /* logger */].log('Unable to parse AAC frame');\n break;\n }\n } else if (id3[\"a\" /* default */].isHeader(data, offset)) {\n id3Data = id3[\"a\" /* default */].getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n AACDemuxer.prototype.destroy = function destroy() {};\n\n return AACDemuxer;\n}();\n\n/* harmony default export */ var aacdemuxer = (aacdemuxer_AACDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp4demuxer.js\nfunction mp4demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * MP4 demuxer\n */\n\n\n\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar mp4demuxer_MP4Demuxer = function () {\n function MP4Demuxer(observer, remuxer) {\n mp4demuxer__classCallCheck(this, MP4Demuxer);\n\n this.observer = observer;\n this.remuxer = remuxer;\n }\n\n MP4Demuxer.prototype.resetTimeStamp = function resetTimeStamp(initPTS) {\n this.initPTS = initPTS;\n };\n\n MP4Demuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n //jshint unused:false\n if (initSegment && initSegment.byteLength) {\n var initData = this.initData = MP4Demuxer.parseInitSegment(initSegment);\n\n // default audio codec if nothing specified\n // TODO : extract that from initsegment\n if (audioCodec == null) {\n audioCodec = 'mp4a.40.5';\n }\n if (videoCodec == null) {\n videoCodec = 'avc1.42e01e';\n }\n var tracks = {};\n if (initData.audio && initData.video) {\n tracks.audiovideo = { container: 'video/mp4', codec: audioCodec + ',' + videoCodec, initSegment: duration ? initSegment : null };\n } else {\n if (initData.audio) {\n tracks.audio = { container: 'audio/mp4', codec: audioCodec, initSegment: duration ? initSegment : null };\n }\n if (initData.video) {\n tracks.video = { container: 'video/mp4', codec: videoCodec, initSegment: duration ? initSegment : null };\n }\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, { tracks: tracks });\n } else {\n if (audioCodec) {\n this.audioCodec = audioCodec;\n }\n if (videoCodec) {\n this.videoCodec = videoCodec;\n }\n }\n };\n\n MP4Demuxer.probe = function probe(data) {\n // ensure we find a moof box in the first 16 kB\n return MP4Demuxer.findBox({ data: data, start: 0, end: Math.min(data.length, 16384) }, ['moof']).length > 0;\n };\n\n MP4Demuxer.bin2str = function bin2str(buffer) {\n return String.fromCharCode.apply(null, buffer);\n };\n\n MP4Demuxer.readUint32 = function readUint32(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];\n return val < 0 ? 4294967296 + val : val;\n };\n\n MP4Demuxer.writeUint32 = function writeUint32(buffer, offset, value) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n buffer[offset] = value >> 24;\n buffer[offset + 1] = value >> 16 & 0xff;\n buffer[offset + 2] = value >> 8 & 0xff;\n buffer[offset + 3] = value & 0xff;\n };\n\n // Find the data for a box specified by its path\n\n\n MP4Demuxer.findBox = function findBox(data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults,\n start,\n endbox;\n\n if (data.data) {\n start = data.start;\n end = data.end;\n data = data.data;\n } else {\n start = 0;\n end = data.byteLength;\n }\n\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n\n for (i = start; i < end;) {\n size = MP4Demuxer.readUint32(data, i);\n type = MP4Demuxer.bin2str(data.subarray(i + 4, i + 8));\n endbox = size > 1 ? i + size : end;\n\n if (type === path[0]) {\n\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: data, start: i + 8, end: endbox });\n } else {\n // recursively search for the next box along the path\n subresults = MP4Demuxer.findBox({ data: data, start: i + 8, end: endbox }, path.slice(1));\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n i = endbox;\n }\n\n // we've finished searching all of data\n return results;\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 init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n\n\n MP4Demuxer.parseInitSegment = function parseInitSegment(initSegment) {\n var result = [];\n var traks = MP4Demuxer.findBox(initSegment, ['moov', 'trak']);\n\n traks.forEach(function (trak) {\n var tkhd = MP4Demuxer.findBox(trak, ['tkhd'])[0];\n if (tkhd) {\n var version = tkhd.data[tkhd.start];\n var index = version === 0 ? 12 : 20;\n var trackId = MP4Demuxer.readUint32(tkhd, index);\n\n var mdhd = MP4Demuxer.findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n version = mdhd.data[mdhd.start];\n index = version === 0 ? 12 : 20;\n var timescale = MP4Demuxer.readUint32(mdhd, index);\n\n var hdlr = MP4Demuxer.findBox(trak, ['mdia', 'hdlr'])[0];\n if (hdlr) {\n var hdlrType = MP4Demuxer.bin2str(hdlr.data.subarray(hdlr.start + 8, hdlr.start + 12));\n var type = { 'soun': 'audio', 'vide': 'video' }[hdlrType];\n if (type) {\n // extract codec info. TODO : parse codec details to be able to build MIME type\n var codecBox = MP4Demuxer.findBox(trak, ['mdia', 'minf', 'stbl', 'stsd']);\n if (codecBox.length) {\n codecBox = codecBox[0];\n var codecType = MP4Demuxer.bin2str(codecBox.data.subarray(codecBox.start + 12, codecBox.start + 16));\n logger[\"b\" /* logger */].log('MP4Demuxer:' + type + ':' + codecType + ' found');\n }\n result[trackId] = { timescale: timescale, type: type };\n result[type] = { timescale: timescale, id: trackId };\n }\n }\n }\n }\n });\n return result;\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 timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n\n\n MP4Demuxer.getStartDTS = function getStartDTS(initData, fragment) {\n var trafs, baseTimes, result;\n\n // we need info from two childrend of each track fragment box\n trafs = MP4Demuxer.findBox(fragment, ['moof', 'traf']);\n\n // determine the start times for each track\n baseTimes = [].concat.apply([], trafs.map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n var id, scale, baseTime;\n\n // get the track id from the tfhd\n id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n scale = initData[id].timescale || 90e3;\n\n // get the base media decode time from the tfdt\n baseTime = MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version, result;\n\n version = tfdt.data[tfdt.start];\n result = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 1) {\n result *= Math.pow(2, 32);\n\n result += MP4Demuxer.readUint32(tfdt, 8);\n }\n return result;\n })[0];\n // convert base time to seconds\n return baseTime / scale;\n });\n }));\n\n // return the minimum\n result = Math.min.apply(null, baseTimes);\n return isFinite(result) ? result : 0;\n };\n\n MP4Demuxer.offsetStartDTS = function offsetStartDTS(initData, fragment, timeOffset) {\n MP4Demuxer.findBox(fragment, ['moof', 'traf']).map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n // get the track id from the tfhd\n var id = MP4Demuxer.readUint32(tfhd, 4);\n // assume a 90kHz clock if no timescale was specified\n var timescale = initData[id].timescale || 90e3;\n\n // get the base media decode time from the tfdt\n MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt.data[tfdt.start];\n var baseMediaDecodeTime = MP4Demuxer.readUint32(tfdt, 4);\n if (version === 0) {\n MP4Demuxer.writeUint32(tfdt, 4, baseMediaDecodeTime - timeOffset * timescale);\n } else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += MP4Demuxer.readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n MP4Demuxer.writeUint32(tfdt, 4, upper);\n MP4Demuxer.writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n MP4Demuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var initData = this.initData;\n if (!initData) {\n this.resetInitSegment(data, this.audioCodec, this.videoCodec);\n initData = this.initData;\n }\n var startDTS = void 0,\n initPTS = this.initPTS;\n if (initPTS === undefined) {\n var _startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.initPTS = initPTS = _startDTS - timeOffset;\n this.observer.trigger(events[\"a\" /* default */].INIT_PTS_FOUND, { initPTS: initPTS });\n }\n MP4Demuxer.offsetStartDTS(initData, data, initPTS);\n startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.remuxer.remux(initData.audio, initData.video, null, null, startDTS, contiguous, accurateTimeOffset, data);\n };\n\n MP4Demuxer.prototype.destroy = function destroy() {};\n\n return MP4Demuxer;\n}();\n\n/* harmony default export */ var mp4demuxer = (mp4demuxer_MP4Demuxer);\n// CONCATENATED MODULE: ./src/demux/mpegaudio.js\n/**\n * MPEG parser helper\n */\n\nvar MpegAudio = {\n\n 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\n SamplingRateMap: [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000],\n\n SamplesCoefficients: [\n // MPEG 2.5\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ],\n // Reserved\n [0, // Reserved\n 0, // Layer3\n 0, // Layer2\n 0 // Layer1\n ],\n // MPEG 2\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ],\n // MPEG 1\n [0, // Reserved\n 144, // Layer3\n 144, // Layer2\n 12 // Layer1\n ]],\n\n BytesInSlot: [0, // Reserved\n 1, // Layer3\n 1, // Layer2\n 4 // Layer1\n ],\n\n appendFrame: 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 undefined;\n }\n\n var header = this.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 = { unit: data.subarray(offset, offset + header.frameLength), pts: stamp, dts: stamp };\n\n track.config = [];\n track.channelCount = header.channelCount;\n track.samplerate = header.sampleRate;\n track.samples.push(sample);\n track.len += header.frameLength;\n\n return { sample: sample, length: header.frameLength };\n }\n\n return undefined;\n },\n\n parseHeader: function parseHeader(data, offset) {\n var headerB = data[offset + 1] >> 3 & 3;\n var headerC = data[offset + 1] >> 1 & 3;\n var headerE = data[offset + 2] >> 4 & 15;\n var headerF = data[offset + 2] >> 2 & 3;\n var headerG = data[offset + 2] >> 1 & 1;\n if (headerB !== 1 && headerE !== 0 && headerE !== 15 && headerF !== 3) {\n var columnInBitrates = headerB === 3 ? 3 - headerC : headerC === 3 ? 3 : 4;\n var bitRate = MpegAudio.BitratesMap[columnInBitrates * 14 + headerE - 1] * 1000;\n var columnInSampleRates = headerB === 3 ? 0 : headerB === 2 ? 1 : 2;\n var sampleRate = MpegAudio.SamplingRateMap[columnInSampleRates * 3 + headerF];\n var channelCount = data[offset + 3] >> 6 === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n var sampleCoefficient = MpegAudio.SamplesCoefficients[headerB][headerC];\n var bytesInSlot = MpegAudio.BytesInSlot[headerC];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = parseInt(sampleCoefficient * bitRate / sampleRate + headerG, 10) * bytesInSlot;\n\n return { sampleRate: sampleRate, channelCount: channelCount, frameLength: frameLength, samplesPerFrame: samplesPerFrame };\n }\n\n return undefined;\n },\n\n isHeaderPattern: function isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n },\n\n isHeader: 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 if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n return true;\n }\n return false;\n },\n\n probe: 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 && this.isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4;\n // MPEG frame Length\n var header = this.parseHeader(data, offset);\n var frameLength = headerLength;\n if (header && header.frameLength) {\n frameLength = header.frameLength;\n }\n var newOffset = offset + frameLength;\n if (newOffset === data.length || newOffset + 1 < data.length && this.isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n return false;\n }\n};\n\n/* harmony default export */ var mpegaudio = (MpegAudio);\n// CONCATENATED MODULE: ./src/demux/exp-golomb.js\nfunction exp_golomb__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\n\n\nvar exp_golomb_ExpGolomb = function () {\n function ExpGolomb(data) {\n exp_golomb__classCallCheck(this, ExpGolomb);\n\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\n\n ExpGolomb.prototype.loadWord = function loadWord() {\n var data = this.data,\n bytesAvailable = this.bytesAvailable,\n position = data.byteLength - bytesAvailable,\n workingBytes = new Uint8Array(4),\n 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\n ExpGolomb.prototype.skipBits = function skipBits(count) {\n var skipBytes; // :int\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\n ExpGolomb.prototype.readBits = function readBits(size) {\n var bits = Math.min(this.bitsAvailable, size),\n // :uint\n valu = this.word >>> 32 - bits; // :uint\n if (size > 32) {\n logger[\"b\" /* 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 }\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\n ExpGolomb.prototype.skipLZ = function skipLZ() {\n var leadingZeroCount; // :uint\n for (leadingZeroCount = 0; leadingZeroCount < this.bitsAvailable; ++leadingZeroCount) {\n if (0 !== (this.word & 0x80000000 >>> leadingZeroCount)) {\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\n ExpGolomb.prototype.skipUEG = function skipUEG() {\n this.skipBits(1 + this.skipLZ());\n };\n\n // ():void\n\n\n ExpGolomb.prototype.skipEG = function skipEG() {\n this.skipBits(1 + this.skipLZ());\n };\n\n // ():uint\n\n\n ExpGolomb.prototype.readUEG = function readUEG() {\n var clz = this.skipLZ(); // :uint\n return this.readBits(clz + 1) - 1;\n };\n\n // ():int\n\n\n ExpGolomb.prototype.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\n ExpGolomb.prototype.readBoolean = function readBoolean() {\n return 1 === this.readBits(1);\n };\n\n // ():int\n\n\n ExpGolomb.prototype.readUByte = function readUByte() {\n return this.readBits(8);\n };\n\n // ():int\n\n\n ExpGolomb.prototype.readUShort = function readUShort() {\n return this.readBits(16);\n };\n // ():int\n\n\n ExpGolomb.prototype.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 {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n\n\n ExpGolomb.prototype.skipScalingList = function skipScalingList(count) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n for (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 * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n\n\n ExpGolomb.prototype.readSPS = function readSPS() {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n profileIdc,\n profileCompat,\n levelIdc,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i,\n readUByte = this.readUByte.bind(this),\n readBits = this.readBits.bind(this),\n readUEG = this.readUEG.bind(this),\n readBoolean = this.readBoolean.bind(this),\n skipBits = this.skipBits.bind(this),\n skipEG = this.skipEG.bind(this),\n skipUEG = this.skipUEG.bind(this),\n skipScalingList = this.skipScalingList.bind(this);\n\n readUByte();\n profileIdc = readUByte(); // profile_idc\n profileCompat = readBits(5); // constraint_set[0-4]_flag, u(5)\n skipBits(3); // reserved_zero_3bits u(3),\n levelIdc = 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); // 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(); // offset_for_ref_frame[ i ]\n }\n }\n skipUEG(); // max_num_ref_frames\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n picWidthInMbsMinus1 = readUEG();\n picHeightInMapUnitsMinus1 = readUEG();\n frameMbsOnlyFlag = readBits(1);\n if (frameMbsOnlyFlag === 0) {\n skipBits(1); // 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];break;\n case 2:\n pixelRatio = [12, 11];break;\n case 3:\n pixelRatio = [10, 11];break;\n case 4:\n pixelRatio = [16, 11];break;\n case 5:\n pixelRatio = [40, 33];break;\n case 6:\n pixelRatio = [24, 11];break;\n case 7:\n pixelRatio = [20, 11];break;\n case 8:\n pixelRatio = [32, 11];break;\n case 9:\n pixelRatio = [80, 33];break;\n case 10:\n pixelRatio = [18, 11];break;\n case 11:\n pixelRatio = [15, 11];break;\n case 12:\n pixelRatio = [64, 33];break;\n case 13:\n pixelRatio = [160, 99];break;\n case 14:\n pixelRatio = [4, 3];break;\n case 15:\n pixelRatio = [3, 2];break;\n case 16:\n pixelRatio = [2, 1];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\n ExpGolomb.prototype.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\n return ExpGolomb;\n}();\n\n/* harmony default export */ var exp_golomb = (exp_golomb_ExpGolomb);\n// CONCATENATED MODULE: ./src/demux/sample-aes.js\nfunction sample_aes__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * SAMPLE-AES decrypter\n*/\n\n\n\nvar sample_aes_SampleAesDecrypter = function () {\n function SampleAesDecrypter(observer, config, decryptdata, discardEPB) {\n sample_aes__classCallCheck(this, SampleAesDecrypter);\n\n this.decryptdata = decryptdata;\n this.discardEPB = discardEPB;\n this.decrypter = new crypt_decrypter[\"a\" /* default */](observer, config);\n }\n\n SampleAesDecrypter.prototype.decryptBuffer = function decryptBuffer(encryptedData, callback) {\n this.decrypter.decrypt(encryptedData, this.decryptdata.key.buffer, this.decryptdata.iv.buffer, callback);\n };\n\n // AAC - encrypt all full 16 bytes blocks starting from offset 16\n\n\n SampleAesDecrypter.prototype.decryptAacSample = function decryptAacSample(samples, sampleIndex, callback, sync) {\n var curUnit = samples[sampleIndex].unit;\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n\n var localthis = this;\n this.decryptBuffer(encryptedBuffer, function (decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n curUnit.set(decryptedData, 16);\n\n if (!sync) {\n localthis.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\n });\n };\n\n SampleAesDecrypter.prototype.decryptAacSamples = function decryptAacSamples(samples, sampleIndex, callback) {\n for (;; sampleIndex++) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n\n this.decryptAacSample(samples, sampleIndex, callback, sync);\n\n if (!sync) {\n return;\n }\n }\n };\n\n // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n\n\n SampleAesDecrypter.prototype.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\n SampleAesDecrypter.prototype.getAvcDecryptedUnit = function getAvcDecryptedUnit(decodedData, decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n for (var outputPos = 32; outputPos <= decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(decryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n return decodedData;\n };\n\n SampleAesDecrypter.prototype.decryptAvcSample = function decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync) {\n var decodedData = this.discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n var localthis = this;\n\n this.decryptBuffer(encryptedData.buffer, function (decryptedData) {\n curUnit.data = localthis.getAvcDecryptedUnit(decodedData, decryptedData);\n\n if (!sync) {\n localthis.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n\n SampleAesDecrypter.prototype.decryptAvcSamples = function decryptAvcSamples(samples, sampleIndex, unitIndex, callback) {\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n var curUnits = samples[sampleIndex].units;\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n\n var curUnit = curUnits[unitIndex];\n if (curUnit.length <= 48 || curUnit.type !== 1 && curUnit.type !== 5) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync);\n\n if (!sync) {\n return;\n }\n }\n }\n };\n\n return SampleAesDecrypter;\n}();\n\n/* harmony default export */ var sample_aes = (sample_aes_SampleAesDecrypter);\n// CONCATENATED MODULE: ./src/demux/tsdemuxer.js\nfunction tsdemuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n\n\n\n\n\n// import Hex from '../utils/hex';\n\n\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.\nvar RemuxerTrackIdConfig = {\n video: 0,\n audio: 1,\n id3: 2,\n text: 3\n};\n\nvar tsdemuxer_TSDemuxer = function () {\n function TSDemuxer(observer, remuxer, config, typeSupported) {\n tsdemuxer__classCallCheck(this, TSDemuxer);\n\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.remuxer = remuxer;\n this.sampleAes = null;\n }\n\n TSDemuxer.prototype.setDecryptData = function setDecryptData(decryptdata) {\n if (decryptdata != null && decryptdata.key != null && decryptdata.method === 'SAMPLE-AES') {\n this.sampleAes = new sample_aes(this.observer, this.config, decryptdata, this.discardEPB);\n } else {\n this.sampleAes = null;\n }\n };\n\n TSDemuxer.probe = function probe(data) {\n var syncOffset = TSDemuxer._syncOffset(data);\n if (syncOffset < 0) {\n return false;\n } else {\n if (syncOffset) {\n logger[\"b\" /* logger */].warn('MPEG2-TS detected but first sync word found @ offset ' + syncOffset + ', junk ahead ?');\n }\n return true;\n }\n };\n\n TSDemuxer._syncOffset = function _syncOffset(data) {\n // scan 1000 first bytes\n var scanwindow = Math.min(1000, data.length - 3 * 188);\n var i = 0;\n while (i < scanwindow) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data[i] === 0x47 && data[i + 188] === 0x47 && data[i + 2 * 188] === 0x47) {\n return i;\n } else {\n i++;\n }\n }\n return -1;\n };\n\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n *\n * @param {string} type 'audio' | 'video' | 'id3' | 'text'\n * @param {number} duration\n * @return {object} TSDemuxer's internal track model\n */\n\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 len: 0,\n dropped: type === 'video' ? 0 : undefined,\n isAAC: type === 'audio' ? true : undefined,\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 * @override Implements generic demuxing/remuxing interface (see DemuxerInline)\n * @param {object} initSegment\n * @param {string} audioCodec\n * @param {string} videoCodec\n * @param {number} duration (in TS timescale = 90kHz)\n */\n\n\n TSDemuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n\n this._avcTrack = TSDemuxer.createTrack('video', duration);\n this._audioTrack = TSDemuxer.createTrack('audio', duration);\n this._id3Track = TSDemuxer.createTrack('id3', duration);\n this._txtTrack = TSDemuxer.createTrack('text', duration);\n\n // flush any partial content\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcSample = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = duration;\n };\n\n /**\n * \n * @override\n */\n\n\n TSDemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n // feed incoming data to the front of the parsing pipeline\n\n\n TSDemuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var start,\n len = data.length,\n stt,\n pid,\n atf,\n offset,\n pes,\n unknownPIDs = false;\n this.contiguous = contiguous;\n var pmtParsed = this.pmtParsed,\n avcTrack = this._avcTrack,\n audioTrack = this._audioTrack,\n id3Track = this._id3Track,\n avcId = avcTrack.pid,\n audioId = audioTrack.pid,\n id3Id = id3Track.pid,\n pmtId = this._pmtId,\n avcData = avcTrack.pesData,\n audioData = audioTrack.pesData,\n id3Data = id3Track.pesData,\n parsePAT = this._parsePAT,\n parsePMT = this._parsePMT,\n parsePES = this._parsePES,\n parseAVCPES = this._parseAVCPES.bind(this),\n parseAACPES = this._parseAACPES.bind(this),\n parseMPEGPES = this._parseMPEGPES.bind(this),\n parseID3PES = this._parseID3PES.bind(this);\n\n var syncOffset = TSDemuxer._syncOffset(data);\n\n // don't parse last TS packet if incomplete\n len -= (len + syncOffset) % 188;\n\n // loop through TS packets\n for (start = syncOffset; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40);\n // pid is a 13-bit field starting at the last bit of TS[1]\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4;\n // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n if (atf > 1) {\n offset = start + 5 + data[start + 4];\n // continue if there is only adaptation field\n if (offset === start + 188) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, false);\n }\n avcData = { data: [], size: 0 };\n }\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n break;\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n }\n audioData = { data: [], size: 0 };\n }\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + 188));\n audioData.size += start + 188 - offset;\n }\n break;\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(pes);\n }\n id3Data = { data: [], size: 0 };\n }\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n break;\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n pmtId = this._pmtId = parsePAT(data, offset);\n break;\n case pmtId:\n if (stt) {\n offset += data[offset] + 1;\n }\n var parsedPIDs = parsePMT(data, offset, this.typeSupported.mpeg === true || this.typeSupported.mp3 === true, this.sampleAes != null);\n\n // only update track id if track PID found while parsing PMT\n // this is to avoid resetting the PID to -1 in case\n // track PID transiently disappears from the stream\n // this could happen in case of transient missing audio samples for example\n // NOTE this is only the PID of the track as found in TS,\n // but we are not using this for MP4 track IDs.\n avcId = parsedPIDs.avc;\n if (avcId > 0) {\n avcTrack.pid = avcId;\n }\n audioId = parsedPIDs.audio;\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.isAAC = parsedPIDs.isAAC;\n }\n id3Id = parsedPIDs.id3;\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n if (unknownPIDs && !pmtParsed) {\n logger[\"b\" /* logger */].log('reparse from beginning');\n unknownPIDs = false;\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 case 17:\n case 0x1fff:\n break;\n default:\n unknownPIDs = true;\n break;\n }\n } else {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: false, reason: 'TS packet did not start with 0x47' });\n }\n }\n // try to parse last PES packets\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, true);\n avcTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n avcTrack.pesData = avcData;\n }\n\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n audioTrack.pesData = null;\n } else {\n if (audioData && audioData.size) {\n logger[\"b\" /* logger */].log('last AAC PES packet truncated,might overlap between fragments');\n }\n // either audioData null or PES truncated, keep it for next frag parsing\n audioTrack.pesData = audioData;\n }\n\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(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 if (this.sampleAes == null) {\n this.remuxer.remux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n } else {\n this.decryptAndRemux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.decryptAndRemux = function decryptAndRemux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (audioTrack.samples && audioTrack.isAAC) {\n var localthis = this;\n this.sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n localthis.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.decryptAndRemuxAvc = function decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (videoTrack.samples) {\n var localthis = this;\n this.sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n localthis.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n TSDemuxer.prototype.destroy = function destroy() {\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n };\n\n TSDemuxer.prototype._parsePAT = 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 //logger.log('PMT PID:' + this._pmtId);\n };\n\n TSDemuxer.prototype._parsePMT = function _parsePMT(data, offset, mpegSupported, isSampleAes) {\n var sectionLength,\n tableEnd,\n programInfoLength,\n pid,\n result = { audio: -1, avc: -1, id3: -1, isAAC: true };\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n 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 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 pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n case 0x0f:\n //logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n break;\n\n // Packetized metadata (ID3)\n case 0x15:\n //logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n break;\n\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n /* falls through */\n\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n case 0x1b:\n //logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n break;\n\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n case 0x03:\n case 0x04:\n //logger.log('MPEG PID:' + pid);\n if (!mpegSupported) {\n logger[\"b\" /* logger */].log('MPEG audio found, not supported in this browser for now');\n } else if (result.audio === -1) {\n result.audio = pid;\n result.isAAC = false;\n }\n break;\n\n case 0x24:\n logger[\"b\" /* logger */].warn('HEVC stream type found, not supported for now');\n break;\n\n default:\n logger[\"b\" /* logger */].log('unkown stream type:' + data[offset]);\n break;\n }\n // move to the next table entry\n // skip past the elementary stream descriptors, if present\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n return result;\n };\n\n TSDemuxer.prototype._parsePES = function _parsePES(stream) {\n var i = 0,\n frag,\n pesFlags,\n pesPrefix,\n pesLen,\n pesHdrLen,\n pesData,\n pesPts,\n pesDts,\n payloadStartOffset,\n data = stream.data;\n // safety check\n if (!stream || stream.size === 0) {\n return null;\n }\n\n // we might need up to 19 bytes to read PES header\n // if first chunk of data is less than 19 bytes, let's merge it with following ones until we get 19 bytes\n // usually only one merge is needed (and this is rare ...)\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n }\n //retrieve PTS/DTS from first fragment\n frag = data[0];\n 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 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 + // 1 << 29\n (frag[10] & 0xFF) * 4194304 + // 1 << 22\n (frag[11] & 0xFE) * 16384 + // 1 << 14\n (frag[12] & 0xFF) * 128 + // 1 << 7\n (frag[13] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesPts > 4294967295) {\n // decrement 2^33\n pesPts -= 8589934592;\n }\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29\n (frag[15] & 0xFF) * 4194304 + // 1 << 22\n (frag[16] & 0xFE) * 16384 + // 1 << 14\n (frag[17] & 0xFF) * 128 + // 1 << 7\n (frag[18] & 0xFE) / 2;\n // check if greater than 2^32 -1\n if (pesDts > 4294967295) {\n // decrement 2^33\n pesDts -= 8589934592;\n }\n if (pesPts - pesDts > 60 * 90000) {\n logger[\"b\" /* 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 payloadStartOffset = pesHdrLen + 9;\n\n stream.size -= payloadStartOffset;\n //reassemble PES packet\n 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 { data: pesData, pts: pesPts, dts: pesDts, len: pesLen };\n } else {\n return null;\n }\n };\n\n TSDemuxer.prototype.pushAccesUnit = function pushAccesUnit(avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length;\n // only push AVC sample if starting with a keyframe is not mandatory OR\n // if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n if (!this.config.forceKeyFrameOnDiscontinuity || avcSample.key === true || avcTrack.sps && (nbSamples || this.contiguous)) {\n avcSample.id = nbSamples;\n samples.push(avcSample);\n } else {\n // dropped samples, track it\n avcTrack.dropped++;\n }\n }\n if (avcSample.debug.length) {\n logger[\"b\" /* logger */].log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n };\n\n TSDemuxer.prototype._parseAVCPES = function _parseAVCPES(pes, last) {\n var _this = this;\n\n //logger.log('parse new PES');\n var track = this._avcTrack,\n units = this._parseAVCNALu(pes.data),\n debug = false,\n expGolombDecoder,\n avcSample = this.avcSample,\n push,\n spsfound = false,\n i,\n pushAccesUnit = this.pushAccesUnit.bind(this),\n createAVCSample = function createAVCSample(key, pts, dts, debug) {\n return { key: key, pts: pts, dts: dts, units: [], debug: debug };\n };\n //free pes.data to save up some memory\n pes.data = null;\n\n // if new NAL units found and last sample still there, let's push ...\n // this helps parsing streams with missing AUD (only do this if AUD never found)\n if (avcSample && units.length && !track.audFound) {\n pushAccesUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n\n units.forEach(function (unit) {\n switch (unit.type) {\n //NDR\n case 1:\n push = true;\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'NDR ';\n }\n avcSample.frame = 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 exp_golomb(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 avcSample.key = true;\n }\n }\n break;\n //IDR\n case 5:\n push = true;\n // handle PES not starting with AUD\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n if (debug) {\n avcSample.debug += 'IDR ';\n }\n avcSample.key = true;\n avcSample.frame = true;\n break;\n //SEI\n case 6:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'SEI ';\n }\n expGolombDecoder = new exp_golomb(_this.discardEPB(unit.data));\n\n // skip frameType\n expGolombDecoder.readUByte();\n\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n\n while (!endOfCaptions && expGolombDecoder.bytesAvailable > 1) {\n payloadType = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadType += b;\n } while (b === 0xFF);\n\n // Parse payload size.\n payloadSize = 0;\n do {\n b = expGolombDecoder.readUByte();\n payloadSize += b;\n } while (b === 0xFF);\n\n // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n if (payloadType === 4 && expGolombDecoder.bytesAvailable !== 0) {\n\n endOfCaptions = true;\n\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181) {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49) {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934) {\n var userDataType = expGolombDecoder.readUByte();\n\n // Raw CEA-608 bytes wrapped in CEA-708 packet\n if (userDataType === 3) {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i = 0; i < totalCCs; i++) {\n // 3 bytes per CC\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, { type: 3, pts: pes.pts, bytes: byteArray });\n }\n }\n }\n }\n } else if (payloadSize < expGolombDecoder.bytesAvailable) {\n for (i = 0; i < payloadSize; i++) {\n expGolombDecoder.readUByte();\n }\n }\n }\n break;\n //SPS\n case 7:\n push = true;\n spsfound = true;\n if (debug && avcSample) {\n avcSample.debug += 'SPS ';\n }\n if (!track.sps) {\n expGolombDecoder = new exp_golomb(unit.data);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [unit.data];\n track.duration = _this._duration;\n var codecarray = unit.data.subarray(1, 4);\n var codecstring = 'avc1.';\n for (i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n if (h.length < 2) {\n h = '0' + h;\n }\n codecstring += h;\n }\n track.codec = codecstring;\n }\n break;\n //PPS\n case 8:\n push = true;\n if (debug && avcSample) {\n avcSample.debug += 'PPS ';\n }\n if (!track.pps) {\n track.pps = [unit.data];\n }\n break;\n // AUD\n case 9:\n push = false;\n track.audFound = true;\n if (avcSample) {\n pushAccesUnit(avcSample, track);\n }\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, debug ? 'AUD ' : '');\n break;\n // Filler Data\n case 12:\n push = false;\n break;\n default:\n push = false;\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n break;\n }\n if (avcSample && push) {\n var _units = avcSample.units;\n _units.push(unit);\n }\n });\n // if last PES packet, push samples\n if (last && avcSample) {\n pushAccesUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n\n TSDemuxer.prototype._insertSampleInOrder = function _insertSampleInOrder(arr, data) {\n var len = arr.length;\n if (len > 0) {\n if (data.pts >= arr[len - 1].pts) {\n arr.push(data);\n } else {\n for (var pos = len - 1; pos >= 0; pos--) {\n if (data.pts < arr[pos].pts) {\n arr.splice(pos, 0, data);\n break;\n }\n }\n }\n } else {\n arr.push(data);\n }\n };\n\n TSDemuxer.prototype._getLastNalUnit = function _getLastNalUnit() {\n var avcSample = this.avcSample,\n lastUnit = void 0;\n // try to fallback to previous sample if current one is empty\n if (!avcSample || avcSample.units.length === 0) {\n var track = this._avcTrack,\n samples = track.samples;\n avcSample = samples[samples.length - 1];\n }\n if (avcSample) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n return lastUnit;\n };\n\n TSDemuxer.prototype._parseAVCNALu = function _parseAVCNALu(array) {\n var i = 0,\n len = array.byteLength,\n value,\n overflow,\n track = this._avcTrack,\n state = track.naluState || 0,\n lastState = state;\n var units = [],\n unit,\n unitType,\n lastUnitStart = -1,\n lastUnitType;\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\n while (i < len) {\n value = array[i++];\n // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n }\n // here we have state either equal to 2 or 3\n if (!value) {\n state = 3;\n } else if (value === 1) {\n if (lastUnitStart >= 0) {\n unit = { data: array.subarray(lastUnitStart, i - state - 1), type: lastUnitType };\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();\n if (lastUnit) {\n if (lastState && i <= 4 - lastState) {\n // start delimiter overlapping between PES packets\n // strip start delimiter bytes from the end of last NAL unit\n // check if lastUnit had a state different from zero\n if (lastUnit.state) {\n // strip last bytes\n lastUnit.data = lastUnit.data.subarray(0, lastUnit.data.byteLength - lastState);\n }\n }\n // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n overflow = i - state - 1;\n if (overflow > 0) {\n //logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\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 unit = { data: array.subarray(lastUnitStart, len), type: lastUnitType, state: state };\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();\n if (_lastUnit) {\n var _tmp = new Uint8Array(_lastUnit.data.byteLength + array.byteLength);\n _tmp.set(_lastUnit.data, 0);\n _tmp.set(array, _lastUnit.data.byteLength);\n _lastUnit.data = _tmp;\n }\n }\n track.naluState = state;\n return units;\n };\n\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n\n\n TSDemuxer.prototype.discardEPB = function discardEPB(data) {\n var length = data.byteLength,\n EPBPositions = [],\n i = 1,\n newLength,\n newData;\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 newLength = length - EPBPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\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\n TSDemuxer.prototype._parseAACPES = function _parseAACPES(pes) {\n var track = this._audioTrack,\n data = pes.data,\n pts = pes.pts,\n startOffset = 0,\n aacOverFlow = this.aacOverFlow,\n aacLastPTS = this.aacLastPTS,\n frameDuration,\n frameIndex,\n offset,\n stamp,\n len;\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength);\n //logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n data = tmp;\n }\n // look for ADTS header (0xFFFx)\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (isHeader(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) {\n var reason, fatal;\n if (offset < len - 1) {\n reason = 'AAC PES did not start with ADTS header,offset:' + offset;\n fatal = false;\n } else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n logger[\"b\" /* logger */].warn('parsing error:' + reason);\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: fatal, reason: reason });\n if (fatal) {\n return;\n }\n }\n\n initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n frameIndex = 0;\n frameDuration = getFrameDuration(track.samplerate);\n\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 if (aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS + frameDuration;\n if (Math.abs(newPTS - pts) > 1) {\n logger[\"b\" /* logger */].log('AAC: align PTS for overlapping frames by ' + Math.round((newPTS - pts) / 90));\n pts = newPTS;\n }\n }\n\n //scan for aac samples\n while (offset < len) {\n if (isHeader(data, offset) && offset + 5 < len) {\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n //logger.log(`${Math.round(frame.sample.pts)} : AAC`);\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n //logger.log('Unable to parse AAC frame');\n break;\n }\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len);\n //logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n };\n\n TSDemuxer.prototype._parseMPEGPES = function _parseMPEGPES(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\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(this._audioTrack, 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\n TSDemuxer.prototype._parseID3PES = function _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n };\n\n return TSDemuxer;\n}();\n\n/* harmony default export */ var tsdemuxer = (tsdemuxer_TSDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp3demuxer.js\nfunction mp3demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * MP3 demuxer\n */\n\n\n\n\nvar mp3demuxer_MP3Demuxer = function () {\n function MP3Demuxer(observer, remuxer, config) {\n mp3demuxer__classCallCheck(this, MP3Demuxer);\n\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n MP3Demuxer.prototype.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = { container: 'audio/mpeg', type: 'audio', id: -1, sequenceNumber: 0, isAAC: false, samples: [], len: 0, manifestCodec: audioCodec, duration: duration, inputTimeScale: 90000 };\n };\n\n MP3Demuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n MP3Demuxer.probe = function probe(data) {\n // check if data contains ID3 timestamp and MPEG sync word\n var offset, length;\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0);\n if (id3Data && id3[\"a\" /* default */].getTimeStamp(id3Data) !== undefined) {\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 for (offset = id3Data.length, length = Math.min(data.length - 1, offset + 100); offset < length; offset++) {\n if (mpegaudio.probe(data, offset)) {\n logger[\"b\" /* logger */].log('MPEG Audio sync word found !');\n return true;\n }\n }\n }\n return false;\n };\n\n // feed incoming data to the front of the parsing pipeline\n\n\n MP3Demuxer.prototype.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var id3Data = id3[\"a\" /* default */].getID3Data(data, 0);\n var timestamp = id3[\"a\" /* default */].getTimeStamp(id3Data);\n var pts = timestamp ? 90 * timestamp : timeOffset * 90000;\n var offset = id3Data.length;\n var length = data.length;\n var frameIndex = 0,\n stamp = 0;\n var track = this._audioTrack;\n\n var id3Samples = [{ pts: pts, dts: pts, data: id3Data }];\n\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(track, data, offset, pts, frameIndex);\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n //logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n } else if (id3[\"a\" /* default */].isHeader(data, offset)) {\n id3Data = id3[\"a\" /* default */].getID3Data(data, offset);\n id3Samples.push({ pts: stamp, dts: stamp, data: id3Data });\n offset += id3Data.length;\n } else {\n //nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, { samples: [] }, { samples: id3Samples, inputTimeScale: 90000 }, { samples: [] }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n MP3Demuxer.prototype.destroy = function destroy() {};\n\n return MP3Demuxer;\n}();\n\n/* harmony default export */ var mp3demuxer = (mp3demuxer_MP3Demuxer);\n// CONCATENATED MODULE: ./src/helper/aac.js\nfunction aac__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * AAC helper\n */\n\nvar AAC = function () {\n function AAC() {\n aac__classCallCheck(this, AAC);\n }\n\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 null;\n };\n\n return AAC;\n}();\n\n/* harmony default export */ var aac = (AAC);\n// CONCATENATED MODULE: ./src/remux/mp4-generator.js\nfunction mp4_generator__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Generate MP4 Box\n*/\n\n//import Hex from '../utils/hex';\n\nvar mp4_generator_UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4 = function () {\n function MP4() {\n mp4_generator__classCallCheck(this, MP4);\n }\n\n MP4.init = function init() {\n MP4.types = {\n avc1: [], // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n\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\n var videoHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n\n var audioHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n\n MP4.HDLR_TYPES = {\n 'video': videoHdlr,\n 'audio': audioHdlr\n };\n\n var dref = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n\n var stco = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n\n MP4.STSZ = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00]);\n MP4.VMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]);\n\n MP4.STSD = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // 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\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\n MP4.box = function box(type) {\n var payload = Array.prototype.slice.call(arguments, 1),\n size = 8,\n i = payload.length,\n len = i,\n result;\n // calculate the total size we need to allocate\n while (i--) {\n size += payload[i].byteLength;\n }\n 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\n MP4.hdlr = function hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n\n MP4.mdat = function mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n };\n\n MP4.mdhd = function mdhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.mdhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xFF, upperWordDuration >> 8 & 0xFF, upperWordDuration & 0xFF, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xFF, lowerWordDuration >> 8 & 0xFF, lowerWordDuration & 0xFF, 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00]));\n };\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\n MP4.mfhd = function mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags\n sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF]) // sequence_number\n );\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\n MP4.moof = function moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n };\n /**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n\n\n MP4.moov = function moov(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\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\n MP4.mvex = function mvex(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\n\n MP4.mvhd = function mvhd(timescale, duration) {\n duration *= timescale;\n var upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1));\n var lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n var bytes = new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // 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, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // 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, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n };\n\n MP4.sdtp = function sdtp(track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i;\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\n return MP4.box(MP4.types.sdtp, bytes);\n };\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\n MP4.avc1 = function avc1(track) {\n var sps = [],\n pps = [],\n i,\n data,\n 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 sps = sps.concat(Array.prototype.slice.call(data)); // SPS\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\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version\n sps[3], // profile\n sps[4], // profile compat\n sps[5], // level\n 0xfc | 3, // 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))),\n // \"PPS\"\n width = track.width,\n height = track.height,\n hSpacing = track.pixelRatio[0],\n vSpacing = track.pixelRatio[1];\n //console.log('avcc:' + Hex.hexDump(avcc));\n return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n width >> 8 & 0xFF, width & 0xff, // width\n height >> 8 & 0xFF, height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x12, 0x64, 0x61, 0x69, 0x6C, //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, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]), // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])), // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24, // hSpacing\n hSpacing >> 16 & 0xFF, hSpacing >> 8 & 0xFF, hSpacing & 0xFF, vSpacing >> 24, // vSpacing\n vSpacing >> 16 & 0xFF, vSpacing >> 8 & 0xFF, vSpacing & 0xFF])));\n };\n\n MP4.esds = function esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n\n 0x03, // descriptor_type\n 0x17 + configlen, // length\n 0x00, 0x01, //es_id\n 0x00, // stream_priority\n\n 0x04, // descriptor_type\n 0x0f + configlen, // length\n 0x40, //codec : mpeg4_audio\n 0x15, // stream_type\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n\n MP4.mp4a = function mp4a(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n\n MP4.mp3 = function mp3(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]));\n };\n\n MP4.stsd = function stsd(track) {\n if (track.type === 'audio') {\n if (!track.isAAC && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp4a(track));\n } else {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.avc1(track));\n }\n };\n\n MP4.tkhd = function tkhd(track) {\n var id = track.id,\n duration = track.duration * track.timescale,\n width = track.width,\n height = track.height,\n upperWordDuration = Math.floor(duration / (mp4_generator_UINT32_MAX + 1)),\n lowerWordDuration = Math.floor(duration % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // 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, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x00, 0x00, // non-audio track volume\n 0x00, 0x00, // 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, // transformation: unity matrix\n width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width\n height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height\n ]));\n };\n\n MP4.traf = function traf(track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track),\n id = track.id,\n upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (mp4_generator_UINT32_MAX + 1)),\n lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (mp4_generator_UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF]) // track_ID\n ), MP4.box(MP4.types.tfdt, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // 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 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n };\n\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n\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\n MP4.trex = function trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n\n MP4.trun = function trun(track, offset) {\n var samples = track.samples || [],\n len = samples.length,\n arraylen = 12 + 16 * len,\n array = new Uint8Array(arraylen),\n i,\n sample,\n duration,\n size,\n flags,\n cts;\n offset += 8 + arraylen;\n array.set([0x00, // version 0\n 0x00, 0x0f, 0x01, // flags\n len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // 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, // sample_duration\n size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // 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, // 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\n MP4.initSegment = function initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n var movie = MP4.moov(tracks),\n result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n\n return MP4;\n}();\n\n/* harmony default export */ var mp4_generator = (MP4);\n// CONCATENATED MODULE: ./src/remux/mp4-remuxer.js\nfunction mp4_remuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n* fMP4 remuxer\n*/\n\n\n\n\n\n\n\n// 10 seconds\nvar MAX_SILENT_FRAME_DURATION = 10 * 1000;\n\nvar mp4_remuxer_MP4Remuxer = function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n mp4_remuxer__classCallCheck(this, MP4Remuxer);\n\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n var userAgent = navigator.userAgent;\n this.isSafari = vendor && vendor.indexOf('Apple') > -1 && userAgent && !userAgent.match('CriOS');\n this.ISGenerated = false;\n }\n\n MP4Remuxer.prototype.destroy = function destroy() {};\n\n MP4Remuxer.prototype.resetTimeStamp = function resetTimeStamp(defaultTimeStamp) {\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n\n MP4Remuxer.prototype.resetInitSegment = function resetInitSegment() {\n this.ISGenerated = false;\n };\n\n MP4Remuxer.prototype.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n if (this.ISGenerated) {\n var nbAudioSamples = audioTrack.samples.length;\n var nbVideoSamples = videoTrack.samples.length;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n if (nbAudioSamples && nbVideoSamples) {\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 audiovideoDeltaDts = (audioTrack.samples[0].dts - videoTrack.samples[0].dts) / videoTrack.inputTimeScale;\n audioTimeOffset += Math.max(0, audiovideoDeltaDts);\n videoTimeOffset += Math.max(0, -audiovideoDeltaDts);\n }\n // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is\n // calculated in remuxAudio.\n //logger.log('nb AAC samples:' + audioTrack.samples.length);\n if (nbAudioSamples) {\n // if initSegment was generated without video samples, regenerate it again\n if (!audioTrack.timescale) {\n logger[\"b\" /* logger */].warn('regenerate InitSegment as audio detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n var audioData = this.remuxAudio(audioTrack, audioTimeOffset, contiguous, accurateTimeOffset);\n //logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var audioTrackLength = void 0;\n if (audioData) {\n audioTrackLength = audioData.endPTS - audioData.startPTS;\n }\n // if initSegment was generated without video samples, regenerate it again\n if (!videoTrack.timescale) {\n logger[\"b\" /* logger */].warn('regenerate InitSegment as video detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n this.remuxVideo(videoTrack, videoTimeOffset, contiguous, audioTrackLength, accurateTimeOffset);\n }\n } else {\n var videoData = void 0;\n //logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n videoData = this.remuxVideo(videoTrack, videoTimeOffset, contiguous, accurateTimeOffset);\n }\n if (videoData && audioTrack.codec) {\n this.remuxEmptyAudio(audioTrack, audioTimeOffset, contiguous, videoData);\n }\n }\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (id3Track.samples.length) {\n this.remuxID3(id3Track, timeOffset);\n }\n //logger.log('nb ID3 samples:' + audioTrack.samples.length);\n if (textTrack.samples.length) {\n this.remuxText(textTrack, timeOffset);\n }\n //notify end of parsing\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSED);\n };\n\n MP4Remuxer.prototype.generateIS = function generateIS(audioTrack, videoTrack, timeOffset) {\n var observer = this.observer,\n audioSamples = audioTrack.samples,\n videoSamples = videoTrack.samples,\n typeSupported = this.typeSupported,\n container = 'audio/mp4',\n tracks = {},\n data = { tracks: tracks },\n computePTSDTS = this._initPTS === undefined,\n initPTS,\n initDTS;\n\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 logger[\"b\" /* logger */].log('audio sampling rate : ' + audioTrack.samplerate);\n if (!audioTrack.isAAC) {\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 }\n tracks.audio = {\n container: container,\n codec: audioTrack.codec,\n initSegment: !audioTrack.isAAC && typeSupported.mpeg ? new Uint8Array() : mp4_generator.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - audioTrack.inputTimeScale * timeOffset;\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 var inputTimeScale = videoTrack.inputTimeScale;\n videoTrack.timescale = inputTimeScale;\n tracks.video = {\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: mp4_generator.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n if (computePTSDTS) {\n initPTS = Math.min(initPTS, videoSamples[0].pts - inputTimeScale * timeOffset);\n initDTS = Math.min(initDTS, videoSamples[0].dts - inputTimeScale * timeOffset);\n this.observer.trigger(events[\"a\" /* default */].INIT_PTS_FOUND, { initPTS: initPTS });\n }\n }\n\n if (Object.keys(tracks).length) {\n observer.trigger(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, data);\n this.ISGenerated = true;\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n } else {\n observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: false, reason: 'no audio/video samples found' });\n }\n };\n\n MP4Remuxer.prototype.remuxVideo = function remuxVideo(track, timeOffset, contiguous, audioTrackLength, accurateTimeOffset) {\n var offset = 8,\n timeScale = track.timescale,\n mp4SampleDuration,\n mdat,\n moof,\n firstPTS,\n firstDTS,\n nextDTS,\n lastPTS,\n lastDTS,\n inputSamples = track.samples,\n outputSamples = [],\n nbSamples = inputSamples.length,\n ptsNormalize = this._PTSNormalize,\n initDTS = this._initDTS;\n\n // for (let i = 0; i < track.samples.length; i++) {\n // let avcSample = track.samples[i];\n // let units = avcSample.units;\n // let unitsString = '';\n // for (let j = 0; j < units.length ; j++) {\n // unitsString += units[j].type + ',';\n // if (units[j].data.length < 500) {\n // unitsString += Hex.hexDump(units[j].data);\n // }\n // }\n // logger.log(avcSample.pts + '/' + avcSample.dts + ',' + unitsString + avcSample.units.length);\n // }\n\n // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n var nextAvcDts = this.nextAvcDts;\n\n var isSafari = this.isSafari;\n\n // Safari does not like overlapping DTS on consecutive fragments. let's use nextAvcDts to overcome this if fragments are consecutive\n if (isSafari) {\n // 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 200 ms PTS gaps (timeScale/5)\n contiguous |= inputSamples.length && nextAvcDts && (accurateTimeOffset && Math.abs(timeOffset - nextAvcDts / timeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAvcDts - initDTS) < timeScale / 5);\n }\n\n if (!contiguous) {\n // if not contiguous, let's use target timeOffset\n nextAvcDts = timeOffset * timeScale;\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 inputSamples.forEach(function (sample) {\n sample.pts = ptsNormalize(sample.pts - initDTS, nextAvcDts);\n sample.dts = ptsNormalize(sample.dts - initDTS, nextAvcDts);\n });\n\n // sort video samples by DTS then PTS then demux id order\n inputSamples.sort(function (a, b) {\n var deltadts = a.dts - b.dts;\n var deltapts = a.pts - b.pts;\n return deltadts ? deltadts : deltapts ? deltapts : a.id - b.id;\n });\n\n // handle broken streams with PTS < DTS, tolerance up 200ms (18000 in 90kHz timescale)\n var PTSDTSshift = inputSamples.reduce(function (prev, curr) {\n return Math.max(Math.min(prev, curr.pts - curr.dts), -18000);\n }, 0);\n if (PTSDTSshift < 0) {\n logger[\"b\" /* logger */].warn('PTS < DTS detected in video samples, shifting DTS by ' + Math.round(PTSDTSshift / 90) + ' ms to overcome this issue');\n for (var i = 0; i < inputSamples.length; i++) {\n inputSamples[i].dts += PTSDTSshift;\n }\n }\n\n // compute first DTS and last DTS, normalize them against reference value\n var sample = inputSamples[0];\n firstDTS = Math.max(sample.dts, 0);\n firstPTS = Math.max(sample.pts, 0);\n\n // check timestamp continuity accross consecutive fragments (this is to remove inter-fragment gap/hole)\n var delta = Math.round((firstDTS - nextAvcDts) / 90);\n // if fragment are contiguous, detect hole/overlapping between fragments\n if (contiguous) {\n if (delta) {\n if (delta > 1) {\n logger[\"b\" /* logger */].log('AVC:' + delta + ' ms hole between fragments detected,filling it');\n } else if (delta < -1) {\n logger[\"b\" /* logger */].log('AVC:' + -delta + ' ms overlapping between fragments detected');\n }\n // remove hole/gap : set DTS to next expected DTS\n firstDTS = nextAvcDts;\n inputSamples[0].dts = firstDTS;\n // offset PTS as well, ensure that PTS is smaller or equal than new DTS\n firstPTS = Math.max(firstPTS - delta, nextAvcDts);\n inputSamples[0].pts = firstPTS;\n logger[\"b\" /* logger */].log('Video/PTS/DTS adjusted: ' + Math.round(firstPTS / 90) + '/' + Math.round(firstDTS / 90) + ',delta:' + delta + ' ms');\n }\n }\n nextDTS = firstDTS;\n\n // compute lastPTS/lastDTS\n sample = inputSamples[inputSamples.length - 1];\n lastDTS = Math.max(sample.dts, 0);\n lastPTS = Math.max(sample.pts, 0, lastDTS);\n\n // on Safari let's signal the same sample duration for all samples\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 if (isSafari) {\n mp4SampleDuration = Math.round((lastDTS - firstDTS) / (inputSamples.length - 1));\n }\n\n var nbNalu = 0,\n naluLen = 0;\n for (var _i = 0; _i < nbSamples; _i++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i],\n units = _sample.units,\n nbUnits = units.length,\n 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 // normalize PTS/DTS\n if (isSafari) {\n // sample DTS is computed using a constant decoding offset (mp4SampleDuration) between samples\n _sample.dts = firstDTS + _i * mp4SampleDuration;\n } else {\n // ensure sample monotonic DTS\n _sample.dts = Math.max(_sample.dts, firstDTS);\n }\n // ensure that computed value is greater or equal than sample DTS\n _sample.pts = Math.max(_sample.pts, _sample.dts);\n }\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 try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MUX_ERROR, details: errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: 'fail allocating video mdat ' + mdatSize });\n return;\n }\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n var avcSample = inputSamples[_i2],\n avcSampleUnits = avcSample.units,\n mp4SampleLength = 0,\n compositionTimeOffset = void 0;\n // convert NALU bitstream to MP4 format (prepend NALU with size field)\n for (var _j = 0, _nbUnits = avcSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = avcSampleUnits[_j],\n unitData = unit.data,\n 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 if (!isSafari) {\n // expected sample duration is the Decoding Timestamp diff of consecutive samples\n if (_i2 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i2 + 1].dts - avcSample.dts;\n } else {\n var config = this.config,\n lastFrameDuration = avcSample.dts - inputSamples[_i2 > 0 ? _i2 - 1 : _i2].dts;\n if (config.stretchShortVideoTrack) {\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 the minimum of maxBufferHole and\n // maxSeekHole. 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 maxBufferHole = config.maxBufferHole,\n maxSeekHole = config.maxSeekHole,\n gapTolerance = Math.floor(Math.min(maxBufferHole, maxSeekHole) * timeScale),\n deltaToFrameEnd = (audioTrackLength ? firstPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n if (deltaToFrameEnd > gapTolerance) {\n // We subtract lastFrameDuration from deltaToFrameEnd to try to prevent any video\n // frame overlap. maxBufferHole/maxSeekHole should be >> lastFrameDuration anyway.\n mp4SampleDuration = deltaToFrameEnd - lastFrameDuration;\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n }\n logger[\"b\" /* logger */].log('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 compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts);\n } else {\n compositionTimeOffset = Math.max(0, mp4SampleDuration * Math.round((avcSample.pts - avcSample.dts) / mp4SampleDuration));\n }\n\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n outputSamples.push({\n size: mp4SampleLength,\n // constant duration\n duration: mp4SampleDuration,\n cts: compositionTimeOffset,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: avcSample.key ? 2 : 1,\n isNonSync: avcSample.key ? 0 : 1\n }\n });\n }\n // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n this.nextAvcDts = lastDTS + mp4SampleDuration;\n var dropped = track.dropped;\n track.len = 0;\n track.nbNalu = 0;\n track.dropped = 0;\n if (outputSamples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var flags = outputSamples[0].flags;\n // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n track.samples = outputSamples;\n moof = mp4_generator.moof(track.sequenceNumber++, firstDTS, track);\n track.samples = [];\n\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: firstPTS / timeScale,\n endPTS: (lastPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: this.nextAvcDts / timeScale,\n type: 'video',\n nb: outputSamples.length,\n dropped: dropped\n };\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, data);\n return data;\n };\n\n MP4Remuxer.prototype.remuxAudio = function remuxAudio(track, timeOffset, contiguous, accurateTimeOffset) {\n var inputTimeScale = track.inputTimeScale,\n mp4timeScale = track.timescale,\n scaleFactor = inputTimeScale / mp4timeScale,\n mp4SampleDuration = track.isAAC ? 1024 : 1152,\n inputSampleDuration = mp4SampleDuration * scaleFactor,\n ptsNormalize = this._PTSNormalize,\n initDTS = this._initDTS,\n rawMPEG = !track.isAAC && this.typeSupported.mpeg;\n\n var offset,\n mp4Sample,\n fillFrame,\n mdat,\n moof,\n firstPTS,\n lastPTS,\n inputSamples = track.samples,\n outputSamples = [],\n nextAudioPts = this.nextAudioPts;\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 contiguous |= inputSamples.length && nextAudioPts && (accurateTimeOffset && Math.abs(timeOffset - nextAudioPts / inputTimeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAudioPts - initDTS) < 20 * inputSampleDuration);\n\n // compute normalized PTS\n inputSamples.forEach(function (sample) {\n sample.pts = sample.dts = ptsNormalize(sample.pts - initDTS, timeOffset * inputTimeScale);\n });\n\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 === 0) {\n return;\n }\n\n if (!contiguous) {\n if (!accurateTimeOffset) {\n // if frag are mot contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n } else {\n // if timeOffset is accurate, let's use it as predicted next audio PTS\n nextAudioPts = timeOffset * inputTimeScale;\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.isAAC) {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length;) {\n // First, let's see how far off this frame is from where we expect it to be\n var sample = inputSamples[i],\n delta;\n var pts = sample.pts;\n delta = pts - nextPts;\n\n //console.log(Math.round(pts) + '/' + Math.round(nextPts) + '/' + Math.round(delta));\n var duration = Math.abs(1000 * delta / inputTimeScale);\n\n // If we're overlapping by more than a duration, drop this sample\n if (delta <= -maxAudioFramesDrift * inputSampleDuration) {\n logger[\"b\" /* logger */].warn('Dropping 1 audio frame @ ' + (nextPts / inputTimeScale).toFixed(3) + 's due to ' + Math.round(duration) + ' ms overlap.');\n inputSamples.splice(i, 1);\n track.len -= sample.unit.length;\n // Don't touch nextPtsNorm or i\n }\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 else if (delta >= maxAudioFramesDrift * inputSampleDuration && duration < MAX_SILENT_FRAME_DURATION && nextPts) {\n var missing = Math.round(delta / inputSampleDuration);\n logger[\"b\" /* logger */].warn('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 fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger[\"b\" /* logger */].log('Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n inputSamples.splice(i, 0, { unit: fillFrame, pts: newStamp, dts: newStamp });\n track.len += fillFrame.length;\n nextPts += inputSampleDuration;\n i++;\n }\n\n // Adjust sample to next expected pts\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n } else {\n // Otherwise, just adjust pts\n if (Math.abs(delta) > 0.1 * inputSampleDuration) {\n //logger.log(`Invalid frame delta ${Math.round(delta + inputSampleDuration)} at PTS ${Math.round(pts / 90)} (should be ${Math.round(inputSampleDuration)}).`);\n }\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n }\n }\n\n for (var _j2 = 0, _nbSamples = inputSamples.length; _j2 < _nbSamples; _j2++) {\n var audioSample = inputSamples[_j2];\n var unit = audioSample.unit;\n var _pts = audioSample.pts;\n //logger.log(`Audio/PTS:${Math.round(pts/90)}`);\n // if not first sample\n if (lastPTS !== undefined) {\n mp4Sample.duration = Math.round((_pts - lastPTS) / scaleFactor);\n } else {\n var _delta = Math.round(1000 * (_pts - nextAudioPts) / inputTimeScale),\n numMissingFrames = 0;\n // if fragment are contiguous, detect hole/overlapping between fragments\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n if (contiguous && track.isAAC) {\n // log delta\n if (_delta) {\n if (_delta > 0 && _delta < MAX_SILENT_FRAME_DURATION) {\n numMissingFrames = Math.round((_pts - nextAudioPts) / inputSampleDuration);\n logger[\"b\" /* logger */].log(_delta + ' ms hole between AAC samples detected,filling it');\n if (numMissingFrames > 0) {\n fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n fillFrame = unit.subarray();\n }\n track.len += numMissingFrames * fillFrame.length;\n }\n // if we have frame overlap, overlapping for more than half a frame duraion\n } else if (_delta < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger[\"b\" /* logger */].log('drop overlapping AAC sample, expected/parsed/delta:' + (nextAudioPts / inputTimeScale).toFixed(3) + 's/' + (_pts / inputTimeScale).toFixed(3) + 's/' + -_delta + 'ms');\n track.len -= unit.byteLength;\n continue;\n }\n // set PTS/DTS to expected PTS/DTS\n _pts = nextAudioPts;\n }\n }\n // remember first PTS of our audioSamples\n firstPTS = _pts;\n if (track.len > 0) {\n /* concatenate the audio data and construct the mdat in place\n (need 8 more bytes to fill length and mdat type) */\n var mdatSize = rawMPEG ? track.len : track.len + 8;\n offset = rawMPEG ? 0 : 8;\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MUX_ERROR, details: errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR, fatal: false, bytes: mdatSize, reason: 'fail allocating audio mdat ' + mdatSize });\n return;\n }\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n }\n } else {\n // no audio samples\n return;\n }\n for (var _i3 = 0; _i3 < numMissingFrames; _i3++) {\n fillFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n if (!fillFrame) {\n logger[\"b\" /* logger */].log('Unable to get silent frame for given audio codec; duplicating this frame instead.');\n fillFrame = unit.subarray();\n }\n mdat.set(fillFrame, offset);\n offset += fillFrame.byteLength;\n mp4Sample = {\n size: fillFrame.byteLength,\n cts: 0,\n duration: 1024,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n }\n }\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen;\n //console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${audioSample.pts}/${audioSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(audioSample.pts/4294967296).toFixed(3)}');\n mp4Sample = {\n size: unitLen,\n cts: 0,\n duration: 0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n lastPTS = _pts;\n }\n var lastSampleDuration = 0;\n var nbSamples = outputSamples.length;\n //set last sample duration as being identical to previous sample\n if (nbSamples >= 2) {\n lastSampleDuration = outputSamples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n if (nbSamples) {\n // next audio sample PTS should be equal to last sample PTS + duration\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSampleDuration;\n //logger.log('Audio/PTS/PTSend:' + audioSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n track.len = 0;\n track.samples = outputSamples;\n if (rawMPEG) {\n moof = new Uint8Array();\n } else {\n moof = mp4_generator.moof(track.sequenceNumber++, firstPTS / scaleFactor, track);\n }\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: 'audio',\n nb: nbSamples\n };\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, audioData);\n return audioData;\n }\n return null;\n };\n\n MP4Remuxer.prototype.remuxEmptyAudio = function remuxEmptyAudio(track, timeOffset, contiguous, videoData) {\n var inputTimeScale = track.inputTimeScale,\n mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale,\n scaleFactor = inputTimeScale / mp4timeScale,\n nextAudioPts = this.nextAudioPts,\n\n\n // sync with video's timestamp\n startDTS = (nextAudioPts !== undefined ? nextAudioPts : videoData.startDTS * inputTimeScale) + this._initDTS,\n endDTS = videoData.endDTS * inputTimeScale + this._initDTS,\n\n // one sample's duration value\n sampleDuration = 1024,\n frameDuration = scaleFactor * sampleDuration,\n\n\n // samples count of this segment's duration\n nbSamples = Math.ceil((endDTS - startDTS) / frameDuration),\n\n\n // silent frame\n silentFrame = aac.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n logger[\"b\" /* logger */].warn('remux empty Audio');\n // Can't remux if we can't generate a silent frame...\n if (!silentFrame) {\n logger[\"b\" /* logger */].trace('Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!');\n return;\n }\n\n var samples = [];\n for (var i = 0; i < nbSamples; i++) {\n var stamp = startDTS + i * frameDuration;\n samples.push({ unit: silentFrame, pts: stamp, dts: stamp });\n track.len += silentFrame.length;\n }\n track.samples = samples;\n\n this.remuxAudio(track, timeOffset, contiguous);\n };\n\n MP4Remuxer.prototype.remuxID3 = function remuxID3(track, timeOffset) {\n var length = track.samples.length,\n sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n var initDTS = this._initDTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n 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 = (sample.pts - initPTS) / inputTimeScale;\n sample.dts = (sample.dts - initDTS) / inputTimeScale;\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_METADATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n };\n\n MP4Remuxer.prototype.remuxText = function remuxText(track, timeOffset) {\n track.samples.sort(function (a, b) {\n return a.pts - b.pts;\n });\n\n var length = track.samples.length,\n sample;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n // consume samples\n if (length) {\n for (var index = 0; index < length; index++) {\n 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 = (sample.pts - initPTS) / inputTimeScale;\n }\n this.observer.trigger(events[\"a\" /* default */].FRAG_PARSING_USERDATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n timeOffset = timeOffset;\n };\n\n MP4Remuxer.prototype._PTSNormalize = function _PTSNormalize(value, reference) {\n var offset;\n if (reference === undefined) {\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\n return MP4Remuxer;\n}();\n\n/* harmony default export */ var mp4_remuxer = (mp4_remuxer_MP4Remuxer);\n// CONCATENATED MODULE: ./src/remux/passthrough-remuxer.js\nfunction passthrough_remuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * passthrough remuxer\n*/\n\n\nvar passthrough_remuxer_PassThroughRemuxer = function () {\n function PassThroughRemuxer(observer) {\n passthrough_remuxer__classCallCheck(this, PassThroughRemuxer);\n\n this.observer = observer;\n }\n\n PassThroughRemuxer.prototype.destroy = function destroy() {};\n\n PassThroughRemuxer.prototype.resetTimeStamp = function resetTimeStamp() {};\n\n PassThroughRemuxer.prototype.resetInitSegment = function resetInitSegment() {};\n\n PassThroughRemuxer.prototype.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset, rawData) {\n var observer = this.observer;\n var streamType = '';\n if (audioTrack) {\n streamType += 'audio';\n }\n if (videoTrack) {\n streamType += 'video';\n }\n observer.trigger(events[\"a\" /* default */].FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: streamType,\n nb: 1,\n dropped: 0\n });\n //notify end of parsing\n observer.trigger(events[\"a\" /* default */].FRAG_PARSED);\n };\n\n return PassThroughRemuxer;\n}();\n\n/* harmony default export */ var passthrough_remuxer = (passthrough_remuxer_PassThroughRemuxer);\n// CONCATENATED MODULE: ./src/demux/demuxer-inline.js\nfunction demuxer_inline__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/* inline demuxer.\n * probe fragments and instantiate appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n */\n\n\n\n\n\n\n\n\n\n\n\nvar demuxer_inline_DemuxerInline = function () {\n function DemuxerInline(observer, typeSupported, config, vendor) {\n demuxer_inline__classCallCheck(this, DemuxerInline);\n\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n }\n\n DemuxerInline.prototype.destroy = function destroy() {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n }\n };\n\n DemuxerInline.prototype.push = function push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n if (data.byteLength > 0 && decryptdata != null && decryptdata.key != null && decryptdata.method === 'AES-128') {\n var decrypter = this.decrypter;\n if (decrypter == null) {\n decrypter = this.decrypter = new crypt_decrypter[\"a\" /* default */](this.observer, this.config);\n }\n var localthis = this;\n // performance.now() not available on WebWorker, at least on Safari Desktop\n var startTime;\n try {\n startTime = performance.now();\n } catch (error) {\n startTime = Date.now();\n }\n decrypter.decrypt(data, decryptdata.key.buffer, decryptdata.iv.buffer, function (decryptedData) {\n var endTime;\n try {\n endTime = performance.now();\n } catch (error) {\n endTime = Date.now();\n }\n localthis.observer.trigger(events[\"a\" /* default */].FRAG_DECRYPTED, { stats: { tstart: startTime, tdecrypt: endTime } });\n localthis.pushDecrypted(new Uint8Array(decryptedData), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n });\n } else {\n this.pushDecrypted(new Uint8Array(data), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n };\n\n DemuxerInline.prototype.pushDecrypted = function pushDecrypted(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var demuxer = this.demuxer;\n if (!demuxer ||\n // in case of continuity change, we might switch from content type (AAC container to TS container for example)\n // so let's check that current demuxer is still valid\n discontinuity && !this.probe(data)) {\n var observer = this.observer;\n var typeSupported = this.typeSupported;\n var config = this.config;\n // probing order is TS/AAC/MP3/MP4\n var muxConfig = [{ demux: tsdemuxer, remux: mp4_remuxer }, { demux: mp4demuxer, remux: passthrough_remuxer }, { demux: aacdemuxer, remux: mp4_remuxer }, { demux: mp3demuxer, remux: mp4_remuxer }];\n\n // probe for content type\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n var mux = muxConfig[i];\n var probe = mux.demux.probe;\n if (probe(data)) {\n var _remuxer = this.remuxer = new mux.remux(observer, config, typeSupported, this.vendor);\n demuxer = new mux.demux(observer, _remuxer, config, typeSupported);\n this.probe = probe;\n break;\n }\n }\n if (!demuxer) {\n observer.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_PARSING_ERROR, fatal: true, reason: 'no demux matching with content found' });\n return;\n }\n this.demuxer = demuxer;\n }\n var remuxer = this.remuxer;\n\n if (discontinuity || trackSwitch) {\n demuxer.resetInitSegment(initSegment, audioCodec, videoCodec, duration);\n remuxer.resetInitSegment();\n }\n if (discontinuity) {\n demuxer.resetTimeStamp(defaultInitPTS);\n remuxer.resetTimeStamp(defaultInitPTS);\n }\n if (typeof demuxer.setDecryptData === 'function') {\n demuxer.setDecryptData(decryptdata);\n }\n demuxer.append(data, timeOffset, contiguous, accurateTimeOffset);\n };\n\n return DemuxerInline;\n}();\n\n/* harmony default export */ var demuxer_inline = __webpack_exports__[\"a\"] = (demuxer_inline_DemuxerInline);\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\nvar cues_namespaceObject = {};\n__webpack_require__.d(cues_namespaceObject, \"newCue\", function() { return newCue; });\n\n// EXTERNAL MODULE: ./node_modules/url-toolkit/src/url-toolkit.js\nvar url_toolkit = __webpack_require__(6);\nvar url_toolkit_default = /*#__PURE__*/__webpack_require__.n(url_toolkit);\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/errors.js\nvar errors = __webpack_require__(2);\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(0);\n\n// CONCATENATED MODULE: ./src/event-handler.js\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\n\n\n\n\nvar event_handler_EventHandler = function () {\n function EventHandler(hls) {\n _classCallCheck(this, EventHandler);\n\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n\n for (var _len = arguments.length, events = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n this.handledEvents = events;\n this.useGenericHandler = true;\n\n this.registerListeners();\n }\n\n EventHandler.prototype.destroy = function destroy() {\n this.unregisterListeners();\n };\n\n EventHandler.prototype.isEventHandler = function isEventHandler() {\n return _typeof(this.handledEvents) === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n };\n\n EventHandler.prototype.registerListeners = function registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n if (event === 'hlsEventGeneric') {\n throw new Error('Forbidden event name: ' + event);\n }\n this.hls.on(event, this.onEvent);\n }, this);\n }\n };\n\n EventHandler.prototype.unregisterListeners = function unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n this.hls.off(event, this.onEvent);\n }, this);\n }\n };\n\n /**\n * arguments: event (string), data (any)\n */\n\n\n EventHandler.prototype.onEvent = function onEvent(event, data) {\n this.onEventGeneric(event, data);\n };\n\n EventHandler.prototype.onEventGeneric = function onEventGeneric(event, data) {\n var eventToFunction = function eventToFunction(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n if (typeof this[funcName] !== 'function') {\n throw new Error('Event ' + event + ' has no generic handler in this ' + this.constructor.name + ' class (tried ' + funcName + ')');\n }\n return this[funcName].bind(this, data);\n };\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger[\"b\" /* logger */].error('internal error happened while processing ' + event + ':' + err.message);\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR, details: errors[\"a\" /* ErrorDetails */].INTERNAL_EXCEPTION, fatal: false, event: event, err: err });\n }\n };\n\n return EventHandler;\n}();\n\n/* harmony default export */ var event_handler = (event_handler_EventHandler);\n// CONCATENATED MODULE: ./src/utils/attr-list.js\nfunction attr_list__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/;\nvar ATTR_LIST_REGEX = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g;\n\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\n\nvar AttrList = function () {\n function AttrList(attrs) {\n attr_list__classCallCheck(this, AttrList);\n\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n\n AttrList.prototype.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\n AttrList.prototype.hexadecimalInteger = function hexadecimalInteger(attrName) {\n if (this[attrName]) {\n var stringValue = (this[attrName] || '0x').slice(2);\n stringValue = (stringValue.length & 1 ? '0' : '') + stringValue;\n\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\n AttrList.prototype.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\n AttrList.prototype.decimalFloatingPoint = function decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n };\n\n AttrList.prototype.enumeratedString = function enumeratedString(attrName) {\n return this[attrName];\n };\n\n AttrList.prototype.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\n AttrList.parseAttrList = function parseAttrList(input) {\n var match,\n attrs = {};\n ATTR_LIST_REGEX.lastIndex = 0;\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2],\n quote = '\"';\n\n if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) {\n value = value.slice(1, -1);\n }\n attrs[match[1]] = value;\n }\n return attrs;\n };\n\n return AttrList;\n}();\n\n/* harmony default export */ var attr_list = (AttrList);\n// CONCATENATED MODULE: ./src/utils/codecs.js\n// from http://mp4ra.org/codecs.html\nvar sampleEntryCodesISO = {\n audio: {\n 'a3ds': true,\n 'ac-3': true,\n 'ac-4': true,\n 'alac': true,\n 'alaw': true,\n 'dra1': true,\n 'dts+': true,\n 'dts-': true,\n 'dtsc': true,\n 'dtse': true,\n 'dtsh': true,\n 'ec-3': true,\n 'enca': true,\n 'g719': true,\n 'g726': true,\n 'm4ae': true,\n 'mha1': true,\n 'mha2': true,\n 'mhm1': true,\n 'mhm2': true,\n 'mlpa': true,\n 'mp4a': true,\n 'raw ': true,\n 'Opus': true,\n 'samr': true,\n 'sawb': true,\n 'sawp': true,\n 'sevc': true,\n 'sqcp': true,\n 'ssmv': true,\n 'twos': true,\n 'ulaw': true\n },\n video: {\n 'avc1': true,\n 'avc2': true,\n 'avc3': true,\n 'avc4': true,\n 'avcp': true,\n 'drac': true,\n 'dvav': true,\n 'dvhe': true,\n 'encv': true,\n 'hev1': true,\n 'hvc1': true,\n 'mjp2': true,\n 'mp4v': true,\n 'mvc1': true,\n 'mvc2': true,\n 'mvc3': true,\n 'mvc4': true,\n 'resv': true,\n 'rv60': true,\n 's263': true,\n 'svc1': true,\n 'svc2': true,\n 'vc-1': true,\n 'vp08': true,\n 'vp09': true\n }\n};\n\nfunction isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n}\n\nfunction isCodecSupportedInMp4(codec, type) {\n return MediaSource.isTypeSupported((type || 'video') + '/mp4;codecs=\"' + codec + '\"');\n}\n\n\n// CONCATENATED MODULE: ./src/loader/playlist-loader.js\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nfunction playlist_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Playlist Loader\n*/\n\n\n\n\n\n\n\n\n\n// https://regex101.com is your friend\nvar MASTER_PLAYLIST_REGEX = /#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)/g;\nvar MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\n\nvar LEVEL_PLAYLIST_REGEX_FAST = new RegExp([/#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source, // duration (#EXTINF:<duration>,<title>), group 1 => duration, group 2 => title\n/|(?!#)(\\S+)/.source, // segment URI, group 3 => the URI (note newline is not eaten)\n/|#EXT-X-BYTERANGE:*(.+)/.source, // next segment's byterange, group 4 => range spec (x@y)\n/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, // 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\nvar LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\\d+))|(?:#EXT-X-(TARGETDURATION): *(\\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\\r?\\n?/;\n\nvar playlist_loader_LevelKey = function () {\n function LevelKey() {\n playlist_loader__classCallCheck(this, LevelKey);\n\n this.method = null;\n this.key = null;\n this.iv = null;\n this._uri = null;\n }\n\n _createClass(LevelKey, [{\n key: 'uri',\n get: function get() {\n if (!this._uri && this.reluri) {\n this._uri = url_toolkit_default.a.buildAbsoluteURL(this.baseuri, this.reluri, { alwaysNormalize: true });\n }\n return this._uri;\n }\n }]);\n\n return LevelKey;\n}();\n\nvar playlist_loader_Fragment = function () {\n function Fragment() {\n playlist_loader__classCallCheck(this, Fragment);\n\n this._url = null;\n this._byteRange = null;\n this._decryptdata = null;\n this.tagList = [];\n }\n\n /**\n * Utility method for parseLevelPlaylist to create an initialization vector for a given segment\n * @returns {Uint8Array}\n */\n Fragment.prototype.createInitializationVector = function createInitializationVector(segmentNumber) {\n var uint8View = new Uint8Array(16);\n\n for (var i = 12; i < 16; i++) {\n uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff;\n }\n\n return uint8View;\n };\n\n /**\n * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data\n * @param levelkey - a playlist's encryption info\n * @param segmentNumber - the fragment's segment number\n * @returns {*} - an object to be applied as a fragment's decryptdata\n */\n\n\n Fragment.prototype.fragmentDecryptdataFromLevelkey = function fragmentDecryptdataFromLevelkey(levelkey, segmentNumber) {\n var decryptdata = levelkey;\n\n if (levelkey && levelkey.method && levelkey.uri && !levelkey.iv) {\n decryptdata = new playlist_loader_LevelKey();\n decryptdata.method = levelkey.method;\n decryptdata.baseuri = levelkey.baseuri;\n decryptdata.reluri = levelkey.reluri;\n decryptdata.iv = this.createInitializationVector(segmentNumber);\n }\n\n return decryptdata;\n };\n\n Fragment.prototype.cloneObj = function cloneObj(obj) {\n return JSON.parse(JSON.stringify(obj));\n };\n\n _createClass(Fragment, [{\n key: 'url',\n get: function get() {\n if (!this._url && this.relurl) {\n this._url = url_toolkit_default.a.buildAbsoluteURL(this.baseurl, this.relurl, { alwaysNormalize: true });\n }\n return this._url;\n },\n set: function set(value) {\n this._url = value;\n }\n }, {\n key: 'programDateTime',\n get: function get() {\n if (!this._programDateTime && this.rawProgramDateTime) {\n this._programDateTime = new Date(Date.parse(this.rawProgramDateTime));\n }\n return this._programDateTime;\n }\n }, {\n key: 'byteRange',\n get: function get() {\n if (!this._byteRange) {\n var byteRange = this._byteRange = [];\n if (this.rawByteRange) {\n var params = this.rawByteRange.split('@', 2);\n if (params.length === 1) {\n var lastByteRangeEndOffset = this.lastByteRangeEndOffset;\n byteRange[0] = lastByteRangeEndOffset ? lastByteRangeEndOffset : 0;\n } else {\n byteRange[0] = parseInt(params[1]);\n }\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n }\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: 'decryptdata',\n get: function get() {\n if (!this._decryptdata) {\n this._decryptdata = this.fragmentDecryptdataFromLevelkey(this.levelkey, this.sn);\n }\n return this._decryptdata;\n }\n }]);\n\n return Fragment;\n}();\n\nfunction findGroup(groups, mediaGroupId) {\n if (!groups) {\n return null;\n }\n\n var matchingGroup = null;\n\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n if (group.id === mediaGroupId) {\n matchingGroup = group;\n }\n }\n\n return matchingGroup;\n}\n\nvar playlist_loader_PlaylistLoader = function (_EventHandler) {\n _inherits(PlaylistLoader, _EventHandler);\n\n function PlaylistLoader(hls) {\n playlist_loader__classCallCheck(this, PlaylistLoader);\n\n var _this = _possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].LEVEL_LOADING, events[\"a\" /* default */].AUDIO_TRACK_LOADING, events[\"a\" /* default */].SUBTITLE_TRACK_LOADING));\n\n _this.loaders = {};\n return _this;\n }\n\n PlaylistLoader.prototype.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n PlaylistLoader.prototype.onManifestLoading = function onManifestLoading(data) {\n this.load(data.url, { type: 'manifest' });\n };\n\n PlaylistLoader.prototype.onLevelLoading = function onLevelLoading(data) {\n this.load(data.url, { type: 'level', level: data.level, id: data.id });\n };\n\n PlaylistLoader.prototype.onAudioTrackLoading = function onAudioTrackLoading(data) {\n this.load(data.url, { type: 'audioTrack', id: data.id });\n };\n\n PlaylistLoader.prototype.onSubtitleTrackLoading = function onSubtitleTrackLoading(data) {\n this.load(data.url, { type: 'subtitleTrack', id: data.id });\n };\n\n PlaylistLoader.prototype.load = function load(url, context) {\n var loader = this.loaders[context.type];\n if (loader !== undefined) {\n var loaderContext = loader.context;\n if (loaderContext && loaderContext.url === url) {\n logger[\"b\" /* logger */].trace('playlist request ongoing');\n return;\n } else {\n logger[\"b\" /* logger */].warn('abort previous loader for type:' + context.type);\n loader.abort();\n }\n }\n var config = this.hls.config,\n maxRetry = void 0,\n timeout = void 0,\n retryDelay = void 0,\n maxRetryDelay = void 0;\n if (context.type === 'manifest') {\n maxRetry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n maxRetryDelay = config.manifestLoadingMaxRetryTimeout;\n } else if (context.type === 'level') {\n // Disable internal loader retry logic, since we are managing retries in Level Controller\n maxRetry = 0;\n timeout = config.levelLoadingTimeOut;\n } else {\n // TODO Introduce retry settings for audio-track and subtitle-track, it should not use level retry config\n maxRetry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n maxRetryDelay = config.levelLoadingMaxRetryTimeout;\n logger[\"b\" /* logger */].log('loading playlist for ' + context.type + ' ' + (context.level || context.id));\n }\n loader = this.loaders[context.type] = context.loader = typeof config.pLoader !== 'undefined' ? new config.pLoader(config) : new config.loader(config);\n context.url = url;\n context.responseType = '';\n\n var loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderConfig = { timeout: timeout, maxRetry: maxRetry, retryDelay: retryDelay, maxRetryDelay: maxRetryDelay };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) };\n loader.load(context, loaderConfig, loaderCallbacks);\n };\n\n PlaylistLoader.prototype.resolve = function resolve(url, baseUrl) {\n return url_toolkit_default.a.buildAbsoluteURL(baseUrl, url, { alwaysNormalize: true });\n };\n\n PlaylistLoader.prototype.parseMasterPlaylist = function parseMasterPlaylist(string, baseurl) {\n var levels = [],\n result = void 0;\n MASTER_PLAYLIST_REGEX.lastIndex = 0;\n\n function setCodecs(codecs, level) {\n ['video', 'audio'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) {\n return isCodecType(codec, type);\n });\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + 'Codec'] = preferred.length > 0 ? preferred[0] : filtered[0];\n\n // remove from list\n codecs = codecs.filter(function (codec) {\n return filtered.indexOf(codec) === -1;\n });\n }\n });\n\n level.unknownCodecs = codecs;\n }\n\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n var level = {};\n\n var attrs = level.attrs = new attr_list(result[1]);\n level.url = this.resolve(result[2], baseurl);\n\n var resolution = attrs.decimalResolution('RESOLUTION');\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n\n setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);\n\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = this.avc1toavcoti(level.videoCodec);\n }\n\n levels.push(level);\n }\n return levels;\n };\n\n PlaylistLoader.prototype.parseMasterPlaylistMedia = function parseMasterPlaylistMedia(string, baseurl, type) {\n var audioGroups = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n\n var result = void 0;\n var medias = [];\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var media = {};\n var attrs = new attr_list(result[1]);\n if (attrs.TYPE === type) {\n media.groupId = attrs['GROUP-ID'];\n media.name = attrs.NAME;\n media.type = type;\n media.default = attrs.DEFAULT === 'YES';\n media.autoselect = attrs.AUTOSELECT === 'YES';\n media.forced = attrs.FORCED === 'YES';\n if (attrs.URI) {\n media.url = this.resolve(attrs.URI, baseurl);\n }\n media.lang = attrs.LANGUAGE;\n if (!media.name) {\n media.name = media.lang;\n }\n if (audioGroups.length) {\n var groupCodec = findGroup(audioGroups, media.groupId);\n media.audioCodec = groupCodec ? groupCodec.codec : audioGroups[0].codec;\n }\n media.id = id++;\n medias.push(media);\n }\n }\n return medias;\n };\n\n PlaylistLoader.prototype.avc1toavcoti = function avc1toavcoti(codec) {\n var result,\n avcdata = codec.split('.');\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n } else {\n result = codec;\n }\n return result;\n };\n\n PlaylistLoader.prototype.parseLevelPlaylist = function parseLevelPlaylist(string, baseurl, id, type) {\n var currentSN = 0,\n totalduration = 0,\n level = { type: null, version: null, url: baseurl, fragments: [], live: true, startSN: 0 },\n levelkey = new playlist_loader_LevelKey(),\n cc = 0,\n prevFrag = null,\n frag = new playlist_loader_Fragment(),\n result,\n i;\n\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\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 ? title : null;\n frag.tagList.push(title ? ['INF', duration, title] : ['INF', duration]);\n } else if (result[3]) {\n // url\n if (!isNaN(frag.duration)) {\n var sn = currentSN++;\n frag.type = type;\n frag.start = totalduration;\n frag.levelkey = levelkey;\n frag.sn = sn;\n frag.level = id;\n frag.cc = cc;\n frag.baseurl = baseurl;\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n frag.relurl = (' ' + result[3]).slice(1);\n\n level.fragments.push(frag);\n prevFrag = frag;\n totalduration += frag.duration;\n\n frag = new playlist_loader_Fragment();\n }\n } else if (result[4]) {\n // X-BYTERANGE\n frag.rawByteRange = (' ' + result[4]).slice(1);\n if (prevFrag) {\n var lastByteRangeEndOffset = prevFrag.byteRangeEndOffset;\n if (lastByteRangeEndOffset) {\n frag.lastByteRangeEndOffset = lastByteRangeEndOffset;\n }\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 (level.programDateTime === undefined) {\n level.programDateTime = new Date(new Date(Date.parse(result[5])) - 1000 * totalduration);\n }\n } else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n for (i = 1; i < result.length; i++) {\n if (result[i] !== undefined) {\n break;\n }\n }\n\n // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = (' ' + result[i + 2]).slice(1);\n\n switch (result[i]) {\n case '#':\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n break;\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 'TARGETDURATION':\n level.targetduration = parseFloat(value1);\n break;\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n case 'EXTM3U':\n break;\n case 'ENDLIST':\n level.live = false;\n break;\n case 'DIS':\n cc++;\n frag.tagList.push(['DIS']);\n break;\n case 'DISCONTINUITY-SEQ':\n cc = parseInt(value1);\n break;\n case 'KEY':\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-3.4.4\n var decryptparams = value1;\n var keyAttrs = new attr_list(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD'),\n decrypturi = keyAttrs.URI,\n decryptiv = keyAttrs.hexadecimalInteger('IV');\n if (decryptmethod) {\n levelkey = new playlist_loader_LevelKey();\n if (decrypturi && ['AES-128', 'SAMPLE-AES'].indexOf(decryptmethod) >= 0) {\n levelkey.method = decryptmethod;\n // URI to get the key\n levelkey.baseuri = baseurl;\n levelkey.reluri = decrypturi;\n levelkey.key = null;\n // Initialization Vector (IV)\n levelkey.iv = decryptiv;\n }\n }\n break;\n case 'START':\n var startParams = value1;\n var startAttrs = new attr_list(startParams);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET');\n //TIME-OFFSET can be 0\n if (!isNaN(startTimeOffset)) {\n level.startTimeOffset = startTimeOffset;\n }\n break;\n case 'MAP':\n var mapAttrs = new attr_list(value1);\n frag.relurl = mapAttrs.URI;\n frag.rawByteRange = mapAttrs.BYTERANGE;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n frag = new playlist_loader_Fragment();\n break;\n default:\n logger[\"b\" /* logger */].warn('line parsed but not handled: ' + result);\n break;\n }\n }\n }\n frag = prevFrag;\n //logger.log('found ' + level.fragments.length + ' fragments');\n if (frag && !frag.relurl) {\n level.fragments.pop();\n totalduration -= frag.duration;\n }\n level.totalduration = totalduration;\n level.averagetargetduration = totalduration / level.fragments.length;\n level.endSN = currentSN - 1;\n level.startCC = level.fragments[0] ? level.fragments[0].cc : 0;\n level.endCC = cc;\n return level;\n };\n\n PlaylistLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n var string = response.data,\n url = response.url,\n type = context.type,\n id = context.id,\n level = context.level,\n hls = this.hls;\n\n this.loaders[type] = undefined;\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 stats.tload = performance.now();\n //stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n if (string.indexOf('#EXTM3U') === 0) {\n if (string.indexOf('#EXTINF:') > 0) {\n var isLevel = type !== 'audioTrack' && type !== 'subtitleTrack',\n levelId = !isNaN(level) ? level : !isNaN(id) ? id : 0,\n levelDetails = this.parseLevelPlaylist(string, url, levelId, type === 'audioTrack' ? 'audio' : type === 'subtitleTrack' ? 'subtitle' : 'main');\n levelDetails.tload = stats.tload;\n if (type === 'manifest') {\n // first request, stream manifest (no master playlist), fire manifest loaded event with level details\n hls.trigger(events[\"a\" /* default */].MANIFEST_LOADED, { levels: [{ url: url, details: levelDetails }], audioTracks: [], url: url, stats: stats, networkDetails: networkDetails });\n }\n stats.tparsed = performance.now();\n if (levelDetails.targetduration) {\n if (isLevel) {\n hls.trigger(events[\"a\" /* default */].LEVEL_LOADED, { details: levelDetails, level: level || 0, id: id || 0, stats: stats, networkDetails: networkDetails });\n } else {\n if (type === 'audioTrack') {\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADED, { details: levelDetails, id: id, stats: stats, networkDetails: networkDetails });\n } else if (type === 'subtitleTrack') {\n hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADED, { details: levelDetails, id: id, stats: stats, networkDetails: networkDetails });\n }\n }\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'invalid targetduration', networkDetails: networkDetails });\n }\n } else {\n var levels = this.parseMasterPlaylist(string, url);\n // multi level playlist, parse level info\n if (levels.length) {\n var audioGroups = levels.map(function (l) {\n return { id: l.attrs.AUDIO, codec: l.audioCodec };\n });\n var audioTracks = this.parseMasterPlaylistMedia(string, url, 'AUDIO', audioGroups);\n var subtitles = this.parseMasterPlaylistMedia(string, url, 'SUBTITLES');\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 = false;\n audioTracks.forEach(function (audioTrack) {\n if (!audioTrack.url) {\n embeddedAudioFound = true;\n }\n });\n // if no embedded audio track defined, but audio codec signaled in quality level, we need to signal this main audio track\n // this could happen with playlists with alt audio rendition in which quality levels (main) contains both audio+video. but with mixed audio track not signaled\n if (embeddedAudioFound === false && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger[\"b\" /* logger */].log('audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({ type: 'main', name: 'main' });\n }\n }\n hls.trigger(events[\"a\" /* default */].MANIFEST_LOADED, { levels: levels, audioTracks: audioTracks, subtitles: subtitles, url: url, stats: stats, networkDetails: networkDetails });\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no level found in manifest', networkDetails: networkDetails });\n }\n }\n } else {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].MANIFEST_PARSING_ERROR, fatal: true, url: url, reason: 'no EXTM3U delimiter', networkDetails: networkDetails });\n }\n };\n\n PlaylistLoader.prototype.loaderror = function loaderror(response, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var details,\n fatal,\n loader = context.loader;\n switch (context.type) {\n case 'manifest':\n details = errors[\"a\" /* ErrorDetails */].MANIFEST_LOAD_ERROR;\n fatal = true;\n break;\n case 'level':\n details = errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR;\n fatal = false;\n break;\n case 'audioTrack':\n details = errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_ERROR;\n fatal = false;\n break;\n }\n if (loader) {\n loader.abort();\n this.loaders[context.type] = undefined;\n }\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: details, fatal: fatal, url: loader.url, loader: loader, response: response, context: context, networkDetails: networkDetails });\n };\n\n PlaylistLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var details,\n fatal,\n loader = context.loader;\n switch (context.type) {\n case 'manifest':\n details = errors[\"a\" /* ErrorDetails */].MANIFEST_LOAD_TIMEOUT;\n fatal = true;\n break;\n case 'level':\n details = errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT;\n fatal = false;\n break;\n case 'audioTrack':\n details = errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_TIMEOUT;\n fatal = false;\n break;\n }\n if (loader) {\n loader.abort();\n this.loaders[context.type] = undefined;\n }\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: details, fatal: fatal, url: loader.url, loader: loader, context: context, networkDetails: networkDetails });\n };\n\n return PlaylistLoader;\n}(event_handler);\n\n/* harmony default export */ var playlist_loader = (playlist_loader_PlaylistLoader);\n// CONCATENATED MODULE: ./src/loader/fragment-loader.js\nfunction fragment_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction fragment_loader__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction fragment_loader__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Fragment Loader\n*/\n\n\n\n\n\n\nvar fragment_loader_FragmentLoader = function (_EventHandler) {\n fragment_loader__inherits(FragmentLoader, _EventHandler);\n\n function FragmentLoader(hls) {\n fragment_loader__classCallCheck(this, FragmentLoader);\n\n var _this = fragment_loader__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FRAG_LOADING));\n\n _this.loaders = {};\n return _this;\n }\n\n FragmentLoader.prototype.destroy = function destroy() {\n var loaders = this.loaders;\n for (var loaderName in loaders) {\n var loader = loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n FragmentLoader.prototype.onFragLoading = function onFragLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loader = this.loaders[type],\n config = this.hls.config;\n\n frag.loaded = 0;\n if (loader) {\n logger[\"b\" /* logger */].warn('abort previous fragment loader for type:' + type);\n loader.abort();\n }\n loader = this.loaders[type] = frag.loader = typeof config.fLoader !== 'undefined' ? new config.fLoader(config) : new config.loader(config);\n\n var loaderContext = void 0,\n loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderContext = { url: frag.url, frag: frag, responseType: 'arraybuffer', progressData: false };\n var start = frag.byteRangeStartOffset,\n end = frag.byteRangeEndOffset;\n if (!isNaN(start) && !isNaN(end)) {\n loaderContext.rangeStart = start;\n loaderContext.rangeEnd = end;\n }\n loaderConfig = { timeout: config.fragLoadingTimeOut, maxRetry: 0, retryDelay: 0, maxRetryDelay: config.fragLoadingMaxRetryTimeout };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this), onProgress: this.loadprogress.bind(this) };\n loader.load(loaderContext, loaderConfig, loaderCallbacks);\n };\n\n FragmentLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n var payload = response.data,\n frag = context.frag;\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOADED, { payload: payload, frag: frag, stats: stats, networkDetails: networkDetails });\n };\n\n FragmentLoader.prototype.loaderror = function loaderror(response, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var loader = context.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR, fatal: false, frag: context.frag, response: response, networkDetails: networkDetails });\n };\n\n FragmentLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var networkDetails = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var loader = context.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT, fatal: false, frag: context.frag, networkDetails: networkDetails });\n };\n\n // data will be used for progressive parsing\n\n\n FragmentLoader.prototype.loadprogress = function loadprogress(stats, context, data) {\n var networkDetails = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n // jshint ignore:line\n var frag = context.frag;\n frag.loaded = stats.loaded;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOAD_PROGRESS, { frag: frag, stats: stats, networkDetails: networkDetails });\n };\n\n return FragmentLoader;\n}(event_handler);\n\n/* harmony default export */ var fragment_loader = (fragment_loader_FragmentLoader);\n// CONCATENATED MODULE: ./src/loader/key-loader.js\nfunction key_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction key_loader__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction key_loader__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Decrypt key Loader\n*/\n\n\n\n\n\n\nvar key_loader_KeyLoader = function (_EventHandler) {\n key_loader__inherits(KeyLoader, _EventHandler);\n\n function KeyLoader(hls) {\n key_loader__classCallCheck(this, KeyLoader);\n\n var _this = key_loader__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].KEY_LOADING));\n\n _this.loaders = {};\n _this.decryptkey = null;\n _this.decrypturl = null;\n return _this;\n }\n\n KeyLoader.prototype.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n if (loader) {\n loader.destroy();\n }\n }\n this.loaders = {};\n event_handler.prototype.destroy.call(this);\n };\n\n KeyLoader.prototype.onKeyLoading = function onKeyLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loader = this.loaders[type],\n decryptdata = frag.decryptdata,\n uri = decryptdata.uri;\n // if uri is different from previous one or if decrypt key not retrieved yet\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n\n if (loader) {\n logger[\"b\" /* logger */].warn('abort previous key loader for type:' + type);\n loader.abort();\n }\n frag.loader = this.loaders[type] = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n\n var loaderContext = void 0,\n loaderConfig = void 0,\n loaderCallbacks = void 0;\n loaderContext = { url: uri, frag: frag, responseType: 'arraybuffer' };\n loaderConfig = { timeout: config.fragLoadingTimeOut, maxRetry: config.fragLoadingMaxRetry, retryDelay: config.fragLoadingRetryDelay, maxRetryDelay: config.fragLoadingMaxRetryTimeout };\n loaderCallbacks = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) };\n frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);\n } else if (this.decryptkey) {\n // we already loaded this key, return it\n decryptdata.key = this.decryptkey;\n this.hls.trigger(events[\"a\" /* default */].KEY_LOADED, { frag: frag });\n }\n };\n\n KeyLoader.prototype.loadsuccess = function loadsuccess(response, stats, context) {\n var frag = context.frag;\n this.decryptkey = frag.decryptdata.key = new Uint8Array(response.data);\n // detach fragment loader on load success\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].KEY_LOADED, { frag: frag });\n };\n\n KeyLoader.prototype.loaderror = function loaderror(response, context) {\n var frag = context.frag,\n loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR, fatal: false, frag: frag, response: response });\n };\n\n KeyLoader.prototype.loadtimeout = function loadtimeout(stats, context) {\n var frag = context.frag,\n loader = frag.loader;\n if (loader) {\n loader.abort();\n }\n this.loaders[context.type] = undefined;\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].NETWORK_ERROR, details: errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT, fatal: false, frag: frag });\n };\n\n return KeyLoader;\n}(event_handler);\n\n/* harmony default export */ var key_loader = (key_loader_KeyLoader);\n// CONCATENATED MODULE: ./src/utils/binary-search.js\nvar 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 {Array} list The array to search.\n * @param {Function} comparisonFunction\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 * @return {*} The object if it is found or null otherwise.\n */\n search: function search(list, comparisonFunction) {\n var minIndex = 0;\n var maxIndex = list.length - 1;\n var currentIndex = null;\n var currentElement = null;\n\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n\n var comparisonResult = comparisonFunction(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\n return null;\n }\n};\n\n/* harmony default export */ var binary_search = (BinarySearch);\n// CONCATENATED MODULE: ./src/helper/buffer-helper.js\n/**\n * Buffer Helper utils, providing methods dealing buffer length retrieval\n*/\n\nvar BufferHelper = {\n isBuffered: function isBuffered(media, position) {\n try {\n if (media) {\n var buffered = media.buffered;\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\n bufferInfo: function bufferInfo(media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = media.buffered,\n buffered = [],\n i;\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({ start: vbuffered.start(i), end: vbuffered.end(i) });\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 { len: 0, start: pos, end: pos, nextStart: undefined };\n },\n\n bufferedInfo: function bufferedInfo(buffered, pos, maxHoleDuration) {\n var buffered2 = [],\n\n // bufferStart and bufferEnd are buffer boundaries around current video position\n bufferLen,\n bufferStart,\n bufferEnd,\n bufferStartNext,\n i;\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 // 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 (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 for (i = 0, bufferLen = 0, bufferStart = bufferEnd = pos; i < buffered2.length; i++) {\n var start = buffered2[i].start,\n 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 { len: bufferLen, start: bufferStart, end: bufferEnd, nextStart: bufferStartNext };\n }\n};\n\n/* harmony default export */ var buffer_helper = (BufferHelper);\n// EXTERNAL MODULE: ./src/demux/demuxer-inline.js + 12 modules\nvar demuxer_inline = __webpack_require__(7);\n\n// EXTERNAL MODULE: ./node_modules/events/events.js\nvar events_events = __webpack_require__(5);\nvar events_default = /*#__PURE__*/__webpack_require__.n(events_events);\n\n// EXTERNAL MODULE: ./node_modules/webworkify-webpack/index.js\nvar webworkify_webpack = __webpack_require__(9);\nvar webworkify_webpack_default = /*#__PURE__*/__webpack_require__.n(webworkify_webpack);\n\n// CONCATENATED MODULE: ./src/helper/mediasource-helper.js\n/**\n * MediaSource helper\n */\n\nfunction getMediaSource() {\n if (typeof window !== 'undefined') {\n return window.MediaSource || window.WebKitMediaSource;\n }\n}\n// CONCATENATED MODULE: ./src/demux/demuxer.js\nfunction demuxer__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n\n\n\n\n\n\n\n\nvar demuxer_MediaSource = getMediaSource();\n\nvar demuxer_Demuxer = function () {\n function Demuxer(hls, id) {\n demuxer__classCallCheck(this, Demuxer);\n\n this.hls = hls;\n this.id = id;\n // observer setup\n var observer = this.observer = new events_default.a();\n var config = hls.config;\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function (ev, data) {\n data = data || {};\n data.frag = this.frag;\n data.id = this.id;\n hls.trigger(ev, data);\n }.bind(this);\n\n // forward events to main thread\n observer.on(events[\"a\" /* default */].FRAG_DECRYPTED, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_DATA, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSED, forwardMessage);\n observer.on(events[\"a\" /* default */].ERROR, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events[\"a\" /* default */].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events[\"a\" /* default */].INIT_PTS_FOUND, forwardMessage);\n\n var typeSupported = {\n mp4: demuxer_MediaSource.isTypeSupported('video/mp4'),\n mpeg: demuxer_MediaSource.isTypeSupported('audio/mpeg'),\n mp3: demuxer_MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n };\n // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n var vendor = navigator.vendor;\n if (config.enableWorker && typeof Worker !== 'undefined') {\n logger[\"b\" /* logger */].log('demuxing in webworker');\n var w = void 0;\n try {\n w = this.w = webworkify_webpack_default()(/*require.resolve*/(10));\n this.onwmsg = this.onWorkerMessage.bind(this);\n w.addEventListener('message', this.onwmsg);\n w.onerror = function (event) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR, details: errors[\"a\" /* ErrorDetails */].INTERNAL_EXCEPTION, fatal: true, event: 'demuxerWorker', err: { message: event.message + ' (' + event.filename + ':' + event.lineno + ')' } });\n };\n w.postMessage({ cmd: 'init', typeSupported: typeSupported, vendor: vendor, id: id, config: JSON.stringify(config) });\n } catch (err) {\n logger[\"b\" /* logger */].error('error while initializing DemuxerWorker, fallback on DemuxerInline');\n if (w) {\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n URL.revokeObjectURL(w.objectURL);\n }\n this.demuxer = new demuxer_inline[\"a\" /* default */](observer, typeSupported, config, vendor);\n this.w = undefined;\n }\n } else {\n this.demuxer = new demuxer_inline[\"a\" /* default */](observer, typeSupported, config, vendor);\n }\n }\n\n Demuxer.prototype.destroy = function destroy() {\n var w = this.w;\n if (w) {\n w.removeEventListener('message', this.onwmsg);\n w.terminate();\n this.w = null;\n } else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.destroy();\n this.demuxer = null;\n }\n }\n var observer = this.observer;\n if (observer) {\n observer.removeAllListeners();\n this.observer = null;\n }\n };\n\n Demuxer.prototype.push = function push(data, initSegment, audioCodec, videoCodec, frag, duration, accurateTimeOffset, defaultInitPTS) {\n var w = this.w;\n var timeOffset = !isNaN(frag.startDTS) ? frag.startDTS : frag.start;\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && frag.cc === lastFrag.cc);\n var trackSwitch = !(lastFrag && frag.level === lastFrag.level);\n var nextSN = lastFrag && frag.sn === lastFrag.sn + 1;\n var contiguous = !trackSwitch && nextSN;\n if (discontinuity) {\n logger[\"b\" /* logger */].log(this.id + ':discontinuity detected');\n }\n if (trackSwitch) {\n logger[\"b\" /* logger */].log(this.id + ':switch detected');\n }\n this.frag = frag;\n if (w) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n w.postMessage({ cmd: 'demux', data: data, decryptdata: decryptdata, initSegment: initSegment, audioCodec: audioCodec, videoCodec: videoCodec, timeOffset: timeOffset, discontinuity: discontinuity, trackSwitch: trackSwitch, contiguous: contiguous, duration: duration, accurateTimeOffset: accurateTimeOffset, defaultInitPTS: defaultInitPTS }, data instanceof ArrayBuffer ? [data] : []);\n } else {\n var demuxer = this.demuxer;\n if (demuxer) {\n demuxer.push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n }\n };\n\n Demuxer.prototype.onWorkerMessage = function onWorkerMessage(ev) {\n var data = ev.data,\n hls = this.hls;\n //console.log('onWorkerMessage:' + data.event);\n switch (data.event) {\n case 'init':\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n URL.revokeObjectURL(this.w.objectURL);\n break;\n // special case for FRAG_PARSING_DATA: data1 and data2 are transferable objects\n case events[\"a\" /* default */].FRAG_PARSING_DATA:\n data.data.data1 = new Uint8Array(data.data1);\n if (data.data2) {\n data.data.data2 = new Uint8Array(data.data2);\n }\n /* falls through */\n default:\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 return Demuxer;\n}();\n\n/* harmony default export */ var demux_demuxer = (demuxer_Demuxer);\n// CONCATENATED MODULE: ./src/helper/level-helper.js\n/**\n * Level Helper class, providing methods dealing with playlist sliding and drift\n*/\n\n\n\nfunction updatePTS(fragments, fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],\n fragTo = fragments[toIdx],\n fragToPTS = fragTo.startPTS;\n // if we know startPTS[toIdx]\n if (!isNaN(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS - fragFrom.start;\n if (fragFrom.duration < 0) {\n logger[\"b\" /* logger */].warn('negative duration computed for frag ' + fragFrom.sn + ',level ' + fragFrom.level + ', there should be some duration drift between playlist and fragment!');\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n if (fragTo.duration < 0) {\n logger[\"b\" /* logger */].warn('negative duration computed for frag ' + fragTo.sn + ',level ' + fragTo.level + ', there should be some duration drift between playlist and fragment!');\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n fragTo.start = fragFrom.start + fragFrom.duration;\n } else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n}\n\nfunction updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n // update frag PTS/DTS\n var maxStartPTS = startPTS;\n if (!isNaN(frag.startPTS)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(frag.startPTS - startPTS);\n if (isNaN(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n } else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n maxStartPTS = Math.max(startPTS, frag.startPTS);\n startPTS = Math.min(startPTS, frag.startPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS, frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n\n var drift = startPTS - frag.start;\n frag.start = frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.endPTS = endPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n\n var sn = frag.sn;\n // exit if sn out of range\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n var fragIdx, fragments, i;\n fragIdx = sn - details.startSN;\n 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 happpen 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 updatePTS(fragments, i, i - 1);\n }\n\n // adjust fragment PTS/duration from seqnum to last frag\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updatePTS(fragments, i, i + 1);\n }\n details.PTSKnown = true;\n //logger.log(` frag start/end:${startPTS.toFixed(3)}/${endPTS.toFixed(3)}`);\n\n return drift;\n}\n\nfunction mergeDetails(oldDetails, newDetails) {\n var start = Math.max(oldDetails.startSN, newDetails.startSN) - newDetails.startSN,\n end = Math.min(oldDetails.endSN, newDetails.endSN) - newDetails.startSN,\n delta = newDetails.startSN - oldDetails.startSN,\n oldfragments = oldDetails.fragments,\n newfragments = newDetails.fragments,\n ccOffset = 0,\n PTSFrag;\n\n // check if old/new playlists have fragments in common\n if (end < start) {\n newDetails.PTSKnown = false;\n return;\n }\n // loop through overlapping SN and update startPTS , cc, and duration if any found\n for (var i = start; i <= end; i++) {\n var oldFrag = oldfragments[delta + i],\n newFrag = newfragments[i];\n if (newFrag && oldFrag) {\n ccOffset = oldFrag.cc - newFrag.cc;\n if (!isNaN(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n newFrag.backtracked = oldFrag.backtracked;\n newFrag.dropped = oldFrag.dropped;\n PTSFrag = newFrag;\n }\n }\n }\n\n if (ccOffset) {\n logger[\"b\" /* logger */].log('discontinuity sliding from playlist, take drift into account');\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].cc += ccOffset;\n }\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 if (delta >= 0 && delta < oldfragments.length) {\n // adjust start by sliding offset\n var sliding = oldfragments[delta].start;\n for (i = 0; i < newfragments.length; i++) {\n newfragments[i].start += sliding;\n }\n }\n }\n // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n newDetails.PTSKnown = oldDetails.PTSKnown;\n}\n// CONCATENATED MODULE: ./src/utils/timeRanges.js\n/**\n * TimeRanges to string helper\n */\n\nvar TimeRanges = {\n toString: function toString(r) {\n var log = '',\n 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/* harmony default export */ var timeRanges = (TimeRanges);\n// CONCATENATED MODULE: ./src/utils/discontinuities.js\n\n\n\nfunction findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n\n for (var i = 0; i < fragments.length; i += 1) {\n var currentFrag = fragments[i];\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n\n return firstFrag;\n}\n\nfunction findFragWithCC(fragments, CC) {\n return binary_search.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\nfunction shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n var shouldAlign = false;\n if (lastLevel && lastLevel.details && details) {\n if (details.endCC > details.startCC || lastFrag && lastFrag.cc < details.startCC) {\n shouldAlign = true;\n }\n }\n return shouldAlign;\n}\n\n// Find the first frag in the previous level which matches the CC of the first frag of the new level\nfunction findDiscontinuousReferenceFrag(prevDetails, curDetails) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n\n if (!curFrags.length || !prevFrags.length) {\n logger[\"b\" /* logger */].log('No fragments to align');\n return;\n }\n\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n\n if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {\n logger[\"b\" /* logger */].log('No frag in previous level to align on');\n return;\n }\n\n return prevStartFrag;\n}\n\nfunction adjustPts(sliding, details) {\n details.fragments.forEach(function (frag) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n });\n details.PTSKnown = true;\n}\n\n// If a change in CC is detected, the PTS can no longer be relied upon\n// Attempt to align the level by using the last level - find the last frag matching the current CC and use it's PTS\n// as a reference\nfunction alignDiscontinuities(lastFrag, lastLevel, details) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n if (referenceFrag) {\n logger[\"b\" /* logger */].log('Adjusting PTS using last level due to CC increase within current level');\n adjustPts(referenceFrag.start, details);\n }\n }\n // try to align using programDateTime attribute (if available)\n if (details.PTSKnown === false && lastLevel && lastLevel.details) {\n // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n var lastPDT = lastLevel.details.programDateTime;\n var newPDT = details.programDateTime;\n // date diff is in ms. frag.start is in seconds\n var sliding = (newPDT - lastPDT) / 1000 + lastLevel.details.fragments[0].start;\n if (!isNaN(sliding)) {\n logger[\"b\" /* logger */].log('adjusting PTS using programDateTime delta, sliding:' + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}\n// CONCATENATED MODULE: ./src/controller/stream-controller.js\nvar stream_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\nvar 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_LEVEL: 'WAITING_LEVEL',\n PARSING: 'PARSING',\n PARSED: 'PARSED',\n BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR'\n};\n\nvar stream_controller_StreamController = function (_EventHandler) {\n stream_controller__inherits(StreamController, _EventHandler);\n\n function StreamController(hls) {\n stream_controller__classCallCheck(this, StreamController);\n\n var _this = stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].LEVEL_LOADED, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_LOAD_EMERGENCY_ABORTED, events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, events[\"a\" /* default */].FRAG_PARSING_DATA, events[\"a\" /* default */].FRAG_PARSED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, events[\"a\" /* default */].BUFFER_CREATED, events[\"a\" /* default */].BUFFER_APPENDED, events[\"a\" /* default */].BUFFER_FLUSHED));\n\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this.ticks = 0;\n _this._state = State.STOPPED;\n _this.ontick = _this.tick.bind(_this);\n return _this;\n }\n\n StreamController.prototype.destroy = function destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n event_handler.prototype.destroy.call(this);\n this.state = State.STOPPED;\n };\n\n StreamController.prototype.startLoad = function startLoad(startPosition) {\n if (this.levels) {\n var lastCurrentTime = this.lastCurrentTime,\n hls = this.hls;\n this.stopLoad();\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.level = -1;\n this.fragLoadError = 0;\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls.startLevel;\n if (startLevel === -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 }\n // set new level to playlist loader : this will trigger start level load\n // hls.nextLoadLevel remains until it is set to a new value or until a new frag is successfully loaded\n this.level = hls.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n }\n // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"b\" /* logger */].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\n StreamController.prototype.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = State.STOPPED;\n this.forceStartLoad = false;\n };\n\n StreamController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n StreamController.prototype.doTick = function doTick() {\n switch (this.state) {\n case State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n break;\n case State.BUFFER_FLUSHING:\n // in buffer flushing state, reset fragLoadError counter\n this.fragLoadError = 0;\n break;\n case State.IDLE:\n this._doTickIdle();\n break;\n case State.WAITING_LEVEL:\n var level = this.levels[this.level];\n // check if playlist is already loaded\n if (level && level.details) {\n this.state = State.IDLE;\n }\n break;\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = 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.seeking) {\n logger[\"b\" /* logger */].log('mediaController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n break;\n case State.ERROR:\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n default:\n break;\n }\n // check buffer\n this._checkBuffer();\n // check/update current fragment\n this._checkFragmentChanged();\n };\n\n // Ironically the \"idle\" state is the on we do the most logic in it seems ....\n // NOTE: Maybe we could rather schedule a check for buffer length after half of the currently\n // played segment, or on pause/play/seek instead of naively checking every 100ms?\n\n\n StreamController.prototype._doTickIdle = function _doTickIdle() {\n var hls = this.hls,\n config = hls.config,\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 disable\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 (this.levelLastLoaded === undefined || !media && (this.startFragRequested || !config.startFragPrefetch)) {\n return;\n }\n\n // if we have not yet loaded any fragment, start loading from start position\n var pos = void 0;\n if (this.loadedmetadata) {\n pos = media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n }\n // determine next load level\n var level = hls.nextLoadLevel,\n levelInfo = this.levels[level];\n\n if (!levelInfo) {\n return;\n }\n\n var levelBitrate = levelInfo.bitrate,\n maxBufLen = void 0;\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 if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength);\n\n // determine next candidate fragment to be loaded, based on current position and end of buffer position\n // ensure up to `config.maxMaxBufferLength` of buffer upfront\n\n var bufferInfo = buffer_helper.bufferInfo(this.mediaBuffer ? this.mediaBuffer : media, pos, config.maxBufferHole),\n bufferLen = bufferInfo.len;\n // Stay idle if we are still with buffer margins\n if (bufferLen >= maxBufLen) {\n return;\n }\n\n // if buffer length is less than maxBufLen try to load a new fragment ...\n logger[\"b\" /* logger */].trace('buffer length of ' + bufferLen.toFixed(3) + ' is below max of ' + maxBufLen.toFixed(3) + '. checking for more payload ...');\n\n // set next load level : this will trigger a playlist load if needed\n this.level = hls.nextLoadLevel = level;\n\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 === undefined || levelDetails.live === true && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n return;\n }\n\n // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n // dont switch to ENDED if we need to backtrack last fragment\n var fragPrevious = this.fragPrevious;\n if (!levelDetails.live && fragPrevious && !fragPrevious.backtracked && fragPrevious.sn === levelDetails.endSN && !bufferInfo.nextStart) {\n // fragPrevious is last fragment. retrieve level duration using last frag start offset + duration\n // real duration might be lower than initial duration if there are drifts between real frag duration and playlist signaling\n var duration = Math.min(media.duration, fragPrevious.start + fragPrevious.duration);\n // if everything (almost) til the end is buffered, let's signal eos\n // we don't compare exactly media.duration === bufferInfo.end as there could be some subtle media duration difference (audio/video offsets...)\n // tolerate up to one frag duration to cope with these cases.\n // also cope with almost zero last frag duration (max last frag duration with 200ms) refer to https://github.com/video-dev/hls.js/pull/657\n if (duration - Math.max(bufferInfo.end, fragPrevious.start) <= Math.max(0.2, fragPrevious.duration)) {\n // Finalize the media stream\n var data = {};\n if (this.altAudio) {\n data.type = 'video';\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_EOS, data);\n this.state = State.ENDED;\n return;\n }\n }\n\n // if we have the levelDetails for the selected variant, lets continue enrichen our stream (load keys/fragments or trigger EOS, etc..)\n this._fetchPayloadOrEos(pos, bufferInfo, levelDetails);\n };\n\n StreamController.prototype._fetchPayloadOrEos = function _fetchPayloadOrEos(pos, bufferInfo, levelDetails) {\n var fragPrevious = this.fragPrevious,\n level = this.level,\n fragments = levelDetails.fragments,\n fragLen = fragments.length;\n\n // empty playlist\n if (fragLen === 0) {\n return;\n }\n\n // find fragment index, contiguous with end of buffer position\n var start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n bufferEnd = bufferInfo.end,\n frag = void 0;\n\n if (levelDetails.initSegment && !levelDetails.initSegment.data) {\n frag = levelDetails.initSegment;\n } else {\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n var initialLiveManifestSize = this.config.initialLiveManifestSize;\n if (fragLen < initialLiveManifestSize) {\n logger[\"b\" /* logger */].warn('Can not start playback of a level, reason: not enough fragments ' + fragLen + ' < ' + initialLiveManifestSize);\n return;\n }\n\n frag = this._ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen);\n // if it explicitely returns null don't load any fragment and exit function now\n if (frag === null) {\n return;\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n }\n if (!frag) {\n frag = this._findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails);\n }\n if (frag) {\n this._loadFragmentOrKey(frag, level, levelDetails, pos, bufferEnd);\n }\n return;\n };\n\n StreamController.prototype._ensureFragmentAtLivePoint = function _ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments, fragLen) {\n var config = this.hls.config,\n media = this.media;\n\n var frag = void 0;\n\n // check if requested position is within seekable boundaries :\n //logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n var maxLatency = config.liveMaxLatencyDuration !== undefined ? config.liveMaxLatencyDuration : config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n\n if (bufferEnd < Math.max(start - config.maxFragLookUpTolerance, end - maxLatency)) {\n var liveSyncPosition = this.liveSyncPosition = this.computeLivePosition(start, levelDetails);\n logger[\"b\" /* logger */].log('buffer end: ' + bufferEnd.toFixed(3) + ' is located too far from the end of live sliding playlist, reset currentTime to : ' + liveSyncPosition.toFixed(3));\n bufferEnd = liveSyncPosition;\n if (media && media.readyState && media.duration > liveSyncPosition) {\n media.currentTime = liveSyncPosition;\n }\n this.nextLoadPosition = liveSyncPosition;\n }\n\n // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n // don't return null in case media not loaded yet (readystate === 0)\n if (levelDetails.PTSKnown && bufferEnd > end && media && media.readyState) {\n return null;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n var targetSN = fragPrevious.sn + 1;\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n logger[\"b\" /* logger */].log('live playlist, switching playlist, load frag with next SN: ' + frag.sn);\n }\n }\n // next frag SN not available (or not with same continuity counter)\n // look for a frag sharing the same CC\n if (!frag) {\n frag = binary_search.search(fragments, function (frag) {\n return fragPrevious.cc - frag.cc;\n });\n if (frag) {\n logger[\"b\" /* logger */].log('live playlist, switching playlist, load frag with same CC: ' + frag.sn);\n }\n }\n }\n if (!frag) {\n /* we have no idea about which fragment should be loaded.\n so let's load mid fragment. it will help computing playlist sliding and find the right one\n */\n frag = fragments[Math.min(fragLen - 1, Math.round(fragLen / 2))];\n logger[\"b\" /* logger */].log('live playlist, switching playlist, unknown, load middle frag : ' + frag.sn);\n }\n }\n return frag;\n };\n\n StreamController.prototype._findFragment = function _findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails) {\n var config = this.hls.config;\n var frag = void 0;\n var foundFrag = void 0;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n var fragmentWithinToleranceTest = function fragmentWithinToleranceTest(candidate) {\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 } // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n return -1;\n }\n return 0;\n };\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, fragmentWithinToleranceTest);\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n if (foundFrag) {\n frag = foundFrag;\n var curSNIdx = frag.sn - levelDetails.startSN;\n var sameLevel = fragPrevious && frag.level === fragPrevious.level;\n var prevFrag = fragments[curSNIdx - 1];\n var nextFrag = fragments[curSNIdx + 1];\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.sn === fragPrevious.sn) {\n if (sameLevel && !frag.backtracked) {\n if (frag.sn < levelDetails.endSN) {\n var deltaPTS = fragPrevious.deltaPTS;\n // if there is a significant delta between audio and video, larger than max allowed hole,\n // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped)\n // let's try to load previous fragment again to get last keyframe\n // then we will reload again current fragment (that way we should be able to fill the buffer hole ...)\n if (deltaPTS && deltaPTS > config.maxBufferHole && fragPrevious.dropped && curSNIdx) {\n frag = prevFrag;\n logger[\"b\" /* logger */].warn('SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this');\n // decrement previous frag load counter to avoid frag loop loading error when next fragment will get reloaded\n fragPrevious.loadCounter--;\n } else {\n frag = nextFrag;\n logger[\"b\" /* logger */].log('SN just loaded, load next one: ' + frag.sn);\n }\n } else {\n frag = null;\n }\n } else if (frag.backtracked) {\n // Only backtrack a max of 1 consecutive fragment to prevent sliding back too far when little or no frags start with keyframes\n if (nextFrag && nextFrag.backtracked) {\n logger[\"b\" /* logger */].warn('Already backtracked from fragment ' + nextFrag.sn + ', will not backtrack to fragment ' + frag.sn + '. Loading fragment ' + nextFrag.sn);\n frag = nextFrag;\n } else {\n // If a fragment has dropped frames and it's in a same level/sequence, load the previous fragment to try and find the keyframe\n // Reset the dropped count now since it won't be reset until we parse the fragment again, which prevents infinite backtracking on the same segment\n logger[\"b\" /* logger */].warn('Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe');\n frag.dropped = 0;\n if (prevFrag) {\n if (prevFrag.loadCounter) {\n prevFrag.loadCounter--;\n }\n frag = prevFrag;\n frag.backtracked = true;\n } else if (curSNIdx) {\n // can't backtrack on very first fragment\n frag = null;\n }\n }\n }\n }\n }\n return frag;\n };\n\n StreamController.prototype._loadFragmentOrKey = function _loadFragmentOrKey(frag, level, levelDetails, pos, bufferEnd) {\n var hls = this.hls,\n config = hls.config;\n\n //logger.log('loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level);\n this.state = State.KEY_LOADING;\n hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n logger[\"b\" /* logger */].log('Loading ' + frag.sn + ' of [' + levelDetails.startSN + ' ,' + levelDetails.endSN + '],level ' + level + ', currentTime:' + pos.toFixed(3) + ',bufferEnd:' + bufferEnd.toFixed(3));\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n var maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag });\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n frag.autoLevel = hls.autoLevelEnabled;\n frag.bitrateTest = this.bitrateTest;\n\n this.fragCurrent = frag;\n this.startFragRequested = true;\n // Don't update nextLoadPosition for fragments which are not buffered\n if (!isNaN(frag.sn) && !frag.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n // lazy demuxer init, as this could take some time ... do it during frag loading\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(hls, 'main');\n }\n this.state = State.FRAG_LOADING;\n return;\n }\n };\n\n StreamController.prototype.getBufferedFrag = function getBufferedFrag(position) {\n return binary_search.search(this._bufferedFrags, function (frag) {\n if (position < frag.startPTS) {\n return -1;\n } else if (position > frag.endPTS) {\n return 1;\n }\n return 0;\n });\n };\n\n StreamController.prototype.followingBufferedFrag = function followingBufferedFrag(frag) {\n if (frag) {\n // try to get range of next fragment (500ms after this range)\n return this.getBufferedFrag(frag.endPTS + 0.5);\n }\n return null;\n };\n\n StreamController.prototype._checkFragmentChanged = function _checkFragmentChanged() {\n var fragPlayingCurrent,\n currentTime,\n video = this.media;\n if (video && video.readyState && video.seeking === false) {\n 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 if (currentTime > video.playbackRate * this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n if (buffer_helper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getBufferedFrag(currentTime);\n } else if (buffer_helper.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.getBufferedFrag(currentTime + 0.1);\n }\n if (fragPlayingCurrent) {\n var fragPlaying = fragPlayingCurrent;\n if (fragPlaying !== this.fragPlaying) {\n this.hls.trigger(events[\"a\" /* default */].FRAG_CHANGED, { frag: fragPlaying });\n var fragPlayingLevel = fragPlaying.level;\n if (!this.fragPlaying || this.fragPlaying.level !== fragPlayingLevel) {\n this.hls.trigger(events[\"a\" /* default */].LEVEL_SWITCHED, { level: fragPlayingLevel });\n }\n this.fragPlaying = fragPlaying;\n }\n }\n }\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\n\n StreamController.prototype.immediateLevelSwitch = function immediateLevelSwitch() {\n logger[\"b\" /* logger */].log('immediateLevelSwitch');\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n var media = this.media,\n previouslyPaused = void 0;\n if (media) {\n previouslyPaused = media.paused;\n media.pause();\n } else {\n // don't restart playback after instant level switch in case media not attached\n previouslyPaused = true;\n }\n this.previouslyPaused = previouslyPaused;\n }\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n };\n\n /*\n on immediate level switch end, after new fragment has been buffered :\n - nudge video decoder by slightly adjusting video currentTime (if currentTime buffered)\n - resume the playback if needed\n */\n\n\n StreamController.prototype.immediateLevelSwitchEnd = function immediateLevelSwitchEnd() {\n var media = this.media;\n if (media && media.buffered.length) {\n this.immediateSwitch = false;\n if (buffer_helper.isBuffered(media, media.currentTime)) {\n // only nudge if currentTime is buffered\n media.currentTime -= 0.0001;\n }\n if (!this.previouslyPaused) {\n media.play();\n }\n }\n };\n\n StreamController.prototype.nextLevelSwitch = function nextLevelSwitch() {\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 var media = this.media;\n // ensure that media is defined and that metadata are available (to retrieve currentTime)\n if (media && media.readyState) {\n var fetchdelay = void 0,\n fragPlayingCurrent = void 0,\n nextBufferedFrag = void 0;\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n fragPlayingCurrent = this.getBufferedFrag(media.currentTime);\n if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 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.startPTS - 1);\n }\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,\n nextLevel = this.levels[nextLevelId],\n fragLastKbps = this.fragLastKbps;\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n }\n //logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n nextBufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n if (nextBufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n nextBufferedFrag = this.followingBufferedFrag(nextBufferedFrag);\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n // start flush position is the start PTS of next buffered frag.\n // we use frag.naxStartPTS which is max(audio startPTS, video startPTS).\n // in case there is a small PTS Delta between audio and video, using maxStartPTS avoids flushing last samples from current fragment\n this.flushMainBuffer(nextBufferedFrag.maxStartPTS, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n\n StreamController.prototype.flushMainBuffer = function flushMainBuffer(startOffset, endOffset) {\n this.state = State.BUFFER_FLUSHING;\n var flushScope = { startOffset: startOffset, endOffset: endOffset };\n // if alternate audio tracks are used, only flush video, otherwise flush everything\n if (this.altAudio) {\n flushScope.type = 'video';\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, flushScope);\n };\n\n StreamController.prototype.onMediaAttached = function onMediaAttached(data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n if (this.levels && config.autoStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n StreamController.prototype.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger[\"b\" /* logger */].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var levels = this.levels;\n if (levels) {\n // reset fragment load counter\n levels.forEach(function (level) {\n if (level.details) {\n level.details.fragments.forEach(function (fragment) {\n fragment.loadCounter = undefined;\n fragment.backtracked = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n StreamController.prototype.onMediaSeeking = function onMediaSeeking() {\n var media = this.media,\n currentTime = media ? media.currentTime : undefined,\n config = this.config;\n if (!isNaN(currentTime)) {\n logger[\"b\" /* logger */].log('media seeking to ' + currentTime.toFixed(3));\n }\n var mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media;\n var bufferInfo = buffer_helper.bufferInfo(mediaBuffer, currentTime, this.config.maxBufferHole);\n if (this.state === State.FRAG_LOADING) {\n var fragCurrent = this.fragCurrent;\n // check if we are seeking to a unbuffered area AND if frag loading is in progress\n if (bufferInfo.len === 0 && fragCurrent) {\n var tolerance = config.maxFragLookUpTolerance,\n fragStartOffset = fragCurrent.start - tolerance,\n fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance;\n // check if we seek position will be out of currently loaded frag range : if out cancel frag load, if in, don't do anything\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (fragCurrent.loader) {\n logger[\"b\" /* logger */].log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n } else {\n logger[\"b\" /* logger */].log('seeking outside of buffer but within currently loaded fragment range');\n }\n }\n } else if (this.state === State.ENDED) {\n // if seeking to unbuffered area, clean up fragPrevious\n if (bufferInfo.len === 0) {\n this.fragPrevious = 0;\n }\n // switch to IDLE state to check for potential new fragment\n this.state = State.IDLE;\n }\n if (media) {\n this.lastCurrentTime = currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.state !== State.FRAG_LOADING && this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * config.fragLoadingLoopThreshold;\n }\n // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n if (!this.loadedmetadata) {\n this.nextLoadPosition = this.startPosition = currentTime;\n }\n // tick to speed up processing\n this.tick();\n };\n\n StreamController.prototype.onMediaSeeked = function onMediaSeeked() {\n var media = this.media,\n currentTime = media ? media.currentTime : undefined;\n if (!isNaN(currentTime)) {\n logger[\"b\" /* logger */].log('media seeked to ' + currentTime.toFixed(3));\n }\n // tick to speed up FRAGMENT_PLAYING triggering\n this.tick();\n };\n\n StreamController.prototype.onMediaEnded = function onMediaEnded() {\n logger[\"b\" /* logger */].log('media ended');\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n StreamController.prototype.onManifestLoading = function onManifestLoading() {\n // reset buffer on manifest loading\n logger[\"b\" /* logger */].log('trigger BUFFER_RESET');\n this.hls.trigger(events[\"a\" /* default */].BUFFER_RESET);\n this._bufferedFrags = [];\n this.stalled = false;\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n StreamController.prototype.onManifestParsed = function onManifestParsed(data) {\n var aac = false,\n heaac = false,\n codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = aac && heaac;\n if (this.audioCodecSwitch) {\n logger[\"b\" /* logger */].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 var config = this.config;\n if (config.autoStartLoad || this.forceStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n StreamController.prototype.onLevelLoaded = function onLevelLoaded(data) {\n var newDetails = data.details;\n var newLevelId = data.level;\n var lastLevel = this.levels[this.levelLastLoaded];\n var curLevel = this.levels[newLevelId];\n var duration = newDetails.totalduration;\n var sliding = 0;\n\n logger[\"b\" /* logger */].log('level ' + newLevelId + ' loaded [' + newDetails.startSN + ',' + newDetails.endSN + '],duration:' + duration);\n\n if (newDetails.live) {\n var curDetails = curLevel.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown && !isNaN(sliding)) {\n logger[\"b\" /* logger */].log('live playlist sliding:' + sliding.toFixed(3));\n } else {\n logger[\"b\" /* logger */].log('live playlist - outdated PTS, unknown sliding');\n alignDiscontinuities(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n logger[\"b\" /* logger */].log('live playlist - first load, unknown sliding');\n newDetails.PTSKnown = false;\n alignDiscontinuities(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n newDetails.PTSKnown = false;\n }\n // override level info\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(events[\"a\" /* default */].LEVEL_UPDATED, { details: newDetails, level: newLevelId });\n\n if (this.startFragRequested === false) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1 || this.lastCurrentTime === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (!isNaN(startTimeOffset)) {\n if (startTimeOffset < 0) {\n logger[\"b\" /* logger */].log('negative start time offset ' + startTimeOffset + ', count from end of last fragment');\n startTimeOffset = sliding + duration + startTimeOffset;\n }\n logger[\"b\" /* logger */].log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"b\" /* logger */].log('configure startPosition to ' + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n this.lastCurrentTime = this.startPosition;\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n }\n //trigger handler right now\n this.tick();\n };\n\n StreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n StreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'main' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var stats = data.stats,\n currentLevel = this.levels[fragCurrent.level],\n details = currentLevel.details;\n logger[\"b\" /* logger */].log('Loaded ' + fragCurrent.sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + fragCurrent.level);\n // reset frag bitrate test in any case after frag loaded event\n this.bitrateTest = false;\n this.stats = stats;\n // if this frag was loaded to perform a bitrate test AND if hls.nextLoadLevel is greater than 0\n // then this means that we should be able to load a fragment at a higher quality level\n if (fragLoaded.bitrateTest === true && this.hls.nextLoadLevel) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.startFragRequested = false;\n stats.tparsed = stats.tbuffered = performance.now();\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n } else if (fragLoaded.sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'main' });\n this.tick();\n } else {\n this.state = State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n var duration = details.totalduration,\n level = fragCurrent.level,\n sn = fragCurrent.sn,\n audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n if (this.audioCodecSwap) {\n logger[\"b\" /* logger */].log('swapping playlist audio codec');\n if (audioCodec === undefined) {\n audioCodec = this.lastAudioCodec;\n }\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 }\n this.pendingBuffering = true;\n this.appended = false;\n logger[\"b\" /* logger */].log('Parsing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],level ' + level + ', cc ' + fragCurrent.cc);\n var demuxer = this.demuxer;\n if (!demuxer) {\n demuxer = this.demuxer = new demux_demuxer(this.hls, 'main');\n }\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live) and if media is not seeking (this is to overcome potential timestamp drifts between playlists and fragments)\n var media = this.media;\n var mediaSeeking = media && media.seeking;\n var accurateTimeOffset = !mediaSeeking && (details.PTSKnown || !details.live);\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n demuxer.push(data.payload, initSegmentData, audioCodec, currentLevel.videoCodec, fragCurrent, duration, accurateTimeOffset, undefined);\n }\n }\n this.fragLoadError = 0;\n };\n\n StreamController.prototype.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n trackName,\n track;\n\n // if audio track is expected to come from audio stream controller, discard any coming from main\n if (tracks.audio && this.altAudio) {\n delete tracks.audio;\n }\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n if (audioCodec && this.audioCodecSwap) {\n logger[\"b\" /* logger */].log('swapping playlist 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 // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if (track.metadata.channelCount !== 1 &&\n // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n }\n // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n if (ua.indexOf('android') !== -1 && track.container !== 'audio/mpeg') {\n // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n logger[\"b\" /* logger */].log('Android: force audio codec to ' + audioCodec);\n }\n track.levelCodec = audioCodec;\n track.id = data.id;\n }\n track = tracks.video;\n if (track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n track.id = data.id;\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CODECS, tracks);\n // loop through tracks that are going to be provided to bufferController\n for (trackName in tracks) {\n track = tracks[trackName];\n logger[\"b\" /* logger */].log('main track:' + trackName + ',container:' + track.container + ',codecs[level/parsed]=[' + track.levelCodec + '/' + track.codec + ']');\n var initSegment = track.initSegment;\n if (initSegment) {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, { type: trackName, data: initSegment, parent: 'main', content: 'initSegment' });\n }\n }\n //trigger handler right now\n this.tick();\n }\n };\n\n StreamController.prototype.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && !(data.type === 'audio' && this.altAudio) && // filter out main audio if audio track is loaded through audio stream controller\n this.state === State.PARSING) {\n var level = this.levels[this.level],\n frag = fragCurrent;\n if (isNaN(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n logger[\"b\" /* logger */].log('Parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb + ',dropped:' + (data.dropped || 0));\n\n // Detect gaps in a fragment and try to fix it by finding a keyframe in the previous fragment (see _findFragments)\n if (data.type === 'video') {\n frag.dropped = data.dropped;\n if (frag.dropped) {\n if (!frag.backtracked) {\n var levelDetails = level.details;\n if (levelDetails && frag.sn === levelDetails.startSN) {\n logger[\"b\" /* logger */].warn('missing video frame(s) on first frag, appending with gap');\n } else {\n logger[\"b\" /* logger */].warn('missing video frame(s), backtracking fragment');\n // Return back to the IDLE state without appending to buffer\n // Causes findFragments to backtrack a segment and find the keyframe\n // Audio fragments arriving before video sets the nextLoadPosition, causing _findFragments to skip the backtracked fragment\n frag.backtracked = true;\n this.nextLoadPosition = data.startPTS;\n this.state = State.IDLE;\n this.fragPrevious = frag;\n this.tick();\n return;\n }\n } else {\n logger[\"b\" /* logger */].warn('Already backtracked on this fragment, appending with the gap');\n }\n } else {\n // Only reset the backtracked flag if we've loaded the frag without any dropped frames\n frag.backtracked = false;\n }\n }\n\n var drift = updateFragPTSDTS(level.details, frag, data.startPTS, data.endPTS, data.startDTS, data.endDTS),\n hls = this.hls;\n hls.trigger(events[\"a\" /* default */].LEVEL_PTS_UPDATED, { details: level.details, level: this.level, drift: drift, type: data.type, start: data.startPTS, end: data.endPTS });\n\n // has remuxer dropped video frames located before first keyframe ?\n [data.data1, data.data2].forEach(function (buffer) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (buffer && buffer.length && _this2.state === State.PARSING) {\n _this2.appended = true;\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, { type: data.type, data: buffer, parent: 'main', content: 'data' });\n }\n });\n //trigger handler right now\n this.tick();\n }\n };\n\n StreamController.prototype.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = State.PARSED;\n this._checkAppendedParsed();\n }\n };\n\n StreamController.prototype.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url,\n trackId = data.id;\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 logger[\"b\" /* logger */].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.loader) {\n logger[\"b\" /* logger */].log('switching to main audio track, cancel main fragment load');\n fragCurrent.loader.abort();\n }\n this.fragCurrent = null;\n this.fragPrevious = null;\n // destroy demuxer to force init segment generation (following audio switch)\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n // switch to IDLE state to load new fragment\n this.state = State.IDLE;\n }\n var hls = this.hls;\n // switching to main audio, flush all audio and trigger track switched\n hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n this.altAudio = false;\n }\n };\n\n StreamController.prototype.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var trackId = data.id,\n 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 logger[\"b\" /* logger */].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\n StreamController.prototype.onBufferCreated = function onBufferCreated(data) {\n var tracks = data.tracks,\n mediaTrack = void 0,\n name = void 0,\n 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 this.videoBuffer = tracks[type].buffer;\n }\n } else {\n alternate = true;\n }\n }\n if (alternate && mediaTrack) {\n logger[\"b\" /* logger */].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\n StreamController.prototype.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'main') {\n var state = this.state;\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n this._checkAppendedParsed();\n }\n }\n };\n\n StreamController.prototype._checkAppendedParsed = function _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent;\n if (frag) {\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"b\" /* logger */].log('main buffered : ' + timeRanges.toString(media.buffered));\n // filter fragments potentially evicted from buffer. this is to avoid memleak on live streams\n var bufferedFrags = this._bufferedFrags.filter(function (frag) {\n return buffer_helper.isBuffered(media, (frag.startPTS + frag.endPTS) / 2);\n });\n // push new range\n bufferedFrags.push(frag);\n // sort frags, as we use BinarySearch for lookup in getBufferedFrag ...\n this._bufferedFrags = bufferedFrags.sort(function (a, b) {\n return a.startPTS - b.startPTS;\n });\n this.fragPrevious = frag;\n var stats = this.stats;\n stats.tbuffered = performance.now();\n // we should get rid of this.fragLastKbps\n this.fragLastKbps = Math.round(8 * stats.total / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: frag, id: 'main' });\n this.state = State.IDLE;\n }\n this.tick();\n }\n };\n\n StreamController.prototype.onError = function onError(data) {\n var frag = data.frag || this.fragCurrent;\n // don't handle frag error not related to main fragment\n if (frag && frag.type !== 'main') {\n return;\n }\n // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n var mediaBuffered = !!this.media && buffer_helper.isBuffered(this.media, this.media.currentTime) && buffer_helper.isBuffered(this.media, this.media.currentTime + 0.5);\n\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n if (!data.fatal) {\n // keep retrying until the limit will be reached\n if (this.fragLoadError + 1 <= this.config.fragLoadingMaxRetry) {\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, this.fragLoadError) * this.config.fragLoadingRetryDelay, this.config.fragLoadingMaxRetryTimeout);\n // reset load counter to avoid frag loop loading error\n frag.loadCounter = 0;\n logger[\"b\" /* logger */].warn('mediaController: frag loading failed, retry in ' + delay + ' ms');\n this.retryDate = performance.now() + delay;\n // retry loading state\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.fragLoadError++;\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"b\" /* logger */].error('mediaController: ' + data.details + ' reaches max retry, redispatch as fatal ...');\n // switch error to fatal\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n if (!data.fatal) {\n // if buffer is not empty\n if (mediaBuffered) {\n // try to reduce max buffer length : rationale is that we could get\n // frag loop loading error because of buffer eviction\n this._reduceMaxBufferLength(frag.duration);\n this.state = State.IDLE;\n } else {\n // buffer empty. report as fatal if in manual mode or if lowest level.\n // level controller takes care of emergency switch down logic\n if (!frag.autoLevel || frag.level === 0) {\n // switch error to fatal\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT:\n if (this.state !== State.ERROR) {\n if (data.fatal) {\n // if fatal error, stop processing\n this.state = State.ERROR;\n logger[\"b\" /* logger */].warn('streamController: ' + data.details + ',switch to ' + this.state + ' state ...');\n } else {\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) {\n this.state = State.IDLE;\n }\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'main' && (this.state === State.PARSING || this.state === State.PARSED)) {\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n this._reduceMaxBufferLength(this.config.maxBufferLength);\n this.state = State.IDLE;\n } else {\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 buffer to recover\n logger[\"b\" /* logger */].warn('buffer full error also media.currentTime is not buffered, flush everything');\n this.fragCurrent = null;\n // flush everything\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n }\n break;\n default:\n break;\n }\n };\n\n StreamController.prototype._reduceMaxBufferLength = function _reduceMaxBufferLength(minLength) {\n var config = this.config;\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger[\"b\" /* logger */].warn('main:reduce max buffer length to ' + config.maxMaxBufferLength + 's');\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * config.fragLoadingLoopThreshold;\n }\n }\n };\n\n StreamController.prototype._checkBuffer = function _checkBuffer() {\n var media = this.media,\n config = this.config;\n // if ready state different from HAVE_NOTHING (numeric value 0), we are allowed to seek\n if (media && media.readyState) {\n var currentTime = media.currentTime,\n mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media,\n buffered = mediaBuffer.buffered;\n // adjust currentTime to start position on loaded metadata\n if (!this.loadedmetadata && buffered.length) {\n this.loadedmetadata = true;\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 var startPosition = media.seeking ? currentTime : this.startPosition,\n startPositionBuffered = buffer_helper.isBuffered(mediaBuffer, startPosition),\n firstbufferedPosition = buffered.start(0),\n startNotBufferedButClose = !startPositionBuffered && Math.abs(startPosition - firstbufferedPosition) < config.maxSeekHole;\n // if currentTime not matching with expected startPosition or startPosition not buffered but close to first buffered\n if (currentTime !== startPosition || startNotBufferedButClose) {\n logger[\"b\" /* logger */].log('target start position:' + startPosition);\n // if startPosition not buffered, let's seek to buffered.start(0)\n if (startNotBufferedButClose) {\n startPosition = firstbufferedPosition;\n logger[\"b\" /* logger */].log('target start position not buffered, seek to buffered.start(0) ' + startPosition);\n }\n logger[\"b\" /* logger */].log('adjust currentTime from ' + currentTime + ' to ' + startPosition);\n media.currentTime = startPosition;\n }\n } else if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n } else {\n var bufferInfo = buffer_helper.bufferInfo(media, currentTime, 0),\n expectedPlaying = !(media.paused || // not playing when media is paused\n media.ended || // not playing when media is ended\n media.buffered.length === 0),\n // not playing if nothing buffered\n jumpThreshold = 0.5,\n // tolerance needed as some browsers stalls playback before reaching buffered range end\n playheadMoving = currentTime !== this.lastCurrentTime;\n\n if (playheadMoving) {\n // played moving, but was previously stalled => now not stuck anymore\n if (this.stallReported) {\n logger[\"b\" /* logger */].warn('playback not stuck anymore @' + currentTime + ', after ' + Math.round(performance.now() - this.stalled) + 'ms');\n this.stallReported = false;\n }\n this.stalled = undefined;\n this.nudgeRetry = 0;\n } else {\n // playhead not moving\n if (expectedPlaying) {\n // playhead not moving BUT media expected to play\n var tnow = performance.now();\n var hls = this.hls;\n if (!this.stalled) {\n // stall just detected, store current time\n this.stalled = tnow;\n this.stallReported = false;\n } else {\n // playback already stalled, check stalling duration\n // if stalling for more than a given threshold, let's try to recover\n var stalledDuration = tnow - this.stalled;\n var bufferLen = bufferInfo.len;\n var nudgeRetry = this.nudgeRetry || 0;\n // have we reached stall deadline ?\n if (bufferLen <= jumpThreshold && stalledDuration > config.lowBufferWatchdogPeriod * 1000) {\n // report stalled error once\n if (!this.stallReported) {\n this.stallReported = true;\n logger[\"b\" /* logger */].warn('playback stalling in low buffer @' + currentTime);\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: false, buffer: bufferLen });\n }\n // if buffer len is below threshold, try to jump to start of next buffer range if close\n // no buffer available @ currentTime, check if next buffer is close (within a config.maxSeekHole second range)\n var nextBufferStart = bufferInfo.nextStart,\n delta = nextBufferStart - currentTime;\n if (nextBufferStart && delta < config.maxSeekHole && delta > 0) {\n this.nudgeRetry = ++nudgeRetry;\n var nudgeOffset = nudgeRetry * config.nudgeOffset;\n // next buffer is close ! adjust currentTime to nextBufferStart\n // this will ensure effective video decoding\n logger[\"b\" /* logger */].log('adjust currentTime from ' + media.currentTime + ' to next buffered @ ' + nextBufferStart + ' + nudge ' + nudgeOffset);\n media.currentTime = nextBufferStart + nudgeOffset;\n // reset stalled so to rearm watchdog timer\n this.stalled = undefined;\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_SEEK_OVER_HOLE, fatal: false, hole: nextBufferStart + nudgeOffset - currentTime });\n }\n } else if (bufferLen > jumpThreshold && stalledDuration > config.highBufferWatchdogPeriod * 1000) {\n // report stalled error once\n if (!this.stallReported) {\n this.stallReported = true;\n logger[\"b\" /* logger */].warn('playback stalling in high buffer @' + currentTime);\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: false, buffer: bufferLen });\n }\n // reset stalled so to rearm watchdog timer\n this.stalled = undefined;\n this.nudgeRetry = ++nudgeRetry;\n if (nudgeRetry < config.nudgeMaxRetry) {\n var _currentTime = media.currentTime;\n var targetTime = _currentTime + nudgeRetry * config.nudgeOffset;\n logger[\"b\" /* logger */].log('adjust currentTime from ' + _currentTime + ' to ' + targetTime);\n // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n media.currentTime = targetTime;\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_NUDGE_ON_STALL, fatal: false });\n } else {\n logger[\"b\" /* logger */].error('still stuck in high buffer @' + currentTime + ' after ' + config.nudgeMaxRetry + ', raise fatal error');\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_STALLED_ERROR, fatal: true });\n }\n }\n }\n }\n }\n }\n }\n };\n\n StreamController.prototype.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.tick();\n };\n\n StreamController.prototype.onBufferFlushed = function onBufferFlushed() {\n /* after successful buffer flushing, filter flushed fragments from bufferedFrags\n use mediaBuffered instead of media (so that we will check against video.buffered ranges in case of alt audio track)\n */\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n this._bufferedFrags = this._bufferedFrags.filter(function (frag) {\n return buffer_helper.isBuffered(media, (frag.startPTS + frag.endPTS) / 2);\n });\n\n if (this.fragLoadIdx !== undefined) {\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n };\n\n StreamController.prototype.swapAudioCodec = function swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n };\n\n StreamController.prototype.computeLivePosition = function computeLivePosition(sliding, levelDetails) {\n var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * levelDetails.targetduration;\n return sliding + Math.max(0, levelDetails.totalduration - targetLatency);\n };\n\n stream_controller__createClass(StreamController, [{\n key: 'state',\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"b\" /* logger */].log('main stream:' + previousState + '->' + nextState);\n this.hls.trigger(events[\"a\" /* default */].STREAM_STATE_TRANSITION, { previousState: previousState, nextState: nextState });\n }\n },\n get: function get() {\n return this._state;\n }\n }, {\n key: 'currentLevel',\n get: function get() {\n var media = this.media;\n if (media) {\n var frag = this.getBufferedFrag(media.currentTime);\n if (frag) {\n return frag.level;\n }\n }\n return -1;\n }\n }, {\n key: 'nextBufferedFrag',\n get: function get() {\n var media = this.media;\n if (media) {\n // first get end range of current fragment\n return this.followingBufferedFrag(this.getBufferedFrag(media.currentTime));\n } else {\n return null;\n }\n }\n }, {\n key: 'nextLevel',\n get: function get() {\n var frag = this.nextBufferedFrag;\n if (frag) {\n return frag.level;\n } else {\n return -1;\n }\n }\n }, {\n key: 'liveSyncPosition',\n get: function get() {\n return this._liveSyncPosition;\n },\n set: function set(value) {\n this._liveSyncPosition = value;\n }\n }]);\n\n return StreamController;\n}(event_handler);\n\n/* harmony default export */ var stream_controller = (stream_controller_StreamController);\n// CONCATENATED MODULE: ./src/controller/level-controller.js\nvar level_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction level_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction level_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction level_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Level Controller\n*/\n\n\n\n\n\n\n\nvar level_controller_LevelController = function (_EventHandler) {\n level_controller__inherits(LevelController, _EventHandler);\n\n function LevelController(hls) {\n level_controller__classCallCheck(this, LevelController);\n\n var _this = level_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].LEVEL_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].ERROR));\n\n _this.canload = false;\n _this.currentLevelIndex = null;\n _this.manualLevelIndex = -1;\n _this.timer = null;\n return _this;\n }\n\n LevelController.prototype.destroy = function destroy() {\n this.cleanTimer();\n this.manualLevelIndex = -1;\n };\n\n LevelController.prototype.cleanTimer = function cleanTimer() {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n LevelController.prototype.startLoad = function startLoad() {\n var levels = this._levels;\n\n this.canload = true;\n this.levelRetryCount = 0;\n\n // clean up live level details to force reload them, and reset load errors\n if (levels) {\n levels.forEach(function (level) {\n level.loadError = 0;\n var levelDetails = level.details;\n if (levelDetails && levelDetails.live) {\n level.details = undefined;\n }\n });\n }\n // speed up live playlist refresh if timer exists\n if (this.timer !== null) {\n this.loadLevel();\n }\n };\n\n LevelController.prototype.stopLoad = function stopLoad() {\n this.canload = false;\n };\n\n LevelController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var levels = [];\n var bitrateStart = void 0;\n var levelSet = {};\n var levelFromSet = null;\n var videoCodecFound = false;\n var audioCodecFound = false;\n var chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());\n var audioTracks = [];\n\n // regroup redundant levels together\n data.levels.forEach(function (level) {\n level.loadError = 0;\n level.fragmentError = false;\n\n videoCodecFound = videoCodecFound || !!level.videoCodec;\n audioCodecFound = audioCodecFound || !!level.audioCodec || !!(level.attrs && level.attrs.AUDIO);\n\n // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n if (chromeOrFirefox === true && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {\n level.audioCodec = undefined;\n }\n\n levelFromSet = levelSet[level.bitrate];\n\n if (levelFromSet === undefined) {\n level.url = [level.url];\n level.urlId = 0;\n levelSet[level.bitrate] = level;\n levels.push(level);\n } else {\n levelFromSet.url.push(level.url);\n }\n });\n\n // remove audio-only level if we also have levels with audio+video codecs signalled\n if (videoCodecFound === true && audioCodecFound === true) {\n levels = levels.filter(function (_ref) {\n var videoCodec = _ref.videoCodec;\n return !!videoCodec;\n });\n }\n\n // only keep levels with supported audio/video codecs\n levels = levels.filter(function (_ref2) {\n var audioCodec = _ref2.audioCodec,\n videoCodec = _ref2.videoCodec;\n\n return (!audioCodec || isCodecSupportedInMp4(audioCodec)) && (!videoCodec || isCodecSupportedInMp4(videoCodec));\n });\n\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio');\n });\n }\n\n if (levels.length > 0) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate;\n // sort level on bitrate\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels;\n // find index of first level in sorted levels\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger[\"b\" /* logger */].log('manifest loaded,' + levels.length + ' level(s) found, first bitrate:' + bitrateStart);\n break;\n }\n }\n this.hls.trigger(events[\"a\" /* default */].MANIFEST_PARSED, {\n levels: levels,\n audioTracks: audioTracks,\n firstLevel: this._firstLevel,\n stats: data.stats,\n audio: audioCodecFound,\n video: videoCodecFound,\n altAudio: audioTracks.length > 0\n });\n } else {\n this.hls.trigger(events[\"a\" /* default */].ERROR, {\n type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR,\n details: errors[\"a\" /* ErrorDetails */].MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: this.hls.url,\n reason: 'no level with compatible codecs found in manifest'\n });\n }\n };\n\n LevelController.prototype.setLevelInternal = function setLevelInternal(newLevel) {\n var levels = this._levels;\n var hls = this.hls;\n // check if level idx is valid\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n if (this.currentLevelIndex !== newLevel) {\n logger[\"b\" /* logger */].log('switching to level ' + newLevel);\n this.currentLevelIndex = newLevel;\n var levelProperties = levels[newLevel];\n levelProperties.level = newLevel;\n // LEVEL_SWITCH to be deprecated in next major release\n hls.trigger(events[\"a\" /* default */].LEVEL_SWITCH, levelProperties);\n hls.trigger(events[\"a\" /* default */].LEVEL_SWITCHING, levelProperties);\n }\n var level = levels[newLevel],\n levelDetails = level.details;\n // check if we need to load playlist for this level\n if (!levelDetails || levelDetails.live === true) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var urlId = level.urlId;\n hls.trigger(events[\"a\" /* default */].LEVEL_LOADING, { url: level.url[urlId], level: newLevel, id: urlId });\n }\n } else {\n // invalid level id given, trigger error\n hls.trigger(events[\"a\" /* default */].ERROR, {\n type: errors[\"b\" /* ErrorTypes */].OTHER_ERROR,\n details: errors[\"a\" /* ErrorDetails */].LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: false,\n reason: 'invalid level idx'\n });\n }\n };\n\n LevelController.prototype.onError = function onError(data) {\n if (data.fatal === true) {\n if (data.type === errors[\"b\" /* ErrorTypes */].NETWORK_ERROR) {\n this.cleanTimer();\n }\n return;\n }\n\n var levelError = false,\n fragmentError = false;\n var levelIndex = void 0;\n\n // try to recover not fatal errors\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n levelIndex = data.frag.level;\n fragmentError = true;\n break;\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].LEVEL_LOAD_TIMEOUT:\n levelIndex = data.context.level;\n levelError = true;\n break;\n case errors[\"a\" /* ErrorDetails */].REMUX_ALLOC_ERROR:\n levelIndex = data.level;\n levelError = true;\n break;\n }\n\n if (levelIndex !== undefined) {\n this.recoverLevel(data, levelIndex, levelError, fragmentError);\n }\n };\n\n /**\n * Switch to a redundant stream if any available.\n * If redundant stream is not available, emergency switch down if ABR mode is enabled.\n *\n * @param {Object} errorEvent\n * @param {Number} levelIndex current level index\n * @param {Boolean} levelError\n * @param {Boolean} fragmentError\n */\n // FIXME Find a better abstraction where fragment/level retry management is well decoupled\n\n\n LevelController.prototype.recoverLevel = function recoverLevel(errorEvent, levelIndex, levelError, fragmentError) {\n var _this2 = this;\n\n var config = this.hls.config;\n var errorDetails = errorEvent.details;\n\n var level = this._levels[levelIndex];\n var redundantLevels = void 0,\n delay = void 0,\n nextLevel = void 0;\n\n level.loadError++;\n level.fragmentError = fragmentError;\n\n if (levelError === true) {\n if (this.levelRetryCount + 1 <= config.levelLoadingMaxRetry) {\n // exponential backoff capped to max retry timeout\n delay = Math.min(Math.pow(2, this.levelRetryCount) * config.levelLoadingRetryDelay, config.levelLoadingMaxRetryTimeout);\n // Schedule level reload\n this.timer = setTimeout(function () {\n return _this2.loadLevel();\n }, delay);\n // boolean used to inform stream controller not to switch back to IDLE on non fatal error\n errorEvent.levelRetry = true;\n this.levelRetryCount++;\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ', retry in ' + delay + ' ms, current retry count is ' + this.levelRetryCount);\n } else {\n logger[\"b\" /* logger */].error('level controller, cannot recover from ' + errorDetails + ' error');\n this.currentLevelIndex = null;\n // stopping live reloading timer if any\n this.cleanTimer();\n // switch error to fatal\n errorEvent.fatal = true;\n return;\n }\n }\n\n // Try any redundant streams if available for both errors: level and fragment\n // If level.loadError reaches redundantLevels it means that we tried them all, no hope => let's switch down\n if (levelError === true || fragmentError === true) {\n redundantLevels = level.url.length;\n\n if (redundantLevels > 1 && level.loadError < redundantLevels) {\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ' for level ' + levelIndex + ': switching to redundant stream id ' + level.urlId);\n level.urlId = (level.urlId + 1) % redundantLevels;\n level.details = undefined;\n } else {\n // Search for available level\n if (this.manualLevelIndex === -1) {\n // When lowest level has been reached, let's start hunt from the top\n nextLevel = levelIndex === 0 ? this._levels.length - 1 : levelIndex - 1;\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ': switch to ' + nextLevel);\n this.hls.nextAutoLevel = this.currentLevelIndex = nextLevel;\n } else if (fragmentError === true) {\n // Allow fragment retry as long as configuration allows.\n // reset this._level so that another call to set level() will trigger again a frag load\n logger[\"b\" /* logger */].warn('level controller, ' + errorDetails + ': reload a fragment');\n this.currentLevelIndex = null;\n }\n }\n }\n };\n\n // reset errors on the successful load of a fragment\n\n\n LevelController.prototype.onFragLoaded = function onFragLoaded(_ref3) {\n var frag = _ref3.frag;\n\n if (frag !== undefined && frag.type === 'main') {\n var level = this._levels[frag.level];\n if (level !== undefined) {\n level.fragmentError = false;\n level.loadError = 0;\n this.levelRetryCount = 0;\n }\n }\n };\n\n LevelController.prototype.onLevelLoaded = function onLevelLoaded(data) {\n var _this3 = this;\n\n var levelId = data.level;\n // only process level loaded events matching with expected level\n if (levelId === this.currentLevelIndex) {\n var curLevel = this._levels[levelId];\n // reset level load error counter on successful level loaded only if there is no issues with fragments\n if (curLevel.fragmentError === false) {\n curLevel.loadError = 0;\n this.levelRetryCount = 0;\n }\n var newDetails = data.details;\n // if current playlist is a live playlist, arm a timer to reload it\n if (newDetails.live) {\n var reloadInterval = 1000 * (newDetails.averagetargetduration ? newDetails.averagetargetduration : newDetails.targetduration),\n curDetails = curLevel.details;\n if (curDetails && newDetails.endSN === curDetails.endSN) {\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 logger[\"b\" /* logger */].log('same live playlist, reload twice faster');\n }\n // decrement reloadInterval with level loading delay\n reloadInterval -= performance.now() - data.stats.trequest;\n // in any case, don't reload more than every second\n reloadInterval = Math.max(1000, Math.round(reloadInterval));\n logger[\"b\" /* logger */].log('live playlist, reload in ' + reloadInterval + ' ms');\n this.timer = setTimeout(function () {\n return _this3.loadLevel();\n }, reloadInterval);\n } else {\n this.cleanTimer();\n }\n }\n };\n\n LevelController.prototype.loadLevel = function loadLevel() {\n var level = void 0,\n urlIndex = void 0;\n\n if (this.currentLevelIndex !== null && this.canload === true) {\n level = this._levels[this.currentLevelIndex];\n if (level !== undefined && level.url.length > 0) {\n urlIndex = level.urlId;\n this.hls.trigger(events[\"a\" /* default */].LEVEL_LOADING, { url: level.url[urlIndex], level: this.currentLevelIndex, id: urlIndex });\n }\n }\n };\n\n level_controller__createClass(LevelController, [{\n key: 'levels',\n get: function get() {\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) {\n newLevel = Math.min(newLevel, levels.length - 1);\n if (this.currentLevelIndex !== newLevel || levels[newLevel].details === undefined) {\n this.setLevelInternal(newLevel);\n }\n }\n }\n }, {\n key: 'manualLevel',\n get: function get() {\n return this.manualLevelIndex;\n },\n set: function set(newLevel) {\n this.manualLevelIndex = newLevel;\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n }, {\n key: 'firstLevel',\n get: function get() {\n return this._firstLevel;\n },\n set: function set(newLevel) {\n this._firstLevel = newLevel;\n }\n }, {\n key: 'startLevel',\n get: function get() {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n if (configStartLevel !== undefined) {\n return configStartLevel;\n } else {\n return this._firstLevel;\n }\n } else {\n return this._startLevel;\n }\n },\n set: function set(newLevel) {\n this._startLevel = newLevel;\n }\n }, {\n key: 'nextLoadLevel',\n get: function get() {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n } else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function set(nextLevel) {\n this.level = nextLevel;\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n }\n }]);\n\n return LevelController;\n}(event_handler);\n\n/* harmony default export */ var level_controller = (level_controller_LevelController);\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(3);\n\n// CONCATENATED MODULE: ./src/controller/id3-track-controller.js\nfunction id3_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction id3_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction id3_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * id3 metadata track controller\n*/\n\n\n\n\n\nvar id3_track_controller_ID3TrackController = function (_EventHandler) {\n id3_track_controller__inherits(ID3TrackController, _EventHandler);\n\n function ID3TrackController(hls) {\n id3_track_controller__classCallCheck(this, ID3TrackController);\n\n var _this = id3_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].FRAG_PARSING_METADATA));\n\n _this.id3Track = undefined;\n _this.media = undefined;\n return _this;\n }\n\n ID3TrackController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n // Add ID3 metatadata text track.\n\n\n ID3TrackController.prototype.onMediaAttached = function onMediaAttached(data) {\n this.media = data.media;\n if (!this.media) {\n return;\n }\n };\n\n ID3TrackController.prototype.onMediaDetaching = function onMediaDetaching() {\n this.media = undefined;\n };\n\n ID3TrackController.prototype.onFragParsingMetadata = function onFragParsingMetadata(data) {\n var fragment = data.frag;\n var samples = data.samples;\n\n // create track dynamically\n if (!this.id3Track) {\n this.id3Track = this.media.addTextTrack('metadata', 'id3');\n this.id3Track.mode = 'hidden';\n }\n\n // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n var Cue = window.WebKitDataCue || window.VTTCue || window.TextTrackCue;\n\n for (var i = 0; i < samples.length; i++) {\n var frames = id3[\"a\" /* default */].getID3Frames(samples[i].data);\n if (frames) {\n var startTime = samples[i].pts;\n var endTime = i < samples.length - 1 ? samples[i + 1].pts : fragment.endPTS;\n\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\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 (!id3[\"a\" /* default */].isTimeStampFrame(frame)) {\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n\n return ID3TrackController;\n}(event_handler);\n\n/* harmony default export */ var id3_track_controller = (id3_track_controller_ID3TrackController);\n// CONCATENATED MODULE: ./src/helper/is-supported.js\n\n\nfunction is_supported_isSupported() {\n var mediaSource = getMediaSource();\n var sourceBuffer = window.SourceBuffer || window.WebKitSourceBuffer;\n var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"');\n\n // if SourceBuffer is exposed ensure its API is valid\n // safari and old version of Chrome doe not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n return !!isTypeSupported && !!sourceBufferValidAPI;\n}\n// CONCATENATED MODULE: ./src/utils/ewma.js\nfunction ewma__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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\nvar EWMA = function () {\n\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife) {\n ewma__classCallCheck(this, EWMA);\n\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_ = 0;\n this.totalWeight_ = 0;\n }\n\n EWMA.prototype.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\n EWMA.prototype.getTotalWeight = function getTotalWeight() {\n return this.totalWeight_;\n };\n\n EWMA.prototype.getEstimate = function getEstimate() {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n return this.estimate_ / zeroFactor;\n } else {\n return this.estimate_;\n }\n };\n\n return EWMA;\n}();\n\n/* harmony default export */ var ewma = (EWMA);\n// CONCATENATED MODULE: ./src/utils/ewma-bandwidth-estimator.js\nfunction ewma_bandwidth_estimator__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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\n\nvar ewma_bandwidth_estimator_EwmaBandWidthEstimator = function () {\n function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) {\n ewma_bandwidth_estimator__classCallCheck(this, EwmaBandWidthEstimator);\n\n this.hls = hls;\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 }\n\n EwmaBandWidthEstimator.prototype.sample = function sample(durationMs, numBytes) {\n durationMs = Math.max(durationMs, this.minDelayMs_);\n var bandwidth = 8000 * numBytes / durationMs,\n\n //console.log('instant bw:'+ Math.round(bandwidth));\n // we weight sample using loading duration....\n weight = durationMs / 1000;\n this.fast_.sample(weight, bandwidth);\n this.slow_.sample(weight, bandwidth);\n };\n\n EwmaBandWidthEstimator.prototype.canEstimate = function canEstimate() {\n var fast = this.fast_;\n return fast && fast.getTotalWeight() >= this.minWeight_;\n };\n\n EwmaBandWidthEstimator.prototype.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\n EwmaBandWidthEstimator.prototype.destroy = function destroy() {};\n\n return EwmaBandWidthEstimator;\n}();\n\n/* harmony default export */ var ewma_bandwidth_estimator = (ewma_bandwidth_estimator_EwmaBandWidthEstimator);\n// CONCATENATED MODULE: ./src/controller/abr-controller.js\nvar abr_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction abr_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction abr_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction abr_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\n\n\n\n\n\n\n\n\nvar abr_controller_AbrController = function (_EventHandler) {\n abr_controller__inherits(AbrController, _EventHandler);\n\n function AbrController(hls) {\n abr_controller__classCallCheck(this, AbrController);\n\n var _this = abr_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FRAG_LOADING, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_BUFFERED, events[\"a\" /* default */].ERROR));\n\n _this.lastLoadedFragLevel = 0;\n _this._nextAutoLevel = -1;\n _this.hls = hls;\n _this.timer = null;\n _this._bwEstimator = null;\n _this.onCheck = _this._abandonRulesCheck.bind(_this);\n return _this;\n }\n\n AbrController.prototype.destroy = function destroy() {\n this.clearTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n AbrController.prototype.onFragLoading = function onFragLoading(data) {\n var frag = data.frag;\n if (frag.type === 'main') {\n if (!this.timer) {\n this.timer = setInterval(this.onCheck, 100);\n }\n // lazy init of bw Estimator, rationale is that we use different params for Live/VoD\n // so we need to wait for stream manifest / playlist type to instantiate it.\n if (!this._bwEstimator) {\n var hls = this.hls,\n level = data.frag.level,\n isLive = hls.levels[level].details.live,\n config = hls.config,\n ewmaFast = void 0,\n ewmaSlow = void 0;\n\n if (isLive) {\n ewmaFast = config.abrEwmaFastLive;\n ewmaSlow = config.abrEwmaSlowLive;\n } else {\n ewmaFast = config.abrEwmaFastVoD;\n ewmaSlow = config.abrEwmaSlowVoD;\n }\n this._bwEstimator = new ewma_bandwidth_estimator(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate);\n }\n this.fragCurrent = frag;\n }\n };\n\n AbrController.prototype._abandonRulesCheck = function _abandonRulesCheck() {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n var hls = this.hls,\n v = hls.media,\n frag = this.fragCurrent,\n loader = frag.loader,\n minAutoLevel = hls.minAutoLevel;\n\n // if loader has been destroyed or loading has been aborted, stop timer and return\n if (!loader || loader.stats && loader.stats.aborted) {\n logger[\"b\" /* logger */].warn('frag loader destroy or aborted, disarm abandonRules');\n this.clearTimer();\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n return;\n }\n var stats = loader.stats;\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n if (v && stats && (!v.paused && v.playbackRate !== 0 || !v.readyState) && frag.autoLevel && frag.level) {\n var requestDelay = performance.now() - stats.trequest,\n playbackRate = Math.abs(v.playbackRate);\n // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n if (requestDelay > 500 * frag.duration / playbackRate) {\n var levels = hls.levels,\n loadRate = Math.max(1, stats.bw ? stats.bw / 8 : stats.loaded * 1000 / requestDelay),\n // byte/s; at least 1 byte/s to avoid division by zero\n // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size\n level = levels[frag.level],\n levelBitrate = level.realBitrate ? Math.max(level.realBitrate, level.bitrate) : level.bitrate,\n expectedLen = stats.total ? stats.total : Math.max(stats.loaded, Math.round(frag.duration * levelBitrate / 8)),\n pos = v.currentTime,\n fragLoadedDelay = (expectedLen - stats.loaded) / loadRate,\n bufferStarvationDelay = (buffer_helper.bufferInfo(v, pos, hls.config.maxBufferHole).end - pos) / playbackRate;\n // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n if (bufferStarvationDelay < 2 * frag.duration / playbackRate && fragLoadedDelay > bufferStarvationDelay) {\n var fragLevelNextLoadedDelay = void 0,\n nextLoadLevel = void 0;\n // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].realBitrate ? Math.max(levels[nextLoadLevel].realBitrate, levels[nextLoadLevel].bitrate) : levels[nextLoadLevel].bitrate;\n fragLevelNextLoadedDelay = frag.duration * levelNextBitrate / (8 * 0.8 * loadRate);\n if (fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n }\n // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n logger[\"b\" /* logger */].warn('loading too slow, abort fragment loading and switch to level ' + nextLoadLevel + ':fragLoadedDelay[' + nextLoadLevel + ']<fragLoadedDelay[' + (frag.level - 1) + '];bufferStarvationDelay:' + fragLevelNextLoadedDelay.toFixed(1) + '<' + fragLoadedDelay.toFixed(1) + ':' + bufferStarvationDelay.toFixed(1));\n // force next load level in auto mode\n hls.nextLoadLevel = nextLoadLevel;\n // update bw estimate for this fragment before cancelling load (this will help reducing the bw)\n this._bwEstimator.sample(requestDelay, stats.loaded);\n //abort fragment loading\n loader.abort();\n // stop abandon rules timer\n this.clearTimer();\n hls.trigger(events[\"a\" /* default */].FRAG_LOAD_EMERGENCY_ABORTED, { frag: frag, stats: stats });\n }\n }\n }\n }\n };\n\n AbrController.prototype.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag;\n if (frag.type === 'main' && !isNaN(frag.sn)) {\n // stop monitoring bw once frag loaded\n this.clearTimer();\n // store level id after successful fragment load\n this.lastLoadedFragLevel = frag.level;\n // reset forced auto level value so that next level will be selected\n this._nextAutoLevel = -1;\n\n // compute level average bitrate\n if (this.hls.config.abrMaxWithRealBitrate) {\n var level = this.hls.levels[frag.level];\n var loadedBytes = (level.loaded ? level.loaded.bytes : 0) + data.stats.loaded;\n var loadedDuration = (level.loaded ? level.loaded.duration : 0) + data.frag.duration;\n level.loaded = { bytes: loadedBytes, duration: loadedDuration };\n level.realBitrate = Math.round(8 * loadedBytes / loadedDuration);\n }\n // if fragment has been loaded to perform a bitrate test,\n if (data.frag.bitrateTest) {\n var stats = data.stats;\n stats.tparsed = stats.tbuffered = stats.tload;\n this.onFragBuffered(data);\n }\n }\n };\n\n AbrController.prototype.onFragBuffered = function onFragBuffered(data) {\n var stats = data.stats,\n frag = data.frag;\n // only update stats on first frag buffering\n // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly\n // and leading to wrong bw estimation\n // on bitrate test, also only update stats once (if tload = tbuffered == on FRAG_LOADED)\n if (stats.aborted !== true && frag.loadCounter === 1 && frag.type === 'main' && !isNaN(frag.sn) && (!frag.bitrateTest || stats.tload === stats.tbuffered)) {\n // use tparsed-trequest instead of tbuffered-trequest to compute fragLoadingProcessing; rationale is that buffer appending only happens once media is attached\n // in case we use config.startFragPrefetch while media is not attached yet, fragment might be parsed while media not attached yet, but it will only be buffered on media attached\n // as a consequence it could happen really late in the process. meaning that appending duration might appears huge ... leading to underestimated throughput estimation\n var fragLoadingProcessingMs = stats.tparsed - stats.trequest;\n logger[\"b\" /* logger */].log('latency/loading/parsing/append/kbps:' + Math.round(stats.tfirst - stats.trequest) + '/' + Math.round(stats.tload - stats.tfirst) + '/' + Math.round(stats.tparsed - stats.tload) + '/' + Math.round(stats.tbuffered - stats.tparsed) + '/' + Math.round(8 * stats.loaded / (stats.tbuffered - stats.trequest)));\n this._bwEstimator.sample(fragLoadingProcessingMs, stats.loaded);\n stats.bwEstimate = this._bwEstimator.getEstimate();\n // if fragment has been loaded to perform a bitrate test, (hls.startLevel = -1), store bitrate test delay duration\n if (frag.bitrateTest) {\n this.bitrateTestDelay = fragLoadingProcessingMs / 1000;\n } else {\n this.bitrateTestDelay = 0;\n }\n }\n };\n\n AbrController.prototype.onError = function onError(data) {\n // stop timer in case of frag loading error\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n this.clearTimer();\n break;\n default:\n break;\n }\n };\n\n AbrController.prototype.clearTimer = function clearTimer() {\n clearInterval(this.timer);\n this.timer = null;\n };\n\n // return next auto level\n\n\n AbrController.prototype._findBestLevel = function _findBestLevel(currentLevel, currentFragDuration, currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor, levels) {\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i],\n levelDetails = levelInfo.details,\n avgDuration = levelDetails ? levelDetails.totalduration / levelDetails.fragments.length : currentFragDuration,\n live = levelDetails ? levelDetails.live : false,\n adjustedbw = void 0;\n // follow algorithm captured from stagefright :\n // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp\n // Pick the highest bandwidth stream below or equal to estimated bandwidth.\n // consider only 80% of the available bandwidth, but if we are switching up,\n // be even more conservative (70%) to avoid overestimating and immediately\n // switching back.\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n var bitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate,\n fetchDuration = bitrate * avgDuration / adjustedbw;\n\n logger[\"b\" /* logger */].trace('level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: ' + i + '/' + Math.round(adjustedbw) + '/' + bitrate + '/' + avgDuration + '/' + maxFetchDuration + '/' + fetchDuration);\n // if adjusted bw is greater than level bitrate AND\n if (adjustedbw > bitrate && (\n // fragment fetchDuration unknown OR live stream OR fragment fetchDuration less than max allowed fetch duration, then this level matches\n // we don't account for max Fetch Duration for live streams, this is to avoid switching down when near the edge of live sliding window ...\n // special case to support startLevel = -1 (bitrateTest) on live streams : in that case we should not exit loop so that _findBestLevel will return -1\n !fetchDuration || live && !this.bitrateTestDelay || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n }\n // not enough time budget even with quality level 0 ... rebuffering might happen\n return -1;\n };\n\n abr_controller__createClass(AbrController, [{\n key: 'nextAutoLevel',\n get: function get() {\n var forcedAutoLevel = this._nextAutoLevel;\n var bwEstimator = this._bwEstimator;\n // in case next auto level has been forced, and bw not available or not reliable, return forced value\n if (forcedAutoLevel !== -1 && (!bwEstimator || !bwEstimator.canEstimate())) {\n return forcedAutoLevel;\n }\n // compute next level using ABR logic\n var nextABRAutoLevel = this._nextABRAutoLevel;\n // if forced auto level has been defined, use it to cap ABR computed quality level\n if (forcedAutoLevel !== -1) {\n nextABRAutoLevel = Math.min(forcedAutoLevel, nextABRAutoLevel);\n }\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n }, {\n key: '_nextABRAutoLevel',\n get: function get() {\n var hls = this.hls,\n maxAutoLevel = hls.maxAutoLevel,\n levels = hls.levels,\n config = hls.config,\n minAutoLevel = hls.minAutoLevel;\n var v = hls.media,\n currentLevel = this.lastLoadedFragLevel,\n currentFragDuration = this.fragCurrent ? this.fragCurrent.duration : 0,\n pos = v ? v.currentTime : 0,\n\n // playbackRate is the absolute value of the playback rate; if v.playbackRate is 0, we use 1 to load as\n // if we're playing back at the normal rate.\n playbackRate = v && v.playbackRate !== 0 ? Math.abs(v.playbackRate) : 1.0,\n avgbw = this._bwEstimator ? this._bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate,\n\n // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n bufferStarvationDelay = (buffer_helper.bufferInfo(v, pos, config.maxBufferHole).end - pos) / playbackRate;\n\n // First, look to see if we can find a level matching with our avg bandwidth AND that could also guarantee no rebuffering at all\n var bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, config.abrBandWidthFactor, config.abrBandWidthUpFactor, levels);\n if (bestLevel >= 0) {\n return bestLevel;\n } else {\n logger[\"b\" /* logger */].trace('rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering');\n // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay,\n bwFactor = config.abrBandWidthFactor,\n bwUpFactor = config.abrBandWidthUpFactor;\n if (bufferStarvationDelay === 0) {\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[\"b\" /* logger */].trace('bitrate test took ' + Math.round(1000 * bitrateTestDelay) + 'ms, set first fragment max fetchDuration to ' + Math.round(1000 * maxStarvationDelay) + ' ms');\n // don't use conservative factor on bitrate test\n bwFactor = bwUpFactor = 1;\n }\n }\n bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor, levels);\n return Math.max(bestLevel, 0);\n }\n }\n }]);\n\n return AbrController;\n}(event_handler);\n\n/* harmony default export */ var abr_controller = (abr_controller_AbrController);\n// CONCATENATED MODULE: ./src/controller/buffer-controller.js\nfunction buffer_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction buffer_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction buffer_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Buffer Controller\n*/\n\n\n\n\n\n\n\nvar buffer_controller_MediaSource = getMediaSource();\n\nvar buffer_controller_BufferController = function (_EventHandler) {\n buffer_controller__inherits(BufferController, _EventHandler);\n\n function BufferController(hls) {\n buffer_controller__classCallCheck(this, BufferController);\n\n // the value that we have set mediasource.duration to\n // (the actual duration may be tweaked slighly by the browser)\n var _this = buffer_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].BUFFER_RESET, events[\"a\" /* default */].BUFFER_APPENDING, events[\"a\" /* default */].BUFFER_CODECS, events[\"a\" /* default */].BUFFER_EOS, events[\"a\" /* default */].BUFFER_FLUSHING, events[\"a\" /* default */].LEVEL_PTS_UPDATED, events[\"a\" /* default */].LEVEL_UPDATED));\n\n _this._msDuration = null;\n // the value that we want to set mediaSource.duration to\n _this._levelDuration = null;\n // current stream state: true - for live broadcast, false - for VoD content\n _this._live = null;\n // cache the self generated object url to detect hijack of video tag\n _this._objectUrl = null;\n\n // Source Buffer listeners\n _this.onsbue = _this.onSBUpdateEnd.bind(_this);\n _this.onsbe = _this.onSBUpdateError.bind(_this);\n _this.pendingTracks = {};\n _this.tracks = {};\n return _this;\n }\n\n BufferController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n BufferController.prototype.onLevelPtsUpdated = function onLevelPtsUpdated(data) {\n var type = data.type;\n var audioTrack = this.tracks.audio;\n\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). At the time of change we issue\n // `SourceBuffer.abort()` and adjusting `SourceBuffer.timestampOffset` if `SourceBuffer.updating` is false or awaiting `updateend`\n // event if SB is in updating state.\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n\n if (type === 'audio' && audioTrack && audioTrack.container === 'audio/mpeg') {\n // Chrome audio mp3 track\n var audioBuffer = this.sourceBuffer.audio;\n var delta = Math.abs(audioBuffer.timestampOffset - data.start);\n\n // adjust timestamp offset if time delta is greater than 100ms\n if (delta > 0.1) {\n var updating = audioBuffer.updating;\n\n try {\n audioBuffer.abort();\n } catch (err) {\n updating = true;\n logger[\"b\" /* logger */].warn('can not abort audio buffer: ' + err);\n }\n\n if (!updating) {\n logger[\"b\" /* logger */].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + data.start);\n audioBuffer.timestampOffset = data.start;\n } else {\n this.audioTimestampOffset = data.start;\n }\n }\n }\n };\n\n BufferController.prototype.onManifestParsed = function onManifestParsed(data) {\n var audioExpected = data.audio,\n videoExpected = data.video || data.levels.length && data.audio,\n sourceBufferNb = 0;\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 if (data.altAudio && (audioExpected || videoExpected)) {\n sourceBufferNb = (audioExpected ? 1 : 0) + (videoExpected ? 1 : 0);\n logger[\"b\" /* logger */].log(sourceBufferNb + ' sourceBuffer(s) expected');\n }\n this.sourceBufferNb = sourceBufferNb;\n };\n\n BufferController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n var media = this.media = data.media;\n if (media) {\n // setup the media source\n var ms = this.mediaSource = new buffer_controller_MediaSource();\n //Media Source listeners\n this.onmso = this.onMediaSourceOpen.bind(this);\n this.onmse = this.onMediaSourceEnded.bind(this);\n this.onmsc = this.onMediaSourceClose.bind(this);\n ms.addEventListener('sourceopen', this.onmso);\n ms.addEventListener('sourceended', this.onmse);\n ms.addEventListener('sourceclose', this.onmsc);\n // link video and media Source\n media.src = URL.createObjectURL(ms);\n // cache the locally generated object url\n this._objectUrl = media.src;\n }\n };\n\n BufferController.prototype.onMediaDetaching = function onMediaDetaching() {\n logger[\"b\" /* logger */].log('media source detaching');\n var ms = this.mediaSource;\n if (ms) {\n if (ms.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 ms.endOfStream();\n } catch (err) {\n logger[\"b\" /* logger */].warn('onMediaDetaching:' + err.message + ' while calling endOfStream');\n }\n }\n ms.removeEventListener('sourceopen', this.onmso);\n ms.removeEventListener('sourceended', this.onmse);\n ms.removeEventListener('sourceclose', this.onmsc);\n\n // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n if (this.media) {\n URL.revokeObjectURL(this._objectUrl);\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.media.src === this._objectUrl) {\n this.media.removeAttribute('src');\n this.media.load();\n } else {\n logger[\"b\" /* logger */].warn('media.src was changed by a third party - skip cleanup');\n }\n }\n\n this.mediaSource = null;\n this.media = null;\n this._objectUrl = null;\n this.pendingTracks = {};\n this.tracks = {};\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n }\n this.onmso = this.onmse = this.onmsc = null;\n this.hls.trigger(events[\"a\" /* default */].MEDIA_DETACHED);\n };\n\n BufferController.prototype.onMediaSourceOpen = function onMediaSourceOpen() {\n logger[\"b\" /* logger */].log('media source opened');\n this.hls.trigger(events[\"a\" /* default */].MEDIA_ATTACHED, { media: this.media });\n var mediaSource = this.mediaSource;\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', this.onmso);\n }\n this.checkPendingTracks();\n };\n\n BufferController.prototype.checkPendingTracks = function checkPendingTracks() {\n // if any buffer codecs pending, check if we have enough to create sourceBuffers\n var pendingTracks = this.pendingTracks,\n pendingTracksNb = Object.keys(pendingTracks).length;\n // if any pending tracks and (if nb of pending tracks gt or equal than expected nb or if unknown expected nb)\n if (pendingTracksNb && (this.sourceBufferNb <= pendingTracksNb || this.sourceBufferNb === 0)) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {};\n // append any pending segments now !\n this.doAppending();\n }\n };\n\n BufferController.prototype.onMediaSourceClose = function onMediaSourceClose() {\n logger[\"b\" /* logger */].log('media source closed');\n };\n\n BufferController.prototype.onMediaSourceEnded = function onMediaSourceEnded() {\n logger[\"b\" /* logger */].log('media source ended');\n };\n\n BufferController.prototype.onSBUpdateEnd = function onSBUpdateEnd() {\n // update timestampOffset\n if (this.audioTimestampOffset) {\n var audioBuffer = this.sourceBuffer.audio;\n logger[\"b\" /* logger */].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + this.audioTimestampOffset);\n audioBuffer.timestampOffset = this.audioTimestampOffset;\n delete this.audioTimestampOffset;\n }\n\n if (this._needsFlush) {\n this.doFlush();\n }\n\n if (this._needsEos) {\n this.checkEos();\n }\n this.appending = false;\n var parent = this.parent;\n // count nb of pending segments waiting for appending on this sourcebuffer\n var pending = this.segments.reduce(function (counter, segment) {\n return segment.parent === parent ? counter + 1 : counter;\n }, 0);\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDED, { parent: parent, pending: pending });\n\n // don't append in flushing mode\n if (!this._needsFlush) {\n this.doAppending();\n }\n\n this.updateMediaElementDuration();\n };\n\n BufferController.prototype.onSBUpdateError = function onSBUpdateError(event) {\n logger[\"b\" /* logger */].error('sourceBuffer error:', event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_APPENDING_ERROR, fatal: false });\n // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n };\n\n BufferController.prototype.onBufferReset = function onBufferReset() {\n var sourceBuffer = this.sourceBuffer;\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n try {\n this.mediaSource.removeSourceBuffer(sb);\n sb.removeEventListener('updateend', this.onsbue);\n sb.removeEventListener('error', this.onsbe);\n } catch (err) {}\n }\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n };\n\n BufferController.prototype.onBufferCodecs = function onBufferCodecs(tracks) {\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n // if sourcebuffers already created, do nothing ...\n if (Object.keys(this.sourceBuffer).length === 0) {\n for (var trackName in tracks) {\n this.pendingTracks[trackName] = tracks[trackName];\n }\n var mediaSource = this.mediaSource;\n if (mediaSource && mediaSource.readyState === 'open') {\n // try to create sourcebuffers if mediasource opened\n this.checkPendingTracks();\n }\n }\n };\n\n BufferController.prototype.createSourceBuffers = function createSourceBuffers(tracks) {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n // use levelCodec as first priority\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + ';codecs=' + codec;\n logger[\"b\" /* logger */].log('creating sourceBuffer(' + mimeType + ')');\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this.onsbue);\n sb.addEventListener('error', this.onsbe);\n this.tracks[trackName] = { codec: codec, container: track.container };\n track.buffer = sb;\n } catch (err) {\n logger[\"b\" /* logger */].error('error while trying to add sourceBuffer:' + err.message);\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_ADD_CODEC_ERROR, fatal: false, err: err, mimeType: mimeType });\n }\n }\n }\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CREATED, { tracks: tracks });\n };\n\n BufferController.prototype.onBufferAppending = function onBufferAppending(data) {\n if (!this._needsFlush) {\n if (!this.segments) {\n this.segments = [data];\n } else {\n this.segments.push(data);\n }\n this.doAppending();\n }\n };\n\n BufferController.prototype.onBufferAppendFail = function onBufferAppendFail(data) {\n logger[\"b\" /* logger */].error('sourceBuffer error:', data.event);\n // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n this.hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].BUFFER_APPENDING_ERROR, fatal: false });\n };\n\n // on BUFFER_EOS mark matching sourcebuffer(s) as ended and trigger checkEos()\n\n\n BufferController.prototype.onBufferEos = function onBufferEos(data) {\n var sb = this.sourceBuffer;\n var dataType = data.type;\n for (var type in sb) {\n if (!dataType || type === dataType) {\n if (!sb[type].ended) {\n sb[type].ended = true;\n logger[\"b\" /* logger */].log(type + ' sourceBuffer now EOS');\n }\n }\n }\n this.checkEos();\n };\n\n // if all source buffers are marked as ended, signal endOfStream() to MediaSource.\n\n\n BufferController.prototype.checkEos = function checkEos() {\n var sb = this.sourceBuffer,\n mediaSource = this.mediaSource;\n if (!mediaSource || mediaSource.readyState !== 'open') {\n this._needsEos = false;\n return;\n }\n for (var type in sb) {\n var sbobj = sb[type];\n if (!sbobj.ended) {\n return;\n }\n if (sbobj.updating) {\n this._needsEos = true;\n return;\n }\n }\n logger[\"b\" /* logger */].log('all media data available, signal endOfStream() to MediaSource and stop loading fragment');\n //Notify the media element that it now has all of the media data\n try {\n mediaSource.endOfStream();\n } catch (e) {\n logger[\"b\" /* logger */].warn('exception while calling mediaSource.endOfStream()');\n }\n this._needsEos = false;\n };\n\n BufferController.prototype.onBufferFlushing = function onBufferFlushing(data) {\n this.flushRange.push({ start: data.startOffset, end: data.endOffset, type: data.type });\n // attempt flush immediately\n this.flushBufferCounter = 0;\n this.doFlush();\n };\n\n BufferController.prototype.onLevelUpdated = function onLevelUpdated(_ref) {\n var details = _ref.details;\n\n if (details.fragments.length > 0) {\n this._levelDuration = details.totalduration + details.fragments[0].start;\n this._live = details.live;\n this.updateMediaElementDuration();\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\n\n BufferController.prototype.updateMediaElementDuration = function updateMediaElementDuration() {\n var config = this.hls.config;\n\n var duration = void 0;\n\n if (this._levelDuration === null || !this.media || !this.mediaSource || !this.sourceBuffer || this.media.readyState === 0 || this.mediaSource.readyState !== 'open') {\n return;\n }\n\n for (var type in this.sourceBuffer) {\n if (this.sourceBuffer[type].updating === true) {\n // can't set duration whilst a buffer is updating\n return;\n }\n }\n\n duration = this.media.duration;\n // initialise to the value that the media source is reporting\n if (this._msDuration === null) {\n this._msDuration = this.mediaSource.duration;\n }\n\n if (this._live === true && config.liveDurationInfinity === true) {\n // Override duration to Infinity\n logger[\"b\" /* logger */].log('Media Source duration is set to Infinity');\n this._msDuration = this.mediaSource.duration = Infinity;\n } else if (this._levelDuration > this._msDuration && this._levelDuration > duration || duration === Infinity || isNaN(duration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger[\"b\" /* logger */].log('Updating Media Source duration to ' + this._levelDuration.toFixed(3));\n this._msDuration = this.mediaSource.duration = this._levelDuration;\n }\n };\n\n BufferController.prototype.doFlush = function doFlush() {\n // loop through all buffer ranges to flush\n while (this.flushRange.length) {\n var range = this.flushRange[0];\n // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n if (this.flushBuffer(range.start, range.end, range.type)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n } else {\n this._needsFlush = true;\n // avoid looping, wait for SB update end to retrigger a flush\n return;\n }\n }\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false;\n\n // let's recompute this.appended, which is used to avoid flush looping\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n try {\n for (var type in sourceBuffer) {\n appended += sourceBuffer[type].buffered.length;\n }\n } catch (error) {\n // error could be thrown while accessing buffered, in case sourcebuffer has already been removed from MediaSource\n // this is harmess at this stage, catch this to avoid reporting an internal exception\n logger[\"b\" /* logger */].error('error while accessing sourceBuffer.buffered');\n }\n this.appended = appended;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHED);\n }\n };\n\n BufferController.prototype.doAppending = function doAppending() {\n var hls = this.hls,\n sourceBuffer = this.sourceBuffer,\n segments = this.segments;\n if (Object.keys(sourceBuffer).length) {\n if (this.media.error) {\n this.segments = [];\n logger[\"b\" /* logger */].error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n if (this.appending) {\n //logger.log(`sb appending in progress`);\n return;\n }\n if (segments && segments.length) {\n var segment = segments.shift();\n try {\n var type = segment.type,\n sb = sourceBuffer[type];\n if (sb) {\n if (!sb.updating) {\n // reset sourceBuffer ended flag before appending segment\n sb.ended = false;\n //logger.log(`appending ${segment.content} ${type} SB, size:${segment.data.length}, ${segment.parent}`);\n this.parent = segment.parent;\n sb.appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n this.appending = true;\n } else {\n segments.unshift(segment);\n }\n } else {\n // in case we don't have any source buffer matching with this segment type,\n // it means that Mediasource fails to create sourcebuffer\n // discard this segment, and trigger update end\n this.onSBUpdateEnd();\n }\n } catch (err) {\n // in case any error occured while appending, put back segment in segments table\n logger[\"b\" /* logger */].error('error while trying to append buffer:' + err.message);\n segments.unshift(segment);\n var event = { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, parent: segment.parent };\n if (err.code !== 22) {\n if (this.appendError) {\n this.appendError++;\n } else {\n this.appendError = 1;\n }\n event.details = errors[\"a\" /* 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 help recovering this\n */\n if (this.appendError > hls.config.appendErrorMaxRetry) {\n logger[\"b\" /* logger */].log('fail ' + hls.config.appendErrorMaxRetry + ' times to append segment in sourceBuffer');\n segments = [];\n event.fatal = true;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n return;\n } else {\n event.fatal = false;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n }\n } else {\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 this.segments = [];\n event.details = errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR;\n event.fatal = false;\n hls.trigger(events[\"a\" /* default */].ERROR, event);\n return;\n }\n }\n }\n }\n };\n\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n\n\n BufferController.prototype.flushBuffer = function flushBuffer(startOffset, endOffset, typeIn) {\n var sb,\n i,\n bufStart,\n bufEnd,\n flushStart,\n flushEnd,\n sourceBuffer = this.sourceBuffer;\n if (Object.keys(sourceBuffer).length) {\n logger[\"b\" /* logger */].log('flushBuffer,pos/start/end: ' + this.media.currentTime.toFixed(3) + '/' + startOffset + '/' + endOffset);\n // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n if (this.flushBufferCounter < this.appended) {\n for (var type in sourceBuffer) {\n // check if sourcebuffer type is defined (typeIn): if yes, let's only flush this one\n // if no, let's flush all sourcebuffers\n if (typeIn && type !== typeIn) {\n continue;\n }\n sb = sourceBuffer[type];\n // we are going to flush buffer, mark source buffer as 'not ended'\n sb.ended = false;\n if (!sb.updating) {\n try {\n for (i = 0; i < sb.buffered.length; i++) {\n bufStart = sb.buffered.start(i);\n bufEnd = sb.buffered.end(i);\n // workaround firefox not able to properly flush multiple buffered range.\n if (navigator.userAgent.toLowerCase().indexOf('firefox') !== -1 && endOffset === Number.POSITIVE_INFINITY) {\n flushStart = startOffset;\n flushEnd = endOffset;\n } else {\n flushStart = Math.max(bufStart, startOffset);\n flushEnd = Math.min(bufEnd, endOffset);\n }\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n if (Math.min(flushEnd, bufEnd) - flushStart > 0.5) {\n this.flushBufferCounter++;\n logger[\"b\" /* logger */].log('flush ' + type + ' [' + flushStart + ',' + flushEnd + '], of [' + bufStart + ',' + bufEnd + '], pos:' + this.media.currentTime);\n sb.remove(flushStart, flushEnd);\n return false;\n }\n }\n } catch (e) {\n logger[\"b\" /* logger */].warn('exception while accessing sourcebuffer, it might have been removed from MediaSource');\n }\n } else {\n //logger.log('abort ' + type + ' append in progress');\n // this will abort any appending in progress\n //sb.abort();\n logger[\"b\" /* logger */].warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n } else {\n logger[\"b\" /* logger */].warn('abort flushing too many retries');\n }\n logger[\"b\" /* logger */].log('buffer flushed');\n }\n // everything flushed !\n return true;\n };\n\n return BufferController;\n}(event_handler);\n\n/* harmony default export */ var buffer_controller = (buffer_controller_BufferController);\n// CONCATENATED MODULE: ./src/controller/cap-level-controller.js\nvar cap_level_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction cap_level_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction cap_level_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction cap_level_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * cap stream level to media size dimension controller\n*/\n\n\n\n\nvar cap_level_controller_CapLevelController = function (_EventHandler) {\n cap_level_controller__inherits(CapLevelController, _EventHandler);\n\n function CapLevelController(hls) {\n cap_level_controller__classCallCheck(this, CapLevelController);\n\n return cap_level_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].FPS_DROP_LEVEL_CAPPING, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MANIFEST_PARSED));\n }\n\n CapLevelController.prototype.destroy = function destroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = this.restrictedLevels = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n }\n }\n };\n\n CapLevelController.prototype.onFpsDropLevelCapping = function onFpsDropLevelCapping(data) {\n // Don't add a restricted level more than once\n if (CapLevelController.isLevelAllowed(data.droppedLevel, this.restrictedLevels)) {\n this.restrictedLevels.push(data.droppedLevel);\n }\n };\n\n CapLevelController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media instanceof HTMLVideoElement ? data.media : null;\n };\n\n CapLevelController.prototype.onManifestParsed = function onManifestParsed(data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n if (hls.config.capLevelToPlayerSize) {\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.levels = data.levels;\n hls.firstLevel = this.getMaxLevel(data.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n }\n };\n\n CapLevelController.prototype.detectPlayerSize = function detectPlayerSize() {\n if (this.media) {\n var levelsLength = this.levels ? this.levels.length : 0;\n if (levelsLength) {\n var hls = this.hls;\n hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n if (hls.autoLevelCapping > this.autoLevelCapping) {\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 hls.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\n\n CapLevelController.prototype.getMaxLevel = function getMaxLevel(capLevelIndex) {\n var _this2 = this;\n\n if (!this.levels) {\n return -1;\n }\n\n var validLevels = this.levels.filter(function (level, index) {\n return CapLevelController.isLevelAllowed(index, _this2.restrictedLevels) && index <= capLevelIndex;\n });\n\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\n\n CapLevelController.isLevelAllowed = function isLevelAllowed(level) {\n var restrictedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n\n return restrictedLevels.indexOf(level) === -1;\n };\n\n CapLevelController.getMaxLevelByMediaSize = function getMaxLevelByMediaSize(levels, width, height) {\n if (!levels || levels && !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 atGreatestBandiwdth = function atGreatestBandiwdth(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\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n if ((level.width >= width || level.height >= height) && atGreatestBandiwdth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n\n return maxLevelIndex;\n };\n\n cap_level_controller__createClass(CapLevelController, [{\n key: 'mediaWidth',\n get: function get() {\n var width = void 0;\n var media = this.media;\n if (media) {\n width = media.width || media.clientWidth || media.offsetWidth;\n width *= CapLevelController.contentScaleFactor;\n }\n return width;\n }\n }, {\n key: 'mediaHeight',\n get: function get() {\n var height = void 0;\n var media = this.media;\n if (media) {\n height = media.height || media.clientHeight || media.offsetHeight;\n height *= CapLevelController.contentScaleFactor;\n }\n return height;\n }\n }], [{\n key: 'contentScaleFactor',\n get: function get() {\n var pixelRatio = 1;\n try {\n pixelRatio = window.devicePixelRatio;\n } catch (e) {}\n return pixelRatio;\n }\n }]);\n\n return CapLevelController;\n}(event_handler);\n\n/* harmony default export */ var cap_level_controller = (cap_level_controller_CapLevelController);\n// CONCATENATED MODULE: ./src/controller/fps-controller.js\nfunction fps_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction fps_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction fps_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * FPS Controller\n*/\n\n\n\n\n\nvar fps_controller_FPSController = function (_EventHandler) {\n fps_controller__inherits(FPSController, _EventHandler);\n\n function FPSController(hls) {\n fps_controller__classCallCheck(this, FPSController);\n\n return fps_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING));\n }\n\n FPSController.prototype.destroy = function destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.isVideoPlaybackQualityAvailable = false;\n };\n\n FPSController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n var config = this.hls.config;\n if (config.capLevelOnFPSDrop) {\n var video = this.video = data.media instanceof HTMLVideoElement ? data.media : null;\n if (typeof video.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n clearInterval(this.timer);\n this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n\n FPSController.prototype.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 currentDropped = droppedFrames - this.lastDroppedFrames,\n currentDecoded = decodedFrames - this.lastDecodedFrames,\n droppedFPS = 1000 * currentDropped / currentPeriod,\n hls = this.hls;\n hls.trigger(events[\"a\" /* default */].FPS_DROP, { currentDropped: currentDropped, currentDecoded: currentDecoded, totalDroppedFrames: droppedFrames });\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[\"b\" /* 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[\"a\" /* default */].FPS_DROP_LEVEL_CAPPING, { level: currentLevel, droppedLevel: hls.currentLevel });\n hls.autoLevelCapping = currentLevel;\n hls.streamController.nextLevelSwitch();\n }\n }\n }\n }\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n\n FPSController.prototype.checkFPSInterval = function checkFPSInterval() {\n var video = this.video;\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n } else {\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n\n return FPSController;\n}(event_handler);\n\n/* harmony default export */ var fps_controller = (fps_controller_FPSController);\n// CONCATENATED MODULE: ./src/utils/xhr-loader.js\nfunction xhr_loader__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * XHR based logger\n*/\n\n\n\nvar xhr_loader_XhrLoader = function () {\n function XhrLoader(config) {\n xhr_loader__classCallCheck(this, XhrLoader);\n\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n\n XhrLoader.prototype.destroy = function destroy() {\n this.abort();\n this.loader = null;\n };\n\n XhrLoader.prototype.abort = function abort() {\n var loader = this.loader;\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n\n window.clearTimeout(this.requestTimeout);\n this.requestTimeout = null;\n window.clearTimeout(this.retryTimeout);\n this.retryTimeout = null;\n };\n\n XhrLoader.prototype.load = function load(context, config, callbacks) {\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.stats = { trequest: performance.now(), retry: 0 };\n this.retryDelay = config.retryDelay;\n this.loadInternal();\n };\n\n XhrLoader.prototype.loadInternal = function loadInternal() {\n var xhr,\n context = this.context;\n xhr = this.loader = new XMLHttpRequest();\n\n var stats = this.stats;\n stats.tfirst = 0;\n stats.loaded = 0;\n var xhrSetup = this.xhrSetup;\n\n try {\n if (xhrSetup) {\n try {\n xhrSetup(xhr, context.url);\n } catch (e) {\n // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader(\"Content-Language\", \"test\");}\n // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN\n xhr.open('GET', context.url, true);\n xhrSetup(xhr, context.url);\n }\n }\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n } catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n this.callbacks.onError({ code: xhr.status, text: e.message }, context, xhr);\n return;\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\n // setup timeout before we perform request\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);\n xhr.send();\n };\n\n XhrLoader.prototype.readystatechange = function readystatechange(event) {\n var xhr = event.currentTarget,\n readyState = xhr.readyState,\n stats = this.stats,\n context = this.context,\n 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 // clear xhr timeout and rearm it if readyState less than 4\n window.clearTimeout(this.requestTimeout);\n if (stats.tfirst === 0) {\n stats.tfirst = Math.max(performance.now(), stats.trequest);\n }\n if (readyState === 4) {\n var status = xhr.status;\n // http status between 200 to 299 are all successful\n if (status >= 200 && status < 300) {\n stats.tload = Math.max(stats.tfirst, performance.now());\n var data = void 0,\n len = void 0;\n if (context.responseType === 'arraybuffer') {\n data = xhr.response;\n len = data.byteLength;\n } else {\n data = xhr.responseText;\n len = data.length;\n }\n stats.loaded = stats.total = len;\n var response = { url: xhr.responseURL, data: data };\n this.callbacks.onSuccess(response, stats, context, xhr);\n } else {\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (stats.retry >= config.maxRetry || status >= 400 && status < 499) {\n logger[\"b\" /* logger */].error(status + ' while loading ' + context.url);\n this.callbacks.onError({ code: status, text: xhr.statusText }, context, xhr);\n } else {\n // retry\n logger[\"b\" /* logger */].warn(status + ' while loading ' + context.url + ', retrying in ' + this.retryDelay + '...');\n // aborts and resets internal state\n this.destroy();\n // schedule retry\n this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay);\n // set exponential backoff\n this.retryDelay = Math.min(2 * this.retryDelay, config.maxRetryDelay);\n stats.retry++;\n }\n }\n } else {\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), config.timeout);\n }\n }\n };\n\n XhrLoader.prototype.loadtimeout = function loadtimeout() {\n logger[\"b\" /* logger */].warn('timeout while loading ' + this.context.url);\n this.callbacks.onTimeout(this.stats, this.context, null);\n };\n\n XhrLoader.prototype.loadprogress = function loadprogress(event) {\n var xhr = event.currentTarget,\n stats = this.stats;\n\n stats.loaded = event.loaded;\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n var onProgress = this.callbacks.onProgress;\n if (onProgress) {\n // third arg is to provide on progress data\n onProgress(stats, this.context, null, xhr);\n }\n };\n\n return XhrLoader;\n}();\n\n/* harmony default export */ var xhr_loader = (xhr_loader_XhrLoader);\n// CONCATENATED MODULE: ./src/controller/audio-track-controller.js\nvar audio_track_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction audio_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction audio_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction audio_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * audio track controller\n*/\n\n\n\n\n\n\nvar audio_track_controller_AudioTrackController = function (_EventHandler) {\n audio_track_controller__inherits(AudioTrackController, _EventHandler);\n\n function AudioTrackController(hls) {\n audio_track_controller__classCallCheck(this, AudioTrackController);\n\n var _this = audio_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_PARSED, events[\"a\" /* default */].AUDIO_TRACK_LOADED, events[\"a\" /* default */].ERROR));\n\n _this.ticks = 0;\n _this.ontick = _this.tick.bind(_this);\n return _this;\n }\n\n AudioTrackController.prototype.destroy = function destroy() {\n this.cleanTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n AudioTrackController.prototype.cleanTimer = function cleanTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n AudioTrackController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n AudioTrackController.prototype.doTick = function doTick() {\n this.updateTrack(this.trackId);\n };\n\n AudioTrackController.prototype.onError = function onError(data) {\n if (data.fatal && data.type === errors[\"b\" /* ErrorTypes */].NETWORK_ERROR) {\n this.cleanTimer();\n }\n };\n\n AudioTrackController.prototype.onManifestLoading = function onManifestLoading() {\n // reset audio tracks on manifest loading\n this.tracks = [];\n this.trackId = -1;\n };\n\n AudioTrackController.prototype.onManifestParsed = function onManifestParsed(data) {\n var _this2 = this;\n\n var tracks = data.audioTracks || [];\n var defaultFound = false;\n this.tracks = tracks;\n this.hls.trigger(events[\"a\" /* default */].AUDIO_TRACKS_UPDATED, { audioTracks: tracks });\n // loop through available audio tracks and autoselect default if needed\n var id = 0;\n tracks.forEach(function (track) {\n if (track.default && !defaultFound) {\n _this2.audioTrack = id;\n defaultFound = true;\n return;\n }\n id++;\n });\n if (defaultFound === false && tracks.length) {\n logger[\"b\" /* logger */].log('no default audio track defined, use first audio track as default');\n this.audioTrack = 0;\n }\n };\n\n AudioTrackController.prototype.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n if (data.id < this.tracks.length) {\n logger[\"b\" /* logger */].log('audioTrack ' + data.id + ' loaded');\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(this.ontick, 1000 * data.details.targetduration);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n this.cleanTimer();\n }\n }\n };\n\n /** get alternate audio tracks list from playlist **/\n\n\n AudioTrackController.prototype.setAudioTrackInternal = function setAudioTrackInternal(newId) {\n // check if level idx is valid\n if (newId >= 0 && newId < this.tracks.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n this.trackId = newId;\n logger[\"b\" /* logger */].log('switching to audioTrack ' + newId);\n var audioTrack = this.tracks[newId],\n hls = this.hls,\n type = audioTrack.type,\n url = audioTrack.url,\n eventObj = { id: newId, type: type, url: url };\n // keep AUDIO_TRACK_SWITCH for legacy reason\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCH, eventObj);\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, eventObj);\n // check if we need to load playlist for this audio Track\n var details = audioTrack.details;\n if (url && (details === undefined || details.live === true)) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for audioTrack ' + newId);\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADING, { url: url, id: newId });\n }\n }\n };\n\n AudioTrackController.prototype.updateTrack = function updateTrack(newId) {\n // check if level idx is valid\n if (newId >= 0 && newId < this.tracks.length) {\n // stopping live reloading timer if any\n this.cleanTimer();\n this.trackId = newId;\n logger[\"b\" /* logger */].log('updating audioTrack ' + newId);\n var audioTrack = this.tracks[newId],\n url = audioTrack.url;\n // check if we need to load playlist for this audio Track\n var details = audioTrack.details;\n if (url && (details === undefined || details.live === true)) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for audioTrack ' + newId);\n this.hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_LOADING, { url: url, id: newId });\n }\n }\n };\n\n audio_track_controller__createClass(AudioTrackController, [{\n key: 'audioTracks',\n get: function get() {\n return this.tracks;\n }\n\n /** get index of the selected audio track (index in audio track lists) **/\n\n }, {\n key: 'audioTrack',\n get: function get() {\n return this.trackId;\n }\n\n /** select an audio track, based on its index in audio track lists**/\n ,\n set: function set(audioTrackId) {\n if (this.trackId !== audioTrackId || this.tracks[audioTrackId].details === undefined) {\n this.setAudioTrackInternal(audioTrackId);\n }\n }\n }]);\n\n return AudioTrackController;\n}(event_handler);\n\n/* harmony default export */ var audio_track_controller = (audio_track_controller_AudioTrackController);\n// CONCATENATED MODULE: ./src/controller/audio-stream-controller.js\nvar audio_stream_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction audio_stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction audio_stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction audio_stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Audio Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\nvar audio_stream_controller_State = {\n STOPPED: 'STOPPED',\n STARTING: 'STARTING',\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\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 BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS'\n};\n\nvar audio_stream_controller_AudioStreamController = function (_EventHandler) {\n audio_stream_controller__inherits(AudioStreamController, _EventHandler);\n\n function AudioStreamController(hls) {\n audio_stream_controller__classCallCheck(this, AudioStreamController);\n\n var _this = audio_stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].AUDIO_TRACKS_UPDATED, events[\"a\" /* default */].AUDIO_TRACK_SWITCHING, events[\"a\" /* default */].AUDIO_TRACK_LOADED, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, events[\"a\" /* default */].FRAG_PARSING_DATA, events[\"a\" /* default */].FRAG_PARSED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].BUFFER_RESET, events[\"a\" /* default */].BUFFER_CREATED, events[\"a\" /* default */].BUFFER_APPENDED, events[\"a\" /* default */].BUFFER_FLUSHED, events[\"a\" /* default */].INIT_PTS_FOUND));\n\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this.ticks = 0;\n _this._state = audio_stream_controller_State.STOPPED;\n _this.ontick = _this.tick.bind(_this);\n _this.initPTS = [];\n _this.waitingFragment = null;\n _this.videoTrackCC = null;\n return _this;\n }\n\n AudioStreamController.prototype.destroy = function destroy() {\n this.stopLoad();\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n event_handler.prototype.destroy.call(this);\n this.state = audio_stream_controller_State.STOPPED;\n };\n\n //Signal that video PTS was found\n\n\n AudioStreamController.prototype.onInitPtsFound = function onInitPtsFound(data) {\n var demuxerId = data.id,\n cc = data.frag.cc,\n initPTS = data.initPTS;\n if (demuxerId === 'main') {\n //Always update the new INIT PTS\n //Can change due level switch\n this.initPTS[cc] = initPTS;\n this.videoTrackCC = cc;\n logger[\"b\" /* logger */].log('InitPTS for cc:' + cc + ' found from video track:' + initPTS);\n\n //If we are waiting we need to demux/remux the waiting frag\n //With the new initPTS\n if (this.state === audio_stream_controller_State.WAITING_INIT_PTS) {\n this.tick();\n }\n }\n };\n\n AudioStreamController.prototype.startLoad = function startLoad(startPosition) {\n if (this.tracks) {\n var lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n this.fragLoadError = 0;\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"b\" /* logger */].log('audio:override startPosition with lastCurrentTime @' + lastCurrentTime.toFixed(3));\n this.state = audio_stream_controller_State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = audio_stream_controller_State.STARTING;\n }\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n this.startPosition = startPosition;\n this.state = audio_stream_controller_State.STOPPED;\n }\n };\n\n AudioStreamController.prototype.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n this.fragCurrent = null;\n }\n this.fragPrevious = null;\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n this.state = audio_stream_controller_State.STOPPED;\n };\n\n AudioStreamController.prototype.tick = function tick() {\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(this.tick, 1);\n }\n this.ticks = 0;\n }\n };\n\n AudioStreamController.prototype.doTick = function doTick() {\n var pos,\n track,\n trackDetails,\n hls = this.hls,\n config = hls.config;\n //logger.log('audioStream:' + this.state);\n switch (this.state) {\n case audio_stream_controller_State.ERROR:\n //don't do anything in error state to avoid breaking further ...\n case audio_stream_controller_State.PAUSED:\n //don't do anything in paused state either ...\n case audio_stream_controller_State.BUFFER_FLUSHING:\n break;\n case audio_stream_controller_State.STARTING:\n this.state = audio_stream_controller_State.WAITING_TRACK;\n this.loadedmetadata = false;\n break;\n case audio_stream_controller_State.IDLE:\n var tracks = this.tracks;\n // audio tracks not received => exit loop\n if (!tracks) {\n break;\n }\n // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n if (!this.media && (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n }\n // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // if we have not yet loaded any fragment, start loading from start position\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n if (pos === undefined) {\n break;\n }\n }\n var media = this.mediaBuffer ? this.mediaBuffer : this.media,\n videoBuffer = this.videoBuffer ? this.videoBuffer : this.media,\n bufferInfo = buffer_helper.bufferInfo(media, pos, config.maxBufferHole),\n mainBufferInfo = buffer_helper.bufferInfo(videoBuffer, pos, config.maxBufferHole),\n bufferLen = bufferInfo.len,\n bufferEnd = bufferInfo.end,\n fragPrevious = this.fragPrevious,\n\n // ensure we buffer at least config.maxBufferLength (default 30s)\n // once we reach that threshold, don't buffer more than video (mainBufferInfo.len)\n maxBufLen = Math.max(config.maxBufferLength, mainBufferInfo.len),\n audioSwitch = this.audioSwitch,\n trackId = this.trackId;\n\n // if buffer length is less than maxBufLen try to load a new fragment\n if ((bufferLen < maxBufLen || audioSwitch) && trackId < tracks.length) {\n trackDetails = tracks[trackId].details;\n // if track info not retrieved yet, switch state and wait for track retrieval\n if (typeof trackDetails === 'undefined') {\n this.state = audio_stream_controller_State.WAITING_TRACK;\n break;\n }\n\n // check if we need to finalize media stream\n // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n if (!audioSwitch && !trackDetails.live && fragPrevious && fragPrevious.sn === trackDetails.endSN && !bufferInfo.nextStart) {\n // if we are not seeking or if we are seeking but everything (almost) til the end is buffered, let's signal eos\n // we don't compare exactly media.duration === bufferInfo.end as there could be some subtle media duration difference when switching\n // between different renditions. using half frag duration should help cope with these cases.\n if (!this.media.seeking || this.media.duration - bufferEnd < fragPrevious.duration / 2) {\n // Finalize the media stream\n this.hls.trigger(events[\"a\" /* default */].BUFFER_EOS, { type: 'audio' });\n this.state = audio_stream_controller_State.ENDED;\n break;\n }\n }\n\n // find fragment index, contiguous with end of buffer position\n var fragments = trackDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n frag = void 0;\n\n // When switching audio track, reload audio as close as possible to currentTime\n if (audioSwitch) {\n if (trackDetails.live && !trackDetails.PTSKnown) {\n logger[\"b\" /* logger */].log('switching audiotrack, live stream, unknown PTS,load first fragment');\n bufferEnd = 0;\n } else {\n bufferEnd = pos;\n // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime\n if (trackDetails.PTSKnown && pos < start) {\n // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start\n if (bufferInfo.end > start || bufferInfo.nextStart) {\n logger[\"b\" /* logger */].log('alt audio track ahead of main track, seek to start of alt audio track');\n this.media.currentTime = start + 0.05;\n } else {\n return;\n }\n }\n }\n }\n if (trackDetails.initSegment && !trackDetails.initSegment.data) {\n frag = trackDetails.initSegment;\n }\n // if bufferEnd before start of playlist, load first fragment\n else if (bufferEnd <= start) {\n frag = fragments[0];\n if (this.videoTrackCC !== null && frag.cc !== this.videoTrackCC) {\n // Ensure we find a fragment which matches the continuity of the video track\n frag = findFragWithCC(fragments, this.videoTrackCC);\n }\n if (trackDetails.live && frag.loadIdx && frag.loadIdx === this.fragLoadIdx) {\n // we just loaded this first fragment, and we are still lagging behind the start of the live playlist\n // let's force seek to start\n var nextBuffered = bufferInfo.nextStart ? bufferInfo.nextStart : start;\n logger[\"b\" /* logger */].log('no alt audio available @currentTime:' + this.media.currentTime + ', seeking @' + (nextBuffered + 0.05));\n this.media.currentTime = nextBuffered + 0.05;\n return;\n }\n } else {\n var foundFrag = void 0;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n var fragmentWithinToleranceTest = function fragmentWithinToleranceTest(candidate) {\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);\n if (candidate.start + candidate.duration - candidateLookupTolerance <= bufferEnd) {\n return 1;\n } // if maxFragLookUpTolerance will have negative value then don't return -1 for first element\n else if (candidate.start - candidateLookupTolerance > bufferEnd && candidate.start) {\n return -1;\n }\n return 0;\n };\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n }\n // Prefer the next fragment if it's within tolerance\n if (fragNext && !fragmentWithinToleranceTest(fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, fragmentWithinToleranceTest);\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start;\n //logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < trackDetails.endSN) {\n frag = fragments[frag.sn + 1 - trackDetails.startSN];\n logger[\"b\" /* logger */].log('SN just loaded, load next one: ' + frag.sn);\n } else {\n frag = null;\n }\n }\n }\n }\n if (frag) {\n //logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn + ' of [' + trackDetails.startSN + ' ,' + trackDetails.endSN + '],track ' + trackId);\n this.state = audio_stream_controller_State.KEY_LOADING;\n hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n logger[\"b\" /* logger */].log('Loading ' + frag.sn + ', cc: ' + frag.cc + ' of [' + trackDetails.startSN + ' ,' + trackDetails.endSN + '],track ' + trackId + ', currentTime:' + pos + ',bufferEnd:' + bufferEnd.toFixed(3));\n // ensure that we are not reloading the same fragments in loop ...\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx++;\n } else {\n this.fragLoadIdx = 0;\n }\n if (frag.loadCounter) {\n frag.loadCounter++;\n var maxThreshold = config.fragLoadingLoopThreshold;\n // if this frag has already been loaded 3 times, and if it has been reloaded recently\n if (frag.loadCounter > maxThreshold && Math.abs(this.fragLoadIdx - frag.loadIdx) < maxThreshold) {\n hls.trigger(events[\"a\" /* default */].ERROR, { type: errors[\"b\" /* ErrorTypes */].MEDIA_ERROR, details: errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR, fatal: false, frag: frag });\n return;\n }\n } else {\n frag.loadCounter = 1;\n }\n frag.loadIdx = this.fragLoadIdx;\n this.fragCurrent = frag;\n this.startFragRequested = true;\n if (!isNaN(frag.sn)) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n this.state = audio_stream_controller_State.FRAG_LOADING;\n }\n }\n }\n break;\n case audio_stream_controller_State.WAITING_TRACK:\n track = this.tracks[this.trackId];\n // check if playlist is already loaded\n if (track && track.details) {\n this.state = audio_stream_controller_State.IDLE;\n }\n break;\n case audio_stream_controller_State.FRAG_LOADING_WAITING_RETRY:\n var now = performance.now();\n var retryDate = this.retryDate;\n media = this.media;\n var isSeeking = media && media.seeking;\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 || isSeeking) {\n logger[\"b\" /* logger */].log('audioStreamController: retryDate reached, switch back to IDLE state');\n this.state = audio_stream_controller_State.IDLE;\n }\n break;\n case audio_stream_controller_State.WAITING_INIT_PTS:\n var videoTrackCC = this.videoTrackCC;\n if (this.initPTS[videoTrackCC] === undefined) {\n break;\n }\n\n // Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS\n var waitingFrag = this.waitingFragment;\n if (waitingFrag) {\n var waitingFragCC = waitingFrag.frag.cc;\n if (videoTrackCC !== waitingFragCC) {\n track = this.tracks[this.trackId];\n if (track.details && track.details.live) {\n logger[\"b\" /* logger */].warn('Waiting fragment CC (' + waitingFragCC + ') does not match video track CC (' + videoTrackCC + ')');\n this.waitingFragment = null;\n this.state = audio_stream_controller_State.IDLE;\n }\n } else {\n this.state = audio_stream_controller_State.FRAG_LOADING;\n this.onFragLoaded(this.waitingFragment);\n this.waitingFragment = null;\n }\n } else {\n this.state = audio_stream_controller_State.IDLE;\n }\n\n break;\n case audio_stream_controller_State.STOPPED:\n case audio_stream_controller_State.FRAG_LOADING:\n case audio_stream_controller_State.PARSING:\n case audio_stream_controller_State.PARSED:\n case audio_stream_controller_State.ENDED:\n break;\n default:\n break;\n }\n };\n\n AudioStreamController.prototype.onMediaAttached = function onMediaAttached(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.tracks && config.autoStartLoad) {\n this.startLoad(config.startPosition);\n }\n };\n\n AudioStreamController.prototype.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n if (media && media.ended) {\n logger[\"b\" /* logger */].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n }\n\n // reset fragment loading counter on MSE detaching to avoid reporting FRAG_LOOP_LOADING_ERROR after error recovery\n var tracks = this.tracks;\n if (tracks) {\n // reset fragment load counter\n tracks.forEach(function (track) {\n if (track.details) {\n track.details.fragments.forEach(function (fragment) {\n fragment.loadCounter = undefined;\n });\n }\n });\n }\n // remove video listeners\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n this.media = this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n AudioStreamController.prototype.onMediaSeeking = function onMediaSeeking() {\n if (this.state === audio_stream_controller_State.ENDED) {\n // switch to IDLE state to check for potential new fragment\n this.state = audio_stream_controller_State.IDLE;\n }\n if (this.media) {\n this.lastCurrentTime = this.media.currentTime;\n }\n // avoid reporting fragment loop loading error in case user is seeking several times on same position\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n // tick to speed up processing\n this.tick();\n };\n\n AudioStreamController.prototype.onMediaEnded = function onMediaEnded() {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n AudioStreamController.prototype.onAudioTracksUpdated = function onAudioTracksUpdated(data) {\n logger[\"b\" /* logger */].log('audio tracks updated');\n this.tracks = data.audioTracks;\n };\n\n AudioStreamController.prototype.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url;\n this.trackId = data.id;\n\n this.fragCurrent = null;\n this.state = audio_stream_controller_State.PAUSED;\n this.waitingFragment = null;\n // destroy useless demuxer when switching audio to main\n if (!altAudio) {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n } else {\n // switching to audio track, start timer if not already started\n if (!this.timer) {\n this.timer = setInterval(this.ontick, 100);\n }\n }\n\n //should we switch tracks ?\n if (altAudio) {\n this.audioSwitch = true;\n //main audio track are handled by stream-controller, just do something if switching to alt audio track\n this.state = audio_stream_controller_State.IDLE;\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n if (this.fragLoadIdx !== undefined) {\n this.fragLoadIdx += 2 * this.config.fragLoadingLoopThreshold;\n }\n }\n this.tick();\n };\n\n AudioStreamController.prototype.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n var newDetails = data.details,\n trackId = data.id,\n track = this.tracks[trackId],\n duration = newDetails.totalduration,\n sliding = 0;\n\n logger[\"b\" /* logger */].log('track ' + trackId + ' loaded [' + newDetails.startSN + ',' + newDetails.endSN + '],duration:' + duration);\n\n if (newDetails.live) {\n var curDetails = track.details;\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n // TODO\n //this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n if (newDetails.PTSKnown) {\n logger[\"b\" /* logger */].log('live audio playlist sliding:' + sliding.toFixed(3));\n } else {\n logger[\"b\" /* logger */].log('live audio playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger[\"b\" /* logger */].log('live audio playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n track.details = newDetails;\n\n // compute start position\n if (!this.startFragRequested) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n if (!isNaN(startTimeOffset)) {\n logger[\"b\" /* logger */].log('start time offset found in playlist, adjust startPosition to ' + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n this.startPosition = 0;\n }\n }\n this.nextLoadPosition = this.startPosition;\n }\n // only switch batck to IDLE state if we were waiting for track to start downloading a new fragment\n if (this.state === audio_stream_controller_State.WAITING_TRACK) {\n this.state = audio_stream_controller_State.IDLE;\n }\n //trigger handler right now\n this.tick();\n };\n\n AudioStreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === audio_stream_controller_State.KEY_LOADING) {\n this.state = audio_stream_controller_State.IDLE;\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n if (this.state === audio_stream_controller_State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'audio' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var track = this.tracks[this.trackId],\n details = track.details,\n duration = details.totalduration,\n trackId = fragCurrent.level,\n sn = fragCurrent.sn,\n cc = fragCurrent.cc,\n audioCodec = this.config.defaultAudioCodec || track.audioCodec || 'mp4a.40.2',\n stats = this.stats = data.stats;\n if (sn === 'initSegment') {\n this.state = audio_stream_controller_State.IDLE;\n\n stats.tparsed = stats.tbuffered = performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: fragCurrent, id: 'audio' });\n this.tick();\n } else {\n this.state = audio_stream_controller_State.PARSING;\n // transmux the MPEG-TS data to ISO-BMFF segments\n this.appended = false;\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'audio');\n }\n //Check if we have video initPTS\n // If not we need to wait for it\n var initPTS = this.initPTS[cc];\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n if (details.initSegment || initPTS !== undefined) {\n this.pendingBuffering = true;\n logger[\"b\" /* logger */].log('Demuxing ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],track ' + trackId);\n // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n var accurateTimeOffset = false; //details.PTSKnown || !details.live;\n this.demuxer.push(data.payload, initSegmentData, audioCodec, null, fragCurrent, duration, accurateTimeOffset, initPTS);\n } else {\n logger[\"b\" /* logger */].log('unknown video PTS for continuity counter ' + cc + ', waiting for video PTS before demuxing audio frag ' + sn + ' of [' + details.startSN + ' ,' + details.endSN + '],track ' + trackId);\n this.waitingFragment = data;\n this.state = audio_stream_controller_State.WAITING_INIT_PTS;\n }\n }\n }\n this.fragLoadError = 0;\n };\n\n AudioStreamController.prototype.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n var tracks = data.tracks,\n track = void 0;\n\n // delete any video track found on audio demuxer\n if (tracks.video) {\n delete tracks.video;\n }\n\n // include levelCodec in audio and video tracks\n track = tracks.audio;\n if (track) {\n track.levelCodec = track.codec;\n track.id = data.id;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_CODECS, tracks);\n logger[\"b\" /* logger */].log('audio track:audio,container:' + track.container + ',codecs[level/parsed]=[' + track.levelCodec + '/' + track.codec + ']');\n var initSegment = track.initSegment;\n if (initSegment) {\n var appendObj = { type: 'audio', data: initSegment, parent: 'audio', content: 'initSegment' };\n if (this.audioSwitch) {\n this.pendingData = [appendObj];\n } else {\n this.appended = true;\n // arm pending Buffering flag before appending a segment\n this.pendingBuffering = true;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n }\n }\n //trigger handler right now\n this.tick();\n }\n }\n };\n\n AudioStreamController.prototype.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && data.type === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n var trackId = this.trackId,\n track = this.tracks[trackId],\n hls = this.hls;\n\n if (isNaN(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n logger[\"b\" /* logger */].log('parsed ' + data.type + ',PTS:[' + data.startPTS.toFixed(3) + ',' + data.endPTS.toFixed(3) + '],DTS:[' + data.startDTS.toFixed(3) + '/' + data.endDTS.toFixed(3) + '],nb:' + data.nb);\n updateFragPTSDTS(track.details, fragCurrent, data.startPTS, data.endPTS);\n\n var audioSwitch = this.audioSwitch,\n media = this.media,\n appendOnBufferFlush = false;\n //Only flush audio from old audio tracks when PTS is known on new audio track\n if (audioSwitch && media) {\n if (media.readyState) {\n var currentTime = media.currentTime;\n logger[\"b\" /* logger */].log('switching audio track : currentTime:' + currentTime);\n if (currentTime >= data.startPTS) {\n logger[\"b\" /* logger */].log('switching audio track : flushing all audio');\n this.state = audio_stream_controller_State.BUFFER_FLUSHING;\n hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n appendOnBufferFlush = true;\n //Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n } else {\n //Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: trackId });\n }\n }\n\n var pendingData = this.pendingData;\n if (!this.audioSwitch) {\n [data.data1, data.data2].forEach(function (buffer) {\n if (buffer && buffer.length) {\n pendingData.push({ type: data.type, data: buffer, parent: 'audio', content: 'data' });\n }\n });\n if (!appendOnBufferFlush && pendingData.length) {\n pendingData.forEach(function (appendObj) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (_this2.state === audio_stream_controller_State.PARSING) {\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n _this2.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n }\n });\n this.pendingData = [];\n this.appended = true;\n }\n }\n //trigger handler right now\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === audio_stream_controller_State.PARSING) {\n this.stats.tparsed = performance.now();\n this.state = audio_stream_controller_State.PARSED;\n this._checkAppendedParsed();\n }\n };\n\n AudioStreamController.prototype.onBufferReset = function onBufferReset() {\n // reset reference to sourcebuffers\n this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n };\n\n AudioStreamController.prototype.onBufferCreated = function onBufferCreated(data) {\n var audioTrack = data.tracks.audio;\n if (audioTrack) {\n this.mediaBuffer = audioTrack.buffer;\n this.loadedmetadata = true;\n }\n if (data.tracks.video) {\n this.videoBuffer = data.tracks.video.buffer;\n }\n };\n\n AudioStreamController.prototype.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'audio') {\n var state = this.state;\n if (state === audio_stream_controller_State.PARSING || state === audio_stream_controller_State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n this._checkAppendedParsed();\n }\n }\n };\n\n AudioStreamController.prototype._checkAppendedParsed = function _checkAppendedParsed() {\n //trigger handler right now\n if (this.state === audio_stream_controller_State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent,\n stats = this.stats,\n hls = this.hls;\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = performance.now();\n hls.trigger(events[\"a\" /* default */].FRAG_BUFFERED, { stats: stats, frag: frag, id: 'audio' });\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"b\" /* logger */].log('audio buffered : ' + timeRanges.toString(media.buffered));\n if (this.audioSwitch && this.appended) {\n this.audioSwitch = false;\n hls.trigger(events[\"a\" /* default */].AUDIO_TRACK_SWITCHED, { id: this.trackId });\n }\n this.state = audio_stream_controller_State.IDLE;\n }\n this.tick();\n }\n };\n\n AudioStreamController.prototype.onError = function onError(data) {\n var frag = data.frag;\n // don't handle frag error not related to audio fragment\n if (frag && frag.type !== 'audio') {\n return;\n }\n switch (data.details) {\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].FRAG_LOAD_TIMEOUT:\n if (!data.fatal) {\n var loadError = this.fragLoadError;\n if (loadError) {\n loadError++;\n } else {\n loadError = 1;\n }\n var config = this.config;\n if (loadError <= config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError;\n // reset load counter to avoid frag loop loading error\n frag.loadCounter = 0;\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, loadError - 1) * config.fragLoadingRetryDelay, config.fragLoadingMaxRetryTimeout);\n logger[\"b\" /* logger */].warn('audioStreamController: frag loading failed, retry in ' + delay + ' ms');\n this.retryDate = performance.now() + delay;\n // retry loading state\n this.state = audio_stream_controller_State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"b\" /* logger */].error('audioStreamController: ' + data.details + ' reaches max retry, redispatch as fatal ...');\n // switch error to fatal\n data.fatal = true;\n this.state = audio_stream_controller_State.ERROR;\n }\n }\n break;\n case errors[\"a\" /* ErrorDetails */].FRAG_LOOP_LOADING_ERROR:\n case errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].AUDIO_TRACK_LOAD_TIMEOUT:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_ERROR:\n case errors[\"a\" /* ErrorDetails */].KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if (this.state !== audio_stream_controller_State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? audio_stream_controller_State.ERROR : audio_stream_controller_State.IDLE;\n logger[\"b\" /* logger */].warn('audioStreamController: ' + data.details + ' while loading frag,switch to ' + this.state + ' state ...');\n }\n break;\n case errors[\"a\" /* ErrorDetails */].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'audio' && (this.state === audio_stream_controller_State.PARSING || this.state === audio_stream_controller_State.PARSED)) {\n var media = this.mediaBuffer,\n currentTime = this.media.currentTime,\n mediaBuffered = media && buffer_helper.isBuffered(media, currentTime) && buffer_helper.isBuffered(media, currentTime + 0.5);\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n var _config = this.config;\n if (_config.maxMaxBufferLength >= _config.maxBufferLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n _config.maxMaxBufferLength /= 2;\n logger[\"b\" /* logger */].warn('audio:reduce max buffer length to ' + _config.maxMaxBufferLength + 's');\n // increase fragment load Index to avoid frag loop loading error after buffer flush\n this.fragLoadIdx += 2 * _config.fragLoadingLoopThreshold;\n }\n this.state = audio_stream_controller_State.IDLE;\n } else {\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 logger[\"b\" /* logger */].warn('buffer full error also media.currentTime is not buffered, flush audio buffer');\n this.fragCurrent = null;\n // flush everything\n this.state = audio_stream_controller_State.BUFFER_FLUSHING;\n this.hls.trigger(events[\"a\" /* default */].BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: 'audio' });\n }\n }\n break;\n default:\n break;\n }\n };\n\n AudioStreamController.prototype.onBufferFlushed = function onBufferFlushed() {\n var _this3 = this;\n\n var pendingData = this.pendingData;\n if (pendingData && pendingData.length) {\n logger[\"b\" /* logger */].log('appending pending audio data on Buffer Flushed');\n pendingData.forEach(function (appendObj) {\n _this3.hls.trigger(events[\"a\" /* default */].BUFFER_APPENDING, appendObj);\n });\n this.appended = true;\n this.pendingData = [];\n this.state = audio_stream_controller_State.PARSED;\n } else {\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = audio_stream_controller_State.IDLE;\n // reset reference to frag\n this.fragPrevious = null;\n this.tick();\n }\n };\n\n audio_stream_controller__createClass(AudioStreamController, [{\n key: 'state',\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"b\" /* logger */].log('audio stream:' + previousState + '->' + nextState);\n }\n },\n get: function get() {\n return this._state;\n }\n }]);\n\n return AudioStreamController;\n}(event_handler);\n\n/* harmony default export */ var audio_stream_controller = (audio_stream_controller_AudioStreamController);\n// CONCATENATED MODULE: ./src/utils/vttcue.js\n/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* harmony default export */ var vttcue = ((function () {\n if (typeof window !== 'undefined' && window.VTTCue) {\n return window.VTTCue;\n }\n\n var autoKeyword = 'auto';\n var directionSetting = {\n '': true,\n lr: true,\n rl: true\n };\n var alignSetting = {\n start: true,\n middle: true,\n end: true,\n left: true,\n right: true\n };\n\n function findDirectionSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n\n function findAlignSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n\n function extend(obj) {\n var i = 1;\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n\n return obj;\n }\n\n function VTTCue(startTime, endTime, text) {\n var cue = this;\n var isIE8 = function () {\n if (typeof navigator === 'undefined') {\n return;\n }\n return (/MSIE\\s8\\.0/.test(navigator.userAgent)\n );\n }();\n var baseObj = {};\n\n if (isIE8) {\n cue = document.createElement('custom');\n } else {\n baseObj.enumerable = true;\n }\n\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n cue.hasBeenReset = false;\n\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = '';\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = '';\n var _snapToLines = true;\n var _line = 'auto';\n var _lineAlign = 'start';\n var _position = 50;\n var _positionAlign = 'middle';\n var _size = 50;\n var _align = 'middle';\n\n Object.defineProperty(cue, 'id', extend({}, baseObj, {\n get: function get() {\n return _id;\n },\n set: function set(value) {\n _id = '' + value;\n }\n }));\n\n Object.defineProperty(cue, 'pauseOnExit', extend({}, baseObj, {\n get: function get() {\n return _pauseOnExit;\n },\n set: function set(value) {\n _pauseOnExit = !!value;\n }\n }));\n\n Object.defineProperty(cue, 'startTime', extend({}, baseObj, {\n get: function get() {\n return _startTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('Start time must be set to a number.');\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'endTime', extend({}, baseObj, {\n get: function get() {\n return _endTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('End time must be set to a number.');\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'text', extend({}, baseObj, {\n get: function get() {\n return _text;\n },\n set: function set(value) {\n _text = '' + value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'region', extend({}, baseObj, {\n get: function get() {\n return _region;\n },\n set: function set(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'vertical', extend({}, baseObj, {\n get: function get() {\n return _vertical;\n },\n set: function set(value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'snapToLines', extend({}, baseObj, {\n get: function get() {\n return _snapToLines;\n },\n set: function set(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'line', extend({}, baseObj, {\n get: function get() {\n return _line;\n },\n set: function set(value) {\n if (typeof value !== 'number' && value !== autoKeyword) {\n throw new SyntaxError('An invalid number or illegal string was specified.');\n }\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'lineAlign', extend({}, baseObj, {\n get: function get() {\n return _lineAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'position', extend({}, baseObj, {\n get: function get() {\n return _position;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Position must be between 0 and 100.');\n }\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'positionAlign', extend({}, baseObj, {\n get: function get() {\n return _positionAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'size', extend({}, baseObj, {\n get: function get() {\n return _size;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Size must be between 0 and 100.');\n }\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n\n Object.defineProperty(cue, 'align', extend({}, baseObj, {\n get: function get() {\n return _align;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n\n /**\n * Other <track> spec defined properties\n */\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n cue.displayState = undefined;\n\n if (isIE8) {\n return cue;\n }\n }\n\n /**\n * VTTCue methods\n */\n\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n var WebVTT = window.WebVTT;\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n\n return VTTCue;\n})());\n// CONCATENATED MODULE: ./src/utils/vttparser.js\n/*\n * Source: https://github.com/mozilla/vtt.js/blob/master/dist/vtt.js#L1716\n */\n\n\n\nvar StringDecoder = function StringDecoder() {\n return {\n decode: function decode(data) {\n if (!data) {\n return '';\n }\n if (typeof data !== 'string') {\n throw new Error('Error - expected string data.');\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nfunction VTTParser() {\n this.window = window;\n this.state = 'INITIAL';\n this.buffer = '';\n this.decoder = new StringDecoder();\n this.regionList = [];\n}\n\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(':', ''), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = Object.create(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function set(k, v) {\n if (!this.get(k) && v !== '') {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function get(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function has(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function alt(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function integer(k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function percent(k, v) {\n var m;\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n\n// Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== 'string') {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\n\nvar defaults = new vttcue(0, 0, 0);\n// 'middle' was changed to 'center' in the spec: https://github.com/w3c/webvtt/pull/244\n// Safari doesn't yet support this change, but FF and Chrome do.\nvar center = defaults.align === 'middle' ? 'middle' : 'center';\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new Error('Malformed timestamp: ' + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, '');\n return ts;\n }\n\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'region':\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case 'vertical':\n settings.alt(k, v, ['rl', 'lr']);\n break;\n case 'line':\n var vals = v.split(','),\n vals0 = vals[0];\n settings.integer(k, vals0);\n if (settings.percent(k, vals0)) {\n settings.set('snapToLines', false);\n }\n settings.alt(k, vals0, ['auto']);\n if (vals.length === 2) {\n settings.alt('lineAlign', vals[1], ['start', center, 'end']);\n }\n break;\n case 'position':\n vals = v.split(',');\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt('positionAlign', vals[1], ['start', center, 'end', 'line-left', 'line-right', 'auto']);\n }\n break;\n case 'size':\n settings.percent(k, v);\n break;\n case 'align':\n settings.alt(k, v, ['start', center, 'end', 'left', 'right']);\n break;\n }\n }, /:/, /\\s/);\n\n // Apply default values for any missing fields.\n cue.region = settings.get('region', null);\n cue.vertical = settings.get('vertical', '');\n var line = settings.get('line', 'auto');\n if (line === 'auto' && defaults.line === -1) {\n // set numeric line number for Safari\n line = -1;\n }\n cue.line = line;\n cue.lineAlign = settings.get('lineAlign', 'start');\n cue.snapToLines = settings.get('snapToLines', true);\n cue.size = settings.get('size', 100);\n cue.align = settings.get('align', center);\n var position = settings.get('position', 'auto');\n if (position === 'auto' && defaults.position === 50) {\n // set numeric position for Safari\n position = cue.align === 'start' || cue.align === 'left' ? 0 : cue.align === 'end' || cue.align === 'right' ? 100 : 50;\n }\n cue.position = position;\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, '');\n }\n\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== '-->') {\n // (3) next characters must match '-->'\n throw new Error('Malformed time stamp (time stamps must be separated by \\'-->\\'): ' + oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\nfunction fixLineBreaks(input) {\n return input.replace(/<br(?: \\/)?>/gi, '\\n');\n}\n\nVTTParser.prototype = {\n parse: function parse(data) {\n var self = this;\n\n // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, { stream: true });\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n\n buffer = fixLineBreaks(buffer);\n\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'Region':\n // 3.3 WebVTT region metadata header syntax\n console.log('parse region', v);\n //parseRegion(v);\n break;\n }\n }, /:/);\n }\n\n // 5.1 WebVTT file parsing.\n try {\n var line;\n if (self.state === 'INITIAL') {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine();\n // strip of UTF-8 BOM if any\n // https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n var m = line.match(/^()?WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new Error('Malformed WebVTT signature.');\n }\n\n self.state = 'HEADER';\n }\n\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case 'HEADER':\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = 'ID';\n }\n continue;\n case 'NOTE':\n // Ignore NOTE blocks.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n case 'ID':\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = 'NOTE';\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new vttcue(0, 0, '');\n self.state = 'CUE';\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf('-->') === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /*falls through*/\n case 'CUE':\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = 'BADCUE';\n continue;\n }\n self.state = 'CUETEXT';\n continue;\n case 'CUETEXT':\n var hasSubstring = line.indexOf('-->') !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n if (self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n self.state = 'ID';\n continue;\n }\n if (self.cue.text) {\n self.cue.text += '\\n';\n }\n self.cue.text += line;\n continue;\n case 'BADCUE':\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = 'ID';\n }\n continue;\n }\n }\n } catch (e) {\n\n // If we are currently parsing a cue, report what we have.\n if (self.state === 'CUETEXT' && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === 'INITIAL' ? 'BADWEBVTT' : 'BADCUE';\n }\n return this;\n },\n flush: function flush() {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === 'HEADER') {\n self.buffer += '\\n\\n';\n self.parse();\n }\n // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n if (self.state === 'INITIAL') {\n throw new Error('Malformed WebVTT signature.');\n }\n } catch (e) {\n throw e;\n }\n if (self.onflush) {\n self.onflush();\n }\n return this;\n }\n};\n\n\n\n/* harmony default export */ var vttparser = (VTTParser);\n// CONCATENATED MODULE: ./src/utils/cues.js\n\n\nfunction newCue(track, startTime, endTime, captionScreen) {\n var row;\n var cue;\n var indenting;\n var indent;\n var text;\n var VTTCue = window.VTTCue || window.TextTrackCue;\n\n for (var r = 0; r < captionScreen.rows.length; r++) {\n row = captionScreen.rows[r];\n indenting = true;\n indent = 0;\n text = '';\n\n if (!row.isEmpty()) {\n for (var c = 0; c < row.chars.length; c++) {\n if (row.chars[c].uchar.match(/\\s/) && indenting) {\n indent++;\n } else {\n text += row.chars[c].uchar;\n indenting = false;\n }\n }\n //To be used for cleaning-up orphaned roll-up captions\n row.cueStartTime = startTime;\n\n // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n\n cue = new VTTCue(startTime, endTime, fixLineBreaks(text.trim()));\n\n if (indent >= 16) {\n indent--;\n } else {\n indent++;\n }\n\n // VTTCue.line get's flakey when using controls, so let's now include line 13&14\n // also, drop line 1 since it's to close to the top\n if (navigator.userAgent.match(/Firefox\\//)) {\n cue.line = r + 1;\n } else {\n cue.line = r > 7 ? r - 2 : r + 1;\n }\n cue.align = 'left';\n // Clamp the position between 0 and 100 - if out of these bounds, Firefox throws an exception and captions break\n cue.position = Math.max(0, Math.min(100, 100 * (indent / 32) + (navigator.userAgent.match(/Firefox\\//) ? 50 : 0)));\n track.addCue(cue);\n }\n }\n}\n// CONCATENATED MODULE: ./src/utils/cea-608-parser.js\nfunction cea_608_parser__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\n\nvar specialCea608CharsCodes = {\n 0x2a: 0xe1, // lowercase a, acute accent\n 0x5c: 0xe9, // lowercase e, acute accent\n 0x5e: 0xed, // lowercase i, acute accent\n 0x5f: 0xf3, // lowercase o, acute accent\n 0x60: 0xfa, // lowercase u, acute accent\n 0x7b: 0xe7, // lowercase c with cedilla\n 0x7c: 0xf7, // division symbol\n 0x7d: 0xd1, // uppercase N tilde\n 0x7e: 0xf1, // lowercase n tilde\n 0x7f: 0x2588, // Full block\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae, // Registered symbol (R)\n 0x81: 0xb0, // degree sign\n 0x82: 0xbd, // 1/2 symbol\n 0x83: 0xbf, // Inverted (open) question mark\n 0x84: 0x2122, // Trademark symbol (TM)\n 0x85: 0xa2, // Cents symbol\n 0x86: 0xa3, // Pounds sterling\n 0x87: 0x266a, // Music 8'th note\n 0x88: 0xe0, // lowercase a, grave accent\n 0x89: 0x20, // transparent space (regular)\n 0x8a: 0xe8, // lowercase e, grave accent\n 0x8b: 0xe2, // lowercase a, circumflex accent\n 0x8c: 0xea, // lowercase e, circumflex accent\n 0x8d: 0xee, // lowercase i, circumflex accent\n 0x8e: 0xf4, // lowercase o, circumflex accent\n 0x8f: 0xfb, // lowercase u, circumflex accent\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1, // capital letter A with acute\n 0x91: 0xc9, // capital letter E with acute\n 0x92: 0xd3, // capital letter O with acute\n 0x93: 0xda, // capital letter U with acute\n 0x94: 0xdc, // capital letter U with diaresis\n 0x95: 0xfc, // lowercase letter U with diaeresis\n 0x96: 0x2018, // opening single quote\n 0x97: 0xa1, // inverted exclamation mark\n 0x98: 0x2a, // asterisk\n 0x99: 0x2019, // closing single quote\n 0x9a: 0x2501, // box drawings heavy horizontal\n 0x9b: 0xa9, // copyright sign\n 0x9c: 0x2120, // Service mark\n 0x9d: 0x2022, // (round) bullet\n 0x9e: 0x201c, // Left double quotation mark\n 0x9f: 0x201d, // Right double quotation mark\n 0xa0: 0xc0, // uppercase A, grave accent\n 0xa1: 0xc2, // uppercase A, circumflex\n 0xa2: 0xc7, // uppercase C with cedilla\n 0xa3: 0xc8, // uppercase E, grave accent\n 0xa4: 0xca, // uppercase E, circumflex\n 0xa5: 0xcb, // capital letter E with diaresis\n 0xa6: 0xeb, // lowercase letter e with diaresis\n 0xa7: 0xce, // uppercase I, circumflex\n 0xa8: 0xcf, // uppercase I, with diaresis\n 0xa9: 0xef, // lowercase i, with diaresis\n 0xaa: 0xd4, // uppercase O, circumflex\n 0xab: 0xd9, // uppercase U, grave accent\n 0xac: 0xf9, // lowercase u, grave accent\n 0xad: 0xdb, // uppercase U, circumflex\n 0xae: 0xab, // left-pointing double angle quotation mark\n 0xaf: 0xbb, // right-pointing double angle quotation mark\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3, // Uppercase A, tilde\n 0xb1: 0xe3, // Lowercase a, tilde\n 0xb2: 0xcd, // Uppercase I, acute accent\n 0xb3: 0xcc, // Uppercase I, grave accent\n 0xb4: 0xec, // Lowercase i, grave accent\n 0xb5: 0xd2, // Uppercase O, grave accent\n 0xb6: 0xf2, // Lowercase o, grave accent\n 0xb7: 0xd5, // Uppercase O, tilde\n 0xb8: 0xf5, // Lowercase o, tilde\n 0xb9: 0x7b, // Open curly brace\n 0xba: 0x7d, // Closing curly brace\n 0xbb: 0x5c, // Backslash\n 0xbc: 0x5e, // Caret\n 0xbd: 0x5f, // Underscore\n 0xbe: 0x7c, // Pipe (vertical line)\n 0xbf: 0x223c, // Tilde operator\n 0xc0: 0xc4, // Uppercase A, umlaut\n 0xc1: 0xe4, // Lowercase A, umlaut\n 0xc2: 0xd6, // Uppercase O, umlaut\n 0xc3: 0xf6, // Lowercase o, umlaut\n 0xc4: 0xdf, // Esszett (sharp S)\n 0xc5: 0xa5, // Yen symbol\n 0xc6: 0xa4, // Generic currency sign\n 0xc7: 0x2503, // Box drawings heavy vertical\n 0xc8: 0xc5, // Uppercase A, ring\n 0xc9: 0xe5, // Lowercase A, ring\n 0xca: 0xd8, // Uppercase O, stroke\n 0xcb: 0xf8, // Lowercase o, strok\n 0xcc: 0x250f, // Box drawings heavy down and right\n 0xcd: 0x2513, // Box drawings heavy down and left\n 0xce: 0x2517, // Box drawings heavy up and right\n 0xcf: 0x251b // Box drawings heavy up and left\n};\n\n/**\n * Utils\n */\nvar getCharForByte = function getCharForByte(byte) {\n var charCode = byte;\n if (specialCea608CharsCodes.hasOwnProperty(byte)) {\n charCode = specialCea608CharsCodes[byte];\n }\n return String.fromCharCode(charCode);\n};\n\nvar NR_ROWS = 15,\n NR_COLS = 100;\n// Tables to look up row from PAC data\nvar rowsLowCh1 = { 0x11: 1, 0x12: 3, 0x15: 5, 0x16: 7, 0x17: 9, 0x10: 11, 0x13: 12, 0x14: 14 };\nvar rowsHighCh1 = { 0x11: 2, 0x12: 4, 0x15: 6, 0x16: 8, 0x17: 10, 0x13: 13, 0x14: 15 };\nvar rowsLowCh2 = { 0x19: 1, 0x1A: 3, 0x1D: 5, 0x1E: 7, 0x1F: 9, 0x18: 11, 0x1B: 12, 0x1C: 14 };\nvar rowsHighCh2 = { 0x19: 2, 0x1A: 4, 0x1D: 6, 0x1E: 8, 0x1F: 10, 0x1B: 13, 0x1C: 15 };\n\nvar backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent'];\n\n/**\n * Simple logger class to be able to write with time-stamps and filter on level.\n */\nvar cea_608_parser_logger = {\n verboseFilter: { 'DATA': 3, 'DEBUG': 3, 'INFO': 2, 'WARNING': 2, 'TEXT': 1, 'ERROR': 0 },\n time: null,\n verboseLevel: 0, // Only write errors\n setTime: function setTime(newTime) {\n this.time = newTime;\n },\n log: function log(severity, msg) {\n var minLevel = this.verboseFilter[severity];\n if (this.verboseLevel >= minLevel) {\n console.log(this.time + ' [' + severity + '] ' + msg);\n }\n }\n};\n\nvar numArrayToHexArray = function numArrayToHexArray(numArray) {\n var hexArray = [];\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n return hexArray;\n};\n\nvar PenState = function () {\n function PenState(foreground, underline, italics, background, flash) {\n cea_608_parser__classCallCheck(this, PenState);\n\n this.foreground = foreground || 'white';\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || 'black';\n this.flash = flash || false;\n }\n\n PenState.prototype.reset = function reset() {\n this.foreground = 'white';\n this.underline = false;\n this.italics = false;\n this.background = 'black';\n this.flash = false;\n };\n\n PenState.prototype.setStyles = function setStyles(styles) {\n var attribs = ['foreground', 'underline', 'italics', 'background', 'flash'];\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n };\n\n PenState.prototype.isDefault = function isDefault() {\n return this.foreground === 'white' && !this.underline && !this.italics && this.background === 'black' && !this.flash;\n };\n\n PenState.prototype.equals = function equals(other) {\n return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash;\n };\n\n PenState.prototype.copy = function copy(newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n };\n\n PenState.prototype.toString = function toString() {\n return 'color=' + this.foreground + ', underline=' + this.underline + ', italics=' + this.italics + ', background=' + this.background + ', flash=' + this.flash;\n };\n\n return PenState;\n}();\n\n/**\n * Unicode character with styling and background.\n * @constructor\n */\n\n\nvar StyledUnicodeChar = function () {\n function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n cea_608_parser__classCallCheck(this, StyledUnicodeChar);\n\n this.uchar = uchar || ' '; // unicode character\n this.penState = new PenState(foreground, underline, italics, background, flash);\n }\n\n StyledUnicodeChar.prototype.reset = function reset() {\n this.uchar = ' ';\n this.penState.reset();\n };\n\n StyledUnicodeChar.prototype.setChar = function setChar(uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n };\n\n StyledUnicodeChar.prototype.setPenState = function setPenState(newPenState) {\n this.penState.copy(newPenState);\n };\n\n StyledUnicodeChar.prototype.equals = function equals(other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n };\n\n StyledUnicodeChar.prototype.copy = function copy(newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n };\n\n StyledUnicodeChar.prototype.isEmpty = function isEmpty() {\n return this.uchar === ' ' && this.penState.isDefault();\n };\n\n return StyledUnicodeChar;\n}();\n\n/**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\n\n\nvar Row = function () {\n function Row() {\n cea_608_parser__classCallCheck(this, Row);\n\n this.chars = [];\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n this.pos = 0;\n this.currPenState = new PenState();\n }\n\n Row.prototype.equals = function equals(other) {\n var equal = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n\n Row.prototype.copy = function copy(other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n };\n\n Row.prototype.isEmpty = function isEmpty() {\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n\n /**\n * Set the cursor to a valid column.\n */\n\n\n Row.prototype.setCursor = function setCursor(absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n if (this.pos < 0) {\n cea_608_parser_logger.log('ERROR', 'Negative cursor position ' + this.pos);\n this.pos = 0;\n } else if (this.pos > NR_COLS) {\n cea_608_parser_logger.log('ERROR', 'Too large cursor position ' + this.pos);\n this.pos = NR_COLS;\n }\n };\n\n /**\n * Move the cursor relative to current position.\n */\n\n\n Row.prototype.moveCursor = function moveCursor(relPos) {\n var newPos = this.pos + relPos;\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n this.setCursor(newPos);\n };\n\n /**\n * Backspace, move one step back and clear character.\n */\n\n\n Row.prototype.backSpace = function backSpace() {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(' ', this.currPenState);\n };\n\n Row.prototype.insertChar = function insertChar(byte) {\n if (byte >= 0x90) {\n //Extended char\n this.backSpace();\n }\n var char = getCharForByte(byte);\n if (this.pos >= NR_COLS) {\n cea_608_parser_logger.log('ERROR', 'Cannot insert ' + byte.toString(16) + ' (' + char + ') at position ' + this.pos + '. Skipping it!');\n return;\n }\n this.chars[this.pos].setChar(char, this.currPenState);\n this.moveCursor(1);\n };\n\n Row.prototype.clearFromPos = function clearFromPos(startPos) {\n var i;\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n };\n\n Row.prototype.clear = function clear() {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n };\n\n Row.prototype.clearToEndOfRow = function clearToEndOfRow() {\n this.clearFromPos(this.pos);\n };\n\n Row.prototype.getTextString = function getTextString() {\n var chars = [];\n var empty = true;\n for (var i = 0; i < NR_COLS; i++) {\n var char = this.chars[i].uchar;\n if (char !== ' ') {\n empty = false;\n }\n chars.push(char);\n }\n if (empty) {\n return '';\n } else {\n return chars.join('');\n }\n };\n\n Row.prototype.setPenStyles = function setPenStyles(styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n };\n\n return Row;\n}();\n\n/**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n*/\n\n\nvar CaptionScreen = function () {\n function CaptionScreen() {\n cea_608_parser__classCallCheck(this, CaptionScreen);\n\n this.rows = [];\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row()); // Note that we use zero-based numbering (0-14)\n }\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.reset();\n }\n\n CaptionScreen.prototype.reset = function reset() {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n this.currRow = NR_ROWS - 1;\n };\n\n CaptionScreen.prototype.equals = function equals(other) {\n var equal = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n return equal;\n };\n\n CaptionScreen.prototype.copy = function copy(other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n };\n\n CaptionScreen.prototype.isEmpty = function isEmpty() {\n var empty = true;\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n return empty;\n };\n\n CaptionScreen.prototype.backSpace = function backSpace() {\n var row = this.rows[this.currRow];\n row.backSpace();\n };\n\n CaptionScreen.prototype.clearToEndOfRow = function clearToEndOfRow() {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n };\n\n /**\n * Insert a character (without styling) in the current row.\n */\n\n\n CaptionScreen.prototype.insertChar = function insertChar(char) {\n var row = this.rows[this.currRow];\n row.insertChar(char);\n };\n\n CaptionScreen.prototype.setPen = function setPen(styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n };\n\n CaptionScreen.prototype.moveCursor = function moveCursor(relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n };\n\n CaptionScreen.prototype.setCursor = function setCursor(absPos) {\n cea_608_parser_logger.log('INFO', 'setCursor: ' + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n };\n\n CaptionScreen.prototype.setPAC = function setPAC(pacData) {\n cea_608_parser_logger.log('INFO', 'pacData = ' + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n }\n\n //Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n if (this.nrRollUpRows && this.currRow !== newRow) {\n //clear all rows first\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n\n //Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n //topRowIndex - the start of rows to copy (inclusive index)\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n //We only copy if the last position was already shown.\n //We use the cueStartTime value to check this.\n var lastOutputScreen = this.lastOutputScreen;\n if (lastOutputScreen) {\n var prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime;\n if (prevLineTime && prevLineTime < cea_608_parser_logger.time) {\n for (var _i = 0; _i < this.nrRollUpRows; _i++) {\n this.rows[newRow - this.nrRollUpRows + _i + 1].copy(lastOutputScreen.rows[topRowIndex + _i]);\n }\n }\n }\n }\n\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n var styles = { foreground: pacData.color, underline: pacData.underline, italics: pacData.italics, background: 'black', flash: false };\n this.setPen(styles);\n };\n\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n\n\n CaptionScreen.prototype.setBkgData = function setBkgData(bkgData) {\n\n cea_608_parser_logger.log('INFO', 'bkgData = ' + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); //Space\n };\n\n CaptionScreen.prototype.setRollUpRows = function setRollUpRows(nrRows) {\n this.nrRollUpRows = nrRows;\n };\n\n CaptionScreen.prototype.rollUp = function rollUp() {\n if (this.nrRollUpRows === null) {\n cea_608_parser_logger.log('DEBUG', 'roll_up but nrRollUpRows not set yet');\n return; //Not properly setup\n }\n cea_608_parser_logger.log('TEXT', this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n cea_608_parser_logger.log('INFO', 'Rolling up');\n //logger.log('TEXT', this.get_display_text())\n };\n\n /**\n * Get all non-empty rows with as unicode text.\n */\n\n\n CaptionScreen.prototype.getDisplayText = function getDisplayText(asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = '';\n var rowNr = -1;\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n if (rowText) {\n rowNr = i + 1;\n if (asOneRow) {\n displayText.push('Row ' + rowNr + ': \\'' + rowText + '\\'');\n } else {\n displayText.push(rowText.trim());\n }\n }\n }\n if (displayText.length > 0) {\n if (asOneRow) {\n text = '[' + displayText.join(' | ') + ']';\n } else {\n text = displayText.join('\\n');\n }\n }\n return text;\n };\n\n CaptionScreen.prototype.getTextAndFormat = function getTextAndFormat() {\n return this.rows;\n };\n\n return CaptionScreen;\n}();\n\n//var modes = ['MODE_ROLL-UP', 'MODE_POP-ON', 'MODE_PAINT-ON', 'MODE_TEXT'];\n\nvar Cea608Channel = function () {\n function Cea608Channel(channelNumber, outputFilter) {\n cea_608_parser__classCallCheck(this, Cea608Channel);\n\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen();\n this.nonDisplayedMemory = new CaptionScreen();\n this.lastOutputScreen = new CaptionScreen();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n }\n\n Cea608Channel.prototype.reset = function reset() {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n this.lastCueEndTime = null;\n };\n\n Cea608Channel.prototype.getHandler = function getHandler() {\n return this.outputFilter;\n };\n\n Cea608Channel.prototype.setHandler = function setHandler(newHandler) {\n this.outputFilter = newHandler;\n };\n\n Cea608Channel.prototype.setPAC = function setPAC(pacData) {\n this.writeScreen.setPAC(pacData);\n };\n\n Cea608Channel.prototype.setBkgData = function setBkgData(bkgData) {\n this.writeScreen.setBkgData(bkgData);\n };\n\n Cea608Channel.prototype.setMode = function setMode(newMode) {\n if (newMode === this.mode) {\n return;\n }\n this.mode = newMode;\n cea_608_parser_logger.log('INFO', 'MODE=' + newMode);\n if (this.mode === 'MODE_POP-ON') {\n this.writeScreen = this.nonDisplayedMemory;\n } else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n if (this.mode !== 'MODE_ROLL-UP') {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n this.mode = newMode;\n };\n\n Cea608Channel.prototype.insertChars = function insertChars(chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n var screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';\n cea_608_parser_logger.log('INFO', screen + ': ' + this.writeScreen.getDisplayText(true));\n if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n cea_608_parser_logger.log('TEXT', 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n };\n\n Cea608Channel.prototype.ccRCL = function ccRCL() {\n // Resume Caption Loading (switch mode to Pop On)\n cea_608_parser_logger.log('INFO', 'RCL - Resume Caption Loading');\n this.setMode('MODE_POP-ON');\n };\n\n Cea608Channel.prototype.ccBS = function ccBS() {\n // BackSpace\n cea_608_parser_logger.log('INFO', 'BS - BackSpace');\n if (this.mode === 'MODE_TEXT') {\n return;\n }\n this.writeScreen.backSpace();\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n };\n\n Cea608Channel.prototype.ccAOF = function ccAOF() {\n // Reserved (formerly Alarm Off)\n return;\n };\n\n Cea608Channel.prototype.ccAON = function ccAON() {\n // Reserved (formerly Alarm On)\n return;\n };\n\n Cea608Channel.prototype.ccDER = function ccDER() {\n // Delete to End of Row\n cea_608_parser_logger.log('INFO', 'DER- Delete to End of Row');\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n };\n\n Cea608Channel.prototype.ccRU = function ccRU(nrRows) {\n //Roll-Up Captions-2,3,or 4 Rows\n cea_608_parser_logger.log('INFO', 'RU(' + nrRows + ') - Roll Up');\n this.writeScreen = this.displayedMemory;\n this.setMode('MODE_ROLL-UP');\n this.writeScreen.setRollUpRows(nrRows);\n };\n\n Cea608Channel.prototype.ccFON = function ccFON() {\n //Flash On\n cea_608_parser_logger.log('INFO', 'FON - Flash On');\n this.writeScreen.setPen({ flash: true });\n };\n\n Cea608Channel.prototype.ccRDC = function ccRDC() {\n // Resume Direct Captioning (switch mode to PaintOn)\n cea_608_parser_logger.log('INFO', 'RDC - Resume Direct Captioning');\n this.setMode('MODE_PAINT-ON');\n };\n\n Cea608Channel.prototype.ccTR = function ccTR() {\n // Text Restart in text mode (not supported, however)\n cea_608_parser_logger.log('INFO', 'TR');\n this.setMode('MODE_TEXT');\n };\n\n Cea608Channel.prototype.ccRTD = function ccRTD() {\n // Resume Text Display in Text mode (not supported, however)\n cea_608_parser_logger.log('INFO', 'RTD');\n this.setMode('MODE_TEXT');\n };\n\n Cea608Channel.prototype.ccEDM = function ccEDM() {\n // Erase Displayed Memory\n cea_608_parser_logger.log('INFO', 'EDM - Erase Displayed Memory');\n this.displayedMemory.reset();\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccCR = function ccCR() {\n // Carriage Return\n cea_608_parser_logger.log('CR - Carriage Return');\n this.writeScreen.rollUp();\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccENM = function ccENM() {\n //Erase Non-Displayed Memory\n cea_608_parser_logger.log('INFO', 'ENM - Erase Non-displayed Memory');\n this.nonDisplayedMemory.reset();\n };\n\n Cea608Channel.prototype.ccEOC = function ccEOC() {\n //End of Caption (Flip Memories)\n cea_608_parser_logger.log('INFO', 'EOC - End Of Caption');\n if (this.mode === 'MODE_POP-ON') {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n cea_608_parser_logger.log('TEXT', 'DISP: ' + this.displayedMemory.getDisplayText());\n }\n this.outputDataUpdate(true);\n };\n\n Cea608Channel.prototype.ccTO = function ccTO(nrCols) {\n // Tab Offset 1,2, or 3 columns\n cea_608_parser_logger.log('INFO', 'TO(' + nrCols + ') - Tab Offset');\n this.writeScreen.moveCursor(nrCols);\n };\n\n Cea608Channel.prototype.ccMIDROW = function ccMIDROW(secondByte) {\n // Parse MIDROW command\n var styles = { flash: false };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta'];\n styles.foreground = colors[colorIndex];\n } else {\n styles.foreground = 'white';\n }\n cea_608_parser_logger.log('INFO', 'MIDROW: ' + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n };\n\n Cea608Channel.prototype.outputDataUpdate = function outputDataUpdate() {\n var dispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var t = cea_608_parser_logger.time;\n if (t === null) {\n return;\n }\n if (this.outputFilter) {\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n // Start of a new cue\n this.cueStartTime = t;\n } else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen);\n if (dispatch === true && this.outputFilter.dispatchCue) {\n this.outputFilter.dispatchCue();\n }\n }\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : t;\n }\n }\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n };\n\n Cea608Channel.prototype.cueSplitAtTime = function cueSplitAtTime(t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n this.cueStartTime = t;\n }\n }\n };\n\n return Cea608Channel;\n}();\n\nvar Cea608Parser = function () {\n function Cea608Parser(field, out1, out2) {\n cea_608_parser__classCallCheck(this, Cea608Parser);\n\n this.field = field || 1;\n this.outputs = [out1, out2];\n this.channels = [new Cea608Channel(1, out1), new Cea608Channel(2, out2)];\n this.currChNr = -1; // Will be 1 or 2\n this.lastCmdA = null; // First byte of last command\n this.lastCmdB = null; // Second byte of last command\n this.bufferedData = [];\n this.startTime = null;\n this.lastTime = null;\n this.dataCounters = { 'padding': 0, 'char': 0, 'cmd': 0, 'other': 0 };\n }\n\n Cea608Parser.prototype.getHandler = function getHandler(index) {\n return this.channels[index].getHandler();\n };\n\n Cea608Parser.prototype.setHandler = function setHandler(index, newHandler) {\n this.channels[index].setHandler(newHandler);\n };\n\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n\n\n Cea608Parser.prototype.addData = function addData(t, byteList) {\n var cmdFound,\n a,\n b,\n charsFound = false;\n\n this.lastTime = t;\n cea_608_parser_logger.setTime(t);\n\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n if (a === 0 && b === 0) {\n this.dataCounters.padding += 2;\n continue;\n } else {\n cea_608_parser_logger.log('DATA', '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');\n }\n cmdFound = this.parseCmd(a, b);\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n if (charsFound) {\n if (this.currChNr && this.currChNr >= 0) {\n var channel = this.channels[this.currChNr - 1];\n channel.insertChars(charsFound);\n } else {\n cea_608_parser_logger.log('WARNING', 'No channel found yet. TEXT-MODE?');\n }\n }\n }\n if (cmdFound) {\n this.dataCounters.cmd += 2;\n } else if (charsFound) {\n this.dataCounters.char += 2;\n } else {\n this.dataCounters.other += 2;\n cea_608_parser_logger.log('WARNING', 'Couldn\\'t parse cleaned data ' + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n };\n\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n\n\n Cea608Parser.prototype.parseCmd = function parseCmd(a, b) {\n var chNr = null;\n\n var cond1 = (a === 0x14 || a === 0x1C) && 0x20 <= b && b <= 0x2F;\n var cond2 = (a === 0x17 || a === 0x1F) && 0x21 <= b && b <= 0x23;\n if (!(cond1 || cond2)) {\n return false;\n }\n\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null; // Repeated commands are dropped (once)\n cea_608_parser_logger.log('DEBUG', 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');\n return true;\n }\n\n if (a === 0x14 || a === 0x17) {\n chNr = 1;\n } else {\n chNr = 2; // (a === 0x1C || a=== 0x1f)\n }\n\n var channel = this.channels[chNr - 1];\n\n if (a === 0x14 || a === 0x1C) {\n if (b === 0x20) {\n channel.ccRCL();\n } else if (b === 0x21) {\n channel.ccBS();\n } else if (b === 0x22) {\n channel.ccAOF();\n } else if (b === 0x23) {\n channel.ccAON();\n } else if (b === 0x24) {\n channel.ccDER();\n } else if (b === 0x25) {\n channel.ccRU(2);\n } else if (b === 0x26) {\n channel.ccRU(3);\n } else if (b === 0x27) {\n channel.ccRU(4);\n } else if (b === 0x28) {\n channel.ccFON();\n } else if (b === 0x29) {\n channel.ccRDC();\n } else if (b === 0x2A) {\n channel.ccTR();\n } else if (b === 0x2B) {\n channel.ccRTD();\n } else if (b === 0x2C) {\n channel.ccEDM();\n } else if (b === 0x2D) {\n channel.ccCR();\n } else if (b === 0x2E) {\n channel.ccENM();\n } else if (b === 0x2F) {\n channel.ccEOC();\n }\n } else {\n //a == 0x17 || a == 0x1F\n channel.ccTO(b - 0x20);\n }\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n\n\n Cea608Parser.prototype.parseMidrow = function parseMidrow(a, b) {\n var chNr = null;\n\n if ((a === 0x11 || a === 0x19) && 0x20 <= b && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n } else {\n chNr = 2;\n }\n if (chNr !== this.currChNr) {\n cea_608_parser_logger.log('ERROR', 'Mismatch channel in midrow parsing');\n return false;\n }\n var channel = this.channels[chNr - 1];\n channel.ccMIDROW(b);\n cea_608_parser_logger.log('DEBUG', 'MIDROW (' + numArrayToHexArray([a, b]) + ')');\n return true;\n }\n return false;\n };\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n\n\n Cea608Parser.prototype.parsePAC = function parsePAC(a, b) {\n\n var chNr = null;\n var row = null;\n\n var case1 = (0x11 <= a && a <= 0x17 || 0x19 <= a && a <= 0x1F) && 0x40 <= b && b <= 0x7F;\n var case2 = (a === 0x10 || a === 0x18) && 0x40 <= b && b <= 0x5F;\n if (!(case1 || case2)) {\n return false;\n }\n\n if (a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true; // Repeated commands are dropped (once)\n }\n\n chNr = a <= 0x17 ? 1 : 2;\n\n if (0x40 <= b && b <= 0x5F) {\n row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];\n } else {\n // 0x60 <= b <= 0x7F\n row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n var pacData = this.interpretPAC(row, b);\n var channel = this.channels[chNr - 1];\n channel.setPAC(pacData);\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n };\n\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n\n\n Cea608Parser.prototype.interpretPAC = function interpretPAC(row, byte) {\n var pacIndex = byte;\n var pacData = { color: null, italics: false, indent: null, underline: false, row: row };\n\n if (byte > 0x5F) {\n pacIndex = byte - 0x60;\n } else {\n pacIndex = byte - 0x40;\n }\n pacData.underline = (pacIndex & 1) === 1;\n if (pacIndex <= 0xd) {\n pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)];\n } else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = 'white';\n } else {\n pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4;\n }\n return pacData; // Note that row has zero offset. The spec uses 1.\n };\n\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n\n\n Cea608Parser.prototype.parseChars = function parseChars(a, b) {\n\n var channelNr = null,\n charCodes = null,\n charCode1 = null;\n\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n } else {\n channelNr = 1;\n charCode1 = a;\n }\n if (0x11 <= charCode1 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n } else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n } else {\n oneCode = b + 0x90;\n }\n cea_608_parser_logger.log('INFO', 'Special char \\'' + getCharForByte(oneCode) + '\\' in channel ' + channelNr);\n charCodes = [oneCode];\n } else if (0x20 <= a && a <= 0x7f) {\n charCodes = b === 0 ? [a] : [a, b];\n }\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n cea_608_parser_logger.log('DEBUG', 'Char codes = ' + hexCodes.join(','));\n this.lastCmdA = null;\n this.lastCmdB = null;\n }\n return charCodes;\n };\n\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns{Boolean} Tells if background attributes are found\n */\n\n\n Cea608Parser.prototype.parseBackgroundAttributes = function parseBackgroundAttributes(a, b) {\n var bkgData, index, chNr, channel;\n\n var case1 = (a === 0x10 || a === 0x18) && 0x20 <= b && b <= 0x2f;\n var case2 = (a === 0x17 || a === 0x1f) && 0x2d <= b && b <= 0x2f;\n if (!(case1 || case2)) {\n return false;\n }\n bkgData = {};\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + '_semi';\n }\n } else if (b === 0x2d) {\n bkgData.background = 'transparent';\n } else {\n bkgData.foreground = 'black';\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n chNr = a < 0x18 ? 1 : 2;\n channel = this.channels[chNr - 1];\n channel.setBkgData(bkgData);\n this.lastCmdA = null;\n this.lastCmdB = null;\n return true;\n };\n\n /**\n * Reset state of parser and its channels.\n */\n\n\n Cea608Parser.prototype.reset = function reset() {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].reset();\n }\n }\n this.lastCmdA = null;\n this.lastCmdB = null;\n };\n\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n\n\n Cea608Parser.prototype.cueSplitAtTime = function cueSplitAtTime(t) {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].cueSplitAtTime(t);\n }\n }\n };\n\n return Cea608Parser;\n}();\n\n/* harmony default export */ var cea_608_parser = (Cea608Parser);\n// CONCATENATED MODULE: ./src/utils/output-filter.js\nfunction output_filter__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar OutputFilter = function () {\n function OutputFilter(timelineController, track) {\n output_filter__classCallCheck(this, OutputFilter);\n\n this.timelineController = timelineController;\n this.track = track;\n this.startTime = null;\n this.endTime = null;\n this.screen = null;\n }\n\n OutputFilter.prototype.dispatchCue = function dispatchCue() {\n if (this.startTime === null) {\n return;\n }\n this.timelineController.addCues('textTrack' + this.track, this.startTime, this.endTime, this.screen);\n this.startTime = null;\n };\n\n OutputFilter.prototype.newCue = function newCue(startTime, endTime, screen) {\n if (this.startTime === null || this.startTime > startTime) {\n this.startTime = startTime;\n }\n this.endTime = endTime;\n this.screen = screen;\n this.timelineController.createCaptionsTrack(this.track);\n };\n\n return OutputFilter;\n}();\n\n/* harmony default export */ var output_filter = (OutputFilter);\n// CONCATENATED MODULE: ./src/utils/webvtt-parser.js\n\n\n\n// String.prototype.startsWith is not supported in IE11\nvar startsWith = function startsWith(inputString, searchString, position) {\n return inputString.substr(position || 0, searchString.length) === searchString;\n};\n\nvar cueString2millis = function cueString2millis(timeString) {\n var ts = parseInt(timeString.substr(-3));\n var secs = parseInt(timeString.substr(-6, 2));\n var mins = parseInt(timeString.substr(-9, 2));\n var hours = timeString.length > 9 ? parseInt(timeString.substr(0, timeString.indexOf(':'))) : 0;\n\n if (isNaN(ts) || isNaN(secs) || isNaN(mins) || isNaN(hours)) {\n return -1;\n }\n\n ts += 1000 * secs;\n ts += 60 * 1000 * mins;\n ts += 60 * 60 * 1000 * hours;\n\n return ts;\n};\n\n// From https://github.com/darkskyapp/string-hash\nvar hash = function hash(text) {\n var hash = 5381;\n var i = text.length;\n while (i) {\n hash = hash * 33 ^ text.charCodeAt(--i);\n }\n return (hash >>> 0).toString();\n};\n\nvar calculateOffset = function calculateOffset(vttCCs, cc, presentationTime) {\n var currCC = vttCCs[cc];\n var prevCC = vttCCs[currCC.prevCC];\n\n // This is the first discontinuity or cues have been processed since the last discontinuity\n // Offset = current discontinuity time\n if (!prevCC || !prevCC.new && currCC.new) {\n vttCCs.ccOffset = vttCCs.presentationOffset = currCC.start;\n currCC.new = false;\n return;\n }\n\n // There have been discontinuities since cues were last parsed.\n // Offset = time elapsed\n while (prevCC && prevCC.new) {\n vttCCs.ccOffset += currCC.start - prevCC.start;\n currCC.new = false;\n currCC = prevCC;\n prevCC = vttCCs[currCC.prevCC];\n }\n\n vttCCs.presentationOffset = presentationTime;\n};\n\nvar WebVTTParser = {\n parse: function parse(vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {\n // Convert byteArray into string, replacing any somewhat exotic linefeeds with \"\\n\", then split on that character.\n var re = /\\r\\n|\\n\\r|\\n|\\r/g;\n // Uint8Array.prototype.reduce is not implemented in IE11\n var vttLines = Object(id3[\"b\" /* utf8ArrayToStr */])(new Uint8Array(vttByteArray)).trim().replace(re, '\\n').split('\\n');\n\n var cueTime = '00:00.000';\n var mpegTs = 0;\n var localTime = 0;\n var presentationTime = 0;\n var cues = [];\n var parsingError = void 0;\n var inHeader = true;\n // let VTTCue = VTTCue || window.TextTrackCue;\n\n // Create parser object using VTTCue with TextTrackCue fallback on certain browsers.\n var parser = new vttparser();\n\n parser.oncue = function (cue) {\n // Adjust cue timing; clamp cues to start no earlier than - and drop cues that don't end after - 0 on timeline.\n var currCC = vttCCs[cc];\n var cueOffset = vttCCs.ccOffset;\n\n // Update offsets for new discontinuities\n if (currCC && currCC.new) {\n if (localTime !== undefined) {\n // When local time is provided, offset = discontinuity start time - local time\n cueOffset = vttCCs.ccOffset = currCC.start;\n } else {\n calculateOffset(vttCCs, cc, presentationTime);\n }\n }\n\n if (presentationTime) {\n // If we have MPEGTS, offset = presentation time + discontinuity offset\n cueOffset = presentationTime + vttCCs.ccOffset - vttCCs.presentationOffset;\n }\n\n cue.startTime += cueOffset - localTime;\n cue.endTime += cueOffset - localTime;\n\n // Create a unique hash id for a cue based on start/end times and text.\n // This helps timeline-controller to avoid showing repeated captions.\n cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text);\n\n // Fix encoding of special characters. TODO: Test with all sorts of weird characters.\n cue.text = decodeURIComponent(encodeURIComponent(cue.text));\n if (cue.endTime > 0) {\n cues.push(cue);\n }\n };\n\n parser.onparsingerror = function (e) {\n parsingError = e;\n };\n\n parser.onflush = function () {\n if (parsingError && errorCallBack) {\n errorCallBack(parsingError);\n return;\n }\n callBack(cues);\n };\n\n // Go through contents line by line.\n vttLines.forEach(function (line) {\n if (inHeader) {\n // Look for X-TIMESTAMP-MAP in header.\n if (startsWith(line, 'X-TIMESTAMP-MAP=')) {\n // Once found, no more are allowed anyway, so stop searching.\n inHeader = false;\n // Extract LOCAL and MPEGTS.\n line.substr(16).split(',').forEach(function (timestamp) {\n if (startsWith(timestamp, 'LOCAL:')) {\n cueTime = timestamp.substr(6);\n } else if (startsWith(timestamp, 'MPEGTS:')) {\n mpegTs = parseInt(timestamp.substr(7));\n }\n });\n try {\n // Calculate subtitle offset in milliseconds.\n // If sync PTS is less than zero, we have a 33-bit wraparound, which is fixed by adding 2^33 = 8589934592.\n syncPTS = syncPTS < 0 ? syncPTS + 8589934592 : syncPTS;\n // Adjust MPEGTS by sync PTS.\n mpegTs -= syncPTS;\n // Convert cue time to seconds\n localTime = cueString2millis(cueTime) / 1000;\n // Convert MPEGTS to seconds from 90kHz.\n presentationTime = mpegTs / 90000;\n\n if (localTime === -1) {\n parsingError = new Error('Malformed X-TIMESTAMP-MAP: ' + line);\n }\n } catch (e) {\n parsingError = new Error('Malformed X-TIMESTAMP-MAP: ' + line);\n }\n // Return without parsing X-TIMESTAMP-MAP line.\n return;\n } else if (line === '') {\n inHeader = false;\n }\n }\n // Parse line by default.\n parser.parse(line + '\\n');\n });\n\n parser.flush();\n }\n};\n\n/* harmony default export */ var webvtt_parser = (WebVTTParser);\n// CONCATENATED MODULE: ./src/controller/timeline-controller.js\nfunction timeline_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction timeline_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction timeline_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Timeline Controller\n*/\n\n\n\n\n\n\n\n\nfunction clearCurrentCues(track) {\n if (track && track.cues) {\n while (track.cues.length > 0) {\n track.removeCue(track.cues[0]);\n }\n }\n}\n\nfunction reuseVttTextTrack(inUseTrack, manifestTrack) {\n return inUseTrack && inUseTrack.label === manifestTrack.name && !(inUseTrack.textTrack1 || inUseTrack.textTrack2);\n}\n\nfunction intersection(x1, x2, y1, y2) {\n return Math.min(x2, y2) - Math.max(x1, y1);\n}\n\nvar timeline_controller_TimelineController = function (_EventHandler) {\n timeline_controller__inherits(TimelineController, _EventHandler);\n\n function TimelineController(hls) {\n timeline_controller__classCallCheck(this, TimelineController);\n\n var _this = timeline_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHING, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].FRAG_PARSING_USERDATA, events[\"a\" /* default */].FRAG_DECRYPTED, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].LEVEL_SWITCHING, events[\"a\" /* default */].INIT_PTS_FOUND));\n\n _this.hls = hls;\n _this.config = hls.config;\n _this.enabled = true;\n _this.Cues = hls.config.cueHandler;\n _this.textTracks = [];\n _this.tracks = [];\n _this.unparsedVttFrags = [];\n _this.initPTS = undefined;\n _this.cueRanges = [];\n\n if (_this.config.enableCEA708Captions) {\n var channel1 = new output_filter(_this, 1);\n var channel2 = new output_filter(_this, 2);\n\n _this.cea608Parser = new cea_608_parser(0, channel1, channel2);\n }\n return _this;\n }\n\n TimelineController.prototype.addCues = function addCues(channel, startTime, endTime, screen) {\n // skip cues which overlap more than 50% with previously parsed time ranges\n var ranges = this.cueRanges;\n var merged = false;\n for (var i = ranges.length; i--;) {\n var cueRange = ranges[i];\n var overlap = intersection(cueRange[0], cueRange[1], startTime, endTime);\n if (overlap >= 0) {\n cueRange[0] = Math.min(cueRange[0], startTime);\n cueRange[1] = Math.max(cueRange[1], endTime);\n merged = true;\n if (overlap / (endTime - startTime) > 0.5) {\n return;\n }\n }\n }\n if (!merged) {\n ranges.push([startTime, endTime]);\n }\n this.Cues.newCue(this[channel], startTime, endTime, screen);\n };\n\n // Triggered when an initial PTS is found; used for synchronisation of WebVTT.\n\n\n TimelineController.prototype.onInitPtsFound = function onInitPtsFound(data) {\n var _this2 = this;\n\n if (typeof this.initPTS === 'undefined') {\n this.initPTS = data.initPTS;\n }\n\n // Due to asynchrony, initial PTS may arrive later than the first VTT fragments are loaded.\n // Parse any unparsed fragments upon receiving the initial PTS.\n if (this.unparsedVttFrags.length) {\n this.unparsedVttFrags.forEach(function (frag) {\n _this2.onFragLoaded(frag);\n });\n this.unparsedVttFrags = [];\n }\n };\n\n TimelineController.prototype.getExistingTrack = function getExistingTrack(channelNumber) {\n var media = this.media;\n if (media) {\n for (var i = 0; i < media.textTracks.length; i++) {\n var textTrack = media.textTracks[i];\n var propName = 'textTrack' + channelNumber;\n if (textTrack[propName] === true) {\n return textTrack;\n }\n }\n }\n return null;\n };\n\n TimelineController.prototype.sendAddTrackEvent = function sendAddTrackEvent(track, media) {\n var e = null;\n try {\n e = new window.Event('addtrack');\n } catch (err) {\n //for IE11\n e = document.createEvent('Event');\n e.initEvent('addtrack', false, false);\n }\n e.track = track;\n media.dispatchEvent(e);\n };\n\n TimelineController.prototype.createCaptionsTrack = function createCaptionsTrack(track) {\n var trackVar = 'textTrack' + track;\n if (!this[trackVar]) {\n //Enable reuse of existing text track.\n var existingTrack = this.getExistingTrack(track);\n if (!existingTrack) {\n var textTrack = this.createTextTrack('captions', this.config['captionsTextTrack' + track + 'Label'], this.config.captionsTextTrack1LanguageCode);\n if (textTrack) {\n textTrack[trackVar] = true;\n this[trackVar] = textTrack;\n }\n } else {\n this[trackVar] = existingTrack;\n clearCurrentCues(this[trackVar]);\n\n this.sendAddTrackEvent(this[trackVar], this.media);\n }\n }\n };\n\n TimelineController.prototype.createTextTrack = function createTextTrack(kind, label, lang) {\n var media = this.media;\n if (media) {\n return media.addTextTrack(kind, label, lang);\n }\n };\n\n TimelineController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n TimelineController.prototype.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media;\n this._cleanTracks();\n };\n\n TimelineController.prototype.onMediaDetaching = function onMediaDetaching() {\n clearCurrentCues(this.textTrack1);\n clearCurrentCues(this.textTrack2);\n };\n\n TimelineController.prototype.onManifestLoading = function onManifestLoading() {\n this.lastSn = -1; // Detect discontiguity in fragment parsing\n this.prevCC = -1;\n this.vttCCs = { ccOffset: 0, presentationOffset: 0 }; // Detect discontinuity in subtitle manifests\n this._cleanTracks();\n };\n\n TimelineController.prototype._cleanTracks = function _cleanTracks() {\n // clear outdated subtitles\n var media = this.media;\n if (media) {\n var textTracks = media.textTracks;\n if (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n clearCurrentCues(textTracks[i]);\n }\n }\n }\n };\n\n TimelineController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n this.textTracks = [];\n this.unparsedVttFrags = this.unparsedVttFrags || [];\n this.initPTS = undefined;\n this.cueRanges = [];\n\n if (this.config.enableWebVTT) {\n this.tracks = data.subtitles || [];\n var inUseTracks = this.media ? this.media.textTracks : [];\n\n this.tracks.forEach(function (track, index) {\n var textTrack = void 0;\n if (index < inUseTracks.length) {\n var inUseTrack = inUseTracks[index];\n // Reuse tracks with the same label, but do not reuse 608/708 tracks\n if (reuseVttTextTrack(inUseTrack, track)) {\n textTrack = inUseTrack;\n }\n }\n if (!textTrack) {\n textTrack = _this3.createTextTrack('subtitles', track.name, track.lang);\n }\n textTrack.mode = track.default ? 'showing' : 'hidden';\n _this3.textTracks.push(textTrack);\n });\n }\n };\n\n TimelineController.prototype.onLevelSwitching = function onLevelSwitching() {\n this.enabled = this.hls.currentLevel.closedCaptions !== 'NONE';\n };\n\n TimelineController.prototype.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag,\n payload = data.payload;\n if (frag.type === 'main') {\n var sn = frag.sn;\n // if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack\n if (sn !== this.lastSn + 1) {\n var cea608Parser = this.cea608Parser;\n if (cea608Parser) {\n cea608Parser.reset();\n }\n }\n this.lastSn = sn;\n }\n // If fragment is subtitle type, parse as WebVTT.\n else if (frag.type === 'subtitle') {\n if (payload.byteLength) {\n // We need an initial synchronisation PTS. Store fragments as long as none has arrived.\n if (typeof this.initPTS === 'undefined') {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n var decryptData = frag.decryptdata;\n // If the subtitles are not encrypted, parse VTTs now. Otherwise, we need to wait.\n if (decryptData == null || decryptData.key == null || decryptData.method !== 'AES-128') {\n this._parseVTTs(frag, payload);\n }\n } else {\n // In case there is no payload, finish unsuccessfully.\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n }\n }\n };\n\n TimelineController.prototype._parseVTTs = function _parseVTTs(frag, payload) {\n var vttCCs = this.vttCCs;\n if (!vttCCs[frag.cc]) {\n vttCCs[frag.cc] = { start: frag.start, prevCC: this.prevCC, new: true };\n this.prevCC = frag.cc;\n }\n var textTracks = this.textTracks,\n hls = this.hls;\n\n // Parse the WebVTT file contents.\n webvtt_parser.parse(payload, this.initPTS, vttCCs, frag.cc, function (cues) {\n var currentTrack = textTracks[frag.trackId];\n // Add cues and trigger event with success true.\n cues.forEach(function (cue) {\n // Sometimes there are cue overlaps on segmented vtts so the same\n // cue can appear more than once in different vtt files.\n // This avoid showing duplicated cues with same timecode and text.\n if (!currentTrack.cues.getCueById(cue.id)) {\n try {\n currentTrack.addCue(cue);\n } catch (err) {\n var textTrackCue = new window.TextTrackCue(cue.startTime, cue.endTime, cue.text);\n textTrackCue.id = cue.id;\n currentTrack.addCue(textTrackCue);\n }\n }\n });\n hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: true, frag: frag });\n }, function (e) {\n // Something went wrong while parsing. Trigger event with success false.\n logger[\"b\" /* logger */].log('Failed to parse VTT cue: ' + e);\n hls.trigger(events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED, { success: false, frag: frag });\n });\n };\n\n TimelineController.prototype.onFragDecrypted = function onFragDecrypted(data) {\n var decryptedData = data.payload,\n frag = data.frag;\n\n if (frag.type === 'subtitle') {\n if (typeof this.initPTS === 'undefined') {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n this._parseVTTs(frag, decryptedData);\n }\n };\n\n TimelineController.prototype.onFragParsingUserdata = function onFragParsingUserdata(data) {\n // push all of the CEA-708 messages into the interpreter\n // immediately. It will create the proper timestamps based on our PTS value\n if (this.enabled && this.config.enableCEA708Captions) {\n for (var i = 0; i < data.samples.length; i++) {\n var ccdatas = this.extractCea608Data(data.samples[i].bytes);\n this.cea608Parser.addData(data.samples[i].pts, ccdatas);\n }\n }\n };\n\n TimelineController.prototype.extractCea608Data = function extractCea608Data(byteArray) {\n var count = byteArray[0] & 31;\n var position = 2;\n var tmpByte, ccbyte1, ccbyte2, ccValid, ccType;\n var actualCCBytes = [];\n\n for (var j = 0; j < count; j++) {\n tmpByte = byteArray[position++];\n ccbyte1 = 0x7F & byteArray[position++];\n ccbyte2 = 0x7F & byteArray[position++];\n ccValid = (4 & tmpByte) !== 0;\n ccType = 3 & tmpByte;\n\n if (ccbyte1 === 0 && ccbyte2 === 0) {\n continue;\n }\n\n if (ccValid) {\n if (ccType === 0) // || ccType === 1\n {\n actualCCBytes.push(ccbyte1);\n actualCCBytes.push(ccbyte2);\n }\n }\n }\n return actualCCBytes;\n };\n\n return TimelineController;\n}(event_handler);\n\n/* harmony default export */ var timeline_controller = (timeline_controller_TimelineController);\n// CONCATENATED MODULE: ./src/controller/subtitle-track-controller.js\nvar subtitle_track_controller__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction subtitle_track_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction subtitle_track_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction subtitle_track_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * subtitle track controller\n*/\n\n\n\n\n\nfunction filterSubtitleTracks(textTrackList) {\n var tracks = [];\n for (var i = 0; i < textTrackList.length; i++) {\n if (textTrackList[i].kind === 'subtitles') {\n tracks.push(textTrackList[i]);\n }\n }\n return tracks;\n}\n\nvar subtitle_track_controller_SubtitleTrackController = function (_EventHandler) {\n subtitle_track_controller__inherits(SubtitleTrackController, _EventHandler);\n\n function SubtitleTrackController(hls) {\n subtitle_track_controller__classCallCheck(this, SubtitleTrackController);\n\n var _this = subtitle_track_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].MEDIA_DETACHING, events[\"a\" /* default */].MANIFEST_LOADING, events[\"a\" /* default */].MANIFEST_LOADED, events[\"a\" /* default */].SUBTITLE_TRACK_LOADED));\n\n _this.tracks = [];\n _this.trackId = -1;\n _this.media = undefined;\n _this.subtitleDisplay = false;\n return _this;\n }\n\n SubtitleTrackController.prototype._onTextTracksChanged = function _onTextTracksChanged() {\n // Media is undefined when switching streams via loadSource()\n if (!this.media) {\n return;\n }\n\n var trackId = -1;\n var tracks = filterSubtitleTracks(this.media.textTracks);\n for (var id = 0; id < tracks.length; id++) {\n if (tracks[id].mode === 'showing') {\n trackId = id;\n }\n }\n\n // Setting current subtitleTrack will invoke code.\n this.subtitleTrack = trackId;\n };\n\n SubtitleTrackController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n // Listen for subtitle track change, then extract the current track ID.\n\n\n SubtitleTrackController.prototype.onMediaAttached = function onMediaAttached(data) {\n var _this2 = this;\n\n this.media = data.media;\n if (!this.media) {\n return;\n }\n\n if (this.queuedDefaultTrack !== undefined) {\n this.subtitleTrack = this.queuedDefaultTrack;\n delete this.queuedDefaultTrack;\n }\n\n this.trackChangeListener = this._onTextTracksChanged.bind(this);\n\n this.useTextTrackPolling = !(this.media.textTracks && 'onchange' in this.media.textTracks);\n if (this.useTextTrackPolling) {\n this.subtitlePollingInterval = setInterval(function () {\n _this2.trackChangeListener();\n }, 500);\n } else {\n this.media.textTracks.addEventListener('change', this.trackChangeListener);\n }\n };\n\n SubtitleTrackController.prototype.onMediaDetaching = function onMediaDetaching() {\n if (!this.media) {\n return;\n }\n if (this.useTextTrackPolling) {\n clearInterval(this.subtitlePollingInterval);\n } else {\n this.media.textTracks.removeEventListener('change', this.trackChangeListener);\n }\n\n this.media = undefined;\n };\n\n // Reset subtitle tracks on manifest loading\n\n\n SubtitleTrackController.prototype.onManifestLoading = function onManifestLoading() {\n this.tracks = [];\n this.trackId = -1;\n };\n\n // Fired whenever a new manifest is loaded.\n\n\n SubtitleTrackController.prototype.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n var tracks = data.subtitles || [];\n this.tracks = tracks;\n this.trackId = -1;\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACKS_UPDATED, { subtitleTracks: tracks });\n\n // loop through available subtitle tracks and autoselect default if needed\n // TODO: improve selection logic to handle forced, etc\n tracks.forEach(function (track) {\n if (track.default) {\n // setting this.subtitleTrack will trigger internal logic\n // if media has not been attached yet, it will fail\n // we keep a reference to the default track id\n // and we'll set subtitleTrack when onMediaAttached is triggered\n if (_this3.media) {\n _this3.subtitleTrack = track.id;\n } else {\n _this3.queuedDefaultTrack = track.id;\n }\n }\n });\n };\n\n // Trigger subtitle track playlist reload.\n\n\n SubtitleTrackController.prototype.onTick = function onTick() {\n var trackId = this.trackId;\n var subtitleTrack = this.tracks[trackId];\n if (!subtitleTrack) {\n return;\n }\n\n var details = subtitleTrack.details;\n // check if we need to load playlist for this subtitle Track\n if (details === undefined || details.live === true) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for subtitle track ' + trackId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: trackId });\n }\n };\n\n SubtitleTrackController.prototype.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var _this4 = this;\n\n if (data.id < this.tracks.length) {\n logger[\"b\" /* logger */].log('subtitle track ' + data.id + ' loaded');\n this.tracks[data.id].details = data.details;\n // check if current playlist is a live playlist\n if (data.details.live && !this.timer) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n this.timer = setInterval(function () {\n _this4.onTick();\n }, 1000 * data.details.targetduration, this);\n }\n if (!data.details.live && this.timer) {\n // playlist is not live and timer is armed : stopping it\n clearInterval(this.timer);\n this.timer = null;\n }\n }\n };\n\n /** get alternate subtitle tracks list from playlist **/\n\n\n SubtitleTrackController.prototype.setSubtitleTrackInternal = function setSubtitleTrackInternal(newId) {\n // check if level idx is valid\n if (newId < -1 || newId >= this.tracks.length) {\n return;\n }\n\n // stopping live reloading timer if any\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n\n var textTracks = filterSubtitleTracks(this.media.textTracks);\n\n // hide currently enabled subtitle track\n if (this.trackId !== -1 && this.subtitleDisplay) {\n textTracks[this.trackId].mode = 'hidden';\n }\n\n this.trackId = newId;\n logger[\"b\" /* logger */].log('switching to subtitle track ' + newId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_SWITCH, { id: newId });\n\n if (newId === -1) {\n return;\n }\n\n var subtitleTrack = this.tracks[newId];\n if (this.subtitleDisplay) {\n textTracks[newId].mode = 'showing';\n }\n\n // check if we need to load playlist for this subtitle Track\n var details = subtitleTrack.details;\n if (details === undefined || details.live === true) {\n // track not retrieved yet, or live playlist we need to (re)load it\n logger[\"b\" /* logger */].log('(re)loading playlist for subtitle track ' + newId);\n this.hls.trigger(events[\"a\" /* default */].SUBTITLE_TRACK_LOADING, { url: subtitleTrack.url, id: newId });\n }\n };\n\n subtitle_track_controller__createClass(SubtitleTrackController, [{\n key: 'subtitleTracks',\n get: function get() {\n return this.tracks;\n }\n\n /** get index of the selected subtitle track (index in subtitle track lists) **/\n\n }, {\n key: 'subtitleTrack',\n get: function get() {\n return this.trackId;\n }\n\n /** select a subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n if (this.trackId !== subtitleTrackId) {\n // || this.tracks[subtitleTrackId].details === undefined) {\n this.setSubtitleTrackInternal(subtitleTrackId);\n }\n }\n }]);\n\n return SubtitleTrackController;\n}(event_handler);\n\n/* harmony default export */ var subtitle_track_controller = (subtitle_track_controller_SubtitleTrackController);\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar decrypter = __webpack_require__(4);\n\n// CONCATENATED MODULE: ./src/controller/subtitle-stream-controller.js\nfunction subtitle_stream_controller__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction subtitle_stream_controller__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction subtitle_stream_controller__inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Subtitle Stream Controller\n*/\n\n\n\n\n\n\nvar subtitle_stream_controller_State = {\n STOPPED: 'STOPPED',\n IDLE: 'IDLE',\n KEY_LOADING: 'KEY_LOADING',\n FRAG_LOADING: 'FRAG_LOADING'\n};\n\nvar subtitle_stream_controller_SubtitleStreamController = function (_EventHandler) {\n subtitle_stream_controller__inherits(SubtitleStreamController, _EventHandler);\n\n function SubtitleStreamController(hls) {\n subtitle_stream_controller__classCallCheck(this, SubtitleStreamController);\n\n var _this = subtitle_stream_controller__possibleConstructorReturn(this, _EventHandler.call(this, hls, events[\"a\" /* default */].MEDIA_ATTACHED, events[\"a\" /* default */].ERROR, events[\"a\" /* default */].KEY_LOADED, events[\"a\" /* default */].FRAG_LOADED, events[\"a\" /* default */].SUBTITLE_TRACKS_UPDATED, events[\"a\" /* default */].SUBTITLE_TRACK_SWITCH, events[\"a\" /* default */].SUBTITLE_TRACK_LOADED, events[\"a\" /* default */].SUBTITLE_FRAG_PROCESSED));\n\n _this.config = hls.config;\n _this.vttFragSNsProcessed = {};\n _this.vttFragQueues = undefined;\n _this.currentlyProcessing = null;\n _this.state = subtitle_stream_controller_State.STOPPED;\n _this.currentTrackId = -1;\n _this.ticks = 0;\n _this.decrypter = new decrypter[\"a\" /* default */](hls.observer, hls.config);\n return _this;\n }\n\n SubtitleStreamController.prototype.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n this.state = subtitle_stream_controller_State.STOPPED;\n };\n\n // Remove all queued items and create a new, empty queue for each track.\n\n\n SubtitleStreamController.prototype.clearVttFragQueues = function clearVttFragQueues() {\n var _this2 = this;\n\n this.vttFragQueues = {};\n this.tracks.forEach(function (track) {\n _this2.vttFragQueues[track.id] = [];\n });\n };\n\n // If no frag is being processed and queue isn't empty, initiate processing of next frag in line.\n\n\n SubtitleStreamController.prototype.nextFrag = function nextFrag() {\n if (this.currentlyProcessing === null && this.currentTrackId > -1 && this.vttFragQueues[this.currentTrackId].length) {\n var frag = this.currentlyProcessing = this.vttFragQueues[this.currentTrackId].shift();\n this.fragCurrent = frag;\n this.hls.trigger(events[\"a\" /* default */].FRAG_LOADING, { frag: frag });\n this.state = subtitle_stream_controller_State.FRAG_LOADING;\n }\n };\n\n // When fragment has finished processing, add sn to list of completed if successful.\n\n\n SubtitleStreamController.prototype.onSubtitleFragProcessed = function onSubtitleFragProcessed(data) {\n if (data.success) {\n this.vttFragSNsProcessed[data.frag.trackId].push(data.frag.sn);\n }\n this.currentlyProcessing = null;\n this.state = subtitle_stream_controller_State.IDLE;\n this.nextFrag();\n };\n\n SubtitleStreamController.prototype.onMediaAttached = function onMediaAttached() {\n this.state = subtitle_stream_controller_State.IDLE;\n };\n\n // If something goes wrong, procede to next frag, if we were processing one.\n\n\n SubtitleStreamController.prototype.onError = function onError(data) {\n var frag = data.frag;\n // don't handle frag error not related to subtitle fragment\n if (frag && frag.type !== 'subtitle') {\n return;\n }\n if (this.currentlyProcessing) {\n this.currentlyProcessing = null;\n this.nextFrag();\n }\n };\n\n SubtitleStreamController.prototype.tick = function tick() {\n var _this3 = this;\n\n this.ticks++;\n if (this.ticks === 1) {\n this.doTick();\n if (this.ticks > 1) {\n setTimeout(function () {\n _this3.tick();\n }, 1);\n }\n this.ticks = 0;\n }\n };\n\n SubtitleStreamController.prototype.doTick = function doTick() {\n var _this4 = this;\n\n switch (this.state) {\n case subtitle_stream_controller_State.IDLE:\n var tracks = this.tracks;\n var trackId = this.currentTrackId;\n\n var processedFragSNs = this.vttFragSNsProcessed[trackId],\n fragQueue = this.vttFragQueues[trackId],\n currentFragSN = !!this.currentlyProcessing ? this.currentlyProcessing.sn : -1;\n\n var alreadyProcessed = function alreadyProcessed(frag) {\n return processedFragSNs.indexOf(frag.sn) > -1;\n };\n\n var alreadyInQueue = function alreadyInQueue(frag) {\n return fragQueue.some(function (fragInQueue) {\n return fragInQueue.sn === frag.sn;\n });\n };\n\n // exit if tracks don't exist\n if (!tracks) {\n break;\n }\n var trackDetails;\n\n if (trackId < tracks.length) {\n trackDetails = tracks[trackId].details;\n }\n\n if (typeof trackDetails === 'undefined') {\n break;\n }\n\n // Add all fragments that haven't been, aren't currently being and aren't waiting to be processed, to queue.\n trackDetails.fragments.forEach(function (frag) {\n if (!(alreadyProcessed(frag) || frag.sn === currentFragSN || alreadyInQueue(frag))) {\n // Load key if subtitles are encrypted\n if (frag.decryptdata && frag.decryptdata.uri != null && frag.decryptdata.key == null) {\n logger[\"b\" /* logger */].log('Loading key for ' + frag.sn);\n _this4.state = subtitle_stream_controller_State.KEY_LOADING;\n _this4.hls.trigger(events[\"a\" /* default */].KEY_LOADING, { frag: frag });\n } else {\n // Frags don't know their subtitle track ID, so let's just add that...\n frag.trackId = trackId;\n fragQueue.push(frag);\n _this4.nextFrag();\n }\n }\n });\n }\n };\n\n // Got all new subtitle tracks.\n\n\n SubtitleStreamController.prototype.onSubtitleTracksUpdated = function onSubtitleTracksUpdated(data) {\n var _this5 = this;\n\n logger[\"b\" /* logger */].log('subtitle tracks updated');\n this.tracks = data.subtitleTracks;\n this.clearVttFragQueues();\n this.vttFragSNsProcessed = {};\n this.tracks.forEach(function (track) {\n _this5.vttFragSNsProcessed[track.id] = [];\n });\n };\n\n SubtitleStreamController.prototype.onSubtitleTrackSwitch = function onSubtitleTrackSwitch(data) {\n this.currentTrackId = data.id;\n this.clearVttFragQueues();\n };\n\n // Got a new set of subtitle fragments.\n\n\n SubtitleStreamController.prototype.onSubtitleTrackLoaded = function onSubtitleTrackLoaded() {\n this.tick();\n };\n\n SubtitleStreamController.prototype.onKeyLoaded = function onKeyLoaded() {\n if (this.state === subtitle_stream_controller_State.KEY_LOADING) {\n this.state = subtitle_stream_controller_State.IDLE;\n this.tick();\n }\n };\n\n SubtitleStreamController.prototype.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n decryptData = data.frag.decryptdata;\n var fragLoaded = data.frag,\n hls = this.hls;\n if (this.state === subtitle_stream_controller_State.FRAG_LOADING && fragCurrent && data.frag.type === 'subtitle' && fragCurrent.sn === data.frag.sn) {\n // check to see if the payload needs to be decrypted\n if (data.payload.byteLength > 0 && decryptData != null && decryptData.key != null && decryptData.method === 'AES-128') {\n var startTime;\n try {\n startTime = performance.now();\n } catch (error) {\n startTime = Date.now();\n }\n // decrypt the subtitles\n this.decrypter.decrypt(data.payload, decryptData.key.buffer, decryptData.iv.buffer, function (decryptedData) {\n var endTime;\n try {\n endTime = performance.now();\n } catch (error) {\n endTime = Date.now();\n }\n hls.trigger(events[\"a\" /* default */].FRAG_DECRYPTED, { frag: fragLoaded, payload: decryptedData, stats: { tstart: startTime, tdecrypt: endTime } });\n });\n }\n }\n };\n\n return SubtitleStreamController;\n}(event_handler);\n\n/* harmony default export */ var subtitle_stream_controller = (subtitle_stream_controller_SubtitleStreamController);\n// CONCATENATED MODULE: ./src/config.js\n/**\n * HLS config\n */\n\n\n\n\n\n\n//import FetchLoader from './utils/fetch-loader';\n\n\n\n\n\n\n\n\n\nvar hlsDefaultConfig = {\n autoStartLoad: true, // used by stream-controller\n startPosition: -1, // used by stream-controller\n defaultAudioCodec: undefined, // used by stream-controller\n debug: false, // used by logger\n capLevelOnFPSDrop: false, // used by fps-controller\n capLevelToPlayerSize: false, // used by cap-level-controller\n initialLiveManifestSize: 1, // used by stream-controller\n maxBufferLength: 30, // used by stream-controller\n maxBufferSize: 60 * 1000 * 1000, // used by stream-controller\n maxBufferHole: 0.5, // used by stream-controller\n maxSeekHole: 2, // used by stream-controller\n lowBufferWatchdogPeriod: 0.5, // used by stream-controller\n highBufferWatchdogPeriod: 3, // used by stream-controller\n nudgeOffset: 0.1, // used by stream-controller\n nudgeMaxRetry: 3, // used by stream-controller\n maxFragLookUpTolerance: 0.25, // used by stream-controller\n liveSyncDurationCount: 3, // used by stream-controller\n liveMaxLatencyDurationCount: Infinity, // used by stream-controller\n liveSyncDuration: undefined, // used by stream-controller\n liveMaxLatencyDuration: undefined, // used by stream-controller\n liveDurationInfinity: false, // used by buffer-controller\n maxMaxBufferLength: 600, // used by stream-controller\n enableWorker: true, // used by demuxer\n enableSoftwareAES: true, // used by decrypter\n manifestLoadingTimeOut: 10000, // used by playlist-loader\n manifestLoadingMaxRetry: 1, // used by playlist-loader\n manifestLoadingRetryDelay: 1000, // used by playlist-loader\n manifestLoadingMaxRetryTimeout: 64000, // used by playlist-loader\n startLevel: undefined, // used by level-controller\n levelLoadingTimeOut: 10000, // used by playlist-loader\n levelLoadingMaxRetry: 4, // used by playlist-loader\n levelLoadingRetryDelay: 1000, // used by playlist-loader\n levelLoadingMaxRetryTimeout: 64000, // used by playlist-loader\n fragLoadingTimeOut: 20000, // used by fragment-loader\n fragLoadingMaxRetry: 6, // used by fragment-loader\n fragLoadingRetryDelay: 1000, // used by fragment-loader\n fragLoadingMaxRetryTimeout: 64000, // used by fragment-loader\n fragLoadingLoopThreshold: 3, // used by stream-controller\n startFragPrefetch: false, // used by stream-controller\n fpsDroppedMonitoringPeriod: 5000, // used by fps-controller\n fpsDroppedMonitoringThreshold: 0.2, // used by fps-controller\n appendErrorMaxRetry: 3, // used by buffer-controller\n loader: xhr_loader,\n //loader: FetchLoader,\n fLoader: undefined,\n pLoader: undefined,\n xhrSetup: undefined,\n fetchSetup: undefined,\n abrController: abr_controller,\n bufferController: buffer_controller,\n capLevelController: cap_level_controller,\n fpsController: fps_controller,\n stretchShortVideoTrack: false, // used by mp4-remuxer\n maxAudioFramesDrift: 1, // used by mp4-remuxer\n forceKeyFrameOnDiscontinuity: true, // used by ts-demuxer\n abrEwmaFastLive: 3, // used by abr-controller\n abrEwmaSlowLive: 9, // used by abr-controller\n abrEwmaFastVoD: 3, // used by abr-controller\n abrEwmaSlowVoD: 9, // used by abr-controller\n abrEwmaDefaultEstimate: 5e5, // 500 kbps // used by abr-controller\n abrBandWidthFactor: 0.95, // used by abr-controller\n abrBandWidthUpFactor: 0.7, // used by abr-controller\n abrMaxWithRealBitrate: false, // used by abr-controller\n maxStarvationDelay: 4, // used by abr-controller\n maxLoadingDelay: 4, // used by abr-controller\n minAutoBitrate: 0 // used by hls\n};\n\nif (true) {\n hlsDefaultConfig.subtitleStreamController = subtitle_stream_controller;\n hlsDefaultConfig.subtitleTrackController = subtitle_track_controller;\n hlsDefaultConfig.timelineController = timeline_controller;\n hlsDefaultConfig.cueHandler = cues_namespaceObject;\n hlsDefaultConfig.enableCEA708Captions = true; // used by timeline-controller\n hlsDefaultConfig.enableWebVTT = true; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack1Label = 'English'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack1LanguageCode = 'en'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack2Label = 'Spanish'; // used by timeline-controller\n hlsDefaultConfig.captionsTextTrack2LanguageCode = 'es'; // used by timeline-controller\n}\n\nif (true) {\n hlsDefaultConfig.audioStreamController = audio_stream_controller;\n hlsDefaultConfig.audioTrackController = audio_track_controller;\n}\n// CONCATENATED MODULE: ./src/hls.js\nvar hls__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction hls__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * HLS interface\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar hls_Hls = function () {\n Hls.isSupported = function isSupported() {\n return is_supported_isSupported();\n };\n\n hls__createClass(Hls, null, [{\n key: 'version',\n get: function get() {\n return \"0.8.9\";\n }\n }, {\n key: 'Events',\n get: function get() {\n return events[\"a\" /* default */];\n }\n }, {\n key: 'ErrorTypes',\n get: function get() {\n return errors[\"b\" /* ErrorTypes */];\n }\n }, {\n key: 'ErrorDetails',\n get: function get() {\n return errors[\"a\" /* ErrorDetails */];\n }\n }, {\n key: 'DefaultConfig',\n get: function get() {\n if (!Hls.defaultConfig) {\n return hlsDefaultConfig;\n }\n return Hls.defaultConfig;\n },\n set: function set(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n }]);\n\n function Hls() {\n var _this = this;\n\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n hls__classCallCheck(this, Hls);\n\n var defaultConfig = Hls.DefaultConfig;\n\n if ((config.liveSyncDurationCount || config.liveMaxLatencyDurationCount) && (config.liveSyncDuration || config.liveMaxLatencyDuration)) {\n throw new Error('Illegal hls.js config: don\\'t mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration');\n }\n\n for (var prop in defaultConfig) {\n if (prop in config) {\n continue;\n }\n config[prop] = defaultConfig[prop];\n }\n\n if (config.liveMaxLatencyDurationCount !== undefined && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== undefined && (config.liveMaxLatencyDuration <= config.liveSyncDuration || config.liveSyncDuration === undefined)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n Object(logger[\"a\" /* enableLogs */])(config.debug);\n this.config = config;\n this._autoLevelCapping = -1;\n // observer setup\n var observer = this.observer = new events_default.a();\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n this.on = observer.on.bind(observer);\n this.off = observer.off.bind(observer);\n this.trigger = observer.trigger.bind(observer);\n\n // core controllers and network loaders\n var abrController = this.abrController = new config.abrController(this);\n var bufferController = new config.bufferController(this);\n var capLevelController = new config.capLevelController(this);\n var fpsController = new config.fpsController(this);\n var playListLoader = new playlist_loader(this);\n var fragmentLoader = new fragment_loader(this);\n var keyLoader = new key_loader(this);\n var id3TrackController = new id3_track_controller(this);\n\n // network controllers\n var levelController = this.levelController = new level_controller(this);\n var streamController = this.streamController = new stream_controller(this);\n var networkControllers = [levelController, streamController];\n\n // optional audio stream controller\n var Controller = config.audioStreamController;\n if (Controller) {\n networkControllers.push(new Controller(this));\n }\n this.networkControllers = networkControllers;\n\n var coreComponents = [playListLoader, fragmentLoader, keyLoader, abrController, bufferController, capLevelController, fpsController, id3TrackController];\n\n // optional audio track and subtitle controller\n Controller = config.audioTrackController;\n if (Controller) {\n var audioTrackController = new Controller(this);\n this.audioTrackController = audioTrackController;\n coreComponents.push(audioTrackController);\n }\n\n Controller = config.subtitleTrackController;\n if (Controller) {\n var subtitleTrackController = new Controller(this);\n this.subtitleTrackController = subtitleTrackController;\n coreComponents.push(subtitleTrackController);\n }\n\n // optional subtitle controller\n [config.subtitleStreamController, config.timelineController].forEach(function (Controller) {\n if (Controller) {\n coreComponents.push(new Controller(_this));\n }\n });\n this.coreComponents = coreComponents;\n }\n\n Hls.prototype.destroy = function destroy() {\n logger[\"b\" /* logger */].log('destroy');\n this.trigger(events[\"a\" /* default */].DESTROYING);\n this.detachMedia();\n this.coreComponents.concat(this.networkControllers).forEach(function (component) {\n component.destroy();\n });\n this.url = null;\n this.observer.removeAllListeners();\n this._autoLevelCapping = -1;\n };\n\n Hls.prototype.attachMedia = function attachMedia(media) {\n logger[\"b\" /* logger */].log('attachMedia');\n this.media = media;\n this.trigger(events[\"a\" /* default */].MEDIA_ATTACHING, { media: media });\n };\n\n Hls.prototype.detachMedia = function detachMedia() {\n logger[\"b\" /* logger */].log('detachMedia');\n this.trigger(events[\"a\" /* default */].MEDIA_DETACHING);\n this.media = null;\n };\n\n Hls.prototype.loadSource = function loadSource(url) {\n url = url_toolkit_default.a.buildAbsoluteURL(window.location.href, url, { alwaysNormalize: true });\n logger[\"b\" /* logger */].log('loadSource:' + url);\n this.url = url;\n // when attaching to a source URL, trigger a playlist load\n this.trigger(events[\"a\" /* default */].MANIFEST_LOADING, { url: url });\n };\n\n Hls.prototype.startLoad = function startLoad() {\n var startPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n\n logger[\"b\" /* logger */].log('startLoad(' + startPosition + ')');\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n };\n\n Hls.prototype.stopLoad = function stopLoad() {\n logger[\"b\" /* logger */].log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n };\n\n Hls.prototype.swapAudioCodec = function swapAudioCodec() {\n logger[\"b\" /* logger */].log('swapAudioCodec');\n this.streamController.swapAudioCodec();\n };\n\n Hls.prototype.recoverMediaError = function recoverMediaError() {\n logger[\"b\" /* logger */].log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n this.attachMedia(media);\n };\n\n /** Return all quality levels **/\n\n\n hls__createClass(Hls, [{\n key: 'levels',\n get: function get() {\n return this.levelController.levels;\n }\n\n /** Return current playback quality level **/\n\n }, {\n key: 'currentLevel',\n get: function get() {\n return this.streamController.currentLevel;\n }\n\n /* set quality level immediately (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set currentLevel:' + newLevel);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n\n /** Return next playback quality level (quality level of next fragment) **/\n\n }, {\n key: 'nextLevel',\n get: function get() {\n return this.streamController.nextLevel;\n }\n\n /* set quality level for next fragment (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set nextLevel:' + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n\n /** Return the quality level of current/last loaded fragment **/\n\n }, {\n key: 'loadLevel',\n get: function get() {\n return this.levelController.level;\n }\n\n /* set quality level for current/next loaded fragment (-1 for automatic level selection) */\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set loadLevel:' + newLevel);\n this.levelController.manualLevel = newLevel;\n }\n\n /** Return the quality level of next loaded fragment **/\n\n }, {\n key: 'nextLoadLevel',\n get: function get() {\n return this.levelController.nextLoadLevel;\n }\n\n /** set quality level of next loaded fragment **/\n ,\n set: function set(level) {\n this.levelController.nextLoadLevel = level;\n }\n\n /** Return first level (index of first level referenced in manifest)\n **/\n\n }, {\n key: 'firstLevel',\n get: function get() {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n }\n\n /** set first level (index of first level referenced in manifest)\n **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set firstLevel:' + newLevel);\n this.levelController.firstLevel = newLevel;\n }\n\n /** Return start level (level of first fragment that will be played back)\n if not overrided by user, first level appearing in manifest will be used as start level\n if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)\n **/\n\n }, {\n key: 'startLevel',\n get: function get() {\n return this.levelController.startLevel;\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 (determined from download of first segment)\n **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set startLevel:' + newLevel);\n var hls = this;\n // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, hls.minAutoLevel);\n }\n hls.levelController.startLevel = newLevel;\n }\n\n /** Return the capping/max level value that could be used by automatic level selection algorithm **/\n\n }, {\n key: 'autoLevelCapping',\n get: function get() {\n return this._autoLevelCapping;\n }\n\n /** set the capping/max level value that could be used by automatic level selection algorithm **/\n ,\n set: function set(newLevel) {\n logger[\"b\" /* logger */].log('set autoLevelCapping:' + newLevel);\n this._autoLevelCapping = newLevel;\n }\n\n /* check if we are in automatic level selection mode */\n\n }, {\n key: 'autoLevelEnabled',\n get: function get() {\n return this.levelController.manualLevel === -1;\n }\n\n /* return manual level */\n\n }, {\n key: 'manualLevel',\n get: function get() {\n return this.levelController.manualLevel;\n }\n\n /* return min level selectable in auto mode according to config.minAutoBitrate */\n\n }, {\n key: 'minAutoLevel',\n get: function get() {\n var hls = this,\n levels = hls.levels,\n minAutoBitrate = hls.config.minAutoBitrate,\n len = levels ? levels.length : 0;\n for (var i = 0; i < len; i++) {\n var levelNextBitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n if (levelNextBitrate > minAutoBitrate) {\n return i;\n }\n }\n return 0;\n }\n\n /* return max level selectable in auto mode according to autoLevelCapping */\n\n }, {\n key: 'maxAutoLevel',\n get: function get() {\n var hls = this;\n var levels = hls.levels;\n var autoLevelCapping = hls.autoLevelCapping;\n var maxAutoLevel = void 0;\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n } else {\n maxAutoLevel = autoLevelCapping;\n }\n return maxAutoLevel;\n }\n\n // return next auto level\n\n }, {\n key: 'nextAutoLevel',\n get: function get() {\n var hls = this;\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(hls.abrController.nextAutoLevel, hls.minAutoLevel), hls.maxAutoLevel);\n }\n\n // this setter is used to force next auto level\n // this is useful to force a switch down in auto mode : 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 succesful frag loading at forced level, this value will be resetted to -1 by ABR controller\n ,\n set: function set(nextLevel) {\n var hls = this;\n hls.abrController.nextAutoLevel = Math.max(hls.minAutoLevel, nextLevel);\n }\n\n /** get alternate audio tracks list from playlist **/\n\n }, {\n key: 'audioTracks',\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n }\n\n /** get 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 /** select 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 key: 'liveSyncPosition',\n get: function get() {\n return this.streamController.liveSyncPosition;\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 /** get 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\n /** select an subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n }\n }, {\n key: 'subtitleDisplay',\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n },\n set: function set(value) {\n var subtitleTrackController = this.subtitleTrackController;\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n }\n }]);\n\n return Hls;\n}();\n\n/* harmony default export */ var src_hls = __webpack_exports__[\"default\"] = (hls_Hls);\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction webpackBootstrapFunc (modules) {\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __webpack_require__.i = function(value) { return value; };\n\n/******/ // define getter function for harmony exports\n/******/ __webpack_require__.d = function(exports, name, getter) {\n/******/ if(!__webpack_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __webpack_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __webpack_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"/\";\n\n/******/ // on error function for async loading\n/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE)\n return f.default || f // try to call default if defined to also support babel esmodule exports\n}\n\n// http://stackoverflow.com/a/2593661/130442\nfunction quoteRegExp (str) {\n return (str + '').replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&')\n}\n\nfunction getModuleDependencies (module) {\n var retval = []\n var fnString = module.toString()\n var wrapperSignature = fnString.match(/^function\\s?\\(\\w+,\\s*\\w+,\\s*(\\w+)\\)/)\n if (!wrapperSignature) return retval\n\n var webpackRequireName = wrapperSignature[1]\n var re = new RegExp('(\\\\\\\\n|\\\\W)' + quoteRegExp(webpackRequireName) + '\\\\((\\/\\\\*.*?\\\\*\\/)?\\s?.*?([\\\\.|\\\\-|\\\\w|\\/|@]+).*?\\\\)', 'g') // additional chars when output.pathinfo is true\n var match\n while ((match = re.exec(fnString))) {\n retval.push(match[3])\n }\n return retval\n}\n\nfunction getRequiredModules (sources, moduleId) {\n var modulesQueue = [moduleId]\n var requiredModules = []\n var seenModules = {}\n\n while (modulesQueue.length) {\n var moduleToCheck = modulesQueue.pop()\n if (seenModules[moduleToCheck] || !sources[moduleToCheck]) continue\n seenModules[moduleToCheck] = true\n requiredModules.push(moduleToCheck)\n var newModules = getModuleDependencies(sources[moduleToCheck])\n modulesQueue = modulesQueue.concat(newModules)\n }\n\n return requiredModules\n}\n\nmodule.exports = function (moduleId, options) {\n options = options || {}\n var sources = __webpack_require__.m\n\n var requiredModules = options.all ? Object.keys(sources) : getRequiredModules(sources, moduleId)\n var src = '(' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[id].toString() }).join(',') + '})(self);'\n\n var blob = new window.Blob([src], { type: 'text/javascript' })\n if (options.bare) { return blob }\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL\n\n var workerUrl = URL.createObjectURL(blob)\n var worker = new window.Worker(workerUrl)\n worker.objectURL = workerUrl\n\n return worker\n}\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__demux_demuxer_inline__ = __webpack_require__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__events__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_logger__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_events__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_events___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_events__);\n/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\n\n\n\n\n\n\nvar DemuxerWorker = function DemuxerWorker(self) {\n // observer setup\n var observer = new __WEBPACK_IMPORTED_MODULE_3_events___default.a();\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function forwardMessage(ev, data) {\n self.postMessage({ event: ev, data: data });\n };\n\n self.addEventListener('message', function (ev) {\n var data = ev.data;\n //console.log('demuxer cmd:' + data.cmd);\n switch (data.cmd) {\n case 'init':\n var config = JSON.parse(data.config);\n self.demuxer = new __WEBPACK_IMPORTED_MODULE_0__demux_demuxer_inline__[\"a\" /* default */](observer, data.typeSupported, config, data.vendor);\n try {\n Object(__WEBPACK_IMPORTED_MODULE_2__utils_logger__[\"a\" /* enableLogs */])(config.debug === true);\n } catch (err) {\n console.warn('demuxerWorker: unable to enable logs');\n }\n // signal end of worker init\n forwardMessage('init', null);\n break;\n case 'demux':\n self.demuxer.push(data.data, data.decryptdata, data.initSegment, data.audioCodec, data.videoCodec, data.timeOffset, data.discontinuity, data.trackSwitch, data.contiguous, data.duration, data.accurateTimeOffset, data.defaultInitPTS);\n break;\n default:\n break;\n }\n });\n\n // forward events to main thread\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_DECRYPTED, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSED, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].ERROR, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].INIT_PTS_FOUND, forwardMessage);\n\n // special case for FRAG_PARSING_DATA: pass data1/data2 as transferable object (no copy)\n observer.on(__WEBPACK_IMPORTED_MODULE_1__events__[\"a\" /* default */].FRAG_PARSING_DATA, function (ev, data) {\n var transferable = [];\n var message = { event: ev, data: data };\n if (data.data1) {\n message.data1 = data.data1.buffer;\n transferable.push(data.data1.buffer);\n delete data.data1;\n }\n if (data.data2) {\n message.data2 = data.data2.buffer;\n transferable.push(data.data2.buffer);\n delete data.data2;\n }\n self.postMessage(message, transferable);\n });\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (DemuxerWorker);\n\n/***/ })\n/******/ ])[\"default\"];\n});\n//# sourceMappingURL=hls.js.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/hls.js/dist/hls.js\n// module id = 0\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"video.js\",\"commonjs2\":\"video.js\",\"amd\":\"video.js\",\"root\":\"videojs\"}\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar Hls = require('hls.js');\n\nif (!window.Hls) {\n window.Hls = Hls; // expose hls.js constructor\n}\n\n/**\n * hls.js source handler\n * @param source\n * @param tech\n * @constructor\n */\nfunction Html5HlsJS(source, tech) {\n var options = tech.options_;\n var el = tech.el();\n var duration = null;\n var hls = this.hls = new Hls(options.hlsjsConfig);\n\n /**\n * creates an error handler function\n * @returns {Function}\n */\n function errorHandlerFactory() {\n var _recoverDecodingErrorDate = null;\n var _recoverAudioCodecErrorDate = null;\n\n return function() {\n var now = Date.now();\n\n if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) {\n _recoverDecodingErrorDate = now;\n hls.recoverMediaError();\n }\n else if (!_recoverAudioCodecErrorDate || (now - _recoverAudioCodecErrorDate) > 2000) {\n _recoverAudioCodecErrorDate = now;\n hls.swapAudioCodec();\n hls.recoverMediaError();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n };\n }\n\n // create separate error handlers for hlsjs and the video tag\n var hlsjsErrorHandler = errorHandlerFactory();\n var videoTagErrorHandler = errorHandlerFactory();\n\n // listen to error events coming from the video tag\n el.addEventListener('error', function(e) {\n var mediaError = e.currentTarget.error;\n\n if (mediaError.code === mediaError.MEDIA_ERR_DECODE) {\n videoTagErrorHandler();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n });\n\n /**\n * Destroys the Hls instance\n */\n this.dispose = function() {\n hls.destroy();\n };\n\n /**\n * returns the duration of the stream, or Infinity if live video\n * @returns {Infinity|number}\n */\n this.duration = function() {\n return duration || el.duration || 0;\n };\n\n // update live status on level load\n hls.on(Hls.Events.LEVEL_LOADED, function(event, data) {\n duration = data.details.live ? Infinity : data.details.totalduration;\n });\n\n // try to recover on fatal errors\n hls.on(Hls.Events.ERROR, function(event, data) {\n if (data.fatal) {\n switch (data.type) {\n case Hls.ErrorTypes.NETWORK_ERROR:\n hls.startLoad();\n break;\n case Hls.ErrorTypes.MEDIA_ERROR:\n hlsjsErrorHandler();\n break;\n default:\n console.error('Error loading media: File could not be played');\n break;\n }\n }\n });\n\n Object.keys(Hls.Events).forEach(function(key) {\n var eventName = Hls.Events[key];\n hls.on(eventName, function(event, data) {\n tech.trigger(eventName, data);\n });\n });\n\n // Intercept native TextTrack calls and route to video.js directly only\n // if native text tracks are not supported on this browser.\n if (!tech.featuresNativeTextTracks) {\n Object.defineProperty(el, 'textTracks', {\n value: tech.textTracks,\n writable: false\n });\n el.addTextTrack = function() {\n return tech.addTextTrack.apply(tech, arguments);\n };\n }\n\n // attach hlsjs to videotag\n hls.attachMedia(el);\n hls.loadSource(source.src);\n}\n\nvar hlsTypeRE = /^application\\/(x-mpegURL|vnd\\.apple\\.mpegURL)$/i;\nvar hlsExtRE = /\\.m3u8/i;\n\nvar HlsSourceHandler = {\n canHandleSource: function(source) {\n if (source.skipContribHlsJs) {\n return '';\n }\n else if (hlsTypeRE.test(source.type)) {\n return 'probably';\n }\n else if (hlsExtRE.test(source.src)) {\n return 'maybe';\n }\n else {\n return '';\n }\n },\n handleSource: function(source, tech) {\n return new Html5HlsJS(source, tech);\n },\n canPlayType: function(type) {\n if (hlsTypeRE.test(type)) {\n return 'probably';\n }\n\n return '';\n }\n};\n\nif (Hls.isSupported()) {\n var videojs = require('video.js'); // resolved UMD-wise through webpack\n\n // support es6 style import\n videojs = videojs && videojs.default || videojs;\n\n if (videojs) {\n var html5Tech = videojs.getTech && videojs.getTech('Html5'); // videojs6 (partially on videojs5 too)\n html5Tech = html5Tech || (videojs.getComponent && videojs.getComponent('Html5')); // videojs5\n\n if (html5Tech) {\n html5Tech.registerSourceHandler(HlsSourceHandler, 0);\n }\n }\n else {\n console.warn('videojs-contrib-hls.js: Couldn\\'t find find window.videojs nor require(\\'video.js\\')');\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/videojs.hlsjs.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///videojs-contrib-hlsjs.min.js","webpack:///webpack/bootstrap 76a8b753eae8493d1b23","webpack:///./~/hls.js/dist/hls.js","webpack:///external {\"commonjs\":\"video.js\",\"commonjs2\":\"video.js\",\"amd\":\"video.js\",\"root\":\"videojs\"}","webpack:///./src/videojs.hlsjs.js"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","window","r","Symbol","toStringTag","t","mode","ns","create","key","bind","./node_modules/eventemitter3/index.js","Events","EE","fn","context","once","addListener","emitter","event","TypeError","listener","evt","prefix","_events","push","_eventsCount","clearEvent","EventEmitter","has","__proto__","eventNames","events","names","slice","getOwnPropertySymbols","concat","listeners","handlers","length","ee","Array","listenerCount","emit","a1","a2","a3","a4","a5","args","len","arguments","removeListener","undefined","apply","j","on","removeAllListeners","off","prefixed","./node_modules/url-toolkit/src/url-toolkit.js","URL_REGEX","FIRST_SEGMENT_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","./node_modules/webworkify-webpack/index.js","webpackBootstrapFunc","oe","err","console","error","f","ENTRY_MODULE","default","quoteRegExp","str","isNumeric","isNaN","getModuleDependencies","sources","queueName","retval","fnString","toString","wrapperSignature","match","webpackRequireName","re","RegExp","dependencyRegExp","moduleNameReqExp","keys","hasValuesInQueues","queues","reduce","hasValues","getRequiredModules","modulesQueue","main","requiredModules","seenModules","queue","moduleToCheck","pop","newModules","newModulesKeys","options","all","src","filter","forEach","entryModule","JSON","stringify","map","id","blob","Blob","type","bare","URL","webkitURL","mozURL","msURL","workerUrl","createObjectURL","worker","Worker","objectURL","./src/crypt/decrypter.js","__webpack_exports__","removePadding","buffer","outputBytes","byteLength","paddingBytes","DataView","getUint8","AESCrypto","subtle","iv","aesIV","decrypt","data","FastAESKey","expandKey","importKey","fast_aes_key","AESDecryptor","rcon","subMix","Uint32Array","invSubMix","sBox","invSBox","initTable","_proto","uint8ArrayToUint32Array_","arrayBuffer","view","newArray","getUint32","subMix0","subMix1","subMix2","subMix3","invSubMix0","invSubMix1","invSubMix2","invSubMix3","x","xi","sx","x2","x4","x8","keyBuffer","sameKey","offset","keySize","ksRow","invKsRow","prev","ksRows","keySchedule","invKeySchedule","sbox","networkToHostOrderSwap","word","inputArrayBuffer","removePKCS7Padding","t0","t1","t2","t3","s0","s1","s2","s3","inputWords0","inputWords1","inputWords2","inputWords3","nRounds","invSBOX","initVector","initVector0","initVector1","initVector2","initVector3","inputInt32","Int32Array","outputInt32","swapWord","destroy","aes_decryptor","errors","logger","get_self_scope","global","decrypter_Decrypter","Decrypter","observer","config","_temp","_ref","_ref$removePKCS7Paddi","logEnabled","browserCrypto","crypto","webkitSubtle","e","disableWebCrypto","isSync","enableSoftwareAES","callback","_this","log","decryptor","fastAesKey","then","aesKey","catch","onWebCryptoError","result","message","trigger","ERROR","MEDIA_ERROR","details","FRAG_DECRYPT_ERROR","fatal","reason","./src/demux/demuxer-inline.js","getAudioConfig","audioCodec","adtsObjectType","adtsSampleingIndex","adtsExtensionSampleingIndex","adtsChanelConfig","userAgent","navigator","toLowerCase","manifestCodec","adtsSampleingRates","FRAG_PARSING_ERROR","test","indexOf","samplerate","channelCount","codec","isHeaderPattern","getHeaderLength","getFullFrameLength","isHeader","adts_probe","headerLength","frameLength","newOffset","initTrackConfig","track","getFrameDuration","parseFrameHeader","pts","frameIndex","frameDuration","stamp","appendFrame","header","aacSample","unit","subarray","dts","samples","sample","toTimescaleFromBase","destScale","srcBase","round","Math","toMsFromMpegTsClock","MPEG_TS_CLOCK_FREQ_HZ","toMpegTsClockFromTimescale","srcScale","PTSNormalize","reference","abs","now","crypt_decrypter","number","id3","aacdemuxer_AACDemuxer","AACDemuxer","remuxer","resetInitSegment","initSegment","videoCodec","duration","_audioTrack","container","sequenceNumber","isAAC","inputTimeScale","resetTimeStamp","probe","id3Data","getID3Data","append","timeOffset","contiguous","accurateTimeOffset","timestamp","getTimeStamp","id3Samples","frame","remux","aacdemuxer","mp4demuxer","MpegAudio","BitratesMap","SamplingRateMap","SamplesCoefficients","BytesInSlot","parseHeader","samplesPerFrame","sampleRate","headerB","headerC","headerE","headerF","headerG","columnInBitrates","bitRate","columnInSampleRates","sampleCoefficient","bytesInSlot","parseInt","mpegaudio","exp_golomb_ExpGolomb","ExpGolomb","bytesAvailable","bitsAvailable","loadWord","position","workingBytes","Uint8Array","availableBytes","min","set","skipBits","count","skipBytes","readBits","size","bits","valu","skipLZ","leadingZeroCount","skipUEG","skipEG","readUEG","clz","readEG","readBoolean","readUByte","readUShort","readUInt","skipScalingList","deltaScale","lastScale","nextScale","readSPS","profileIdc","numRefFramesInPicOrderCntCycle","picWidthInMbsMinus1","picHeightInMapUnitsMinus1","frameMbsOnlyFlag","scalingListCount","frameCropLeftOffset","frameCropRightOffset","frameCropTopOffset","frameCropBottomOffset","chromaFormatIdc","picOrderCntType","pixelRatio","width","ceil","height","readSliceType","exp_golomb","sample_aes_SampleAesDecrypter","SampleAesDecrypter","decryptdata","discardEPB","decrypter","decryptBuffer","encryptedData","decryptAacSample","sampleIndex","sync","curUnit","encryptedBuffer","byteOffset","localthis","decryptedData","decryptAacSamples","getAvcEncryptedData","decodedData","encryptedDataLen","floor","Int8Array","outputPos","inputPos","getAvcDecryptedUnit","decryptAvcSample","unitIndex","decryptAvcSamples","curUnits","units","sample_aes","RemuxerTrackIdConfig","video","audio","text","tsdemuxer_TSDemuxer","TSDemuxer","typeSupported","sampleAes","pmtUnknownTypes","setDecryptData","method","syncOffset","_syncOffset","warn","scanwindow","createTrack","pid","dropped","pmtParsed","_pmtId","_avcTrack","_id3Track","_txtTrack","aacOverFlow","aacLastPTS","avcSample","_duration","start","stt","pes","unknownPIDs","avcTrack","audioTrack","id3Track","avcId","audioId","id3Id","pmtId","avcData","pesData","audioData","parsePAT","_parsePAT","parsePMT","_parsePMT","parsePES","_parsePES","parseAVCPES","_parseAVCPES","parseAACPES","_parseAACPES","parseMPEGPES","_parseMPEGPES","parseID3PES","_parseID3PES","parsedPIDs","mpeg","mp3","avc","decryptAndRemux","videoTrack","textTrack","decryptAndRemuxAvc","_initPTS","_initDTS","_trackUnknownPmt","logLevel","mpegSupported","isSampleAes","sectionLength","tableEnd","programInfoLength","stream","frag","pesFlags","pesLen","pesHdrLen","pesPts","pesDts","payloadStartOffset","newData","splice","dataLen","pushAccesUnit","nbSamples","lastSample","forceKeyFrameOnDiscontinuity","sps","debug","last","expGolombDecoder","_parseAVCNALu","spsfound","createAVCSample","audFound","sliceType","payloadType","payloadSize","endOfCaptions","b","firstByte","secondByte","totalCCs","byteArray","_insertSampleInOrder","bytes","uuidStrArray","userDataPayloadBytes","uuid","userDataBytes","userData","codecarray","codecstring","h","pps","arr","pos","_getLastNalUnit","lastUnit","array","overflow","unitType","lastUnitType","state","naluState","lastState","lastUnitStart","tmp","_lastUnit","_tmp","newLength","EPBPositions","sourceIndex","shift","newPTS","tsdemuxer","mp3demuxer_MP3Demuxer","MP3Demuxer","mp3demuxer","AAC","getSilentFrame","aac_helper","UINT32_MAX","pow","MP4","init","types","avc1","avcC","btrt","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a",".mp3","mvex","mvhd","pasp","sdtp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trun","trex","tkhd","vmhd","smhd","charCodeAt","videoHdlr","audioHdlr","HDLR_TYPES","STTS","STSC","STCO","STSZ","VMHD","SMHD","STSD","majorBrand","avc1Brand","minorVersion","FTYP","box","DINF","payload","timescale","upperWordDuration","lowerWordDuration","sn","baseMediaDecodeTime","tracks","boxes","flags","dependsOn","isDependedOn","hasRedundancy","avcc","hSpacing","vSpacing","configlen","sampleDependencyTable","upperWordBaseMediaDecodeTime","lowerWordBaseMediaDecodeTime","cts","arraylen","isLeading","paddingValue","isNonSync","degradPrio","movie","mp4_generator","MAX_SILENT_FRAME_DURATION_90KHZ","PTS_DTS_SHIFT_TOLERANCE_90KHZ","chromeVersion","mp4_remuxer_MP4Remuxer","MP4Remuxer","vendor","ISGenerated","defaultTimeStamp","getVideoStartPts","videoSamples","rolloverDetected","startPTS","minPTS","delta","generateIS","nbAudioSamples","nbVideoSamples","audioTimeOffset","videoTimeOffset","tsDelta","audiovideoTimestampDelta","max","remuxAudio","audioTrackLength","endPTS","remuxVideo","videoData","remuxEmptyAudio","remuxID3","remuxText","FRAG_PARSED","initPTS","initDTS","audioSamples","computePTSDTS","Infinity","metadata","startOffset","INIT_PTS_FOUND","FRAG_PARSING_INIT_SEGMENT","mp4SampleDuration","firstDTS","lastDTS","timeScale","inputSamples","outputSamples","Number","POSITIVE_INFINITY","maxPTS","NEGATIVE_INFINITY","ptsDtsShift","sortSamples","nextAvcDts","sort","deltadts","deltapts","averageSampleDuration","lastDts","_i","_i2","foundHole","foundOverlap","firstPTS","nbNalu","naluLen","_i3","_sample","nbUnits","sampleLen","mdatSize","MUX_ERROR","REMUX_ALLOC_ERROR","setUint32","_i4","avcSampleUnits","mp4SampleLength","compositionTimeOffset","_j","_nbUnits","unitData","unitDataLen","lastFrameDuration","stretchShortVideoTrack","maxBufferHole","gapTolerance","deltaToFrameEnd","nextAudioPts","data1","data2","startDTS","endDTS","hasAudio","hasVideo","nb","FRAG_PARSING_DATA","mp4Sample","fillFrame","lastPTS","mp4timeScale","scaleFactor","inputSampleDuration","rawMPEG","maxAudioFramesDrift","nextPts","missing","newStamp","_j2","_nbSamples","audioSample","_pts","_delta","numMissingFrames","_i5","unitLen","lastSampleDuration","end","silentFrame","trace","index","FRAG_PARSING_METADATA","FRAG_PARSING_USERDATA","mp4_remuxer","passthrough_remuxer_PassThroughRemuxer","PassThroughRemuxer","rawData","streamType","passthrough_remuxer","performance","Date","demuxer_inline_DemuxerInline","DemuxerInline","demuxer","discontinuity","trackSwitch","defaultInitPTS","startTime","endTime","FRAG_DECRYPTED","stats","tstart","tdecrypt","pushDecrypted","mux","muxConfig","demux","./src/demux/demuxer-worker.js","_demux_demuxer_inline__WEBPACK_IMPORTED_MODULE_0__","_events__WEBPACK_IMPORTED_MODULE_1__","_utils_logger__WEBPACK_IMPORTED_MODULE_2__","eventemitter3__WEBPACK_IMPORTED_MODULE_3__","DemuxerWorker","self","_len","_key","_len2","_key2","forwardMessage","ev","postMessage","addEventListener","cmd","parse","transferable","./src/demux/id3.js","getTextDecoder","_utils_get_self_scope__WEBPACK_IMPORTED_MODULE_0__","decoder","TextDecoder","utf8ArrayToStr","ID3","isFooter","front","_readSize","frames","getID3Frames","isTimeStampFrame","_readTimeStamp","info","_getFrameData","String","fromCharCode","frameData","_decodeFrame","_decodePrivFrame","_decodeTextFrame","_decodeURLFrame","timeStampFrame","pts33Bit","owner","_utf8ArrayToStr","privateData","description","exitOnNull","decoded","decode","idx","char2","char3","out","./src/demux/mp4demuxer.js","_utils_logger__WEBPACK_IMPORTED_MODULE_0__","MP4Demuxer","initData","parseInitSegment","audiovideo","findBox","bin2str","readUint16","val","readUint32","writeUint32","subresults","endbox","results","parseSegmentIndex","references","moovEndOffset","sidx","version","startByte","referencesCount","referenceIndex","referenceInfo","referenceSize","subsegmentDuration","earliestPresentationTime","trackId","hdlrType","soun","vide","codecBox","codecType","getStartDTS","trafs","baseTimes","scale","isFinite","offsetStartDTS","upper","lower","_startDTS","./src/errors.ts","ErrorTypes","ErrorDetails","./src/events.js","HlsEvents","MEDIA_ATTACHING","MEDIA_ATTACHED","MEDIA_DETACHING","MEDIA_DETACHED","BUFFER_RESET","BUFFER_CODECS","BUFFER_CREATED","BUFFER_APPENDING","BUFFER_APPENDED","BUFFER_EOS","BUFFER_FLUSHING","BUFFER_FLUSHED","MANIFEST_LOADING","MANIFEST_LOADED","MANIFEST_PARSED","LEVEL_SWITCHING","LEVEL_SWITCHED","LEVEL_LOADING","LEVEL_LOADED","LEVEL_UPDATED","LEVEL_PTS_UPDATED","LEVELS_UPDATED","AUDIO_TRACKS_UPDATED","AUDIO_TRACK_SWITCHING","AUDIO_TRACK_SWITCHED","AUDIO_TRACK_LOADING","AUDIO_TRACK_LOADED","SUBTITLE_TRACKS_UPDATED","SUBTITLE_TRACK_SWITCH","SUBTITLE_TRACK_LOADING","SUBTITLE_TRACK_LOADED","SUBTITLE_FRAG_PROCESSED","CUES_PARSED","NON_NATIVE_TEXT_TRACKS_FOUND","FRAG_LOADING","FRAG_LOAD_PROGRESS","FRAG_LOAD_EMERGENCY_ABORTED","FRAG_LOADED","FRAG_BUFFERED","FRAG_CHANGED","FPS_DROP","FPS_DROP_LEVEL_CAPPING","DESTROYING","KEY_LOADING","KEY_LOADED","STREAM_STATE_TRANSITION","LIVE_BACK_BUFFER_REACHED","./src/hls.ts","_defineProperties","target","props","descriptor","writable","_createClass","Constructor","protoProps","staticProps","fragment_defineProperties","fragment_createClass","level_defineProperties","level_createClass","isCodecType","typeCodes","sampleEntryCodesISO","isCodecSupportedInMp4","MediaSource","isTypeSupported","backfillProgramDateTimes","fragments","startIndex","fragPrev","programDateTime","assignProgramDateTime","prevFrag","rawProgramDateTime","endProgramDateTime","_inheritsLoose","subClass","superClass","constructor","fragment_loader_inheritsLoose","key_loader_inheritsLoose","fragment_tracker_inheritsLoose","getMediaSource","WebKitMediaSource","observer_inheritsLoose","addGroupId","level","audioGroupIds","textGroupIds","updatePTS","fromIdx","toIdx","fragFrom","fragTo","fragToPTS","cc","minEndPTS","updateFragPTSDTS","maxStartPTS","deltaPTS","drift","startSN","endSN","fragIdx","PTSKnown","mergeDetails","oldDetails","newDetails","PTSFrag","ccOffset","mapFragmentIntersection","oldFrag","newFrag","backtracked","newFragments","adjustSliding","mergeSubtitlePlaylists","oldPlaylist","newPlaylist","referenceStart","lastIndex","frags","intersectionFn","oldFragments","computeReloadInterval","currentPlaylist","lastRequestTime","reloadInterval","averagetargetduration","targetduration","minReloadInterval","findFirstFragWithCC","firstFrag","currentFrag","findFragWithCC","CC","binary_search","search","candidate","shouldAlignOnDiscontinuities","lastFrag","lastLevel","shouldAlign","endCC","startCC","findDiscontinuousReferenceFrag","prevDetails","curDetails","prevFrags","curFrags","prevStartFrag","adjustPts","sliding","alignStream","alignDiscontinuities","alignPDT","referenceFrag","lastDetails","hasProgramDateTime","lastPDT","newPDT","toFixed","findFragmentByPDT","PDTValue","maxFragLookUpTolerance","isArray","seg","pdtWithinToleranceTest","findFragmentByPTS","fragPrevious","bufferEnd","fragNext","fragmentWithinToleranceTest","foundFragment","candidateLookupTolerance","pdtBufferEnd","_assertThisInitialized","ReferenceError","task_loop_inheritsLoose","base_stream_controller_inheritsLoose","stream_controller_defineProperties","stream_controller_createClass","stream_controller_inheritsLoose","level_controller_defineProperties","level_controller_createClass","level_controller_inheritsLoose","sendAddTrackEvent","videoEl","Event","document","createEvent","initEvent","dispatchEvent","clearCurrentCues","cues","removeCue","getClosestCue","time","left","right","mid","id3_track_controller_inheritsLoose","is_supported_isSupported","mediaSource","sourceBuffer","SourceBuffer","WebKitSourceBuffer","sourceBufferValidAPI","appendBuffer","remove","abr_controller_defineProperties","abr_controller_createClass","abr_controller_assertThisInitialized","abr_controller_inheritsLoose","buffer_controller_inheritsLoose","cap_level_controller_defineProperties","cap_level_controller_createClass","cap_level_controller_inheritsLoose","fps_controller_inheritsLoose","audio_track_controller_defineProperties","audio_track_controller_createClass","audio_track_controller_inheritsLoose","audio_stream_controller_defineProperties","audio_stream_controller_createClass","audio_stream_controller_inheritsLoose","VTTParser","StringDecoder","regionList","parseTimeStamp","input","computeSeconds","Settings","values","parseOptions","keyValueDelim","groupDelim","groups","kv","k","v","parseCue","cue","consumeTimeStamp","ts","oInput","skipWhitespace","substr","settings","region","alt","vals","vals0","integer","percent","center","vertical","line","defaults","lineAlign","snapToLines","align","fixLineBreaks","newCue","captionScreen","row","indenting","indent","VTTCue","TextTrackCue","rows","isEmpty","chars","uchar","cueStartTime","addCue","setLastCmd","cmdHistory","hasCmdRepeated","createCmdHistory","timeline_controller_assertThisInitialized","timeline_controller_inheritsLoose","canReuseVttTextTrack","inUseTrack","manifestTrack","label","textTrack1","textTrack2","intersection","x1","y1","y2","newVTTCCs","presentationOffset","0","prevCC","new","subtitle_track_controller_defineProperties","subtitle_track_controller_createClass","subtitle_track_controller_inheritsLoose","filterSubtitleTracks","textTrackList","kind","subtitle_stream_controller_assertThisInitialized","subtitle_stream_controller_inheritsLoose","eme_controller_defineProperties","eme_controller_createClass","eme_controller_inheritsLoose","ownKeys","enumerableOnly","symbols","sym","getOwnPropertyDescriptor","_objectSpread","source","_defineProperty","getOwnPropertyDescriptors","defineProperties","obj","hls_ownKeys","hls_objectSpread","hls_defineProperty","hls_assertThisInitialized","hls_defineProperties","hls_createClass","hls_inheritsLoose","hls_Hls","cues_namespaceObject","PlaylistContextType","url_toolkit","FORBIDDEN_EVENT_NAMES","hlsEventGeneric","hlsHandlerDestroying","hlsHandlerDestroyed","event_handler_EventHandler","EventHandler","hls","handledEvents","useGenericHandler","onEvent","registerListeners","onHandlerDestroying","unregisterListeners","onHandlerDestroyed","isEventHandler","onEventGeneric","eventToFunction","funcName","OTHER_ERROR","INTERNAL_EXCEPTION","event_handler","PlaylistLevelType","ElementaryStreamTypes","level_key_LevelKey","LevelKey","baseURI","relativeURI","_uri","baseuri","reluri","chromeOrFirefox","fragment_Fragment","Fragment","_this$_elementaryStre","_url","_byteRange","_decryptdata","_elementaryStreams","AUDIO","VIDEO","title","tagList","relurl","baseurl","urlId","levelkey","loader","setByteRange","previousFrag","byteRange","byteRangeEndOffset","addElementaryStream","hasElementaryStream","createInitializationVector","segmentNumber","uint8View","setDecryptDataFromLevelKey","uri","level_Level","Level","baseUrl","live","needSidxRanges","startTimeOffset","totalduration","DECIMAL_RESOLUTION_REGEX","ATTR_LIST_REGEX","AttrList","attrs","parseAttrList","attr","decimalInteger","attrName","intValue","MAX_SAFE_INTEGER","hexadecimalInteger","stringValue","hexadecimalIntegerAsNumber","decimalFloatingPoint","parseFloat","enumeratedString","decimalResolution","res","attr_list","a3ds","ac-3","ac-4","alac","alaw","dra1","dts+","dts-","dtsc","dtse","dtsh","ec-3","enca","g719","g726","m4ae","mha1","mha2","mhm1","mhm2","mlpa","raw ","Opus","samr","sawb","sawp","sevc","sqcp","ssmv","twos","ulaw","avc2","avc3","avc4","avcp","drac","dvav","dvhe","encv","hev1","hvc1","mjp2","mp4v","mvc1","mvc2","mvc3","mvc4","resv","rv60","s263","svc1","svc2","vc-1","vp08","vp09","MASTER_PLAYLIST_REGEX","MASTER_PLAYLIST_MEDIA_REGEX","LEVEL_PLAYLIST_REGEX_FAST","MP4_REGEX_SUFFIX","m3u8_parser_M3U8Parser","M3U8Parser","findGroup","mediaGroupId","group","convertAVC1ToAVCOTI","avcdata","resolve","parseMasterPlaylist","string","levels","sessionData","hasSessionData","resolution","bitrate","NAME","codecs","filtered","preferred","unknownCodecs","CODECS","sessionAttrs","parseMasterPlaylistMedia","audioGroups","medias","TYPE","media","groupId","instreamId","LANGUAGE","DEFAULT","autoselect","AUTOSELECT","forced","FORCED","lang","URI","groupCodec","parseLevelPlaylist","levelUrlId","currentSN","discontinuityCounter","firstPdtIndex","value1","value2","toUpperCase","decryptparams","keyAttrs","decryptmethod","decrypturi","decryptiv","decryptkeyformat","KEYFORMAT","startAttrs","mapAttrs","BYTERANGE","every","_window","playlist_loader_PlaylistLoader","_EventHandler","PlaylistLoader","loaders","canHaveQualityLevels","AUDIO_TRACK","SUBTITLE_TRACK","mapContextToLevelType","SUBTITLE","MAIN","getResponseUrl","response","createInternalLoader","PLoader","pLoader","Loader","InternalLoader","getInternalLoader","resetInternalLoader","contextType","destroyInternalLoaders","onManifestLoading","load","MANIFEST","responseType","onLevelLoading","LEVEL","onAudioTrackLoading","onSubtitleTrackLoading","loaderContext","abort","maxRetry","timeout","retryDelay","maxRetryDelay","manifestLoadingMaxRetry","manifestLoadingTimeOut","manifestLoadingRetryDelay","manifestLoadingMaxRetryTimeout","levelLoadingTimeOut","levelLoadingMaxRetry","levelLoadingRetryDelay","levelLoadingMaxRetryTimeout","loaderConfig","loaderCallbacks","onSuccess","loadsuccess","onError","loaderror","onTimeout","loadtimeout","networkDetails","isSidxRequest","_handleSidxRequest","_handlePlaylistLoaded","tload","_handleManifestParsingError","_handleTrackOrLevelPlaylist","_handleMasterPlaylist","_handleNetworkError","_M3U8Parser$parseMast","audioTracks","subtitles","captions","embeddedAudioFound","unshift","levelId","levelType","levelDetails","NETWORK_ERROR","LEVEL_EMPTY_ERROR","singleLevel","tparsed","sidxUrl","rangeStart","rangeEnd","sidxInfo","sidxReferences","segmentRef","segRefInfo","MANIFEST_PARSING_ERROR","MANIFEST_LOAD_TIMEOUT","MANIFEST_LOAD_ERROR","LEVEL_LOAD_TIMEOUT","LEVEL_LOAD_ERROR","AUDIO_TRACK_LOAD_TIMEOUT","AUDIO_TRACK_LOAD_ERROR","errorData","playlist_loader","fragment_loader_FragmentLoader","FragmentLoader","loaderName","onFragLoading","FragmentILoader","fLoader","DefaultILoader","loaded","progressData","byteRangeStartOffset","fragLoadingTimeOut","fragLoadingMaxRetryTimeout","onProgress","loadprogress","FRAG_LOAD_ERROR","FRAG_LOAD_TIMEOUT","fragment_loader","key_loader_KeyLoader","KeyLoader","decryptkey","decrypturl","onKeyLoading","fragLoadingRetryDelay","KEY_LOAD_ERROR","KEY_LOAD_TIMEOUT","key_loader","FragmentState","NOT_LOADED","APPENDING","PARTIAL","OK","fragment_tracker_FragmentTracker","FragmentTracker","bufferPadding","timeRanges","getBufferedFrag","bufferedFrags","fragmentEntity","body","buffered","bufferedFragKey","detectEvictedFragments","elementaryStream","timeRange","_this2","esData","range","fragmentTimes","isTimeBuffered","removeFragment","detectPartialFragments","_this3","fragKey","getFragmentKey","getBufferedTimes","fragmentPartial","partial","getPartialFragment","timePadding","_this4","bestFragment","bestOverlap","isPartial","getState","onFragLoaded","bitrateTest","onBufferAppended","_this5","onFragBuffered","hasFragment","removeAllFragments","BinarySearch","list","comparisonFn","minIndex","maxIndex","currentIndex","currentElement","comparisonResult","BufferHelper","isBuffered","bufferInfo","maxHoleDuration","vbuffered","bufferedInfo","nextStart","diff","buffered2","buf2len","buf2end","bufferStartNext","bufferLen","bufferStart","eventemitter3","webworkify_webpack","demuxer_inline","Observer","_EventEmitter","demuxer_MediaSource","demuxer_Demuxer","Demuxer","mp4","enableWorker","w","onwmsg","onWorkerMessage","onerror","filename","lineno","revokeObjectURL","removeEventListener","terminate","nextSN","ArrayBuffer","demux_demuxer","TimeRanges","time_ranges","gap_controller_GapController","GapController","fragmentTracker","nudgeRetry","stallReported","stalled","moved","seeking","poll","lastCurrentTime","currentTime","seeked","beginSeek","paused","ended","playbackRate","hasEnoughBuffer","noBufferGap","startJump","_trySkipBufferHole","tnow","stalledDuration","_reportStall","bufferedWithHoles","_tryFixBufferStall","_stalledDuration","stalledDurationMs","highBufferWatchdogPeriod","_tryNudgeBuffer","BUFFER_STALLED_ERROR","lastEndTime","targetTime","BUFFER_SEEK_OVER_HOLE","nudgeMaxRetry","nudgeOffset","BUFFER_NUDGE_ON_STALL","TaskLoop","_boundTick","_tickTimer","_tickInterval","_tickCallCount","tick","clearNextTick","clearInterval","hasInterval","hasNextTick","setInterval","millis","clearTimeout","doTick","setTimeout","State","STOPPED","STARTING","IDLE","PAUSED","FRAG_LOADING_WAITING_RETRY","WAITING_TRACK","PARSING","PARSED","ENDED","WAITING_INIT_PTS","WAITING_LEVEL","base_stream_controller_BaseStreamController","_TaskLoop","BaseStreamController","startLoad","stopLoad","fragCurrent","_streamEnded","fragState","onMediaSeeking","mediaBuffer","tolerance","fragStartOffset","fragEndOffset","loadedmetadata","nextLoadPosition","startPosition","onMediaEnded","computeLivePosition","targetLatency","liveSyncDuration","liveSyncDurationCount","stream_controller_StreamController","_BaseStreamController","StreamController","audioCodecSwap","_state","gapController","altAudio","audioOnly","fragLoadError","startFragRequested","startLevel","testBandwidth","nextAutoLevel","nextLoadLevel","forceStartLoad","_doTickIdle","retryDate","_checkBuffer","_checkFragmentChanged","levelLastLoaded","startFragPrefetch","levelInfo","maxBufLen","levelBitrate","maxBufferSize","maxBufferLength","maxMaxBufferLength","_fetchPayloadOrEos","fragLen","initialLiveManifestSize","_ensureFragmentAtLivePoint","_findFragment","encrypted","_loadKey","_loadFragment","maxLatency","liveMaxLatencyDuration","liveMaxLatencyDurationCount","liveSyncPosition","readyState","targetSN","fragPreviousLoad","fragmentIndexRange","fragNextLoad","curSNIdx","sameLevel","prevSnFrag","nextSnFrag","autoLevel","autoLevelEnabled","_reduceMaxBufferLength","followingBufferedFrag","fragPlayingCurrent","fragPlaying","fragPlayingLevel","immediateLevelSwitch","immediateSwitch","previouslyPaused","pause","flushMainBuffer","immediateLevelSwitchEnd","play","nextLevelSwitch","fetchdelay","nextLevelId","nextLevel","fragLastKbps","bufferedFrag","nextBufferedFrag","startPts","endOffset","flushScope","onMediaAttached","onvseeking","onvseeked","onMediaSeeked","onvended","autoStartLoad","onMediaDetaching","onManifestParsed","aac","heaac","audioCodecSwitch","onLevelLoaded","newLevelId","curLevel","onKeyLoaded","fragLoaded","currentLevel","tbuffered","pendingBuffering","appended","initSegmentData","_getAudioCodec","onFragParsingInitSegment","fragNew","trackName","ua","levelCodec","parent","content","onFragParsingData","onFragParsed","_checkAppendedParsed","onAudioTrackSwitching","fromAltAudio","onAudioTrackSwitched","videoBuffer","onBufferCreated","mediaTrack","alternate","pending","total","tfirst","mediaBuffered","fragLoadingMaxRetry","delay","levelRetry","BUFFER_FULL_ERROR","minLength","_seekToStartPos","onFragLoadEmergencyAborted","onBufferFlushed","elementaryStreamType","onLevelsUpdated","swapAudioCodec","defaultAudioCodec","nextState","previousState","_liveSyncPosition","stream_controller","level_controller_LevelController","LevelController","canload","currentLevelIndex","manualLevelIndex","timer","clearTimer","_levels","levelRetryCount","loadError","loadLevel","onManifestLoaded","bitrateStart","levelSet","levelFromSet","videoCodecFound","audioCodecFound","attributes","fragmentError","SUBTITLES","_ref2","_firstLevel","firstLevel","some","MANIFEST_INCOMPATIBLE_CODECS_ERROR","setLevelInternal","newLevel","levelProperties","LEVEL_SWITCH_ERROR","levelIndex","levelError","recoverLevel","errorEvent","redundantLevels","errorDetails","_ref3","trequest","audioGroupId","levelObject","removeLevel","_startLevel","configStartLevel","id3_track_controller_ID3TrackController","ID3TrackController","getID3Track","textTracks","addTextTrack","onFragParsingMetadata","Cue","WebKitDataCue","onLiveBackBufferReached","foundCue","id3_track_controller","EWMA","halfLife","alpha_","estimate_","totalWeight_","exp","weight","adjAlpha","getTotalWeight","getEstimate","zeroFactor","ewma","ewma_bandwidth_estimator_EwmaBandWidthEstimator","EwmaBandWidthEstimator","slow","fast","defaultEstimate","defaultEstimate_","minWeight_","minDelayMs_","slow_","fast_","durationMs","numBytes","numBits","durationS","bandwidthInBps","canEstimate","ewma_bandwidth_estimator","abr_controller_window","abr_controller_performance","abr_controller_AbrController","AbrController","lastLoadedFragLevel","_nextAutoLevel","_bwEstimator","onCheck","_abandonRulesCheck","ewmaFast","ewmaSlow","isLive","abrEwmaFastLive","abrEwmaSlowLive","abrEwmaFastVoD","abrEwmaSlowVoD","abrEwmaDefaultEstimate","aborted","requestDelay","loadRate","bw","realBitrate","expectedLen","fragLoadedDelay","bufferStarvationDelay","fragLevelNextLoadedDelay","minAutoLevel","levelNextBitrate","abrMaxWithRealBitrate","loadedBytes","loadedDuration","fragLoadingProcessingMs","bwEstimate","bitrateTestDelay","_findBestLevel","currentFragDuration","currentBw","maxAutoLevel","maxFetchDuration","bwFactor","bwUpFactor","avgDuration","adjustedbw","fetchDuration","forcedAutoLevel","bwEstimator","nextABRAutoLevel","_nextABRAutoLevel","avgbw","bestLevel","abrBandWidthFactor","abrBandWidthUpFactor","maxStarvationDelay","maxLoadingDelay","abr_controller","buffer_controller_MediaSource","buffer_controller_BufferController","BufferController","_msDuration","_levelDuration","_levelTargetDuration","_live","_objectUrl","_needsFlush","_needsEos","audioTimestampOffset","bufferCodecEventsExpected","_bufferCodecEventsTotal","segments","appending","appendError","flushBufferCounter","pendingTracks","flushRange","_onMediaSourceOpen","checkPendingTracks","_onMediaSourceClose","_onMediaSourceEnded","_onSBUpdateEnd","audioBuffer","timestampOffset","doFlush","checkEos","counter","segment","sbSet","sb","doAppending","updateMediaElementDuration","flushLiveBackBuffer","_onSBUpdateError","BUFFER_APPENDING_ERROR","onLevelPtsUpdated","updating","codecEvents","onMediaAttaching","ms","endOfStream","removeAttribute","pendingTracksCount","createSourceBuffers","onBufferReset","removeSourceBuffer","onBufferCodecs","mimeType","addSourceBuffer","BUFFER_ADD_CODEC_ERROR","onBufferAppending","onBufferEos","onBufferFlushing","liveBackBufferLength","bufferTypes","targetBackBufferPosition","bufferType","removeBufferRange","onLevelUpdated","liveDurationInfinity","flushBuffer","code","BUFFER_APPEND_ERROR","appendErrorMaxRetry","sbType","bufStart","bufEnd","removeStart","removeEnd","buffer_controller","cap_level_controller_CapLevelController","CapLevelController","autoLevelCapping","restrictedLevels","clientRect","capLevelToPlayerSize","stopCapping","onFpsDropLevelCapping","isLevelAllowed","droppedLevel","HTMLVideoElement","startCapping","detectPlayerSize","levelsLength","getMaxLevel","streamController","capLevelIndex","validLevels","getMaxLevelByMediaSize","mediaWidth","mediaHeight","getDimensions","boundsRect","getBoundingClientRect","bottom","top","maxLevelIndex","contentScaleFactor","devicePixelRatio","cap_level_controller","fps_controller_window","fps_controller_performance","fps_controller_FPSController","FPSController","isVideoPlaybackQualityAvailable","capLevelOnFPSDrop","getVideoPlaybackQuality","checkFPSInterval","fpsDroppedMonitoringPeriod","checkFPS","decodedFrames","droppedFrames","lastTime","currentPeriod","currentDropped","lastDroppedFrames","currentDecoded","lastDecodedFrames","droppedFPS","totalDroppedFrames","fpsDroppedMonitoringThreshold","videoPlaybackQuality","totalVideoFrames","droppedVideoFrames","webkitDecodedFrameCount","webkitDroppedFrameCount","fps_controller","xhr_loader_XhrLoader","XhrLoader","xhrSetup","requestTimeout","retryTimeout","callbacks","retry","loadInternal","xhr","XMLHttpRequest","open","status","setRequestHeader","onreadystatechange","readystatechange","onprogress","send","currentTarget","responseText","responseURL","statusText","lengthComputable","xhr_loader","audio_track_controller_AudioTrackController","AudioTrackController","_trackId","_selectDefaultTrack","trackIdBlacklist","_selectAudioGroup","onAudioTrackLoaded","updatePeriodMs","_handleLoadError","_setAudioTrack","newId","_loadTrackDetailsIfNeeded","_updateTrack","_selectInitialAudioTrack","currentAudioTrack","defaultTracks","trackFound","traverseTracks","_needsTrackLoading","previousId","_this$tracks$previous","language","newTrack","audio_track_controller","audio_stream_controller_window","audio_stream_controller_performance","audio_stream_controller_AudioStreamController","AudioStreamController","waitingFragment","videoTrackCC","waitingVideoCC","onInitPtsFound","demuxerId","trackDetails","mainBufferInfo","maxConfigBuffer","audioSwitch","loadIdx","fragLoadIdx","nextBuffered","foundFrag","isSeeking","waitingFrag","waitingFragCC","clearWaitingFragment","_bufferInfo","waitingFragmentAtPosition","onAudioTracksUpdated","appendObj","pendingData","appendOnBufferFlush","_frag","_config","audio_stream_controller","vttcue","findDirectionSetting","directionSetting","findAlignSetting","alignSetting","extend","cobj","baseObj","hasBeenReset","_id","_pauseOnExit","_startTime","_endTime","_text","_region","_vertical","_snapToLines","_line","_lineAlign","_position","_positionAlign","_size","_align","setting","SyntaxError","autoKeyword","displayState","","lr","rl","middle","getCueAsHTML","WebVTT","convertCueToDOMTree","decodeURIComponent","encodeURIComponent","dflt","defaultKey","collectNextLine","alreadyCollectedLine","hasSubstring","oncue","flush","onflush","VerboseLevel","vttparser","specialCea608CharsCodes","42","92","94","95","96","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153","154","155","156","157","158","159","160","161","162","163","164","165","166","167","168","169","170","171","172","173","174","175","176","177","178","179","180","181","182","183","184","185","186","187","188","189","190","191","192","193","194","195","196","197","198","199","200","201","202","203","204","205","206","207","getCharForByte","_byte","charCode","NR_ROWS","NR_COLS","rowsLowCh1","17","18","21","22","23","16","19","20","rowsHighCh1","rowsLowCh2","25","26","29","30","31","24","27","28","rowsHighCh2","backgroundColors","KeySystems","cea_608_parser_CaptionsLogger","CaptionsLogger","verboseLevel","severity","msg","numArrayToHexArray","numArray","hexArray","PenState","foreground","underline","italics","background","flash","_proto2","reset","setStyles","styles","attribs","style","isDefault","equals","other","copy","newPenState","StyledUnicodeChar","penState","_proto3","setChar","setPenState","newChar","Row","currPenState","_proto4","equal","empty","setCursor","absPos","DEBUG","moveCursor","relPos","newPos","backSpace","insertChar","_byte2","_char","clearFromPos","startPos","clear","clearToEndOfRow","getTextString","_char2","setPenStyles","CaptionScreen","currRow","nrRollUpRows","lastOutputScreen","_proto5","_char3","setPen","INFO","setPAC","pacData","newRow","topRowIndex","prevLineTime","prevPos","color","setBkgData","bkgData","setRollUpRows","nrRows","rollUp","TEXT","getDisplayText","topRow","asOneRow","displayText","rowNr","rowText","getTextAndFormat","Cea608Channel","channelNumber","outputFilter","chNr","verbose","displayedMemory","nonDisplayedMemory","currRollUpRow","writeScreen","_proto6","getHandler","setHandler","newHandler","setMode","newMode","insertChars","screen","outputDataUpdate","ccRCL","ccBS","ccAOF","ccAON","ccDER","ccRU","ccFON","ccRDC","ccTR","ccRTD","ccEDM","ccCR","ccENM","ccEOC","ccTO","nrCols","ccMIDROW","colorIndex","colors","dispatch","dispatchCue","cueSplitAtTime","Cea608Parser","field","out1","out2","channels","currentChannel","_proto7","channel","addData","byteList","cmdFound","charsFound","DATA","parseCmd","parseMidrow","parsePAC","parseBackgroundAttributes","parseChars","currChNr","WARNING","cond1","cond2","case1","case2","interpretPAC","_byte3","pacIndex","channelNr","charCodes","charCode1","oneCode","hexCodes","cea_608_parser","OutputFilter","timelineController","cueRanges","addCues","createCaptionsTrack","startsWith","inputString","searchString","webvtt_parser_cueString2millis","timeString","secs","mins","hours","hash","calculateOffset","vttCCs","presentationTime","currCC","WebVTTParser","vttByteArray","syncPTS","callBack","errorCallBack","parsingError","vttLines","cueTime","mpegTs","localTime","inHeader","timestampMap","parser","cueOffset","onparsingerror","webvtt_parser","timeline_controller_TimelineController","TimelineController","enabled","Cues","unparsedVttFrags","captionsTracks","nonNativeCaptionsTracks","captionsProperties","cea608Parser1","cea608Parser2","lastSn","cueHandler","captionsTextTrack1Label","languageCode","captionsTextTrack1LanguageCode","captionsTextTrack2Label","captionsTextTrack2LanguageCode","textTrack3","captionsTextTrack3Label","captionsTextTrack3LanguageCode","textTrack4","captionsTextTrack4Label","captionsTextTrack4LanguageCode","enableCEA708Captions","channel1","channel2","channel3","channel4","merged","cueRange","overlap","renderTextTracksNatively","getExistingTrack","createNativeTrack","createNonNativeTrack","_captionsProperties$t","existingTrack","createTextTrack","trackProperties","closedCaptions","_cleanTracks","enableWebVTT","sameTracks","inUseTracks","subtitleDisplay","tracksList","subtitleTrack","captionsTrack","instreamIdMatch","success","decryptData","_parseVTTs","currentTrack","getCueById","textTrackCue","onFragDecrypted","onFragParsingUserdata","ccBytes","ccdatas","extractCea608Data","actualCCBytes","tmpByte","ccbyte1","ccbyte2","ccValid","ccType","timeline_controller","subtitle_track_controller_SubtitleTrackController","SubtitleTrackController","stopped","queuedDefaultTrack","trackChangeListener","_onTextTracksChanged","useTextTrackPolling","subtitlePollingInterval","subtitleTracks","onSubtitleTrackLoaded","_clearReloadTimer","_loadCurrentTrack","_toggleTrackModes","oldTrack","nextTrack","_setSubtitleTrackInternal","subtitleTrackId","subtitle_track_controller","subtitle_stream_controller_window","subtitle_stream_controller_performance","subtitle_stream_controller_SubtitleStreamController","SubtitleStreamController","tracksBuffered","currentTrackId","lastAVStart","_onMediaSeeking","onSubtitleFragProcessed","fragStart","fragEnd","onSubtitleTracksUpdated","onSubtitleTrackSwitch","_getBuffered","requestMediaKeySystemAccess","createWidevineMediaKeySystemConfigurations","audioCodecs","videoCodecs","drmSystemOptions","baseConfig","audioCapabilities","videoCapabilities","contentType","robustness","audioRobustness","videoRobustness","eme_controller_getSupportedMediaKeySystemConfigurations","keySystem","WIDEVINE","eme_controller_EMEController","EMEController","_widevineLicenseUrl","_licenseXhrSetup","_emeEnabled","_requestMediaKeySystemAccess","_drmSystemOptions","_mediaKeysList","_media","_hasSetMediaKeys","_requestLicenseFailureCount","mediaKeysPromise","_onMediaEncrypted","initDataType","KEY_SYSTEM_ERROR","KEY_SYSTEM_NO_KEYS","finallySetKeyAndStartSession","mediaKeys","_attemptSetMediaKeys","_generateRequestWithPreferredKeySession","widevineLicenseUrl","licenseXhrSetup","emeEnabled","requestMediaKeySystemAccessFunc","getLicenseServerUrl","_attemptKeySystemAccess","mediaKeySystemConfigs","keySystemAccessPromise","mediaKeySystemAccess","_onMediaKeySystemAccessObtained","mediaKeysListItem","mediaKeysSessionInitialized","mediaKeySystemDomain","Promise","createMediaKeys","_onMediaKeysCreated","mediaKeysSession","createSession","_onNewMediaKeySession","keySession","sessionId","_onKeySessionMessage","_requestLicense","update","keysListItem","setMediaKeys","_this6","KEY_SYSTEM_NO_ACCESS","generateRequest","KEY_SYSTEM_NO_SESSION","KEY_SYSTEM_NO_INIT_DATA","_createLicenseXhr","keyMessage","_onLicenseRequestReadyStageChange","KEY_SYSTEM_LICENSE_REQUEST_FAILED","attemptsLeft","_generateLicenseRequestChallenge","_xhr","challenge","onMediaDetached","mediaKeysList","close","eme_controller","hlsDefaultConfig","lowBufferWatchdogPeriod","abrController","bufferController","capLevelController","fpsController","minAutoBitrate","subtitleStreamController","subtitleTrackController","audioStreamController","audioTrackController","emeController","_Observer","Hls","userConfig","_autoLevelCapping","levelController","networkControllers","coreComponents","defaultConfig","DefaultConfig","_assertThisInitialize","playListLoader","fragmentLoader","keyLoader","id3TrackController","Controller","isSupported","detachMedia","component","attachMedia","loadSource","location","href","controller","recoverMediaError","manualLevel","shouldStartCapping","newCapLevelToPlayerSize","NaN","audioTrackId","./src/polyfills/number.js","isFiniteNumber","./src/utils/get-self-scope.js","getSelfScope","./src/utils/logger.js","noop","formatMsg","consolePrintFn","func","exportLoggerFunctions","debugConfig","functions","exportedLogger","enableLogs","_get_self_scope__WEBPACK_IMPORTED_MODULE_0__","fakeLogger","Html5HlsJS","tech","errorHandlerFactory","_recoverDecodingErrorDate","_recoverAudioCodecErrorDate","options_","el","hlsjsConfig","hlsjsErrorHandler","videoTagErrorHandler","mediaError","MEDIA_ERR_DECODE","dispose","eventName","featuresNativeTextTracks","hlsTypeRE","hlsExtRE","HlsSourceHandler","canHandleSource","skipContribHlsJs","handleSource","canPlayType","videojs","html5Tech","getTech","getComponent","registerSourceHandler"],"mappings":"CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,iBACA,sBAAAC,gBAAAC,IACAD,QAAA,YAAAJ,OACA,CACA,GAAAM,GAAAN,EAAA,gBAAAC,SAAAE,QAAA,YAAAJ,EAAA,QACA,QAAAQ,KAAAD,IAAA,gBAAAL,iBAAAF,GAAAQ,GAAAD,EAAAC,KAECC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAL,EAAAK,EACAE,GAAA,EACAb,WAUA,OANAS,GAAAE,GAAAG,KAAAb,EAAAD,QAAAC,IAAAD,QAAAU,GAGAT,EAAAY,GAAA,EAGAZ,EAAAD,QAvBA,GAAAY,KA+DA,OAnCAF,GAAAK,EAAAN,EAGAC,EAAAM,EAAAJ,EAGAF,EAAAJ,EAAA,SAAAW,GAA2C,MAAAA,IAG3CP,EAAAQ,EAAA,SAAAlB,EAAAmB,EAAAC,GACAV,EAAAW,EAAArB,EAAAmB,IACAG,OAAAC,eAAAvB,EAAAmB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAA1B,GACA,GAAAmB,GAAAnB,KAAA2B,WACA,WAA2B,MAAA3B,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAS,GAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAlB,KAAAe,EAAAC,IAGtDpB,E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js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"video.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"video.js\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"video.js\")) : factory(root[\"videojs\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"video.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"video.js\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"video.js\")) : factory(root[\"videojs\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 2);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\ntypeof window !== \"undefined\" &&\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Hls\"] = factory();\n\telse\n\t\troot[\"Hls\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./src/hls.ts\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/eventemitter3/index.js\":\n/*!*********************************************!*\\\n !*** ./node_modules/eventemitter3/index.js ***!\n \\*********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/url-toolkit/src/url-toolkit.js\":\n/*!*****************************************************!*\\\n !*** ./node_modules/url-toolkit/src/url-toolkit.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n// see https://tools.ietf.org/html/rfc1808\n\n(function (root) {\n var URL_REGEX = /^((?:[a-zA-Z0-9+\\-.]+:)?)(\\/\\/[^\\/?#]*)?((?:[^\\/?#]*\\/)*[^;?#]*)?(;[^?#]*)?(\\?[^#]*)?(#.*)?$/;\n var FIRST_SEGMENT_REGEX = /^([^\\/?#]*)(.*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n\n var URLToolkit = {\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(\n basePartsForNormalise.path\n );\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment,\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's <net_loc> is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the <net_loc>\n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's <params> is non-empty, we skip to\n // step 7; otherwise, it inherits the <params> of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's <query> is non-empty, we skip to\n // step 7; otherwise, it inherits the <query> of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath =\n baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) +\n relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize\n ? URLToolkit.normalizePath(relativeParts.path)\n : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function (url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || '',\n };\n },\n normalizePath: function (path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"<segment>/../\", where <segment> is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"<segment>/..\", where <segment> is a\n // complete path segment not equal to \"..\", that\n // \"<segment>/..\" is removed.\n while (\n path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length\n ) {}\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function (parts) {\n return (\n parts.scheme +\n parts.netLoc +\n parts.path +\n parts.params +\n parts.query +\n parts.fragment\n );\n },\n };\n\n if (true)\n module.exports = URLToolkit;\n else {}\n})(this);\n\n\n/***/ }),\n\n/***/ \"./node_modules/webworkify-webpack/index.js\":\n/*!**************************************************!*\\\n !*** ./node_modules/webworkify-webpack/index.js ***!\n \\**************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction webpackBootstrapFunc (modules) {\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __webpack_require__.i = function(value) { return value; };\n\n/******/ // define getter function for harmony exports\n/******/ __webpack_require__.d = function(exports, name, getter) {\n/******/ if(!__webpack_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n\n/******/ // define __esModule on exports\n/******/ __webpack_require__.r = function(exports) {\n/******/ Object.defineProperty(exports, '__esModule', { value: true });\n/******/ };\n\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __webpack_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __webpack_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"/\";\n\n/******/ // on error function for async loading\n/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE)\n return f.default || f // try to call default if defined to also support babel esmodule exports\n}\n\nvar moduleNameReqExp = '[\\\\.|\\\\-|\\\\+|\\\\w|\\/|@]+'\nvar dependencyRegExp = '\\\\(\\\\s*(\\/\\\\*.*?\\\\*\\/)?\\\\s*.*?(' + moduleNameReqExp + ').*?\\\\)' // additional chars when output.pathinfo is true\n\n// http://stackoverflow.com/a/2593661/130442\nfunction quoteRegExp (str) {\n return (str + '').replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&')\n}\n\nfunction isNumeric(n) {\n return !isNaN(1 * n); // 1 * n converts integers, integers as string (\"123\"), 1e3 and \"1e3\" to integers and strings to NaN\n}\n\nfunction getModuleDependencies (sources, module, queueName) {\n var retval = {}\n retval[queueName] = []\n\n var fnString = module.toString()\n var wrapperSignature = fnString.match(/^function\\s?\\w*\\(\\w+,\\s*\\w+,\\s*(\\w+)\\)/)\n if (!wrapperSignature) return retval\n var webpackRequireName = wrapperSignature[1]\n\n // main bundle deps\n var re = new RegExp('(\\\\\\\\n|\\\\W)' + quoteRegExp(webpackRequireName) + dependencyRegExp, 'g')\n var match\n while ((match = re.exec(fnString))) {\n if (match[3] === 'dll-reference') continue\n retval[queueName].push(match[3])\n }\n\n // dll deps\n re = new RegExp('\\\\(' + quoteRegExp(webpackRequireName) + '\\\\(\"(dll-reference\\\\s(' + moduleNameReqExp + '))\"\\\\)\\\\)' + dependencyRegExp, 'g')\n while ((match = re.exec(fnString))) {\n if (!sources[match[2]]) {\n retval[queueName].push(match[1])\n sources[match[2]] = __webpack_require__(match[1]).m\n }\n retval[match[2]] = retval[match[2]] || []\n retval[match[2]].push(match[4])\n }\n\n // convert 1e3 back to 1000 - this can be important after uglify-js converted 1000 to 1e3\n var keys = Object.keys(retval);\n for (var i = 0; i < keys.length; i++) {\n for (var j = 0; j < retval[keys[i]].length; j++) {\n if (isNumeric(retval[keys[i]][j])) {\n retval[keys[i]][j] = 1 * retval[keys[i]][j];\n }\n }\n }\n\n return retval\n}\n\nfunction hasValuesInQueues (queues) {\n var keys = Object.keys(queues)\n return keys.reduce(function (hasValues, key) {\n return hasValues || queues[key].length > 0\n }, false)\n}\n\nfunction getRequiredModules (sources, moduleId) {\n var modulesQueue = {\n main: [moduleId]\n }\n var requiredModules = {\n main: []\n }\n var seenModules = {\n main: {}\n }\n\n while (hasValuesInQueues(modulesQueue)) {\n var queues = Object.keys(modulesQueue)\n for (var i = 0; i < queues.length; i++) {\n var queueName = queues[i]\n var queue = modulesQueue[queueName]\n var moduleToCheck = queue.pop()\n seenModules[queueName] = seenModules[queueName] || {}\n if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck]) continue\n seenModules[queueName][moduleToCheck] = true\n requiredModules[queueName] = requiredModules[queueName] || []\n requiredModules[queueName].push(moduleToCheck)\n var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName)\n var newModulesKeys = Object.keys(newModules)\n for (var j = 0; j < newModulesKeys.length; j++) {\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || []\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]])\n }\n }\n }\n\n return requiredModules\n}\n\nmodule.exports = function (moduleId, options) {\n options = options || {}\n var sources = {\n main: __webpack_require__.m\n }\n\n var requiredModules = options.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId)\n\n var src = ''\n\n Object.keys(requiredModules).filter(function (m) { return m !== 'main' }).forEach(function (module) {\n var entryModule = 0\n while (requiredModules[module][entryModule]) {\n entryModule++\n }\n requiredModules[module].push(entryModule)\n sources[module][entryModule] = '(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })'\n src = src + 'var ' + module + ' = (' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(entryModule)) + ')({' + requiredModules[module].map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[module][id].toString() }).join(',') + '});\\n'\n })\n\n src = src + 'new ((' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.main.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources.main[id].toString() }).join(',') + '}))(self);'\n\n var blob = new window.Blob([src], { type: 'text/javascript' })\n if (options.bare) { return blob }\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL\n\n var workerUrl = URL.createObjectURL(blob)\n var worker = new window.Worker(workerUrl)\n worker.objectURL = workerUrl\n\n return worker\n}\n\n\n/***/ }),\n\n/***/ \"./src/crypt/decrypter.js\":\n/*!********************************************!*\\\n !*** ./src/crypt/decrypter.js + 3 modules ***!\n \\********************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// CONCATENATED MODULE: ./src/crypt/aes-crypto.js\nvar AESCrypto = /*#__PURE__*/function () {\n function AESCrypto(subtle, iv) {\n this.subtle = subtle;\n this.aesIV = iv;\n }\n\n var _proto = AESCrypto.prototype;\n\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\n return AESCrypto;\n}();\n\n\n// CONCATENATED MODULE: ./src/crypt/fast-aes-key.js\nvar FastAESKey = /*#__PURE__*/function () {\n function FastAESKey(subtle, key) {\n this.subtle = subtle;\n this.key = key;\n }\n\n var _proto = FastAESKey.prototype;\n\n _proto.expandKey = function expandKey() {\n return this.subtle.importKey('raw', this.key, {\n name: 'AES-CBC'\n }, false, ['encrypt', 'decrypt']);\n };\n\n return FastAESKey;\n}();\n\n/* harmony default export */ var fast_aes_key = (FastAESKey);\n// CONCATENATED MODULE: ./src/crypt/aes-decryptor.js\n// PKCS7\nfunction removePadding(buffer) {\n var outputBytes = buffer.byteLength;\n var paddingBytes = outputBytes && new DataView(buffer).getUint8(outputBytes - 1);\n\n if (paddingBytes) {\n return buffer.slice(0, outputBytes - paddingBytes);\n } else {\n return buffer;\n }\n}\n\nvar AESDecryptor = /*#__PURE__*/function () {\n function AESDecryptor() {\n // Static after running initTable\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); // Changes during runtime\n\n this.key = new Uint32Array(0);\n this.initTable();\n } // Using view.getUint32() also swaps the byte order.\n\n\n var _proto = AESDecryptor.prototype;\n\n _proto.uint8ArrayToUint32Array_ = function uint8ArrayToUint32Array_(arrayBuffer) {\n var view = new DataView(arrayBuffer);\n var newArray = new Uint32Array(4);\n\n for (var i = 0; i < 4; i++) {\n newArray[i] = view.getUint32(i * 4);\n }\n\n return newArray;\n };\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\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\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; // Compute multiplication\n\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4]; // Compute sub/invSub bytes, mix columns tables\n\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; // Compute inv sub bytes, inv mix columns tables\n\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; // Compute next counter\n\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\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\n while (offset < key.length && sameKey) {\n sameKey = key[offset] === this.key[offset];\n offset++;\n }\n\n if (sameKey) {\n return;\n }\n\n this.key = key;\n var keySize = this.keySize = key.length;\n\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\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\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n\n t = prev;\n\n if (ksRow % keySize === 0) {\n // Rot word\n t = t << 8 | t >>> 24; // Sub word\n\n t = sbox[t >>> 24] << 24 | sbox[t >>> 16 & 0xff] << 16 | sbox[t >>> 8 & 0xff] << 8 | sbox[t & 0xff]; // Mix Rcon\n\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\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\n\n for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n ksRow = ksRows - invKsRow;\n\n if (invKsRow & 3) {\n t = keySchedule[ksRow];\n } else {\n t = keySchedule[ksRow - 4];\n }\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\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n } // Adding this as a method greatly improves performance.\n ;\n\n _proto.networkToHostOrderSwap = function networkToHostOrderSwap(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n\n _proto.decrypt = function decrypt(inputArrayBuffer, offset, aesIV, removePKCS7Padding) {\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\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; // Iterate through the rounds of decryption\n\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]; // Update state\n\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n ksRow = ksRow + 4;\n } // Shift rows, sub bytes, add round key\n\n\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 ksRow = ksRow + 3; // Write\n\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); // reset initVector to last 4 unsigned int\n\n initVector0 = inputWords0;\n initVector1 = inputWords1;\n initVector2 = inputWords2;\n initVector3 = inputWords3;\n offset = offset + 4;\n }\n\n return removePKCS7Padding ? removePadding(outputInt32.buffer) : outputInt32.buffer;\n };\n\n _proto.destroy = function destroy() {\n this.key = undefined;\n this.keySize = undefined;\n this.ksRows = undefined;\n this.sBox = undefined;\n this.invSBox = undefined;\n this.subMix = undefined;\n this.invSubMix = undefined;\n this.keySchedule = undefined;\n this.invKeySchedule = undefined;\n this.rcon = undefined;\n };\n\n return AESDecryptor;\n}();\n\n/* harmony default export */ var aes_decryptor = (AESDecryptor);\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/crypt/decrypter.js\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar decrypter_Decrypter = /*#__PURE__*/function () {\n function Decrypter(observer, config, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$removePKCS7Paddi = _ref.removePKCS7Padding,\n removePKCS7Padding = _ref$removePKCS7Paddi === void 0 ? true : _ref$removePKCS7Paddi;\n\n this.logEnabled = true;\n this.observer = observer;\n this.config = config;\n this.removePKCS7Padding = removePKCS7Padding; // built in decryptor expects PKCS7 padding\n\n if (removePKCS7Padding) {\n try {\n var browserCrypto = global.crypto;\n\n if (browserCrypto) {\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n }\n } catch (e) {}\n }\n\n this.disableWebCrypto = !this.subtle;\n }\n\n var _proto = Decrypter.prototype;\n\n _proto.isSync = function isSync() {\n return this.disableWebCrypto && this.config.enableSoftwareAES;\n };\n\n _proto.decrypt = function decrypt(data, key, iv, callback) {\n var _this = this;\n\n if (this.disableWebCrypto && this.config.enableSoftwareAES) {\n if (this.logEnabled) {\n logger[\"logger\"].log('JS AES decrypt');\n this.logEnabled = false;\n }\n\n var decryptor = this.decryptor;\n\n if (!decryptor) {\n this.decryptor = decryptor = new aes_decryptor();\n }\n\n decryptor.expandKey(key);\n callback(decryptor.decrypt(data, 0, iv, this.removePKCS7Padding));\n } else {\n if (this.logEnabled) {\n logger[\"logger\"].log('WebCrypto AES decrypt');\n this.logEnabled = false;\n }\n\n var subtle = this.subtle;\n\n if (this.key !== key) {\n this.key = key;\n this.fastAesKey = new fast_aes_key(subtle, key);\n }\n\n this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n var crypto = new AESCrypto(subtle, iv);\n crypto.decrypt(data, aesKey).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n }).then(function (result) {\n callback(result);\n });\n }).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n };\n\n _proto.onWebCryptoError = function onWebCryptoError(err, data, key, iv, callback) {\n if (this.config.enableSoftwareAES) {\n logger[\"logger\"].log('WebCrypto Error, disable WebCrypto API');\n this.disableWebCrypto = true;\n this.logEnabled = true;\n this.decrypt(data, key, iv, callback);\n } else {\n logger[\"logger\"].error(\"decrypting error : \" + err.message);\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_DECRYPT_ERROR,\n fatal: true,\n reason: err.message\n });\n }\n };\n\n _proto.destroy = function destroy() {\n var decryptor = this.decryptor;\n\n if (decryptor) {\n decryptor.destroy();\n this.decryptor = undefined;\n }\n };\n\n return Decrypter;\n}();\n\n/* harmony default export */ var decrypter = __webpack_exports__[\"default\"] = (decrypter_Decrypter);\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-inline.js\":\n/*!**************************************************!*\\\n !*** ./src/demux/demuxer-inline.js + 12 modules ***!\n \\**************************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar crypt_decrypter = __webpack_require__(\"./src/crypt/decrypter.js\");\n\n// EXTERNAL MODULE: ./src/polyfills/number.js\nvar number = __webpack_require__(\"./src/polyfills/number.js\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/demux/adts.js\n/**\n * ADTS parser helper\n * @link https://wiki.multimedia.cx/index.php?title=ADTS\n */\n\n\n\n\nfunction getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType,\n // :int\n adtsSampleingIndex,\n // :int\n adtsExtensionSampleingIndex,\n // :int\n adtsChanelConfig,\n // :int\n config,\n userAgent = navigator.userAgent.toLowerCase(),\n manifestCodec = audioCodec,\n adtsSampleingRates = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; // byte 2\n\n adtsObjectType = ((data[offset + 2] & 0xC0) >>> 6) + 1;\n adtsSampleingIndex = (data[offset + 2] & 0x3C) >>> 2;\n\n if (adtsSampleingIndex > adtsSampleingRates.length - 1) {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: true,\n reason: \"invalid ADTS sampling index:\" + adtsSampleingIndex\n });\n return;\n }\n\n adtsChanelConfig = (data[offset + 2] & 0x01) << 2; // byte 3\n\n adtsChanelConfig |= (data[offset + 3] & 0xC0) >>> 6;\n logger[\"logger\"].log(\"manifest codec:\" + audioCodec + \",ADTS data:type:\" + adtsObjectType + \",sampleingIndex:\" + adtsSampleingIndex + \"[\" + adtsSampleingRates[adtsSampleingIndex] + \"Hz],channelConfig:\" + adtsChanelConfig); // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n\n if (/firefox/i.test(userAgent)) {\n if (adtsSampleingIndex >= 6) {\n adtsObjectType = 5;\n config = new Array(4); // 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\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n } // Android : always use AAC\n\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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); // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)\n\n if (audioCodec && (audioCodec.indexOf('mp4a.40.29') !== -1 || audioCodec.indexOf('mp4a.40.5') !== -1) || !audioCodec && adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 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 && (adtsSampleingIndex >= 6 && adtsChanelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChanelConfig === 1) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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\n\n config[0] = adtsObjectType << 3; // samplingFrequencyIndex\n\n config[0] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7; // channelConfiguration\n\n config[1] |= adtsChanelConfig << 3;\n\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 0x01) << 7; // 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\n config[2] |= 2 << 2;\n config[3] = 0;\n }\n\n return {\n config: config,\n samplerate: adtsSampleingRates[adtsSampleingIndex],\n channelCount: adtsChanelConfig,\n codec: 'mp4a.40.' + adtsObjectType,\n manifestCodec: manifestCodec\n };\n}\nfunction isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n}\nfunction getHeaderLength(data, offset) {\n return data[offset + 1] & 0x01 ? 7 : 9;\n}\nfunction getFullFrameLength(data, offset) {\n return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5;\n}\nfunction isHeader(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 if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n return true;\n }\n\n return false;\n}\nfunction adts_probe(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(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n\n if (offset + headerLength >= data.length) {\n return false;\n } // ADTS frame Length\n\n\n var frameLength = getFullFrameLength(data, offset);\n\n if (frameLength <= headerLength) {\n return false;\n }\n\n var newOffset = offset + frameLength;\n\n if (newOffset === data.length || newOffset + 1 < data.length && isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n\n return false;\n}\nfunction initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\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[\"logger\"].log(\"parsed codec:\" + track.codec + \",rate:\" + config.samplerate + \",nb channel:\" + config.channelCount);\n }\n}\nfunction getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n}\nfunction parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {\n var headerLength, frameLength, stamp;\n var length = data.length; // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n\n headerLength = getHeaderLength(data, offset); // retrieve frame size\n\n frameLength = getFullFrameLength(data, offset);\n frameLength -= headerLength;\n\n if (frameLength > 0 && offset + headerLength + frameLength <= length) {\n stamp = pts + frameIndex * frameDuration; // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n\n return {\n headerLength: headerLength,\n frameLength: frameLength,\n stamp: stamp\n };\n }\n\n return undefined;\n}\nfunction appendFrame(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);\n\n if (header) {\n var stamp = header.stamp;\n var headerLength = header.headerLength;\n var frameLength = header.frameLength; // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n\n var aacSample = {\n unit: data.subarray(offset + headerLength, offset + headerLength + frameLength),\n pts: stamp,\n dts: stamp\n };\n track.samples.push(aacSample);\n return {\n sample: aacSample,\n length: frameLength + headerLength\n };\n }\n\n return undefined;\n}\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(\"./src/demux/id3.js\");\n\n// CONCATENATED MODULE: ./src/demux/aacdemuxer.js\n\n\n/**\n * AAC demuxer\n */\n\n\n\n\nvar aacdemuxer_AACDemuxer = /*#__PURE__*/function () {\n function AACDemuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n var _proto = AACDemuxer.prototype;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = {\n container: 'audio/adts',\n type: 'audio',\n id: 0,\n sequenceNumber: 0,\n isAAC: true,\n samples: [],\n len: 0,\n manifestCodec: audioCodec,\n duration: duration,\n inputTimeScale: 90000\n };\n };\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n AACDemuxer.probe = function probe(data) {\n if (!data) {\n return false;\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\n\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var offset = id3Data.length;\n\n for (var length = data.length; offset < length; offset++) {\n if (adts_probe(data, offset)) {\n logger[\"logger\"].log('ADTS sync word found !');\n return true;\n }\n }\n\n return false;\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var track = this._audioTrack;\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var timestamp = id3[\"default\"].getTimeStamp(id3Data);\n var pts = Object(number[\"isFiniteNumber\"])(timestamp) ? timestamp * 90 : timeOffset * 90000;\n var frameIndex = 0;\n var stamp = pts;\n var length = data.length;\n var offset = id3Data.length;\n var id3Samples = [{\n pts: stamp,\n dts: stamp,\n data: id3Data\n }];\n\n while (offset < length - 1) {\n if (isHeader(data, offset) && offset + 5 < length) {\n initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n logger[\"logger\"].log('Unable to parse AAC frame');\n break;\n }\n } else if (id3[\"default\"].isHeader(data, offset)) {\n id3Data = id3[\"default\"].getID3Data(data, offset);\n id3Samples.push({\n pts: stamp,\n dts: stamp,\n data: id3Data\n });\n offset += id3Data.length;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, {\n samples: []\n }, {\n samples: id3Samples,\n inputTimeScale: 90000\n }, {\n samples: []\n }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n _proto.destroy = function destroy() {};\n\n return AACDemuxer;\n}();\n\n/* harmony default export */ var aacdemuxer = (aacdemuxer_AACDemuxer);\n// EXTERNAL MODULE: ./src/demux/mp4demuxer.js\nvar mp4demuxer = __webpack_require__(\"./src/demux/mp4demuxer.js\");\n\n// CONCATENATED MODULE: ./src/demux/mpegaudio.js\n/**\n * MPEG parser helper\n */\nvar MpegAudio = {\n 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 SamplingRateMap: [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000],\n SamplesCoefficients: [// MPEG 2.5\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ], // Reserved\n [0, // Reserved\n 0, // Layer3\n 0, // Layer2\n 0 // Layer1\n ], // MPEG 2\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ], // MPEG 1\n [0, // Reserved\n 144, // Layer3\n 144, // Layer2\n 12 // Layer1\n ]],\n BytesInSlot: [0, // Reserved\n 1, // Layer3\n 1, // Layer2\n 4 // Layer1\n ],\n appendFrame: 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 undefined;\n }\n\n var header = this.parseHeader(data, offset);\n\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 };\n }\n\n return undefined;\n },\n parseHeader: function parseHeader(data, offset) {\n var headerB = data[offset + 1] >> 3 & 3;\n var headerC = data[offset + 1] >> 1 & 3;\n var headerE = data[offset + 2] >> 4 & 15;\n var headerF = data[offset + 2] >> 2 & 3;\n var headerG = data[offset + 2] >> 1 & 1;\n\n if (headerB !== 1 && headerE !== 0 && headerE !== 15 && headerF !== 3) {\n var columnInBitrates = headerB === 3 ? 3 - headerC : headerC === 3 ? 3 : 4;\n var bitRate = MpegAudio.BitratesMap[columnInBitrates * 14 + headerE - 1] * 1000;\n var columnInSampleRates = headerB === 3 ? 0 : headerB === 2 ? 1 : 2;\n var sampleRate = MpegAudio.SamplingRateMap[columnInSampleRates * 3 + headerF];\n var channelCount = data[offset + 3] >> 6 === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n\n var sampleCoefficient = MpegAudio.SamplesCoefficients[headerB][headerC];\n var bytesInSlot = MpegAudio.BytesInSlot[headerC];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = parseInt(sampleCoefficient * bitRate / sampleRate + headerG, 10) * bytesInSlot;\n return {\n sampleRate: sampleRate,\n channelCount: channelCount,\n frameLength: frameLength,\n samplesPerFrame: samplesPerFrame\n };\n }\n\n return undefined;\n },\n isHeaderPattern: function isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n },\n isHeader: 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 if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n return true;\n }\n\n return false;\n },\n probe: 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 && this.isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4; // MPEG frame Length\n\n var header = this.parseHeader(data, offset);\n var frameLength = headerLength;\n\n if (header && header.frameLength) {\n frameLength = header.frameLength;\n }\n\n var newOffset = offset + frameLength;\n\n if (newOffset === data.length || newOffset + 1 < data.length && this.isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n\n return false;\n }\n};\n/* harmony default export */ var mpegaudio = (MpegAudio);\n// CONCATENATED MODULE: ./src/demux/exp-golomb.js\n/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\n\nvar exp_golomb_ExpGolomb = /*#__PURE__*/function () {\n function ExpGolomb(data) {\n this.data = data; // the number of bytes left to examine in this.data\n\n this.bytesAvailable = data.byteLength; // the current word being examined\n\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n\n this.bitsAvailable = 0; // :uint\n } // ():void\n\n\n var _proto = ExpGolomb.prototype;\n\n _proto.loadWord = function loadWord() {\n var data = this.data,\n bytesAvailable = this.bytesAvailable,\n position = data.byteLength - bytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, bytesAvailable);\n\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n\n workingBytes.set(data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0); // track the amount of this.data that has been processed\n\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n } // (count:int):void\n ;\n\n _proto.skipBits = function skipBits(count) {\n var skipBytes; // :int\n\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 } // (size:int):uint\n ;\n\n _proto.readBits = function readBits(size) {\n var bits = Math.min(this.bitsAvailable, size),\n // :uint\n valu = this.word >>> 32 - bits; // :uint\n\n if (size > 32) {\n logger[\"logger\"].error('Cannot read more than 32 bits at a time');\n }\n\n this.bitsAvailable -= bits;\n\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n } else if (this.bytesAvailable > 0) {\n this.loadWord();\n }\n\n bits = size - bits;\n\n if (bits > 0 && this.bitsAvailable) {\n return valu << bits | this.readBits(bits);\n } else {\n return valu;\n }\n } // ():uint\n ;\n\n _proto.skipLZ = function skipLZ() {\n var leadingZeroCount; // :uint\n\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 } // we exhausted word and still have not found a 1\n\n\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n } // ():void\n ;\n\n _proto.skipUEG = function skipUEG() {\n this.skipBits(1 + this.skipLZ());\n } // ():void\n ;\n\n _proto.skipEG = function skipEG() {\n this.skipBits(1 + this.skipLZ());\n } // ():uint\n ;\n\n _proto.readUEG = function readUEG() {\n var clz = this.skipLZ(); // :uint\n\n return this.readBits(clz + 1) - 1;\n } // ():int\n ;\n\n _proto.readEG = function readEG() {\n var valu = this.readUEG(); // :int\n\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 } // Some convenience functions\n // :Boolean\n ;\n\n _proto.readBoolean = function readBoolean() {\n return this.readBits(1) === 1;\n } // ():int\n ;\n\n _proto.readUByte = function readUByte() {\n return this.readBits(8);\n } // ():int\n ;\n\n _proto.readUShort = function readUShort() {\n return this.readBits(16);\n } // ():int\n ;\n\n _proto.readUInt = function readUInt() {\n return this.readBits(32);\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 {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n ;\n\n _proto.skipScalingList = function skipScalingList(count) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n\n lastScale = nextScale === 0 ? lastScale : nextScale;\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 * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n ;\n\n _proto.readSPS = function readSPS() {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n profileIdc,\n profileCompat,\n levelIdc,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i,\n readUByte = this.readUByte.bind(this),\n readBits = this.readBits.bind(this),\n readUEG = this.readUEG.bind(this),\n readBoolean = this.readBoolean.bind(this),\n skipBits = this.skipBits.bind(this),\n skipEG = this.skipEG.bind(this),\n skipUEG = this.skipUEG.bind(this),\n skipScalingList = this.skipScalingList.bind(this);\n readUByte();\n profileIdc = readUByte(); // profile_idc\n\n profileCompat = readBits(5); // constraint_set[0-4]_flag, u(5)\n\n skipBits(3); // reserved_zero_3bits u(3),\n\n levelIdc = readUByte(); // level_idc u(8)\n\n skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n\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\n if (chromaFormatIdc === 3) {\n skipBits(1);\n } // separate_colour_plane_flag\n\n\n skipUEG(); // bit_depth_luma_minus8\n\n skipUEG(); // bit_depth_chroma_minus8\n\n skipBits(1); // qpprime_y_zero_transform_bypass_flag\n\n if (readBoolean()) {\n // seq_scaling_matrix_present_flag\n scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;\n\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\n skipUEG(); // log2_max_frame_num_minus4\n\n var picOrderCntType = readUEG();\n\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\n skipEG(); // offset_for_non_ref_pic\n\n skipEG(); // offset_for_top_to_bottom_field\n\n numRefFramesInPicOrderCntCycle = readUEG();\n\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n skipEG();\n } // offset_for_ref_frame[ i ]\n\n }\n\n skipUEG(); // max_num_ref_frames\n\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n\n picWidthInMbsMinus1 = readUEG();\n picHeightInMapUnitsMinus1 = readUEG();\n frameMbsOnlyFlag = readBits(1);\n\n if (frameMbsOnlyFlag === 0) {\n skipBits(1);\n } // mb_adaptive_frame_field_flag\n\n\n skipBits(1); // direct_8x8_inference_flag\n\n if (readBoolean()) {\n // frame_cropping_flag\n frameCropLeftOffset = readUEG();\n frameCropRightOffset = readUEG();\n frameCropTopOffset = readUEG();\n frameCropBottomOffset = readUEG();\n }\n\n var pixelRatio = [1, 1];\n\n if (readBoolean()) {\n // vui_parameters_present_flag\n if (readBoolean()) {\n // aspect_ratio_info_present_flag\n var aspectRatioIdc = readUByte();\n\n switch (aspectRatioIdc) {\n case 1:\n pixelRatio = [1, 1];\n break;\n\n case 2:\n pixelRatio = [12, 11];\n break;\n\n case 3:\n pixelRatio = [10, 11];\n break;\n\n case 4:\n pixelRatio = [16, 11];\n break;\n\n case 5:\n pixelRatio = [40, 33];\n break;\n\n case 6:\n pixelRatio = [24, 11];\n break;\n\n case 7:\n pixelRatio = [20, 11];\n break;\n\n case 8:\n pixelRatio = [32, 11];\n break;\n\n case 9:\n pixelRatio = [80, 33];\n break;\n\n case 10:\n pixelRatio = [18, 11];\n break;\n\n case 11:\n pixelRatio = [15, 11];\n break;\n\n case 12:\n pixelRatio = [64, 33];\n break;\n\n case 13:\n pixelRatio = [160, 99];\n break;\n\n case 14:\n pixelRatio = [4, 3];\n break;\n\n case 15:\n pixelRatio = [3, 2];\n break;\n\n case 16:\n pixelRatio = [2, 1];\n break;\n\n case 255:\n {\n pixelRatio = [readUByte() << 8 | readUByte(), readUByte() << 8 | readUByte()];\n break;\n }\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\n _proto.readSliceType = function readSliceType() {\n // skip NALu type\n this.readUByte(); // discard first_mb_in_slice\n\n this.readUEG(); // return slice_type\n\n return this.readUEG();\n };\n\n return ExpGolomb;\n}();\n\n/* harmony default export */ var exp_golomb = (exp_golomb_ExpGolomb);\n// CONCATENATED MODULE: ./src/demux/sample-aes.js\n/**\n * SAMPLE-AES decrypter\n*/\n\n\nvar sample_aes_SampleAesDecrypter = /*#__PURE__*/function () {\n function SampleAesDecrypter(observer, config, decryptdata, discardEPB) {\n this.decryptdata = decryptdata;\n this.discardEPB = discardEPB;\n this.decrypter = new crypt_decrypter[\"default\"](observer, config, {\n removePKCS7Padding: false\n });\n }\n\n var _proto = SampleAesDecrypter.prototype;\n\n _proto.decryptBuffer = function decryptBuffer(encryptedData, callback) {\n this.decrypter.decrypt(encryptedData, this.decryptdata.key.buffer, this.decryptdata.iv.buffer, callback);\n } // AAC - encrypt all full 16 bytes blocks starting from offset 16\n ;\n\n _proto.decryptAacSample = function decryptAacSample(samples, sampleIndex, callback, sync) {\n var curUnit = samples[sampleIndex].unit;\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n var localthis = this;\n this.decryptBuffer(encryptedBuffer, function (decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n curUnit.set(decryptedData, 16);\n\n if (!sync) {\n localthis.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\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\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n this.decryptAacSample(samples, sampleIndex, callback, sync);\n\n if (!sync) {\n return;\n }\n }\n } // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n ;\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\n for (var inputPos = 32; inputPos <= decodedData.length - 16; inputPos += 160, outputPos += 16) {\n encryptedData.set(decodedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n\n return encryptedData;\n };\n\n _proto.getAvcDecryptedUnit = function getAvcDecryptedUnit(decodedData, decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n\n for (var outputPos = 32; outputPos <= decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(decryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n\n return decodedData;\n };\n\n _proto.decryptAvcSample = function decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync) {\n var decodedData = this.discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n var localthis = this;\n this.decryptBuffer(encryptedData.buffer, function (decryptedData) {\n curUnit.data = localthis.getAvcDecryptedUnit(decodedData, decryptedData);\n\n if (!sync) {\n localthis.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n\n _proto.decryptAvcSamples = function decryptAvcSamples(samples, sampleIndex, unitIndex, callback) {\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n var curUnits = samples[sampleIndex].units;\n\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n\n var curUnit = curUnits[unitIndex];\n\n if (curUnit.data.length <= 48 || curUnit.type !== 1 && curUnit.type !== 5) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync);\n\n if (!sync) {\n return;\n }\n }\n }\n };\n\n return SampleAesDecrypter;\n}();\n\n/* harmony default export */ var sample_aes = (sample_aes_SampleAesDecrypter);\n// CONCATENATED MODULE: ./src/demux/tsdemuxer.js\n/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n\n\n\n // import Hex from '../utils/hex';\n\n\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\nvar RemuxerTrackIdConfig = {\n video: 1,\n audio: 2,\n id3: 3,\n text: 4\n};\n\nvar tsdemuxer_TSDemuxer = /*#__PURE__*/function () {\n function TSDemuxer(observer, remuxer, config, typeSupported) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.remuxer = remuxer;\n this.sampleAes = null;\n this.pmtUnknownTypes = {};\n }\n\n var _proto = TSDemuxer.prototype;\n\n _proto.setDecryptData = function setDecryptData(decryptdata) {\n if (decryptdata != null && decryptdata.key != null && decryptdata.method === 'SAMPLE-AES') {\n this.sampleAes = new sample_aes(this.observer, this.config, decryptdata, this.discardEPB);\n } else {\n this.sampleAes = null;\n }\n };\n\n TSDemuxer.probe = function probe(data) {\n var syncOffset = TSDemuxer._syncOffset(data);\n\n if (syncOffset < 0) {\n return false;\n } else {\n if (syncOffset) {\n logger[\"logger\"].warn(\"MPEG2-TS detected but first sync word found @ offset \" + syncOffset + \", junk ahead ?\");\n }\n\n return true;\n }\n };\n\n TSDemuxer._syncOffset = function _syncOffset(data) {\n // scan 1000 first bytes\n var scanwindow = Math.min(1000, data.length - 3 * 188);\n var i = 0;\n\n while (i < scanwindow) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data[i] === 0x47 && data[i + 188] === 0x47 && data[i + 2 * 188] === 0x47) {\n return i;\n } else {\n i++;\n }\n }\n\n return -1;\n }\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n *\n * @param {string} type 'audio' | 'video' | 'id3' | 'text'\n * @param {number} duration\n * @return {object} TSDemuxer's internal track model\n */\n ;\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: type === 'video' ? 0 : undefined,\n isAAC: type === 'audio' ? true : undefined,\n duration: type === 'audio' ? duration : undefined\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 * @override Implements generic demuxing/remuxing interface (see DemuxerInline)\n * @param {object} initSegment\n * @param {string} audioCodec\n * @param {string} videoCodec\n * @param {number} duration (in TS timescale = 90kHz)\n */\n ;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n this.pmtUnknownTypes = {};\n this._avcTrack = TSDemuxer.createTrack('video', duration);\n this._audioTrack = TSDemuxer.createTrack('audio', duration);\n this._id3Track = TSDemuxer.createTrack('id3', duration);\n this._txtTrack = TSDemuxer.createTrack('text', duration); // flush any partial content\n\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcSample = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = duration;\n }\n /**\n *\n * @override\n */\n ;\n\n _proto.resetTimeStamp = function resetTimeStamp() {} // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var start,\n len = data.length,\n stt,\n pid,\n atf,\n offset,\n pes,\n unknownPIDs = false;\n this.pmtUnknownTypes = {};\n this.contiguous = contiguous;\n\n var pmtParsed = this.pmtParsed,\n avcTrack = this._avcTrack,\n audioTrack = this._audioTrack,\n id3Track = this._id3Track,\n avcId = avcTrack.pid,\n audioId = audioTrack.pid,\n id3Id = id3Track.pid,\n pmtId = this._pmtId,\n avcData = avcTrack.pesData,\n audioData = audioTrack.pesData,\n id3Data = id3Track.pesData,\n parsePAT = this._parsePAT,\n parsePMT = this._parsePMT.bind(this),\n parsePES = this._parsePES,\n parseAVCPES = this._parseAVCPES.bind(this),\n parseAACPES = this._parseAACPES.bind(this),\n parseMPEGPES = this._parseMPEGPES.bind(this),\n parseID3PES = this._parseID3PES.bind(this);\n\n var syncOffset = TSDemuxer._syncOffset(data); // don't parse last TS packet if incomplete\n\n\n len -= (len + syncOffset) % 188; // loop through TS packets\n\n for (start = syncOffset; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40); // pid is a 13-bit field starting at the last bit of TS[1]\n\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4; // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n\n if (atf > 1) {\n offset = start + 5 + data[start + 4]; // continue if there is only adaptation field\n\n if (offset === start + 188) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, false);\n }\n\n avcData = {\n data: [],\n size: 0\n };\n }\n\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n\n break;\n\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n }\n\n audioData = {\n data: [],\n size: 0\n };\n }\n\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + 188));\n audioData.size += start + 188 - offset;\n }\n\n break;\n\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(pes);\n }\n\n id3Data = {\n data: [],\n size: 0\n };\n }\n\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n\n break;\n\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n\n pmtId = this._pmtId = parsePAT(data, offset);\n break;\n\n case pmtId:\n if (stt) {\n offset += data[offset] + 1;\n }\n\n var parsedPIDs = parsePMT(data, offset, this.typeSupported.mpeg === true || this.typeSupported.mp3 === true, this.sampleAes != null); // 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\n avcId = parsedPIDs.avc;\n\n if (avcId > 0) {\n avcTrack.pid = avcId;\n }\n\n audioId = parsedPIDs.audio;\n\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.isAAC = parsedPIDs.isAAC;\n }\n\n id3Id = parsedPIDs.id3;\n\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n\n if (unknownPIDs && !pmtParsed) {\n logger[\"logger\"].log('reparse from beginning');\n unknownPIDs = false; // we set it to -188, the += 188 in the for loop will reset start to 0\n\n start = syncOffset - 188;\n }\n\n pmtParsed = this.pmtParsed = true;\n break;\n\n case 17:\n case 0x1fff:\n break;\n\n default:\n unknownPIDs = true;\n break;\n }\n } else {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: false,\n reason: 'TS packet did not start with 0x47'\n });\n }\n } // try to parse last PES packets\n\n\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, true);\n avcTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n avcTrack.pesData = avcData;\n }\n\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n\n audioTrack.pesData = null;\n } else {\n if (audioData && audioData.size) {\n logger[\"logger\"].log('last AAC PES packet truncated,might overlap between fragments');\n } // either audioData null or PES truncated, keep it for next frag parsing\n\n\n audioTrack.pesData = audioData;\n }\n\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(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 if (this.sampleAes == null) {\n this.remuxer.remux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n } else {\n this.decryptAndRemux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.decryptAndRemux = function decryptAndRemux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (audioTrack.samples && audioTrack.isAAC) {\n var localthis = this;\n this.sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n localthis.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.decryptAndRemuxAvc = function decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (videoTrack.samples) {\n var localthis = this;\n this.sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n localthis.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.destroy = function destroy() {\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n };\n\n _proto._parsePAT = 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]; // logger.log('PMT PID:' + this._pmtId);\n };\n\n _proto._trackUnknownPmt = function _trackUnknownPmt(type, logLevel, message) {\n // Only log unknown and unsupported stream types once per append or stream (by resetting this.pmtUnknownTypes)\n // For more information on elementary stream types see:\n // https://en.wikipedia.org/wiki/Program-specific_information#Elementary_stream_types\n var result = this.pmtUnknownTypes[type] || 0;\n\n if (result === 0) {\n this.pmtUnknownTypes[type] = 0;\n logLevel.call(logger[\"logger\"], message);\n }\n\n this.pmtUnknownTypes[type]++;\n return result;\n };\n\n _proto._parsePMT = function _parsePMT(data, offset, mpegSupported, isSampleAes) {\n var sectionLength,\n tableEnd,\n programInfoLength,\n pid,\n result = {\n audio: -1,\n avc: -1,\n id3: -1,\n isAAC: true\n };\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11]; // advance the offset to the first entry in the mapping table\n\n offset += 12 + programInfoLength;\n\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream');\n\n break;\n }\n\n /* falls through */\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n\n case 0x0f:\n // logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n\n break;\n // Packetized metadata (ID3)\n\n case 0x15:\n // logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n\n break;\n\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'H.264 with AES-128-CBC slice encryption found in unencrypted stream');\n\n break;\n }\n\n /* falls through */\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n\n case 0x1b:\n // logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n\n break;\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n\n case 0x03:\n case 0x04:\n // logger.log('MPEG PID:' + pid);\n if (!mpegSupported) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'MPEG audio found, not supported in this browser');\n } else if (result.audio === -1) {\n result.audio = pid;\n result.isAAC = false;\n }\n\n break;\n\n case 0x24:\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'Unsupported HEVC stream type found');\n\n break;\n\n default:\n this._trackUnknownPmt(data[offset], logger[\"logger\"].log, 'Unknown stream type:' + data[offset]);\n\n break;\n } // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n\n return result;\n };\n\n _proto._parsePES = function _parsePES(stream) {\n var i = 0,\n frag,\n pesFlags,\n pesPrefix,\n pesLen,\n pesHdrLen,\n pesData,\n pesPts,\n pesDts,\n payloadStartOffset,\n data = stream.data; // safety check\n\n if (!stream || stream.size === 0) {\n return null;\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\n\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n } // retrieve PTS/DTS from first fragment\n\n\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5]; // 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\n if (pesLen && pesLen > stream.size - 6) {\n return null;\n }\n\n pesFlags = frag[7];\n\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 + // 1 << 29\n (frag[10] & 0xFF) * 4194304 + // 1 << 22\n (frag[11] & 0xFE) * 16384 + // 1 << 14\n (frag[12] & 0xFF) * 128 + // 1 << 7\n (frag[13] & 0xFE) / 2;\n\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29\n (frag[15] & 0xFF) * 4194304 + // 1 << 22\n (frag[16] & 0xFE) * 16384 + // 1 << 14\n (frag[17] & 0xFF) * 128 + // 1 << 7\n (frag[18] & 0xFE) / 2;\n\n if (pesPts - pesDts > 60 * 90000) {\n logger[\"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\n pesHdrLen = frag[8]; // 9 bytes : 6 bytes for PES header + 3 bytes for PES extension\n\n payloadStartOffset = pesHdrLen + 9;\n\n if (stream.size <= payloadStartOffset) {\n return null;\n }\n\n stream.size -= payloadStartOffset; // reassemble PES packet\n\n pesData = new Uint8Array(stream.size);\n\n for (var j = 0, dataLen = data.length; j < dataLen; j++) {\n frag = data[j];\n var len = frag.byteLength;\n\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\n pesData.set(frag, i);\n i += len;\n }\n\n if (pesLen) {\n // payload size : remove PES header + PES extension\n pesLen -= pesHdrLen + 3;\n }\n\n return {\n data: pesData,\n pts: pesPts,\n dts: pesDts,\n len: pesLen\n };\n } else {\n return null;\n }\n };\n\n _proto.pushAccesUnit = function pushAccesUnit(avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length; // if sample does not have PTS/DTS, patch with last sample PTS/DTS\n\n if (isNaN(avcSample.pts)) {\n if (nbSamples) {\n var lastSample = samples[nbSamples - 1];\n avcSample.pts = lastSample.pts;\n avcSample.dts = lastSample.dts;\n } else {\n // dropping samples, no timestamp found\n avcTrack.dropped++;\n return;\n }\n } // only push AVC sample if starting with a keyframe is not mandatory OR\n // if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n\n\n if (!this.config.forceKeyFrameOnDiscontinuity || avcSample.key === true || avcTrack.sps && (nbSamples || this.contiguous)) {\n avcSample.id = nbSamples;\n samples.push(avcSample);\n } else {\n // dropped samples, track it\n avcTrack.dropped++;\n }\n }\n\n if (avcSample.debug.length) {\n logger[\"logger\"].log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n };\n\n _proto._parseAVCPES = function _parseAVCPES(pes, last) {\n var _this = this;\n\n // logger.log('parse new PES');\n var track = this._avcTrack,\n units = this._parseAVCNALu(pes.data),\n debug = false,\n expGolombDecoder,\n avcSample = this.avcSample,\n push,\n spsfound = false,\n i,\n pushAccesUnit = this.pushAccesUnit.bind(this),\n createAVCSample = function createAVCSample(key, pts, dts, debug) {\n return {\n key: key,\n pts: pts,\n dts: dts,\n units: [],\n debug: debug\n };\n }; // free pes.data to save up some memory\n\n\n pes.data = null; // 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\n if (avcSample && units.length && !track.audFound) {\n pushAccesUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n\n units.forEach(function (unit) {\n switch (unit.type) {\n // NDR\n case 1:\n push = true;\n\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n\n if (debug) {\n avcSample.debug += 'NDR ';\n }\n\n avcSample.frame = true;\n var data = unit.data; // only check slice type to detect KF in case SPS found in same packet (any keyframe is preceded by SPS ...)\n\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 exp_golomb(data).readSliceType(); // 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\n if (sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9) {\n avcSample.key = true;\n }\n }\n\n break;\n // IDR\n\n case 5:\n push = true; // handle PES not starting with AUD\n\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n\n if (debug) {\n avcSample.debug += 'IDR ';\n }\n\n avcSample.key = true;\n avcSample.frame = true;\n break;\n // SEI\n\n case 6:\n push = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'SEI ';\n }\n\n expGolombDecoder = new exp_golomb(_this.discardEPB(unit.data)); // skip frameType\n\n expGolombDecoder.readUByte();\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n\n while (!endOfCaptions && expGolombDecoder.bytesAvailable > 1) {\n payloadType = 0;\n\n do {\n b = expGolombDecoder.readUByte();\n payloadType += b;\n } while (b === 0xFF); // Parse payload size.\n\n\n payloadSize = 0;\n\n do {\n b = expGolombDecoder.readUByte();\n payloadSize += b;\n } while (b === 0xFF); // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n\n\n if (payloadType === 4 && expGolombDecoder.bytesAvailable !== 0) {\n endOfCaptions = true;\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181) {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49) {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934) {\n var userDataType = expGolombDecoder.readUByte(); // Raw CEA-608 bytes wrapped in CEA-708 packet\n\n if (userDataType === 3) {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i = 0; i < totalCCs; i++) {\n // 3 bytes per CC\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, {\n type: 3,\n pts: pes.pts,\n bytes: byteArray\n });\n }\n }\n }\n }\n } else if (payloadType === 5 && expGolombDecoder.bytesAvailable !== 0) {\n endOfCaptions = true;\n\n if (payloadSize > 16) {\n var uuidStrArray = [];\n\n for (i = 0; i < 16; i++) {\n uuidStrArray.push(expGolombDecoder.readUByte().toString(16));\n\n if (i === 3 || i === 5 || i === 7 || i === 9) {\n uuidStrArray.push('-');\n }\n }\n\n var length = payloadSize - 16;\n var userDataPayloadBytes = new Uint8Array(length);\n\n for (i = 0; i < length; i++) {\n userDataPayloadBytes[i] = expGolombDecoder.readUByte();\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, {\n pts: pes.pts,\n payloadType: payloadType,\n uuid: uuidStrArray.join(''),\n userDataBytes: userDataPayloadBytes,\n userData: Object(id3[\"utf8ArrayToStr\"])(userDataPayloadBytes.buffer)\n });\n }\n } else if (payloadSize < expGolombDecoder.bytesAvailable) {\n for (i = 0; i < payloadSize; i++) {\n expGolombDecoder.readUByte();\n }\n }\n }\n\n break;\n // SPS\n\n case 7:\n push = true;\n spsfound = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'SPS ';\n }\n\n if (!track.sps) {\n expGolombDecoder = new exp_golomb(unit.data);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [unit.data];\n track.duration = _this._duration;\n var codecarray = unit.data.subarray(1, 4);\n var codecstring = 'avc1.';\n\n for (i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n\n if (h.length < 2) {\n h = '0' + h;\n }\n\n codecstring += h;\n }\n\n track.codec = codecstring;\n }\n\n break;\n // PPS\n\n case 8:\n push = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'PPS ';\n }\n\n if (!track.pps) {\n track.pps = [unit.data];\n }\n\n break;\n // AUD\n\n case 9:\n push = false;\n track.audFound = true;\n\n if (avcSample) {\n pushAccesUnit(avcSample, track);\n }\n\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, debug ? 'AUD ' : '');\n break;\n // Filler Data\n\n case 12:\n push = false;\n break;\n\n default:\n push = false;\n\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n\n break;\n }\n\n if (avcSample && push) {\n var _units = avcSample.units;\n\n _units.push(unit);\n }\n }); // if last PES packet, push samples\n\n if (last && avcSample) {\n pushAccesUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n\n _proto._insertSampleInOrder = function _insertSampleInOrder(arr, data) {\n var len = arr.length;\n\n if (len > 0) {\n if (data.pts >= arr[len - 1].pts) {\n arr.push(data);\n } else {\n for (var pos = len - 1; pos >= 0; pos--) {\n if (data.pts < arr[pos].pts) {\n arr.splice(pos, 0, data);\n break;\n }\n }\n }\n } else {\n arr.push(data);\n }\n };\n\n _proto._getLastNalUnit = function _getLastNalUnit() {\n var avcSample = this.avcSample,\n lastUnit; // try to fallback to previous sample if current one is empty\n\n if (!avcSample || avcSample.units.length === 0) {\n var track = this._avcTrack,\n samples = track.samples;\n avcSample = samples[samples.length - 1];\n }\n\n if (avcSample) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n\n return lastUnit;\n };\n\n _proto._parseAVCNALu = function _parseAVCNALu(array) {\n var i = 0,\n len = array.byteLength,\n value,\n overflow,\n track = this._avcTrack,\n state = track.naluState || 0,\n lastState = state;\n var units = [],\n unit,\n unitType,\n lastUnitStart = -1,\n lastUnitType; // 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; // NALu type is value read from offset 0\n\n lastUnitType = array[0] & 0x1f;\n state = 0;\n i = 1;\n }\n\n while (i < len) {\n value = array[i++]; // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n } // here we have state either equal to 2 or 3\n\n\n if (!value) {\n state = 3;\n } else if (value === 1) {\n if (lastUnitStart >= 0) {\n unit = {\n data: array.subarray(lastUnitStart, i - state - 1),\n type: lastUnitType\n }; // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);\n\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();\n\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 } // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n\n\n overflow = i - state - 1;\n\n if (overflow > 0) {\n // logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\n }\n } // check if we can read unit type\n\n\n if (i < len) {\n unitType = array[i] & 0x1f; // logger.log('find NALU @ offset:' + i + ',type:' + unitType);\n\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\n if (lastUnitStart >= 0 && state >= 0) {\n unit = {\n data: array.subarray(lastUnitStart, len),\n type: lastUnitType,\n state: state\n };\n units.push(unit); // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);\n } // no NALu found\n\n\n if (units.length === 0) {\n // append pes.data to previous NAL unit\n var _lastUnit = this._getLastNalUnit();\n\n if (_lastUnit) {\n var _tmp = new Uint8Array(_lastUnit.data.byteLength + array.byteLength);\n\n _tmp.set(_lastUnit.data, 0);\n\n _tmp.set(array, _lastUnit.data.byteLength);\n\n _lastUnit.data = _tmp;\n }\n }\n\n track.naluState = state;\n return units;\n }\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n ;\n\n _proto.discardEPB = function discardEPB(data) {\n var length = data.byteLength,\n EPBPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\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 } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (EPBPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n\n newLength = length - EPBPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === EPBPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n EPBPositions.shift();\n }\n\n newData[i] = data[sourceIndex];\n }\n\n return newData;\n };\n\n _proto._parseAACPES = function _parseAACPES(pes) {\n var track = this._audioTrack,\n data = pes.data,\n pts = pes.pts,\n startOffset = 0,\n aacOverFlow = this.aacOverFlow,\n aacLastPTS = this.aacLastPTS,\n frameDuration,\n frameIndex,\n offset,\n stamp,\n len;\n\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength); // logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n\n data = tmp;\n } // look for ADTS header (0xFFFx)\n\n\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (isHeader(data, offset)) {\n break;\n }\n } // if ADTS header does not start straight from the beginning of the PES payload, raise an error\n\n\n if (offset) {\n var reason, fatal;\n\n if (offset < len - 1) {\n reason = \"AAC PES did not start with ADTS header,offset:\" + offset;\n fatal = false;\n } else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n\n logger[\"logger\"].warn(\"parsing error:\" + reason);\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: fatal,\n reason: reason\n });\n\n if (fatal) {\n return;\n }\n }\n\n initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n frameIndex = 0;\n frameDuration = getFrameDuration(track.samplerate); // 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\n if (aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS + frameDuration;\n\n if (Math.abs(newPTS - pts) > 1) {\n logger[\"logger\"].log(\"AAC: align PTS for overlapping frames by \" + Math.round((newPTS - pts) / 90));\n pts = newPTS;\n }\n } // scan for aac samples\n\n\n while (offset < len) {\n if (isHeader(data, offset)) {\n if (offset + 5 < len) {\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n continue;\n }\n } // We are at an ADTS header, but do not have enough data for a frame\n // Remaining data will be added to aacOverFlow\n\n\n break;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len); // logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n };\n\n _proto._parseMPEGPES = function _parseMPEGPES(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\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(this._audioTrack, data, offset, pts, frameIndex);\n\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\n _proto._parseID3PES = function _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n };\n\n return TSDemuxer;\n}();\n\n/* harmony default export */ var tsdemuxer = (tsdemuxer_TSDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp3demuxer.js\n/**\n * MP3 demuxer\n */\n\n\n\n\nvar mp3demuxer_MP3Demuxer = /*#__PURE__*/function () {\n function MP3Demuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n var _proto = MP3Demuxer.prototype;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = {\n container: 'audio/mpeg',\n type: 'audio',\n id: -1,\n sequenceNumber: 0,\n isAAC: false,\n samples: [],\n len: 0,\n manifestCodec: audioCodec,\n duration: duration,\n inputTimeScale: 90000\n };\n };\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n MP3Demuxer.probe = function probe(data) {\n // check if data contains ID3 timestamp and MPEG sync word\n var offset, length;\n var id3Data = id3[\"default\"].getID3Data(data, 0);\n\n if (id3Data && id3[\"default\"].getTimeStamp(id3Data) !== undefined) {\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 for (offset = id3Data.length, length = Math.min(data.length - 1, offset + 100); offset < length; offset++) {\n if (mpegaudio.probe(data, offset)) {\n logger[\"logger\"].log('MPEG Audio sync word found !');\n return true;\n }\n }\n }\n\n return false;\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var timestamp = id3[\"default\"].getTimeStamp(id3Data);\n var pts = timestamp !== undefined ? 90 * timestamp : timeOffset * 90000;\n var offset = id3Data.length;\n var length = data.length;\n var frameIndex = 0,\n stamp = 0;\n var track = this._audioTrack;\n var id3Samples = [{\n pts: pts,\n dts: pts,\n data: id3Data\n }];\n\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n // logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n } else if (id3[\"default\"].isHeader(data, offset)) {\n id3Data = id3[\"default\"].getID3Data(data, offset);\n id3Samples.push({\n pts: stamp,\n dts: stamp,\n data: id3Data\n });\n offset += id3Data.length;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, {\n samples: []\n }, {\n samples: id3Samples,\n inputTimeScale: 90000\n }, {\n samples: []\n }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n _proto.destroy = function destroy() {};\n\n return MP3Demuxer;\n}();\n\n/* harmony default export */ var mp3demuxer = (mp3demuxer_MP3Demuxer);\n// CONCATENATED MODULE: ./src/remux/aac-helper.js\n/**\n * AAC helper\n */\nvar AAC = /*#__PURE__*/function () {\n function AAC() {}\n\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\n break;\n // handle HE-AAC below (mp4a.40.5 / mp4a.40.29)\n\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\n break;\n }\n\n return null;\n };\n\n return AAC;\n}();\n\n/* harmony default export */ var aac_helper = (AAC);\n// CONCATENATED MODULE: ./src/remux/mp4-generator.js\n/**\n * Generate MP4 Box\n*/\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4 = /*#__PURE__*/function () {\n function MP4() {}\n\n MP4.init = function init() {\n MP4.types = {\n avc1: [],\n // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n var i;\n\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\n var videoHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n var audioHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n var stco = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n MP4.STSZ = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n MP4.VMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]);\n MP4.STSD = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01]); // entry_count\n\n var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom\n\n var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1\n\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\n MP4.box = function box(type) {\n var payload = Array.prototype.slice.call(arguments, 1),\n size = 8,\n i = payload.length,\n len = i,\n result; // calculate the total size we need to allocate\n\n while (i--) {\n size += payload[i].byteLength;\n }\n\n 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); // copy the payload into the result\n\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\n return result;\n };\n\n MP4.hdlr = function hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n\n MP4.mdat = function mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n };\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, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xFF, upperWordDuration >> 8 & 0xFF, upperWordDuration & 0xFF, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xFF, lowerWordDuration >> 8 & 0xFF, lowerWordDuration & 0xFF, 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00]));\n };\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\n MP4.mfhd = function mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags\n sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF // sequence_number\n ]));\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\n MP4.moof = function moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n }\n /**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n ;\n\n MP4.moov = function moov(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\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\n MP4.mvex = function mvex(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\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, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // 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, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // 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, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n };\n\n MP4.sdtp = function sdtp(track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i; // leave the full box header (4 bytes) all zero\n // write the sample table\n\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\n return MP4.box(MP4.types.sdtp, bytes);\n };\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\n MP4.avc1 = function avc1(track) {\n var sps = [],\n pps = [],\n i,\n data,\n len; // 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); // SPS\n\n sps = sps.concat(Array.prototype.slice.call(data));\n } // assemble the PPSs\n\n\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\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version\n sps[3], // profile\n sps[4], // profile compat\n sps[5], // level\n 0xfc | 3, // 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))),\n // \"PPS\"\n width = track.width,\n height = track.height,\n hSpacing = track.pixelRatio[0],\n vSpacing = track.pixelRatio[1];\n return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n width >> 8 & 0xFF, width & 0xff, // width\n height >> 8 & 0xFF, height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x12, 0x64, 0x61, 0x69, 0x6C, // 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, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]), // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])), // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24, // hSpacing\n hSpacing >> 16 & 0xFF, hSpacing >> 8 & 0xFF, hSpacing & 0xFF, vSpacing >> 24, // vSpacing\n vSpacing >> 16 & 0xFF, vSpacing >> 8 & 0xFF, vSpacing & 0xFF])));\n };\n\n MP4.esds = function esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x03, // descriptor_type\n 0x17 + configlen, // length\n 0x00, 0x01, // es_id\n 0x00, // stream_priority\n 0x04, // descriptor_type\n 0x0f + configlen, // length\n 0x40, // codec : mpeg4_audio\n 0x15, // stream_type\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n\n MP4.mp4a = function mp4a(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n\n MP4.mp3 = function mp3(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]));\n };\n\n MP4.stsd = function stsd(track) {\n if (track.type === 'audio') {\n if (!track.isAAC && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\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\n MP4.tkhd = function tkhd(track) {\n var id = track.id,\n duration = track.duration * track.timescale,\n width = track.width,\n height = track.height,\n upperWordDuration = Math.floor(duration / (UINT32_MAX + 1)),\n lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // 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, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x00, 0x00, // non-audio track volume\n 0x00, 0x00, // 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, // transformation: unity matrix\n width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width\n height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height\n ]));\n };\n\n MP4.traf = function traf(track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track),\n id = track.id,\n upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1)),\n lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF // track_ID\n ])), MP4.box(MP4.types.tfdt, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // 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 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n }\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n ;\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\n MP4.trex = function trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n\n MP4.trun = function trun(track, offset) {\n var samples = track.samples || [],\n len = samples.length,\n arraylen = 12 + 16 * len,\n array = new Uint8Array(arraylen),\n i,\n sample,\n duration,\n size,\n flags,\n cts;\n offset += 8 + arraylen;\n array.set([0x00, // version 0\n 0x00, 0x0f, 0x01, // flags\n len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // sample_count\n offset >>> 24 & 0xFF, offset >>> 16 & 0xFF, offset >>> 8 & 0xFF, offset & 0xFF // data_offset\n ], 0);\n\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, // sample_duration\n size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // 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, // sample_flags\n cts >>> 24 & 0xFF, cts >>> 16 & 0xFF, cts >>> 8 & 0xFF, cts & 0xFF // sample_composition_time_offset\n ], 12 + 16 * i);\n }\n\n return MP4.box(MP4.types.trun, array);\n };\n\n MP4.initSegment = function initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n\n var movie = MP4.moov(tracks),\n result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n\n return MP4;\n}();\n\n/* harmony default export */ var mp4_generator = (MP4);\n// CONCATENATED MODULE: ./src/utils/timescale-conversion.ts\nvar MPEG_TS_CLOCK_FREQ_HZ = 90000;\nfunction toTimescaleFromScale(value, destScale, srcScale, round) {\n if (srcScale === void 0) {\n srcScale = 1;\n }\n\n if (round === void 0) {\n round = false;\n }\n\n return toTimescaleFromBase(value, destScale, 1 / srcScale);\n}\nfunction toTimescaleFromBase(value, destScale, srcBase, round) {\n if (srcBase === void 0) {\n srcBase = 1;\n }\n\n if (round === void 0) {\n round = false;\n }\n\n var result = value * destScale * srcBase; // equivalent to `(value * scale) / (1 / base)`\n\n return round ? Math.round(result) : result;\n}\nfunction toMsFromMpegTsClock(value, round) {\n if (round === void 0) {\n round = false;\n }\n\n return toTimescaleFromBase(value, 1000, 1 / MPEG_TS_CLOCK_FREQ_HZ, round);\n}\nfunction toMpegTsClockFromTimescale(value, srcScale) {\n if (srcScale === void 0) {\n srcScale = 1;\n }\n\n return toTimescaleFromBase(value, MPEG_TS_CLOCK_FREQ_HZ, 1 / srcScale);\n}\n// CONCATENATED MODULE: ./src/remux/mp4-remuxer.js\n/**\n * fMP4 remuxer\n*/\n\n\n\n\n\n\nvar MAX_SILENT_FRAME_DURATION_90KHZ = toMpegTsClockFromTimescale(10);\nvar PTS_DTS_SHIFT_TOLERANCE_90KHZ = toMpegTsClockFromTimescale(0.2);\nvar chromeVersion = null;\n\nvar mp4_remuxer_MP4Remuxer = /*#__PURE__*/function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.ISGenerated = false;\n\n if (chromeVersion === null) {\n var result = navigator.userAgent.match(/Chrome\\/(\\d+)/i);\n chromeVersion = result ? parseInt(result[1]) : 0;\n }\n }\n\n var _proto = MP4Remuxer.prototype;\n\n _proto.destroy = function destroy() {};\n\n _proto.resetTimeStamp = function resetTimeStamp(defaultTimeStamp) {\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n\n _proto.resetInitSegment = function resetInitSegment() {\n this.ISGenerated = false;\n };\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\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 PTSNormalize(minPTS, sample.pts);\n } else if (delta > 0) {\n return minPTS;\n } else {\n return sample.pts;\n }\n }, videoSamples[0].pts);\n\n if (rolloverDetected) {\n logger[\"logger\"].debug('PTS rollover detected');\n }\n\n return startPTS;\n };\n\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n if (this.ISGenerated) {\n var nbAudioSamples = audioTrack.samples.length;\n var nbVideoSamples = videoTrack.samples.length;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n\n if (nbAudioSamples && nbVideoSamples) {\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 = PTSNormalize(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 } // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is\n // calculated in remuxAudio.\n // logger.log('nb AAC samples:' + audioTrack.samples.length);\n\n\n if (nbAudioSamples) {\n // if initSegment was generated without video samples, regenerate it again\n if (!audioTrack.timescale) {\n logger[\"logger\"].warn('regenerate InitSegment as audio detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n var audioData = this.remuxAudio(audioTrack, audioTimeOffset, contiguous, accurateTimeOffset); // logger.log('nb AVC samples:' + videoTrack.samples.length);\n\n if (nbVideoSamples) {\n var audioTrackLength;\n\n if (audioData) {\n audioTrackLength = audioData.endPTS - audioData.startPTS;\n } // if initSegment was generated without video samples, regenerate it again\n\n\n if (!videoTrack.timescale) {\n logger[\"logger\"].warn('regenerate InitSegment as video detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n this.remuxVideo(videoTrack, videoTimeOffset, contiguous, audioTrackLength);\n }\n } else {\n // logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var videoData = this.remuxVideo(videoTrack, videoTimeOffset, contiguous, 0, accurateTimeOffset);\n\n if (videoData && audioTrack.codec) {\n this.remuxEmptyAudio(audioTrack, audioTimeOffset, contiguous, videoData);\n }\n }\n }\n } // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n\n\n if (id3Track.samples.length) {\n this.remuxID3(id3Track, timeOffset);\n } // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n\n\n if (textTrack.samples.length) {\n this.remuxText(textTrack, timeOffset);\n } // notify end of parsing\n\n\n this.observer.trigger(events[\"default\"].FRAG_PARSED);\n };\n\n _proto.generateIS = function generateIS(audioTrack, videoTrack, timeOffset) {\n var observer = this.observer,\n audioSamples = audioTrack.samples,\n videoSamples = videoTrack.samples,\n typeSupported = this.typeSupported,\n container = 'audio/mp4',\n tracks = {},\n data = {\n tracks: tracks\n },\n computePTSDTS = this._initPTS === undefined,\n initPTS,\n initDTS;\n\n if (computePTSDTS) {\n initPTS = initDTS = Infinity;\n }\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 logger[\"logger\"].log(\"audio sampling rate : \" + audioTrack.samplerate);\n\n if (!audioTrack.isAAC) {\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 }\n\n tracks.audio = {\n container: container,\n codec: audioTrack.codec,\n initSegment: !audioTrack.isAAC && typeSupported.mpeg ? new Uint8Array() : mp4_generator.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - Math.round(audioTrack.inputTimeScale * timeOffset);\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 var inputTimeScale = videoTrack.inputTimeScale;\n videoTrack.timescale = inputTimeScale;\n tracks.video = {\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: mp4_generator.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n\n if (computePTSDTS) {\n var startPTS = this.getVideoStartPts(videoSamples);\n var startOffset = Math.round(inputTimeScale * timeOffset);\n initDTS = Math.min(initDTS, PTSNormalize(videoSamples[0].dts, startPTS) - startOffset);\n initPTS = Math.min(initPTS, startPTS - startOffset);\n this.observer.trigger(events[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n } else if (computePTSDTS && tracks.audio) {\n // initPTS found for audio-only stream with main and alt audio\n this.observer.trigger(events[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n\n if (Object.keys(tracks).length) {\n observer.trigger(events[\"default\"].FRAG_PARSING_INIT_SEGMENT, data);\n this.ISGenerated = true;\n\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n } else {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: false,\n reason: 'no audio/video samples found'\n });\n }\n };\n\n _proto.remuxVideo = function remuxVideo(track, timeOffset, contiguous, audioTrackLength) {\n var timeScale = track.timescale;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nbSamples = inputSamples.length;\n var initPTS = this._initPTS;\n var offset = 8;\n var mp4SampleDuration;\n var mdat;\n var moof;\n var firstDTS;\n var lastDTS;\n var minPTS = Number.POSITIVE_INFINITY;\n var maxPTS = Number.NEGATIVE_INFINITY;\n var ptsDtsShift = 0;\n var sortSamples = false; // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n\n var nextAvcDts = this.nextAvcDts;\n\n if (nbSamples === 0) {\n return;\n }\n\n if (!contiguous) {\n var pts = timeOffset * timeScale;\n var cts = inputSamples[0].pts - PTSNormalize(inputSamples[0].dts, inputSamples[0].pts); // if not contiguous, let's use target timeOffset\n\n nextAvcDts = pts - cts;\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\n\n for (var i = 0; i < nbSamples; i++) {\n var sample = inputSamples[i];\n sample.pts = PTSNormalize(sample.pts - initPTS, nextAvcDts);\n sample.dts = PTSNormalize(sample.dts - initPTS, nextAvcDts);\n\n if (sample.dts > sample.pts) {\n ptsDtsShift = Math.max(Math.min(ptsDtsShift, sample.pts - sample.dts), -1 * PTS_DTS_SHIFT_TOLERANCE_90KHZ);\n }\n\n if (sample.dts < inputSamples[i > 0 ? i - 1 : i].dts) {\n sortSamples = true;\n }\n } // sort video samples by DTS then PTS then demux id order\n\n\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 || a.id - b.id;\n });\n } // Get first/last DTS\n\n\n firstDTS = inputSamples[0].dts;\n lastDTS = inputSamples[nbSamples - 1].dts; // on Safari let's signal the same sample duration for all samples\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\n var averageSampleDuration = Math.round((lastDTS - firstDTS) / (nbSamples - 1)); // handle broken streams with PTS < DTS, tolerance up 0.2 seconds\n\n if (ptsDtsShift < 0) {\n if (ptsDtsShift < averageSampleDuration * -2) {\n // Fix for \"CNN special report, with CC\" in test-streams (including Safari browser)\n // With large PTS < DTS errors such as this, we want to correct CTS while maintaining increasing DTS values\n logger[\"logger\"].warn(\"PTS < DTS detected in video samples, offsetting DTS from PTS by \" + toMsFromMpegTsClock(-averageSampleDuration, true) + \" ms\");\n var lastDts = ptsDtsShift;\n\n for (var _i = 0; _i < nbSamples; _i++) {\n inputSamples[_i].dts = lastDts = Math.max(lastDts, inputSamples[_i].pts - averageSampleDuration);\n inputSamples[_i].pts = Math.max(lastDts, inputSamples[_i].pts);\n }\n } else {\n // Fix for \"Custom IV with bad PTS DTS\" in test-streams\n // With smaller PTS < DTS errors we can simply move all DTS back. This increases CTS without causing buffer gaps or decode errors in Safari\n logger[\"logger\"].warn(\"PTS < DTS detected in video samples, shifting DTS by \" + toMsFromMpegTsClock(ptsDtsShift, true) + \" ms to overcome this issue\");\n\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n inputSamples[_i2].dts = inputSamples[_i2].dts + ptsDtsShift;\n }\n }\n\n firstDTS = inputSamples[0].dts;\n lastDTS = inputSamples[nbSamples - 1].dts;\n } // if fragment are contiguous, detect hole/overlapping between fragments\n\n\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\n if (foundHole || foundOverlap) {\n if (foundHole) {\n logger[\"logger\"].warn(\"AVC: \" + toMsFromMpegTsClock(delta, true) + \" ms (\" + delta + \"dts) hole between fragments detected, filling it\");\n } else {\n logger[\"logger\"].warn(\"AVC: \" + toMsFromMpegTsClock(-delta, true) + \" ms (\" + delta + \"dts) overlapping between fragments detected\");\n }\n\n firstDTS = nextAvcDts;\n var firstPTS = inputSamples[0].pts - delta;\n inputSamples[0].dts = firstDTS;\n inputSamples[0].pts = firstPTS;\n logger[\"logger\"].log(\"Video: First PTS/DTS adjusted: \" + toMsFromMpegTsClock(firstPTS, true) + \"/\" + toMsFromMpegTsClock(firstDTS, true) + \", delta: \" + toMsFromMpegTsClock(delta, true) + \" ms\");\n }\n }\n\n if (chromeVersion && chromeVersion < 75) {\n firstDTS = Math.max(0, firstDTS);\n }\n\n var nbNalu = 0;\n var naluLen = 0;\n\n for (var _i3 = 0; _i3 < nbSamples; _i3++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i3];\n var units = _sample.units;\n var nbUnits = units.length;\n var sampleLen = 0;\n\n for (var j = 0; j < nbUnits; j++) {\n sampleLen += units[j].data.length;\n }\n\n naluLen += sampleLen;\n nbNalu += nbUnits;\n _sample.length = sampleLen; // normalize PTS/DTS\n // ensure sample monotonic DTS\n\n _sample.dts = Math.max(_sample.dts, firstDTS); // ensure that computed value is greater or equal than sample DTS\n\n _sample.pts = Math.max(_sample.pts, _sample.dts, 0);\n minPTS = Math.min(_sample.pts, minPTS);\n maxPTS = Math.max(_sample.pts, maxPTS);\n }\n\n lastDTS = inputSamples[nbSamples - 1].dts;\n /* concatenate the video data and construct the mdat in place\n (need 8 more bytes to fill length and mpdat type) */\n\n var mdatSize = naluLen + 4 * nbNalu + 8;\n\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MUX_ERROR,\n details: errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR,\n fatal: false,\n bytes: mdatSize,\n reason: \"fail allocating video mdat \" + mdatSize\n });\n return;\n }\n\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n\n for (var _i4 = 0; _i4 < nbSamples; _i4++) {\n var avcSample = inputSamples[_i4];\n var avcSampleUnits = avcSample.units;\n var mp4SampleLength = 0;\n var compositionTimeOffset = void 0; // convert NALU bitstream to MP4 format (prepend NALU with size field)\n\n for (var _j = 0, _nbUnits = avcSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = avcSampleUnits[_j];\n var unitData = unit.data;\n var unitDataLen = unit.data.byteLength;\n view.setUint32(offset, unitDataLen);\n offset += 4;\n mdat.set(unitData, offset);\n offset += unitDataLen;\n mp4SampleLength += 4 + unitDataLen;\n } // expected sample duration is the Decoding Timestamp diff of consecutive samples\n\n\n if (_i4 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i4 + 1].dts - avcSample.dts;\n } else {\n var config = this.config;\n var lastFrameDuration = avcSample.dts - inputSamples[_i4 > 0 ? _i4 - 1 : _i4].dts;\n\n if (config.stretchShortVideoTrack) {\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 maxBufferHole = config.maxBufferHole;\n var gapTolerance = Math.floor(maxBufferHole * timeScale);\n var deltaToFrameEnd = (audioTrackLength ? minPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n\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\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n }\n\n logger[\"logger\"].log(\"It is approximately \" + toMsFromMpegTsClock(deltaToFrameEnd, false) + \" ms to the next segment; using duration \" + toMsFromMpegTsClock(mp4SampleDuration, false) + \" ms for the last video frame.\");\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n }\n\n compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts); // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n\n outputSamples.push({\n size: mp4SampleLength,\n // constant duration\n duration: mp4SampleDuration,\n cts: compositionTimeOffset,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: avcSample.key ? 2 : 1,\n isNonSync: avcSample.key ? 0 : 1\n }\n });\n } // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n\n\n this.nextAvcDts = lastDTS + mp4SampleDuration;\n var dropped = track.dropped;\n track.nbNalu = 0;\n track.dropped = 0;\n\n if (outputSamples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var flags = outputSamples[0].flags; // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n\n track.samples = outputSamples;\n moof = mp4_generator.moof(track.sequenceNumber++, firstDTS, track);\n track.samples = [];\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: minPTS / timeScale,\n endPTS: (maxPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: this.nextAvcDts / timeScale,\n type: 'video',\n hasAudio: false,\n hasVideo: true,\n nb: outputSamples.length,\n dropped: dropped\n };\n this.observer.trigger(events[\"default\"].FRAG_PARSING_DATA, data);\n return data;\n };\n\n _proto.remuxAudio = function remuxAudio(track, timeOffset, contiguous, accurateTimeOffset) {\n var inputTimeScale = track.inputTimeScale;\n var mp4timeScale = track.timescale;\n var scaleFactor = inputTimeScale / mp4timeScale;\n var mp4SampleDuration = track.isAAC ? 1024 : 1152;\n var inputSampleDuration = mp4SampleDuration * scaleFactor;\n var initPTS = this._initPTS;\n var rawMPEG = !track.isAAC && this.typeSupported.mpeg;\n var mp4Sample;\n var fillFrame;\n var mdat;\n var moof;\n var firstPTS;\n var lastPTS;\n var offset = rawMPEG ? 0 : 8;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nextAudioPts = this.nextAudioPts; // 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\n contiguous |= inputSamples.length && nextAudioPts && (accurateTimeOffset && Math.abs(timeOffset - nextAudioPts / inputTimeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAudioPts - initPTS) < 20 * inputSampleDuration); // compute normalized PTS\n\n inputSamples.forEach(function (sample) {\n sample.pts = sample.dts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale);\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\n inputSamples = inputSamples.filter(function (sample) {\n return sample.pts >= 0;\n }); // in case all samples have negative PTS, and have been filtered out, return now\n\n if (inputSamples.length === 0) {\n return;\n }\n\n if (!contiguous) {\n if (!accurateTimeOffset) {\n // if frag are mot contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n } else {\n // if timeOffset is accurate, let's use it as predicted next audio PTS\n nextAudioPts = Math.max(0, timeOffset * inputTimeScale);\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\n if (track.isAAC) {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length;) {\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; // If we're overlapping by more than a duration, drop this sample\n\n if (delta <= -maxAudioFramesDrift * inputSampleDuration) {\n if (contiguous || i > 0) {\n logger[\"logger\"].warn(\"Dropping 1 audio frame @ \" + toMsFromMpegTsClock(nextPts, true) / 1000 + \"s due to \" + toMsFromMpegTsClock(delta, true) + \" ms overlap.\");\n inputSamples.splice(i, 1); // Don't touch nextPtsNorm or i\n } else {\n // When changing qualities we can't trust that audio has been appended up to nextAudioPts\n // Warn about the overlap but do not drop samples as that can introduce buffer gaps\n logger[\"logger\"].warn(\"Audio frame @ \" + toMsFromMpegTsClock(pts, true) / 1000 + \"s overlaps nextAudioPts by \" + toMsFromMpegTsClock(delta, true) + \" ms.\");\n nextPts = pts + inputSampleDuration;\n i++;\n }\n } // eslint-disable-line brace-style\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 else if (delta >= maxAudioFramesDrift * inputSampleDuration && delta < MAX_SILENT_FRAME_DURATION_90KHZ && nextPts) {\n var missing = Math.round(delta / inputSampleDuration);\n logger[\"logger\"].warn(\"Injecting \" + missing + \" audio frames @ \" + toMsFromMpegTsClock(nextPts, true) / 1000 + \"s due to \" + toMsFromMpegTsClock(delta, true) + \" ms gap.\");\n\n for (var j = 0; j < missing; j++) {\n var newStamp = Math.max(nextPts, 0);\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n logger[\"logger\"].log('Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n\n inputSamples.splice(i, 0, {\n unit: fillFrame,\n pts: newStamp,\n dts: newStamp\n });\n nextPts += inputSampleDuration;\n i++;\n } // Adjust sample to next expected pts\n\n\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n } else {\n // Otherwise, just adjust pts\n if (Math.abs(delta) > 0.1 * inputSampleDuration) {// logger.log(`Invalid frame delta ${Math.round(delta + inputSampleDuration)} at PTS ${Math.round(pts / 90)} (should be ${Math.round(inputSampleDuration)}).`);\n }\n\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n }\n } // compute mdat size, as we eventually filtered/added some samples\n\n\n var nbSamples = inputSamples.length;\n var mdatSize = 0;\n\n while (nbSamples--) {\n mdatSize += inputSamples[nbSamples].unit.byteLength;\n }\n\n for (var _j2 = 0, _nbSamples = inputSamples.length; _j2 < _nbSamples; _j2++) {\n var audioSample = inputSamples[_j2];\n var unit = audioSample.unit;\n var _pts = audioSample.pts; // logger.log(`Audio/PTS:${toMsFromMpegTsClock(pts, true)}`);\n // if not first sample\n\n if (lastPTS !== undefined && mp4Sample) {\n mp4Sample.duration = Math.round((_pts - lastPTS) / scaleFactor);\n } else {\n var _delta = _pts - nextAudioPts;\n\n var numMissingFrames = 0; // if fragment are contiguous, detect hole/overlapping between fragments\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n\n if (contiguous && track.isAAC) {\n // log delta\n if (_delta) {\n if (_delta > 0 && _delta < MAX_SILENT_FRAME_DURATION_90KHZ) {\n // Q: why do we have to round here, shouldn't this always result in an integer if timestamps are correct,\n // and if not, shouldn't we actually Math.ceil() instead?\n numMissingFrames = Math.round((_pts - nextAudioPts) / inputSampleDuration);\n logger[\"logger\"].log(toMsFromMpegTsClock(_delta, true) + \" ms hole between AAC samples detected,filling it\");\n\n if (numMissingFrames > 0) {\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n fillFrame = unit.subarray();\n }\n\n mdatSize += numMissingFrames * fillFrame.length;\n } // if we have frame overlap, overlapping for more than half a frame duraion\n\n } else if (_delta < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger[\"logger\"].log(\"drop overlapping AAC sample, expected/parsed/delta: \" + toMsFromMpegTsClock(nextAudioPts, true) + \" ms / \" + toMsFromMpegTsClock(_pts, true) + \" ms / \" + toMsFromMpegTsClock(-_delta, true) + \" ms\");\n mdatSize -= unit.byteLength;\n continue;\n } // set PTS/DTS to expected PTS/DTS\n\n\n _pts = nextAudioPts;\n }\n } // remember first PTS of our audioSamples\n\n\n firstPTS = _pts;\n\n if (mdatSize > 0) {\n mdatSize += offset;\n\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MUX_ERROR,\n details: errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR,\n fatal: false,\n bytes: mdatSize,\n reason: \"fail allocating audio mdat \" + mdatSize\n });\n return;\n }\n\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n }\n } else {\n // no audio samples\n return;\n }\n\n for (var _i5 = 0; _i5 < numMissingFrames; _i5++) {\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n logger[\"logger\"].log('Unable to get silent frame for given audio codec; duplicating this frame instead.');\n fillFrame = unit.subarray();\n }\n\n mdat.set(fillFrame, offset);\n offset += fillFrame.byteLength;\n mp4Sample = {\n size: fillFrame.byteLength,\n cts: 0,\n duration: 1024,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n }\n }\n\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen; // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${audioSample.pts}/${audioSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(audioSample.pts/4294967296).toFixed(3)}');\n\n mp4Sample = {\n size: unitLen,\n cts: 0,\n duration: 0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n lastPTS = _pts;\n }\n\n var lastSampleDuration = 0;\n nbSamples = outputSamples.length; // set last sample duration as being identical to previous sample\n\n if (nbSamples >= 2) {\n lastSampleDuration = outputSamples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n\n if (nbSamples) {\n // next audio sample PTS should be equal to last sample PTS + duration\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSampleDuration; // logger.log('Audio/PTS/PTSend:' + audioSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n\n track.samples = outputSamples;\n\n if (rawMPEG) {\n moof = new Uint8Array();\n } else {\n moof = mp4_generator.moof(track.sequenceNumber++, firstPTS / scaleFactor, track);\n }\n\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: 'audio',\n hasAudio: true,\n hasVideo: false,\n nb: nbSamples\n };\n this.observer.trigger(events[\"default\"].FRAG_PARSING_DATA, audioData);\n return audioData;\n }\n\n return null;\n };\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; // sync with video's timestamp\n\n var startDTS = (nextAudioPts !== undefined ? nextAudioPts : videoData.startDTS * inputTimeScale) + this._initDTS;\n var endDTS = videoData.endDTS * inputTimeScale + this._initDTS; // one sample's duration value\n\n var sampleDuration = 1024;\n var frameDuration = scaleFactor * sampleDuration; // samples count of this segment's duration\n\n var nbSamples = Math.ceil((endDTS - startDTS) / frameDuration); // silent frame\n\n var silentFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n logger[\"logger\"].warn('remux empty Audio'); // Can't remux if we can't generate a silent frame...\n\n if (!silentFrame) {\n logger[\"logger\"].trace('Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!');\n return;\n }\n\n var samples = [];\n\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\n track.samples = samples;\n this.remuxAudio(track, timeOffset, contiguous);\n };\n\n _proto.remuxID3 = function remuxID3(track, timeOffset) {\n var length = track.samples.length;\n\n if (!length) {\n return;\n }\n\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n var initDTS = this._initDTS; // consume samples\n\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index]; // setting id3 pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n\n sample.pts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale) / inputTimeScale;\n sample.dts = PTSNormalize(sample.dts - initDTS, timeOffset * inputTimeScale) / inputTimeScale;\n }\n\n this.observer.trigger(events[\"default\"].FRAG_PARSING_METADATA, {\n samples: track.samples\n });\n track.samples = [];\n };\n\n _proto.remuxText = function remuxText(track, timeOffset) {\n var length = track.samples.length;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS; // consume samples\n\n if (length) {\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index]; // setting text pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n\n sample.pts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale) / inputTimeScale;\n }\n\n track.samples.sort(function (a, b) {\n return a.pts - b.pts;\n });\n this.observer.trigger(events[\"default\"].FRAG_PARSING_USERDATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n };\n\n return MP4Remuxer;\n}();\n\nfunction PTSNormalize(value, reference) {\n var offset;\n\n if (reference === undefined) {\n return value;\n }\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\n\n while (Math.abs(value - reference) > 4294967296) {\n value += offset;\n }\n\n return value;\n}\n\n/* harmony default export */ var mp4_remuxer = (mp4_remuxer_MP4Remuxer);\n// CONCATENATED MODULE: ./src/remux/passthrough-remuxer.js\n/**\n * passthrough remuxer\n*/\n\n\nvar passthrough_remuxer_PassThroughRemuxer = /*#__PURE__*/function () {\n function PassThroughRemuxer(observer) {\n this.observer = observer;\n }\n\n var _proto = PassThroughRemuxer.prototype;\n\n _proto.destroy = function destroy() {};\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n _proto.resetInitSegment = function resetInitSegment() {};\n\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset, rawData) {\n var observer = this.observer;\n var streamType = '';\n\n if (audioTrack) {\n streamType += 'audio';\n }\n\n if (videoTrack) {\n streamType += 'video';\n }\n\n observer.trigger(events[\"default\"].FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: streamType,\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack,\n nb: 1,\n dropped: 0\n }); // notify end of parsing\n\n observer.trigger(events[\"default\"].FRAG_PARSED);\n };\n\n return PassThroughRemuxer;\n}();\n\n/* harmony default export */ var passthrough_remuxer = (passthrough_remuxer_PassThroughRemuxer);\n// CONCATENATED MODULE: ./src/demux/demuxer-inline.js\n/**\n *\n * inline demuxer: probe fragments and instantiate\n * appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n *\n */\n\n\n\n\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar now; // performance.now() not available on WebWorker, at least on Safari Desktop\n\ntry {\n now = global.performance.now.bind(global.performance);\n} catch (err) {\n logger[\"logger\"].debug('Unable to use Performance API on this environment');\n now = global.Date.now;\n}\n\nvar demuxer_inline_DemuxerInline = /*#__PURE__*/function () {\n function DemuxerInline(observer, typeSupported, config, vendor) {\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n }\n\n var _proto = DemuxerInline.prototype;\n\n _proto.destroy = function destroy() {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.destroy();\n }\n };\n\n _proto.push = function push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var _this = this;\n\n if (data.byteLength > 0 && decryptdata != null && decryptdata.key != null && decryptdata.method === 'AES-128') {\n var decrypter = this.decrypter;\n\n if (decrypter == null) {\n decrypter = this.decrypter = new crypt_decrypter[\"default\"](this.observer, this.config);\n }\n\n var startTime = now();\n decrypter.decrypt(data, decryptdata.key.buffer, decryptdata.iv.buffer, function (decryptedData) {\n var endTime = now();\n\n _this.observer.trigger(events[\"default\"].FRAG_DECRYPTED, {\n stats: {\n tstart: startTime,\n tdecrypt: endTime\n }\n });\n\n _this.pushDecrypted(new Uint8Array(decryptedData), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n });\n } else {\n this.pushDecrypted(new Uint8Array(data), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n };\n\n _proto.pushDecrypted = function pushDecrypted(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var demuxer = this.demuxer;\n var remuxer = this.remuxer;\n\n if (!demuxer || // 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 discontinuity || trackSwitch) {\n var observer = this.observer;\n var typeSupported = this.typeSupported;\n var config = this.config; // probing order is TS/MP4/AAC/MP3\n\n var muxConfig = [{\n demux: tsdemuxer,\n remux: mp4_remuxer\n }, {\n demux: mp4demuxer[\"default\"],\n remux: passthrough_remuxer\n }, {\n demux: aacdemuxer,\n remux: mp4_remuxer\n }, {\n demux: mp3demuxer,\n remux: mp4_remuxer\n }]; // probe for content type\n\n var mux;\n\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n mux = muxConfig[i];\n\n if (mux.demux.probe(data)) {\n break;\n }\n }\n\n if (!mux) {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: true,\n reason: 'no demux matching with content found'\n });\n return;\n } // so let's check that current remuxer and demuxer are still valid\n\n\n if (!remuxer || !(remuxer instanceof mux.remux)) {\n remuxer = new mux.remux(observer, config, typeSupported, this.vendor);\n }\n\n if (!demuxer || !(demuxer instanceof mux.demux)) {\n demuxer = new mux.demux(observer, remuxer, config, typeSupported);\n this.probe = mux.demux.probe;\n }\n\n this.demuxer = demuxer;\n this.remuxer = remuxer;\n }\n\n if (discontinuity || trackSwitch) {\n demuxer.resetInitSegment(initSegment, audioCodec, videoCodec, duration);\n remuxer.resetInitSegment();\n }\n\n if (discontinuity) {\n demuxer.resetTimeStamp(defaultInitPTS);\n remuxer.resetTimeStamp(defaultInitPTS);\n }\n\n if (typeof demuxer.setDecryptData === 'function') {\n demuxer.setDecryptData(decryptdata);\n }\n\n demuxer.append(data, timeOffset, contiguous, accurateTimeOffset);\n };\n\n return DemuxerInline;\n}();\n\n/* harmony default export */ var demuxer_inline = __webpack_exports__[\"default\"] = (demuxer_inline_DemuxerInline);\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-worker.js\":\n/*!*************************************!*\\\n !*** ./src/demux/demuxer-worker.js ***!\n \\*************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/demux/demuxer.js (referenced with require.resolve) */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _demux_demuxer_inline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../demux/demuxer-inline */ \"./src/demux/demuxer-inline.js\");\n/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events */ \"./src/events.js\");\n/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_3__);\n/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\n\n\n\n\n\nvar DemuxerWorker = function DemuxerWorker(self) {\n // observer setup\n var observer = new eventemitter3__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]();\n\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function forwardMessage(ev, data) {\n self.postMessage({\n event: ev,\n data: data\n });\n };\n\n self.addEventListener('message', function (ev) {\n var data = ev.data; // console.log('demuxer cmd:' + data.cmd);\n\n switch (data.cmd) {\n case 'init':\n var config = JSON.parse(data.config);\n self.demuxer = new _demux_demuxer_inline__WEBPACK_IMPORTED_MODULE_0__[\"default\"](observer, data.typeSupported, config, data.vendor);\n Object(_utils_logger__WEBPACK_IMPORTED_MODULE_2__[\"enableLogs\"])(config.debug); // signal end of worker init\n\n forwardMessage('init', null);\n break;\n\n case 'demux':\n self.demuxer.push(data.data, data.decryptdata, data.initSegment, data.audioCodec, data.videoCodec, data.timeOffset, data.discontinuity, data.trackSwitch, data.contiguous, data.duration, data.accurateTimeOffset, data.defaultInitPTS);\n break;\n\n default:\n break;\n }\n }); // forward events to main thread\n\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_DECRYPTED, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSED, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].ERROR, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].INIT_PTS_FOUND, forwardMessage); // special case for FRAG_PARSING_DATA: pass data1/data2 as transferable object (no copy)\n\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_DATA, function (ev, data) {\n var transferable = [];\n var message = {\n event: ev,\n data: data\n };\n\n if (data.data1) {\n message.data1 = data.data1.buffer;\n transferable.push(data.data1.buffer);\n delete data.data1;\n }\n\n if (data.data2) {\n message.data2 = data.data2.buffer;\n transferable.push(data.data2.buffer);\n delete data.data2;\n }\n\n self.postMessage(message, transferable);\n });\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (DemuxerWorker);\n\n/***/ }),\n\n/***/ \"./src/demux/id3.js\":\n/*!**************************!*\\\n !*** ./src/demux/id3.js ***!\n \\**************************/\n/*! exports provided: default, utf8ArrayToStr */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8ArrayToStr\", function() { return utf8ArrayToStr; });\n/* harmony import */ var _utils_get_self_scope__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\n\n/**\n * ID3 parser\n */\n\nvar ID3 = /*#__PURE__*/function () {\n function ID3() {}\n\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 header is found\n */\n ID3.isHeader = 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\n return false;\n }\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 footer is found\n */\n ;\n\n ID3.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\n return false;\n }\n /**\n * Returns any adjacent ID3 tags found in data starting at offset, as one block of data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {Uint8Array} - The block of data containing any ID3 tags found\n */\n ;\n\n ID3.getID3Data = function getID3Data(data, offset) {\n var front = offset;\n var length = 0;\n\n while (ID3.isHeader(data, offset)) {\n // ID3 header is 10 bytes\n length += 10;\n\n var size = ID3._readSize(data, offset + 6);\n\n length += size;\n\n if (ID3.isFooter(data, offset + 10)) {\n // ID3 footer is 10 bytes\n length += 10;\n }\n\n offset += length;\n }\n\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n\n return undefined;\n };\n\n ID3._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 /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param {Uint8Array} data - Block of data containing one or more ID3 tags\n * @return {number} - The timestamp\n */\n ;\n\n ID3.getTimeStamp = function getTimeStamp(data) {\n var frames = ID3.getID3Frames(data);\n\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n\n if (ID3.isTimeStampFrame(frame)) {\n return ID3._readTimeStamp(frame);\n }\n }\n\n return undefined;\n }\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n * @param {ID3 frame} frame\n */\n ;\n\n ID3.isTimeStampFrame = function isTimeStampFrame(frame) {\n return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';\n };\n\n ID3._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\n var size = ID3._readSize(data, 4); // skip frame id, size, and flags\n\n\n var offset = 10;\n return {\n type: type,\n size: size,\n data: data.subarray(offset, offset + size)\n };\n }\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags\n * @return {ID3 frame[]} - Array of ID3 frame objects\n */\n ;\n\n ID3.getID3Frames = function getID3Frames(id3Data) {\n var offset = 0;\n var frames = [];\n\n while (ID3.isHeader(id3Data, offset)) {\n var size = ID3._readSize(id3Data, offset + 6); // skip past ID3 header\n\n\n offset += 10;\n var end = offset + size; // loop through frames in the ID3 tag\n\n while (offset + 8 < end) {\n var frameData = ID3._getFrameData(id3Data.subarray(offset));\n\n var frame = ID3._decodeFrame(frameData);\n\n if (frame) {\n frames.push(frame);\n } // skip frame header and frame data\n\n\n offset += frameData.size + 10;\n }\n\n if (ID3.isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n\n return frames;\n };\n\n ID3._decodeFrame = function _decodeFrame(frame) {\n if (frame.type === 'PRIV') {\n return ID3._decodePrivFrame(frame);\n } else if (frame.type[0] === 'T') {\n return ID3._decodeTextFrame(frame);\n } else if (frame.type[0] === 'W') {\n return ID3._decodeURLFrame(frame);\n }\n\n return undefined;\n };\n\n ID3._readTimeStamp = function _readTimeStamp(timeStampFrame) {\n if (timeStampFrame.data.byteLength === 8) {\n var data = new Uint8Array(timeStampFrame.data); // timestamp is 33 bit expressed as a big-endian eight-octet number,\n // with the upper 31 bits set to zero.\n\n var pts33Bit = data[3] & 0x1;\n var timestamp = (data[4] << 23) + (data[5] << 15) + (data[6] << 7) + data[7];\n timestamp /= 45;\n\n if (pts33Bit) {\n timestamp += 47721858.84;\n } // 2^32 / 90\n\n\n return Math.round(timestamp);\n }\n\n return undefined;\n };\n\n ID3._decodePrivFrame = function _decodePrivFrame(frame) {\n /*\n Format: <text string>\\0<binary data>\n */\n if (frame.size < 2) {\n return undefined;\n }\n\n var owner = ID3._utf8ArrayToStr(frame.data, true);\n\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\n ID3._decodeTextFrame = function _decodeTextFrame(frame) {\n if (frame.size < 2) {\n return undefined;\n }\n\n if (frame.type === 'TXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{Value}\n */\n var index = 1;\n\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index), true);\n\n index += description.length + 1;\n\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return {\n key: frame.type,\n info: description,\n data: value\n };\n } else {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = ID3._utf8ArrayToStr(frame.data.subarray(1));\n\n return {\n key: frame.type,\n data: text\n };\n }\n };\n\n ID3._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\n var index = 1;\n\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index), true);\n\n index += description.length + 1;\n\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return {\n key: frame.type,\n info: description,\n data: value\n };\n } else {\n /*\n Format:\n [0-?] = {URL}\n */\n var url = ID3._utf8ArrayToStr(frame.data);\n\n return {\n key: frame.type,\n data: url\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\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 ;\n\n ID3._utf8ArrayToStr = function _utf8ArrayToStr(array, exitOnNull) {\n if (exitOnNull === void 0) {\n exitOnNull = false;\n }\n\n var decoder = getTextDecoder();\n\n if (decoder) {\n var decoded = decoder.decode(array);\n\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 } // remove any null characters\n\n\n return decoded.replace(/\\0/g, '');\n }\n\n var len = array.length;\n var c;\n var char2;\n var char3;\n var out = '';\n var i = 0;\n\n while (i < len) {\n c = array[i++];\n\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\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\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\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 default:\n }\n }\n\n return out;\n };\n\n return ID3;\n}();\n\nvar decoder;\n\nfunction getTextDecoder() {\n var global = Object(_utils_get_self_scope__WEBPACK_IMPORTED_MODULE_0__[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\n if (!decoder && typeof global.TextDecoder !== 'undefined') {\n decoder = new global.TextDecoder('utf-8');\n }\n\n return decoder;\n}\n\nvar utf8ArrayToStr = ID3._utf8ArrayToStr;\n/* harmony default export */ __webpack_exports__[\"default\"] = (ID3);\n\n\n/***/ }),\n\n/***/ \"./src/demux/mp4demuxer.js\":\n/*!*********************************!*\\\n !*** ./src/demux/mp4demuxer.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events */ \"./src/events.js\");\n/**\n * MP4 demuxer\n */\n\n\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4Demuxer = /*#__PURE__*/function () {\n function MP4Demuxer(observer, remuxer) {\n this.observer = observer;\n this.remuxer = remuxer;\n }\n\n var _proto = MP4Demuxer.prototype;\n\n _proto.resetTimeStamp = function resetTimeStamp(initPTS) {\n this.initPTS = initPTS;\n };\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n // jshint unused:false\n if (initSegment && initSegment.byteLength) {\n var initData = this.initData = MP4Demuxer.parseInitSegment(initSegment); // default audio codec if nothing specified\n // TODO : extract that from initsegment\n\n if (audioCodec == null) {\n audioCodec = 'mp4a.40.5';\n }\n\n if (videoCodec == null) {\n videoCodec = 'avc1.42e01e';\n }\n\n var tracks = {};\n\n if (initData.audio && initData.video) {\n tracks.audiovideo = {\n container: 'video/mp4',\n codec: audioCodec + ',' + videoCodec,\n initSegment: duration ? initSegment : null\n };\n } else {\n if (initData.audio) {\n tracks.audio = {\n container: 'audio/mp4',\n codec: audioCodec,\n initSegment: duration ? initSegment : null\n };\n }\n\n if (initData.video) {\n tracks.video = {\n container: 'video/mp4',\n codec: videoCodec,\n initSegment: duration ? initSegment : null\n };\n }\n }\n\n this.observer.trigger(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_INIT_SEGMENT, {\n tracks: tracks\n });\n } else {\n if (audioCodec) {\n this.audioCodec = audioCodec;\n }\n\n if (videoCodec) {\n this.videoCodec = videoCodec;\n }\n }\n };\n\n MP4Demuxer.probe = function probe(data) {\n // ensure we find a moof box in the first 16 kB\n return MP4Demuxer.findBox({\n data: data,\n start: 0,\n end: Math.min(data.length, 16384)\n }, ['moof']).length > 0;\n };\n\n MP4Demuxer.bin2str = function bin2str(buffer) {\n return String.fromCharCode.apply(null, buffer);\n };\n\n MP4Demuxer.readUint16 = function readUint16(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 8 | buffer[offset + 1];\n return val < 0 ? 65536 + val : val;\n };\n\n MP4Demuxer.readUint32 = function readUint32(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];\n return val < 0 ? 4294967296 + val : val;\n };\n\n MP4Demuxer.writeUint32 = function writeUint32(buffer, offset, value) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\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 } // Find the data for a box specified by its path\n ;\n\n MP4Demuxer.findBox = function findBox(data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults,\n start,\n endbox;\n\n if (data.data) {\n start = data.start;\n end = data.end;\n data = data.data;\n } else {\n start = 0;\n end = data.byteLength;\n }\n\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n\n for (i = start; i < end;) {\n size = MP4Demuxer.readUint32(data, i);\n type = MP4Demuxer.bin2str(data.subarray(i + 4, i + 8));\n endbox = size > 1 ? i + size : end;\n\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({\n data: data,\n start: i + 8,\n end: endbox\n });\n } else {\n // recursively search for the next box along the path\n subresults = MP4Demuxer.findBox({\n data: data,\n start: i + 8,\n end: endbox\n }, path.slice(1));\n\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n\n i = endbox;\n } // we've finished searching all of data\n\n\n return results;\n };\n\n MP4Demuxer.parseSegmentIndex = function parseSegmentIndex(initSegment) {\n var moov = MP4Demuxer.findBox(initSegment, ['moov'])[0];\n var moovEndOffset = moov ? moov.end : null; // we need this in case we need to chop of garbage of the end of current data\n\n var index = 0;\n var sidx = MP4Demuxer.findBox(initSegment, ['sidx']);\n var references;\n\n if (!sidx || !sidx[0]) {\n return null;\n }\n\n references = [];\n sidx = sidx[0];\n var version = sidx.data[0]; // set initial offset, we skip the reference ID (not needed)\n\n index = version === 0 ? 8 : 16;\n var timescale = MP4Demuxer.readUint32(sidx, index);\n index += 4; // TODO: parse earliestPresentationTime and firstOffset\n // usually zero in our case\n\n var earliestPresentationTime = 0;\n var firstOffset = 0;\n\n if (version === 0) {\n index += 8;\n } else {\n index += 16;\n } // skip reserved\n\n\n index += 2;\n var startByte = sidx.end + firstOffset;\n var referencesCount = MP4Demuxer.readUint16(sidx, index);\n index += 2;\n\n for (var i = 0; i < referencesCount; i++) {\n var referenceIndex = index;\n var referenceInfo = MP4Demuxer.readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n var referenceSize = referenceInfo & 0x7FFFFFFF;\n var referenceType = (referenceInfo & 0x80000000) >>> 31;\n\n if (referenceType === 1) {\n console.warn('SIDX has hierarchical references (not supported)');\n return;\n }\n\n var subsegmentDuration = MP4Demuxer.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; // Skipping 1 bit for |startsWithSap|, 3 bits for |sapType|, and 28 bits\n // for |sapDelta|.\n\n referenceIndex += 4; // skip to next ref\n\n index = referenceIndex;\n }\n\n return {\n earliestPresentationTime: earliestPresentationTime,\n timescale: timescale,\n version: version,\n referencesCount: referencesCount,\n references: references,\n moovEndOffset: moovEndOffset\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 init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n ;\n\n MP4Demuxer.parseInitSegment = function parseInitSegment(initSegment) {\n var result = [];\n var traks = MP4Demuxer.findBox(initSegment, ['moov', 'trak']);\n traks.forEach(function (trak) {\n var tkhd = MP4Demuxer.findBox(trak, ['tkhd'])[0];\n\n if (tkhd) {\n var version = tkhd.data[tkhd.start];\n var index = version === 0 ? 12 : 20;\n var trackId = MP4Demuxer.readUint32(tkhd, index);\n var mdhd = MP4Demuxer.findBox(trak, ['mdia', 'mdhd'])[0];\n\n if (mdhd) {\n version = mdhd.data[mdhd.start];\n index = version === 0 ? 12 : 20;\n var timescale = MP4Demuxer.readUint32(mdhd, index);\n var hdlr = MP4Demuxer.findBox(trak, ['mdia', 'hdlr'])[0];\n\n if (hdlr) {\n var hdlrType = MP4Demuxer.bin2str(hdlr.data.subarray(hdlr.start + 8, hdlr.start + 12));\n var type = {\n 'soun': 'audio',\n 'vide': 'video'\n }[hdlrType];\n\n if (type) {\n // extract codec info. TODO : parse codec details to be able to build MIME type\n var codecBox = MP4Demuxer.findBox(trak, ['mdia', 'minf', 'stbl', 'stsd']);\n\n if (codecBox.length) {\n codecBox = codecBox[0];\n var codecType = MP4Demuxer.bin2str(codecBox.data.subarray(codecBox.start + 12, codecBox.start + 16));\n _utils_logger__WEBPACK_IMPORTED_MODULE_0__[\"logger\"].log(\"MP4Demuxer:\" + type + \":\" + codecType + \" found\");\n }\n\n result[trackId] = {\n timescale: timescale,\n type: type\n };\n result[type] = {\n timescale: timescale,\n id: trackId\n };\n }\n }\n }\n }\n });\n return result;\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 timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n ;\n\n MP4Demuxer.getStartDTS = function getStartDTS(initData, fragment) {\n var trafs, baseTimes, result; // we need info from two childrend of each track fragment box\n\n trafs = MP4Demuxer.findBox(fragment, ['moof', 'traf']); // determine the start times for each track\n\n baseTimes = [].concat.apply([], trafs.map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n var id, scale, baseTime; // get the track id from the tfhd\n\n id = MP4Demuxer.readUint32(tfhd, 4); // assume a 90kHz clock if no timescale was specified\n\n scale = initData[id].timescale || 90e3; // get the base media decode time from the tfdt\n\n baseTime = MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version, result;\n version = tfdt.data[tfdt.start];\n result = MP4Demuxer.readUint32(tfdt, 4);\n\n if (version === 1) {\n result *= Math.pow(2, 32);\n result += MP4Demuxer.readUint32(tfdt, 8);\n }\n\n return result;\n })[0]; // convert base time to seconds\n\n return baseTime / scale;\n });\n })); // return the minimum\n\n result = Math.min.apply(null, baseTimes);\n return isFinite(result) ? result : 0;\n };\n\n MP4Demuxer.offsetStartDTS = function offsetStartDTS(initData, fragment, timeOffset) {\n MP4Demuxer.findBox(fragment, ['moof', 'traf']).map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n // get the track id from the tfhd\n var id = MP4Demuxer.readUint32(tfhd, 4); // assume a 90kHz clock if no timescale was specified\n\n var timescale = initData[id].timescale || 90e3; // get the base media decode time from the tfdt\n\n MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt.data[tfdt.start];\n var baseMediaDecodeTime = MP4Demuxer.readUint32(tfdt, 4);\n\n if (version === 0) {\n MP4Demuxer.writeUint32(tfdt, 4, baseMediaDecodeTime - timeOffset * timescale);\n } else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += MP4Demuxer.readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n MP4Demuxer.writeUint32(tfdt, 4, upper);\n MP4Demuxer.writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var initData = this.initData;\n\n if (!initData) {\n this.resetInitSegment(data, this.audioCodec, this.videoCodec, false);\n initData = this.initData;\n }\n\n var startDTS,\n initPTS = this.initPTS;\n\n if (initPTS === undefined) {\n var _startDTS = MP4Demuxer.getStartDTS(initData, data);\n\n this.initPTS = initPTS = _startDTS - timeOffset;\n this.observer.trigger(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n\n MP4Demuxer.offsetStartDTS(initData, data, initPTS);\n startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.remuxer.remux(initData.audio, initData.video, null, null, startDTS, contiguous, accurateTimeOffset, data);\n };\n\n _proto.destroy = function destroy() {};\n\n return MP4Demuxer;\n}();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (MP4Demuxer);\n\n/***/ }),\n\n/***/ \"./src/errors.ts\":\n/*!***********************!*\\\n !*** ./src/errors.ts ***!\n \\***********************/\n/*! exports provided: ErrorTypes, ErrorDetails */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ErrorTypes\", function() { return ErrorTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ErrorDetails\", function() { return ErrorDetails; });\nvar ErrorTypes;\n/**\n * @enum {ErrorDetails}\n * @typedef {string} ErrorDetail\n */\n\n(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})(ErrorTypes || (ErrorTypes = {}));\n\nvar ErrorDetails;\n\n(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_LICENSE_REQUEST_FAILED\"] = \"keySystemLicenseRequestFailed\";\n ErrorDetails[\"KEY_SYSTEM_NO_INIT_DATA\"] = \"keySystemNoInitData\";\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_SWITCH_ERROR\"] = \"levelSwitchError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_ERROR\"] = \"audioTrackLoadError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_TIMEOUT\"] = \"audioTrackLoadTimeOut\";\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[\"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_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 || (ErrorDetails = {}));\n\n/***/ }),\n\n/***/ \"./src/events.js\":\n/*!***********************!*\\\n !*** ./src/events.js ***!\n \\***********************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/**\n * @readonly\n * @enum {string}\n */\nvar HlsEvents = {\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be reset - data: { }\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when sourcebuffers have been created - data: { tracks : tracks }\n BUFFER_CREATED: 'hlsBufferCreated',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer - data : { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent}\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data - data: { }\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data { startOffset, endOffset }\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media buffer has been flushed - data: { }\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels], audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels], firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCHING: 'hlsLevelSwitching',\n // fired when a level switch is effective - data: { level : id of new level }\n LEVEL_SWITCHED: 'hlsLevelSwitched',\n // fired when a level playlist loading starts - data: { url : level URL, level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired to notify that levels have changed after removing a level - data: { levels : [available quality levels] }\n LEVELS_UPDATED: 'hlsLevelsUpdated',\n // fired to notify that audio track lists has been updated - data: { audioTracks : audioTracks }\n AUDIO_TRACKS_UPDATED: 'hlsAudioTracksUpdated',\n // fired when an audio track switching is requested - data: { id : audio track id }\n AUDIO_TRACK_SWITCHING: 'hlsAudioTrackSwitching',\n // fired when an audio track switch actually occurs - data: { id : audio track id }\n AUDIO_TRACK_SWITCHED: 'hlsAudioTrackSwitched',\n // fired when an audio track loading starts - data: { url : audio track URL, id : audio track id }\n AUDIO_TRACK_LOADING: 'hlsAudioTrackLoading',\n // fired when an audio track loading finishes - data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } }\n AUDIO_TRACK_LOADED: 'hlsAudioTrackLoaded',\n // fired to notify that subtitle track lists has been updated - data: { subtitleTracks : subtitleTracks }\n SUBTITLE_TRACKS_UPDATED: 'hlsSubtitleTracksUpdated',\n // fired when an subtitle track switch occurs - data: { id : subtitle track id }\n SUBTITLE_TRACK_SWITCH: 'hlsSubtitleTrackSwitch',\n // fired when a subtitle track loading starts - data: { url : subtitle track URL, id : subtitle track id }\n SUBTITLE_TRACK_LOADING: 'hlsSubtitleTrackLoading',\n // fired when a subtitle track loading finishes - data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } }\n SUBTITLE_TRACK_LOADED: 'hlsSubtitleTrackLoaded',\n // fired when a subtitle fragment has been processed - data: { success : boolean, frag : the processed frag }\n SUBTITLE_FRAG_PROCESSED: 'hlsSubtitleFragProcessed',\n // fired when a set of VTTCues to be managed externally has been parsed - data: { type: string, track: string, cues: [ VTTCue ] }\n CUES_PARSED: 'hlsCuesParsed',\n // fired when a text track to be managed externally is found - data: { tracks: [ { label: string, kind: string, default: boolean } ] }\n NON_NATIVE_TEXT_TRACKS_FOUND: 'hlsNonNativeTextTracksFound',\n // fired when the first timestamp is found - data: { id : demuxer id, initPTS: initPTS, frag : fragment object }\n INIT_PTS_FOUND: 'hlsInitPtsFound',\n // fired when a fragment loading starts - data: { frag : fragment object }\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded } }\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: { frag : fragment object }\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length } }\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when a fragment has finished decrypting - data: { id : demuxer id, frag: fragment object, payload : fragment payload, stats : { tstart, tdecrypt } }\n FRAG_DECRYPTED: 'hlsFragDecrypted',\n // fired when Init Segment has been extracted from fragment - data: { id : demuxer id, frag: fragment object, moov : moov MP4 box, codecs : codecs found while parsing fragment }\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { id : demuxer id, frag: fragment object, samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { id : demuxer id, frag: fragment object, data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: { id : demuxer id, frag: fragment object }\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { id : demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length, bwEstimate } }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { id : demuxer id, frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: { curentDropped, currentDecoded, totalDroppedFrames }\n FPS_DROP: 'hlsFpsDrop',\n // triggered when FPS drop triggers auto level capping - data: { level, droppedlevel }\n FPS_DROP_LEVEL_CAPPING: 'hlsFpsDropLevelCapping',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data }\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example - data: { }\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object }\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length } }\n KEY_LOADED: 'hlsKeyLoaded',\n // fired upon stream controller state transitions - data: { previousState, nextState }\n STREAM_STATE_TRANSITION: 'hlsStreamStateTransition',\n // fired when the live back buffer is reached defined by the liveBackBufferLength config option - data : { bufferEnd: number }\n LIVE_BACK_BUFFER_REACHED: 'hlsLiveBackBufferReached'\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (HlsEvents);\n\n/***/ }),\n\n/***/ \"./src/hls.ts\":\n/*!*********************************!*\\\n !*** ./src/hls.ts + 50 modules ***!\n \\*********************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */\n/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, \"default\", function() { return /* binding */ hls_Hls; });\n\n// NAMESPACE OBJECT: ./src/utils/cues.ts\nvar cues_namespaceObject = {};\n__webpack_require__.r(cues_namespaceObject);\n__webpack_require__.d(cues_namespaceObject, \"newCue\", function() { return newCue; });\n\n// EXTERNAL MODULE: ./node_modules/url-toolkit/src/url-toolkit.js\nvar url_toolkit = __webpack_require__(\"./node_modules/url-toolkit/src/url-toolkit.js\");\n\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/polyfills/number.js\nvar number = __webpack_require__(\"./src/polyfills/number.js\");\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// CONCATENATED MODULE: ./src/event-handler.ts\n/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\n\n\nvar FORBIDDEN_EVENT_NAMES = {\n 'hlsEventGeneric': true,\n 'hlsHandlerDestroying': true,\n 'hlsHandlerDestroyed': true\n};\n\nvar event_handler_EventHandler = /*#__PURE__*/function () {\n function EventHandler(hls) {\n this.hls = void 0;\n this.handledEvents = void 0;\n this.useGenericHandler = void 0;\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n\n for (var _len = arguments.length, events = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n this.handledEvents = events;\n this.useGenericHandler = true;\n this.registerListeners();\n }\n\n var _proto = EventHandler.prototype;\n\n _proto.destroy = function destroy() {\n this.onHandlerDestroying();\n this.unregisterListeners();\n this.onHandlerDestroyed();\n };\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {};\n\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {};\n\n _proto.isEventHandler = function isEventHandler() {\n return typeof this.handledEvents === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n };\n\n _proto.registerListeners = function registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n if (FORBIDDEN_EVENT_NAMES[event]) {\n throw new Error('Forbidden event-name: ' + event);\n }\n\n this.hls.on(event, this.onEvent);\n }, this);\n }\n };\n\n _proto.unregisterListeners = function unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n this.hls.off(event, this.onEvent);\n }, this);\n }\n }\n /**\n * arguments: event (string), data (any)\n */\n ;\n\n _proto.onEvent = function onEvent(event, data) {\n this.onEventGeneric(event, data);\n };\n\n _proto.onEventGeneric = function onEventGeneric(event, data) {\n var eventToFunction = function eventToFunction(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n\n if (typeof this[funcName] !== 'function') {\n throw new Error(\"Event \" + event + \" has no generic handler in this \" + this.constructor.name + \" class (tried \" + funcName + \")\");\n }\n\n return this[funcName].bind(this, data);\n };\n\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger[\"logger\"].error(\"An internal error happened while handling event \" + event + \". Error message: \\\"\" + err.message + \"\\\". Here is a stacktrace:\", err);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].INTERNAL_EXCEPTION,\n fatal: false,\n event: event,\n err: err\n });\n }\n };\n\n return EventHandler;\n}();\n\n/* harmony default export */ var event_handler = (event_handler_EventHandler);\n// CONCATENATED MODULE: ./src/types/loader.ts\n/**\n * `type` property values for this loaders' context object\n * @enum\n *\n */\nvar PlaylistContextType;\n/**\n * @enum {string}\n */\n\n(function (PlaylistContextType) {\n PlaylistContextType[\"MANIFEST\"] = \"manifest\";\n PlaylistContextType[\"LEVEL\"] = \"level\";\n PlaylistContextType[\"AUDIO_TRACK\"] = \"audioTrack\";\n PlaylistContextType[\"SUBTITLE_TRACK\"] = \"subtitleTrack\";\n})(PlaylistContextType || (PlaylistContextType = {}));\n\nvar PlaylistLevelType;\n\n(function (PlaylistLevelType) {\n PlaylistLevelType[\"MAIN\"] = \"main\";\n PlaylistLevelType[\"AUDIO\"] = \"audio\";\n PlaylistLevelType[\"SUBTITLE\"] = \"subtitle\";\n})(PlaylistLevelType || (PlaylistLevelType = {}));\n// EXTERNAL MODULE: ./src/demux/mp4demuxer.js\nvar mp4demuxer = __webpack_require__(\"./src/demux/mp4demuxer.js\");\n\n// CONCATENATED MODULE: ./src/loader/level-key.ts\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\nvar level_key_LevelKey = /*#__PURE__*/function () {\n function LevelKey(baseURI, relativeURI) {\n this._uri = null;\n this.baseuri = void 0;\n this.reluri = void 0;\n this.method = null;\n this.key = null;\n this.iv = null;\n this.baseuri = baseURI;\n this.reluri = relativeURI;\n }\n\n _createClass(LevelKey, [{\n key: \"uri\",\n get: function get() {\n if (!this._uri && this.reluri) {\n this._uri = Object(url_toolkit[\"buildAbsoluteURL\"])(this.baseuri, this.reluri, {\n alwaysNormalize: true\n });\n }\n\n return this._uri;\n }\n }]);\n\n return LevelKey;\n}();\n\n\n// CONCATENATED MODULE: ./src/loader/fragment.ts\n\n\n\nfunction fragment_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction fragment_createClass(Constructor, protoProps, staticProps) { if (protoProps) fragment_defineProperties(Constructor.prototype, protoProps); if (staticProps) fragment_defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\nvar ElementaryStreamTypes;\n\n(function (ElementaryStreamTypes) {\n ElementaryStreamTypes[\"AUDIO\"] = \"audio\";\n ElementaryStreamTypes[\"VIDEO\"] = \"video\";\n})(ElementaryStreamTypes || (ElementaryStreamTypes = {}));\n\nvar fragment_Fragment = /*#__PURE__*/function () {\n function Fragment() {\n var _this$_elementaryStre;\n\n this._url = null;\n this._byteRange = null;\n this._decryptdata = null;\n this._elementaryStreams = (_this$_elementaryStre = {}, _this$_elementaryStre[ElementaryStreamTypes.AUDIO] = false, _this$_elementaryStre[ElementaryStreamTypes.VIDEO] = false, _this$_elementaryStre);\n this.deltaPTS = 0;\n this.rawProgramDateTime = null;\n this.programDateTime = null;\n this.title = null;\n this.tagList = [];\n this.cc = void 0;\n this.type = void 0;\n this.relurl = void 0;\n this.baseurl = void 0;\n this.duration = void 0;\n this.start = void 0;\n this.sn = 0;\n this.urlId = 0;\n this.level = 0;\n this.levelkey = void 0;\n this.loader = void 0;\n }\n\n var _proto = Fragment.prototype;\n\n // setByteRange converts a EXT-X-BYTERANGE attribute into a two element array\n _proto.setByteRange = function setByteRange(value, previousFrag) {\n var params = value.split('@', 2);\n var byteRange = [];\n\n if (params.length === 1) {\n byteRange[0] = previousFrag ? previousFrag.byteRangeEndOffset : 0;\n } else {\n byteRange[0] = parseInt(params[1]);\n }\n\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n this._byteRange = byteRange;\n };\n\n /**\n * @param {ElementaryStreamTypes} type\n */\n _proto.addElementaryStream = function addElementaryStream(type) {\n this._elementaryStreams[type] = true;\n }\n /**\n * @param {ElementaryStreamTypes} type\n */\n ;\n\n _proto.hasElementaryStream = function hasElementaryStream(type) {\n return this._elementaryStreams[type] === true;\n }\n /**\n * Utility method for parseLevelPlaylist to create an initialization vector for a given segment\n * @param {number} segmentNumber - segment number to generate IV with\n * @returns {Uint8Array}\n */\n ;\n\n _proto.createInitializationVector = function createInitializationVector(segmentNumber) {\n var uint8View = new Uint8Array(16);\n\n for (var i = 12; i < 16; i++) {\n uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff;\n }\n\n return uint8View;\n }\n /**\n * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data\n * @param levelkey - a playlist's encryption info\n * @param segmentNumber - the fragment's segment number\n * @returns {LevelKey} - an object to be applied as a fragment's decryptdata\n */\n ;\n\n _proto.setDecryptDataFromLevelKey = function setDecryptDataFromLevelKey(levelkey, segmentNumber) {\n var decryptdata = levelkey;\n\n if ((levelkey === null || levelkey === void 0 ? void 0 : levelkey.method) && levelkey.uri && !levelkey.iv) {\n decryptdata = new level_key_LevelKey(levelkey.baseuri, levelkey.reluri);\n decryptdata.method = levelkey.method;\n decryptdata.iv = this.createInitializationVector(segmentNumber);\n }\n\n return decryptdata;\n };\n\n fragment_createClass(Fragment, [{\n key: \"url\",\n get: function get() {\n if (!this._url && this.relurl) {\n this._url = Object(url_toolkit[\"buildAbsoluteURL\"])(this.baseurl, this.relurl, {\n alwaysNormalize: true\n });\n }\n\n return this._url;\n },\n set: function set(value) {\n this._url = value;\n }\n }, {\n key: \"byteRange\",\n get: function get() {\n if (!this._byteRange) {\n return [];\n }\n\n return this._byteRange;\n }\n /**\n * @type {number}\n */\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: \"decryptdata\",\n get: function get() {\n if (!this.levelkey && !this._decryptdata) {\n return null;\n }\n\n if (!this._decryptdata && this.levelkey) {\n var sn = this.sn;\n\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.levelkey && this.levelkey.method === 'AES-128' && !this.levelkey.iv) {\n logger[\"logger\"].warn(\"missing IV for initialization segment with method=\\\"\" + this.levelkey.method + \"\\\" - compliance issue\");\n }\n /*\n Be converted to a Number.\n 'initSegment' will become NaN.\n NaN, which when converted through ToInt32() -> +0.\n ---\n Explicitly set sn to resulting value from implicit conversions 'initSegment' values for IV generation.\n */\n\n\n sn = 0;\n }\n\n this._decryptdata = this.setDecryptDataFromLevelKey(this.levelkey, sn);\n }\n\n return this._decryptdata;\n }\n }, {\n key: \"endProgramDateTime\",\n get: function get() {\n if (this.programDateTime === null) {\n return null;\n }\n\n if (!Object(number[\"isFiniteNumber\"])(this.programDateTime)) {\n return null;\n }\n\n var duration = !Object(number[\"isFiniteNumber\"])(this.duration) ? 0 : this.duration;\n return this.programDateTime + duration * 1000;\n }\n }, {\n key: \"encrypted\",\n get: function get() {\n return !!(this.decryptdata && this.decryptdata.uri !== null && this.decryptdata.key === null);\n }\n }]);\n\n return Fragment;\n}();\n\n\n// CONCATENATED MODULE: ./src/loader/level.js\n\n\nfunction level_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction level_createClass(Constructor, protoProps, staticProps) { if (protoProps) level_defineProperties(Constructor.prototype, protoProps); if (staticProps) level_defineProperties(Constructor, staticProps); return Constructor; }\n\nvar level_Level = /*#__PURE__*/function () {\n function Level(baseUrl) {\n // Please keep properties in alphabetical order\n this.endCC = 0;\n this.endSN = 0;\n this.fragments = [];\n this.initSegment = null;\n this.live = true;\n this.needSidxRanges = false;\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 = baseUrl;\n this.version = null;\n }\n\n level_createClass(Level, [{\n key: \"hasProgramDateTime\",\n get: function get() {\n return !!(this.fragments[0] && Object(number[\"isFiniteNumber\"])(this.fragments[0].programDateTime));\n }\n }]);\n\n return Level;\n}();\n\n\n// CONCATENATED MODULE: ./src/utils/attr-list.js\nvar DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/; // eslint-disable-line no-useless-escape\n\nvar ATTR_LIST_REGEX = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g; // eslint-disable-line no-useless-escape\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\n\nvar AttrList = /*#__PURE__*/function () {\n function AttrList(attrs) {\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n\n var _proto = AttrList.prototype;\n\n _proto.decimalInteger = function decimalInteger(attrName) {\n var intValue = parseInt(this[attrName], 10);\n\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n\n return intValue;\n };\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\n for (var i = 0; i < stringValue.length / 2; i++) {\n value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16);\n }\n\n return value;\n } else {\n return null;\n }\n };\n\n _proto.hexadecimalIntegerAsNumber = function hexadecimalIntegerAsNumber(attrName) {\n var intValue = parseInt(this[attrName], 16);\n\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n\n return intValue;\n };\n\n _proto.decimalFloatingPoint = function decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n };\n\n _proto.enumeratedString = function enumeratedString(attrName) {\n return this[attrName];\n };\n\n _proto.decimalResolution = function decimalResolution(attrName) {\n var res = DECIMAL_RESOLUTION_REGEX.exec(this[attrName]);\n\n if (res === null) {\n return undefined;\n }\n\n return {\n width: parseInt(res[1], 10),\n height: parseInt(res[2], 10)\n };\n };\n\n AttrList.parseAttrList = function parseAttrList(input) {\n var match,\n attrs = {};\n ATTR_LIST_REGEX.lastIndex = 0;\n\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2],\n quote = '\"';\n\n if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) {\n value = value.slice(1, -1);\n }\n\n attrs[match[1]] = value;\n }\n\n return attrs;\n };\n\n return AttrList;\n}();\n\n/* harmony default export */ var attr_list = (AttrList);\n// CONCATENATED MODULE: ./src/utils/codecs.ts\n// from http://mp4ra.org/codecs.html\nvar sampleEntryCodesISO = {\n audio: {\n 'a3ds': true,\n 'ac-3': true,\n 'ac-4': true,\n 'alac': true,\n 'alaw': true,\n 'dra1': true,\n 'dts+': true,\n 'dts-': true,\n 'dtsc': true,\n 'dtse': true,\n 'dtsh': true,\n 'ec-3': true,\n 'enca': true,\n 'g719': true,\n 'g726': true,\n 'm4ae': true,\n 'mha1': true,\n 'mha2': true,\n 'mhm1': true,\n 'mhm2': true,\n 'mlpa': true,\n 'mp4a': true,\n 'raw ': true,\n 'Opus': true,\n 'samr': true,\n 'sawb': true,\n 'sawp': true,\n 'sevc': true,\n 'sqcp': true,\n 'ssmv': true,\n 'twos': true,\n 'ulaw': true\n },\n video: {\n 'avc1': true,\n 'avc2': true,\n 'avc3': true,\n 'avc4': true,\n 'avcp': true,\n 'drac': true,\n 'dvav': true,\n 'dvhe': true,\n 'encv': true,\n 'hev1': true,\n 'hvc1': true,\n 'mjp2': true,\n 'mp4v': true,\n 'mvc1': true,\n 'mvc2': true,\n 'mvc3': true,\n 'mvc4': true,\n 'resv': true,\n 'rv60': true,\n 's263': true,\n 'svc1': true,\n 'svc2': true,\n 'vc-1': true,\n 'vp08': true,\n 'vp09': true\n }\n};\n\nfunction isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n}\n\nfunction isCodecSupportedInMp4(codec, type) {\n return MediaSource.isTypeSupported((type || 'video') + \"/mp4;codecs=\\\"\" + codec + \"\\\"\");\n}\n\n\n// CONCATENATED MODULE: ./src/loader/m3u8-parser.ts\n\n\n\n\n\n\n\n\n\n\n\n/**\n * M3U8 parser\n * @module\n */\n// https://regex101.com is your friend\nvar MASTER_PLAYLIST_REGEX = /(?:#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)|#EXT-X-SESSION-DATA:([^\\n\\r]*)[\\r\\n]+)/g;\nvar MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\nvar LEVEL_PLAYLIST_REGEX_FAST = new RegExp([/#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source, // duration (#EXTINF:<duration>,<title>), group 1 => duration, group 2 => title\n/|(?!#)([\\S+ ?]+)/.source, // segment URI, group 3 => the URI (note newline is not eaten)\n/|#EXT-X-BYTERANGE:*(.+)/.source, // next segment's byterange, group 4 => range spec (x@y)\n/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, // 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');\nvar LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\\d+))|(?:#EXT-X-(TARGETDURATION): *(\\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\\r?\\n?/;\nvar MP4_REGEX_SUFFIX = /\\.(mp4|m4s|m4v|m4a)$/i;\n\nvar m3u8_parser_M3U8Parser = /*#__PURE__*/function () {\n function M3U8Parser() {}\n\n M3U8Parser.findGroup = function findGroup(groups, mediaGroupId) {\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n\n if (group.id === mediaGroupId) {\n return group;\n }\n }\n };\n\n M3U8Parser.convertAVC1ToAVCOTI = function convertAVC1ToAVCOTI(codec) {\n var avcdata = codec.split('.');\n var result;\n\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n } else {\n result = codec;\n }\n\n return result;\n };\n\n M3U8Parser.resolve = function resolve(url, baseUrl) {\n return url_toolkit[\"buildAbsoluteURL\"](baseUrl, url, {\n alwaysNormalize: true\n });\n };\n\n M3U8Parser.parseMasterPlaylist = function parseMasterPlaylist(string, baseurl) {\n // TODO(typescript-level)\n var levels = [];\n var sessionData = {};\n var hasSessionData = false;\n MASTER_PLAYLIST_REGEX.lastIndex = 0; // TODO(typescript-level)\n\n function setCodecs(codecs, level) {\n ['video', 'audio'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) {\n return isCodecType(codec, type);\n });\n\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + \"Codec\"] = preferred.length > 0 ? preferred[0] : filtered[0]; // remove from list\n\n codecs = codecs.filter(function (codec) {\n return filtered.indexOf(codec) === -1;\n });\n }\n });\n level.unknownCodecs = codecs;\n }\n\n var result;\n\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n if (result[1]) {\n // '#EXT-X-STREAM-INF' is found, parse level tag in group 1\n // TODO(typescript-level)\n var level = {};\n var attrs = level.attrs = new attr_list(result[1]);\n level.url = M3U8Parser.resolve(result[2], baseurl);\n var resolution = attrs.decimalResolution('RESOLUTION');\n\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);\n\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);\n }\n\n levels.push(level);\n } else if (result[3]) {\n // '#EXT-X-SESSION-DATA' is found, parse session data in group 3\n var sessionAttrs = new attr_list(result[3]);\n\n if (sessionAttrs['DATA-ID']) {\n hasSessionData = true;\n sessionData[sessionAttrs['DATA-ID']] = sessionAttrs;\n }\n }\n }\n\n return {\n levels: levels,\n sessionData: hasSessionData ? sessionData : null\n };\n };\n\n M3U8Parser.parseMasterPlaylistMedia = function parseMasterPlaylistMedia(string, baseurl, type, audioGroups) {\n if (audioGroups === void 0) {\n audioGroups = [];\n }\n\n var result;\n var medias = [];\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var attrs = new attr_list(result[1]);\n\n if (attrs.TYPE === type) {\n var media = {\n attrs: attrs,\n id: id++,\n groupId: attrs['GROUP-ID'],\n instreamId: attrs['INSTREAM-ID'],\n name: attrs.NAME || attrs.LANGUAGE,\n type: type,\n default: attrs.DEFAULT === 'YES',\n autoselect: attrs.AUTOSELECT === 'YES',\n forced: attrs.FORCED === 'YES',\n lang: attrs.LANGUAGE\n };\n\n if (attrs.URI) {\n media.url = M3U8Parser.resolve(attrs.URI, baseurl);\n }\n\n if (audioGroups.length) {\n // If there are audio groups signalled in the manifest, let's look for a matching codec string for this track\n var groupCodec = M3U8Parser.findGroup(audioGroups, media.groupId); // If we don't find the track signalled, lets use the first audio groups codec we have\n // Acting as a best guess\n\n media.audioCodec = groupCodec ? groupCodec.codec : audioGroups[0].codec;\n }\n\n medias.push(media);\n }\n }\n\n return medias;\n };\n\n M3U8Parser.parseLevelPlaylist = function parseLevelPlaylist(string, baseurl, id, type, levelUrlId) {\n var currentSN = 0;\n var totalduration = 0;\n var level = new level_Level(baseurl);\n var discontinuityCounter = 0;\n var prevFrag = null;\n var frag = new fragment_Fragment();\n var result;\n var i;\n var levelkey;\n var firstPdtIndex = null;\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\n var duration = result[1];\n\n if (duration) {\n // INF\n frag.duration = parseFloat(duration); // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\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 (Object(number[\"isFiniteNumber\"])(frag.duration)) {\n var sn = currentSN++;\n frag.type = type;\n frag.start = totalduration;\n\n if (levelkey) {\n frag.levelkey = levelkey;\n }\n\n frag.sn = sn;\n frag.level = id;\n frag.cc = discontinuityCounter;\n frag.urlId = levelUrlId;\n frag.baseurl = baseurl; // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\n frag.relurl = (' ' + result[3]).slice(1);\n assignProgramDateTime(frag, prevFrag);\n level.fragments.push(frag);\n prevFrag = frag;\n totalduration += frag.duration;\n frag = new fragment_Fragment();\n }\n } else if (result[4]) {\n // X-BYTERANGE\n var data = (' ' + result[4]).slice(1);\n\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\n if (firstPdtIndex === null) {\n firstPdtIndex = level.fragments.length;\n }\n } else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n\n if (!result) {\n logger[\"logger\"].warn('No matches on slow regex match for level playlist!');\n continue;\n }\n\n for (i = 1; i < result.length; i++) {\n if (typeof result[i] !== 'undefined') {\n break;\n }\n } // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\n\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = (' ' + result[i + 2]).slice(1);\n\n switch (result[i]) {\n case '#':\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n break;\n\n case 'PLAYLIST-TYPE':\n level.type = value1.toUpperCase();\n break;\n\n case 'MEDIA-SEQUENCE':\n currentSN = level.startSN = parseInt(value1);\n break;\n\n case 'TARGETDURATION':\n level.targetduration = parseFloat(value1);\n break;\n\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n\n case 'EXTM3U':\n break;\n\n case 'ENDLIST':\n level.live = false;\n break;\n\n case 'DIS':\n discontinuityCounter++;\n frag.tagList.push(['DIS']);\n break;\n\n case 'DISCONTINUITY-SEQ':\n discontinuityCounter = parseInt(value1);\n break;\n\n case 'KEY':\n {\n // https://tools.ietf.org/html/rfc8216#section-4.3.2.4\n var decryptparams = value1;\n var keyAttrs = new attr_list(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD');\n var decrypturi = keyAttrs.URI;\n var decryptiv = keyAttrs.hexadecimalInteger('IV'); // From RFC: This attribute is OPTIONAL; its absence indicates an implicit value of \"identity\".\n\n var decryptkeyformat = keyAttrs.KEYFORMAT || 'identity';\n\n if (decryptkeyformat === 'com.apple.streamingkeydelivery') {\n logger[\"logger\"].warn('Keyformat com.apple.streamingkeydelivery is not supported');\n continue;\n }\n\n if (decryptmethod) {\n levelkey = new level_key_LevelKey(baseurl, decrypturi);\n\n if (decrypturi && ['AES-128', 'SAMPLE-AES', 'SAMPLE-AES-CENC'].indexOf(decryptmethod) >= 0) {\n levelkey.method = decryptmethod;\n levelkey.key = null; // Initialization Vector (IV)\n\n levelkey.iv = decryptiv;\n }\n }\n\n break;\n }\n\n case 'START':\n {\n var startAttrs = new attr_list(value1);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET'); // TIME-OFFSET can be 0\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n level.startTimeOffset = startTimeOffset;\n }\n\n break;\n }\n\n case 'MAP':\n {\n var mapAttrs = new attr_list(value1);\n frag.relurl = mapAttrs.URI;\n\n if (mapAttrs.BYTERANGE) {\n frag.setByteRange(mapAttrs.BYTERANGE);\n }\n\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n frag = new fragment_Fragment();\n frag.rawProgramDateTime = level.initSegment.rawProgramDateTime;\n break;\n }\n\n default:\n logger[\"logger\"].warn(\"line parsed but not handled: \" + result);\n break;\n }\n }\n }\n\n frag = prevFrag; // logger.log('found ' + level.fragments.length + ' fragments');\n\n if (frag && !frag.relurl) {\n level.fragments.pop();\n totalduration -= frag.duration;\n }\n\n level.totalduration = totalduration;\n level.averagetargetduration = totalduration / level.fragments.length;\n level.endSN = currentSN - 1;\n level.startCC = level.fragments[0] ? level.fragments[0].cc : 0;\n level.endCC = discontinuityCounter;\n\n if (!level.initSegment && level.fragments.length) {\n // this is a bit lurky but HLS really has no other way to tell us\n // if the fragments are TS or MP4, except if we download them :/\n // but this is to be able to handle SIDX.\n if (level.fragments.every(function (frag) {\n return MP4_REGEX_SUFFIX.test(frag.relurl);\n })) {\n logger[\"logger\"].warn('MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX');\n frag = new fragment_Fragment();\n frag.relurl = level.fragments[0].relurl;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n level.needSidxRanges = true;\n }\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\n\n if (firstPdtIndex) {\n backfillProgramDateTimes(level.fragments, firstPdtIndex);\n }\n\n return level;\n };\n\n return M3U8Parser;\n}();\n\n\n\nfunction backfillProgramDateTimes(fragments, startIndex) {\n var fragPrev = fragments[startIndex];\n\n for (var i = startIndex - 1; i >= 0; i--) {\n var frag = fragments[i];\n frag.programDateTime = fragPrev.programDateTime - frag.duration * 1000;\n fragPrev = frag;\n }\n}\n\nfunction assignProgramDateTime(frag, prevFrag) {\n if (frag.rawProgramDateTime) {\n frag.programDateTime = Date.parse(frag.rawProgramDateTime);\n } else if (prevFrag === null || prevFrag === void 0 ? void 0 : prevFrag.programDateTime) {\n frag.programDateTime = prevFrag.endProgramDateTime;\n }\n\n if (!Object(number[\"isFiniteNumber\"])(frag.programDateTime)) {\n frag.programDateTime = null;\n frag.rawProgramDateTime = null;\n }\n}\n// CONCATENATED MODULE: ./src/loader/playlist-loader.ts\n\n\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.\n *\n * Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.\n *\n * Uses loader(s) set in config to do actual internal loading of resource tasks.\n *\n * @module\n *\n */\n\n\n\n\n\n\n\nvar _window = window,\n performance = _window.performance;\n/**\n * @constructor\n */\n\nvar playlist_loader_PlaylistLoader = /*#__PURE__*/function (_EventHandler) {\n _inheritsLoose(PlaylistLoader, _EventHandler);\n\n /**\n * @constructs\n * @param {Hls} hls\n */\n function PlaylistLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MANIFEST_LOADING, events[\"default\"].LEVEL_LOADING, events[\"default\"].AUDIO_TRACK_LOADING, events[\"default\"].SUBTITLE_TRACK_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n /**\n * @param {PlaylistContextType} type\n * @returns {boolean}\n */\n\n\n PlaylistLoader.canHaveQualityLevels = function canHaveQualityLevels(type) {\n return type !== PlaylistContextType.AUDIO_TRACK && type !== PlaylistContextType.SUBTITLE_TRACK;\n }\n /**\n * Map context.type to LevelType\n * @param {PlaylistLoaderContext} context\n * @returns {LevelType}\n */\n ;\n\n PlaylistLoader.mapContextToLevelType = function mapContextToLevelType(context) {\n var type = context.type;\n\n switch (type) {\n case PlaylistContextType.AUDIO_TRACK:\n return PlaylistLevelType.AUDIO;\n\n case PlaylistContextType.SUBTITLE_TRACK:\n return PlaylistLevelType.SUBTITLE;\n\n default:\n return PlaylistLevelType.MAIN;\n }\n };\n\n PlaylistLoader.getResponseUrl = function getResponseUrl(response, context) {\n var url = response.url; // 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\n if (url === undefined || url.indexOf('data:') === 0) {\n // fallback to initial URL\n url = context.url;\n }\n\n return url;\n }\n /**\n * Returns defaults or configured loader-type overloads (pLoader and loader config params)\n * Default loader is XHRLoader (see utils)\n * @param {PlaylistLoaderContext} context\n * @returns {Loader} or other compatible configured overload\n */\n ;\n\n var _proto = PlaylistLoader.prototype;\n\n _proto.createInternalLoader = function createInternalLoader(context) {\n var config = this.hls.config;\n var PLoader = config.pLoader;\n var Loader = config.loader; // TODO(typescript-config): Verify once config is typed that InternalLoader always returns a Loader\n\n var InternalLoader = PLoader || Loader;\n var loader = new InternalLoader(config); // TODO - Do we really need to assign the instance or if the dep has been lost\n\n context.loader = loader;\n this.loaders[context.type] = loader;\n return loader;\n };\n\n _proto.getInternalLoader = function getInternalLoader(context) {\n return this.loaders[context.type];\n };\n\n _proto.resetInternalLoader = function resetInternalLoader(contextType) {\n if (this.loaders[contextType]) {\n delete this.loaders[contextType];\n }\n }\n /**\n * Call `destroy` on all internal loader instances mapped (one per context type)\n */\n ;\n\n _proto.destroyInternalLoaders = function destroyInternalLoaders() {\n for (var contextType in this.loaders) {\n var loader = this.loaders[contextType];\n\n if (loader) {\n loader.destroy();\n }\n\n this.resetInternalLoader(contextType);\n }\n };\n\n _proto.destroy = function destroy() {\n this.destroyInternalLoaders();\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onManifestLoading = function onManifestLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.MANIFEST,\n level: 0,\n id: null,\n responseType: 'text'\n });\n };\n\n _proto.onLevelLoading = function onLevelLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.LEVEL,\n level: data.level,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.onAudioTrackLoading = function onAudioTrackLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.AUDIO_TRACK,\n level: null,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.onSubtitleTrackLoading = function onSubtitleTrackLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.SUBTITLE_TRACK,\n level: null,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.load = function load(context) {\n var config = this.hls.config;\n logger[\"logger\"].debug(\"Loading playlist of type \" + context.type + \", level: \" + context.level + \", id: \" + context.id); // Check if a loader for this context already exists\n\n var loader = this.getInternalLoader(context);\n\n if (loader) {\n var loaderContext = loader.context;\n\n if (loaderContext && loaderContext.url === context.url) {\n // same URL can't overlap\n logger[\"logger\"].trace('playlist request ongoing');\n return false;\n } else {\n logger[\"logger\"].warn(\"aborting previous loader for type: \" + context.type);\n loader.abort();\n }\n }\n\n var maxRetry;\n var timeout;\n var retryDelay;\n var maxRetryDelay; // apply different configs for retries depending on\n // context (manifest, level, audio/subs playlist)\n\n switch (context.type) {\n case PlaylistContextType.MANIFEST:\n maxRetry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n maxRetryDelay = config.manifestLoadingMaxRetryTimeout;\n break;\n\n case PlaylistContextType.LEVEL:\n // Disable internal loader retry logic, since we are managing retries in Level Controller\n maxRetry = 0;\n maxRetryDelay = 0;\n retryDelay = 0;\n timeout = config.levelLoadingTimeOut; // TODO Introduce retry settings for audio-track and subtitle-track, it should not use level retry config\n\n break;\n\n default:\n maxRetry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n maxRetryDelay = config.levelLoadingMaxRetryTimeout;\n break;\n }\n\n loader = this.createInternalLoader(context);\n var loaderConfig = {\n timeout: timeout,\n maxRetry: maxRetry,\n retryDelay: retryDelay,\n maxRetryDelay: maxRetryDelay\n };\n var loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this)\n };\n logger[\"logger\"].debug(\"Calling internal loader delegate for URL: \" + context.url);\n loader.load(context, loaderConfig, loaderCallbacks);\n return true;\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n if (context.isSidxRequest) {\n this._handleSidxRequest(response, context);\n\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n\n return;\n }\n\n this.resetInternalLoader(context.type);\n\n if (typeof response.data !== 'string') {\n throw new Error('expected responseType of \"text\" for PlaylistLoader');\n }\n\n var string = response.data;\n stats.tload = performance.now(); // stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n // Validate if it is an M3U8 at all\n\n if (string.indexOf('#EXTM3U') !== 0) {\n this._handleManifestParsingError(response, context, 'no EXTM3U delimiter', networkDetails);\n\n return;\n } // Check if chunk-list or master. handle empty chunk list case (first EXTINF not signaled, but TARGETDURATION present)\n\n\n if (string.indexOf('#EXTINF:') > 0 || string.indexOf('#EXT-X-TARGETDURATION:') > 0) {\n this._handleTrackOrLevelPlaylist(response, stats, context, networkDetails);\n } else {\n this._handleMasterPlaylist(response, stats, context, networkDetails);\n }\n };\n\n _proto.loaderror = function loaderror(response, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n this._handleNetworkError(context, networkDetails, false, response);\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n this._handleNetworkError(context, networkDetails, true);\n } // TODO(typescript-config): networkDetails can currently be a XHR or Fetch impl,\n // but with custom loaders it could be generic investigate this further when config is typed\n ;\n\n _proto._handleMasterPlaylist = function _handleMasterPlaylist(response, stats, context, networkDetails) {\n var hls = this.hls;\n var string = response.data;\n var url = PlaylistLoader.getResponseUrl(response, context);\n\n var _M3U8Parser$parseMast = m3u8_parser_M3U8Parser.parseMasterPlaylist(string, url),\n levels = _M3U8Parser$parseMast.levels,\n sessionData = _M3U8Parser$parseMast.sessionData;\n\n if (!levels.length) {\n this._handleManifestParsingError(response, context, 'no level found in manifest', networkDetails);\n\n return;\n } // multi level playlist, parse level info\n\n\n var audioGroups = levels.map(function (level) {\n return {\n id: level.attrs.AUDIO,\n codec: level.audioCodec\n };\n });\n var audioTracks = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'AUDIO', audioGroups);\n var subtitles = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'SUBTITLES');\n var captions = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'CLOSED-CAPTIONS');\n\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 = false;\n audioTracks.forEach(function (audioTrack) {\n if (!audioTrack.url) {\n embeddedAudioFound = true;\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\n if (embeddedAudioFound === false && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger[\"logger\"].log('audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({\n type: 'main',\n name: 'main',\n default: false,\n autoselect: false,\n forced: false,\n id: -1,\n attrs: {},\n url: ''\n });\n }\n }\n\n hls.trigger(events[\"default\"].MANIFEST_LOADED, {\n levels: levels,\n audioTracks: audioTracks,\n subtitles: subtitles,\n captions: captions,\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: sessionData\n });\n };\n\n _proto._handleTrackOrLevelPlaylist = function _handleTrackOrLevelPlaylist(response, stats, context, networkDetails) {\n var hls = this.hls;\n var id = context.id,\n level = context.level,\n type = context.type;\n var url = PlaylistLoader.getResponseUrl(response, context); // if the values are null, they will result in the else conditional\n\n var levelUrlId = Object(number[\"isFiniteNumber\"])(id) ? id : 0;\n var levelId = Object(number[\"isFiniteNumber\"])(level) ? level : levelUrlId;\n var levelType = PlaylistLoader.mapContextToLevelType(context);\n var levelDetails = m3u8_parser_M3U8Parser.parseLevelPlaylist(response.data, url, levelId, levelType, levelUrlId); // set stats on level structure\n // TODO(jstackhouse): why? mixing concerns, is it just treated as value bag?\n\n levelDetails.tload = stats.tload;\n\n if (!levelDetails.fragments.length) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].LEVEL_EMPTY_ERROR,\n fatal: false,\n url: url,\n reason: 'no fragments found in level',\n level: typeof context.level === 'number' ? context.level : undefined\n });\n return;\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\n\n if (type === PlaylistContextType.MANIFEST) {\n var singleLevel = {\n url: url,\n details: levelDetails\n };\n hls.trigger(events[\"default\"].MANIFEST_LOADED, {\n levels: [singleLevel],\n audioTracks: [],\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: null\n });\n } // save parsing time\n\n\n stats.tparsed = performance.now(); // in case we need SIDX ranges\n // return early after calling load for\n // the SIDX box.\n\n if (levelDetails.needSidxRanges) {\n var sidxUrl = levelDetails.initSegment.url;\n this.load({\n url: sidxUrl,\n isSidxRequest: true,\n type: type,\n level: level,\n levelDetails: levelDetails,\n id: id,\n rangeStart: 0,\n rangeEnd: 2048,\n responseType: 'arraybuffer'\n });\n return;\n } // extend the context with the new levelDetails property\n\n\n context.levelDetails = levelDetails;\n\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n };\n\n _proto._handleSidxRequest = function _handleSidxRequest(response, context) {\n if (typeof response.data === 'string') {\n throw new Error('sidx request must be made with responseType of array buffer');\n }\n\n var sidxInfo = mp4demuxer[\"default\"].parseSegmentIndex(new Uint8Array(response.data)); // if provided fragment does not contain sidx, early return\n\n if (!sidxInfo) {\n return;\n }\n\n var sidxReferences = sidxInfo.references;\n var levelDetails = context.levelDetails;\n sidxReferences.forEach(function (segmentRef, index) {\n var segRefInfo = segmentRef.info;\n\n if (!levelDetails) {\n return;\n }\n\n var frag = levelDetails.fragments[index];\n\n if (frag.byteRange.length === 0) {\n frag.setByteRange(String(1 + segRefInfo.end - segRefInfo.start) + '@' + String(segRefInfo.start));\n }\n });\n\n if (levelDetails) {\n levelDetails.initSegment.setByteRange(String(sidxInfo.moovEndOffset) + '@0');\n }\n };\n\n _proto._handleManifestParsingError = function _handleManifestParsingError(response, context, reason, networkDetails) {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].MANIFEST_PARSING_ERROR,\n fatal: true,\n url: response.url,\n reason: reason,\n networkDetails: networkDetails\n });\n };\n\n _proto._handleNetworkError = function _handleNetworkError(context, networkDetails, timeout, response) {\n if (timeout === void 0) {\n timeout = false;\n }\n\n if (response === void 0) {\n response = null;\n }\n\n logger[\"logger\"].info(\"A network error occured while loading a \" + context.type + \"-type playlist\");\n var details;\n var fatal;\n var loader = this.getInternalLoader(context);\n\n switch (context.type) {\n case PlaylistContextType.MANIFEST:\n details = timeout ? errors[\"ErrorDetails\"].MANIFEST_LOAD_TIMEOUT : errors[\"ErrorDetails\"].MANIFEST_LOAD_ERROR;\n fatal = true;\n break;\n\n case PlaylistContextType.LEVEL:\n details = timeout ? errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT : errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR;\n fatal = false;\n break;\n\n case PlaylistContextType.AUDIO_TRACK:\n details = timeout ? errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_TIMEOUT : errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR;\n fatal = false;\n break;\n\n default:\n // details = ...?\n fatal = false;\n }\n\n if (loader) {\n loader.abort();\n this.resetInternalLoader(context.type);\n } // TODO(typescript-events): when error events are handled, type this\n\n\n var errorData = {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: details,\n fatal: fatal,\n url: context.url,\n loader: loader,\n context: context,\n networkDetails: networkDetails\n };\n\n if (response) {\n errorData.response = response;\n }\n\n this.hls.trigger(events[\"default\"].ERROR, errorData);\n };\n\n _proto._handlePlaylistLoaded = function _handlePlaylistLoaded(response, stats, context, networkDetails) {\n var type = context.type,\n level = context.level,\n id = context.id,\n levelDetails = context.levelDetails;\n\n if (!levelDetails || !levelDetails.targetduration) {\n this._handleManifestParsingError(response, context, 'invalid target duration', networkDetails);\n\n return;\n }\n\n var canHaveLevels = PlaylistLoader.canHaveQualityLevels(context.type);\n\n if (canHaveLevels) {\n this.hls.trigger(events[\"default\"].LEVEL_LOADED, {\n details: levelDetails,\n level: level || 0,\n id: id || 0,\n stats: stats,\n networkDetails: networkDetails\n });\n } else {\n switch (type) {\n case PlaylistContextType.AUDIO_TRACK:\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n\n case PlaylistContextType.SUBTITLE_TRACK:\n this.hls.trigger(events[\"default\"].SUBTITLE_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n }\n }\n };\n\n return PlaylistLoader;\n}(event_handler);\n\n/* harmony default export */ var playlist_loader = (playlist_loader_PlaylistLoader);\n// CONCATENATED MODULE: ./src/loader/fragment-loader.js\n\n\n\nfunction fragment_loader_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Fragment Loader\n*/\n\n\n\n\n\nvar fragment_loader_FragmentLoader = /*#__PURE__*/function (_EventHandler) {\n fragment_loader_inheritsLoose(FragmentLoader, _EventHandler);\n\n function FragmentLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FRAG_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n\n var _proto = FragmentLoader.prototype;\n\n _proto.destroy = function destroy() {\n var loaders = this.loaders;\n\n for (var loaderName in loaders) {\n var loader = loaders[loaderName];\n\n if (loader) {\n loader.destroy();\n }\n }\n\n this.loaders = {};\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onFragLoading = function onFragLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loaders = this.loaders,\n config = this.hls.config,\n FragmentILoader = config.fLoader,\n DefaultILoader = config.loader; // reset fragment state\n\n frag.loaded = 0;\n var loader = loaders[type];\n\n if (loader) {\n logger[\"logger\"].warn(\"abort previous fragment loader for type: \" + type);\n loader.abort();\n }\n\n loader = loaders[type] = frag.loader = config.fLoader ? new FragmentILoader(config) : new DefaultILoader(config);\n var loaderContext, loaderConfig, loaderCallbacks;\n loaderContext = {\n url: frag.url,\n frag: frag,\n responseType: 'arraybuffer',\n progressData: false\n };\n var start = frag.byteRangeStartOffset,\n end = frag.byteRangeEndOffset;\n\n if (Object(number[\"isFiniteNumber\"])(start) && Object(number[\"isFiniteNumber\"])(end)) {\n loaderContext.rangeStart = start;\n loaderContext.rangeEnd = end;\n }\n\n loaderConfig = {\n timeout: config.fragLoadingTimeOut,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: config.fragLoadingMaxRetryTimeout\n };\n loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this),\n onProgress: this.loadprogress.bind(this)\n };\n loader.load(loaderContext, loaderConfig, loaderCallbacks);\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var payload = response.data,\n frag = context.frag; // detach fragment loader on load success\n\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].FRAG_LOADED, {\n payload: payload,\n frag: frag,\n stats: stats,\n networkDetails: networkDetails\n });\n };\n\n _proto.loaderror = function loaderror(response, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_LOAD_ERROR,\n fatal: false,\n frag: context.frag,\n response: response,\n networkDetails: networkDetails\n });\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT,\n fatal: false,\n frag: context.frag,\n networkDetails: networkDetails\n });\n } // data will be used for progressive parsing\n ;\n\n _proto.loadprogress = function loadprogress(stats, context, data, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n // jshint ignore:line\n var frag = context.frag;\n frag.loaded = stats.loaded;\n this.hls.trigger(events[\"default\"].FRAG_LOAD_PROGRESS, {\n frag: frag,\n stats: stats,\n networkDetails: networkDetails\n });\n };\n\n return FragmentLoader;\n}(event_handler);\n\n/* harmony default export */ var fragment_loader = (fragment_loader_FragmentLoader);\n// CONCATENATED MODULE: ./src/loader/key-loader.ts\nfunction key_loader_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Decrypt key Loader\n*/\n\n\n\n\n\nvar key_loader_KeyLoader = /*#__PURE__*/function (_EventHandler) {\n key_loader_inheritsLoose(KeyLoader, _EventHandler);\n\n function KeyLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].KEY_LOADING) || this;\n _this.loaders = {};\n _this.decryptkey = null;\n _this.decrypturl = null;\n return _this;\n }\n\n var _proto = KeyLoader.prototype;\n\n _proto.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n\n if (loader) {\n loader.destroy();\n }\n }\n\n this.loaders = {};\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onKeyLoading = function onKeyLoading(data) {\n var frag = data.frag;\n var type = frag.type;\n var loader = this.loaders[type];\n\n if (!frag.decryptdata) {\n logger[\"logger\"].warn('Missing decryption data on fragment in onKeyLoading');\n return;\n } // Load the key if the uri is different from previous one, or if the decrypt key has not yet been retrieved\n\n\n var uri = frag.decryptdata.uri;\n\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n\n if (loader) {\n logger[\"logger\"].warn(\"abort previous key loader for type:\" + type);\n loader.abort();\n }\n\n if (!uri) {\n logger[\"logger\"].warn('key uri is falsy');\n return;\n }\n\n frag.loader = this.loaders[type] = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n var loaderContext = {\n url: uri,\n frag: frag,\n responseType: 'arraybuffer'\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\n var loaderConfig = {\n timeout: config.fragLoadingTimeOut,\n maxRetry: 0,\n retryDelay: config.fragLoadingRetryDelay,\n maxRetryDelay: config.fragLoadingMaxRetryTimeout\n };\n var loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this)\n };\n frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);\n } else if (this.decryptkey) {\n // Return the key if it's already been loaded\n frag.decryptdata.key = this.decryptkey;\n this.hls.trigger(events[\"default\"].KEY_LOADED, {\n frag: frag\n });\n }\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context) {\n var frag = context.frag;\n\n if (!frag.decryptdata) {\n logger[\"logger\"].error('after key load, decryptdata unset');\n return;\n }\n\n this.decryptkey = frag.decryptdata.key = new Uint8Array(response.data); // detach fragment loader on load success\n\n frag.loader = undefined;\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].KEY_LOADED, {\n frag: frag\n });\n };\n\n _proto.loaderror = function loaderror(response, context) {\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].KEY_LOAD_ERROR,\n fatal: false,\n frag: frag,\n response: response\n });\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context) {\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT,\n fatal: false,\n frag: frag\n });\n };\n\n return KeyLoader;\n}(event_handler);\n\n/* harmony default export */ var key_loader = (key_loader_KeyLoader);\n// CONCATENATED MODULE: ./src/controller/fragment-tracker.js\n\n\nfunction fragment_tracker_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\nvar FragmentState = {\n NOT_LOADED: 'NOT_LOADED',\n APPENDING: 'APPENDING',\n PARTIAL: 'PARTIAL',\n OK: 'OK'\n};\nvar fragment_tracker_FragmentTracker = /*#__PURE__*/function (_EventHandler) {\n fragment_tracker_inheritsLoose(FragmentTracker, _EventHandler);\n\n function FragmentTracker(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].BUFFER_APPENDED, events[\"default\"].FRAG_BUFFERED, events[\"default\"].FRAG_LOADED) || this;\n _this.bufferPadding = 0.2;\n _this.fragments = Object.create(null);\n _this.timeRanges = Object.create(null);\n _this.config = hls.config;\n return _this;\n }\n\n var _proto = FragmentTracker.prototype;\n\n _proto.destroy = function destroy() {\n this.fragments = Object.create(null);\n this.timeRanges = Object.create(null);\n this.config = null;\n event_handler.prototype.destroy.call(this);\n\n _EventHandler.prototype.destroy.call(this);\n }\n /**\n * Return a Fragment that match the position and levelType.\n * If not found any Fragment, return null\n * @param {number} position\n * @param {LevelType} levelType\n * @returns {Fragment|null}\n */\n ;\n\n _proto.getBufferedFrag = function getBufferedFrag(position, levelType) {\n var fragments = this.fragments;\n var bufferedFrags = Object.keys(fragments).filter(function (key) {\n var fragmentEntity = fragments[key];\n\n if (fragmentEntity.body.type !== levelType) {\n return false;\n }\n\n if (!fragmentEntity.buffered) {\n return false;\n }\n\n var frag = fragmentEntity.body;\n return frag.startPTS <= position && position <= frag.endPTS;\n });\n\n if (bufferedFrags.length === 0) {\n return null;\n } else {\n // https://github.com/video-dev/hls.js/pull/1545#discussion_r166229566\n var bufferedFragKey = bufferedFrags.pop();\n return fragments[bufferedFragKey].body;\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 * @param {String} elementaryStream The elementaryStream of media this is (eg. video/audio)\n * @param {TimeRanges} timeRange TimeRange object from a sourceBuffer\n */\n ;\n\n _proto.detectEvictedFragments = function detectEvictedFragments(elementaryStream, timeRange) {\n var _this2 = this;\n\n // Check if any flagged fragments have been unloaded\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this2.fragments[key];\n\n if (!fragmentEntity || !fragmentEntity.buffered) {\n return;\n }\n\n var esData = fragmentEntity.range[elementaryStream];\n\n if (!esData) {\n return;\n }\n\n var fragmentTimes = esData.time;\n\n for (var i = 0; i < fragmentTimes.length; i++) {\n var time = fragmentTimes[i];\n\n if (!_this2.isTimeBuffered(time.startPTS, time.endPTS, timeRange)) {\n // Unregister partial fragment as it needs to load again to be reused\n _this2.removeFragment(fragmentEntity.body);\n\n break;\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 * @param {Object} fragment Check the fragment against all sourceBuffers loaded\n */\n ;\n\n _proto.detectPartialFragments = function detectPartialFragments(fragment) {\n var _this3 = this;\n\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n\n if (fragmentEntity) {\n fragmentEntity.buffered = true;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n if (fragment.hasElementaryStream(elementaryStream)) {\n var timeRange = _this3.timeRanges[elementaryStream]; // Check for malformed fragments\n // Gaps need to be calculated for each elementaryStream\n\n fragmentEntity.range[elementaryStream] = _this3.getBufferedTimes(fragment.startPTS, fragment.endPTS, timeRange);\n }\n });\n }\n };\n\n _proto.getBufferedTimes = function getBufferedTimes(startPTS, endPTS, timeRange) {\n var fragmentTimes = [];\n var startTime, endTime;\n var fragmentPartial = false;\n\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n\n if (startPTS >= startTime && endPTS <= endTime) {\n // Fragment is entirely contained in buffer\n // No need to check the other timeRange times since it's completely playable\n fragmentTimes.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 // Check for intersection with buffer\n // Get playable sections of the fragment\n fragmentTimes.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n fragmentPartial = true;\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\n return {\n time: fragmentTimes,\n partial: fragmentPartial\n };\n };\n\n _proto.getFragmentKey = function getFragmentKey(fragment) {\n return fragment.type + \"_\" + fragment.level + \"_\" + fragment.urlId + \"_\" + fragment.sn;\n }\n /**\n * Gets the partial fragment for a certain time\n * @param {Number} time\n * @returns {Object} fragment Returns a partial fragment at a time or null if there is no partial fragment\n */\n ;\n\n _proto.getPartialFragment = function getPartialFragment(time) {\n var _this4 = this;\n\n var timePadding, startTime, endTime;\n var bestFragment = null;\n var bestOverlap = 0;\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this4.fragments[key];\n\n if (_this4.isPartial(fragmentEntity)) {\n startTime = fragmentEntity.body.startPTS - _this4.bufferPadding;\n endTime = fragmentEntity.body.endPTS + _this4.bufferPadding;\n\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\n if (bestOverlap <= timePadding) {\n bestFragment = fragmentEntity.body;\n bestOverlap = timePadding;\n }\n }\n }\n });\n return bestFragment;\n }\n /**\n * @param {Object} fragment The fragment to check\n * @returns {String} Returns the fragment state when a fragment never loaded or if it partially loaded\n */\n ;\n\n _proto.getState = function getState(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n var state = FragmentState.NOT_LOADED;\n\n if (fragmentEntity !== undefined) {\n if (!fragmentEntity.buffered) {\n state = FragmentState.APPENDING;\n } else if (this.isPartial(fragmentEntity) === true) {\n state = FragmentState.PARTIAL;\n } else {\n state = FragmentState.OK;\n }\n }\n\n return state;\n };\n\n _proto.isPartial = function isPartial(fragmentEntity) {\n return fragmentEntity.buffered === true && (fragmentEntity.range.video !== undefined && fragmentEntity.range.video.partial === true || fragmentEntity.range.audio !== undefined && fragmentEntity.range.audio.partial === true);\n };\n\n _proto.isTimeBuffered = function isTimeBuffered(startPTS, endPTS, timeRange) {\n var startTime, endTime;\n\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n\n if (startPTS >= startTime && endPTS <= endTime) {\n return true;\n }\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\n return false;\n }\n /**\n * Fires when a fragment loading is completed\n */\n ;\n\n _proto.onFragLoaded = function onFragLoaded(e) {\n var fragment = e.frag; // don't track initsegment (for which sn is not a number)\n // don't track frags used for bitrateTest, they're irrelevant.\n\n if (!Object(number[\"isFiniteNumber\"])(fragment.sn) || fragment.bitrateTest) {\n return;\n }\n\n this.fragments[this.getFragmentKey(fragment)] = {\n body: fragment,\n range: Object.create(null),\n buffered: false\n };\n }\n /**\n * Fires when the buffer is updated\n */\n ;\n\n _proto.onBufferAppended = function onBufferAppended(e) {\n var _this5 = this;\n\n // Store the latest timeRanges loaded in the buffer\n this.timeRanges = e.timeRanges;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n var timeRange = _this5.timeRanges[elementaryStream];\n\n _this5.detectEvictedFragments(elementaryStream, timeRange);\n });\n }\n /**\n * Fires after a fragment has been loaded into the source buffer\n */\n ;\n\n _proto.onFragBuffered = function onFragBuffered(e) {\n this.detectPartialFragments(e.frag);\n }\n /**\n * Return true if fragment tracker has the fragment.\n * @param {Object} fragment\n * @returns {boolean}\n */\n ;\n\n _proto.hasFragment = function hasFragment(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n return this.fragments[fragKey] !== undefined;\n }\n /**\n * Remove a fragment from fragment tracker until it is loaded again\n * @param {Object} fragment The fragment to remove\n */\n ;\n\n _proto.removeFragment = function removeFragment(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n delete this.fragments[fragKey];\n }\n /**\n * Remove all fragments from fragment tracker.\n */\n ;\n\n _proto.removeAllFragments = function removeAllFragments() {\n this.fragments = Object.create(null);\n };\n\n return FragmentTracker;\n}(event_handler);\n// CONCATENATED MODULE: ./src/utils/binary-search.ts\nvar 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 {Array<T>} list The array to search.\n * @param {BinarySearchComparison<T>} 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 * @return {T | null} The object if it is found or null otherwise.\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\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n var comparisonResult = comparisonFn(currentElement);\n\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\n return null;\n }\n};\n/* harmony default export */ var binary_search = (BinarySearch);\n// CONCATENATED MODULE: ./src/utils/buffer-helper.ts\n/**\n * @module BufferHelper\n *\n * Providing 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*/\nvar BufferHelper = /*#__PURE__*/function () {\n function BufferHelper() {}\n\n /**\n * Return true if `media`'s buffered include `position`\n * @param {Bufferable} media\n * @param {number} position\n * @returns {boolean}\n */\n BufferHelper.isBuffered = function isBuffered(media, position) {\n try {\n if (media) {\n var buffered = media.buffered;\n\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) {// 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\n return false;\n };\n\n BufferHelper.bufferInfo = function bufferInfo(media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = media.buffered;\n var buffered = [];\n var i;\n\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({\n start: vbuffered.start(i),\n end: vbuffered.end(i)\n });\n }\n\n return this.bufferedInfo(buffered, pos, maxHoleDuration);\n }\n } catch (error) {// 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\n return {\n len: 0,\n start: pos,\n end: pos,\n nextStart: undefined\n };\n };\n\n BufferHelper.bufferedInfo = function bufferedInfo(buffered, pos, maxHoleDuration) {\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\n if (diff) {\n return diff;\n } else {\n return b.end - a.end;\n }\n });\n var buffered2 = [];\n\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\n if (buf2len) {\n var buf2end = buffered2[buf2len - 1].end; // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n\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\n var bufferLen = 0; // bufferStartNext can possibly be undefined based on the conditional logic below\n\n var bufferStartNext; // bufferStart and bufferEnd are buffer boundaries around current video position\n\n var bufferStart = pos;\n var bufferEnd = pos;\n\n for (var _i = 0; _i < buffered2.length; _i++) {\n var start = buffered2[_i].start,\n end = buffered2[_i].end; // logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n\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\n return {\n len: bufferLen,\n start: bufferStart,\n end: bufferEnd,\n nextStart: bufferStartNext\n };\n };\n\n return BufferHelper;\n}();\n// EXTERNAL MODULE: ./node_modules/eventemitter3/index.js\nvar eventemitter3 = __webpack_require__(\"./node_modules/eventemitter3/index.js\");\n\n// EXTERNAL MODULE: ./node_modules/webworkify-webpack/index.js\nvar webworkify_webpack = __webpack_require__(\"./node_modules/webworkify-webpack/index.js\");\n\n// EXTERNAL MODULE: ./src/demux/demuxer-inline.js + 12 modules\nvar demuxer_inline = __webpack_require__(\"./src/demux/demuxer-inline.js\");\n\n// CONCATENATED MODULE: ./src/utils/mediasource-helper.ts\n/**\n * MediaSource helper\n */\nfunction getMediaSource() {\n return window.MediaSource || window.WebKitMediaSource;\n}\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/observer.ts\nfunction observer_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n/**\n * Simple adapter sub-class of Nodejs-like EventEmitter.\n */\n\nvar Observer = /*#__PURE__*/function (_EventEmitter) {\n observer_inheritsLoose(Observer, _EventEmitter);\n\n function Observer() {\n return _EventEmitter.apply(this, arguments) || this;\n }\n\n var _proto = Observer.prototype;\n\n /**\n * We simply want to pass along the event-name itself\n * in every call to a handler, which is the purpose of our `trigger` method\n * extending the standard API.\n */\n _proto.trigger = function trigger(event) {\n for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n this.emit.apply(this, [event, event].concat(data));\n };\n\n return Observer;\n}(eventemitter3[\"EventEmitter\"]);\n// CONCATENATED MODULE: ./src/demux/demuxer.js\n\n\n\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar demuxer_MediaSource = getMediaSource() || {\n isTypeSupported: function isTypeSupported() {\n return false;\n }\n};\n\nvar demuxer_Demuxer = /*#__PURE__*/function () {\n function Demuxer(hls, id) {\n var _this = this;\n\n this.hls = hls;\n this.id = id;\n var observer = this.observer = new Observer();\n var config = hls.config;\n\n var forwardMessage = function forwardMessage(ev, data) {\n data = data || {};\n data.frag = _this.frag;\n data.id = _this.id;\n hls.trigger(ev, data);\n }; // forward events to main thread\n\n\n observer.on(events[\"default\"].FRAG_DECRYPTED, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_DATA, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSED, forwardMessage);\n observer.on(events[\"default\"].ERROR, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events[\"default\"].INIT_PTS_FOUND, forwardMessage);\n var typeSupported = {\n mp4: demuxer_MediaSource.isTypeSupported('video/mp4'),\n mpeg: demuxer_MediaSource.isTypeSupported('audio/mpeg'),\n mp3: demuxer_MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n }; // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n\n var vendor = navigator.vendor;\n\n if (config.enableWorker && typeof Worker !== 'undefined') {\n logger[\"logger\"].log('demuxing in webworker');\n var w;\n\n try {\n w = this.w = webworkify_webpack(/*require.resolve*/(/*! ../demux/demuxer-worker.js */ \"./src/demux/demuxer-worker.js\"));\n this.onwmsg = this.onWorkerMessage.bind(this);\n w.addEventListener('message', this.onwmsg);\n\n w.onerror = function (event) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].INTERNAL_EXCEPTION,\n fatal: true,\n event: 'demuxerWorker',\n err: {\n message: event.message + ' (' + event.filename + ':' + event.lineno + ')'\n }\n });\n };\n\n w.postMessage({\n cmd: 'init',\n typeSupported: typeSupported,\n vendor: vendor,\n id: id,\n config: JSON.stringify(config)\n });\n } catch (err) {\n logger[\"logger\"].warn('Error in worker:', err);\n logger[\"logger\"].error('Error while initializing DemuxerWorker, fallback on DemuxerInline');\n\n if (w) {\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(w.objectURL);\n }\n\n this.demuxer = new demuxer_inline[\"default\"](observer, typeSupported, config, vendor);\n this.w = undefined;\n }\n } else {\n this.demuxer = new demuxer_inline[\"default\"](observer, typeSupported, config, vendor);\n }\n }\n\n var _proto = Demuxer.prototype;\n\n _proto.destroy = function destroy() {\n var w = this.w;\n\n if (w) {\n w.removeEventListener('message', this.onwmsg);\n w.terminate();\n this.w = null;\n } else {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.destroy();\n this.demuxer = null;\n }\n }\n\n var observer = this.observer;\n\n if (observer) {\n observer.removeAllListeners();\n this.observer = null;\n }\n };\n\n _proto.push = function push(data, initSegment, audioCodec, videoCodec, frag, duration, accurateTimeOffset, defaultInitPTS) {\n var w = this.w;\n var timeOffset = Object(number[\"isFiniteNumber\"])(frag.startPTS) ? frag.startPTS : frag.start;\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && frag.cc === lastFrag.cc);\n var trackSwitch = !(lastFrag && frag.level === lastFrag.level);\n var nextSN = lastFrag && frag.sn === lastFrag.sn + 1;\n var contiguous = !trackSwitch && nextSN;\n\n if (discontinuity) {\n logger[\"logger\"].log(this.id + \":discontinuity detected\");\n }\n\n if (trackSwitch) {\n logger[\"logger\"].log(this.id + \":switch detected\");\n }\n\n this.frag = frag;\n\n if (w) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n w.postMessage({\n cmd: 'demux',\n data: data,\n decryptdata: decryptdata,\n initSegment: initSegment,\n audioCodec: audioCodec,\n videoCodec: videoCodec,\n timeOffset: timeOffset,\n discontinuity: discontinuity,\n trackSwitch: trackSwitch,\n contiguous: contiguous,\n duration: duration,\n accurateTimeOffset: accurateTimeOffset,\n defaultInitPTS: defaultInitPTS\n }, data instanceof ArrayBuffer ? [data] : []);\n } else {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n }\n };\n\n _proto.onWorkerMessage = function onWorkerMessage(ev) {\n var data = ev.data,\n hls = this.hls;\n\n switch (data.event) {\n case 'init':\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(this.w.objectURL);\n break;\n // special case for FRAG_PARSING_DATA: data1 and data2 are transferable objects\n\n case events[\"default\"].FRAG_PARSING_DATA:\n data.data.data1 = new Uint8Array(data.data1);\n\n if (data.data2) {\n data.data.data2 = new Uint8Array(data.data2);\n }\n\n /* falls through */\n\n default:\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 return Demuxer;\n}();\n\n/* harmony default export */ var demux_demuxer = (demuxer_Demuxer);\n// CONCATENATED MODULE: ./src/controller/level-helper.js\n\n\n\n\n\n/**\n * @module LevelHelper\n *\n * Providing methods dealing with playlist sliding and drift\n *\n * TODO: Create an actual `Level` class/model that deals with all this logic in an object-oriented-manner.\n *\n * */\n\nfunction addGroupId(level, type, id) {\n switch (type) {\n case 'audio':\n if (!level.audioGroupIds) {\n level.audioGroupIds = [];\n }\n\n level.audioGroupIds.push(id);\n break;\n\n case 'text':\n if (!level.textGroupIds) {\n level.textGroupIds = [];\n }\n\n level.textGroupIds.push(id);\n break;\n }\n}\nfunction updatePTS(fragments, fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],\n fragTo = fragments[toIdx],\n fragToPTS = fragTo.startPTS; // if we know startPTS[toIdx]\n\n if (Object(number[\"isFiniteNumber\"])(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS - fragFrom.start;\n\n if (fragFrom.duration < 0) {\n logger[\"logger\"].warn(\"negative duration computed for frag \" + fragFrom.sn + \",level \" + fragFrom.level + \", there should be some duration drift between playlist and fragment!\");\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n\n if (fragTo.duration < 0) {\n logger[\"logger\"].warn(\"negative duration computed for frag \" + fragTo.sn + \",level \" + fragTo.level + \", there should be some duration drift between playlist and fragment!\");\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n var contiguous = fragFrom.cc === fragTo.cc;\n fragTo.start = fragFrom.start + (contiguous && fragFrom.minEndPTS ? fragFrom.minEndPTS - fragFrom.start : fragFrom.duration);\n } else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n}\nfunction updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n // update frag PTS/DTS\n var maxStartPTS = startPTS;\n var minEndPTS = endPTS;\n\n if (Object(number[\"isFiniteNumber\"])(frag.startPTS)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(frag.startPTS - startPTS);\n\n if (!Object(number[\"isFiniteNumber\"])(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n } else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n\n maxStartPTS = Math.max(startPTS, frag.startPTS);\n startPTS = Math.min(startPTS, frag.startPTS);\n minEndPTS = Math.min(endPTS, frag.endPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS, frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n\n var drift = startPTS - frag.start;\n frag.start = frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.endPTS = endPTS;\n frag.minEndPTS = minEndPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n var sn = frag.sn; // exit if sn out of range\n\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n\n var fragIdx, fragments, i;\n fragIdx = sn - details.startSN;\n fragments = details.fragments; // 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\n fragments[fragIdx] = frag; // adjust fragment PTS/duration from seqnum-1 to frag 0\n\n for (i = fragIdx; i > 0; i--) {\n updatePTS(fragments, i, i - 1);\n } // adjust fragment PTS/duration from seqnum to last frag\n\n\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updatePTS(fragments, i, i + 1);\n }\n\n details.PTSKnown = true;\n return drift;\n}\nfunction mergeDetails(oldDetails, newDetails) {\n // potentially retrieve cached initsegment\n if (newDetails.initSegment && oldDetails.initSegment) {\n newDetails.initSegment = oldDetails.initSegment;\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\n\n var ccOffset = 0;\n var PTSFrag;\n mapFragmentIntersection(oldDetails, newDetails, function (oldFrag, newFrag) {\n ccOffset = oldFrag.cc - newFrag.cc;\n\n if (Object(number[\"isFiniteNumber\"])(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n newFrag.backtracked = oldFrag.backtracked;\n newFrag.dropped = oldFrag.dropped;\n PTSFrag = newFrag;\n } // PTS is known when there are overlapping segments\n\n\n newDetails.PTSKnown = true;\n });\n\n if (!newDetails.PTSKnown) {\n return;\n }\n\n if (ccOffset) {\n logger[\"logger\"].log('discontinuity sliding from playlist, take drift into account');\n var newFragments = newDetails.fragments;\n\n for (var i = 0; i < newFragments.length; i++) {\n newFragments[i].cc += ccOffset;\n }\n } // if at least one fragment contains PTS info, recompute PTS information for all fragments\n\n\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 } // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n\n\n newDetails.PTSKnown = oldDetails.PTSKnown;\n}\nfunction mergeSubtitlePlaylists(oldPlaylist, newPlaylist, referenceStart) {\n if (referenceStart === void 0) {\n referenceStart = 0;\n }\n\n var lastIndex = -1;\n mapFragmentIntersection(oldPlaylist, newPlaylist, function (oldFrag, newFrag, index) {\n newFrag.start = oldFrag.start;\n lastIndex = index;\n });\n var frags = newPlaylist.fragments;\n\n if (lastIndex < 0) {\n frags.forEach(function (frag) {\n frag.start += referenceStart;\n });\n return;\n }\n\n for (var i = lastIndex + 1; i < frags.length; i++) {\n frags[i].start = frags[i - 1].start + frags[i - 1].duration;\n }\n}\nfunction mapFragmentIntersection(oldPlaylist, newPlaylist, intersectionFn) {\n if (!oldPlaylist || !newPlaylist) {\n return;\n }\n\n var start = Math.max(oldPlaylist.startSN, newPlaylist.startSN) - newPlaylist.startSN;\n var end = Math.min(oldPlaylist.endSN, newPlaylist.endSN) - newPlaylist.startSN;\n var delta = newPlaylist.startSN - oldPlaylist.startSN;\n\n for (var i = start; i <= end; i++) {\n var oldFrag = oldPlaylist.fragments[delta + i];\n var newFrag = newPlaylist.fragments[i];\n\n if (!oldFrag || !newFrag) {\n break;\n }\n\n intersectionFn(oldFrag, newFrag, i);\n }\n}\nfunction adjustSliding(oldPlaylist, newPlaylist) {\n var delta = newPlaylist.startSN - oldPlaylist.startSN;\n var oldFragments = oldPlaylist.fragments;\n var newFragments = newPlaylist.fragments;\n\n if (delta < 0 || delta > oldFragments.length) {\n return;\n }\n\n for (var i = 0; i < newFragments.length; i++) {\n newFragments[i].start += oldFragments[delta].start;\n }\n}\nfunction computeReloadInterval(currentPlaylist, newPlaylist, lastRequestTime) {\n var reloadInterval = 1000 * (newPlaylist.averagetargetduration ? newPlaylist.averagetargetduration : newPlaylist.targetduration);\n var minReloadInterval = reloadInterval / 2;\n\n if (currentPlaylist && newPlaylist.endSN === currentPlaylist.endSN) {\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 = minReloadInterval;\n }\n\n if (lastRequestTime) {\n reloadInterval = Math.max(minReloadInterval, reloadInterval - (window.performance.now() - lastRequestTime));\n } // in any case, don't reload more than half of target duration\n\n\n return Math.round(reloadInterval);\n}\n// CONCATENATED MODULE: ./src/utils/time-ranges.ts\n/**\n * TimeRanges to string helper\n */\nvar TimeRanges = {\n toString: function toString(r) {\n var log = '';\n var len = r.length;\n\n for (var i = 0; i < len; i++) {\n log += '[' + r.start(i).toFixed(3) + ',' + r.end(i).toFixed(3) + ']';\n }\n\n return log;\n }\n};\n/* harmony default export */ var time_ranges = (TimeRanges);\n// CONCATENATED MODULE: ./src/utils/discontinuities.js\n\n\n\nfunction findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n\n for (var i = 0; i < fragments.length; i += 1) {\n var currentFrag = fragments[i];\n\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n\n return firstFrag;\n}\nfunction findFragWithCC(fragments, CC) {\n return binary_search.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}\nfunction shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n var shouldAlign = false;\n\n if (lastLevel && lastLevel.details && details) {\n if (details.endCC > details.startCC || lastFrag && lastFrag.cc < details.startCC) {\n shouldAlign = true;\n }\n }\n\n return shouldAlign;\n} // Find the first frag in the previous level which matches the CC of the first frag of the new level\n\nfunction findDiscontinuousReferenceFrag(prevDetails, curDetails) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n\n if (!curFrags.length || !prevFrags.length) {\n logger[\"logger\"].log('No fragments to align');\n return;\n }\n\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n\n if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {\n logger[\"logger\"].log('No frag in previous level to align on');\n return;\n }\n\n return prevStartFrag;\n}\nfunction adjustPts(sliding, details) {\n details.fragments.forEach(function (frag) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n });\n details.PTSKnown = true;\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\nfunction alignStream(lastFrag, lastLevel, details) {\n alignDiscontinuities(lastFrag, details, lastLevel);\n\n if (!details.PTSKnown && lastLevel) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n}\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 lastLevel - The details of the last loaded level\n * @param details - The details of the new level\n */\n\nfunction alignDiscontinuities(lastFrag, details, lastLevel) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n\n if (referenceFrag) {\n logger[\"logger\"].log('Adjusting PTS using last level due to CC increase within current level');\n adjustPts(referenceFrag.start, details);\n }\n }\n}\n/**\n * Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.\n * @param details - The details of the new level\n * @param lastDetails - The details of the last loaded level\n */\n\nfunction alignPDT(details, lastDetails) {\n if (lastDetails && lastDetails.fragments.length) {\n if (!details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {\n return;\n } // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n\n\n var lastPDT = lastDetails.fragments[0].programDateTime;\n var newPDT = details.fragments[0].programDateTime; // date diff is in ms. frag.start is in seconds\n\n var sliding = (newPDT - lastPDT) / 1000 + lastDetails.fragments[0].start;\n\n if (Object(number[\"isFiniteNumber\"])(sliding)) {\n logger[\"logger\"].log(\"adjusting PTS using programDateTime delta, sliding:\" + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}\n// CONCATENATED MODULE: ./src/controller/fragment-finders.ts\n\n\n\n/**\n * Returns first fragment whose endPdt value exceeds the given PDT.\n * @param {Array<Fragment>} fragments - The array of candidate fragments\n * @param {number|null} [PDTValue = null] - The PDT value which must be exceeded\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*|null} fragment - The best matching fragment\n */\nfunction findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {\n if (PDTValue === null || !Array.isArray(fragments) || !fragments.length || !Object(number[\"isFiniteNumber\"])(PDTValue)) {\n return null;\n } // if less than start\n\n\n var startPDT = fragments[0].programDateTime;\n\n if (PDTValue < (startPDT || 0)) {\n return null;\n }\n\n var endPDT = fragments[fragments.length - 1].endProgramDateTime;\n\n if (PDTValue >= (endPDT || 0)) {\n return null;\n }\n\n maxFragLookUpTolerance = maxFragLookUpTolerance || 0;\n\n for (var seg = 0; seg < fragments.length; ++seg) {\n var frag = fragments[seg];\n\n if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {\n return frag;\n }\n }\n\n return null;\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 {Array<Fragment>} fragments - The array of candidate fragments\n * @param {number} [bufferEnd = 0] - The end of the contiguous buffered range the playhead is currently within\n * @param {number} maxFragLookUpTolerance - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*} foundFrag - The best matching fragment\n */\n\nfunction findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\n\n var fragNext = null;\n\n if (fragPrevious) {\n fragNext = fragments[fragPrevious.sn - fragments[0].sn + 1];\n } else if (bufferEnd === 0 && fragments[0].start === 0) {\n fragNext = fragments[0];\n } // Prefer the next fragment if it's within tolerance\n\n\n if (fragNext && fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext) === 0) {\n return fragNext;\n } // We might be seeking past the tolerance so find the best match\n\n\n var foundFragment = binary_search.search(fragments, fragmentWithinToleranceTest.bind(null, bufferEnd, maxFragLookUpTolerance));\n\n if (foundFragment) {\n return foundFragment;\n } // If no match was found return the next fragment after fragPrevious, or null\n\n\n return fragNext;\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 {number} [bufferEnd = 0] - The end of the current buffered range the playhead is currently within\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {number} - 0 if it matches, 1 if too low, -1 if too high\n */\n\nfunction fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, candidate) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\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\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\n return 0;\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 {number} [pdtBufferEnd = 0] - The Unix time representing the end of the current buffered range\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {boolean} True if contiguous, false otherwise\n */\n\nfunction pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate) {\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0)) * 1000; // endProgramDateTime can be null, default to zero\n\n var endProgramDateTime = candidate.endProgramDateTime || 0;\n return endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;\n}\n// CONCATENATED MODULE: ./src/controller/gap-controller.js\n\n\n\n\nvar STALL_MINIMUM_DURATION_MS = 250;\nvar MAX_START_GAP_JUMP = 2.0;\nvar SKIP_BUFFER_HOLE_STEP_SECONDS = 0.1;\nvar SKIP_BUFFER_RANGE_START = 0.05;\n\nvar gap_controller_GapController = /*#__PURE__*/function () {\n function GapController(config, media, fragmentTracker, hls) {\n this.config = config;\n this.media = media;\n this.fragmentTracker = fragmentTracker;\n this.hls = hls;\n this.nudgeRetry = 0;\n this.stallReported = false;\n this.stalled = null;\n this.moved = false;\n this.seeking = false;\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 {number} lastCurrentTime Previously read playhead position\n */\n\n\n var _proto = GapController.prototype;\n\n _proto.poll = function poll(lastCurrentTime) {\n var config = this.config,\n media = this.media,\n stalled = this.stalled;\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; // The playhead is moving, no-op\n\n if (currentTime !== lastCurrentTime) {\n this.moved = true;\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\n logger[\"logger\"].warn(\"playback not stuck anymore @\" + currentTime + \", after \" + Math.round(_stalledDuration) + \"ms\");\n this.stallReported = false;\n }\n\n this.stalled = null;\n this.nudgeRetry = 0;\n }\n\n return;\n } // Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek\n\n\n if (beginSeek || seeked) {\n this.stalled = null;\n } // The playhead should not be moving\n\n\n if (media.paused || media.ended || media.playbackRate === 0 || !media.buffered.length) {\n return;\n }\n\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var isBuffered = bufferInfo.len > 0;\n var nextStart = bufferInfo.nextStart || 0; // There is no playable buffer (waiting for buffer append)\n\n if (!isBuffered && !nextStart) {\n return;\n }\n\n if (seeking) {\n // Waiting for seeking in a buffered range to complete\n var hasEnoughBuffer = bufferInfo.len > MAX_START_GAP_JUMP; // Next buffered range is too far ahead to jump to while still seeking\n\n var noBufferGap = !nextStart || nextStart - currentTime > MAX_START_GAP_JUMP && !this.fragmentTracker.getPartialFragment(currentTime);\n\n if (hasEnoughBuffer || noBufferGap) {\n return;\n } // Reset moved state when seeking to a point in or before a gap\n\n\n this.moved = false;\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\n\n if (!this.moved && this.stalled) {\n // Jump start gaps within jump threshold\n var startJump = Math.max(nextStart, bufferInfo.start || 0) - currentTime;\n\n if (startJump > 0 && startJump <= MAX_START_GAP_JUMP) {\n this._trySkipBufferHole(null);\n\n return;\n }\n } // Start tracking stall time\n\n\n var tnow = self.performance.now();\n\n if (stalled === null) {\n this.stalled = tnow;\n return;\n }\n\n var stalledDuration = tnow - stalled;\n\n if (!seeking && stalledDuration >= STALL_MINIMUM_DURATION_MS) {\n // Report stalling after trying to fix\n this._reportStall(bufferInfo.len);\n }\n\n var bufferedWithHoles = BufferHelper.bufferInfo(media, currentTime, config.maxBufferHole);\n\n this._tryFixBufferStall(bufferedWithHoles, stalledDuration);\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 ;\n\n _proto._tryFixBufferStall = function _tryFixBufferStall(bufferInfo, stalledDurationMs) {\n var config = this.config,\n fragmentTracker = this.fragmentTracker,\n media = this.media;\n var currentTime = media.currentTime;\n var partial = fragmentTracker.getPartialFragment(currentTime);\n\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); // we return here in this case, meaning\n // the branch below only executes when we don't handle a partial fragment\n\n\n if (targetTime) {\n return;\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\n\n if (bufferInfo.len > config.maxBufferHole && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {\n logger[\"logger\"].warn('Trying to nudge playhead over buffer-hole'); // 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\n this.stalled = null;\n\n this._tryNudgeBuffer();\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 ;\n\n _proto._reportStall = function _reportStall(bufferLen) {\n var hls = this.hls,\n media = this.media,\n stallReported = this.stallReported;\n\n if (!stallReported) {\n // Report stalled error once\n this.stallReported = true;\n logger[\"logger\"].warn(\"Playback stalling at @\" + media.currentTime + \" due to low buffer (buffer=\" + bufferLen + \")\");\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_STALLED_ERROR,\n fatal: false,\n buffer: bufferLen\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 ;\n\n _proto._trySkipBufferHole = function _trySkipBufferHole(partial) {\n var config = this.config,\n hls = this.hls,\n media = this.media;\n var currentTime = media.currentTime;\n var lastEndTime = 0; // Check if currentTime is between unbuffered regions of partial fragments\n\n for (var i = 0; i < media.buffered.length; i++) {\n var startTime = media.buffered.start(i);\n\n if (currentTime + config.maxBufferHole >= lastEndTime && currentTime < startTime) {\n var targetTime = Math.max(startTime + SKIP_BUFFER_RANGE_START, media.currentTime + SKIP_BUFFER_HOLE_STEP_SECONDS);\n logger[\"logger\"].warn(\"skipping hole, adjusting currentTime from \" + currentTime + \" to \" + targetTime);\n this.moved = true;\n this.stalled = null;\n media.currentTime = targetTime;\n\n if (partial) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_SEEK_OVER_HOLE,\n fatal: false,\n reason: \"fragment loaded with buffer holes, seeking from \" + currentTime + \" to \" + targetTime,\n frag: partial\n });\n }\n\n return targetTime;\n }\n\n lastEndTime = media.buffered.end(i);\n }\n\n return 0;\n }\n /**\n * Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.\n * @private\n */\n ;\n\n _proto._tryNudgeBuffer = function _tryNudgeBuffer() {\n var config = this.config,\n hls = this.hls,\n media = this.media;\n var currentTime = media.currentTime;\n var nudgeRetry = (this.nudgeRetry || 0) + 1;\n this.nudgeRetry = nudgeRetry;\n\n if (nudgeRetry < config.nudgeMaxRetry) {\n var targetTime = currentTime + nudgeRetry * config.nudgeOffset; // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n\n logger[\"logger\"].warn(\"Nudging 'currentTime' from \" + currentTime + \" to \" + targetTime);\n media.currentTime = targetTime;\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_NUDGE_ON_STALL,\n fatal: false\n });\n } else {\n logger[\"logger\"].error(\"Playhead still not moving while enough data buffered @\" + currentTime + \" after \" + config.nudgeMaxRetry + \" nudges\");\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_STALLED_ERROR,\n fatal: true\n });\n }\n };\n\n return GapController;\n}();\n\n\n// CONCATENATED MODULE: ./src/task-loop.ts\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction task_loop_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n/**\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 */\nvar TaskLoop = /*#__PURE__*/function (_EventHandler) {\n task_loop_inheritsLoose(TaskLoop, _EventHandler);\n\n function TaskLoop(hls) {\n var _this;\n\n for (var _len = arguments.length, events = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n _this = _EventHandler.call.apply(_EventHandler, [this, hls].concat(events)) || this;\n _this._boundTick = void 0;\n _this._tickTimer = null;\n _this._tickInterval = null;\n _this._tickCallCount = 0;\n _this._boundTick = _this.tick.bind(_assertThisInitialized(_this));\n return _this;\n }\n /**\n * @override\n */\n\n\n var _proto = TaskLoop.prototype;\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n // clear all timers before unregistering from event bus\n this.clearNextTick();\n this.clearInterval();\n }\n /**\n * @returns {boolean}\n */\n ;\n\n _proto.hasInterval = function hasInterval() {\n return !!this._tickInterval;\n }\n /**\n * @returns {boolean}\n */\n ;\n\n _proto.hasNextTick = function hasNextTick() {\n return !!this._tickTimer;\n }\n /**\n * @param {number} millis Interval time (ms)\n * @returns {boolean} True when interval has been scheduled, false when already scheduled (no effect)\n */\n ;\n\n _proto.setInterval = function setInterval(millis) {\n if (!this._tickInterval) {\n this._tickInterval = self.setInterval(this._boundTick, millis);\n return true;\n }\n\n return false;\n }\n /**\n * @returns {boolean} True when interval was cleared, false when none was set (no effect)\n */\n ;\n\n _proto.clearInterval = function clearInterval() {\n if (this._tickInterval) {\n self.clearInterval(this._tickInterval);\n this._tickInterval = null;\n return true;\n }\n\n return false;\n }\n /**\n * @returns {boolean} True when timeout was cleared, false when none was set (no effect)\n */\n ;\n\n _proto.clearNextTick = function clearNextTick() {\n if (this._tickTimer) {\n self.clearTimeout(this._tickTimer);\n this._tickTimer = null;\n return true;\n }\n\n return false;\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 ;\n\n _proto.tick = function tick() {\n this._tickCallCount++;\n\n if (this._tickCallCount === 1) {\n this.doTick(); // 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\n if (this._tickCallCount > 1) {\n // make sure only one timer exists at any time at max\n this.clearNextTick();\n this._tickTimer = self.setTimeout(this._boundTick, 0);\n }\n\n this._tickCallCount = 0;\n }\n }\n /**\n * For subclass to implement task logic\n * @abstract\n */\n ;\n\n _proto.doTick = function doTick() {};\n\n return TaskLoop;\n}(event_handler);\n\n\n// CONCATENATED MODULE: ./src/controller/base-stream-controller.js\n\n\nfunction base_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\nvar State = {\n STOPPED: 'STOPPED',\n STARTING: 'STARTING',\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\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 BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS',\n WAITING_LEVEL: 'WAITING_LEVEL'\n};\n\nvar base_stream_controller_BaseStreamController = /*#__PURE__*/function (_TaskLoop) {\n base_stream_controller_inheritsLoose(BaseStreamController, _TaskLoop);\n\n function BaseStreamController() {\n return _TaskLoop.apply(this, arguments) || this;\n }\n\n var _proto = BaseStreamController.prototype;\n\n _proto.doTick = function doTick() {};\n\n _proto.startLoad = function startLoad() {};\n\n _proto.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n\n this.fragmentTracker.removeFragment(frag);\n }\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null;\n this.clearInterval();\n this.clearNextTick();\n this.state = State.STOPPED;\n };\n\n _proto._streamEnded = function _streamEnded(bufferInfo, levelDetails) {\n var fragCurrent = this.fragCurrent,\n fragmentTracker = this.fragmentTracker; // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n // dont switch to ENDED if we need to backtrack last fragment\n\n if (!levelDetails.live && fragCurrent && !fragCurrent.backtracked && fragCurrent.sn === levelDetails.endSN && !bufferInfo.nextStart) {\n var fragState = fragmentTracker.getState(fragCurrent);\n return fragState === FragmentState.PARTIAL || fragState === FragmentState.OK;\n }\n\n return false;\n };\n\n _proto.onMediaSeeking = function onMediaSeeking() {\n var config = this.config,\n media = this.media,\n mediaBuffer = this.mediaBuffer,\n state = this.state;\n var currentTime = media ? media.currentTime : null;\n var bufferInfo = BufferHelper.bufferInfo(mediaBuffer || media, currentTime, this.config.maxBufferHole);\n logger[\"logger\"].log(\"media seeking to \" + (Object(number[\"isFiniteNumber\"])(currentTime) ? currentTime.toFixed(3) : currentTime));\n\n if (state === State.FRAG_LOADING) {\n var fragCurrent = this.fragCurrent; // check if we are seeking to a unbuffered area AND if frag loading is in progress\n\n if (bufferInfo.len === 0 && fragCurrent) {\n var tolerance = config.maxFragLookUpTolerance;\n var fragStartOffset = fragCurrent.start - tolerance;\n var fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance; // check if we seek position will be out of currently loaded frag range : if out cancel frag load, if in, don't do anything\n\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (fragCurrent.loader) {\n logger[\"logger\"].log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null; // switch to IDLE state to load new fragment\n\n this.state = State.IDLE;\n } else {\n logger[\"logger\"].log('seeking outside of buffer but within currently loaded fragment range');\n }\n }\n } else if (state === State.ENDED) {\n // if seeking to unbuffered area, clean up fragPrevious\n if (bufferInfo.len === 0) {\n this.fragPrevious = null;\n this.fragCurrent = null;\n } // switch to IDLE state to check for potential new fragment\n\n\n this.state = State.IDLE;\n }\n\n if (media) {\n this.lastCurrentTime = currentTime;\n } // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n\n\n if (!this.loadedmetadata) {\n this.nextLoadPosition = this.startPosition = currentTime;\n } // tick to speed up processing\n\n\n this.tick();\n };\n\n _proto.onMediaEnded = function onMediaEnded() {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this.stopLoad();\n\n _TaskLoop.prototype.onHandlerDestroying.call(this);\n };\n\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {\n this.state = State.STOPPED;\n this.fragmentTracker = null;\n };\n\n _proto.computeLivePosition = function computeLivePosition(sliding, levelDetails) {\n var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * levelDetails.targetduration;\n return sliding + Math.max(0, levelDetails.totalduration - targetLatency);\n };\n\n return BaseStreamController;\n}(TaskLoop);\n\n\n// CONCATENATED MODULE: ./src/controller/stream-controller.js\n\n\n\n\n\n\n\nfunction stream_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction stream_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) stream_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) stream_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar TICK_INTERVAL = 100; // how often to tick in ms\n\nvar stream_controller_StreamController = /*#__PURE__*/function (_BaseStreamController) {\n stream_controller_inheritsLoose(StreamController, _BaseStreamController);\n\n function StreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].LEVEL_LOADED, events[\"default\"].LEVELS_UPDATED, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_LOAD_EMERGENCY_ABORTED, events[\"default\"].FRAG_PARSING_INIT_SEGMENT, events[\"default\"].FRAG_PARSING_DATA, events[\"default\"].FRAG_PARSED, events[\"default\"].ERROR, events[\"default\"].AUDIO_TRACK_SWITCHING, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].BUFFER_CREATED, events[\"default\"].BUFFER_APPENDED, events[\"default\"].BUFFER_FLUSHED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = State.STOPPED;\n _this.stallReported = false;\n _this.gapController = null;\n _this.altAudio = false;\n _this.audioOnly = false;\n _this.bitrateTest = false;\n return _this;\n }\n\n var _proto = StreamController.prototype;\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 this.fragLoadError = 0;\n\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls.startLevel;\n\n if (startLevel === -1) {\n if (hls.config.testBandwidth) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.bitrateTest = true;\n } else {\n startLevel = hls.nextAutoLevel;\n }\n } // 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\n\n this.level = hls.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n } // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n\n\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"logger\"].log(\"override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n startPosition = lastCurrentTime;\n }\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\n _proto.stopLoad = function stopLoad() {\n this.forceStartLoad = false;\n\n _BaseStreamController.prototype.stopLoad.call(this);\n };\n\n _proto.doTick = function doTick() {\n switch (this.state) {\n case State.BUFFER_FLUSHING:\n // in buffer flushing state, reset fragLoadError counter\n this.fragLoadError = 0;\n break;\n\n case State.IDLE:\n this._doTickIdle();\n\n break;\n\n case State.WAITING_LEVEL:\n var level = this.levels[this.level]; // check if playlist is already loaded\n\n if (level && level.details) {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = window.performance.now();\n var retryDate = this.retryDate; // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n\n if (!retryDate || now >= retryDate || this.media && this.media.seeking) {\n logger[\"logger\"].log('mediaController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n\n break;\n\n case State.ERROR:\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n\n default:\n break;\n } // check buffer\n\n\n this._checkBuffer(); // check/update current fragment\n\n\n this._checkFragmentChanged();\n } // Ironically the \"idle\" state is the on we do the most logic in it seems ....\n // NOTE: Maybe we could rather schedule a check for buffer length after half of the currently\n // played segment, or on pause/play/seek instead of naively checking every 100ms?\n ;\n\n _proto._doTickIdle = function _doTickIdle() {\n var hls = this.hls,\n config = hls.config,\n media = this.media; // if start level not parsed yet OR\n // if video not attached AND start fragment already requested OR start frag prefetch disable\n // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment\n\n if (this.levelLastLoaded === undefined || !media && (this.startFragRequested || !config.startFragPrefetch)) {\n return;\n } // If the \"main\" level is audio-only but we are loading an alternate track in the same group, do not load anything\n\n\n if (this.altAudio && this.audioOnly) {\n // Clear audio demuxer state so when switching back to main audio we're not still appending where we left off\n this.demuxer.frag = null;\n return;\n } // if we have not yet loaded any fragment, start loading from start position\n\n\n var pos;\n\n if (this.loadedmetadata) {\n pos = media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n } // determine next load level\n\n\n var level = hls.nextLoadLevel,\n levelInfo = this.levels[level];\n\n if (!levelInfo) {\n return;\n }\n\n var levelBitrate = levelInfo.bitrate,\n maxBufLen; // compute max Buffer Length that we could get from this load level, based on level bitrate.\n\n if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength); // determine next candidate fragment to be loaded, based on current position and end of buffer position\n // ensure up to `config.maxMaxBufferLength` of buffer upfront\n\n var maxBufferHole = pos < config.maxBufferHole ? Math.max(MAX_START_GAP_JUMP, config.maxBufferHole) : config.maxBufferHole;\n var bufferInfo = BufferHelper.bufferInfo(this.mediaBuffer ? this.mediaBuffer : media, pos, maxBufferHole);\n var bufferLen = bufferInfo.len; // Stay idle if we are still with buffer margins\n\n if (bufferLen >= maxBufLen) {\n return;\n } // if buffer length is less than maxBufLen try to load a new fragment ...\n\n\n logger[\"logger\"].trace(\"buffer length of \" + bufferLen.toFixed(3) + \" is below max of \" + maxBufLen.toFixed(3) + \". checking for more payload ...\"); // set next load level : this will trigger a playlist load if needed\n\n this.level = hls.nextLoadLevel = level;\n var levelDetails = levelInfo.details; // 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\n if (!levelDetails || levelDetails.live && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n return;\n }\n\n if (this._streamEnded(bufferInfo, levelDetails)) {\n var data = {};\n\n if (this.altAudio) {\n data.type = 'video';\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_EOS, data);\n this.state = State.ENDED;\n return;\n } // if we have the levelDetails for the selected variant, lets continue enrichen our stream (load keys/fragments or trigger EOS, etc..)\n\n\n this._fetchPayloadOrEos(pos, bufferInfo, levelDetails);\n };\n\n _proto._fetchPayloadOrEos = function _fetchPayloadOrEos(pos, bufferInfo, levelDetails) {\n var fragPrevious = this.fragPrevious,\n level = this.level,\n fragments = levelDetails.fragments,\n fragLen = fragments.length; // empty playlist\n\n if (fragLen === 0) {\n return;\n } // find fragment index, contiguous with end of buffer position\n\n\n var start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n bufferEnd = bufferInfo.end,\n frag;\n\n if (levelDetails.initSegment && !levelDetails.initSegment.data) {\n frag = levelDetails.initSegment;\n } else {\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n var initialLiveManifestSize = this.config.initialLiveManifestSize;\n\n if (fragLen < initialLiveManifestSize) {\n logger[\"logger\"].warn(\"Can not start playback of a level, reason: not enough fragments \" + fragLen + \" < \" + initialLiveManifestSize);\n return;\n }\n\n frag = this._ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments); // if it explicitely returns null don't load any fragment and exit function now\n\n if (frag === null) {\n return;\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n }\n\n if (!frag) {\n frag = this._findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails);\n }\n\n if (frag) {\n if (frag.encrypted) {\n this._loadKey(frag, levelDetails);\n } else {\n this._loadFragment(frag, levelDetails, pos, bufferEnd);\n }\n }\n };\n\n _proto._ensureFragmentAtLivePoint = function _ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments) {\n var config = this.hls.config,\n media = this.media;\n var frag; // check if requested position is within seekable boundaries :\n // logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n\n var maxLatency = Infinity;\n\n if (config.liveMaxLatencyDuration !== undefined) {\n maxLatency = config.liveMaxLatencyDuration;\n } else if (Object(number[\"isFiniteNumber\"])(config.liveMaxLatencyDurationCount)) {\n maxLatency = config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n }\n\n if (bufferEnd < Math.max(start - config.maxFragLookUpTolerance, end - maxLatency)) {\n var liveSyncPosition = this.liveSyncPosition = this.computeLivePosition(start, levelDetails);\n bufferEnd = liveSyncPosition;\n\n if (media && !media.paused && media.readyState && media.duration > liveSyncPosition && liveSyncPosition > media.currentTime) {\n logger[\"logger\"].log(\"buffer end: \" + bufferEnd.toFixed(3) + \" is located too far from the end of live sliding playlist, reset currentTime to : \" + liveSyncPosition.toFixed(3));\n media.currentTime = liveSyncPosition;\n }\n\n this.nextLoadPosition = liveSyncPosition;\n } // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n // don't return null in case media not loaded yet (readystate === 0)\n\n\n if (levelDetails.PTSKnown && bufferEnd > end && media && media.readyState) {\n return null;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n if (levelDetails.hasProgramDateTime) {\n // Relies on PDT in order to switch bitrates (Support EXT-X-DISCONTINUITY without EXT-X-DISCONTINUITY-SEQUENCE)\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with same PDT: \" + fragPrevious.programDateTime);\n frag = findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, config.maxFragLookUpTolerance);\n } else {\n // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)\n var targetSN = fragPrevious.sn + 1;\n\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with next SN: \" + frag.sn);\n }\n } // next frag SN not available (or not with same continuity counter)\n // look for a frag sharing the same CC\n\n\n if (!frag) {\n frag = binary_search.search(fragments, function (frag) {\n return fragPrevious.cc - frag.cc;\n });\n\n if (frag) {\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with same CC: \" + frag.sn);\n }\n }\n }\n }\n }\n\n return frag;\n };\n\n _proto._findFragment = function _findFragment(start, fragPreviousLoad, fragmentIndexRange, fragments, bufferEnd, end, levelDetails) {\n var config = this.hls.config;\n var fragNextLoad;\n\n if (bufferEnd < end) {\n var lookupTolerance = bufferEnd > end - config.maxFragLookUpTolerance ? 0 : config.maxFragLookUpTolerance; // 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\n fragNextLoad = findFragmentByPTS(fragPreviousLoad, fragments, bufferEnd, lookupTolerance);\n } else {\n // reach end of playlist\n fragNextLoad = fragments[fragmentIndexRange - 1];\n }\n\n if (fragNextLoad) {\n var curSNIdx = fragNextLoad.sn - levelDetails.startSN;\n var sameLevel = fragPreviousLoad && fragNextLoad.level === fragPreviousLoad.level;\n var prevSnFrag = fragments[curSNIdx - 1];\n var nextSnFrag = fragments[curSNIdx + 1]; // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n\n if (fragPreviousLoad && fragNextLoad.sn === fragPreviousLoad.sn) {\n if (sameLevel && !fragNextLoad.backtracked) {\n if (fragNextLoad.sn < levelDetails.endSN) {\n var deltaPTS = fragPreviousLoad.deltaPTS; // if there is a significant delta between audio and video, larger than max allowed hole,\n // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped)\n // let's try to load previous fragment again to get last keyframe\n // then we will reload again current fragment (that way we should be able to fill the buffer hole ...)\n\n if (deltaPTS && deltaPTS > config.maxBufferHole && fragPreviousLoad.dropped && curSNIdx) {\n fragNextLoad = prevSnFrag;\n logger[\"logger\"].warn('Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this');\n } else {\n fragNextLoad = nextSnFrag;\n\n if (this.fragmentTracker.getState(fragNextLoad) !== FragmentState.OK) {\n logger[\"logger\"].log(\"Re-loading fragment with SN: \" + fragNextLoad.sn);\n }\n }\n } else {\n fragNextLoad = null;\n }\n } else if (fragNextLoad.backtracked) {\n // Only backtrack a max of 1 consecutive fragment to prevent sliding back too far when little or no frags start with keyframes\n if (nextSnFrag && nextSnFrag.backtracked) {\n logger[\"logger\"].warn(\"Already backtracked from fragment \" + nextSnFrag.sn + \", will not backtrack to fragment \" + fragNextLoad.sn + \". Loading fragment \" + nextSnFrag.sn);\n fragNextLoad = nextSnFrag;\n } else {\n // If a fragment has dropped frames and it's in a same level/sequence, load the previous fragment to try and find the keyframe\n // Reset the dropped count now since it won't be reset until we parse the fragment again, which prevents infinite backtracking on the same segment\n logger[\"logger\"].warn('Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe');\n fragNextLoad.dropped = 0;\n\n if (prevSnFrag) {\n fragNextLoad = prevSnFrag;\n fragNextLoad.backtracked = true;\n } else if (curSNIdx) {\n // can't backtrack on very first fragment\n fragNextLoad = null;\n }\n }\n }\n }\n }\n\n return fragNextLoad;\n };\n\n _proto._loadKey = function _loadKey(frag, levelDetails) {\n logger[\"logger\"].log(\"Loading key for \" + frag.sn + \" of [\" + levelDetails.startSN + \"-\" + levelDetails.endSN + \"], level \" + this.level);\n this.state = State.KEY_LOADING;\n this.hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: frag\n });\n };\n\n _proto._loadFragment = function _loadFragment(frag, levelDetails, pos, bufferEnd) {\n // Check if fragment is not loaded\n var fragState = this.fragmentTracker.getState(frag);\n this.fragCurrent = frag;\n\n if (frag.sn !== 'initSegment') {\n this.startFragRequested = true;\n } // Don't update nextLoadPosition for fragments which are not buffered\n\n\n if (Object(number[\"isFiniteNumber\"])(frag.sn) && !frag.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n } // Allow backtracked fragments to load\n\n\n if (frag.backtracked || fragState === FragmentState.NOT_LOADED || fragState === FragmentState.PARTIAL) {\n frag.autoLevel = this.hls.autoLevelEnabled;\n frag.bitrateTest = this.bitrateTest;\n logger[\"logger\"].log(\"Loading \" + frag.sn + \" of [\" + levelDetails.startSN + \"-\" + levelDetails.endSN + \"], level \" + this.level + \", \" + (this.loadedmetadata ? 'currentTime' : 'nextLoadPosition') + \": \" + parseFloat(pos.toFixed(3)) + \", bufferEnd: \" + parseFloat(bufferEnd.toFixed(3)));\n this.hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: frag\n }); // lazy demuxer init, as this could take some time ... do it during frag loading\n\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'main');\n }\n\n this.state = State.FRAG_LOADING;\n } else if (fragState === FragmentState.APPENDING) {\n // Lower the buffer size and try again\n if (this._reduceMaxBufferLength(frag.duration)) {\n this.fragmentTracker.removeFragment(frag);\n }\n }\n };\n\n _proto.getBufferedFrag = function getBufferedFrag(position) {\n return this.fragmentTracker.getBufferedFrag(position, PlaylistLevelType.MAIN);\n };\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.endPTS + 0.5);\n }\n\n return null;\n };\n\n _proto._checkFragmentChanged = function _checkFragmentChanged() {\n var fragPlayingCurrent,\n currentTime,\n video = this.media;\n\n if (video && video.readyState && video.seeking === false) {\n 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 (currentTime > this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n\n if (BufferHelper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getBufferedFrag(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.getBufferedFrag(currentTime + 0.1);\n }\n\n if (fragPlayingCurrent) {\n var fragPlaying = fragPlayingCurrent;\n\n if (fragPlaying !== this.fragPlaying) {\n this.hls.trigger(events[\"default\"].FRAG_CHANGED, {\n frag: fragPlaying\n });\n var fragPlayingLevel = fragPlaying.level;\n\n if (!this.fragPlaying || this.fragPlaying.level !== fragPlayingLevel) {\n this.hls.trigger(events[\"default\"].LEVEL_SWITCHED, {\n level: fragPlayingLevel\n });\n }\n\n this.fragPlaying = fragPlaying;\n }\n }\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 ;\n\n _proto.immediateLevelSwitch = function immediateLevelSwitch() {\n logger[\"logger\"].log('immediateLevelSwitch');\n\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n var media = this.media,\n previouslyPaused;\n\n if (media) {\n previouslyPaused = media.paused;\n\n if (!previouslyPaused) {\n media.pause();\n }\n } else {\n // don't restart playback after instant level switch in case media not attached\n previouslyPaused = true;\n }\n\n this.previouslyPaused = previouslyPaused;\n }\n\n var fragCurrent = this.fragCurrent;\n\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null; // flush everything\n\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n /**\n * on immediate level switch end, after new fragment has been buffered:\n * - nudge video decoder by slightly adjusting video currentTime (if currentTime buffered)\n * - resume the playback if needed\n */\n ;\n\n _proto.immediateLevelSwitchEnd = function immediateLevelSwitchEnd() {\n var media = this.media;\n\n if (media && media.buffered.length) {\n this.immediateSwitch = false;\n\n if (media.currentTime > 0 && BufferHelper.isBuffered(media, media.currentTime)) {\n // only nudge if currentTime is buffered\n media.currentTime -= 0.0001;\n }\n\n if (!this.previouslyPaused) {\n media.play();\n }\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 ;\n\n _proto.nextLevelSwitch = function nextLevelSwitch() {\n var media = this.media; // ensure that media is defined and that metadata are available (to retrieve currentTime)\n\n if (media && media.readyState) {\n var fetchdelay;\n var fragPlayingCurrent = this.getBufferedFrag(media.currentTime);\n\n if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 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.startPTS - 1);\n }\n\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,\n nextLevel = this.levels[nextLevelId],\n fragLastKbps = this.fragLastKbps;\n\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n } // logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n\n\n var bufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n\n if (bufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n var nextBufferedFrag = this.followingBufferedFrag(bufferedFrag);\n\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null; // start flush position is the start PTS of next buffered frag.\n // we use frag.naxStartPTS which is max(audio startPTS, video startPTS).\n // in case there is a small PTS Delta between audio and video, using maxStartPTS avoids flushing last samples from current fragment\n\n var startPts = Math.max(bufferedFrag.endPTS, nextBufferedFrag.maxStartPTS + Math.min(this.config.maxFragLookUpTolerance, nextBufferedFrag.duration));\n this.flushMainBuffer(startPts, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n\n _proto.flushMainBuffer = function flushMainBuffer(startOffset, endOffset) {\n this.state = State.BUFFER_FLUSHING;\n var flushScope = {\n startOffset: startOffset,\n endOffset: endOffset\n }; // if alternate audio tracks are used, only flush video, otherwise flush everything\n\n if (this.altAudio) {\n flushScope.type = 'video';\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHING, flushScope);\n };\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n\n if (this.levels && config.autoStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n\n this.gapController = new gap_controller_GapController(config, media, this.fragmentTracker, this.hls);\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n\n if (media && media.ended) {\n logger[\"logger\"].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n } // reset fragment backtracked flag\n\n\n var levels = this.levels;\n\n if (levels) {\n levels.forEach(function (level) {\n if (level.details) {\n level.details.fragments.forEach(function (fragment) {\n fragment.backtracked = undefined;\n });\n }\n });\n } // remove video listeners\n\n\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n\n this.fragmentTracker.removeAllFragments();\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n _proto.onMediaSeeked = function onMediaSeeked() {\n var media = this.media;\n var currentTime = media ? media.currentTime : undefined;\n\n if (Object(number[\"isFiniteNumber\"])(currentTime)) {\n logger[\"logger\"].log(\"media seeked to \" + currentTime.toFixed(3));\n } // tick to speed up FRAGMENT_PLAYING triggering\n\n\n this.tick();\n };\n\n _proto.onManifestLoading = function onManifestLoading() {\n // reset buffer on manifest loading\n logger[\"logger\"].log('trigger BUFFER_RESET');\n this.hls.trigger(events[\"default\"].BUFFER_RESET);\n this.fragmentTracker.removeAllFragments();\n this.stalled = false;\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var aac = false,\n heaac = false,\n codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = aac && heaac;\n\n if (this.audioCodecSwitch) {\n logger[\"logger\"].log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n\n this.altAudio = data.altAudio;\n this.levels = data.levels;\n this.startFragRequested = false;\n var config = this.config;\n\n if (config.autoStartLoad || this.forceStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n var newDetails = data.details;\n var newLevelId = data.level;\n var lastLevel = this.levels[this.levelLastLoaded];\n var curLevel = this.levels[newLevelId];\n var duration = newDetails.totalduration;\n var sliding = 0;\n logger[\"logger\"].log(\"level \" + newLevelId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n\n if (newDetails.live || curLevel.details && curLevel.details.live) {\n var curDetails = curLevel.details;\n\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n\n if (newDetails.PTSKnown && Object(number[\"isFiniteNumber\"])(sliding)) {\n logger[\"logger\"].log(\"live playlist sliding:\" + sliding.toFixed(3));\n } else {\n logger[\"logger\"].log('live playlist - outdated PTS, unknown sliding');\n alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n logger[\"logger\"].log('live playlist - first load, unknown sliding');\n newDetails.PTSKnown = false;\n alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n newDetails.PTSKnown = false;\n } // override level info\n\n\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(events[\"default\"].LEVEL_UPDATED, {\n details: newDetails,\n level: newLevelId\n });\n\n if (this.startFragRequested === false) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1 || this.lastCurrentTime === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n if (startTimeOffset < 0) {\n logger[\"logger\"].log(\"negative start time offset \" + startTimeOffset + \", count from end of last fragment\");\n startTimeOffset = sliding + duration + startTimeOffset;\n }\n\n logger[\"logger\"].log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"logger\"].log(\"configure startPosition to \" + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n\n this.lastCurrentTime = this.startPosition;\n }\n\n this.nextLoadPosition = this.startPosition;\n } // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n\n\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n } // trigger handler right now\n\n\n this.tick();\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n hls = this.hls,\n levels = this.levels,\n media = this.media;\n var fragLoaded = data.frag;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'main' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var stats = data.stats;\n var currentLevel = levels[fragCurrent.level];\n var details = currentLevel.details; // reset frag bitrate test in any case after frag loaded event\n // if this frag was loaded to perform a bitrate test AND if hls.nextLoadLevel is greater than 0\n // then this means that we should be able to load a fragment at a higher quality level\n\n this.bitrateTest = false;\n this.stats = stats;\n logger[\"logger\"].log(\"Loaded \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level);\n\n if (fragLoaded.bitrateTest && hls.nextLoadLevel) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.startFragRequested = false;\n stats.tparsed = stats.tbuffered = window.performance.now();\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'main'\n });\n this.tick();\n } else if (fragLoaded.sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = window.performance.now();\n details.initSegment.data = data.payload;\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'main'\n });\n this.tick();\n } else {\n logger[\"logger\"].log(\"Parsing \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level + \", cc \" + fragCurrent.cc);\n this.state = State.PARSING;\n this.pendingBuffering = true;\n this.appended = false; // Bitrate test frags are not usually buffered so the fragment tracker ignores them. If Hls.js decides to buffer\n // it (and therefore ends up at this line), then the fragment tracker needs to be manually informed.\n\n if (fragLoaded.bitrateTest) {\n fragLoaded.bitrateTest = false;\n this.fragmentTracker.onFragLoaded({\n frag: fragLoaded\n });\n } // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live) and if media is not seeking (this is to overcome potential timestamp drifts between playlists and fragments)\n\n\n var accurateTimeOffset = !(media && media.seeking) && (details.PTSKnown || !details.live);\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n\n var audioCodec = this._getAudioCodec(currentLevel); // transmux the MPEG-TS data to ISO-BMFF segments\n\n\n var demuxer = this.demuxer = this.demuxer || new demux_demuxer(this.hls, 'main');\n demuxer.push(data.payload, initSegmentData, audioCodec, currentLevel.videoCodec, fragCurrent, details.totalduration, accurateTimeOffset);\n }\n }\n\n this.fragLoadError = 0;\n };\n\n _proto.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n trackName,\n track;\n this.audioOnly = tracks.audio && !tracks.video; // if audio track is expected to come from audio stream controller, discard any coming from main\n\n if (this.altAudio && !this.audioOnly) {\n delete tracks.audio;\n } // include levelCodec in audio and video tracks\n\n\n track = tracks.audio;\n\n if (track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n\n if (audioCodec && this.audioCodecSwap) {\n logger[\"logger\"].log('swapping playlist audio codec');\n\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n } // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n\n\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if (track.metadata.channelCount !== 1 && // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n } // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n\n\n if (ua.indexOf('android') !== -1 && track.container !== 'audio/mpeg') {\n // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n logger[\"logger\"].log(\"Android: force audio codec to \" + audioCodec);\n }\n\n track.levelCodec = audioCodec;\n track.id = data.id;\n }\n\n track = tracks.video;\n\n if (track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n track.id = data.id;\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_CODECS, tracks); // loop through tracks that are going to be provided to bufferController\n\n for (trackName in tracks) {\n track = tracks[trackName];\n logger[\"logger\"].log(\"main track:\" + trackName + \",container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n\n if (initSegment) {\n this.appended = true; // arm pending Buffering flag before appending a segment\n\n this.pendingBuffering = true;\n this.hls.trigger(events[\"default\"].BUFFER_APPENDING, {\n type: trackName,\n data: initSegment,\n parent: 'main',\n content: 'initSegment'\n });\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n };\n\n _proto.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && !(data.type === 'audio' && this.altAudio) && // filter out main audio if audio track is loaded through audio stream controller\n this.state === State.PARSING) {\n var level = this.levels[this.level],\n frag = fragCurrent;\n\n if (!Object(number[\"isFiniteNumber\"])(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n if (data.hasAudio === true) {\n frag.addElementaryStream(ElementaryStreamTypes.AUDIO);\n }\n\n if (data.hasVideo === true) {\n frag.addElementaryStream(ElementaryStreamTypes.VIDEO);\n }\n\n logger[\"logger\"].log(\"Parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb + \",dropped:\" + (data.dropped || 0)); // Detect gaps in a fragment and try to fix it by finding a keyframe in the previous fragment (see _findFragments)\n\n if (data.type === 'video') {\n frag.dropped = data.dropped;\n\n if (frag.dropped) {\n if (!frag.backtracked) {\n var levelDetails = level.details;\n\n if (levelDetails && frag.sn === levelDetails.startSN) {\n logger[\"logger\"].warn('missing video frame(s) on first frag, appending with gap', frag.sn);\n } else {\n logger[\"logger\"].warn('missing video frame(s), backtracking fragment', frag.sn); // Return back to the IDLE state without appending to buffer\n // Causes findFragments to backtrack a segment and find the keyframe\n // Audio fragments arriving before video sets the nextLoadPosition, causing _findFragments to skip the backtracked fragment\n\n this.fragmentTracker.removeFragment(frag);\n frag.backtracked = true;\n this.nextLoadPosition = data.startPTS;\n this.state = State.IDLE;\n this.fragPrevious = frag;\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n\n this.tick();\n return;\n }\n } else {\n logger[\"logger\"].warn('Already backtracked on this fragment, appending with the gap', frag.sn);\n }\n } else {\n // Only reset the backtracked flag if we've loaded the frag without any dropped frames\n frag.backtracked = false;\n }\n }\n\n var drift = updateFragPTSDTS(level.details, frag, data.startPTS, data.endPTS, data.startDTS, data.endDTS),\n hls = this.hls;\n hls.trigger(events[\"default\"].LEVEL_PTS_UPDATED, {\n details: level.details,\n level: this.level,\n drift: drift,\n type: data.type,\n start: data.startPTS,\n end: data.endPTS\n }); // has remuxer dropped video frames located before first keyframe ?\n\n [data.data1, data.data2].forEach(function (buffer) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (buffer && buffer.length && _this2.state === State.PARSING) {\n _this2.appended = true; // arm pending Buffering flag before appending a segment\n\n _this2.pendingBuffering = true;\n hls.trigger(events[\"default\"].BUFFER_APPENDING, {\n type: data.type,\n data: buffer,\n parent: 'main',\n content: 'data'\n });\n }\n }); // trigger handler right now\n\n this.tick();\n }\n };\n\n _proto.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = window.performance.now();\n this.state = State.PARSED;\n\n this._checkAppendedParsed();\n }\n };\n\n _proto.onAudioTrackSwitching = function onAudioTrackSwitching(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 var trackId = data.id; // 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\n if (!altAudio) {\n if (this.mediaBuffer !== this.media) {\n logger[\"logger\"].log('switching on main audio, use media.buffered to schedule main fragment loading');\n this.mediaBuffer = this.media;\n var fragCurrent = this.fragCurrent; // we need to refill audio buffer from main: cancel any frag loading to speed up audio switch\n\n if (fragCurrent.loader) {\n logger[\"logger\"].log('switching to main audio track, cancel main fragment load');\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null; // destroy demuxer to force init segment generation (following audio switch)\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n } // switch to IDLE state to load new fragment\n\n\n this.state = State.IDLE;\n }\n\n var hls = this.hls; // If switching from alt to main audio, flush all audio and trigger track switched\n\n if (fromAltAudio) {\n hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n }\n\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n };\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var trackId = data.id,\n altAudio = !!this.hls.audioTracks[trackId].url;\n\n if (altAudio) {\n var videoBuffer = this.videoBuffer; // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered\n\n if (videoBuffer && this.mediaBuffer !== videoBuffer) {\n logger[\"logger\"].log('switching on alternate audio, use video.buffered to schedule main fragment loading');\n this.mediaBuffer = videoBuffer;\n }\n }\n\n this.altAudio = altAudio;\n this.tick();\n };\n\n _proto.onBufferCreated = function onBufferCreated(data) {\n var tracks = data.tracks,\n mediaTrack,\n name,\n alternate = false;\n\n for (var type in tracks) {\n var track = tracks[type];\n\n if (track.id === 'main') {\n name = type;\n mediaTrack = track; // keep video source buffer reference\n\n if (type === 'video') {\n this.videoBuffer = tracks[type].buffer;\n }\n } else {\n alternate = true;\n }\n }\n\n if (alternate && mediaTrack) {\n logger[\"logger\"].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\n _proto.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'main') {\n var state = this.state;\n\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n\n this._checkAppendedParsed();\n }\n }\n };\n\n _proto._checkAppendedParsed = function _checkAppendedParsed() {\n // trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent;\n\n if (frag) {\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"logger\"].log(\"main buffered : \" + time_ranges.toString(media.buffered));\n this.fragPrevious = frag;\n var stats = this.stats;\n stats.tbuffered = window.performance.now(); // we should get rid of this.fragLastKbps\n\n this.fragLastKbps = Math.round(8 * stats.total / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: frag,\n id: 'main'\n });\n this.state = State.IDLE;\n } // Do not tick when _seekToStartPos needs to be called as seeking to the start can fail on live streams at this point\n\n\n if (this.loadedmetadata || this.startPosition <= 0) {\n this.tick();\n }\n }\n };\n\n _proto.onError = function onError(data) {\n var frag = data.frag || this.fragCurrent; // don't handle frag error not related to main fragment\n\n if (frag && frag.type !== 'main') {\n return;\n } // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n\n\n var mediaBuffered = !!this.media && BufferHelper.isBuffered(this.media, this.media.currentTime) && BufferHelper.isBuffered(this.media, this.media.currentTime + 0.5);\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n if (!data.fatal) {\n // keep retrying until the limit will be reached\n if (this.fragLoadError + 1 <= this.config.fragLoadingMaxRetry) {\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, this.fragLoadError) * this.config.fragLoadingRetryDelay, this.config.fragLoadingMaxRetryTimeout);\n logger[\"logger\"].warn(\"mediaController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = window.performance.now() + delay; // retry loading state\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\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n\n this.fragLoadError++;\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"logger\"].error(\"mediaController: \" + data.details + \" reaches max retry, redispatch as fatal ...\"); // switch error to fatal\n\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR:\n case errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT:\n if (this.state !== State.ERROR) {\n if (data.fatal) {\n // if fatal error, stop processing\n this.state = State.ERROR;\n logger[\"logger\"].warn(\"streamController: \" + data.details + \",switch to \" + this.state + \" state ...\");\n } else {\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) {\n this.state = State.IDLE;\n }\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'main' && (this.state === State.PARSING || this.state === State.PARSED)) {\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n this._reduceMaxBufferLength(this.config.maxBufferLength);\n\n this.state = State.IDLE;\n } else {\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 buffer to recover\n logger[\"logger\"].warn('buffer full error also media.currentTime is not buffered, flush everything');\n this.fragCurrent = null; // flush everything\n\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n }\n\n break;\n\n default:\n break;\n }\n };\n\n _proto._reduceMaxBufferLength = function _reduceMaxBufferLength(minLength) {\n var config = this.config;\n\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger[\"logger\"].warn(\"main:reduce max buffer length to \" + config.maxMaxBufferLength + \"s\");\n return true;\n }\n\n return false;\n }\n /**\n * Checks the health of the buffer and attempts to resolve playback stalls.\n * @private\n */\n ;\n\n _proto._checkBuffer = function _checkBuffer() {\n var media = this.media;\n\n if (!media || media.readyState === 0) {\n // Exit early if we don't have media or if the media hasn't bufferd anything yet (readyState 0)\n return;\n }\n\n var mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media;\n var buffered = mediaBuffer.buffered;\n\n if (!this.loadedmetadata && buffered.length) {\n this.loadedmetadata = true;\n\n this._seekToStartPos();\n } else if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n } else {\n this.gapController.poll(this.lastCurrentTime, buffered);\n }\n };\n\n _proto.onFragLoadEmergencyAborted = function onFragLoadEmergencyAborted() {\n this.state = State.IDLE; // if loadedmetadata is not set, it means that we are emergency switch down on first frag\n // in that case, reset startFragRequested flag\n\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n\n this.tick();\n };\n\n _proto.onBufferFlushed = function onBufferFlushed() {\n /* after successful buffer flushing, filter flushed fragments from bufferedFrags\n use mediaBuffered instead of media (so that we will check against video.buffered ranges in case of alt audio track)\n */\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n\n if (media) {\n // filter fragments potentially evicted from buffer. this is to avoid memleak on live streams\n var elementaryStreamType = this.audioOnly ? ElementaryStreamTypes.AUDIO : ElementaryStreamTypes.VIDEO;\n this.fragmentTracker.detectEvictedFragments(elementaryStreamType, media.buffered);\n } // move to IDLE once flush complete. this should trigger new fragment loading\n\n\n this.state = State.IDLE; // reset reference to frag\n\n this.fragPrevious = null;\n };\n\n _proto.onLevelsUpdated = function onLevelsUpdated(data) {\n this.levels = data.levels;\n };\n\n _proto.swapAudioCodec = function swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n /**\n * Seeks to the set startPosition if not equal to the mediaElement's current time.\n * @private\n */\n ;\n\n _proto._seekToStartPos = function _seekToStartPos() {\n var media = this.media;\n var currentTime = media.currentTime;\n var startPosition = this.startPosition; // 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\n if (currentTime !== startPosition && startPosition >= 0) {\n if (media.seeking) {\n logger[\"logger\"].log(\"could not seek to \" + startPosition + \", already seeking at \" + currentTime);\n return;\n }\n\n var bufferStart = media.buffered.length ? media.buffered.start(0) : 0;\n var delta = bufferStart - startPosition;\n\n if (delta > 0 && delta < this.config.maxBufferHole) {\n logger[\"logger\"].log(\"adjusting start position by \" + delta + \" to match buffer start\");\n startPosition += delta;\n this.startPosition = startPosition;\n }\n\n logger[\"logger\"].log(\"seek to target start position \" + startPosition + \" from current time \" + currentTime + \". ready state \" + media.readyState);\n media.currentTime = startPosition;\n }\n };\n\n _proto._getAudioCodec = function _getAudioCodec(currentLevel) {\n var audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n\n if (this.audioCodecSwap) {\n logger[\"logger\"].log('swapping playlist audio codec');\n\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 }\n\n return audioCodec;\n };\n\n stream_controller_createClass(StreamController, [{\n key: \"state\",\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"logger\"].log(\"main stream-controller: \" + previousState + \"->\" + nextState);\n this.hls.trigger(events[\"default\"].STREAM_STATE_TRANSITION, {\n previousState: previousState,\n nextState: nextState\n });\n }\n },\n get: function get() {\n return this._state;\n }\n }, {\n key: \"currentLevel\",\n get: function get() {\n var media = this.media;\n\n if (media) {\n var frag = this.getBufferedFrag(media.currentTime);\n\n if (frag) {\n return frag.level;\n }\n }\n\n return -1;\n }\n }, {\n key: \"nextBufferedFrag\",\n get: function get() {\n var media = this.media;\n\n if (media) {\n // first get end range of current fragment\n return this.followingBufferedFrag(this.getBufferedFrag(media.currentTime));\n } else {\n return null;\n }\n }\n }, {\n key: \"nextLevel\",\n get: function get() {\n var frag = this.nextBufferedFrag;\n\n if (frag) {\n return frag.level;\n } else {\n return -1;\n }\n }\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n return this._liveSyncPosition;\n },\n set: function set(value) {\n this._liveSyncPosition = value;\n }\n }]);\n\n return StreamController;\n}(base_stream_controller_BaseStreamController);\n\n/* harmony default export */ var stream_controller = (stream_controller_StreamController);\n// CONCATENATED MODULE: ./src/controller/level-controller.js\nfunction level_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction level_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) level_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) level_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction level_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Level Controller\n*/\n\n\n\n\n\n\nvar chromeOrFirefox;\n\nvar level_controller_LevelController = /*#__PURE__*/function (_EventHandler) {\n level_controller_inheritsLoose(LevelController, _EventHandler);\n\n function LevelController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MANIFEST_LOADED, events[\"default\"].LEVEL_LOADED, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].FRAG_LOADED, events[\"default\"].ERROR) || this;\n _this.canload = false;\n _this.currentLevelIndex = null;\n _this.manualLevelIndex = -1;\n _this.timer = null;\n chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());\n return _this;\n }\n\n var _proto = LevelController.prototype;\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this.clearTimer();\n this.manualLevelIndex = -1;\n };\n\n _proto.clearTimer = function clearTimer() {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n _proto.startLoad = function startLoad() {\n var levels = this._levels;\n this.canload = true;\n this.levelRetryCount = 0; // clean up live level details to force reload them, and reset load errors\n\n if (levels) {\n levels.forEach(function (level) {\n level.loadError = 0;\n var levelDetails = level.details;\n\n if (levelDetails && levelDetails.live) {\n level.details = undefined;\n }\n });\n } // speed up live playlist refresh if timer exists\n\n\n if (this.timer !== null) {\n this.loadLevel();\n }\n };\n\n _proto.stopLoad = function stopLoad() {\n this.canload = false;\n };\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var levels = [];\n var audioTracks = [];\n var bitrateStart;\n var levelSet = {};\n var levelFromSet = null;\n var videoCodecFound = false;\n var audioCodecFound = false; // regroup redundant levels together\n\n data.levels.forEach(function (level) {\n var attributes = level.attrs;\n level.loadError = 0;\n level.fragmentError = false;\n videoCodecFound = videoCodecFound || !!level.videoCodec;\n audioCodecFound = audioCodecFound || !!level.audioCodec; // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n\n if (chromeOrFirefox && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {\n level.audioCodec = undefined;\n }\n\n levelFromSet = levelSet[level.bitrate]; // FIXME: we would also have to match the resolution here\n\n if (!levelFromSet) {\n level.url = [level.url];\n level.urlId = 0;\n levelSet[level.bitrate] = level;\n levels.push(level);\n } else {\n levelFromSet.url.push(level.url);\n }\n\n if (attributes) {\n if (attributes.AUDIO) {\n addGroupId(levelFromSet || level, 'audio', attributes.AUDIO);\n }\n\n if (attributes.SUBTITLES) {\n addGroupId(levelFromSet || level, 'text', attributes.SUBTITLES);\n }\n }\n }); // remove audio-only level if we also have levels with audio+video codecs signalled\n\n if (videoCodecFound && audioCodecFound) {\n levels = levels.filter(function (_ref) {\n var videoCodec = _ref.videoCodec;\n return !!videoCodec;\n });\n } // only keep levels with supported audio/video codecs\n\n\n levels = levels.filter(function (_ref2) {\n var audioCodec = _ref2.audioCodec,\n videoCodec = _ref2.videoCodec;\n return (!audioCodec || isCodecSupportedInMp4(audioCodec, 'audio')) && (!videoCodec || isCodecSupportedInMp4(videoCodec, 'video'));\n });\n\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio');\n }); // Reassign id's after filtering since they're used as array indices\n\n audioTracks.forEach(function (track, index) {\n track.id = index;\n });\n }\n\n if (levels.length > 0) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate; // sort level on bitrate\n\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels; // find index of first level in sorted levels\n\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger[\"logger\"].log(\"manifest loaded,\" + levels.length + \" level(s) found, first bitrate:\" + bitrateStart);\n break;\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\n\n var audioOnly = audioCodecFound && !videoCodecFound;\n this.hls.trigger(events[\"default\"].MANIFEST_PARSED, {\n levels: levels,\n audioTracks: audioTracks,\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 } else {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: this.hls.url,\n reason: 'no level with compatible codecs found in manifest'\n });\n }\n };\n\n _proto.setLevelInternal = function setLevelInternal(newLevel) {\n var levels = this._levels;\n var hls = this.hls; // check if level idx is valid\n\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n this.clearTimer();\n\n if (this.currentLevelIndex !== newLevel) {\n logger[\"logger\"].log(\"switching to level \" + newLevel);\n this.currentLevelIndex = newLevel;\n var levelProperties = levels[newLevel];\n levelProperties.level = newLevel;\n hls.trigger(events[\"default\"].LEVEL_SWITCHING, levelProperties);\n }\n\n var level = levels[newLevel];\n var levelDetails = level.details; // check if we need to load playlist for this level\n\n if (!levelDetails || levelDetails.live) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var urlId = level.urlId;\n hls.trigger(events[\"default\"].LEVEL_LOADING, {\n url: level.url[urlId],\n level: newLevel,\n id: urlId\n });\n }\n } else {\n // invalid level id given, trigger error\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: false,\n reason: 'invalid level idx'\n });\n }\n };\n\n _proto.onError = function onError(data) {\n if (data.fatal) {\n if (data.type === errors[\"ErrorTypes\"].NETWORK_ERROR) {\n this.clearTimer();\n }\n\n return;\n }\n\n var levelError = false,\n fragmentError = false;\n var levelIndex; // try to recover not fatal errors\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n levelIndex = data.frag.level;\n fragmentError = true;\n break;\n\n case errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR:\n case errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT:\n levelIndex = data.context.level;\n levelError = true;\n break;\n\n case errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR:\n levelIndex = data.level;\n levelError = true;\n break;\n }\n\n if (levelIndex !== undefined) {\n this.recoverLevel(data, levelIndex, levelError, fragmentError);\n }\n }\n /**\n * Switch to a redundant stream if any available.\n * If redundant stream is not available, emergency switch down if ABR mode is enabled.\n *\n * @param {Object} errorEvent\n * @param {Number} levelIndex current level index\n * @param {Boolean} levelError\n * @param {Boolean} fragmentError\n */\n // FIXME Find a better abstraction where fragment/level retry management is well decoupled\n ;\n\n _proto.recoverLevel = function recoverLevel(errorEvent, levelIndex, levelError, fragmentError) {\n var _this2 = this;\n\n var config = this.hls.config;\n var errorDetails = errorEvent.details;\n var level = this._levels[levelIndex];\n var redundantLevels, delay, nextLevel;\n level.loadError++;\n level.fragmentError = fragmentError;\n\n if (levelError) {\n if (this.levelRetryCount + 1 <= config.levelLoadingMaxRetry) {\n // exponential backoff capped to max retry timeout\n delay = Math.min(Math.pow(2, this.levelRetryCount) * config.levelLoadingRetryDelay, config.levelLoadingMaxRetryTimeout); // Schedule level reload\n\n this.timer = setTimeout(function () {\n return _this2.loadLevel();\n }, delay); // boolean used to inform stream controller not to switch back to IDLE on non fatal error\n\n errorEvent.levelRetry = true;\n this.levelRetryCount++;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \", retry in \" + delay + \" ms, current retry count is \" + this.levelRetryCount);\n } else {\n logger[\"logger\"].error(\"level controller, cannot recover from \" + errorDetails + \" error\");\n this.currentLevelIndex = null; // stopping live reloading timer if any\n\n this.clearTimer(); // switch error to fatal\n\n errorEvent.fatal = true;\n return;\n }\n } // Try any redundant streams if available for both errors: level and fragment\n // If level.loadError reaches redundantLevels it means that we tried them all, no hope => let's switch down\n\n\n if (levelError || fragmentError) {\n redundantLevels = level.url.length;\n\n if (redundantLevels > 1 && level.loadError < redundantLevels) {\n level.urlId = (level.urlId + 1) % redundantLevels;\n level.details = undefined;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \" for level \" + levelIndex + \": switching to redundant URL-id \" + level.urlId); // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);\n // console.log('New video quality level audio group id:', level.attrs.AUDIO);\n } else {\n // Search for available level\n if (this.manualLevelIndex === -1) {\n // When lowest level has been reached, let's start hunt from the top\n nextLevel = levelIndex === 0 ? this._levels.length - 1 : levelIndex - 1;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \": switch to \" + nextLevel);\n this.hls.nextAutoLevel = this.currentLevelIndex = nextLevel;\n } else if (fragmentError) {\n // Allow fragment retry as long as configuration allows.\n // reset this._level so that another call to set level() will trigger again a frag load\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \": reload a fragment\");\n this.currentLevelIndex = null;\n }\n }\n }\n } // reset errors on the successful load of a fragment\n ;\n\n _proto.onFragLoaded = function onFragLoaded(_ref3) {\n var frag = _ref3.frag;\n\n if (frag !== undefined && frag.type === 'main') {\n var level = this._levels[frag.level];\n\n if (level !== undefined) {\n level.fragmentError = false;\n level.loadError = 0;\n this.levelRetryCount = 0;\n }\n }\n };\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n var _this3 = this;\n\n var level = data.level,\n details = data.details; // only process level loaded events matching with expected level\n\n if (level !== this.currentLevelIndex) {\n return;\n }\n\n var curLevel = this._levels[level]; // reset level load error counter on successful level loaded only if there is no issues with fragments\n\n if (!curLevel.fragmentError) {\n curLevel.loadError = 0;\n this.levelRetryCount = 0;\n } // if current playlist is a live playlist, arm a timer to reload it\n\n\n if (details.live) {\n var reloadInterval = computeReloadInterval(curLevel.details, details, data.stats.trequest);\n logger[\"logger\"].log(\"live playlist, reload in \" + Math.round(reloadInterval) + \" ms\");\n this.timer = setTimeout(function () {\n return _this3.loadLevel();\n }, reloadInterval);\n } else {\n this.clearTimer();\n }\n };\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var audioGroupId = this.hls.audioTracks[data.id].groupId;\n var currentLevel = this.hls.levels[this.currentLevelIndex];\n\n if (!currentLevel) {\n return;\n }\n\n if (currentLevel.audioGroupIds) {\n var urlId = -1;\n\n for (var i = 0; i < currentLevel.audioGroupIds.length; i++) {\n if (currentLevel.audioGroupIds[i] === audioGroupId) {\n urlId = i;\n break;\n }\n }\n\n if (urlId !== currentLevel.urlId) {\n currentLevel.urlId = urlId;\n this.startLoad();\n }\n }\n };\n\n _proto.loadLevel = function loadLevel() {\n logger[\"logger\"].debug('call to loadLevel');\n\n if (this.currentLevelIndex !== null && this.canload) {\n var levelObject = this._levels[this.currentLevelIndex];\n\n if (typeof levelObject === 'object' && levelObject.url.length > 0) {\n var level = this.currentLevelIndex;\n var id = levelObject.urlId;\n var url = levelObject.url[id];\n logger[\"logger\"].log(\"Attempt loading level index \" + level + \" with URL-id \" + id); // 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\n this.hls.trigger(events[\"default\"].LEVEL_LOADING, {\n url: url,\n level: level,\n id: id\n });\n }\n }\n };\n\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n var levels = this.levels.filter(function (level, index) {\n if (index !== levelIndex) {\n return true;\n }\n\n if (level.url.length > 1 && urlId !== undefined) {\n level.url = level.url.filter(function (url, id) {\n return id !== urlId;\n });\n level.urlId = 0;\n return true;\n }\n\n return false;\n }).map(function (level, index) {\n var details = level.details;\n\n if (details && details.fragments) {\n details.fragments.forEach(function (fragment) {\n fragment.level = index;\n });\n }\n\n return level;\n });\n this._levels = levels;\n this.hls.trigger(events[\"default\"].LEVELS_UPDATED, {\n levels: levels\n });\n };\n\n level_controller_createClass(LevelController, [{\n key: \"levels\",\n get: function get() {\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\n if (levels) {\n newLevel = Math.min(newLevel, levels.length - 1);\n\n if (this.currentLevelIndex !== newLevel || !levels[newLevel].details) {\n this.setLevelInternal(newLevel);\n }\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\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n }, {\n key: \"firstLevel\",\n get: function get() {\n return this._firstLevel;\n },\n set: function set(newLevel) {\n this._firstLevel = newLevel;\n }\n }, {\n key: \"startLevel\",\n get: function get() {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n\n if (configStartLevel !== undefined) {\n return configStartLevel;\n } else {\n return this._firstLevel;\n }\n } else {\n return this._startLevel;\n }\n },\n set: function set(newLevel) {\n this._startLevel = newLevel;\n }\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n } else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function set(nextLevel) {\n this.level = nextLevel;\n\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n }\n }]);\n\n return LevelController;\n}(event_handler);\n\n\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(\"./src/demux/id3.js\");\n\n// CONCATENATED MODULE: ./src/utils/texttrack-utils.ts\nfunction sendAddTrackEvent(track, videoEl) {\n var event;\n\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\n event.track = track;\n videoEl.dispatchEvent(event);\n}\nfunction clearCurrentCues(track) {\n if (track === null || track === void 0 ? void 0 : track.cues) {\n while (track.cues.length > 0) {\n track.removeCue(track.cues[0]);\n }\n }\n}\n/**\n * Given a list of Cues, finds the closest cue matching the given time.\n * Modified verison of binary search O(log(n)).\n *\n * @export\n * @param {(TextTrackCueList | TextTrackCue[])} cues - List of cues.\n * @param {number} time - Target time, to find closest cue to.\n * @returns {TextTrackCue}\n */\n\nfunction getClosestCue(cues, time) {\n // If the offset is less than the first element, the first element is the closest.\n if (time < cues[0].endTime) {\n return cues[0];\n } // If the offset is greater than the last cue, the last is the closest.\n\n\n if (time > cues[cues.length - 1].endTime) {\n return cues[cues.length - 1];\n }\n\n var left = 0;\n var right = cues.length - 1;\n\n while (left <= right) {\n var mid = Math.floor((right + left) / 2);\n\n if (time < cues[mid].endTime) {\n right = mid - 1;\n } else if (time > cues[mid].endTime) {\n left = mid + 1;\n } else {\n // If it's not lower or higher, it must be equal.\n return cues[mid];\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\n\n return cues[left].endTime - time < time - cues[right].endTime ? cues[left] : cues[right];\n}\n// CONCATENATED MODULE: ./src/controller/id3-track-controller.js\nfunction id3_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * id3 metadata track controller\n*/\n\n\n\n\nvar MIN_CUE_DURATION = 0.25;\n\nvar id3_track_controller_ID3TrackController = /*#__PURE__*/function (_EventHandler) {\n id3_track_controller_inheritsLoose(ID3TrackController, _EventHandler);\n\n function ID3TrackController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].FRAG_PARSING_METADATA, events[\"default\"].LIVE_BACK_BUFFER_REACHED) || this;\n _this.id3Track = undefined;\n _this.media = undefined;\n return _this;\n }\n\n var _proto = ID3TrackController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n } // Add ID3 metatadata text track.\n ;\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n this.media = data.media;\n\n if (!this.media) {}\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n clearCurrentCues(this.id3Track);\n this.id3Track = undefined;\n this.media = undefined;\n };\n\n _proto.getID3Track = function getID3Track(textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n var textTrack = textTracks[i];\n\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\n return this.media.addTextTrack('metadata', 'id3');\n };\n\n _proto.onFragParsingMetadata = function onFragParsingMetadata(data) {\n var fragment = data.frag;\n var samples = data.samples; // create track dynamically\n\n if (!this.id3Track) {\n this.id3Track = this.getID3Track(this.media.textTracks);\n this.id3Track.mode = 'hidden';\n } // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n\n\n var Cue = window.WebKitDataCue || window.VTTCue || window.TextTrackCue;\n\n for (var i = 0; i < samples.length; i++) {\n var frames = id3[\"default\"].getID3Frames(samples[i].data);\n\n if (frames) {\n // Ensure the pts is positive - sometimes it's reported as a small negative number\n var startTime = Math.max(samples[i].pts, 0);\n var endTime = i < samples.length - 1 ? samples[i + 1].pts : fragment.endPTS;\n\n if (!endTime) {\n endTime = fragment.start + fragment.duration;\n }\n\n var timeDiff = endTime - startTime;\n\n if (timeDiff <= 0) {\n endTime = startTime + MIN_CUE_DURATION;\n }\n\n for (var j = 0; j < frames.length; j++) {\n var frame = frames[j]; // Safari doesn't put the timestamp frame in the TextTrack\n\n if (!id3[\"default\"].isTimeStampFrame(frame)) {\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n\n _proto.onLiveBackBufferReached = function onLiveBackBufferReached(_ref) {\n var bufferEnd = _ref.bufferEnd;\n var id3Track = this.id3Track;\n\n if (!id3Track || !id3Track.cues || !id3Track.cues.length) {\n return;\n }\n\n var foundCue = getClosestCue(id3Track.cues, bufferEnd);\n\n if (!foundCue) {\n return;\n }\n\n while (id3Track.cues[0] !== foundCue) {\n id3Track.removeCue(id3Track.cues[0]);\n }\n };\n\n return ID3TrackController;\n}(event_handler);\n\n/* harmony default export */ var id3_track_controller = (id3_track_controller_ID3TrackController);\n// CONCATENATED MODULE: ./src/is-supported.ts\n\nfunction is_supported_isSupported() {\n var mediaSource = getMediaSource();\n\n if (!mediaSource) {\n return false;\n }\n\n var sourceBuffer = self.SourceBuffer || self.WebKitSourceBuffer;\n var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"'); // if SourceBuffer is exposed ensure its API is valid\n // safari and old version of Chrome doe not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n\n var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n return !!isTypeSupported && !!sourceBufferValidAPI;\n}\n// CONCATENATED MODULE: ./src/utils/ewma.ts\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 */\nvar EWMA = /*#__PURE__*/function () {\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife) {\n this.alpha_ = void 0;\n this.estimate_ = void 0;\n this.totalWeight_ = void 0;\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_ = 0;\n this.totalWeight_ = 0;\n }\n\n var _proto = EWMA.prototype;\n\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\n _proto.getTotalWeight = function getTotalWeight() {\n return this.totalWeight_;\n };\n\n _proto.getEstimate = function getEstimate() {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n return this.estimate_ / zeroFactor;\n } else {\n return this.estimate_;\n }\n };\n\n return EWMA;\n}();\n\n/* harmony default export */ var ewma = (EWMA);\n// CONCATENATED MODULE: ./src/utils/ewma-bandwidth-estimator.ts\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\nvar ewma_bandwidth_estimator_EwmaBandWidthEstimator = /*#__PURE__*/function () {\n // TODO(typescript-hls)\n function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) {\n this.hls = void 0;\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.hls = hls;\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 }\n\n var _proto = EwmaBandWidthEstimator.prototype;\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 durationS = durationMs / 1000,\n // value is bandwidth in bits/s\n bandwidthInBps = numBits / durationS;\n this.fast_.sample(durationS, bandwidthInBps);\n this.slow_.sample(durationS, bandwidthInBps);\n };\n\n _proto.canEstimate = function canEstimate() {\n var fast = this.fast_;\n return fast && fast.getTotalWeight() >= this.minWeight_;\n };\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\n _proto.destroy = function destroy() {};\n\n return EwmaBandWidthEstimator;\n}();\n\n/* harmony default export */ var ewma_bandwidth_estimator = (ewma_bandwidth_estimator_EwmaBandWidthEstimator);\n// CONCATENATED MODULE: ./src/controller/abr-controller.js\n\n\n\nfunction abr_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction abr_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) abr_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) abr_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction abr_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction abr_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\n\n\n\n\n\n\nvar abr_controller_window = window,\n abr_controller_performance = abr_controller_window.performance;\n\nvar abr_controller_AbrController = /*#__PURE__*/function (_EventHandler) {\n abr_controller_inheritsLoose(AbrController, _EventHandler);\n\n function AbrController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FRAG_LOADING, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_BUFFERED, events[\"default\"].ERROR) || this;\n _this.lastLoadedFragLevel = 0;\n _this._nextAutoLevel = -1;\n _this.hls = hls;\n _this.timer = null;\n _this._bwEstimator = null;\n _this.onCheck = _this._abandonRulesCheck.bind(abr_controller_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = AbrController.prototype;\n\n _proto.destroy = function destroy() {\n this.clearTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n _proto.onFragLoading = function onFragLoading(data) {\n var frag = data.frag;\n\n if (frag.type === 'main') {\n if (!this.timer) {\n this.fragCurrent = frag;\n this.timer = setInterval(this.onCheck, 100);\n } // lazy init of BwEstimator, rationale is that we use different params for Live/VoD\n // so we need to wait for stream manifest / playlist type to instantiate it.\n\n\n if (!this._bwEstimator) {\n var hls = this.hls;\n var config = hls.config;\n var level = frag.level;\n var isLive = hls.levels[level].details.live;\n var ewmaFast;\n var ewmaSlow;\n\n if (isLive) {\n ewmaFast = config.abrEwmaFastLive;\n ewmaSlow = config.abrEwmaSlowLive;\n } else {\n ewmaFast = config.abrEwmaFastVoD;\n ewmaSlow = config.abrEwmaSlowVoD;\n }\n\n this._bwEstimator = new ewma_bandwidth_estimator(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate);\n }\n }\n };\n\n _proto._abandonRulesCheck = function _abandonRulesCheck() {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n var hls = this.hls;\n var video = hls.media;\n var frag = this.fragCurrent;\n\n if (!frag) {\n return;\n }\n\n var loader = frag.loader; // if loader has been destroyed or loading has been aborted, stop timer and return\n\n if (!loader || loader.stats && loader.stats.aborted) {\n logger[\"logger\"].warn('frag loader destroy or aborted, disarm abandonRules');\n this.clearTimer(); // reset forced auto level value so that next level will be selected\n\n this._nextAutoLevel = -1;\n return;\n }\n\n var stats = loader.stats;\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n\n if (video && stats && (!video.paused && video.playbackRate !== 0 || !video.readyState) && frag.autoLevel && frag.level) {\n var requestDelay = abr_controller_performance.now() - stats.trequest;\n var playbackRate = Math.abs(video.playbackRate); // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n\n if (requestDelay > 500 * frag.duration / playbackRate) {\n var levels = hls.levels;\n var loadRate = Math.max(1, stats.bw ? stats.bw / 8 : stats.loaded * 1000 / requestDelay); // byte/s; at least 1 byte/s to avoid division by zero\n // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size\n\n var level = levels[frag.level];\n\n if (!level) {\n return;\n }\n\n var levelBitrate = level.realBitrate ? Math.max(level.realBitrate, level.bitrate) : level.bitrate;\n var expectedLen = stats.total ? stats.total : Math.max(stats.loaded, Math.round(frag.duration * levelBitrate / 8));\n var pos = video.currentTime;\n var fragLoadedDelay = (expectedLen - stats.loaded) / loadRate;\n var bufferStarvationDelay = (BufferHelper.bufferInfo(video, pos, hls.config.maxBufferHole).end - pos) / playbackRate; // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n\n if (bufferStarvationDelay < 2 * frag.duration / playbackRate && fragLoadedDelay > bufferStarvationDelay) {\n var minAutoLevel = hls.minAutoLevel;\n var fragLevelNextLoadedDelay;\n var nextLoadLevel; // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].realBitrate ? Math.max(levels[nextLoadLevel].realBitrate, levels[nextLoadLevel].bitrate) : levels[nextLoadLevel].bitrate;\n\n var _fragLevelNextLoadedDelay = frag.duration * levelNextBitrate / (8 * 0.8 * loadRate);\n\n if (_fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n } // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n\n\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n logger[\"logger\"].warn(\"loading too slow, abort fragment loading and switch to level \" + nextLoadLevel + \":fragLoadedDelay[\" + nextLoadLevel + \"]<fragLoadedDelay[\" + (frag.level - 1) + \"];bufferStarvationDelay:\" + fragLevelNextLoadedDelay.toFixed(1) + \"<\" + fragLoadedDelay.toFixed(1) + \":\" + bufferStarvationDelay.toFixed(1)); // force next load level in auto mode\n\n hls.nextLoadLevel = nextLoadLevel; // update bw estimate for this fragment before cancelling load (this will help reducing the bw)\n\n this._bwEstimator.sample(requestDelay, stats.loaded); // abort fragment loading\n\n\n loader.abort(); // stop abandon rules timer\n\n this.clearTimer();\n hls.trigger(events[\"default\"].FRAG_LOAD_EMERGENCY_ABORTED, {\n frag: frag,\n stats: stats\n });\n }\n }\n }\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag;\n\n if (frag.type === 'main' && Object(number[\"isFiniteNumber\"])(frag.sn)) {\n // stop monitoring bw once frag loaded\n this.clearTimer(); // store level id after successful fragment load\n\n this.lastLoadedFragLevel = frag.level; // reset forced auto level value so that next level will be selected\n\n this._nextAutoLevel = -1; // compute level average bitrate\n\n if (this.hls.config.abrMaxWithRealBitrate) {\n var level = this.hls.levels[frag.level];\n var loadedBytes = (level.loaded ? level.loaded.bytes : 0) + data.stats.loaded;\n var loadedDuration = (level.loaded ? level.loaded.duration : 0) + data.frag.duration;\n level.loaded = {\n bytes: loadedBytes,\n duration: loadedDuration\n };\n level.realBitrate = Math.round(8 * loadedBytes / loadedDuration);\n } // if fragment has been loaded to perform a bitrate test,\n\n\n if (data.frag.bitrateTest) {\n var stats = data.stats;\n stats.tparsed = stats.tbuffered = stats.tload;\n this.onFragBuffered(data);\n }\n }\n };\n\n _proto.onFragBuffered = function onFragBuffered(data) {\n var stats = data.stats;\n var frag = data.frag; // only update stats on first frag buffering\n // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly\n // and leading to wrong bw estimation\n // on bitrate test, also only update stats once (if tload = tbuffered == on FRAG_LOADED)\n\n if (stats.aborted !== true && frag.type === 'main' && Object(number[\"isFiniteNumber\"])(frag.sn) && (!frag.bitrateTest || stats.tload === stats.tbuffered)) {\n // use tparsed-trequest instead of tbuffered-trequest to compute fragLoadingProcessing; rationale is that buffer appending only happens once media is attached\n // in case we use config.startFragPrefetch while media is not attached yet, fragment might be parsed while media not attached yet, but it will only be buffered on media attached\n // as a consequence it could happen really late in the process. meaning that appending duration might appears huge ... leading to underestimated throughput estimation\n var fragLoadingProcessingMs = stats.tparsed - stats.trequest;\n logger[\"logger\"].log(\"latency/loading/parsing/append/kbps:\" + Math.round(stats.tfirst - stats.trequest) + \"/\" + Math.round(stats.tload - stats.tfirst) + \"/\" + Math.round(stats.tparsed - stats.tload) + \"/\" + Math.round(stats.tbuffered - stats.tparsed) + \"/\" + Math.round(8 * stats.loaded / (stats.tbuffered - stats.trequest)));\n\n this._bwEstimator.sample(fragLoadingProcessingMs, stats.loaded);\n\n stats.bwEstimate = this._bwEstimator.getEstimate(); // if fragment has been loaded to perform a bitrate test, (hls.startLevel = -1), store bitrate test delay duration\n\n if (frag.bitrateTest) {\n this.bitrateTestDelay = fragLoadingProcessingMs / 1000;\n } else {\n this.bitrateTestDelay = 0;\n }\n }\n };\n\n _proto.onError = function onError(data) {\n // stop timer in case of frag loading error\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n this.clearTimer();\n break;\n\n default:\n break;\n }\n };\n\n _proto.clearTimer = function clearTimer() {\n clearInterval(this.timer);\n this.timer = null;\n } // return next auto level\n ;\n\n _proto._findBestLevel = function _findBestLevel(currentLevel, currentFragDuration, currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor, levels) {\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i];\n\n if (!levelInfo) {\n continue;\n }\n\n var levelDetails = levelInfo.details;\n var avgDuration = levelDetails ? levelDetails.totalduration / levelDetails.fragments.length : currentFragDuration;\n var live = levelDetails ? levelDetails.live : false;\n var adjustedbw = void 0; // 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\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n\n var bitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n var fetchDuration = bitrate * avgDuration / adjustedbw;\n logger[\"logger\"].trace(\"level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: \" + i + \"/\" + Math.round(adjustedbw) + \"/\" + bitrate + \"/\" + avgDuration + \"/\" + maxFetchDuration + \"/\" + fetchDuration); // if adjusted bw is greater than level bitrate AND\n\n if (adjustedbw > bitrate && ( // 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 || live && !this.bitrateTestDelay || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n } // not enough time budget even with quality level 0 ... rebuffering might happen\n\n\n return -1;\n };\n\n abr_controller_createClass(AbrController, [{\n key: \"nextAutoLevel\",\n get: function get() {\n var forcedAutoLevel = this._nextAutoLevel;\n var bwEstimator = this._bwEstimator; // in case next auto level has been forced, and bw not available or not reliable, return forced value\n\n if (forcedAutoLevel !== -1 && (!bwEstimator || !bwEstimator.canEstimate())) {\n return forcedAutoLevel;\n } // compute next level using ABR logic\n\n\n var nextABRAutoLevel = this._nextABRAutoLevel; // if forced auto level has been defined, use it to cap ABR computed quality level\n\n if (forcedAutoLevel !== -1) {\n nextABRAutoLevel = Math.min(forcedAutoLevel, nextABRAutoLevel);\n }\n\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n }, {\n key: \"_nextABRAutoLevel\",\n get: function get() {\n var hls = this.hls;\n var maxAutoLevel = hls.maxAutoLevel,\n levels = hls.levels,\n config = hls.config,\n minAutoLevel = hls.minAutoLevel;\n var video = hls.media;\n var currentLevel = this.lastLoadedFragLevel;\n var currentFragDuration = this.fragCurrent ? this.fragCurrent.duration : 0;\n var pos = video ? video.currentTime : 0; // playbackRate is the absolute value of the playback rate; if video.playbackRate is 0, we use 1 to load as\n // if we're playing back at the normal rate.\n\n var playbackRate = video && video.playbackRate !== 0 ? Math.abs(video.playbackRate) : 1.0;\n var avgbw = this._bwEstimator ? this._bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate; // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n\n var bufferStarvationDelay = (BufferHelper.bufferInfo(video, pos, config.maxBufferHole).end - pos) / playbackRate; // 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\n var bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, config.abrBandWidthFactor, config.abrBandWidthUpFactor, levels);\n\n if (bestLevel >= 0) {\n return bestLevel;\n } else {\n logger[\"logger\"].trace('rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering'); // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay;\n var bwFactor = config.abrBandWidthFactor;\n var bwUpFactor = config.abrBandWidthUpFactor;\n\n if (bufferStarvationDelay === 0) {\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\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[\"logger\"].trace(\"bitrate test took \" + Math.round(1000 * bitrateTestDelay) + \"ms, set first fragment max fetchDuration to \" + Math.round(1000 * maxStarvationDelay) + \" ms\"); // don't use conservative factor on bitrate test\n\n bwFactor = bwUpFactor = 1;\n }\n }\n\n bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor, levels);\n return Math.max(bestLevel, 0);\n }\n }\n }]);\n\n return AbrController;\n}(event_handler);\n\n/* harmony default export */ var abr_controller = (abr_controller_AbrController);\n// CONCATENATED MODULE: ./src/controller/buffer-controller.ts\n\n\nfunction buffer_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Buffer Controller\n */\n\n\n\n\n\nvar buffer_controller_MediaSource = getMediaSource();\n\nvar buffer_controller_BufferController = /*#__PURE__*/function (_EventHandler) {\n buffer_controller_inheritsLoose(BufferController, _EventHandler);\n\n // the value that we have set mediasource.duration to\n // (the actual duration may be tweaked slighly by the browser)\n // the value that we want to set mediaSource.duration to\n // the target duration of the current media playlist\n // current stream state: true - for live broadcast, false - for VoD content\n // cache the self generated object url to detect hijack of video tag\n // signals that the sourceBuffers need to be flushed\n // signals that mediaSource should have endOfStream called\n // this is optional because this property is removed from the class sometimes\n // The number of BUFFER_CODEC events received before any sourceBuffers are created\n // The total number of BUFFER_CODEC events received\n // A reference to the attached media element\n // A reference to the active media source\n // List of pending segments to be appended to source buffer\n // A guard to see if we are currently appending to the source buffer\n // counters\n function BufferController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].BUFFER_RESET, events[\"default\"].BUFFER_APPENDING, events[\"default\"].BUFFER_CODECS, events[\"default\"].BUFFER_EOS, events[\"default\"].BUFFER_FLUSHING, events[\"default\"].LEVEL_PTS_UPDATED, events[\"default\"].LEVEL_UPDATED) || this;\n _this._msDuration = null;\n _this._levelDuration = null;\n _this._levelTargetDuration = 10;\n _this._live = null;\n _this._objectUrl = null;\n _this._needsFlush = false;\n _this._needsEos = false;\n _this.config = void 0;\n _this.audioTimestampOffset = void 0;\n _this.bufferCodecEventsExpected = 0;\n _this._bufferCodecEventsTotal = 0;\n _this.media = null;\n _this.mediaSource = null;\n _this.segments = [];\n _this.parent = void 0;\n _this.appending = false;\n _this.appended = 0;\n _this.appendError = 0;\n _this.flushBufferCounter = 0;\n _this.tracks = {};\n _this.pendingTracks = {};\n _this.sourceBuffer = {};\n _this.flushRange = [];\n\n _this._onMediaSourceOpen = function () {\n logger[\"logger\"].log('media source opened');\n\n _this.hls.trigger(events[\"default\"].MEDIA_ATTACHED, {\n media: _this.media\n });\n\n var mediaSource = _this.mediaSource;\n\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', _this._onMediaSourceOpen);\n }\n\n _this.checkPendingTracks();\n };\n\n _this._onMediaSourceClose = function () {\n logger[\"logger\"].log('media source closed');\n };\n\n _this._onMediaSourceEnded = function () {\n logger[\"logger\"].log('media source ended');\n };\n\n _this._onSBUpdateEnd = function () {\n // update timestampOffset\n if (_this.audioTimestampOffset && _this.sourceBuffer.audio) {\n var audioBuffer = _this.sourceBuffer.audio;\n logger[\"logger\"].warn(\"change mpeg audio timestamp offset from \" + audioBuffer.timestampOffset + \" to \" + _this.audioTimestampOffset);\n audioBuffer.timestampOffset = _this.audioTimestampOffset;\n delete _this.audioTimestampOffset;\n }\n\n if (_this._needsFlush) {\n _this.doFlush();\n }\n\n if (_this._needsEos) {\n _this.checkEos();\n }\n\n _this.appending = false;\n var parent = _this.parent; // count nb of pending segments waiting for appending on this sourcebuffer\n\n var pending = _this.segments.reduce(function (counter, segment) {\n return segment.parent === parent ? counter + 1 : counter;\n }, 0); // this.sourceBuffer is better to use than media.buffered as it is closer to the PTS data from the fragments\n\n\n var timeRanges = {};\n var sbSet = _this.sourceBuffer;\n\n for (var streamType in sbSet) {\n var sb = sbSet[streamType];\n\n if (!sb) {\n throw Error(\"handling source buffer update end error: source buffer for \" + streamType + \" uninitilized and unable to update buffered TimeRanges.\");\n }\n\n timeRanges[streamType] = sb.buffered;\n }\n\n _this.hls.trigger(events[\"default\"].BUFFER_APPENDED, {\n parent: parent,\n pending: pending,\n timeRanges: timeRanges\n }); // don't append in flushing mode\n\n\n if (!_this._needsFlush) {\n _this.doAppending();\n }\n\n _this.updateMediaElementDuration(); // appending goes first\n\n\n if (pending === 0) {\n _this.flushLiveBackBuffer();\n }\n };\n\n _this._onSBUpdateError = function (event) {\n logger[\"logger\"].error('sourceBuffer error:', event); // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n\n _this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_APPENDING_ERROR,\n fatal: false\n }); // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n\n };\n\n _this.config = hls.config;\n return _this;\n }\n\n var _proto = BufferController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n _proto.onLevelPtsUpdated = function onLevelPtsUpdated(data) {\n var type = data.type;\n var audioTrack = this.tracks.audio; // 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). At the time of change we issue\n // `SourceBuffer.abort()` and adjusting `SourceBuffer.timestampOffset` if `SourceBuffer.updating` is false or awaiting `updateend`\n // event if SB is in updating state.\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n\n if (type === 'audio' && audioTrack && audioTrack.container === 'audio/mpeg') {\n // Chrome audio mp3 track\n var audioBuffer = this.sourceBuffer.audio;\n\n if (!audioBuffer) {\n throw Error('Level PTS Updated and source buffer for audio uninitalized');\n }\n\n var delta = Math.abs(audioBuffer.timestampOffset - data.start); // adjust timestamp offset if time delta is greater than 100ms\n\n if (delta > 0.1) {\n var updating = audioBuffer.updating;\n\n try {\n audioBuffer.abort();\n } catch (err) {\n logger[\"logger\"].warn('can not abort audio buffer: ' + err);\n }\n\n if (!updating) {\n logger[\"logger\"].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + data.start);\n audioBuffer.timestampOffset = data.start;\n } else {\n this.audioTimestampOffset = data.start;\n }\n }\n }\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n // in case of alt audio (where all tracks have urls) 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\n if (data.audio && !data.video || !data.altAudio) {\n codecEvents = 1;\n }\n\n this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = codecEvents;\n logger[\"logger\"].log(this.bufferCodecEventsExpected + \" bufferCodec event(s) expected\");\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n var media = this.media = data.media;\n\n if (media && buffer_controller_MediaSource) {\n // setup the media source\n var ms = this.mediaSource = new buffer_controller_MediaSource(); // Media Source listeners\n\n ms.addEventListener('sourceopen', this._onMediaSourceOpen);\n ms.addEventListener('sourceended', this._onMediaSourceEnded);\n ms.addEventListener('sourceclose', this._onMediaSourceClose); // link video and media Source\n\n media.src = window.URL.createObjectURL(ms); // cache the locally generated object url\n\n this._objectUrl = media.src;\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n logger[\"logger\"].log('media source detaching');\n var ms = this.mediaSource;\n\n if (ms) {\n if (ms.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 ms.endOfStream();\n } catch (err) {\n logger[\"logger\"].warn(\"onMediaDetaching:\" + err.message + \" while calling endOfStream\");\n }\n }\n\n ms.removeEventListener('sourceopen', this._onMediaSourceOpen);\n ms.removeEventListener('sourceended', this._onMediaSourceEnded);\n ms.removeEventListener('sourceclose', this._onMediaSourceClose); // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n\n if (this.media) {\n if (this._objectUrl) {\n window.URL.revokeObjectURL(this._objectUrl);\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\n\n if (this.media.src === this._objectUrl) {\n this.media.removeAttribute('src');\n this.media.load();\n } else {\n logger[\"logger\"].warn('media.src was changed by a third party - skip cleanup');\n }\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 this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n }\n\n this.hls.trigger(events[\"default\"].MEDIA_DETACHED);\n };\n\n _proto.checkPendingTracks = function checkPendingTracks() {\n var bufferCodecEventsExpected = this.bufferCodecEventsExpected,\n pendingTracks = this.pendingTracks; // 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\n var pendingTracksCount = Object.keys(pendingTracks).length;\n\n if (pendingTracksCount && !bufferCodecEventsExpected || pendingTracksCount === 2) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {}; // append any pending segments now !\n\n this.doAppending();\n }\n };\n\n _proto.onBufferReset = function onBufferReset() {\n var sourceBuffer = this.sourceBuffer;\n\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n\n try {\n if (sb) {\n if (this.mediaSource) {\n this.mediaSource.removeSourceBuffer(sb);\n }\n\n sb.removeEventListener('updateend', this._onSBUpdateEnd);\n sb.removeEventListener('error', this._onSBUpdateError);\n }\n } catch (err) {}\n }\n\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n };\n\n _proto.onBufferCodecs = function onBufferCodecs(tracks) {\n var _this2 = this;\n\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n // if sourcebuffers already created, do nothing ...\n if (Object.keys(this.sourceBuffer).length) {\n return;\n }\n\n Object.keys(tracks).forEach(function (trackName) {\n _this2.pendingTracks[trackName] = tracks[trackName];\n });\n this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0);\n\n if (this.mediaSource && this.mediaSource.readyState === 'open') {\n this.checkPendingTracks();\n }\n };\n\n _proto.createSourceBuffers = function createSourceBuffers(tracks) {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n if (!mediaSource) {\n throw Error('createSourceBuffers called when mediaSource was null');\n }\n\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n\n if (!track) {\n throw Error(\"source buffer exists for track \" + trackName + \", however track does not\");\n } // use levelCodec as first priority\n\n\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + \";codecs=\" + codec;\n logger[\"logger\"].log(\"creating sourceBuffer(\" + mimeType + \")\");\n\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this._onSBUpdateEnd);\n sb.addEventListener('error', this._onSBUpdateError);\n this.tracks[trackName] = {\n buffer: sb,\n codec: codec,\n id: track.id,\n container: track.container,\n levelCodec: track.levelCodec\n };\n } catch (err) {\n logger[\"logger\"].error(\"error while trying to add sourceBuffer:\" + err.message);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_ADD_CODEC_ERROR,\n fatal: false,\n err: err,\n mimeType: mimeType\n });\n }\n }\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_CREATED, {\n tracks: this.tracks\n });\n };\n\n _proto.onBufferAppending = function onBufferAppending(data) {\n if (!this._needsFlush) {\n if (!this.segments) {\n this.segments = [data];\n } else {\n this.segments.push(data);\n }\n\n this.doAppending();\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\n _proto.onBufferEos = function onBufferEos(data) {\n for (var type in this.sourceBuffer) {\n if (!data.type || data.type === type) {\n var sb = this.sourceBuffer[type];\n\n if (sb && !sb.ended) {\n sb.ended = true;\n logger[\"logger\"].log(type + \" sourceBuffer now EOS\");\n }\n }\n }\n\n this.checkEos();\n } // if all source buffers are marked as ended, signal endOfStream() to MediaSource.\n ;\n\n _proto.checkEos = function checkEos() {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n if (!mediaSource || mediaSource.readyState !== 'open') {\n this._needsEos = false;\n return;\n }\n\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n if (!sb) continue;\n\n if (!sb.ended) {\n return;\n }\n\n if (sb.updating) {\n this._needsEos = true;\n return;\n }\n }\n\n logger[\"logger\"].log('all media data are available, signal endOfStream() to MediaSource and stop loading fragment'); // Notify the media element that it now has all of the media data\n\n try {\n mediaSource.endOfStream();\n } catch (e) {\n logger[\"logger\"].warn('exception while calling mediaSource.endOfStream()');\n }\n\n this._needsEos = false;\n };\n\n _proto.onBufferFlushing = function onBufferFlushing(data) {\n if (data.type) {\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: data.type\n });\n } else {\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: 'video'\n });\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: 'audio'\n });\n } // attempt flush immediately\n\n\n this.flushBufferCounter = 0;\n this.doFlush();\n };\n\n _proto.flushLiveBackBuffer = function flushLiveBackBuffer() {\n // clear back buffer for live only\n if (!this._live) {\n return;\n }\n\n var liveBackBufferLength = this.config.liveBackBufferLength;\n\n if (!isFinite(liveBackBufferLength) || liveBackBufferLength < 0) {\n return;\n }\n\n if (!this.media) {\n logger[\"logger\"].error('flushLiveBackBuffer called without attaching media');\n return;\n }\n\n var currentTime = this.media.currentTime;\n var sourceBuffer = this.sourceBuffer;\n var bufferTypes = Object.keys(sourceBuffer);\n var targetBackBufferPosition = currentTime - Math.max(liveBackBufferLength, this._levelTargetDuration);\n\n for (var index = bufferTypes.length - 1; index >= 0; index--) {\n var bufferType = bufferTypes[index];\n var sb = sourceBuffer[bufferType];\n\n if (sb) {\n var buffered = sb.buffered; // when target buffer start exceeds actual buffer start\n\n if (buffered.length > 0 && targetBackBufferPosition > buffered.start(0)) {\n // remove buffer up until current time minus minimum back buffer length (removing buffer too close to current\n // time will lead to playback freezing)\n // credits for level target duration - https://github.com/videojs/http-streaming/blob/3132933b6aa99ddefab29c10447624efd6fd6e52/src/segment-loader.js#L91\n if (this.removeBufferRange(bufferType, sb, 0, targetBackBufferPosition)) {\n this.hls.trigger(events[\"default\"].LIVE_BACK_BUFFER_REACHED, {\n bufferEnd: targetBackBufferPosition\n });\n }\n }\n }\n }\n };\n\n _proto.onLevelUpdated = function onLevelUpdated(_ref) {\n var details = _ref.details;\n\n if (details.fragments.length > 0) {\n this._levelDuration = details.totalduration + details.fragments[0].start;\n this._levelTargetDuration = details.averagetargetduration || details.targetduration || 10;\n this._live = details.live;\n this.updateMediaElementDuration();\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 ;\n\n _proto.updateMediaElementDuration = function updateMediaElementDuration() {\n var config = this.config;\n var duration;\n\n if (this._levelDuration === null || !this.media || !this.mediaSource || !this.sourceBuffer || this.media.readyState === 0 || this.mediaSource.readyState !== 'open') {\n return;\n }\n\n for (var type in this.sourceBuffer) {\n var sb = this.sourceBuffer[type];\n\n if (sb && sb.updating === true) {\n // can't set duration whilst a buffer is updating\n return;\n }\n }\n\n duration = this.media.duration; // initialise to the value that the media source is reporting\n\n if (this._msDuration === null) {\n this._msDuration = this.mediaSource.duration;\n }\n\n if (this._live === true && config.liveDurationInfinity === true) {\n // Override duration to Infinity\n logger[\"logger\"].log('Media Source duration is set to Infinity');\n this._msDuration = this.mediaSource.duration = Infinity;\n } else if (this._levelDuration > this._msDuration && this._levelDuration > duration || !Object(number[\"isFiniteNumber\"])(duration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger[\"logger\"].log(\"Updating Media Source duration to \" + this._levelDuration.toFixed(3));\n this._msDuration = this.mediaSource.duration = this._levelDuration;\n }\n };\n\n _proto.doFlush = function doFlush() {\n // loop through all buffer ranges to flush\n while (this.flushRange.length) {\n var range = this.flushRange[0]; // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n\n if (this.flushBuffer(range.start, range.end, range.type)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n } else {\n this._needsFlush = true; // avoid looping, wait for SB update end to retrigger a flush\n\n return;\n }\n }\n\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false; // let's recompute this.appended, which is used to avoid flush looping\n\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n\n try {\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n\n if (sb) {\n appended += sb.buffered.length;\n }\n }\n } catch (error) {\n // error could be thrown while accessing buffered, in case sourcebuffer has already been removed from MediaSource\n // this is harmess at this stage, catch this to avoid reporting an internal exception\n logger[\"logger\"].error('error while accessing sourceBuffer.buffered');\n }\n\n this.appended = appended;\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHED);\n }\n };\n\n _proto.doAppending = function doAppending() {\n var config = this.config,\n hls = this.hls,\n segments = this.segments,\n sourceBuffer = this.sourceBuffer;\n\n if (!Object.keys(sourceBuffer).length) {\n // early exit if no source buffers have been initialized yet\n return;\n }\n\n if (!this.media || this.media.error) {\n this.segments = [];\n logger[\"logger\"].error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n\n if (this.appending) {\n // logger.log(`sb appending in progress`);\n return;\n }\n\n var segment = segments.shift();\n\n if (!segment) {\n // handle undefined shift\n return;\n }\n\n try {\n var sb = sourceBuffer[segment.type];\n\n if (!sb) {\n // in case we don't have any source buffer matching with this segment type,\n // it means that Mediasource fails to create sourcebuffer\n // discard this segment, and trigger update end\n this._onSBUpdateEnd();\n\n return;\n }\n\n if (sb.updating) {\n // if we are still updating the source buffer from the last segment, place this back at the front of the queue\n segments.unshift(segment);\n return;\n } // reset sourceBuffer ended flag before appending segment\n\n\n sb.ended = false; // logger.log(`appending ${segment.content} ${type} SB, size:${segment.data.length}, ${segment.parent}`);\n\n this.parent = segment.parent;\n sb.appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n this.appending = true;\n } catch (err) {\n // in case any error occured while appending, put back segment in segments table\n logger[\"logger\"].error(\"error while trying to append buffer:\" + err.message);\n segments.unshift(segment);\n var event = {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n parent: segment.parent,\n details: '',\n fatal: false\n };\n\n if (err.code === 22) {\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 this.segments = [];\n event.details = errors[\"ErrorDetails\"].BUFFER_FULL_ERROR;\n } else {\n this.appendError++;\n event.details = errors[\"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 help recovering this\n */\n\n if (this.appendError > config.appendErrorMaxRetry) {\n logger[\"logger\"].log(\"fail \" + config.appendErrorMaxRetry + \" times to append segment in sourceBuffer\");\n this.segments = [];\n event.fatal = true;\n }\n }\n\n hls.trigger(events[\"default\"].ERROR, event);\n }\n }\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n ;\n\n _proto.flushBuffer = function flushBuffer(startOffset, endOffset, sbType) {\n var sourceBuffer = this.sourceBuffer; // exit if no sourceBuffers are initialized\n\n if (!Object.keys(sourceBuffer).length) {\n return true;\n }\n\n var currentTime = 'null';\n\n if (this.media) {\n currentTime = this.media.currentTime.toFixed(3);\n }\n\n logger[\"logger\"].log(\"flushBuffer,pos/start/end: \" + currentTime + \"/\" + startOffset + \"/\" + endOffset); // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n\n if (this.flushBufferCounter >= this.appended) {\n logger[\"logger\"].warn('abort flushing too many retries');\n return true;\n }\n\n var sb = sourceBuffer[sbType]; // we are going to flush buffer, mark source buffer as 'not ended'\n\n if (sb) {\n sb.ended = false;\n\n if (!sb.updating) {\n if (this.removeBufferRange(sbType, sb, startOffset, endOffset)) {\n this.flushBufferCounter++;\n return false;\n }\n } else {\n logger[\"logger\"].warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n\n logger[\"logger\"].log('buffer flushed'); // everything flushed !\n\n return true;\n }\n /**\n * Removes first buffered range from provided source buffer that lies within given start and end offsets.\n *\n * @param {string} type Type of the source buffer, logging purposes only.\n * @param {SourceBuffer} sb Target SourceBuffer instance.\n * @param {number} startOffset\n * @param {number} endOffset\n *\n * @returns {boolean} True when source buffer remove requested.\n */\n ;\n\n _proto.removeBufferRange = function removeBufferRange(type, sb, startOffset, endOffset) {\n try {\n for (var i = 0; i < sb.buffered.length; i++) {\n var bufStart = sb.buffered.start(i);\n var bufEnd = sb.buffered.end(i);\n var removeStart = Math.max(bufStart, startOffset);\n var removeEnd = Math.min(bufEnd, endOffset);\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n\n if (Math.min(removeEnd, bufEnd) - removeStart > 0.5) {\n var currentTime = 'null';\n\n if (this.media) {\n currentTime = this.media.currentTime.toString();\n }\n\n logger[\"logger\"].log(\"sb remove \" + type + \" [\" + removeStart + \",\" + removeEnd + \"], of [\" + bufStart + \",\" + bufEnd + \"], pos:\" + currentTime);\n sb.remove(removeStart, removeEnd);\n return true;\n }\n }\n } catch (error) {\n logger[\"logger\"].warn('removeBufferRange failed', error);\n }\n\n return false;\n };\n\n return BufferController;\n}(event_handler);\n\n/* harmony default export */ var buffer_controller = (buffer_controller_BufferController);\n// CONCATENATED MODULE: ./src/controller/cap-level-controller.js\nfunction cap_level_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction cap_level_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) cap_level_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) cap_level_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction cap_level_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * cap stream level to media size dimension controller\n*/\n\n\n\nvar cap_level_controller_CapLevelController = /*#__PURE__*/function (_EventHandler) {\n cap_level_controller_inheritsLoose(CapLevelController, _EventHandler);\n\n function CapLevelController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FPS_DROP_LEVEL_CAPPING, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].LEVELS_UPDATED, events[\"default\"].BUFFER_CODECS, events[\"default\"].MEDIA_DETACHING) || this;\n _this.autoLevelCapping = Number.POSITIVE_INFINITY;\n _this.firstLevel = null;\n _this.levels = [];\n _this.media = null;\n _this.restrictedLevels = [];\n _this.timer = null;\n _this.clientRect = null;\n return _this;\n }\n\n var _proto = CapLevelController.prototype;\n\n _proto.destroy = function destroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = null;\n this.clientRect = null;\n this.stopCapping();\n }\n };\n\n _proto.onFpsDropLevelCapping = function onFpsDropLevelCapping(data) {\n // Don't add a restricted level more than once\n if (CapLevelController.isLevelAllowed(data.droppedLevel, this.restrictedLevels)) {\n this.restrictedLevels.push(data.droppedLevel);\n }\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media instanceof window.HTMLVideoElement ? data.media : null;\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n this.levels = data.levels;\n this.firstLevel = data.firstLevel;\n\n if (hls.config.capLevelToPlayerSize && data.video) {\n // Start capping immediately if the manifest has signaled video codecs\n this.startCapping();\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\n _proto.onBufferCodecs = function onBufferCodecs(data) {\n var hls = this.hls;\n\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\n _proto.onLevelsUpdated = function onLevelsUpdated(data) {\n this.levels = data.levels;\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n this.stopCapping();\n };\n\n _proto.detectPlayerSize = function detectPlayerSize() {\n if (this.media) {\n var levelsLength = this.levels ? this.levels.length : 0;\n\n if (levelsLength) {\n var hls = this.hls;\n hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n\n if (hls.autoLevelCapping > this.autoLevelCapping) {\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 hls.streamController.nextLevelSwitch();\n }\n\n this.autoLevelCapping = hls.autoLevelCapping;\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 ;\n\n _proto.getMaxLevel = function getMaxLevel(capLevelIndex) {\n var _this2 = this;\n\n if (!this.levels) {\n return -1;\n }\n\n var validLevels = this.levels.filter(function (level, index) {\n return CapLevelController.isLevelAllowed(index, _this2.restrictedLevels) && index <= capLevelIndex;\n });\n this.clientRect = null;\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\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\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.hls.firstLevel = this.getMaxLevel(this.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n };\n\n _proto.stopCapping = function stopCapping() {\n this.restrictedLevels = [];\n this.firstLevel = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n this.timer = null;\n }\n };\n\n _proto.getDimensions = function getDimensions() {\n if (this.clientRect) {\n return this.clientRect;\n }\n\n var media = this.media;\n var boundsRect = {\n width: 0,\n height: 0\n };\n\n if (media) {\n var clientRect = media.getBoundingClientRect();\n boundsRect.width = clientRect.width;\n boundsRect.height = clientRect.height;\n\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\n this.clientRect = boundsRect;\n return boundsRect;\n };\n\n CapLevelController.isLevelAllowed = function isLevelAllowed(level, restrictedLevels) {\n if (restrictedLevels === void 0) {\n restrictedLevels = [];\n }\n\n return restrictedLevels.indexOf(level) === -1;\n };\n\n CapLevelController.getMaxLevelByMediaSize = function getMaxLevelByMediaSize(levels, width, height) {\n if (!levels || levels && !levels.length) {\n return -1;\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\n\n var atGreatestBandiwdth = function atGreatestBandiwdth(curLevel, nextLevel) {\n if (!nextLevel) {\n return true;\n }\n\n return curLevel.width !== nextLevel.width || curLevel.height !== nextLevel.height;\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\n\n var maxLevelIndex = levels.length - 1;\n\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n\n if ((level.width >= width || level.height >= height) && atGreatestBandiwdth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n\n return maxLevelIndex;\n };\n\n cap_level_controller_createClass(CapLevelController, [{\n key: \"mediaWidth\",\n get: function get() {\n return this.getDimensions().width * CapLevelController.contentScaleFactor;\n }\n }, {\n key: \"mediaHeight\",\n get: function get() {\n return this.getDimensions().height * CapLevelController.contentScaleFactor;\n }\n }], [{\n key: \"contentScaleFactor\",\n get: function get() {\n var pixelRatio = 1;\n\n try {\n pixelRatio = window.devicePixelRatio;\n } catch (e) {}\n\n return pixelRatio;\n }\n }]);\n\n return CapLevelController;\n}(event_handler);\n\n/* harmony default export */ var cap_level_controller = (cap_level_controller_CapLevelController);\n// CONCATENATED MODULE: ./src/controller/fps-controller.js\nfunction fps_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * FPS Controller\n*/\n\n\n\nvar fps_controller_window = window,\n fps_controller_performance = fps_controller_window.performance;\n\nvar fps_controller_FPSController = /*#__PURE__*/function (_EventHandler) {\n fps_controller_inheritsLoose(FPSController, _EventHandler);\n\n function FPSController(hls) {\n return _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING) || this;\n }\n\n var _proto = FPSController.prototype;\n\n _proto.destroy = function destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n\n this.isVideoPlaybackQualityAvailable = false;\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n var config = this.hls.config;\n\n if (config.capLevelOnFPSDrop) {\n var video = this.video = data.media instanceof window.HTMLVideoElement ? data.media : null;\n\n if (typeof video.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n\n clearInterval(this.timer);\n this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n\n _proto.checkFPS = function checkFPS(video, decodedFrames, droppedFrames) {\n var currentTime = fps_controller_performance.now();\n\n if (decodedFrames) {\n if (this.lastTime) {\n var currentPeriod = currentTime - this.lastTime,\n currentDropped = droppedFrames - this.lastDroppedFrames,\n currentDecoded = decodedFrames - this.lastDecodedFrames,\n droppedFPS = 1000 * currentDropped / currentPeriod,\n hls = this.hls;\n hls.trigger(events[\"default\"].FPS_DROP, {\n currentDropped: currentDropped,\n currentDecoded: currentDecoded,\n totalDroppedFrames: droppedFrames\n });\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[\"logger\"].warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);\n\n if (currentLevel > 0 && (hls.autoLevelCapping === -1 || hls.autoLevelCapping >= currentLevel)) {\n currentLevel = currentLevel - 1;\n hls.trigger(events[\"default\"].FPS_DROP_LEVEL_CAPPING, {\n level: currentLevel,\n droppedLevel: hls.currentLevel\n });\n hls.autoLevelCapping = currentLevel;\n hls.streamController.nextLevelSwitch();\n }\n }\n }\n }\n\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n\n _proto.checkFPSInterval = function checkFPSInterval() {\n var video = this.video;\n\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n } else {\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n\n return FPSController;\n}(event_handler);\n\n/* harmony default export */ var fps_controller = (fps_controller_FPSController);\n// CONCATENATED MODULE: ./src/utils/xhr-loader.js\n/**\n * XHR based logger\n*/\n\n\nvar xhr_loader_XhrLoader = /*#__PURE__*/function () {\n function XhrLoader(config) {\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n\n var _proto = XhrLoader.prototype;\n\n _proto.destroy = function destroy() {\n this.abort();\n this.loader = null;\n };\n\n _proto.abort = function abort() {\n var loader = this.loader;\n\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n\n window.clearTimeout(this.requestTimeout);\n this.requestTimeout = null;\n window.clearTimeout(this.retryTimeout);\n this.retryTimeout = null;\n };\n\n _proto.load = function load(context, config, callbacks) {\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.stats = {\n trequest: window.performance.now(),\n retry: 0\n };\n this.retryDelay = config.retryDelay;\n this.loadInternal();\n };\n\n _proto.loadInternal = function loadInternal() {\n var xhr,\n context = this.context;\n xhr = this.loader = new window.XMLHttpRequest();\n var stats = this.stats;\n stats.tfirst = 0;\n stats.loaded = 0;\n var xhrSetup = this.xhrSetup;\n\n try {\n if (xhrSetup) {\n try {\n xhrSetup(xhr, context.url);\n } catch (e) {\n // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader(\"Content-Language\", \"test\");}\n // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN\n xhr.open('GET', context.url, true);\n xhrSetup(xhr, context.url);\n }\n }\n\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n } catch (e) {\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: e.message\n }, context, xhr);\n return;\n }\n\n if (context.rangeEnd) {\n xhr.setRequestHeader('Range', 'bytes=' + context.rangeStart + '-' + (context.rangeEnd - 1));\n }\n\n xhr.onreadystatechange = this.readystatechange.bind(this);\n xhr.onprogress = this.loadprogress.bind(this);\n xhr.responseType = context.responseType; // setup timeout before we perform request\n\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);\n xhr.send();\n };\n\n _proto.readystatechange = function readystatechange(event) {\n var xhr = event.currentTarget,\n readyState = xhr.readyState,\n stats = this.stats,\n context = this.context,\n config = this.config; // don't proceed if xhr has been aborted\n\n if (stats.aborted) {\n return;\n } // >= HEADERS_RECEIVED\n\n\n if (readyState >= 2) {\n // clear xhr timeout and rearm it if readyState less than 4\n window.clearTimeout(this.requestTimeout);\n\n if (stats.tfirst === 0) {\n stats.tfirst = Math.max(window.performance.now(), stats.trequest);\n }\n\n if (readyState === 4) {\n var status = xhr.status; // http status between 200 to 299 are all successful\n\n if (status >= 200 && status < 300) {\n stats.tload = Math.max(stats.tfirst, window.performance.now());\n var data, len;\n\n if (context.responseType === 'arraybuffer') {\n data = xhr.response;\n len = data.byteLength;\n } else {\n data = xhr.responseText;\n len = data.length;\n }\n\n stats.loaded = stats.total = len;\n var response = {\n url: xhr.responseURL,\n data: data\n };\n this.callbacks.onSuccess(response, stats, context, xhr);\n } else {\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (stats.retry >= config.maxRetry || status >= 400 && status < 499) {\n logger[\"logger\"].error(status + \" while loading \" + context.url);\n this.callbacks.onError({\n code: status,\n text: xhr.statusText\n }, context, xhr);\n } else {\n // retry\n logger[\"logger\"].warn(status + \" while loading \" + context.url + \", retrying in \" + this.retryDelay + \"...\"); // aborts and resets internal state\n\n this.destroy(); // schedule retry\n\n this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay); // set exponential backoff\n\n this.retryDelay = Math.min(2 * this.retryDelay, config.maxRetryDelay);\n stats.retry++;\n }\n }\n } else {\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), config.timeout);\n }\n }\n };\n\n _proto.loadtimeout = function loadtimeout() {\n logger[\"logger\"].warn(\"timeout while loading \" + this.context.url);\n this.callbacks.onTimeout(this.stats, this.context, null);\n };\n\n _proto.loadprogress = function loadprogress(event) {\n var xhr = event.currentTarget,\n stats = this.stats;\n stats.loaded = event.loaded;\n\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n\n var onProgress = this.callbacks.onProgress;\n\n if (onProgress) {\n // third arg is to provide on progress data\n onProgress(stats, this.context, null, xhr);\n }\n };\n\n return XhrLoader;\n}();\n\n/* harmony default export */ var xhr_loader = (xhr_loader_XhrLoader);\n// CONCATENATED MODULE: ./src/controller/audio-track-controller.js\nfunction audio_track_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction audio_track_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) audio_track_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) audio_track_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction audio_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n/**\n * @class AudioTrackController\n * @implements {EventHandler}\n *\n * Handles main manifest and audio-track metadata loaded,\n * owns and exposes the selectable audio-tracks data-models.\n *\n * Exposes internal interface to select available audio-tracks.\n *\n * Handles errors on loading audio-track playlists. Manages fallback mechanism\n * with redundants tracks (group-IDs).\n *\n * Handles level-loading and group-ID switches for video (fallback on video levels),\n * and eventually adapts the audio-track group-ID to match.\n *\n * @fires AUDIO_TRACK_LOADING\n * @fires AUDIO_TRACK_SWITCHING\n * @fires AUDIO_TRACKS_UPDATED\n * @fires ERROR\n *\n */\n\nvar audio_track_controller_AudioTrackController = /*#__PURE__*/function (_TaskLoop) {\n audio_track_controller_inheritsLoose(AudioTrackController, _TaskLoop);\n\n function AudioTrackController(hls) {\n var _this;\n\n _this = _TaskLoop.call(this, hls, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].AUDIO_TRACK_LOADED, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].LEVEL_LOADED, events[\"default\"].ERROR) || this;\n /**\n * @private\n * Currently selected index in `tracks`\n * @member {number} trackId\n */\n\n _this._trackId = -1;\n /**\n * @private\n * If should select tracks according to default track attribute\n * @member {boolean} _selectDefaultTrack\n */\n\n _this._selectDefaultTrack = true;\n /**\n * @public\n * All tracks available\n * @member {AudioTrack[]}\n */\n\n _this.tracks = [];\n /**\n * @public\n * List of blacklisted audio track IDs (that have caused failure)\n * @member {number[]}\n */\n\n _this.trackIdBlacklist = Object.create(null);\n /**\n * @public\n * The currently running group ID for audio\n * (we grab this on manifest-parsed and new level-loaded)\n * @member {string}\n */\n\n _this.audioGroupId = null;\n return _this;\n }\n /**\n * Reset audio tracks on new manifest loading.\n */\n\n\n var _proto = AudioTrackController.prototype;\n\n _proto.onManifestLoading = function onManifestLoading() {\n this.tracks = [];\n this._trackId = -1;\n this._selectDefaultTrack = true;\n }\n /**\n * Store tracks data from manifest parsed data.\n *\n * Trigger AUDIO_TRACKS_UPDATED event.\n *\n * @param {*} data\n */\n ;\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var tracks = this.tracks = data.audioTracks || [];\n this.hls.trigger(events[\"default\"].AUDIO_TRACKS_UPDATED, {\n audioTracks: tracks\n });\n\n this._selectAudioGroup(this.hls.nextLoadLevel);\n }\n /**\n * Store track details of loaded track in our data-model.\n *\n * Set-up metadata update interval task for live-mode streams.\n *\n * @param {*} data\n */\n ;\n\n _proto.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n if (data.id >= this.tracks.length) {\n logger[\"logger\"].warn('Invalid audio track id:', data.id);\n return;\n }\n\n logger[\"logger\"].log(\"audioTrack \" + data.id + \" loaded\");\n this.tracks[data.id].details = data.details; // check if current playlist is a live playlist\n // and if we have already our reload interval setup\n\n if (data.details.live && !this.hasInterval()) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n var updatePeriodMs = data.details.targetduration * 1000;\n this.setInterval(updatePeriodMs);\n }\n\n if (!data.details.live && this.hasInterval()) {\n // playlist is not live and timer is scheduled: cancel it\n this.clearInterval();\n }\n }\n /**\n * Update the internal group ID to any audio-track we may have set manually\n * or because of a failure-handling fallback.\n *\n * Quality-levels should update to that group ID in this case.\n *\n * @param {*} data\n */\n ;\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var audioGroupId = this.tracks[data.id].groupId;\n\n if (audioGroupId && this.audioGroupId !== audioGroupId) {\n this.audioGroupId = audioGroupId;\n }\n }\n /**\n * When a level gets loaded, if it has redundant audioGroupIds (in the same ordinality as it's redundant URLs)\n * we are setting our audio-group ID internally to the one set, if it is different from the group ID currently set.\n *\n * If group-ID got update, we re-select the appropriate audio-track with this group-ID matching the currently\n * selected one (based on NAME property).\n *\n * @param {*} data\n */\n ;\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n this._selectAudioGroup(data.level);\n }\n /**\n * Handle network errors loading audio track manifests\n * and also pausing on any netwok errors.\n *\n * @param {ErrorEventData} data\n */\n ;\n\n _proto.onError = function onError(data) {\n // Only handle network errors\n if (data.type !== errors[\"ErrorTypes\"].NETWORK_ERROR) {\n return;\n } // If fatal network error, cancel update task\n\n\n if (data.fatal) {\n this.clearInterval();\n } // If not an audio-track loading error don't handle further\n\n\n if (data.details !== errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR) {\n return;\n }\n\n logger[\"logger\"].warn('Network failure on audio-track id:', data.context.id);\n\n this._handleLoadError();\n }\n /**\n * @type {AudioTrack[]} Audio-track list we own\n */\n ;\n\n /**\n * @private\n * @param {number} newId\n */\n _proto._setAudioTrack = function _setAudioTrack(newId) {\n // noop on same audio track id as already set\n if (this._trackId === newId && this.tracks[this._trackId].details) {\n logger[\"logger\"].debug('Same id as current audio-track passed, and track details available -> no-op');\n return;\n } // check if level idx is valid\n\n\n if (newId < 0 || newId >= this.tracks.length) {\n logger[\"logger\"].warn('Invalid id passed to audio-track controller');\n return;\n }\n\n var audioTrack = this.tracks[newId];\n logger[\"logger\"].log(\"Now switching to audio-track index \" + newId); // stopping live reloading timer if any\n\n this.clearInterval();\n this._trackId = newId;\n var url = audioTrack.url,\n type = audioTrack.type,\n id = audioTrack.id;\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHING, {\n id: id,\n type: type,\n url: url\n });\n\n this._loadTrackDetailsIfNeeded(audioTrack);\n }\n /**\n * @override\n */\n ;\n\n _proto.doTick = function doTick() {\n this._updateTrack(this._trackId);\n }\n /**\n * @param levelId\n * @private\n */\n ;\n\n _proto._selectAudioGroup = function _selectAudioGroup(levelId) {\n var levelInfo = this.hls.levels[levelId];\n\n if (!levelInfo || !levelInfo.audioGroupIds) {\n return;\n }\n\n var audioGroupId = levelInfo.audioGroupIds[levelInfo.urlId];\n\n if (this.audioGroupId !== audioGroupId) {\n this.audioGroupId = audioGroupId;\n\n this._selectInitialAudioTrack();\n }\n }\n /**\n * Select initial track\n * @private\n */\n ;\n\n _proto._selectInitialAudioTrack = function _selectInitialAudioTrack() {\n var _this2 = this;\n\n var tracks = this.tracks;\n\n if (!tracks.length) {\n return;\n }\n\n var currentAudioTrack = this.tracks[this._trackId];\n var name = null;\n\n if (currentAudioTrack) {\n name = currentAudioTrack.name;\n } // Pre-select default tracks if there are any\n\n\n if (this._selectDefaultTrack) {\n var defaultTracks = tracks.filter(function (track) {\n return track.default;\n });\n\n if (defaultTracks.length) {\n tracks = defaultTracks;\n } else {\n logger[\"logger\"].warn('No default audio tracks defined');\n }\n }\n\n var trackFound = false;\n\n var traverseTracks = function traverseTracks() {\n // Select track with right group ID\n tracks.forEach(function (track) {\n if (trackFound) {\n return;\n } // We need to match the (pre-)selected group ID\n // and the NAME of the current track.\n\n\n if ((!_this2.audioGroupId || track.groupId === _this2.audioGroupId) && (!name || name === track.name)) {\n // If there was a previous track try to stay with the same `NAME`.\n // It should be unique across tracks of same group, and consistent through redundant track groups.\n _this2._setAudioTrack(track.id);\n\n trackFound = true;\n }\n });\n };\n\n traverseTracks();\n\n if (!trackFound) {\n name = null;\n traverseTracks();\n }\n\n if (!trackFound) {\n logger[\"logger\"].error(\"No track found for running audio group-ID: \" + this.audioGroupId);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR,\n fatal: true\n });\n }\n }\n /**\n * @private\n * @param {AudioTrack} audioTrack\n * @returns {boolean}\n */\n ;\n\n _proto._needsTrackLoading = function _needsTrackLoading(audioTrack) {\n var details = audioTrack.details,\n url = audioTrack.url;\n\n if (!details || details.live) {\n // check if we face an audio track embedded in main playlist (audio track without URI attribute)\n return !!url;\n }\n\n return false;\n }\n /**\n * @private\n * @param {AudioTrack} audioTrack\n */\n ;\n\n _proto._loadTrackDetailsIfNeeded = function _loadTrackDetailsIfNeeded(audioTrack) {\n if (this._needsTrackLoading(audioTrack)) {\n var url = audioTrack.url,\n id = audioTrack.id; // track not retrieved yet, or live playlist we need to (re)load it\n\n logger[\"logger\"].log(\"loading audio-track playlist for id: \" + id);\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_LOADING, {\n url: url,\n id: id\n });\n }\n }\n /**\n * @private\n * @param {number} newId\n */\n ;\n\n _proto._updateTrack = function _updateTrack(newId) {\n // check if level idx is valid\n if (newId < 0 || newId >= this.tracks.length) {\n return;\n } // stopping live reloading timer if any\n\n\n this.clearInterval();\n this._trackId = newId;\n logger[\"logger\"].log(\"trying to update audio-track \" + newId);\n var audioTrack = this.tracks[newId];\n\n this._loadTrackDetailsIfNeeded(audioTrack);\n }\n /**\n * @private\n */\n ;\n\n _proto._handleLoadError = function _handleLoadError() {\n // First, let's black list current track id\n this.trackIdBlacklist[this._trackId] = true; // Let's try to fall back on a functional audio-track with the same group ID\n\n var previousId = this._trackId;\n var _this$tracks$previous = this.tracks[previousId],\n name = _this$tracks$previous.name,\n language = _this$tracks$previous.language,\n groupId = _this$tracks$previous.groupId;\n logger[\"logger\"].warn(\"Loading failed on audio track id: \" + previousId + \", group-id: \" + groupId + \", name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\"); // Find a non-blacklisted track ID with the same NAME\n // At least a track that is not blacklisted, thus on another group-ID.\n\n var newId = previousId;\n\n for (var i = 0; i < this.tracks.length; i++) {\n if (this.trackIdBlacklist[i]) {\n continue;\n }\n\n var newTrack = this.tracks[i];\n\n if (newTrack.name === name) {\n newId = i;\n break;\n }\n }\n\n if (newId === previousId) {\n logger[\"logger\"].warn(\"No fallback audio-track found for name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\");\n return;\n }\n\n logger[\"logger\"].log('Attempting audio-track fallback id:', newId, 'group-id:', this.tracks[newId].groupId);\n\n this._setAudioTrack(newId);\n };\n\n audio_track_controller_createClass(AudioTrackController, [{\n key: \"audioTracks\",\n get: function get() {\n return this.tracks;\n }\n /**\n * @type {number} Index into audio-tracks list of currently selected track.\n */\n\n }, {\n key: \"audioTrack\",\n get: function get() {\n return this._trackId;\n }\n /**\n * Select current track by index\n */\n ,\n set: function set(newId) {\n this._setAudioTrack(newId); // If audio track is selected from API then don't choose from the manifest default track\n\n\n this._selectDefaultTrack = false;\n }\n }]);\n\n return AudioTrackController;\n}(TaskLoop);\n\n/* harmony default export */ var audio_track_controller = (audio_track_controller_AudioTrackController);\n// CONCATENATED MODULE: ./src/controller/audio-stream-controller.js\n\n\n\n\nfunction audio_stream_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction audio_stream_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) audio_stream_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) audio_stream_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction audio_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Audio Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar audio_stream_controller_window = window,\n audio_stream_controller_performance = audio_stream_controller_window.performance;\nvar audio_stream_controller_TICK_INTERVAL = 100; // how often to tick in ms\n\nvar audio_stream_controller_AudioStreamController = /*#__PURE__*/function (_BaseStreamController) {\n audio_stream_controller_inheritsLoose(AudioStreamController, _BaseStreamController);\n\n function AudioStreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].AUDIO_TRACKS_UPDATED, events[\"default\"].AUDIO_TRACK_SWITCHING, events[\"default\"].AUDIO_TRACK_LOADED, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_PARSING_INIT_SEGMENT, events[\"default\"].FRAG_PARSING_DATA, events[\"default\"].FRAG_PARSED, events[\"default\"].ERROR, events[\"default\"].BUFFER_RESET, events[\"default\"].BUFFER_CREATED, events[\"default\"].BUFFER_APPENDED, events[\"default\"].BUFFER_FLUSHED, events[\"default\"].INIT_PTS_FOUND) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = State.STOPPED;\n _this.initPTS = [];\n _this.waitingFragment = null;\n _this.videoTrackCC = null;\n _this.waitingVideoCC = null;\n return _this;\n } // Signal that video PTS was found\n\n\n var _proto = AudioStreamController.prototype;\n\n _proto.onInitPtsFound = function onInitPtsFound(data) {\n var demuxerId = data.id,\n cc = data.frag.cc,\n initPTS = data.initPTS;\n\n if (demuxerId === 'main') {\n // Always update the new INIT PTS\n // Can change due level switch\n this.initPTS[cc] = initPTS;\n this.videoTrackCC = cc;\n logger[\"logger\"].log(\"InitPTS for cc: \" + cc + \" found from main: \" + initPTS); // If we are waiting we need to demux/remux the waiting frag\n // With the new initPTS\n\n if (this.state === State.WAITING_INIT_PTS) {\n this.tick();\n }\n }\n };\n\n _proto.startLoad = function startLoad(startPosition) {\n if (this.tracks) {\n var lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n this.setInterval(audio_stream_controller_TICK_INTERVAL);\n this.fragLoadError = 0;\n\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"logger\"].log(\"audio:override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n this.state = State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = State.STARTING;\n }\n\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n this.startPosition = startPosition;\n this.state = State.STOPPED;\n }\n };\n\n _proto.doTick = function doTick() {\n var pos,\n track,\n trackDetails,\n hls = this.hls,\n config = hls.config; // logger.log('audioStream:' + this.state);\n\n switch (this.state) {\n case State.ERROR: // don't do anything in error state to avoid breaking further ...\n\n case State.PAUSED: // don't do anything in paused state either ...\n\n case State.BUFFER_FLUSHING:\n break;\n\n case State.STARTING:\n this.state = State.WAITING_TRACK;\n this.loadedmetadata = false;\n break;\n\n case State.IDLE:\n var tracks = this.tracks; // audio tracks not received => exit loop\n\n if (!tracks) {\n break;\n } // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n\n\n if (!this.media && (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n } // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // if we have not yet loaded any fragment, start loading from start position\n\n\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n\n if (pos === undefined) {\n break;\n }\n }\n\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n var videoBuffer = this.videoBuffer ? this.videoBuffer : this.media;\n var maxBufferHole = pos < config.maxBufferHole ? Math.max(MAX_START_GAP_JUMP, config.maxBufferHole) : config.maxBufferHole;\n var bufferInfo = BufferHelper.bufferInfo(media, pos, maxBufferHole);\n var mainBufferInfo = BufferHelper.bufferInfo(videoBuffer, pos, maxBufferHole);\n var bufferLen = bufferInfo.len;\n var bufferEnd = bufferInfo.end;\n var fragPrevious = this.fragPrevious; // ensure we buffer at least config.maxBufferLength (default 30s) or config.maxMaxBufferLength (default: 600s)\n // whichever is smaller.\n // once we reach that threshold, don't buffer more than video (mainBufferInfo.len)\n\n var maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength);\n var maxBufLen = Math.max(maxConfigBuffer, mainBufferInfo.len);\n var audioSwitch = this.audioSwitch;\n var trackId = this.trackId; // if buffer length is less than maxBufLen try to load a new fragment\n\n if ((bufferLen < maxBufLen || audioSwitch) && trackId < tracks.length) {\n trackDetails = tracks[trackId].details; // if track info not retrieved yet, switch state and wait for track retrieval\n\n if (typeof trackDetails === 'undefined') {\n this.state = State.WAITING_TRACK;\n break;\n }\n\n if (!audioSwitch && this._streamEnded(bufferInfo, trackDetails)) {\n this.hls.trigger(events[\"default\"].BUFFER_EOS, {\n type: 'audio'\n });\n this.state = State.ENDED;\n return;\n } // find fragment index, contiguous with end of buffer position\n\n\n var fragments = trackDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n frag; // When switching audio track, reload audio as close as possible to currentTime\n\n if (audioSwitch) {\n if (trackDetails.live && !trackDetails.PTSKnown) {\n logger[\"logger\"].log('switching audiotrack, live stream, unknown PTS,load first fragment');\n bufferEnd = 0;\n } else {\n bufferEnd = pos; // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime\n\n if (trackDetails.PTSKnown && pos < start) {\n // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start\n if (bufferInfo.end > start || bufferInfo.nextStart) {\n logger[\"logger\"].log('alt audio track ahead of main track, seek to start of alt audio track');\n this.media.currentTime = start + 0.05;\n } else {\n return;\n }\n }\n }\n }\n\n if (trackDetails.initSegment && !trackDetails.initSegment.data) {\n frag = trackDetails.initSegment;\n } // eslint-disable-line brace-style\n // if bufferEnd before start of playlist, load first fragment\n else if (bufferEnd <= start) {\n frag = fragments[0];\n\n if (this.videoTrackCC !== null && frag.cc !== this.videoTrackCC) {\n // Ensure we find a fragment which matches the continuity of the video track\n frag = findFragWithCC(fragments, this.videoTrackCC);\n }\n\n if (trackDetails.live && frag.loadIdx && frag.loadIdx === this.fragLoadIdx) {\n // we just loaded this first fragment, and we are still lagging behind the start of the live playlist\n // let's force seek to start\n var nextBuffered = bufferInfo.nextStart ? bufferInfo.nextStart : start;\n logger[\"logger\"].log(\"no alt audio available @currentTime:\" + this.media.currentTime + \", seeking @\" + (nextBuffered + 0.05));\n this.media.currentTime = nextBuffered + 0.05;\n return;\n }\n } else {\n var foundFrag;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n } // Prefer the next fragment if it's within tolerance\n\n\n if (fragNext && !fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, function (frag) {\n return fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, frag);\n });\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start; // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < trackDetails.endSN) {\n frag = fragments[frag.sn + 1 - trackDetails.startSN];\n\n if (this.fragmentTracker.getState(frag) !== FragmentState.OK) {\n logger[\"logger\"].log(\"SN just loaded, load next one: \" + frag.sn);\n }\n } else {\n frag = null;\n }\n }\n }\n }\n\n if (frag) {\n // logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.encrypted) {\n logger[\"logger\"].log(\"Loading key for \" + frag.sn + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId);\n this.state = State.KEY_LOADING;\n hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: frag\n });\n } else {\n // only load if fragment is not loaded or if in audio switch\n // we force a frag loading in audio switch as fragment tracker might not have evicted previous frags in case of quick audio switch\n this.fragCurrent = frag;\n\n if (audioSwitch || this.fragmentTracker.getState(frag) === FragmentState.NOT_LOADED) {\n logger[\"logger\"].log(\"Loading \" + frag.sn + \", cc: \" + frag.cc + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId + \", \" + (this.loadedmetadata ? 'currentTime' : 'nextLoadPosition') + \": \" + pos + \", bufferEnd: \" + bufferEnd.toFixed(3));\n\n if (frag.sn !== 'initSegment') {\n this.startFragRequested = true;\n }\n\n if (Object(number[\"isFiniteNumber\"])(frag.sn)) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n\n hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: frag\n });\n this.state = State.FRAG_LOADING;\n }\n }\n }\n }\n\n break;\n\n case State.WAITING_TRACK:\n track = this.tracks[this.trackId]; // check if playlist is already loaded\n\n if (track && track.details) {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = audio_stream_controller_performance.now();\n var retryDate = this.retryDate;\n media = this.media;\n var isSeeking = media && media.seeking; // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n\n if (!retryDate || now >= retryDate || isSeeking) {\n logger[\"logger\"].log('audioStreamController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n\n break;\n\n case State.WAITING_INIT_PTS:\n // Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS\n var waitingFrag = this.waitingFragment;\n\n if (waitingFrag) {\n var waitingFragCC = waitingFrag.frag.cc;\n\n if (this.initPTS[waitingFragCC] !== undefined) {\n this.waitingFragment = null;\n this.state = State.FRAG_LOADING;\n this.onFragLoaded(waitingFrag);\n } else if (this.videoTrackCC !== this.waitingVideoCC) {\n // Drop waiting fragment if videoTrackCC has changed since waitingFragment was set and initPTS was not found\n logger[\"logger\"].log(\"Waiting fragment cc (\" + waitingFragCC + \") cancelled because video is at cc \" + this.videoTrackCC);\n this.clearWaitingFragment();\n } else {\n // Drop waiting fragment if an earlier fragment is needed\n var _bufferInfo = BufferHelper.bufferInfo(this.mediaBuffer, this.media.currentTime, config.maxBufferHole);\n\n var waitingFragmentAtPosition = fragmentWithinToleranceTest(_bufferInfo.end, config.maxFragLookUpTolerance, waitingFrag.frag);\n\n if (waitingFragmentAtPosition < 0) {\n logger[\"logger\"].log(\"Waiting fragment cc (\" + waitingFragCC + \") @ \" + waitingFrag.frag.start + \" cancelled because another fragment at \" + _bufferInfo.end + \" is needed\");\n this.clearWaitingFragment();\n }\n }\n } else {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n\n default:\n break;\n }\n };\n\n _proto.clearWaitingFragment = function clearWaitingFragment() {\n var waitingFrag = this.waitingFragment;\n\n if (waitingFrag) {\n this.fragmentTracker.removeFragment(waitingFrag.frag);\n this.waitingFragment = null;\n this.waitingVideoCC = null;\n this.state = State.IDLE;\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(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\n if (this.tracks && config.autoStartLoad) {\n this.startLoad(config.startPosition);\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n\n if (media && media.ended) {\n logger[\"logger\"].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n } // remove video listeners\n\n\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n\n this.media = this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n this.fragmentTracker.removeAllFragments();\n this.stopLoad();\n };\n\n _proto.onAudioTracksUpdated = function onAudioTracksUpdated(data) {\n logger[\"logger\"].log('audio tracks updated');\n this.tracks = data.audioTracks;\n };\n\n _proto.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url;\n this.trackId = data.id;\n this.fragCurrent = null;\n this.clearWaitingFragment();\n this.state = State.PAUSED; // destroy useless demuxer when switching audio to main\n\n if (!altAudio) {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n } else {\n // switching to audio track, start timer if not already started\n this.setInterval(audio_stream_controller_TICK_INTERVAL);\n } // should we switch tracks ?\n\n\n if (altAudio) {\n this.audioSwitch = true; // main audio track are handled by stream-controller, just do something if switching to alt audio track\n\n this.state = State.IDLE;\n }\n\n this.tick();\n };\n\n _proto.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n var newDetails = data.details,\n trackId = data.id,\n track = this.tracks[trackId],\n curDetails = track.details,\n duration = newDetails.totalduration,\n sliding = 0;\n logger[\"logger\"].log(\"track \" + trackId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n\n if (newDetails.live || curDetails && curDetails.live) {\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start; // TODO\n // this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n\n if (newDetails.PTSKnown) {\n logger[\"logger\"].log(\"live audio playlist sliding:\" + sliding.toFixed(3));\n } else {\n logger[\"logger\"].log('live audio playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger[\"logger\"].log('live audio playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n\n track.details = newDetails; // compute start position\n\n if (!this.startFragRequested) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n logger[\"logger\"].log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"logger\"].log(\"compute startPosition for audio-track to \" + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n }\n\n this.nextLoadPosition = this.startPosition;\n } // only switch batck to IDLE state if we were waiting for track to start downloading a new fragment\n\n\n if (this.state === State.WAITING_TRACK) {\n this.state = State.IDLE;\n } // trigger handler right now\n\n\n this.tick();\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'audio' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var track = this.tracks[this.trackId],\n details = track.details,\n duration = details.totalduration,\n trackId = fragCurrent.level,\n sn = fragCurrent.sn,\n cc = fragCurrent.cc,\n audioCodec = this.config.defaultAudioCodec || track.audioCodec || 'mp4a.40.2',\n stats = this.stats = data.stats;\n\n if (sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = audio_stream_controller_performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'audio'\n });\n this.tick();\n } else {\n this.state = State.PARSING; // transmux the MPEG-TS data to ISO-BMFF segments\n\n this.appended = false;\n\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'audio');\n } // Check if we have video initPTS\n // If not we need to wait for it\n\n\n var initPTS = this.initPTS[cc];\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n\n if (initPTS !== undefined) {\n this.pendingBuffering = true;\n logger[\"logger\"].log(\"Demuxing \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId); // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n\n var accurateTimeOffset = false; // details.PTSKnown || !details.live;\n\n this.demuxer.push(data.payload, initSegmentData, audioCodec, null, fragCurrent, duration, accurateTimeOffset, initPTS);\n } else {\n logger[\"logger\"].log(\"Unknown video PTS for cc \" + cc + \", waiting for video PTS before demuxing audio frag \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId);\n this.waitingFragment = data;\n this.waitingVideoCC = this.videoTrackCC;\n this.state = State.WAITING_INIT_PTS;\n }\n }\n }\n\n this.fragLoadError = 0;\n };\n\n _proto.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n track; // delete any video track found on audio demuxer\n\n if (tracks.video) {\n delete tracks.video;\n } // include levelCodec in audio and video tracks\n\n\n track = tracks.audio;\n\n if (track) {\n track.levelCodec = track.codec;\n track.id = data.id;\n this.hls.trigger(events[\"default\"].BUFFER_CODECS, tracks);\n logger[\"logger\"].log(\"audio track:audio,container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n\n if (initSegment) {\n var appendObj = {\n type: 'audio',\n data: initSegment,\n parent: 'audio',\n content: 'initSegment'\n };\n\n if (this.audioSwitch) {\n this.pendingData = [appendObj];\n } else {\n this.appended = true; // arm pending Buffering flag before appending a segment\n\n this.pendingBuffering = true;\n this.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n }\n };\n\n _proto.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && data.type === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var trackId = this.trackId,\n track = this.tracks[trackId],\n hls = this.hls;\n\n if (!Object(number[\"isFiniteNumber\"])(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n fragCurrent.addElementaryStream(ElementaryStreamTypes.AUDIO);\n logger[\"logger\"].log(\"parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb);\n updateFragPTSDTS(track.details, fragCurrent, data.startPTS, data.endPTS);\n var media = this.media;\n var appendOnBufferFlush = false; // Only flush audio from old audio tracks when PTS is known on new audio track\n\n if (this.audioSwitch) {\n if (media && media.readyState) {\n var currentTime = media.currentTime;\n logger[\"logger\"].log('switching audio track : currentTime:' + currentTime);\n\n if (currentTime >= data.startPTS) {\n logger[\"logger\"].log('switching audio track : flushing all audio');\n this.state = State.BUFFER_FLUSHING;\n hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n appendOnBufferFlush = true; // Lets announce that the initial audio track switch flush occur\n\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n } else {\n // Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n }\n\n var pendingData = this.pendingData;\n\n if (!pendingData) {\n logger[\"logger\"].warn('Apparently attempt to enqueue media payload without codec initialization data upfront');\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: null,\n fatal: true\n });\n return;\n }\n\n if (!this.audioSwitch) {\n [data.data1, data.data2].forEach(function (buffer) {\n if (buffer && buffer.length) {\n pendingData.push({\n type: data.type,\n data: buffer,\n parent: 'audio',\n content: 'data'\n });\n }\n });\n\n if (!appendOnBufferFlush && pendingData.length) {\n pendingData.forEach(function (appendObj) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (_this2.state === State.PARSING) {\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n\n _this2.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n }\n });\n this.pendingData = [];\n this.appended = true;\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n };\n\n _proto.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = audio_stream_controller_performance.now();\n this.state = State.PARSED;\n\n this._checkAppendedParsed();\n }\n };\n\n _proto.onBufferReset = function onBufferReset() {\n // reset reference to sourcebuffers\n this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n };\n\n _proto.onBufferCreated = function onBufferCreated(data) {\n var audioTrack = data.tracks.audio;\n\n if (audioTrack) {\n this.mediaBuffer = audioTrack.buffer;\n this.loadedmetadata = true;\n }\n\n if (data.tracks.video) {\n this.videoBuffer = data.tracks.video.buffer;\n }\n };\n\n _proto.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'audio') {\n var state = this.state;\n\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n\n this._checkAppendedParsed();\n }\n }\n };\n\n _proto._checkAppendedParsed = function _checkAppendedParsed() {\n // trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent,\n stats = this.stats,\n hls = this.hls;\n\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = audio_stream_controller_performance.now();\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: frag,\n id: 'audio'\n });\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n\n if (media) {\n logger[\"logger\"].log(\"audio buffered : \" + time_ranges.toString(media.buffered));\n }\n\n if (this.audioSwitch && this.appended) {\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: this.trackId\n });\n }\n\n this.state = State.IDLE;\n }\n\n this.tick();\n }\n };\n\n _proto.onError = function onError(data) {\n var frag = data.frag; // don't handle frag error not related to audio fragment\n\n if (frag && frag.type !== 'audio') {\n return;\n }\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n var _frag = data.frag; // don't handle frag error not related to audio fragment\n\n if (_frag && _frag.type !== 'audio') {\n break;\n }\n\n if (!data.fatal) {\n var loadError = this.fragLoadError;\n\n if (loadError) {\n loadError++;\n } else {\n loadError = 1;\n }\n\n var config = this.config;\n\n if (loadError <= config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError; // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n\n var delay = Math.min(Math.pow(2, loadError - 1) * config.fragLoadingRetryDelay, config.fragLoadingMaxRetryTimeout);\n logger[\"logger\"].warn(\"AudioStreamController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = audio_stream_controller_performance.now() + delay; // retry loading state\n\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"logger\"].error(\"AudioStreamController: \" + data.details + \" reaches max retry, redispatch as fatal ...\"); // switch error to fatal\n\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR:\n case errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if (this.state !== State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? State.ERROR : State.IDLE;\n logger[\"logger\"].warn(\"AudioStreamController: \" + data.details + \" while loading frag, now switching to \" + this.state + \" state ...\");\n }\n\n break;\n\n case errors[\"ErrorDetails\"].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'audio' && (this.state === State.PARSING || this.state === State.PARSED)) {\n var media = this.mediaBuffer,\n currentTime = this.media.currentTime,\n mediaBuffered = media && BufferHelper.isBuffered(media, currentTime) && BufferHelper.isBuffered(media, currentTime + 0.5); // reduce max buf len if current position is buffered\n\n if (mediaBuffered) {\n var _config = this.config;\n\n if (_config.maxMaxBufferLength >= _config.maxBufferLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n _config.maxMaxBufferLength /= 2;\n logger[\"logger\"].warn(\"AudioStreamController: reduce max buffer length to \" + _config.maxMaxBufferLength + \"s\");\n }\n\n this.state = State.IDLE;\n } else {\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 logger[\"logger\"].warn('AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer');\n this.fragCurrent = null; // flush everything\n\n this.state = State.BUFFER_FLUSHING;\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n }\n }\n\n break;\n\n default:\n break;\n }\n };\n\n _proto.onBufferFlushed = function onBufferFlushed() {\n var _this3 = this;\n\n var pendingData = this.pendingData;\n\n if (pendingData && pendingData.length) {\n logger[\"logger\"].log('AudioStreamController: appending pending audio data after buffer flushed');\n pendingData.forEach(function (appendObj) {\n _this3.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n });\n this.appended = true;\n this.pendingData = [];\n this.state = State.PARSED;\n } else {\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE; // reset reference to frag\n\n this.fragPrevious = null;\n this.tick();\n }\n };\n\n audio_stream_controller_createClass(AudioStreamController, [{\n key: \"state\",\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"logger\"].log(\"audio stream:\" + previousState + \"->\" + nextState);\n }\n },\n get: function get() {\n return this._state;\n }\n }]);\n\n return AudioStreamController;\n}(base_stream_controller_BaseStreamController);\n\n/* harmony default export */ var audio_stream_controller = (audio_stream_controller_AudioStreamController);\n// CONCATENATED MODULE: ./src/utils/vttcue.js\n/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* harmony default export */ var vttcue = ((function () {\n if (typeof window !== 'undefined' && window.VTTCue) {\n return window.VTTCue;\n }\n\n var autoKeyword = 'auto';\n var directionSetting = {\n '': true,\n lr: true,\n rl: true\n };\n var alignSetting = {\n start: true,\n middle: true,\n end: true,\n left: true,\n right: true\n };\n\n function findDirectionSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n\n function findAlignSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n\n function extend(obj) {\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n\n return obj;\n }\n\n function VTTCue(startTime, endTime, text) {\n var cue = this;\n var baseObj = {};\n baseObj.enumerable = true;\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n\n cue.hasBeenReset = false;\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = '';\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = '';\n var _snapToLines = true;\n var _line = 'auto';\n var _lineAlign = 'start';\n var _position = 50;\n var _positionAlign = 'middle';\n var _size = 50;\n var _align = 'middle';\n Object.defineProperty(cue, 'id', extend({}, baseObj, {\n get: function get() {\n return _id;\n },\n set: function set(value) {\n _id = '' + value;\n }\n }));\n Object.defineProperty(cue, 'pauseOnExit', extend({}, baseObj, {\n get: function get() {\n return _pauseOnExit;\n },\n set: function set(value) {\n _pauseOnExit = !!value;\n }\n }));\n Object.defineProperty(cue, 'startTime', extend({}, baseObj, {\n get: function get() {\n return _startTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('Start time must be set to a number.');\n }\n\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'endTime', extend({}, baseObj, {\n get: function get() {\n return _endTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('End time must be set to a number.');\n }\n\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'text', extend({}, baseObj, {\n get: function get() {\n return _text;\n },\n set: function set(value) {\n _text = '' + value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'region', extend({}, baseObj, {\n get: function get() {\n return _region;\n },\n set: function set(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'vertical', extend({}, baseObj, {\n get: function get() {\n return _vertical;\n },\n set: function set(value) {\n var setting = findDirectionSetting(value); // Have to check for false because the setting an be an empty string.\n\n if (setting === false) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'snapToLines', extend({}, baseObj, {\n get: function get() {\n return _snapToLines;\n },\n set: function set(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'line', extend({}, baseObj, {\n get: function get() {\n return _line;\n },\n set: function set(value) {\n if (typeof value !== 'number' && value !== autoKeyword) {\n throw new SyntaxError('An invalid number or illegal string was specified.');\n }\n\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'lineAlign', extend({}, baseObj, {\n get: function get() {\n return _lineAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'position', extend({}, baseObj, {\n get: function get() {\n return _position;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Position must be between 0 and 100.');\n }\n\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'positionAlign', extend({}, baseObj, {\n get: function get() {\n return _positionAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'size', extend({}, baseObj, {\n get: function get() {\n return _size;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Size must be between 0 and 100.');\n }\n\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'align', extend({}, baseObj, {\n get: function get() {\n return _align;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n /**\n * Other <track> spec defined properties\n */\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n\n cue.displayState = void 0;\n }\n /**\n * VTTCue methods\n */\n\n\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n var WebVTT = window.WebVTT;\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n\n return VTTCue;\n})());\n// CONCATENATED MODULE: ./src/utils/vttparser.js\n/*\n * Source: https://github.com/mozilla/vtt.js/blob/master/dist/vtt.js#L1716\n */\n\n\nvar StringDecoder = function StringDecoder() {\n return {\n decode: function decode(data) {\n if (!data) {\n return '';\n }\n\n if (typeof data !== 'string') {\n throw new Error('Error - expected string data.');\n }\n\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nfunction VTTParser() {\n this.window = window;\n this.state = 'INITIAL';\n this.buffer = '';\n this.decoder = new StringDecoder();\n this.regionList = [];\n} // Try to parse input as a time stamp.\n\n\nfunction parseTimeStamp(input) {\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(':', ''), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n} // A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\n\n\nfunction Settings() {\n this.values = Object.create(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function set(k, v) {\n if (!this.get(k) && v !== '') {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function get(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function has(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function alt(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function integer(k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function percent(k, v) {\n var m;\n\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n\n return false;\n }\n}; // Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\n\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n\n for (var i in groups) {\n if (typeof groups[i] !== 'string') {\n continue;\n }\n\n var kv = groups[i].split(keyValueDelim);\n\n if (kv.length !== 2) {\n continue;\n }\n\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\n\nvar defaults = new vttcue(0, 0, 0); // 'middle' was changed to 'center' in the spec: https://github.com/w3c/webvtt/pull/244\n// Safari doesn't yet support this change, but FF and Chrome do.\n\nvar center = defaults.align === 'middle' ? 'middle' : 'center';\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input; // 4.1 WebVTT timestamp\n\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n\n if (ts === null) {\n throw new Error('Malformed timestamp: ' + oInput);\n } // Remove time stamp from input.\n\n\n input = input.replace(/^[^\\sa-zA-Z-]+/, '');\n return ts;\n } // 4.4.2 WebVTT cue settings\n\n\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'region':\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n\n break;\n\n case 'vertical':\n settings.alt(k, v, ['rl', 'lr']);\n break;\n\n case 'line':\n var vals = v.split(','),\n vals0 = vals[0];\n settings.integer(k, vals0);\n\n if (settings.percent(k, vals0)) {\n settings.set('snapToLines', false);\n }\n\n settings.alt(k, vals0, ['auto']);\n\n if (vals.length === 2) {\n settings.alt('lineAlign', vals[1], ['start', center, 'end']);\n }\n\n break;\n\n case 'position':\n vals = v.split(',');\n settings.percent(k, vals[0]);\n\n if (vals.length === 2) {\n settings.alt('positionAlign', vals[1], ['start', center, 'end', 'line-left', 'line-right', 'auto']);\n }\n\n break;\n\n case 'size':\n settings.percent(k, v);\n break;\n\n case 'align':\n settings.alt(k, v, ['start', center, 'end', 'left', 'right']);\n break;\n }\n }, /:/, /\\s/); // Apply default values for any missing fields.\n\n cue.region = settings.get('region', null);\n cue.vertical = settings.get('vertical', '');\n var line = settings.get('line', 'auto');\n\n if (line === 'auto' && defaults.line === -1) {\n // set numeric line number for Safari\n line = -1;\n }\n\n cue.line = line;\n cue.lineAlign = settings.get('lineAlign', 'start');\n cue.snapToLines = settings.get('snapToLines', true);\n cue.size = settings.get('size', 100);\n cue.align = settings.get('align', center);\n var position = settings.get('position', 'auto');\n\n if (position === 'auto' && defaults.position === 50) {\n // set numeric position for Safari\n position = cue.align === 'start' || cue.align === 'left' ? 0 : cue.align === 'end' || cue.align === 'right' ? 100 : 50;\n }\n\n cue.position = position;\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, '');\n } // 4.1 WebVTT cue timings.\n\n\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n\n skipWhitespace();\n\n if (input.substr(0, 3) !== '-->') {\n // (3) next characters must match '-->'\n throw new Error('Malformed time stamp (time stamps must be separated by \\'-->\\'): ' + oInput);\n }\n\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n // 4.1 WebVTT cue settings list.\n\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\nfunction fixLineBreaks(input) {\n return input.replace(/<br(?: \\/)?>/gi, '\\n');\n}\n\nVTTParser.prototype = {\n parse: function parse(data) {\n var self = this; // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {\n stream: true\n });\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n buffer = fixLineBreaks(buffer);\n\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n\n var line = buffer.substr(0, pos); // Advance the buffer early in case we fail below.\n\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n\n self.buffer = buffer.substr(pos);\n return line;\n } // 3.2 WebVTT metadata header syntax\n\n\n function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'Region':\n // 3.3 WebVTT region metadata header syntax\n // console.log('parse region', v);\n // parseRegion(v);\n break;\n }\n }, /:/);\n } // 5.1 WebVTT file parsing.\n\n\n try {\n var line;\n\n if (self.state === 'INITIAL') {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine(); // strip of UTF-8 BOM if any\n // https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n\n var m = line.match(/^()?WEBVTT([ \\t].*)?$/);\n\n if (!m || !m[0]) {\n throw new Error('Malformed WebVTT signature.');\n }\n\n self.state = 'HEADER';\n }\n\n var alreadyCollectedLine = false;\n\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case 'HEADER':\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = 'ID';\n }\n\n continue;\n\n case 'NOTE':\n // Ignore NOTE blocks.\n if (!line) {\n self.state = 'ID';\n }\n\n continue;\n\n case 'ID':\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = 'NOTE';\n break;\n } // 19-29 - Allow any number of line terminators, then initialize new cue values.\n\n\n if (!line) {\n continue;\n }\n\n self.cue = new vttcue(0, 0, '');\n self.state = 'CUE'; // 30-39 - Check if self line contains an optional identifier or timing data.\n\n if (line.indexOf('-->') === -1) {\n self.cue.id = line;\n continue;\n }\n\n // Process line as start of a cue.\n\n /* falls through */\n\n case 'CUE':\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = 'BADCUE';\n continue;\n }\n\n self.state = 'CUETEXT';\n continue;\n\n case 'CUETEXT':\n var hasSubstring = line.indexOf('-->') !== -1; // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n if (self.oncue) {\n self.oncue(self.cue);\n }\n\n self.cue = null;\n self.state = 'ID';\n continue;\n }\n\n if (self.cue.text) {\n self.cue.text += '\\n';\n }\n\n self.cue.text += line;\n continue;\n\n case 'BADCUE':\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = 'ID';\n }\n\n continue;\n }\n }\n } catch (e) {\n // If we are currently parsing a cue, report what we have.\n if (self.state === 'CUETEXT' && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n\n self.cue = null; // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n\n self.state = self.state === 'INITIAL' ? 'BADWEBVTT' : 'BADCUE';\n }\n\n return this;\n },\n flush: function flush() {\n var self = this;\n\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode(); // Synthesize the end of the current cue or region.\n\n if (self.cue || self.state === 'HEADER') {\n self.buffer += '\\n\\n';\n self.parse();\n } // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n\n\n if (self.state === 'INITIAL') {\n throw new Error('Malformed WebVTT signature.');\n }\n } catch (e) {\n throw e;\n }\n\n if (self.onflush) {\n self.onflush();\n }\n\n return this;\n }\n};\n\n/* harmony default export */ var vttparser = (VTTParser);\n// CONCATENATED MODULE: ./src/utils/cues.ts\n\nfunction newCue(track, startTime, endTime, captionScreen) {\n var result = [];\n var row; // the type data states this is VTTCue, but it can potentially be a TextTrackCue on old browsers\n\n var cue;\n var indenting;\n var indent;\n var text;\n var VTTCue = window.VTTCue || TextTrackCue;\n\n for (var r = 0; r < captionScreen.rows.length; r++) {\n row = captionScreen.rows[r];\n indenting = true;\n indent = 0;\n text = '';\n\n if (!row.isEmpty()) {\n for (var c = 0; c < row.chars.length; c++) {\n if (row.chars[c].uchar.match(/\\s/) && indenting) {\n indent++;\n } else {\n text += row.chars[c].uchar;\n indenting = false;\n }\n } // To be used for cleaning-up orphaned roll-up captions\n\n\n row.cueStartTime = startTime; // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n\n cue = new VTTCue(startTime, endTime, fixLineBreaks(text.trim()));\n\n if (indent >= 16) {\n indent--;\n } else {\n indent++;\n } // VTTCue.line get's flakey when using controls, so let's now include line 13&14\n // also, drop line 1 since it's to close to the top\n\n\n if (navigator.userAgent.match(/Firefox\\//)) {\n cue.line = r + 1;\n } else {\n cue.line = r > 7 ? r - 2 : r + 1;\n }\n\n cue.align = 'left'; // Clamp the position between 0 and 100 - if out of these bounds, Firefox throws an exception and captions break\n\n cue.position = Math.max(0, Math.min(100, 100 * (indent / 32)));\n result.push(cue);\n\n if (track) {\n track.addCue(cue);\n }\n }\n }\n\n return result;\n}\n// CONCATENATED MODULE: ./src/utils/cea-608-parser.ts\n\n/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\n\nvar specialCea608CharsCodes = {\n 0x2a: 0xe1,\n // lowercase a, acute accent\n 0x5c: 0xe9,\n // lowercase e, acute accent\n 0x5e: 0xed,\n // lowercase i, acute accent\n 0x5f: 0xf3,\n // lowercase o, acute accent\n 0x60: 0xfa,\n // lowercase u, acute accent\n 0x7b: 0xe7,\n // lowercase c with cedilla\n 0x7c: 0xf7,\n // division symbol\n 0x7d: 0xd1,\n // uppercase N tilde\n 0x7e: 0xf1,\n // lowercase n tilde\n 0x7f: 0x2588,\n // Full block\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae,\n // Registered symbol (R)\n 0x81: 0xb0,\n // degree sign\n 0x82: 0xbd,\n // 1/2 symbol\n 0x83: 0xbf,\n // Inverted (open) question mark\n 0x84: 0x2122,\n // Trademark symbol (TM)\n 0x85: 0xa2,\n // Cents symbol\n 0x86: 0xa3,\n // Pounds sterling\n 0x87: 0x266a,\n // Music 8'th note\n 0x88: 0xe0,\n // lowercase a, grave accent\n 0x89: 0x20,\n // transparent space (regular)\n 0x8a: 0xe8,\n // lowercase e, grave accent\n 0x8b: 0xe2,\n // lowercase a, circumflex accent\n 0x8c: 0xea,\n // lowercase e, circumflex accent\n 0x8d: 0xee,\n // lowercase i, circumflex accent\n 0x8e: 0xf4,\n // lowercase o, circumflex accent\n 0x8f: 0xfb,\n // lowercase u, circumflex accent\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1,\n // capital letter A with acute\n 0x91: 0xc9,\n // capital letter E with acute\n 0x92: 0xd3,\n // capital letter O with acute\n 0x93: 0xda,\n // capital letter U with acute\n 0x94: 0xdc,\n // capital letter U with diaresis\n 0x95: 0xfc,\n // lowercase letter U with diaeresis\n 0x96: 0x2018,\n // opening single quote\n 0x97: 0xa1,\n // inverted exclamation mark\n 0x98: 0x2a,\n // asterisk\n 0x99: 0x2019,\n // closing single quote\n 0x9a: 0x2501,\n // box drawings heavy horizontal\n 0x9b: 0xa9,\n // copyright sign\n 0x9c: 0x2120,\n // Service mark\n 0x9d: 0x2022,\n // (round) bullet\n 0x9e: 0x201c,\n // Left double quotation mark\n 0x9f: 0x201d,\n // Right double quotation mark\n 0xa0: 0xc0,\n // uppercase A, grave accent\n 0xa1: 0xc2,\n // uppercase A, circumflex\n 0xa2: 0xc7,\n // uppercase C with cedilla\n 0xa3: 0xc8,\n // uppercase E, grave accent\n 0xa4: 0xca,\n // uppercase E, circumflex\n 0xa5: 0xcb,\n // capital letter E with diaresis\n 0xa6: 0xeb,\n // lowercase letter e with diaresis\n 0xa7: 0xce,\n // uppercase I, circumflex\n 0xa8: 0xcf,\n // uppercase I, with diaresis\n 0xa9: 0xef,\n // lowercase i, with diaresis\n 0xaa: 0xd4,\n // uppercase O, circumflex\n 0xab: 0xd9,\n // uppercase U, grave accent\n 0xac: 0xf9,\n // lowercase u, grave accent\n 0xad: 0xdb,\n // uppercase U, circumflex\n 0xae: 0xab,\n // left-pointing double angle quotation mark\n 0xaf: 0xbb,\n // right-pointing double angle quotation mark\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3,\n // Uppercase A, tilde\n 0xb1: 0xe3,\n // Lowercase a, tilde\n 0xb2: 0xcd,\n // Uppercase I, acute accent\n 0xb3: 0xcc,\n // Uppercase I, grave accent\n 0xb4: 0xec,\n // Lowercase i, grave accent\n 0xb5: 0xd2,\n // Uppercase O, grave accent\n 0xb6: 0xf2,\n // Lowercase o, grave accent\n 0xb7: 0xd5,\n // Uppercase O, tilde\n 0xb8: 0xf5,\n // Lowercase o, tilde\n 0xb9: 0x7b,\n // Open curly brace\n 0xba: 0x7d,\n // Closing curly brace\n 0xbb: 0x5c,\n // Backslash\n 0xbc: 0x5e,\n // Caret\n 0xbd: 0x5f,\n // Underscore\n 0xbe: 0x7c,\n // Pipe (vertical line)\n 0xbf: 0x223c,\n // Tilde operator\n 0xc0: 0xc4,\n // Uppercase A, umlaut\n 0xc1: 0xe4,\n // Lowercase A, umlaut\n 0xc2: 0xd6,\n // Uppercase O, umlaut\n 0xc3: 0xf6,\n // Lowercase o, umlaut\n 0xc4: 0xdf,\n // Esszett (sharp S)\n 0xc5: 0xa5,\n // Yen symbol\n 0xc6: 0xa4,\n // Generic currency sign\n 0xc7: 0x2503,\n // Box drawings heavy vertical\n 0xc8: 0xc5,\n // Uppercase A, ring\n 0xc9: 0xe5,\n // Lowercase A, ring\n 0xca: 0xd8,\n // Uppercase O, stroke\n 0xcb: 0xf8,\n // Lowercase o, strok\n 0xcc: 0x250f,\n // Box drawings heavy down and right\n 0xcd: 0x2513,\n // Box drawings heavy down and left\n 0xce: 0x2517,\n // Box drawings heavy up and right\n 0xcf: 0x251b // Box drawings heavy up and left\n\n};\n/**\n * Utils\n */\n\nvar getCharForByte = function getCharForByte(_byte) {\n var charCode = _byte;\n\n if (specialCea608CharsCodes.hasOwnProperty(_byte)) {\n charCode = specialCea608CharsCodes[_byte];\n }\n\n return String.fromCharCode(charCode);\n};\n\nvar NR_ROWS = 15;\nvar NR_COLS = 100; // Tables to look up row from PAC data\n\nvar rowsLowCh1 = {\n 0x11: 1,\n 0x12: 3,\n 0x15: 5,\n 0x16: 7,\n 0x17: 9,\n 0x10: 11,\n 0x13: 12,\n 0x14: 14\n};\nvar rowsHighCh1 = {\n 0x11: 2,\n 0x12: 4,\n 0x15: 6,\n 0x16: 8,\n 0x17: 10,\n 0x13: 13,\n 0x14: 15\n};\nvar rowsLowCh2 = {\n 0x19: 1,\n 0x1A: 3,\n 0x1D: 5,\n 0x1E: 7,\n 0x1F: 9,\n 0x18: 11,\n 0x1B: 12,\n 0x1C: 14\n};\nvar rowsHighCh2 = {\n 0x19: 2,\n 0x1A: 4,\n 0x1D: 6,\n 0x1E: 8,\n 0x1F: 10,\n 0x1B: 13,\n 0x1C: 15\n};\nvar backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent'];\nvar VerboseLevel;\n\n(function (VerboseLevel) {\n VerboseLevel[VerboseLevel[\"ERROR\"] = 0] = \"ERROR\";\n VerboseLevel[VerboseLevel[\"TEXT\"] = 1] = \"TEXT\";\n VerboseLevel[VerboseLevel[\"WARNING\"] = 2] = \"WARNING\";\n VerboseLevel[VerboseLevel[\"INFO\"] = 2] = \"INFO\";\n VerboseLevel[VerboseLevel[\"DEBUG\"] = 3] = \"DEBUG\";\n VerboseLevel[VerboseLevel[\"DATA\"] = 3] = \"DATA\";\n})(VerboseLevel || (VerboseLevel = {}));\n\nvar cea_608_parser_CaptionsLogger = /*#__PURE__*/function () {\n function CaptionsLogger() {\n this.time = null;\n this.verboseLevel = VerboseLevel.ERROR;\n }\n\n var _proto = CaptionsLogger.prototype;\n\n _proto.log = function log(severity, msg) {\n if (this.verboseLevel >= severity) {\n logger[\"logger\"].log(this.time + \" [\" + severity + \"] \" + msg);\n }\n };\n\n return CaptionsLogger;\n}();\n\nvar numArrayToHexArray = function numArrayToHexArray(numArray) {\n var hexArray = [];\n\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n\n return hexArray;\n};\n\nvar PenState = /*#__PURE__*/function () {\n function PenState(foreground, underline, italics, background, flash) {\n this.foreground = void 0;\n this.underline = void 0;\n this.italics = void 0;\n this.background = void 0;\n this.flash = void 0;\n this.foreground = foreground || 'white';\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || 'black';\n this.flash = flash || false;\n }\n\n var _proto2 = PenState.prototype;\n\n _proto2.reset = function reset() {\n this.foreground = 'white';\n this.underline = false;\n this.italics = false;\n this.background = 'black';\n this.flash = false;\n };\n\n _proto2.setStyles = function setStyles(styles) {\n var attribs = ['foreground', 'underline', 'italics', 'background', 'flash'];\n\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n };\n\n _proto2.isDefault = function isDefault() {\n return this.foreground === 'white' && !this.underline && !this.italics && this.background === 'black' && !this.flash;\n };\n\n _proto2.equals = function equals(other) {\n return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash;\n };\n\n _proto2.copy = function copy(newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n };\n\n _proto2.toString = function toString() {\n return 'color=' + this.foreground + ', underline=' + this.underline + ', italics=' + this.italics + ', background=' + this.background + ', flash=' + this.flash;\n };\n\n return PenState;\n}();\n/**\n * Unicode character with styling and background.\n * @constructor\n */\n\n\nvar StyledUnicodeChar = /*#__PURE__*/function () {\n function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n this.uchar = void 0;\n this.penState = void 0;\n this.uchar = uchar || ' '; // unicode character\n\n this.penState = new PenState(foreground, underline, italics, background, flash);\n }\n\n var _proto3 = StyledUnicodeChar.prototype;\n\n _proto3.reset = function reset() {\n this.uchar = ' ';\n this.penState.reset();\n };\n\n _proto3.setChar = function setChar(uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n };\n\n _proto3.setPenState = function setPenState(newPenState) {\n this.penState.copy(newPenState);\n };\n\n _proto3.equals = function equals(other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n };\n\n _proto3.copy = function copy(newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n };\n\n _proto3.isEmpty = function isEmpty() {\n return this.uchar === ' ' && this.penState.isDefault();\n };\n\n return StyledUnicodeChar;\n}();\n/**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\n\n\nvar Row = /*#__PURE__*/function () {\n function Row(logger) {\n this.chars = void 0;\n this.pos = void 0;\n this.currPenState = void 0;\n this.cueStartTime = void 0;\n this.logger = void 0;\n this.chars = [];\n\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n\n this.logger = logger;\n this.pos = 0;\n this.currPenState = new PenState();\n }\n\n var _proto4 = Row.prototype;\n\n _proto4.equals = function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n };\n\n _proto4.copy = function copy(other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n };\n\n _proto4.isEmpty = function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n }\n /**\n * Set the cursor to a valid column.\n */\n ;\n\n _proto4.setCursor = function setCursor(absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n\n if (this.pos < 0) {\n this.logger.log(VerboseLevel.DEBUG, 'Negative cursor position ' + this.pos);\n this.pos = 0;\n } else if (this.pos > NR_COLS) {\n this.logger.log(VerboseLevel.DEBUG, 'Too large cursor position ' + this.pos);\n this.pos = NR_COLS;\n }\n }\n /**\n * Move the cursor relative to current position.\n */\n ;\n\n _proto4.moveCursor = function moveCursor(relPos) {\n var newPos = this.pos + relPos;\n\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n\n this.setCursor(newPos);\n }\n /**\n * Backspace, move one step back and clear character.\n */\n ;\n\n _proto4.backSpace = function backSpace() {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(' ', this.currPenState);\n };\n\n _proto4.insertChar = function insertChar(_byte2) {\n if (_byte2 >= 0x90) {\n // Extended char\n this.backSpace();\n }\n\n var _char = getCharForByte(_byte2);\n\n if (this.pos >= NR_COLS) {\n this.logger.log(VerboseLevel.ERROR, 'Cannot insert ' + _byte2.toString(16) + ' (' + _char + ') at position ' + this.pos + '. Skipping it!');\n return;\n }\n\n this.chars[this.pos].setChar(_char, this.currPenState);\n this.moveCursor(1);\n };\n\n _proto4.clearFromPos = function clearFromPos(startPos) {\n var i;\n\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n };\n\n _proto4.clear = function clear() {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n };\n\n _proto4.clearToEndOfRow = function clearToEndOfRow() {\n this.clearFromPos(this.pos);\n };\n\n _proto4.getTextString = function getTextString() {\n var chars = [];\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n var _char2 = this.chars[i].uchar;\n\n if (_char2 !== ' ') {\n empty = false;\n }\n\n chars.push(_char2);\n }\n\n if (empty) {\n return '';\n } else {\n return chars.join('');\n }\n };\n\n _proto4.setPenStyles = function setPenStyles(styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n };\n\n return Row;\n}();\n/**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n */\n\nvar CaptionScreen = /*#__PURE__*/function () {\n function CaptionScreen(logger) {\n this.rows = void 0;\n this.currRow = void 0;\n this.nrRollUpRows = void 0;\n this.lastOutputScreen = void 0;\n this.logger = void 0;\n this.rows = [];\n\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row(logger));\n } // Note that we use zero-based numbering (0-14)\n\n\n this.logger = logger;\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.lastOutputScreen = null;\n this.reset();\n }\n\n var _proto5 = CaptionScreen.prototype;\n\n _proto5.reset = function reset() {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n\n this.currRow = NR_ROWS - 1;\n };\n\n _proto5.equals = function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n };\n\n _proto5.copy = function copy(other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n };\n\n _proto5.isEmpty = function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n };\n\n _proto5.backSpace = function backSpace() {\n var row = this.rows[this.currRow];\n row.backSpace();\n };\n\n _proto5.clearToEndOfRow = function clearToEndOfRow() {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n }\n /**\n * Insert a character (without styling) in the current row.\n */\n ;\n\n _proto5.insertChar = function insertChar(_char3) {\n var row = this.rows[this.currRow];\n row.insertChar(_char3);\n };\n\n _proto5.setPen = function setPen(styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n };\n\n _proto5.moveCursor = function moveCursor(relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n };\n\n _proto5.setCursor = function setCursor(absPos) {\n this.logger.log(VerboseLevel.INFO, 'setCursor: ' + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n };\n\n _proto5.setPAC = function setPAC(pacData) {\n this.logger.log(VerboseLevel.INFO, 'pacData = ' + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n } // Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n\n\n if (this.nrRollUpRows && this.currRow !== newRow) {\n // clear all rows first\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n } // Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n // topRowIndex - the start of rows to copy (inclusive index)\n\n\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows; // We only copy if the last position was already shown.\n // We use the cueStartTime value to check this.\n\n var lastOutputScreen = this.lastOutputScreen;\n\n if (lastOutputScreen) {\n var prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime;\n var time = this.logger.time;\n\n if (prevLineTime && time !== null && prevLineTime < time) {\n for (var _i = 0; _i < this.nrRollUpRows; _i++) {\n this.rows[newRow - this.nrRollUpRows + _i + 1].copy(lastOutputScreen.rows[topRowIndex + _i]);\n }\n }\n }\n }\n\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n\n var styles = {\n foreground: pacData.color,\n underline: pacData.underline,\n italics: pacData.italics,\n background: 'black',\n flash: false\n };\n this.setPen(styles);\n }\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n ;\n\n _proto5.setBkgData = function setBkgData(bkgData) {\n this.logger.log(VerboseLevel.INFO, 'bkgData = ' + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); // Space\n };\n\n _proto5.setRollUpRows = function setRollUpRows(nrRows) {\n this.nrRollUpRows = nrRows;\n };\n\n _proto5.rollUp = function rollUp() {\n if (this.nrRollUpRows === null) {\n this.logger.log(VerboseLevel.DEBUG, 'roll_up but nrRollUpRows not set yet');\n return; // Not properly setup\n }\n\n this.logger.log(VerboseLevel.TEXT, this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n this.logger.log(VerboseLevel.INFO, 'Rolling up'); // this.logger.log(VerboseLevel.TEXT, this.get_display_text())\n }\n /**\n * Get all non-empty rows with as unicode text.\n */\n ;\n\n _proto5.getDisplayText = function getDisplayText(asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = '';\n var rowNr = -1;\n\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n\n if (rowText) {\n rowNr = i + 1;\n\n if (asOneRow) {\n displayText.push('Row ' + rowNr + ': \\'' + rowText + '\\'');\n } else {\n displayText.push(rowText.trim());\n }\n }\n }\n\n if (displayText.length > 0) {\n if (asOneRow) {\n text = '[' + displayText.join(' | ') + ']';\n } else {\n text = displayText.join('\\n');\n }\n }\n\n return text;\n };\n\n _proto5.getTextAndFormat = function getTextAndFormat() {\n return this.rows;\n };\n\n return CaptionScreen;\n}(); // var modes = ['MODE_ROLL-UP', 'MODE_POP-ON', 'MODE_PAINT-ON', 'MODE_TEXT'];\n\nvar Cea608Channel = /*#__PURE__*/function () {\n function Cea608Channel(channelNumber, outputFilter, logger) {\n this.chNr = void 0;\n this.outputFilter = void 0;\n this.mode = void 0;\n this.verbose = void 0;\n this.displayedMemory = void 0;\n this.nonDisplayedMemory = void 0;\n this.lastOutputScreen = void 0;\n this.currRollUpRow = void 0;\n this.writeScreen = void 0;\n this.cueStartTime = void 0;\n this.logger = void 0;\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen(logger);\n this.nonDisplayedMemory = new CaptionScreen(logger);\n this.lastOutputScreen = new CaptionScreen(logger);\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n\n this.logger = logger;\n }\n\n var _proto6 = Cea608Channel.prototype;\n\n _proto6.reset = function reset() {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.outputFilter.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n };\n\n _proto6.getHandler = function getHandler() {\n return this.outputFilter;\n };\n\n _proto6.setHandler = function setHandler(newHandler) {\n this.outputFilter = newHandler;\n };\n\n _proto6.setPAC = function setPAC(pacData) {\n this.writeScreen.setPAC(pacData);\n };\n\n _proto6.setBkgData = function setBkgData(bkgData) {\n this.writeScreen.setBkgData(bkgData);\n };\n\n _proto6.setMode = function setMode(newMode) {\n if (newMode === this.mode) {\n return;\n }\n\n this.mode = newMode;\n this.logger.log(VerboseLevel.INFO, 'MODE=' + newMode);\n\n if (this.mode === 'MODE_POP-ON') {\n this.writeScreen = this.nonDisplayedMemory;\n } else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n\n if (this.mode !== 'MODE_ROLL-UP') {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n\n this.mode = newMode;\n };\n\n _proto6.insertChars = function insertChars(chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n\n var screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';\n this.logger.log(VerboseLevel.INFO, screen + ': ' + this.writeScreen.getDisplayText(true));\n\n if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n this.logger.log(VerboseLevel.TEXT, 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n };\n\n _proto6.ccRCL = function ccRCL() {\n // Resume Caption Loading (switch mode to Pop On)\n this.logger.log(VerboseLevel.INFO, 'RCL - Resume Caption Loading');\n this.setMode('MODE_POP-ON');\n };\n\n _proto6.ccBS = function ccBS() {\n // BackSpace\n this.logger.log(VerboseLevel.INFO, 'BS - BackSpace');\n\n if (this.mode === 'MODE_TEXT') {\n return;\n }\n\n this.writeScreen.backSpace();\n\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n };\n\n _proto6.ccAOF = function ccAOF() {// Reserved (formerly Alarm Off)\n };\n\n _proto6.ccAON = function ccAON() {// Reserved (formerly Alarm On)\n };\n\n _proto6.ccDER = function ccDER() {\n // Delete to End of Row\n this.logger.log(VerboseLevel.INFO, 'DER- Delete to End of Row');\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n };\n\n _proto6.ccRU = function ccRU(nrRows) {\n // Roll-Up Captions-2,3,or 4 Rows\n this.logger.log(VerboseLevel.INFO, 'RU(' + nrRows + ') - Roll Up');\n this.writeScreen = this.displayedMemory;\n this.setMode('MODE_ROLL-UP');\n this.writeScreen.setRollUpRows(nrRows);\n };\n\n _proto6.ccFON = function ccFON() {\n // Flash On\n this.logger.log(VerboseLevel.INFO, 'FON - Flash On');\n this.writeScreen.setPen({\n flash: true\n });\n };\n\n _proto6.ccRDC = function ccRDC() {\n // Resume Direct Captioning (switch mode to PaintOn)\n this.logger.log(VerboseLevel.INFO, 'RDC - Resume Direct Captioning');\n this.setMode('MODE_PAINT-ON');\n };\n\n _proto6.ccTR = function ccTR() {\n // Text Restart in text mode (not supported, however)\n this.logger.log(VerboseLevel.INFO, 'TR');\n this.setMode('MODE_TEXT');\n };\n\n _proto6.ccRTD = function ccRTD() {\n // Resume Text Display in Text mode (not supported, however)\n this.logger.log(VerboseLevel.INFO, 'RTD');\n this.setMode('MODE_TEXT');\n };\n\n _proto6.ccEDM = function ccEDM() {\n // Erase Displayed Memory\n this.logger.log(VerboseLevel.INFO, 'EDM - Erase Displayed Memory');\n this.displayedMemory.reset();\n this.outputDataUpdate(true);\n };\n\n _proto6.ccCR = function ccCR() {\n // Carriage Return\n this.logger.log(VerboseLevel.INFO, 'CR - Carriage Return');\n this.writeScreen.rollUp();\n this.outputDataUpdate(true);\n };\n\n _proto6.ccENM = function ccENM() {\n // Erase Non-Displayed Memory\n this.logger.log(VerboseLevel.INFO, 'ENM - Erase Non-displayed Memory');\n this.nonDisplayedMemory.reset();\n };\n\n _proto6.ccEOC = function ccEOC() {\n // End of Caption (Flip Memories)\n this.logger.log(VerboseLevel.INFO, 'EOC - End Of Caption');\n\n if (this.mode === 'MODE_POP-ON') {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n this.logger.log(VerboseLevel.TEXT, 'DISP: ' + this.displayedMemory.getDisplayText());\n }\n\n this.outputDataUpdate(true);\n };\n\n _proto6.ccTO = function ccTO(nrCols) {\n // Tab Offset 1,2, or 3 columns\n this.logger.log(VerboseLevel.INFO, 'TO(' + nrCols + ') - Tab Offset');\n this.writeScreen.moveCursor(nrCols);\n };\n\n _proto6.ccMIDROW = function ccMIDROW(secondByte) {\n // Parse MIDROW command\n var styles = {\n flash: false\n };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta'];\n styles.foreground = colors[colorIndex];\n } else {\n styles.foreground = 'white';\n }\n\n this.logger.log(VerboseLevel.INFO, 'MIDROW: ' + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n };\n\n _proto6.outputDataUpdate = function outputDataUpdate(dispatch) {\n if (dispatch === void 0) {\n dispatch = false;\n }\n\n var time = this.logger.time;\n\n if (time === null) {\n return;\n }\n\n if (this.outputFilter) {\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n // Start of a new cue\n this.cueStartTime = time;\n } else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n this.outputFilter.newCue(this.cueStartTime, time, this.lastOutputScreen);\n\n if (dispatch && this.outputFilter.dispatchCue) {\n this.outputFilter.dispatchCue();\n }\n\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : time;\n }\n }\n\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n };\n\n _proto6.cueSplitAtTime = function cueSplitAtTime(t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n\n this.cueStartTime = t;\n }\n }\n };\n\n return Cea608Channel;\n}();\n\nvar Cea608Parser = /*#__PURE__*/function () {\n function Cea608Parser(field, out1, out2) {\n this.channels = void 0;\n this.currentChannel = 0;\n this.cmdHistory = void 0;\n this.logger = void 0;\n var logger = new cea_608_parser_CaptionsLogger();\n this.channels = [null, new Cea608Channel(field, out1, logger), new Cea608Channel(field + 1, out2, logger)];\n this.cmdHistory = createCmdHistory();\n this.logger = logger;\n }\n\n var _proto7 = Cea608Parser.prototype;\n\n _proto7.getHandler = function getHandler(channel) {\n return this.channels[channel].getHandler();\n };\n\n _proto7.setHandler = function setHandler(channel, newHandler) {\n this.channels[channel].setHandler(newHandler);\n }\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n ;\n\n _proto7.addData = function addData(time, byteList) {\n var cmdFound;\n var a;\n var b;\n var charsFound = false;\n this.logger.time = time;\n\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n\n if (a === 0 && b === 0) {\n continue;\n } else {\n this.logger.log(VerboseLevel.DATA, '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');\n }\n\n cmdFound = this.parseCmd(a, b);\n\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n\n if (charsFound) {\n var currChNr = this.currentChannel;\n\n if (currChNr && currChNr > 0) {\n var channel = this.channels[currChNr];\n channel.insertChars(charsFound);\n } else {\n this.logger.log(VerboseLevel.WARNING, 'No channel found yet. TEXT-MODE?');\n }\n }\n }\n\n if (!cmdFound && !charsFound) {\n this.logger.log(VerboseLevel.WARNING, 'Couldn\\'t parse cleaned data ' + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n }\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n ;\n\n _proto7.parseCmd = function parseCmd(a, b) {\n var cmdHistory = this.cmdHistory;\n var cond1 = (a === 0x14 || a === 0x1C || a === 0x15 || a === 0x1D) && b >= 0x20 && b <= 0x2F;\n var cond2 = (a === 0x17 || a === 0x1F) && b >= 0x21 && b <= 0x23;\n\n if (!(cond1 || cond2)) {\n return false;\n }\n\n if (hasCmdRepeated(a, b, cmdHistory)) {\n setLastCmd(null, null, cmdHistory);\n this.logger.log(VerboseLevel.DEBUG, 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');\n return true;\n }\n\n var chNr = a === 0x14 || a === 0x15 || a === 0x17 ? 1 : 2;\n var channel = this.channels[chNr];\n\n if (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) {\n if (b === 0x20) {\n channel.ccRCL();\n } else if (b === 0x21) {\n channel.ccBS();\n } else if (b === 0x22) {\n channel.ccAOF();\n } else if (b === 0x23) {\n channel.ccAON();\n } else if (b === 0x24) {\n channel.ccDER();\n } else if (b === 0x25) {\n channel.ccRU(2);\n } else if (b === 0x26) {\n channel.ccRU(3);\n } else if (b === 0x27) {\n channel.ccRU(4);\n } else if (b === 0x28) {\n channel.ccFON();\n } else if (b === 0x29) {\n channel.ccRDC();\n } else if (b === 0x2A) {\n channel.ccTR();\n } else if (b === 0x2B) {\n channel.ccRTD();\n } else if (b === 0x2C) {\n channel.ccEDM();\n } else if (b === 0x2D) {\n channel.ccCR();\n } else if (b === 0x2E) {\n channel.ccENM();\n } else if (b === 0x2F) {\n channel.ccEOC();\n }\n } else {\n // a == 0x17 || a == 0x1F\n channel.ccTO(b - 0x20);\n }\n\n setLastCmd(a, b, cmdHistory);\n this.currentChannel = chNr;\n return true;\n }\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n ;\n\n _proto7.parseMidrow = function parseMidrow(a, b) {\n var chNr = 0;\n\n if ((a === 0x11 || a === 0x19) && b >= 0x20 && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n } else {\n chNr = 2;\n }\n\n if (chNr !== this.currentChannel) {\n this.logger.log(VerboseLevel.ERROR, 'Mismatch channel in midrow parsing');\n return false;\n }\n\n var channel = this.channels[chNr];\n\n if (!channel) {\n return false;\n }\n\n channel.ccMIDROW(b);\n this.logger.log(VerboseLevel.DEBUG, 'MIDROW (' + numArrayToHexArray([a, b]) + ')');\n return true;\n }\n\n return false;\n }\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n ;\n\n _proto7.parsePAC = function parsePAC(a, b) {\n var row;\n var cmdHistory = this.cmdHistory;\n var case1 = (a >= 0x11 && a <= 0x17 || a >= 0x19 && a <= 0x1F) && b >= 0x40 && b <= 0x7F;\n var case2 = (a === 0x10 || a === 0x18) && b >= 0x40 && b <= 0x5F;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n if (hasCmdRepeated(a, b, cmdHistory)) {\n setLastCmd(null, null, cmdHistory);\n return true; // Repeated commands are dropped (once)\n }\n\n var chNr = a <= 0x17 ? 1 : 2;\n\n if (b >= 0x40 && b <= 0x5F) {\n row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];\n } else {\n // 0x60 <= b <= 0x7F\n row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n\n var channel = this.channels[chNr];\n\n if (!channel) {\n return false;\n }\n\n channel.setPAC(this.interpretPAC(row, b));\n setLastCmd(a, b, cmdHistory);\n this.currentChannel = chNr;\n return true;\n }\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n ;\n\n _proto7.interpretPAC = function interpretPAC(row, _byte3) {\n var pacIndex = _byte3;\n var pacData = {\n color: null,\n italics: false,\n indent: null,\n underline: false,\n row: row\n };\n\n if (_byte3 > 0x5F) {\n pacIndex = _byte3 - 0x60;\n } else {\n pacIndex = _byte3 - 0x40;\n }\n\n pacData.underline = (pacIndex & 1) === 1;\n\n if (pacIndex <= 0xd) {\n pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)];\n } else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = 'white';\n } else {\n pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4;\n }\n\n return pacData; // Note that row has zero offset. The spec uses 1.\n }\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n ;\n\n _proto7.parseChars = function parseChars(a, b) {\n var channelNr;\n var charCodes = null;\n var charCode1 = null;\n\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n } else {\n channelNr = 1;\n charCode1 = a;\n }\n\n if (charCode1 >= 0x11 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n } else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n } else {\n oneCode = b + 0x90;\n }\n\n this.logger.log(VerboseLevel.INFO, 'Special char \\'' + getCharForByte(oneCode) + '\\' in channel ' + channelNr);\n charCodes = [oneCode];\n } else if (a >= 0x20 && a <= 0x7f) {\n charCodes = b === 0 ? [a] : [a, b];\n }\n\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n this.logger.log(VerboseLevel.DEBUG, 'Char codes = ' + hexCodes.join(','));\n setLastCmd(a, b, this.cmdHistory);\n }\n\n return charCodes;\n }\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns {Boolean} Tells if background attributes are found\n */\n ;\n\n _proto7.parseBackgroundAttributes = function parseBackgroundAttributes(a, b) {\n var case1 = (a === 0x10 || a === 0x18) && b >= 0x20 && b <= 0x2f;\n var case2 = (a === 0x17 || a === 0x1f) && b >= 0x2d && b <= 0x2f;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n var index;\n var bkgData = {};\n\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + '_semi';\n }\n } else if (b === 0x2d) {\n bkgData.background = 'transparent';\n } else {\n bkgData.foreground = 'black';\n\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n\n var chNr = a <= 0x17 ? 1 : 2;\n var channel = this.channels[chNr];\n channel.setBkgData(bkgData);\n setLastCmd(a, b, this.cmdHistory);\n return true;\n }\n /**\n * Reset state of parser and its channels.\n */\n ;\n\n _proto7.reset = function reset() {\n for (var i = 0; i < Object.keys(this.channels).length; i++) {\n var channel = this.channels[i];\n\n if (channel) {\n channel.reset();\n }\n }\n\n this.cmdHistory = createCmdHistory();\n }\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n ;\n\n _proto7.cueSplitAtTime = function cueSplitAtTime(t) {\n for (var i = 0; i < this.channels.length; i++) {\n var channel = this.channels[i];\n\n if (channel) {\n channel.cueSplitAtTime(t);\n }\n }\n };\n\n return Cea608Parser;\n}();\n\nfunction setLastCmd(a, b, cmdHistory) {\n cmdHistory.a = a;\n cmdHistory.b = b;\n}\n\nfunction hasCmdRepeated(a, b, cmdHistory) {\n return cmdHistory.a === a && cmdHistory.b === b;\n}\n\nfunction createCmdHistory() {\n return {\n a: null,\n b: null\n };\n}\n\n/* harmony default export */ var cea_608_parser = (Cea608Parser);\n// CONCATENATED MODULE: ./src/utils/output-filter.ts\nvar OutputFilter = /*#__PURE__*/function () {\n function OutputFilter(timelineController, trackName) {\n this.timelineController = void 0;\n this.cueRanges = [];\n this.trackName = void 0;\n this.startTime = null;\n this.endTime = null;\n this.screen = null;\n this.timelineController = timelineController;\n this.trackName = trackName;\n }\n\n var _proto = OutputFilter.prototype;\n\n _proto.dispatchCue = function dispatchCue() {\n if (this.startTime === null) {\n return;\n }\n\n this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen, this.cueRanges);\n this.startTime = null;\n };\n\n _proto.newCue = function newCue(startTime, endTime, screen) {\n if (this.startTime === null || this.startTime > startTime) {\n this.startTime = startTime;\n }\n\n this.endTime = endTime;\n this.screen = screen;\n this.timelineController.createCaptionsTrack(this.trackName);\n };\n\n _proto.reset = function reset() {\n this.cueRanges = [];\n };\n\n return OutputFilter;\n}();\n\n\n// CONCATENATED MODULE: ./src/utils/webvtt-parser.js\n\n\n\n\n\n // String.prototype.startsWith is not supported in IE11\n\nvar startsWith = function startsWith(inputString, searchString, position) {\n return inputString.substr(position || 0, searchString.length) === searchString;\n};\n\nvar webvtt_parser_cueString2millis = function cueString2millis(timeString) {\n var ts = parseInt(timeString.substr(-3));\n var secs = parseInt(timeString.substr(-6, 2));\n var mins = parseInt(timeString.substr(-9, 2));\n var hours = timeString.length > 9 ? parseInt(timeString.substr(0, timeString.indexOf(':'))) : 0;\n\n if (!Object(number[\"isFiniteNumber\"])(ts) || !Object(number[\"isFiniteNumber\"])(secs) || !Object(number[\"isFiniteNumber\"])(mins) || !Object(number[\"isFiniteNumber\"])(hours)) {\n throw Error(\"Malformed X-TIMESTAMP-MAP: Local:\" + timeString);\n }\n\n ts += 1000 * secs;\n ts += 60 * 1000 * mins;\n ts += 60 * 60 * 1000 * hours;\n return ts;\n}; // From https://github.com/darkskyapp/string-hash\n\n\nvar hash = function hash(text) {\n var hash = 5381;\n var i = text.length;\n\n while (i) {\n hash = hash * 33 ^ text.charCodeAt(--i);\n }\n\n return (hash >>> 0).toString();\n};\n\nvar calculateOffset = function calculateOffset(vttCCs, cc, presentationTime) {\n var currCC = vttCCs[cc];\n var prevCC = vttCCs[currCC.prevCC]; // This is the first discontinuity or cues have been processed since the last discontinuity\n // Offset = current discontinuity time\n\n if (!prevCC || !prevCC.new && currCC.new) {\n vttCCs.ccOffset = vttCCs.presentationOffset = currCC.start;\n currCC.new = false;\n return;\n } // There have been discontinuities since cues were last parsed.\n // Offset = time elapsed\n\n\n while (prevCC && prevCC.new) {\n vttCCs.ccOffset += currCC.start - prevCC.start;\n currCC.new = false;\n currCC = prevCC;\n prevCC = vttCCs[currCC.prevCC];\n }\n\n vttCCs.presentationOffset = presentationTime;\n};\n\nvar WebVTTParser = {\n parse: function parse(vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {\n // Convert byteArray into string, replacing any somewhat exotic linefeeds with \"\\n\", then split on that character.\n var re = /\\r\\n|\\n\\r|\\n|\\r/g; // Uint8Array.prototype.reduce is not implemented in IE11\n\n var vttLines = Object(id3[\"utf8ArrayToStr\"])(new Uint8Array(vttByteArray)).trim().replace(re, '\\n').split('\\n');\n var cueTime = '00:00.000';\n var mpegTs = 0;\n var localTime = 0;\n var presentationTime = 0;\n var cues = [];\n var parsingError;\n var inHeader = true;\n var timestampMap = false; // let VTTCue = VTTCue || window.TextTrackCue;\n // Create parser object using VTTCue with TextTrackCue fallback on certain browsers.\n\n var parser = new vttparser();\n\n parser.oncue = function (cue) {\n // Adjust cue timing; clamp cues to start no earlier than - and drop cues that don't end after - 0 on timeline.\n var currCC = vttCCs[cc];\n var cueOffset = vttCCs.ccOffset; // Update offsets for new discontinuities\n\n if (currCC && currCC.new) {\n if (localTime !== undefined) {\n // When local time is provided, offset = discontinuity start time - local time\n cueOffset = vttCCs.ccOffset = currCC.start;\n } else {\n calculateOffset(vttCCs, cc, presentationTime);\n }\n }\n\n if (presentationTime) {\n // If we have MPEGTS, offset = presentation time + discontinuity offset\n cueOffset = presentationTime - vttCCs.presentationOffset;\n }\n\n if (timestampMap) {\n cue.startTime += cueOffset - localTime;\n cue.endTime += cueOffset - localTime;\n } // Create a unique hash id for a cue based on start/end times and text.\n // This helps timeline-controller to avoid showing repeated captions.\n\n\n cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text); // Fix encoding of special characters. TODO: Test with all sorts of weird characters.\n\n cue.text = decodeURIComponent(encodeURIComponent(cue.text));\n\n if (cue.endTime > 0) {\n cues.push(cue);\n }\n };\n\n parser.onparsingerror = function (e) {\n parsingError = e;\n };\n\n parser.onflush = function () {\n if (parsingError && errorCallBack) {\n errorCallBack(parsingError);\n return;\n }\n\n callBack(cues);\n }; // Go through contents line by line.\n\n\n vttLines.forEach(function (line) {\n if (inHeader) {\n // Look for X-TIMESTAMP-MAP in header.\n if (startsWith(line, 'X-TIMESTAMP-MAP=')) {\n // Once found, no more are allowed anyway, so stop searching.\n inHeader = false;\n timestampMap = true; // Extract LOCAL and MPEGTS.\n\n line.substr(16).split(',').forEach(function (timestamp) {\n if (startsWith(timestamp, 'LOCAL:')) {\n cueTime = timestamp.substr(6);\n } else if (startsWith(timestamp, 'MPEGTS:')) {\n mpegTs = parseInt(timestamp.substr(7));\n }\n });\n\n try {\n // Calculate subtitle offset in milliseconds.\n if (syncPTS + (vttCCs[cc].start * 90000 || 0) < 0) {\n syncPTS += 8589934592;\n } // Adjust MPEGTS by sync PTS.\n\n\n mpegTs -= syncPTS; // Convert cue time to seconds\n\n localTime = webvtt_parser_cueString2millis(cueTime) / 1000; // Convert MPEGTS to seconds from 90kHz.\n\n presentationTime = mpegTs / 90000;\n } catch (e) {\n timestampMap = false;\n parsingError = e;\n } // Return without parsing X-TIMESTAMP-MAP line.\n\n\n return;\n } else if (line === '') {\n inHeader = false;\n }\n } // Parse line by default.\n\n\n parser.parse(line + '\\n');\n });\n parser.flush();\n }\n};\n/* harmony default export */ var webvtt_parser = (WebVTTParser);\n// CONCATENATED MODULE: ./src/controller/timeline-controller.ts\n\n\n\nfunction timeline_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction timeline_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\n\n\nvar timeline_controller_TimelineController = /*#__PURE__*/function (_EventHandler) {\n timeline_controller_inheritsLoose(TimelineController, _EventHandler);\n\n function TimelineController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MEDIA_DETACHING, events[\"default\"].FRAG_PARSING_USERDATA, events[\"default\"].FRAG_DECRYPTED, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].INIT_PTS_FOUND) || this;\n _this.media = null;\n _this.config = void 0;\n _this.enabled = true;\n _this.Cues = void 0;\n _this.textTracks = [];\n _this.tracks = [];\n _this.initPTS = [];\n _this.unparsedVttFrags = [];\n _this.captionsTracks = {};\n _this.nonNativeCaptionsTracks = {};\n _this.captionsProperties = void 0;\n _this.cea608Parser1 = void 0;\n _this.cea608Parser2 = void 0;\n _this.lastSn = -1;\n _this.prevCC = -1;\n _this.vttCCs = newVTTCCs();\n _this.hls = hls;\n _this.config = hls.config;\n _this.Cues = hls.config.cueHandler;\n _this.captionsProperties = {\n textTrack1: {\n label: _this.config.captionsTextTrack1Label,\n languageCode: _this.config.captionsTextTrack1LanguageCode\n },\n textTrack2: {\n label: _this.config.captionsTextTrack2Label,\n languageCode: _this.config.captionsTextTrack2LanguageCode\n },\n textTrack3: {\n label: _this.config.captionsTextTrack3Label,\n languageCode: _this.config.captionsTextTrack3LanguageCode\n },\n textTrack4: {\n label: _this.config.captionsTextTrack4Label,\n languageCode: _this.config.captionsTextTrack4LanguageCode\n }\n };\n\n if (_this.config.enableCEA708Captions) {\n var channel1 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack1');\n var channel2 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack2');\n var channel3 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack3');\n var channel4 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack4');\n _this.cea608Parser1 = new cea_608_parser(1, channel1, channel2);\n _this.cea608Parser2 = new cea_608_parser(3, channel3, channel4);\n }\n\n return _this;\n }\n\n var _proto = TimelineController.prototype;\n\n _proto.addCues = function addCues(trackName, startTime, endTime, screen, cueRanges) {\n // skip cues which overlap more than 50% with previously parsed time ranges\n var merged = false;\n\n for (var i = cueRanges.length; i--;) {\n var cueRange = cueRanges[i];\n var overlap = intersection(cueRange[0], cueRange[1], startTime, endTime);\n\n if (overlap >= 0) {\n cueRange[0] = Math.min(cueRange[0], startTime);\n cueRange[1] = Math.max(cueRange[1], endTime);\n merged = true;\n\n if (overlap / (endTime - startTime) > 0.5) {\n return;\n }\n }\n }\n\n if (!merged) {\n cueRanges.push([startTime, endTime]);\n }\n\n if (this.config.renderTextTracksNatively) {\n this.Cues.newCue(this.captionsTracks[trackName], startTime, endTime, screen);\n } else {\n var cues = this.Cues.newCue(null, startTime, endTime, screen);\n this.hls.trigger(events[\"default\"].CUES_PARSED, {\n type: 'captions',\n cues: cues,\n track: trackName\n });\n }\n } // Triggered when an initial PTS is found; used for synchronisation of WebVTT.\n ;\n\n _proto.onInitPtsFound = function onInitPtsFound(data) {\n var _this2 = this;\n\n var frag = data.frag,\n id = data.id,\n initPTS = data.initPTS;\n var unparsedVttFrags = this.unparsedVttFrags;\n\n if (id === 'main') {\n this.initPTS[frag.cc] = initPTS;\n } // Due to asynchronous processing, initial PTS may arrive later than the first VTT fragments are loaded.\n // Parse any unparsed fragments upon receiving the initial PTS.\n\n\n if (unparsedVttFrags.length) {\n this.unparsedVttFrags = [];\n unparsedVttFrags.forEach(function (frag) {\n _this2.onFragLoaded(frag);\n });\n }\n };\n\n _proto.getExistingTrack = function getExistingTrack(trackName) {\n var media = this.media;\n\n if (media) {\n for (var i = 0; i < media.textTracks.length; i++) {\n var textTrack = media.textTracks[i];\n\n if (textTrack[trackName]) {\n return textTrack;\n }\n }\n }\n\n return null;\n };\n\n _proto.createCaptionsTrack = function createCaptionsTrack(trackName) {\n if (this.config.renderTextTracksNatively) {\n this.createNativeTrack(trackName);\n } else {\n this.createNonNativeTrack(trackName);\n }\n };\n\n _proto.createNativeTrack = function createNativeTrack(trackName) {\n if (this.captionsTracks[trackName]) {\n return;\n }\n\n var captionsProperties = this.captionsProperties,\n captionsTracks = this.captionsTracks,\n media = this.media;\n var _captionsProperties$t = captionsProperties[trackName],\n label = _captionsProperties$t.label,\n languageCode = _captionsProperties$t.languageCode; // Enable reuse of existing text track.\n\n var existingTrack = this.getExistingTrack(trackName);\n\n if (!existingTrack) {\n var textTrack = this.createTextTrack('captions', label, languageCode);\n\n if (textTrack) {\n // Set a special property on the track so we know it's managed by Hls.js\n textTrack[trackName] = true;\n captionsTracks[trackName] = textTrack;\n }\n } else {\n captionsTracks[trackName] = existingTrack;\n clearCurrentCues(captionsTracks[trackName]);\n sendAddTrackEvent(captionsTracks[trackName], media);\n }\n };\n\n _proto.createNonNativeTrack = function createNonNativeTrack(trackName) {\n if (this.nonNativeCaptionsTracks[trackName]) {\n return;\n } // Create a list of a single track for the provider to consume\n\n\n var trackProperties = this.captionsProperties[trackName];\n\n if (!trackProperties) {\n return;\n }\n\n var label = trackProperties.label;\n var track = {\n _id: trackName,\n label: label,\n kind: 'captions',\n default: trackProperties.media ? !!trackProperties.media.default : false,\n closedCaptions: trackProperties.media\n };\n this.nonNativeCaptionsTracks[trackName] = track;\n this.hls.trigger(events[\"default\"].NON_NATIVE_TEXT_TRACKS_FOUND, {\n tracks: [track]\n });\n };\n\n _proto.createTextTrack = function createTextTrack(kind, label, lang) {\n var media = this.media;\n\n if (!media) {\n return;\n }\n\n return media.addTextTrack(kind, label, lang);\n };\n\n _proto.destroy = function destroy() {\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media;\n\n this._cleanTracks();\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var captionsTracks = this.captionsTracks;\n Object.keys(captionsTracks).forEach(function (trackName) {\n clearCurrentCues(captionsTracks[trackName]);\n delete captionsTracks[trackName];\n });\n this.nonNativeCaptionsTracks = {};\n };\n\n _proto.onManifestLoading = function onManifestLoading() {\n this.lastSn = -1; // Detect discontiguity in fragment parsing\n\n this.prevCC = -1;\n this.vttCCs = newVTTCCs(); // Detect discontinuity in subtitle manifests\n\n this._cleanTracks();\n\n this.tracks = [];\n this.captionsTracks = {};\n this.nonNativeCaptionsTracks = {};\n };\n\n _proto._cleanTracks = function _cleanTracks() {\n // clear outdated subtitles\n var media = this.media;\n\n if (!media) {\n return;\n }\n\n var textTracks = media.textTracks;\n\n if (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n clearCurrentCues(textTracks[i]);\n }\n }\n };\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n this.textTracks = [];\n this.unparsedVttFrags = this.unparsedVttFrags || [];\n this.initPTS = [];\n\n if (this.cea608Parser1 && this.cea608Parser2) {\n this.cea608Parser1.reset();\n this.cea608Parser2.reset();\n }\n\n if (this.config.enableWebVTT) {\n var tracks = data.subtitles || [];\n var sameTracks = this.tracks && tracks && this.tracks.length === tracks.length;\n this.tracks = data.subtitles || [];\n\n if (this.config.renderTextTracksNatively) {\n var inUseTracks = this.media ? this.media.textTracks : [];\n this.tracks.forEach(function (track, index) {\n var textTrack;\n\n if (index < inUseTracks.length) {\n var inUseTrack = null;\n\n for (var i = 0; i < inUseTracks.length; i++) {\n if (canReuseVttTextTrack(inUseTracks[i], track)) {\n inUseTrack = inUseTracks[i];\n break;\n }\n } // Reuse tracks with the same label, but do not reuse 608/708 tracks\n\n\n if (inUseTrack) {\n textTrack = inUseTrack;\n }\n }\n\n if (!textTrack) {\n textTrack = _this3.createTextTrack('subtitles', track.name, track.lang);\n }\n\n if (track.default) {\n textTrack.mode = _this3.hls.subtitleDisplay ? 'showing' : 'hidden';\n } else {\n textTrack.mode = 'disabled';\n }\n\n _this3.textTracks.push(textTrack);\n });\n } else if (!sameTracks && this.tracks && this.tracks.length) {\n // Create a list of tracks for the provider to consume\n var tracksList = this.tracks.map(function (track) {\n return {\n label: track.name,\n kind: track.type.toLowerCase(),\n default: track.default,\n subtitleTrack: track\n };\n });\n this.hls.trigger(events[\"default\"].NON_NATIVE_TEXT_TRACKS_FOUND, {\n tracks: tracksList\n });\n }\n }\n\n if (this.config.enableCEA708Captions && data.captions) {\n data.captions.forEach(function (captionsTrack) {\n var instreamIdMatch = /(?:CC|SERVICE)([1-4])/.exec(captionsTrack.instreamId);\n\n if (!instreamIdMatch) {\n return;\n }\n\n var trackName = \"textTrack\" + instreamIdMatch[1];\n var trackProperties = _this3.captionsProperties[trackName];\n\n if (!trackProperties) {\n return;\n }\n\n trackProperties.label = captionsTrack.name;\n\n if (captionsTrack.lang) {\n // optional attribute\n trackProperties.languageCode = captionsTrack.lang;\n }\n\n trackProperties.media = captionsTrack;\n });\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag,\n payload = data.payload;\n var cea608Parser1 = this.cea608Parser1,\n cea608Parser2 = this.cea608Parser2,\n initPTS = this.initPTS,\n lastSn = this.lastSn,\n unparsedVttFrags = this.unparsedVttFrags;\n\n if (frag.type === 'main') {\n var sn = frag.sn; // if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack\n\n if (frag.sn !== lastSn + 1) {\n if (cea608Parser1 && cea608Parser2) {\n cea608Parser1.reset();\n cea608Parser2.reset();\n }\n }\n\n this.lastSn = sn;\n } // eslint-disable-line brace-style\n // If fragment is subtitle type, parse as WebVTT.\n else if (frag.type === 'subtitle') {\n if (payload.byteLength) {\n // We need an initial synchronisation PTS. Store fragments as long as none has arrived.\n if (!Object(number[\"isFiniteNumber\"])(initPTS[frag.cc])) {\n unparsedVttFrags.push(data);\n\n if (initPTS.length) {\n // finish unsuccessfully, otherwise the subtitle-stream-controller could be blocked from loading new frags.\n this.hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n }\n\n return;\n }\n\n var decryptData = frag.decryptdata; // If the subtitles are not encrypted, parse VTTs now. Otherwise, we need to wait.\n\n if (decryptData == null || decryptData.key == null || decryptData.method !== 'AES-128') {\n this._parseVTTs(frag, payload);\n }\n } else {\n // In case there is no payload, finish unsuccessfully.\n this.hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n }\n }\n };\n\n _proto._parseVTTs = function _parseVTTs(frag, payload) {\n var _this4 = this;\n\n var hls = this.hls,\n prevCC = this.prevCC,\n textTracks = this.textTracks,\n vttCCs = this.vttCCs;\n\n if (!vttCCs[frag.cc]) {\n vttCCs[frag.cc] = {\n start: frag.start,\n prevCC: prevCC,\n new: true\n };\n this.prevCC = frag.cc;\n } // Parse the WebVTT file contents.\n\n\n webvtt_parser.parse(payload, this.initPTS[frag.cc], vttCCs, frag.cc, function (cues) {\n if (_this4.config.renderTextTracksNatively) {\n var currentTrack = textTracks[frag.level]; // WebVTTParser.parse is an async method and if the currently selected text track mode is set to \"disabled\"\n // before parsing is done then don't try to access currentTrack.cues.getCueById as cues will be null\n // and trying to access getCueById method of cues will throw an exception\n // Because we check if the mode is diabled, we can force check `cues` below. They can't be null.\n\n if (currentTrack.mode === 'disabled') {\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n return;\n } // Add cues and trigger event with success true.\n\n\n cues.forEach(function (cue) {\n // Sometimes there are cue overlaps on segmented vtts so the same\n // cue can appear more than once in different vtt files.\n // This avoid showing duplicated cues with same timecode and text.\n if (!currentTrack.cues.getCueById(cue.id)) {\n try {\n currentTrack.addCue(cue);\n\n if (!currentTrack.cues.getCueById(cue.id)) {\n throw new Error(\"addCue is failed for: \" + cue);\n }\n } catch (err) {\n logger[\"logger\"].debug(\"Failed occurred on adding cues: \" + err);\n var textTrackCue = new window.TextTrackCue(cue.startTime, cue.endTime, cue.text);\n textTrackCue.id = cue.id;\n currentTrack.addCue(textTrackCue);\n }\n }\n });\n } else {\n var trackId = _this4.tracks[frag.level].default ? 'default' : 'subtitles' + frag.level;\n hls.trigger(events[\"default\"].CUES_PARSED, {\n type: 'subtitles',\n cues: cues,\n track: trackId\n });\n }\n\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: true,\n frag: frag\n });\n }, function (e) {\n // Something went wrong while parsing. Trigger event with success false.\n logger[\"logger\"].log(\"Failed to parse VTT cue: \" + e);\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n });\n };\n\n _proto.onFragDecrypted = function onFragDecrypted(data) {\n var frag = data.frag,\n payload = data.payload;\n\n if (frag.type === 'subtitle') {\n if (!Object(number[\"isFiniteNumber\"])(this.initPTS[frag.cc])) {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n this._parseVTTs(frag, payload);\n }\n };\n\n _proto.onFragParsingUserdata = function onFragParsingUserdata(data) {\n var cea608Parser1 = this.cea608Parser1,\n cea608Parser2 = this.cea608Parser2;\n\n if (!this.enabled || !(cea608Parser1 && cea608Parser2)) {\n return;\n } // If the event contains captions (found in the bytes property), push all bytes into the parser immediately\n // It will create the proper timestamps based on the PTS value\n\n\n for (var i = 0; i < data.samples.length; i++) {\n var ccBytes = data.samples[i].bytes;\n\n if (ccBytes) {\n var ccdatas = this.extractCea608Data(ccBytes);\n cea608Parser1.addData(data.samples[i].pts, ccdatas[0]);\n cea608Parser2.addData(data.samples[i].pts, ccdatas[1]);\n }\n }\n };\n\n _proto.extractCea608Data = function extractCea608Data(byteArray) {\n var count = byteArray[0] & 31;\n var position = 2;\n var actualCCBytes = [[], []];\n\n for (var j = 0; j < count; j++) {\n var tmpByte = byteArray[position++];\n var ccbyte1 = 0x7F & byteArray[position++];\n var ccbyte2 = 0x7F & byteArray[position++];\n var ccValid = (4 & tmpByte) !== 0;\n var ccType = 3 & tmpByte;\n\n if (ccbyte1 === 0 && ccbyte2 === 0) {\n continue;\n }\n\n if (ccValid) {\n if (ccType === 0 || ccType === 1) {\n actualCCBytes[ccType].push(ccbyte1);\n actualCCBytes[ccType].push(ccbyte2);\n }\n }\n }\n\n return actualCCBytes;\n };\n\n return TimelineController;\n}(event_handler);\n\nfunction canReuseVttTextTrack(inUseTrack, manifestTrack) {\n return inUseTrack && inUseTrack.label === manifestTrack.name && !(inUseTrack.textTrack1 || inUseTrack.textTrack2);\n}\n\nfunction intersection(x1, x2, y1, y2) {\n return Math.min(x2, y2) - Math.max(x1, y1);\n}\n\nfunction newVTTCCs() {\n return {\n ccOffset: 0,\n presentationOffset: 0,\n 0: {\n start: 0,\n prevCC: -1,\n new: false\n }\n };\n}\n\n/* harmony default export */ var timeline_controller = (timeline_controller_TimelineController);\n// CONCATENATED MODULE: ./src/controller/subtitle-track-controller.js\n\n\n\n\nfunction subtitle_track_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction subtitle_track_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) subtitle_track_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) subtitle_track_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction subtitle_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\nvar subtitle_track_controller_SubtitleTrackController = /*#__PURE__*/function (_EventHandler) {\n subtitle_track_controller_inheritsLoose(SubtitleTrackController, _EventHandler);\n\n function SubtitleTrackController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_LOADED, events[\"default\"].SUBTITLE_TRACK_LOADED) || this;\n _this.tracks = [];\n _this.trackId = -1;\n _this.media = null;\n _this.stopped = true;\n /**\n * @member {boolean} subtitleDisplay Enable/disable subtitle display rendering\n */\n\n _this.subtitleDisplay = true;\n /**\n * Keeps reference to a default track id when media has not been attached yet\n * @member {number}\n */\n\n _this.queuedDefaultTrack = null;\n return _this;\n }\n\n var _proto = SubtitleTrackController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n } // Listen for subtitle track change, then extract the current track ID.\n ;\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n var _this2 = this;\n\n this.media = data.media;\n\n if (!this.media) {\n return;\n }\n\n if (Object(number[\"isFiniteNumber\"])(this.queuedDefaultTrack)) {\n this.subtitleTrack = this.queuedDefaultTrack;\n this.queuedDefaultTrack = null;\n }\n\n this.trackChangeListener = this._onTextTracksChanged.bind(this);\n this.useTextTrackPolling = !(this.media.textTracks && 'onchange' in this.media.textTracks);\n\n if (this.useTextTrackPolling) {\n this.subtitlePollingInterval = setInterval(function () {\n _this2.trackChangeListener();\n }, 500);\n } else {\n this.media.textTracks.addEventListener('change', this.trackChangeListener);\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n if (!this.media) {\n return;\n }\n\n if (this.useTextTrackPolling) {\n clearInterval(this.subtitlePollingInterval);\n } else {\n this.media.textTracks.removeEventListener('change', this.trackChangeListener);\n }\n\n if (Object(number[\"isFiniteNumber\"])(this.subtitleTrack)) {\n this.queuedDefaultTrack = this.subtitleTrack;\n }\n\n var textTracks = filterSubtitleTracks(this.media.textTracks); // Clear loaded cues on media detachment from tracks\n\n textTracks.forEach(function (track) {\n clearCurrentCues(track);\n }); // Disable all subtitle tracks before detachment so when reattached only tracks in that content are enabled.\n\n this.subtitleTrack = -1;\n this.media = null;\n } // Fired whenever a new manifest is loaded.\n ;\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n var tracks = data.subtitles || [];\n this.tracks = tracks;\n this.hls.trigger(events[\"default\"].SUBTITLE_TRACKS_UPDATED, {\n subtitleTracks: tracks\n }); // loop through available subtitle tracks and autoselect default if needed\n // TODO: improve selection logic to handle forced, etc\n\n tracks.forEach(function (track) {\n if (track.default) {\n // setting this.subtitleTrack will trigger internal logic\n // if media has not been attached yet, it will fail\n // we keep a reference to the default track id\n // and we'll set subtitleTrack when onMediaAttached is triggered\n if (_this3.media) {\n _this3.subtitleTrack = track.id;\n } else {\n _this3.queuedDefaultTrack = track.id;\n }\n }\n });\n };\n\n _proto.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var _this4 = this;\n\n var id = data.id,\n details = data.details;\n var trackId = this.trackId,\n tracks = this.tracks;\n var currentTrack = tracks[trackId];\n\n if (id >= tracks.length || id !== trackId || !currentTrack || this.stopped) {\n this._clearReloadTimer();\n\n return;\n }\n\n logger[\"logger\"].log(\"subtitle track \" + id + \" loaded\");\n\n if (details.live) {\n var reloadInterval = computeReloadInterval(currentTrack.details, details, data.stats.trequest);\n logger[\"logger\"].log(\"Reloading live subtitle playlist in \" + reloadInterval + \"ms\");\n this.timer = setTimeout(function () {\n _this4._loadCurrentTrack();\n }, reloadInterval);\n } else {\n this._clearReloadTimer();\n }\n };\n\n _proto.startLoad = function startLoad() {\n this.stopped = false;\n\n this._loadCurrentTrack();\n };\n\n _proto.stopLoad = function stopLoad() {\n this.stopped = true;\n\n this._clearReloadTimer();\n }\n /** get alternate subtitle tracks list from playlist **/\n ;\n\n _proto._clearReloadTimer = function _clearReloadTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n _proto._loadCurrentTrack = function _loadCurrentTrack() {\n var trackId = this.trackId,\n tracks = this.tracks,\n hls = this.hls;\n var currentTrack = tracks[trackId];\n\n if (trackId < 0 || !currentTrack || currentTrack.details && !currentTrack.details.live) {\n return;\n }\n\n logger[\"logger\"].log(\"Loading subtitle track \" + trackId);\n hls.trigger(events[\"default\"].SUBTITLE_TRACK_LOADING, {\n url: currentTrack.url,\n id: trackId\n });\n }\n /**\n * Disables the old subtitleTrack and sets current mode on the next subtitleTrack.\n * This operates on the DOM textTracks.\n * A value of -1 will disable all subtitle tracks.\n * @param newId - The id of the next track to enable\n * @private\n */\n ;\n\n _proto._toggleTrackModes = function _toggleTrackModes(newId) {\n var media = this.media,\n subtitleDisplay = this.subtitleDisplay,\n trackId = this.trackId;\n\n if (!media) {\n return;\n }\n\n var textTracks = filterSubtitleTracks(media.textTracks);\n\n if (newId === -1) {\n [].slice.call(textTracks).forEach(function (track) {\n track.mode = 'disabled';\n });\n } else {\n var oldTrack = textTracks[trackId];\n\n if (oldTrack) {\n oldTrack.mode = 'disabled';\n }\n }\n\n var nextTrack = textTracks[newId];\n\n if (nextTrack) {\n nextTrack.mode = subtitleDisplay ? 'showing' : 'hidden';\n }\n }\n /**\n * This method is responsible for validating the subtitle index and periodically reloading if live.\n * Dispatches the SUBTITLE_TRACK_SWITCH event, which instructs the subtitle-stream-controller to load the selected track.\n * @param newId - The id of the subtitle track to activate.\n */\n ;\n\n _proto._setSubtitleTrackInternal = function _setSubtitleTrackInternal(newId) {\n var hls = this.hls,\n tracks = this.tracks;\n\n if (!Object(number[\"isFiniteNumber\"])(newId) || newId < -1 || newId >= tracks.length) {\n return;\n }\n\n this.trackId = newId;\n logger[\"logger\"].log(\"Switching to subtitle track \" + newId);\n hls.trigger(events[\"default\"].SUBTITLE_TRACK_SWITCH, {\n id: newId\n });\n\n this._loadCurrentTrack();\n };\n\n _proto._onTextTracksChanged = function _onTextTracksChanged() {\n // Media is undefined when switching streams via loadSource()\n if (!this.media || !this.hls.config.renderTextTracksNatively) {\n return;\n }\n\n var trackId = -1;\n var tracks = filterSubtitleTracks(this.media.textTracks);\n\n for (var id = 0; id < tracks.length; id++) {\n if (tracks[id].mode === 'hidden') {\n // Do not break in case there is a following track with showing.\n trackId = id;\n } else if (tracks[id].mode === 'showing') {\n trackId = id;\n break;\n }\n } // Setting current subtitleTrack will invoke code.\n\n\n this.subtitleTrack = trackId;\n };\n\n subtitle_track_controller_createClass(SubtitleTrackController, [{\n key: \"subtitleTracks\",\n get: function get() {\n return this.tracks;\n }\n /** get index of the selected subtitle track (index in subtitle track lists) **/\n\n }, {\n key: \"subtitleTrack\",\n get: function get() {\n return this.trackId;\n }\n /** select a subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n if (this.trackId !== subtitleTrackId) {\n this._toggleTrackModes(subtitleTrackId);\n\n this._setSubtitleTrackInternal(subtitleTrackId);\n }\n }\n }]);\n\n return SubtitleTrackController;\n}(event_handler);\n\nfunction filterSubtitleTracks(textTrackList) {\n var tracks = [];\n\n for (var i = 0; i < textTrackList.length; i++) {\n var track = textTrackList[i]; // Edge adds a track without a label; we don't want to use it\n\n if (track.kind === 'subtitles' && track.label) {\n tracks.push(textTrackList[i]);\n }\n }\n\n return tracks;\n}\n\n/* harmony default export */ var subtitle_track_controller = (subtitle_track_controller_SubtitleTrackController);\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar decrypter = __webpack_require__(\"./src/crypt/decrypter.js\");\n\n// CONCATENATED MODULE: ./src/controller/subtitle-stream-controller.js\nfunction subtitle_stream_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction subtitle_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * @class SubtitleStreamController\n */\n\n\n\n\n\n\n\n\nvar subtitle_stream_controller_window = window,\n subtitle_stream_controller_performance = subtitle_stream_controller_window.performance;\nvar subtitle_stream_controller_TICK_INTERVAL = 500; // how often to tick in ms\n\nvar subtitle_stream_controller_SubtitleStreamController = /*#__PURE__*/function (_BaseStreamController) {\n subtitle_stream_controller_inheritsLoose(SubtitleStreamController, _BaseStreamController);\n\n function SubtitleStreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].ERROR, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].SUBTITLE_TRACKS_UPDATED, events[\"default\"].SUBTITLE_TRACK_SWITCH, events[\"default\"].SUBTITLE_TRACK_LOADED, events[\"default\"].SUBTITLE_FRAG_PROCESSED, events[\"default\"].LEVEL_UPDATED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.state = State.STOPPED;\n _this.tracks = [];\n _this.tracksBuffered = [];\n _this.currentTrackId = -1;\n _this.decrypter = new decrypter[\"default\"](hls, hls.config); // lastAVStart stores the time in seconds for the start time of a level load\n\n _this.lastAVStart = 0;\n _this._onMediaSeeking = _this.onMediaSeeking.bind(subtitle_stream_controller_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = SubtitleStreamController.prototype;\n\n _proto.startLoad = function startLoad() {\n this.stopLoad();\n this.state = State.IDLE; // Check if we already have a track with necessary details to load fragments\n\n var currentTrack = this.tracks[this.currentTrackId];\n\n if (currentTrack && currentTrack.details) {\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n this.tick();\n }\n };\n\n _proto.onSubtitleFragProcessed = function onSubtitleFragProcessed(data) {\n var frag = data.frag,\n success = data.success;\n this.fragPrevious = frag;\n this.state = State.IDLE;\n\n if (!success) {\n return;\n }\n\n var buffered = this.tracksBuffered[this.currentTrackId];\n\n if (!buffered) {\n return;\n } // Create/update a buffered array matching the interface used by BufferHelper.bufferedInfo\n // so we can re-use the logic used to detect how much have been buffered\n\n\n var timeRange;\n var fragStart = frag.start;\n\n for (var i = 0; i < buffered.length; i++) {\n if (fragStart >= buffered[i].start && fragStart <= buffered[i].end) {\n timeRange = buffered[i];\n break;\n }\n }\n\n var fragEnd = frag.start + frag.duration;\n\n if (timeRange) {\n timeRange.end = fragEnd;\n } else {\n timeRange = {\n start: fragStart,\n end: fragEnd\n };\n buffered.push(timeRange);\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(_ref) {\n var media = _ref.media;\n this.media = media;\n media.addEventListener('seeking', this._onMediaSeeking);\n this.state = State.IDLE;\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var _this2 = this;\n\n if (!this.media) {\n return;\n }\n\n this.media.removeEventListener('seeking', this._onMediaSeeking);\n this.fragmentTracker.removeAllFragments();\n this.currentTrackId = -1;\n this.tracks.forEach(function (track) {\n _this2.tracksBuffered[track.id] = [];\n });\n this.media = null;\n this.state = State.STOPPED;\n } // If something goes wrong, proceed to next frag, if we were processing one.\n ;\n\n _proto.onError = function onError(data) {\n var frag = data.frag; // don't handle error not related to subtitle fragment\n\n if (!frag || frag.type !== 'subtitle') {\n return;\n }\n\n if (this.fragCurrent && this.fragCurrent.loader) {\n this.fragCurrent.loader.abort();\n }\n\n this.state = State.IDLE;\n } // Got all new subtitle tracks.\n ;\n\n _proto.onSubtitleTracksUpdated = function onSubtitleTracksUpdated(data) {\n var _this3 = this;\n\n logger[\"logger\"].log('subtitle tracks updated');\n this.tracksBuffered = [];\n this.tracks = data.subtitleTracks;\n this.tracks.forEach(function (track) {\n _this3.tracksBuffered[track.id] = [];\n });\n };\n\n _proto.onSubtitleTrackSwitch = function onSubtitleTrackSwitch(data) {\n this.currentTrackId = data.id;\n\n if (!this.tracks || !this.tracks.length || this.currentTrackId === -1) {\n this.clearInterval();\n return;\n } // Check if track has the necessary details to load fragments\n\n\n var currentTrack = this.tracks[this.currentTrackId];\n\n if (currentTrack && currentTrack.details) {\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n }\n } // Got a new set of subtitle fragments.\n ;\n\n _proto.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var id = data.id,\n details = data.details;\n var currentTrackId = this.currentTrackId,\n tracks = this.tracks;\n var currentTrack = tracks[currentTrackId];\n\n if (id >= tracks.length || id !== currentTrackId || !currentTrack) {\n return;\n }\n\n if (details.live) {\n mergeSubtitlePlaylists(currentTrack.details, details, this.lastAVStart);\n }\n\n currentTrack.details = details;\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent;\n var decryptData = data.frag.decryptdata;\n var fragLoaded = data.frag;\n var hls = this.hls;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && data.frag.type === 'subtitle' && fragCurrent.sn === data.frag.sn) {\n // check to see if the payload needs to be decrypted\n if (data.payload.byteLength > 0 && decryptData && decryptData.key && decryptData.method === 'AES-128') {\n var startTime = subtitle_stream_controller_performance.now(); // decrypt the subtitles\n\n this.decrypter.decrypt(data.payload, decryptData.key.buffer, decryptData.iv.buffer, function (decryptedData) {\n var endTime = subtitle_stream_controller_performance.now();\n hls.trigger(events[\"default\"].FRAG_DECRYPTED, {\n frag: fragLoaded,\n payload: decryptedData,\n stats: {\n tstart: startTime,\n tdecrypt: endTime\n }\n });\n });\n }\n }\n };\n\n _proto.onLevelUpdated = function onLevelUpdated(_ref2) {\n var details = _ref2.details;\n var frags = details.fragments;\n this.lastAVStart = frags.length ? frags[0].start : 0;\n };\n\n _proto.doTick = function doTick() {\n if (!this.media) {\n this.state = State.IDLE;\n return;\n }\n\n switch (this.state) {\n case State.IDLE:\n {\n var config = this.config,\n currentTrackId = this.currentTrackId,\n fragmentTracker = this.fragmentTracker,\n media = this.media,\n tracks = this.tracks;\n\n if (!tracks || !tracks[currentTrackId] || !tracks[currentTrackId].details) {\n break;\n }\n\n var maxBufferHole = config.maxBufferHole,\n maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength);\n var bufferedInfo = BufferHelper.bufferedInfo(this._getBuffered(), media.currentTime, maxBufferHole);\n var bufferEnd = bufferedInfo.end,\n bufferLen = bufferedInfo.len;\n var trackDetails = tracks[currentTrackId].details;\n var fragments = trackDetails.fragments;\n var fragLen = fragments.length;\n var end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration;\n\n if (bufferLen > maxConfigBuffer) {\n return;\n }\n\n var foundFrag;\n var fragPrevious = this.fragPrevious;\n\n if (bufferEnd < end) {\n if (fragPrevious && trackDetails.hasProgramDateTime) {\n foundFrag = findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, maxFragLookUpTolerance);\n }\n\n if (!foundFrag) {\n foundFrag = findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance);\n }\n } else {\n foundFrag = fragments[fragLen - 1];\n }\n\n if (foundFrag && foundFrag.encrypted) {\n logger[\"logger\"].log(\"Loading key for \" + foundFrag.sn);\n this.state = State.KEY_LOADING;\n this.hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: foundFrag\n });\n } else if (foundFrag && fragmentTracker.getState(foundFrag) === FragmentState.NOT_LOADED) {\n // only load if fragment is not loaded\n this.fragCurrent = foundFrag;\n this.state = State.FRAG_LOADING;\n this.hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: foundFrag\n });\n }\n }\n }\n };\n\n _proto.stopLoad = function stopLoad() {\n this.lastAVStart = 0;\n this.fragPrevious = null;\n\n _BaseStreamController.prototype.stopLoad.call(this);\n };\n\n _proto._getBuffered = function _getBuffered() {\n return this.tracksBuffered[this.currentTrackId] || [];\n };\n\n _proto.onMediaSeeking = function onMediaSeeking() {\n if (this.fragCurrent) {\n var currentTime = this.media ? this.media.currentTime : 0;\n var tolerance = this.config.maxFragLookUpTolerance;\n var fragStartOffset = this.fragCurrent.start - tolerance;\n var fragEndOffset = this.fragCurrent.start + this.fragCurrent.duration + tolerance; // check if position will be out of currently loaded frag range after seeking : if out, cancel frag load, if in, don't do anything\n\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (this.fragCurrent.loader) {\n this.fragCurrent.loader.abort();\n }\n\n this.fragmentTracker.removeFragment(this.fragCurrent);\n this.fragCurrent = null;\n this.fragPrevious = null; // switch to IDLE state to load new fragment\n\n this.state = State.IDLE; // speed up things\n\n this.tick();\n }\n }\n };\n\n return SubtitleStreamController;\n}(base_stream_controller_BaseStreamController);\n// CONCATENATED MODULE: ./src/utils/mediakeys-helper.ts\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess\n */\nvar KeySystems;\n\n(function (KeySystems) {\n KeySystems[\"WIDEVINE\"] = \"com.widevine.alpha\";\n KeySystems[\"PLAYREADY\"] = \"com.microsoft.playready\";\n})(KeySystems || (KeySystems = {}));\n\nvar requestMediaKeySystemAccess = function () {\n if (typeof window !== 'undefined' && window.navigator && window.navigator.requestMediaKeySystemAccess) {\n return window.navigator.requestMediaKeySystemAccess.bind(window.navigator);\n } else {\n return null;\n }\n}();\n\n\n// CONCATENATED MODULE: ./src/controller/eme-controller.ts\nfunction eme_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction eme_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) eme_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) eme_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction eme_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * @author Stephan Hesse <disparat@gmail.com> | <tchakabam@gmail.com>\n *\n * DRM support for Hls.js\n */\n\n\n\n\n\nvar MAX_LICENSE_REQUEST_FAILURES = 3;\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemConfiguration\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @param {object} drmSystemOptions Optional parameters/requirements for the key-system\n * @returns {Array<MediaSystemConfiguration>} An array of supported configurations\n */\n\nvar createWidevineMediaKeySystemConfigurations = function createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs, drmSystemOptions) {\n /* jshint ignore:line */\n var baseConfig = {\n // initDataTypes: ['keyids', 'mp4'],\n // label: \"\",\n // persistentState: \"not-allowed\", // or \"required\" ?\n // distinctiveIdentifier: \"not-allowed\", // or \"required\" ?\n // sessionTypes: ['temporary'],\n audioCapabilities: [],\n // { contentType: 'audio/mp4; codecs=\"mp4a.40.2\"' }\n videoCapabilities: [] // { contentType: 'video/mp4; codecs=\"avc1.42E01E\"' }\n\n };\n audioCodecs.forEach(function (codec) {\n baseConfig.audioCapabilities.push({\n contentType: \"audio/mp4; codecs=\\\"\" + codec + \"\\\"\",\n robustness: drmSystemOptions.audioRobustness || ''\n });\n });\n videoCodecs.forEach(function (codec) {\n baseConfig.videoCapabilities.push({\n contentType: \"video/mp4; codecs=\\\"\" + codec + \"\\\"\",\n robustness: drmSystemOptions.videoRobustness || ''\n });\n });\n return [baseConfig];\n};\n/**\n * The idea here is to handle key-system (and their respective platforms) specific configuration differences\n * in order to work with the local requestMediaKeySystemAccess method.\n *\n * We can also rule-out platform-related key-system support at this point by throwing an error.\n *\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @throws will throw an error if a unknown key system is passed\n * @returns {Array<MediaSystemConfiguration>} A non-empty Array of MediaKeySystemConfiguration objects\n */\n\n\nvar eme_controller_getSupportedMediaKeySystemConfigurations = function getSupportedMediaKeySystemConfigurations(keySystem, audioCodecs, videoCodecs, drmSystemOptions) {\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n return createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs, drmSystemOptions);\n\n default:\n throw new Error(\"Unknown key-system: \" + keySystem);\n }\n};\n\n/**\n * Controller to deal with encrypted media extensions (EME)\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API\n *\n * @class\n * @constructor\n */\nvar eme_controller_EMEController = /*#__PURE__*/function (_EventHandler) {\n eme_controller_inheritsLoose(EMEController, _EventHandler);\n\n /**\n * @constructs\n * @param {Hls} hls Our Hls.js instance\n */\n function EMEController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHED, events[\"default\"].MANIFEST_PARSED) || this;\n _this._widevineLicenseUrl = void 0;\n _this._licenseXhrSetup = void 0;\n _this._emeEnabled = void 0;\n _this._requestMediaKeySystemAccess = void 0;\n _this._drmSystemOptions = void 0;\n _this._config = void 0;\n _this._mediaKeysList = [];\n _this._media = null;\n _this._hasSetMediaKeys = false;\n _this._requestLicenseFailureCount = 0;\n _this.mediaKeysPromise = null;\n\n _this._onMediaEncrypted = function (e) {\n logger[\"logger\"].log(\"Media is encrypted using \\\"\" + e.initDataType + \"\\\" init data type\");\n\n if (!_this.mediaKeysPromise) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no CDM access or no keys have been requested');\n\n _this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_KEYS,\n fatal: true\n });\n\n return;\n }\n\n var finallySetKeyAndStartSession = function finallySetKeyAndStartSession(mediaKeys) {\n if (!_this._media) {\n return;\n }\n\n _this._attemptSetMediaKeys(mediaKeys);\n\n _this._generateRequestWithPreferredKeySession(e.initDataType, e.initData);\n }; // Could use `Promise.finally` but some Promise polyfills are missing it\n\n\n _this.mediaKeysPromise.then(finallySetKeyAndStartSession).catch(finallySetKeyAndStartSession);\n };\n\n _this._config = hls.config;\n _this._widevineLicenseUrl = _this._config.widevineLicenseUrl;\n _this._licenseXhrSetup = _this._config.licenseXhrSetup;\n _this._emeEnabled = _this._config.emeEnabled;\n _this._requestMediaKeySystemAccess = _this._config.requestMediaKeySystemAccessFunc;\n _this._drmSystemOptions = hls.config.drmSystemOptions;\n return _this;\n }\n /**\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @returns {string} License server URL for key-system (if any configured, otherwise causes error)\n * @throws if a unsupported keysystem is passed\n */\n\n\n var _proto = EMEController.prototype;\n\n _proto.getLicenseServerUrl = function getLicenseServerUrl(keySystem) {\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n if (!this._widevineLicenseUrl) {\n break;\n }\n\n return this._widevineLicenseUrl;\n }\n\n throw new Error(\"no license server URL configured for key-system \\\"\" + keySystem + \"\\\"\");\n }\n /**\n * Requests access object and adds it to our list upon success\n * @private\n * @param {string} keySystem System ID (see `KeySystems`)\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @throws When a unsupported KeySystem is passed\n */\n ;\n\n _proto._attemptKeySystemAccess = function _attemptKeySystemAccess(keySystem, audioCodecs, videoCodecs) {\n var _this2 = this;\n\n // This can throw, but is caught in event handler callpath\n var mediaKeySystemConfigs = eme_controller_getSupportedMediaKeySystemConfigurations(keySystem, audioCodecs, videoCodecs, this._drmSystemOptions);\n logger[\"logger\"].log('Requesting encrypted media key-system access'); // expecting interface like window.navigator.requestMediaKeySystemAccess\n\n var keySystemAccessPromise = this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs);\n this.mediaKeysPromise = keySystemAccessPromise.then(function (mediaKeySystemAccess) {\n return _this2._onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess);\n });\n keySystemAccessPromise.catch(function (err) {\n logger[\"logger\"].error(\"Failed to obtain key-system \\\"\" + keySystem + \"\\\" access:\", err);\n });\n };\n\n /**\n * Handles obtaining access to a key-system\n * @private\n * @param {string} keySystem\n * @param {MediaKeySystemAccess} mediaKeySystemAccess https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemAccess\n */\n _proto._onMediaKeySystemAccessObtained = function _onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess) {\n var _this3 = this;\n\n logger[\"logger\"].log(\"Access for key-system \\\"\" + keySystem + \"\\\" obtained\");\n var mediaKeysListItem = {\n mediaKeysSessionInitialized: false,\n mediaKeySystemAccess: mediaKeySystemAccess,\n mediaKeySystemDomain: keySystem\n };\n\n this._mediaKeysList.push(mediaKeysListItem);\n\n var mediaKeysPromise = Promise.resolve().then(function () {\n return mediaKeySystemAccess.createMediaKeys();\n }).then(function (mediaKeys) {\n mediaKeysListItem.mediaKeys = mediaKeys;\n logger[\"logger\"].log(\"Media-keys created for key-system \\\"\" + keySystem + \"\\\"\");\n\n _this3._onMediaKeysCreated();\n\n return mediaKeys;\n });\n mediaKeysPromise.catch(function (err) {\n logger[\"logger\"].error('Failed to create media-keys:', err);\n });\n return mediaKeysPromise;\n }\n /**\n * Handles key-creation (represents access to CDM). We are going to create key-sessions upon this\n * for all existing keys where no session exists yet.\n *\n * @private\n */\n ;\n\n _proto._onMediaKeysCreated = function _onMediaKeysCreated() {\n var _this4 = this;\n\n // check for all key-list items if a session exists, otherwise, create one\n this._mediaKeysList.forEach(function (mediaKeysListItem) {\n if (!mediaKeysListItem.mediaKeysSession) {\n // mediaKeys is definitely initialized here\n mediaKeysListItem.mediaKeysSession = mediaKeysListItem.mediaKeys.createSession();\n\n _this4._onNewMediaKeySession(mediaKeysListItem.mediaKeysSession);\n }\n });\n }\n /**\n * @private\n * @param {*} keySession\n */\n ;\n\n _proto._onNewMediaKeySession = function _onNewMediaKeySession(keySession) {\n var _this5 = this;\n\n logger[\"logger\"].log(\"New key-system session \" + keySession.sessionId);\n keySession.addEventListener('message', function (event) {\n _this5._onKeySessionMessage(keySession, event.message);\n }, false);\n }\n /**\n * @private\n * @param {MediaKeySession} keySession\n * @param {ArrayBuffer} message\n */\n ;\n\n _proto._onKeySessionMessage = function _onKeySessionMessage(keySession, message) {\n logger[\"logger\"].log('Got EME message event, creating license request');\n\n this._requestLicense(message, function (data) {\n logger[\"logger\"].log(\"Received license data (length: \" + (data ? data.byteLength : data) + \"), updating key-session\");\n keySession.update(data);\n });\n }\n /**\n * @private\n * @param e {MediaEncryptedEvent}\n */\n ;\n\n /**\n * @private\n */\n _proto._attemptSetMediaKeys = function _attemptSetMediaKeys(mediaKeys) {\n if (!this._media) {\n throw new Error('Attempted to set mediaKeys without first attaching a media element');\n }\n\n if (!this._hasSetMediaKeys) {\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem || !keysListItem.mediaKeys) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no CDM access or no keys have been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_KEYS,\n fatal: true\n });\n return;\n }\n\n logger[\"logger\"].log('Setting keys for encrypted media');\n\n this._media.setMediaKeys(keysListItem.mediaKeys);\n\n this._hasSetMediaKeys = true;\n }\n }\n /**\n * @private\n */\n ;\n\n _proto._generateRequestWithPreferredKeySession = function _generateRequestWithPreferredKeySession(initDataType, initData) {\n var _this6 = this;\n\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem) {\n logger[\"logger\"].error('Fatal: Media is encrypted but not any key-system access has been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n\n if (keysListItem.mediaKeysSessionInitialized) {\n logger[\"logger\"].warn('Key-Session already initialized but requested again');\n return;\n }\n\n var keySession = keysListItem.mediaKeysSession;\n\n if (!keySession) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no key-session existing');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_SESSION,\n fatal: true\n });\n return;\n } // initData is null if the media is not CORS-same-origin\n\n\n if (!initData) {\n logger[\"logger\"].warn('Fatal: initData required for generating a key session is null');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_INIT_DATA,\n fatal: true\n });\n return;\n }\n\n logger[\"logger\"].log(\"Generating key-session request for \\\"\" + initDataType + \"\\\" init data type\");\n keysListItem.mediaKeysSessionInitialized = true;\n keySession.generateRequest(initDataType, initData).then(function () {\n logger[\"logger\"].debug('Key-session generation succeeded');\n }).catch(function (err) {\n logger[\"logger\"].error('Error generating key-session request:', err);\n\n _this6.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_SESSION,\n fatal: false\n });\n });\n }\n /**\n * @private\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n * @returns {XMLHttpRequest} Unsent (but opened state) XHR object\n * @throws if XMLHttpRequest construction failed\n */\n ;\n\n _proto._createLicenseXhr = function _createLicenseXhr(url, keyMessage, callback) {\n var xhr = new XMLHttpRequest();\n var licenseXhrSetup = this._licenseXhrSetup;\n\n try {\n if (licenseXhrSetup) {\n try {\n licenseXhrSetup(xhr, url);\n } catch (e) {\n // let's try to open before running setup\n xhr.open('POST', url, true);\n licenseXhrSetup(xhr, url);\n }\n } // if licenseXhrSetup did not yet call open, let's do it now\n\n\n if (!xhr.readyState) {\n xhr.open('POST', url, true);\n }\n } catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n throw new Error(\"issue setting up KeySystem license XHR \" + e);\n } // Because we set responseType to ArrayBuffer here, callback is typed as handling only array buffers\n\n\n xhr.responseType = 'arraybuffer';\n xhr.onreadystatechange = this._onLicenseRequestReadyStageChange.bind(this, xhr, url, keyMessage, callback);\n return xhr;\n }\n /**\n * @private\n * @param {XMLHttpRequest} xhr\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n */\n ;\n\n _proto._onLicenseRequestReadyStageChange = function _onLicenseRequestReadyStageChange(xhr, url, keyMessage, callback) {\n switch (xhr.readyState) {\n case 4:\n if (xhr.status === 200) {\n this._requestLicenseFailureCount = 0;\n logger[\"logger\"].log('License request succeeded');\n\n if (xhr.responseType !== 'arraybuffer') {\n logger[\"logger\"].warn('xhr response type was not set to the expected arraybuffer for license request');\n }\n\n callback(xhr.response);\n } else {\n logger[\"logger\"].error(\"License Request XHR failed (\" + url + \"). Status: \" + xhr.status + \" (\" + xhr.statusText + \")\");\n this._requestLicenseFailureCount++;\n\n if (this._requestLicenseFailureCount > MAX_LICENSE_REQUEST_FAILURES) {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n return;\n }\n\n var attemptsLeft = MAX_LICENSE_REQUEST_FAILURES - this._requestLicenseFailureCount + 1;\n logger[\"logger\"].warn(\"Retrying license request, \" + attemptsLeft + \" attempts left\");\n\n this._requestLicense(keyMessage, callback);\n }\n\n break;\n }\n }\n /**\n * @private\n * @param {MediaKeysListItem} keysListItem\n * @param {ArrayBuffer} keyMessage\n * @returns {ArrayBuffer} Challenge data posted to license server\n * @throws if KeySystem is unsupported\n */\n ;\n\n _proto._generateLicenseRequestChallenge = function _generateLicenseRequestChallenge(keysListItem, keyMessage) {\n switch (keysListItem.mediaKeySystemDomain) {\n // case KeySystems.PLAYREADY:\n // from https://github.com/MicrosoftEdge/Demos/blob/master/eme/scripts/demo.js\n\n /*\n if (this.licenseType !== this.LICENSE_TYPE_WIDEVINE) {\n // For PlayReady CDMs, we need to dig the Challenge out of the XML.\n var keyMessageXml = new DOMParser().parseFromString(String.fromCharCode.apply(null, new Uint16Array(keyMessage)), 'application/xml');\n if (keyMessageXml.getElementsByTagName('Challenge')[0]) {\n challenge = atob(keyMessageXml.getElementsByTagName('Challenge')[0].childNodes[0].nodeValue);\n } else {\n throw 'Cannot find <Challenge> in key message';\n }\n var headerNames = keyMessageXml.getElementsByTagName('name');\n var headerValues = keyMessageXml.getElementsByTagName('value');\n if (headerNames.length !== headerValues.length) {\n throw 'Mismatched header <name>/<value> pair in key message';\n }\n for (var i = 0; i < headerNames.length; i++) {\n xhr.setRequestHeader(headerNames[i].childNodes[0].nodeValue, headerValues[i].childNodes[0].nodeValue);\n }\n }\n break;\n */\n case KeySystems.WIDEVINE:\n // For Widevine CDMs, the challenge is the keyMessage.\n return keyMessage;\n }\n\n throw new Error(\"unsupported key-system: \" + keysListItem.mediaKeySystemDomain);\n }\n /**\n * @private\n * @param keyMessage\n * @param callback\n */\n ;\n\n _proto._requestLicense = function _requestLicense(keyMessage, callback) {\n logger[\"logger\"].log('Requesting content license for key-system');\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem) {\n logger[\"logger\"].error('Fatal error: Media is encrypted but no key-system access has been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n\n try {\n var _url = this.getLicenseServerUrl(keysListItem.mediaKeySystemDomain);\n\n var _xhr = this._createLicenseXhr(_url, keyMessage, callback);\n\n logger[\"logger\"].log(\"Sending license request to URL: \" + _url);\n\n var challenge = this._generateLicenseRequestChallenge(keysListItem, keyMessage);\n\n _xhr.send(challenge);\n } catch (e) {\n logger[\"logger\"].error(\"Failure requesting DRM license: \" + e);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n if (!this._emeEnabled) {\n return;\n }\n\n var media = data.media; // keep reference of media\n\n this._media = media;\n media.addEventListener('encrypted', this._onMediaEncrypted);\n };\n\n _proto.onMediaDetached = function onMediaDetached() {\n var media = this._media;\n var mediaKeysList = this._mediaKeysList;\n\n if (!media) {\n return;\n }\n\n media.removeEventListener('encrypted', this._onMediaEncrypted);\n this._media = null;\n this._mediaKeysList = []; // Close all sessions and remove media keys from the video element.\n\n Promise.all(mediaKeysList.map(function (mediaKeysListItem) {\n if (mediaKeysListItem.mediaKeysSession) {\n return mediaKeysListItem.mediaKeysSession.close().catch(function () {// Ignore errors when closing the sessions. Closing a session that\n // generated no key requests will throw an error.\n });\n }\n })).then(function () {\n return media.setMediaKeys(null);\n }).catch(function () {// Ignore any failures while removing media keys from the video element.\n });\n } // TODO: Use manifest types here when they are defined\n ;\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n if (!this._emeEnabled) {\n return;\n }\n\n var audioCodecs = data.levels.map(function (level) {\n return level.audioCodec;\n });\n var videoCodecs = data.levels.map(function (level) {\n return level.videoCodec;\n });\n\n this._attemptKeySystemAccess(KeySystems.WIDEVINE, audioCodecs, videoCodecs);\n };\n\n eme_controller_createClass(EMEController, [{\n key: \"requestMediaKeySystemAccess\",\n get: function get() {\n if (!this._requestMediaKeySystemAccess) {\n throw new Error('No requestMediaKeySystemAccess function configured');\n }\n\n return this._requestMediaKeySystemAccess;\n }\n }]);\n\n return EMEController;\n}(event_handler);\n\n/* harmony default export */ var eme_controller = (eme_controller_EMEController);\n// CONCATENATED MODULE: ./src/config.ts\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * HLS config\n */\n\n\n\n\n // import FetchLoader from './utils/fetch-loader';\n\n\n\n\n\n\n\n\n\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\nvar hlsDefaultConfig = _objectSpread(_objectSpread({\n autoStartLoad: true,\n // used by stream-controller\n startPosition: -1,\n // used by stream-controller\n defaultAudioCodec: void 0,\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 initialLiveManifestSize: 1,\n // used by stream-controller\n maxBufferLength: 30,\n // used by stream-controller\n maxBufferSize: 60 * 1000 * 1000,\n // used by stream-controller\n maxBufferHole: 0.5,\n // used by stream-controller\n lowBufferWatchdogPeriod: 0.5,\n // used by stream-controller\n highBufferWatchdogPeriod: 3,\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 stream-controller\n liveMaxLatencyDurationCount: Infinity,\n // used by stream-controller\n liveSyncDuration: void 0,\n // used by stream-controller\n liveMaxLatencyDuration: void 0,\n // used by stream-controller\n liveDurationInfinity: false,\n // used by buffer-controller\n liveBackBufferLength: Infinity,\n // used by buffer-controller\n maxMaxBufferLength: 600,\n // used by stream-controller\n enableWorker: true,\n // used by demuxer\n enableSoftwareAES: true,\n // used by decrypter\n manifestLoadingTimeOut: 10000,\n // used by playlist-loader\n manifestLoadingMaxRetry: 1,\n // used by playlist-loader\n manifestLoadingRetryDelay: 1000,\n // used by playlist-loader\n manifestLoadingMaxRetryTimeout: 64000,\n // used by playlist-loader\n startLevel: void 0,\n // used by level-controller\n levelLoadingTimeOut: 10000,\n // used by playlist-loader\n levelLoadingMaxRetry: 4,\n // used by playlist-loader\n levelLoadingRetryDelay: 1000,\n // used by playlist-loader\n levelLoadingMaxRetryTimeout: 64000,\n // used by playlist-loader\n fragLoadingTimeOut: 20000,\n // used by fragment-loader\n fragLoadingMaxRetry: 6,\n // used by fragment-loader\n fragLoadingRetryDelay: 1000,\n // used by fragment-loader\n fragLoadingMaxRetryTimeout: 64000,\n // used by fragment-loader\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: xhr_loader,\n // loader: FetchLoader,\n fLoader: void 0,\n // used by fragment-loader\n pLoader: void 0,\n // used by playlist-loader\n xhrSetup: void 0,\n // used by xhr-loader\n licenseXhrSetup: void 0,\n // used by eme-controller\n // fetchSetup: void 0,\n abrController: abr_controller,\n bufferController: buffer_controller,\n capLevelController: cap_level_controller,\n fpsController: fps_controller,\n stretchShortVideoTrack: false,\n // used by mp4-remuxer\n maxAudioFramesDrift: 1,\n // used by mp4-remuxer\n forceKeyFrameOnDiscontinuity: true,\n // used by ts-demuxer\n abrEwmaFastLive: 3,\n // used by abr-controller\n abrEwmaSlowLive: 9,\n // used by abr-controller\n abrEwmaFastVoD: 3,\n // used by abr-controller\n abrEwmaSlowVoD: 9,\n // used by abr-controller\n abrEwmaDefaultEstimate: 5e5,\n // 500 kbps // used by abr-controller\n abrBandWidthFactor: 0.95,\n // used by abr-controller\n abrBandWidthUpFactor: 0.7,\n // used by abr-controller\n abrMaxWithRealBitrate: false,\n // used by abr-controller\n maxStarvationDelay: 4,\n // used by abr-controller\n maxLoadingDelay: 4,\n // used by abr-controller\n minAutoBitrate: 0,\n // used by hls\n emeEnabled: false,\n // used by eme-controller\n widevineLicenseUrl: void 0,\n // used by eme-controller\n drmSystemOptions: {},\n // used by eme-controller\n requestMediaKeySystemAccessFunc: requestMediaKeySystemAccess,\n // used by eme-controller\n testBandwidth: true\n}, timelineConfig()), {}, {\n subtitleStreamController: true ? subtitle_stream_controller_SubtitleStreamController : undefined,\n subtitleTrackController: true ? subtitle_track_controller : undefined,\n timelineController: true ? timeline_controller : undefined,\n audioStreamController: true ? audio_stream_controller : undefined,\n audioTrackController: true ? audio_track_controller : undefined,\n emeController: true ? eme_controller : undefined\n});\n\nfunction timelineConfig() {\n return {\n cueHandler: cues_namespaceObject,\n // used by timeline-controller\n enableCEA708Captions: true,\n // used by timeline-controller\n enableWebVTT: true,\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// CONCATENATED MODULE: ./src/hls.ts\nfunction hls_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction hls_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { hls_ownKeys(Object(source), true).forEach(function (key) { hls_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { hls_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction hls_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction hls_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction hls_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction hls_createClass(Constructor, protoProps, staticProps) { if (protoProps) hls_defineProperties(Constructor.prototype, protoProps); if (staticProps) hls_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction hls_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @module Hls\n * @class\n * @constructor\n */\n\nvar hls_Hls = /*#__PURE__*/function (_Observer) {\n hls_inheritsLoose(Hls, _Observer);\n\n /**\n * @type {boolean}\n */\n Hls.isSupported = function isSupported() {\n return is_supported_isSupported();\n }\n /**\n * @type {HlsEvents}\n */\n ;\n\n hls_createClass(Hls, null, [{\n key: \"version\",\n\n /**\n * @type {string}\n */\n get: function get() {\n return \"0.14.16\";\n }\n }, {\n key: \"Events\",\n get: function get() {\n return events[\"default\"];\n }\n /**\n * @type {HlsErrorTypes}\n */\n\n }, {\n key: \"ErrorTypes\",\n get: function get() {\n return errors[\"ErrorTypes\"];\n }\n /**\n * @type {HlsErrorDetails}\n */\n\n }, {\n key: \"ErrorDetails\",\n get: function get() {\n return errors[\"ErrorDetails\"];\n }\n /**\n * @type {HlsConfig}\n */\n\n }, {\n key: \"DefaultConfig\",\n get: function get() {\n if (!Hls.defaultConfig) {\n return hlsDefaultConfig;\n }\n\n return Hls.defaultConfig;\n }\n /**\n * @type {HlsConfig}\n */\n ,\n set: function set(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n /**\n * Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.\n *\n * @constructs Hls\n * @param {HlsConfig} config\n */\n\n }]);\n\n function Hls(userConfig) {\n var _this;\n\n if (userConfig === void 0) {\n userConfig = {};\n }\n\n _this = _Observer.call(this) || this;\n _this.config = void 0;\n _this._autoLevelCapping = void 0;\n _this.abrController = void 0;\n _this.capLevelController = void 0;\n _this.levelController = void 0;\n _this.streamController = void 0;\n _this.networkControllers = void 0;\n _this.audioTrackController = void 0;\n _this.subtitleTrackController = void 0;\n _this.emeController = void 0;\n _this.coreComponents = void 0;\n _this.media = null;\n _this.url = null;\n var defaultConfig = Hls.DefaultConfig;\n\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 } // Shallow clone\n\n\n _this.config = hls_objectSpread(hls_objectSpread({}, defaultConfig), userConfig);\n\n var _assertThisInitialize = hls_assertThisInitialized(_this),\n config = _assertThisInitialize.config;\n\n if (config.liveMaxLatencyDurationCount !== void 0 && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== void 0 && (config.liveSyncDuration === void 0 || config.liveMaxLatencyDuration <= config.liveSyncDuration)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n Object(logger[\"enableLogs\"])(config.debug);\n _this._autoLevelCapping = -1; // core controllers and network loaders\n\n /**\n * @member {AbrController} abrController\n */\n\n var abrController = _this.abrController = new config.abrController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var bufferController = new config.bufferController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var capLevelController = _this.capLevelController = new config.capLevelController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var fpsController = new config.fpsController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var playListLoader = new playlist_loader(hls_assertThisInitialized(_this));\n var fragmentLoader = new fragment_loader(hls_assertThisInitialized(_this));\n var keyLoader = new key_loader(hls_assertThisInitialized(_this));\n var id3TrackController = new id3_track_controller(hls_assertThisInitialized(_this)); // network controllers\n\n /**\n * @member {LevelController} levelController\n */\n\n var levelController = _this.levelController = new level_controller_LevelController(hls_assertThisInitialized(_this)); // FIXME: FragmentTracker must be defined before StreamController because the order of event handling is important\n\n var fragmentTracker = new fragment_tracker_FragmentTracker(hls_assertThisInitialized(_this));\n /**\n * @member {StreamController} streamController\n */\n\n var streamController = _this.streamController = new stream_controller(hls_assertThisInitialized(_this), fragmentTracker);\n var networkControllers = [levelController, streamController]; // optional audio stream controller\n\n /**\n * @var {ICoreComponent | Controller}\n */\n\n var Controller = config.audioStreamController;\n\n if (Controller) {\n networkControllers.push(new Controller(hls_assertThisInitialized(_this), fragmentTracker));\n }\n /**\n * @member {INetworkController[]} networkControllers\n */\n\n\n _this.networkControllers = networkControllers;\n /**\n * @var {ICoreComponent[]}\n */\n\n var coreComponents = [playListLoader, fragmentLoader, keyLoader, abrController, bufferController, capLevelController, fpsController, id3TrackController, fragmentTracker]; // optional audio track and subtitle controller\n\n Controller = config.audioTrackController;\n\n if (Controller) {\n var audioTrackController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {AudioTrackController} audioTrackController\n */\n\n _this.audioTrackController = audioTrackController;\n coreComponents.push(audioTrackController);\n }\n\n Controller = config.subtitleTrackController;\n\n if (Controller) {\n var subtitleTrackController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {SubtitleTrackController} subtitleTrackController\n */\n\n _this.subtitleTrackController = subtitleTrackController;\n networkControllers.push(subtitleTrackController);\n }\n\n Controller = config.emeController;\n\n if (Controller) {\n var emeController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {EMEController} emeController\n */\n\n _this.emeController = emeController;\n coreComponents.push(emeController);\n } // optional subtitle controllers\n\n\n Controller = config.subtitleStreamController;\n\n if (Controller) {\n networkControllers.push(new Controller(hls_assertThisInitialized(_this), fragmentTracker));\n }\n\n Controller = config.timelineController;\n\n if (Controller) {\n coreComponents.push(new Controller(hls_assertThisInitialized(_this)));\n }\n /**\n * @member {ICoreComponent[]}\n */\n\n\n _this.coreComponents = coreComponents;\n return _this;\n }\n /**\n * Dispose of the instance\n */\n\n\n var _proto = Hls.prototype;\n\n _proto.destroy = function destroy() {\n logger[\"logger\"].log('destroy');\n this.trigger(events[\"default\"].DESTROYING);\n this.detachMedia();\n this.coreComponents.concat(this.networkControllers).forEach(function (component) {\n component.destroy();\n });\n this.url = null;\n this.removeAllListeners();\n this._autoLevelCapping = -1;\n }\n /**\n * Attach a media element\n * @param {HTMLMediaElement} media\n */\n ;\n\n _proto.attachMedia = function attachMedia(media) {\n logger[\"logger\"].log('attachMedia');\n this.media = media;\n this.trigger(events[\"default\"].MEDIA_ATTACHING, {\n media: media\n });\n }\n /**\n * Detach from the media\n */\n ;\n\n _proto.detachMedia = function detachMedia() {\n logger[\"logger\"].log('detachMedia');\n this.trigger(events[\"default\"].MEDIA_DETACHING);\n this.media = null;\n }\n /**\n * Set the source URL. Can be relative or absolute.\n * @param {string} url\n */\n ;\n\n _proto.loadSource = function loadSource(url) {\n url = url_toolkit[\"buildAbsoluteURL\"](window.location.href, url, {\n alwaysNormalize: true\n });\n logger[\"logger\"].log(\"loadSource:\" + url);\n this.url = url; // when attaching to a source URL, trigger a playlist load\n\n this.trigger(events[\"default\"].MANIFEST_LOADING, {\n url: url\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 {number} startPosition Set the start position to stream from\n * @default -1 None (from earliest point)\n */\n ;\n\n _proto.startLoad = function startLoad(startPosition) {\n if (startPosition === void 0) {\n startPosition = -1;\n }\n\n logger[\"logger\"].log(\"startLoad(\" + startPosition + \")\");\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n }\n /**\n * Stop loading of any stream data.\n */\n ;\n\n _proto.stopLoad = function stopLoad() {\n logger[\"logger\"].log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n }\n /**\n * Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)\n */\n ;\n\n _proto.swapAudioCodec = function swapAudioCodec() {\n logger[\"logger\"].log('swapAudioCodec');\n this.streamController.swapAudioCodec();\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 ;\n\n _proto.recoverMediaError = function recoverMediaError() {\n logger[\"logger\"].log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n\n if (media) {\n this.attachMedia(media);\n }\n }\n /**\n * Remove a loaded level from the list of levels, or a level url in from a list of redundant level urls.\n * This can be used to remove a rendition or playlist url that errors frequently from the list of levels that a user\n * or hls.js can choose from.\n *\n * @param levelIndex {number} The quality level index to of the level to remove\n * @param urlId {number} The quality level url index in the case that fallback levels are available. Defaults to 0.\n */\n ;\n\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n if (urlId === void 0) {\n urlId = 0;\n }\n\n this.levelController.removeLevel(levelIndex, urlId);\n }\n /**\n * @type {QualityLevel[]}\n */\n // todo(typescript-levelController)\n ;\n\n hls_createClass(Hls, [{\n key: \"levels\",\n get: function get() {\n return this.levelController.levels;\n }\n /**\n * Index of quality level currently played\n * @type {number}\n */\n\n }, {\n key: \"currentLevel\",\n get: function get() {\n return this.streamController.currentLevel;\n }\n /**\n * Set quality level index immediately .\n * This will flush the current buffer to replace the quality asap.\n * That means playback will interrupt at least shortly to re-buffer and re-sync eventually.\n * @param newLevel {number} -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set currentLevel:\" + newLevel);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n /**\n * Index of next quality level loaded as scheduled by stream controller.\n * @type {number}\n */\n\n }, {\n key: \"nextLevel\",\n get: function get() {\n return this.streamController.nextLevel;\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 * @type {number} -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set nextLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n /**\n * Return the quality level of the currently or last (of none is loaded currently) segment\n * @type {number}\n */\n\n }, {\n key: \"loadLevel\",\n get: function get() {\n return this.levelController.level;\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 * @type {number} newLevel -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set loadLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n }\n /**\n * get next quality level loaded\n * @type {number}\n */\n\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n return this.levelController.nextLoadLevel;\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 * @type {number} level\n */\n ,\n set: function set(level) {\n this.levelController.nextLoadLevel = level;\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 * @type {number}\n */\n\n }, {\n key: \"firstLevel\",\n get: function get() {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n }\n /**\n * Sets \"first-level\", see getter.\n * @type {number}\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set firstLevel:\" + newLevel);\n this.levelController.firstLevel = newLevel;\n }\n /**\n * Return start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n * @type {number}\n */\n\n }, {\n key: \"startLevel\",\n get: function get() {\n return this.levelController.startLevel;\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 * @type {number} newLevel\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set startLevel:\" + newLevel); // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, this.minAutoLevel);\n }\n\n this.levelController.startLevel = newLevel;\n }\n /**\n * set dynamically set capLevelToPlayerSize against (`CapLevelController`)\n *\n * @type {boolean}\n */\n\n }, {\n key: \"capLevelToPlayerSize\",\n set: function set(shouldStartCapping) {\n var newCapLevelToPlayerSize = !!shouldStartCapping;\n\n if (newCapLevelToPlayerSize !== this.config.capLevelToPlayerSize) {\n if (newCapLevelToPlayerSize) {\n this.capLevelController.startCapping(); // If capping occurs, nextLevelSwitch will happen based on size.\n } else {\n this.capLevelController.stopCapping();\n this.autoLevelCapping = -1;\n this.streamController.nextLevelSwitch(); // Now we're uncapped, get the next level asap.\n }\n\n this.config.capLevelToPlayerSize = newCapLevelToPlayerSize;\n }\n }\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n\n }, {\n key: \"autoLevelCapping\",\n get: function get() {\n return this._autoLevelCapping;\n }\n /**\n * get bandwidth estimate\n * @type {number}\n */\n ,\n\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set autoLevelCapping:\" + newLevel);\n this._autoLevelCapping = newLevel;\n }\n /**\n * True when automatic level selection enabled\n * @type {boolean}\n */\n\n }, {\n key: \"bandwidthEstimate\",\n get: function get() {\n var bwEstimator = this.abrController._bwEstimator;\n return bwEstimator ? bwEstimator.getEstimate() : NaN;\n }\n }, {\n key: \"autoLevelEnabled\",\n get: function get() {\n return this.levelController.manualLevel === -1;\n }\n /**\n * Level set manually (if any)\n * @type {number}\n */\n\n }, {\n key: \"manualLevel\",\n get: function get() {\n return this.levelController.manualLevel;\n }\n /**\n * min level selectable in auto mode according to config.minAutoBitrate\n * @type {number}\n */\n\n }, {\n key: \"minAutoLevel\",\n get: function get() {\n var levels = this.levels,\n minAutoBitrate = this.config.minAutoBitrate;\n var len = levels ? levels.length : 0;\n\n for (var i = 0; i < len; i++) {\n var levelNextBitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n\n if (levelNextBitrate > minAutoBitrate) {\n return i;\n }\n }\n\n return 0;\n }\n /**\n * max level selectable in auto mode according to autoLevelCapping\n * @type {number}\n */\n\n }, {\n key: \"maxAutoLevel\",\n get: function get() {\n var levels = this.levels,\n autoLevelCapping = this.autoLevelCapping;\n var maxAutoLevel;\n\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n } else {\n maxAutoLevel = autoLevelCapping;\n }\n\n return maxAutoLevel;\n }\n /**\n * next automatically selected quality level\n * @type {number}\n */\n\n }, {\n key: \"nextAutoLevel\",\n get: function get() {\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), this.maxAutoLevel);\n }\n /**\n * 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 succesful frag loading at forced level,\n * this value will be resetted to -1 by ABR controller.\n * @type {number}\n */\n ,\n set: function set(nextLevel) {\n this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, nextLevel);\n }\n /**\n * @type {AudioTrack[]}\n */\n // todo(typescript-audioTrackController)\n\n }, {\n key: \"audioTracks\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n }\n /**\n * index of the selected audio track (index in audio track lists)\n * @type {number}\n */\n\n }, {\n key: \"audioTrack\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTrack : -1;\n }\n /**\n * selects an audio track, based on its index in audio track lists\n * @type {number}\n */\n ,\n set: function set(audioTrackId) {\n var audioTrackController = this.audioTrackController;\n\n if (audioTrackController) {\n audioTrackController.audioTrack = audioTrackId;\n }\n }\n /**\n * @type {Seconds}\n */\n\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n return this.streamController.liveSyncPosition;\n }\n /**\n * get alternate subtitle tracks list from playlist\n * @type {SubtitleTrack[]}\n */\n // todo(typescript-subtitleTrackController)\n\n }, {\n key: \"subtitleTracks\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTracks : [];\n }\n /**\n * index of the selected subtitle track (index in subtitle track lists)\n * @type {number}\n */\n\n }, {\n key: \"subtitleTrack\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTrack : -1;\n }\n /**\n * select an subtitle track, based on its index in subtitle track lists\n * @type {number}\n */\n ,\n set: function set(subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n }\n /**\n * @type {boolean}\n */\n\n }, {\n key: \"subtitleDisplay\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n }\n /**\n * Enable/disable subtitle display rendering\n * @type {boolean}\n */\n ,\n set: function set(value) {\n var subtitleTrackController = this.subtitleTrackController;\n\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n }\n }]);\n\n return Hls;\n}(Observer);\n\nhls_Hls.defaultConfig = void 0;\n\n\n/***/ }),\n\n/***/ \"./src/polyfills/number.js\":\n/*!*********************************!*\\\n !*** ./src/polyfills/number.js ***!\n \\*********************************/\n/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isFiniteNumber\", function() { return isFiniteNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MAX_SAFE_INTEGER\", function() { return MAX_SAFE_INTEGER; });\nvar isFiniteNumber = Number.isFinite || function (value) {\n return typeof value === 'number' && isFinite(value);\n};\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\n/***/ }),\n\n/***/ \"./src/utils/get-self-scope.js\":\n/*!*************************************!*\\\n !*** ./src/utils/get-self-scope.js ***!\n \\*************************************/\n/*! exports provided: getSelfScope */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getSelfScope\", function() { return getSelfScope; });\nfunction getSelfScope() {\n // see https://stackoverflow.com/a/11237259/589493\n if (typeof window === 'undefined') {\n /* eslint-disable-next-line no-undef */\n return self;\n } else {\n return window;\n }\n}\n\n/***/ }),\n\n/***/ \"./src/utils/logger.js\":\n/*!*****************************!*\\\n !*** ./src/utils/logger.js ***!\n \\*****************************/\n/*! exports provided: enableLogs, logger */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"enableLogs\", function() { return enableLogs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logger\", function() { return logger; });\n/* harmony import */ var _get_self_scope__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get-self-scope */ \"./src/utils/get-self-scope.js\");\n\n\nfunction noop() {}\n\nvar fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\nvar exportedLogger = fakeLogger; // 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\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\n\nvar global = Object(_get_self_scope__WEBPACK_IMPORTED_MODULE_0__[\"getSelfScope\"])();\n\nfunction consolePrintFn(type) {\n var func = global.console[type];\n\n if (func) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n\n func.apply(global.console, args);\n };\n }\n\n return noop;\n}\n\nfunction exportLoggerFunctions(debugConfig) {\n for (var _len2 = arguments.length, functions = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n functions[_key2 - 1] = arguments[_key2];\n }\n\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\n\nvar enableLogs = function enableLogs(debugConfig) {\n // check that console is available\n if (global.console && debugConfig === true || typeof debugConfig === 'object') {\n exportLoggerFunctions(debugConfig, // Remove out from list here to hard-disable a log-level\n // 'trace',\n 'debug', 'log', 'info', 'warn', 'error'); // Some browsers don't allow to use bind on console object anyway\n // fallback to default if needed\n\n try {\n exportedLogger.log();\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n } else {\n exportedLogger = fakeLogger;\n }\n};\nvar logger = exportedLogger;\n\n/***/ })\n\n/******/ })[\"default\"];\n});\n//# sourceMappingURL=hls.js.map\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Hls = __webpack_require__(0);\n\nif (!window.Hls) {\n window.Hls = Hls; // expose hls.js constructor\n}\n\n/**\n * hls.js source handler\n * @param source\n * @param tech\n * @constructor\n */\nfunction Html5HlsJS(source, tech) {\n var options = tech.options_;\n var el = tech.el();\n var duration = null;\n var hls = this.hls = new Hls(options.hlsjsConfig);\n\n /**\n * creates an error handler function\n * @returns {Function}\n */\n function errorHandlerFactory() {\n var _recoverDecodingErrorDate = null;\n var _recoverAudioCodecErrorDate = null;\n\n return function() {\n var now = Date.now();\n\n if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) {\n _recoverDecodingErrorDate = now;\n hls.recoverMediaError();\n }\n else if (!_recoverAudioCodecErrorDate || (now - _recoverAudioCodecErrorDate) > 2000) {\n _recoverAudioCodecErrorDate = now;\n hls.swapAudioCodec();\n hls.recoverMediaError();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n };\n }\n\n // create separate error handlers for hlsjs and the video tag\n var hlsjsErrorHandler = errorHandlerFactory();\n var videoTagErrorHandler = errorHandlerFactory();\n\n // listen to error events coming from the video tag\n el.addEventListener('error', function(e) {\n var mediaError = e.currentTarget.error;\n\n if (mediaError.code === mediaError.MEDIA_ERR_DECODE) {\n videoTagErrorHandler();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n });\n\n /**\n * Destroys the Hls instance\n */\n this.dispose = function() {\n hls.destroy();\n };\n\n /**\n * returns the duration of the stream, or Infinity if live video\n * @returns {Infinity|number}\n */\n this.duration = function() {\n return duration || el.duration || 0;\n };\n\n // update live status on level load\n hls.on(Hls.Events.LEVEL_LOADED, function(event, data) {\n duration = data.details.live ? Infinity : data.details.totalduration;\n });\n\n // try to recover on fatal errors\n hls.on(Hls.Events.ERROR, function(event, data) {\n if (data.fatal) {\n switch (data.type) {\n case Hls.ErrorTypes.NETWORK_ERROR:\n hls.startLoad();\n break;\n case Hls.ErrorTypes.MEDIA_ERROR:\n hlsjsErrorHandler();\n break;\n default:\n console.error('Error loading media: File could not be played');\n break;\n }\n }\n });\n\n Object.keys(Hls.Events).forEach(function(key) {\n var eventName = Hls.Events[key];\n hls.on(eventName, function(event, data) {\n tech.trigger(eventName, data);\n });\n });\n\n // Intercept native TextTrack calls and route to video.js directly only\n // if native text tracks are not supported on this browser.\n if (!tech.featuresNativeTextTracks) {\n Object.defineProperty(el, 'textTracks', {\n value: tech.textTracks,\n writable: false\n });\n el.addTextTrack = function() {\n return tech.addTextTrack.apply(tech, arguments);\n };\n }\n\n // attach hlsjs to videotag\n hls.attachMedia(el);\n hls.loadSource(source.src);\n}\n\nvar hlsTypeRE = /^application\\/(x-mpegURL|vnd\\.apple\\.mpegURL)$/i;\nvar hlsExtRE = /\\.m3u8/i;\n\nvar HlsSourceHandler = {\n canHandleSource: function(source) {\n if (source.skipContribHlsJs) {\n return '';\n }\n else if (hlsTypeRE.test(source.type)) {\n return 'probably';\n }\n else if (hlsExtRE.test(source.src)) {\n return 'maybe';\n }\n else {\n return '';\n }\n },\n handleSource: function(source, tech) {\n return new Html5HlsJS(source, tech);\n },\n canPlayType: function(type) {\n if (hlsTypeRE.test(type)) {\n return 'probably';\n }\n\n return '';\n }\n};\n\nif (Hls.isSupported()) {\n var videojs = __webpack_require__(1); // resolved UMD-wise through webpack\n\n // support es6 style import\n videojs = videojs && videojs.default || videojs;\n\n if (videojs) {\n var html5Tech = videojs.getTech && videojs.getTech('Html5'); // videojs6 (partially on videojs5 too)\n html5Tech = html5Tech || (videojs.getComponent && videojs.getComponent('Html5')); // videojs5\n\n if (html5Tech) {\n html5Tech.registerSourceHandler(HlsSourceHandler, 0);\n }\n }\n else {\n console.warn('videojs-contrib-hls.js: Couldn\\'t find find window.videojs nor require(\\'video.js\\')');\n }\n}\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// videojs-contrib-hlsjs.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 76a8b753eae8493d1b23","typeof window !== \"undefined\" &&\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Hls\"] = factory();\n\telse\n\t\troot[\"Hls\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./src/hls.ts\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/eventemitter3/index.js\":\n/*!*********************************************!*\\\n !*** ./node_modules/eventemitter3/index.js ***!\n \\*********************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif (true) {\n module.exports = EventEmitter;\n}\n\n\n/***/ }),\n\n/***/ \"./node_modules/url-toolkit/src/url-toolkit.js\":\n/*!*****************************************************!*\\\n !*** ./node_modules/url-toolkit/src/url-toolkit.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\n// see https://tools.ietf.org/html/rfc1808\n\n(function (root) {\n var URL_REGEX = /^((?:[a-zA-Z0-9+\\-.]+:)?)(\\/\\/[^\\/?#]*)?((?:[^\\/?#]*\\/)*[^;?#]*)?(;[^?#]*)?(\\?[^#]*)?(#.*)?$/;\n var FIRST_SEGMENT_REGEX = /^([^\\/?#]*)(.*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n\n var URLToolkit = {\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(\n basePartsForNormalise.path\n );\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment,\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's <net_loc> is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the <net_loc>\n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's <params> is non-empty, we skip to\n // step 7; otherwise, it inherits the <params> of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's <query> is non-empty, we skip to\n // step 7; otherwise, it inherits the <query> of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath =\n baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) +\n relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize\n ? URLToolkit.normalizePath(relativeParts.path)\n : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function (url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || '',\n };\n },\n normalizePath: function (path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"<segment>/../\", where <segment> is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"<segment>/..\", where <segment> is a\n // complete path segment not equal to \"..\", that\n // \"<segment>/..\" is removed.\n while (\n path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length\n ) {}\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function (parts) {\n return (\n parts.scheme +\n parts.netLoc +\n parts.path +\n parts.params +\n parts.query +\n parts.fragment\n );\n },\n };\n\n if (true)\n module.exports = URLToolkit;\n else {}\n})(this);\n\n\n/***/ }),\n\n/***/ \"./node_modules/webworkify-webpack/index.js\":\n/*!**************************************************!*\\\n !*** ./node_modules/webworkify-webpack/index.js ***!\n \\**************************************************/\n/*! no static exports found */\n/*! ModuleConcatenation bailout: Module is not an ECMAScript module */\n/***/ (function(module, exports, __webpack_require__) {\n\nfunction webpackBootstrapFunc (modules) {\n/******/ // The module cache\n/******/ var installedModules = {};\n\n/******/ // The require function\n/******/ function __webpack_require__(moduleId) {\n\n/******/ // Check if module is in cache\n/******/ if(installedModules[moduleId])\n/******/ return installedModules[moduleId].exports;\n\n/******/ // Create a new module (and put it into the cache)\n/******/ var module = installedModules[moduleId] = {\n/******/ i: moduleId,\n/******/ l: false,\n/******/ exports: {}\n/******/ };\n\n/******/ // Execute the module function\n/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ // Flag the module as loaded\n/******/ module.l = true;\n\n/******/ // Return the exports of the module\n/******/ return module.exports;\n/******/ }\n\n/******/ // expose the modules object (__webpack_modules__)\n/******/ __webpack_require__.m = modules;\n\n/******/ // expose the module cache\n/******/ __webpack_require__.c = installedModules;\n\n/******/ // identity function for calling harmony imports with the correct context\n/******/ __webpack_require__.i = function(value) { return value; };\n\n/******/ // define getter function for harmony exports\n/******/ __webpack_require__.d = function(exports, name, getter) {\n/******/ if(!__webpack_require__.o(exports, name)) {\n/******/ Object.defineProperty(exports, name, {\n/******/ configurable: false,\n/******/ enumerable: true,\n/******/ get: getter\n/******/ });\n/******/ }\n/******/ };\n\n/******/ // define __esModule on exports\n/******/ __webpack_require__.r = function(exports) {\n/******/ Object.defineProperty(exports, '__esModule', { value: true });\n/******/ };\n\n/******/ // getDefaultExport function for compatibility with non-harmony modules\n/******/ __webpack_require__.n = function(module) {\n/******/ var getter = module && module.__esModule ?\n/******/ function getDefault() { return module['default']; } :\n/******/ function getModuleExports() { return module; };\n/******/ __webpack_require__.d(getter, 'a', getter);\n/******/ return getter;\n/******/ };\n\n/******/ // Object.prototype.hasOwnProperty.call\n/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n/******/ // __webpack_public_path__\n/******/ __webpack_require__.p = \"/\";\n\n/******/ // on error function for async loading\n/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE)\n return f.default || f // try to call default if defined to also support babel esmodule exports\n}\n\nvar moduleNameReqExp = '[\\\\.|\\\\-|\\\\+|\\\\w|\\/|@]+'\nvar dependencyRegExp = '\\\\(\\\\s*(\\/\\\\*.*?\\\\*\\/)?\\\\s*.*?(' + moduleNameReqExp + ').*?\\\\)' // additional chars when output.pathinfo is true\n\n// http://stackoverflow.com/a/2593661/130442\nfunction quoteRegExp (str) {\n return (str + '').replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&')\n}\n\nfunction isNumeric(n) {\n return !isNaN(1 * n); // 1 * n converts integers, integers as string (\"123\"), 1e3 and \"1e3\" to integers and strings to NaN\n}\n\nfunction getModuleDependencies (sources, module, queueName) {\n var retval = {}\n retval[queueName] = []\n\n var fnString = module.toString()\n var wrapperSignature = fnString.match(/^function\\s?\\w*\\(\\w+,\\s*\\w+,\\s*(\\w+)\\)/)\n if (!wrapperSignature) return retval\n var webpackRequireName = wrapperSignature[1]\n\n // main bundle deps\n var re = new RegExp('(\\\\\\\\n|\\\\W)' + quoteRegExp(webpackRequireName) + dependencyRegExp, 'g')\n var match\n while ((match = re.exec(fnString))) {\n if (match[3] === 'dll-reference') continue\n retval[queueName].push(match[3])\n }\n\n // dll deps\n re = new RegExp('\\\\(' + quoteRegExp(webpackRequireName) + '\\\\(\"(dll-reference\\\\s(' + moduleNameReqExp + '))\"\\\\)\\\\)' + dependencyRegExp, 'g')\n while ((match = re.exec(fnString))) {\n if (!sources[match[2]]) {\n retval[queueName].push(match[1])\n sources[match[2]] = __webpack_require__(match[1]).m\n }\n retval[match[2]] = retval[match[2]] || []\n retval[match[2]].push(match[4])\n }\n\n // convert 1e3 back to 1000 - this can be important after uglify-js converted 1000 to 1e3\n var keys = Object.keys(retval);\n for (var i = 0; i < keys.length; i++) {\n for (var j = 0; j < retval[keys[i]].length; j++) {\n if (isNumeric(retval[keys[i]][j])) {\n retval[keys[i]][j] = 1 * retval[keys[i]][j];\n }\n }\n }\n\n return retval\n}\n\nfunction hasValuesInQueues (queues) {\n var keys = Object.keys(queues)\n return keys.reduce(function (hasValues, key) {\n return hasValues || queues[key].length > 0\n }, false)\n}\n\nfunction getRequiredModules (sources, moduleId) {\n var modulesQueue = {\n main: [moduleId]\n }\n var requiredModules = {\n main: []\n }\n var seenModules = {\n main: {}\n }\n\n while (hasValuesInQueues(modulesQueue)) {\n var queues = Object.keys(modulesQueue)\n for (var i = 0; i < queues.length; i++) {\n var queueName = queues[i]\n var queue = modulesQueue[queueName]\n var moduleToCheck = queue.pop()\n seenModules[queueName] = seenModules[queueName] || {}\n if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck]) continue\n seenModules[queueName][moduleToCheck] = true\n requiredModules[queueName] = requiredModules[queueName] || []\n requiredModules[queueName].push(moduleToCheck)\n var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName)\n var newModulesKeys = Object.keys(newModules)\n for (var j = 0; j < newModulesKeys.length; j++) {\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || []\n modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]])\n }\n }\n }\n\n return requiredModules\n}\n\nmodule.exports = function (moduleId, options) {\n options = options || {}\n var sources = {\n main: __webpack_require__.m\n }\n\n var requiredModules = options.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId)\n\n var src = ''\n\n Object.keys(requiredModules).filter(function (m) { return m !== 'main' }).forEach(function (module) {\n var entryModule = 0\n while (requiredModules[module][entryModule]) {\n entryModule++\n }\n requiredModules[module].push(entryModule)\n sources[module][entryModule] = '(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })'\n src = src + 'var ' + module + ' = (' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(entryModule)) + ')({' + requiredModules[module].map(function (id) { return '' + JSON.stringify(id) + ': ' + sources[module][id].toString() }).join(',') + '});\\n'\n })\n\n src = src + 'new ((' + webpackBootstrapFunc.toString().replace('ENTRY_MODULE', JSON.stringify(moduleId)) + ')({' + requiredModules.main.map(function (id) { return '' + JSON.stringify(id) + ': ' + sources.main[id].toString() }).join(',') + '}))(self);'\n\n var blob = new window.Blob([src], { type: 'text/javascript' })\n if (options.bare) { return blob }\n\n var URL = window.URL || window.webkitURL || window.mozURL || window.msURL\n\n var workerUrl = URL.createObjectURL(blob)\n var worker = new window.Worker(workerUrl)\n worker.objectURL = workerUrl\n\n return worker\n}\n\n\n/***/ }),\n\n/***/ \"./src/crypt/decrypter.js\":\n/*!********************************************!*\\\n !*** ./src/crypt/decrypter.js + 3 modules ***!\n \\********************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// CONCATENATED MODULE: ./src/crypt/aes-crypto.js\nvar AESCrypto = /*#__PURE__*/function () {\n function AESCrypto(subtle, iv) {\n this.subtle = subtle;\n this.aesIV = iv;\n }\n\n var _proto = AESCrypto.prototype;\n\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\n return AESCrypto;\n}();\n\n\n// CONCATENATED MODULE: ./src/crypt/fast-aes-key.js\nvar FastAESKey = /*#__PURE__*/function () {\n function FastAESKey(subtle, key) {\n this.subtle = subtle;\n this.key = key;\n }\n\n var _proto = FastAESKey.prototype;\n\n _proto.expandKey = function expandKey() {\n return this.subtle.importKey('raw', this.key, {\n name: 'AES-CBC'\n }, false, ['encrypt', 'decrypt']);\n };\n\n return FastAESKey;\n}();\n\n/* harmony default export */ var fast_aes_key = (FastAESKey);\n// CONCATENATED MODULE: ./src/crypt/aes-decryptor.js\n// PKCS7\nfunction removePadding(buffer) {\n var outputBytes = buffer.byteLength;\n var paddingBytes = outputBytes && new DataView(buffer).getUint8(outputBytes - 1);\n\n if (paddingBytes) {\n return buffer.slice(0, outputBytes - paddingBytes);\n } else {\n return buffer;\n }\n}\n\nvar AESDecryptor = /*#__PURE__*/function () {\n function AESDecryptor() {\n // Static after running initTable\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); // Changes during runtime\n\n this.key = new Uint32Array(0);\n this.initTable();\n } // Using view.getUint32() also swaps the byte order.\n\n\n var _proto = AESDecryptor.prototype;\n\n _proto.uint8ArrayToUint32Array_ = function uint8ArrayToUint32Array_(arrayBuffer) {\n var view = new DataView(arrayBuffer);\n var newArray = new Uint32Array(4);\n\n for (var i = 0; i < 4; i++) {\n newArray[i] = view.getUint32(i * 4);\n }\n\n return newArray;\n };\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\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\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; // Compute multiplication\n\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4]; // Compute sub/invSub bytes, mix columns tables\n\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; // Compute inv sub bytes, inv mix columns tables\n\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; // Compute next counter\n\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\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\n while (offset < key.length && sameKey) {\n sameKey = key[offset] === this.key[offset];\n offset++;\n }\n\n if (sameKey) {\n return;\n }\n\n this.key = key;\n var keySize = this.keySize = key.length;\n\n if (keySize !== 4 && keySize !== 6 && keySize !== 8) {\n throw new Error('Invalid aes key size=' + keySize);\n }\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\n for (ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n prev = keySchedule[ksRow] = key[ksRow];\n continue;\n }\n\n t = prev;\n\n if (ksRow % keySize === 0) {\n // Rot word\n t = t << 8 | t >>> 24; // Sub word\n\n t = sbox[t >>> 24] << 24 | sbox[t >>> 16 & 0xff] << 16 | sbox[t >>> 8 & 0xff] << 8 | sbox[t & 0xff]; // Mix Rcon\n\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\n keySchedule[ksRow] = prev = (keySchedule[ksRow - keySize] ^ t) >>> 0;\n }\n\n for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n ksRow = ksRows - invKsRow;\n\n if (invKsRow & 3) {\n t = keySchedule[ksRow];\n } else {\n t = keySchedule[ksRow - 4];\n }\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\n invKeySchedule[invKsRow] = invKeySchedule[invKsRow] >>> 0;\n }\n } // Adding this as a method greatly improves performance.\n ;\n\n _proto.networkToHostOrderSwap = function networkToHostOrderSwap(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n\n _proto.decrypt = function decrypt(inputArrayBuffer, offset, aesIV, removePKCS7Padding) {\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\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; // Iterate through the rounds of decryption\n\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]; // Update state\n\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n ksRow = ksRow + 4;\n } // Shift rows, sub bytes, add round key\n\n\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 ksRow = ksRow + 3; // Write\n\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); // reset initVector to last 4 unsigned int\n\n initVector0 = inputWords0;\n initVector1 = inputWords1;\n initVector2 = inputWords2;\n initVector3 = inputWords3;\n offset = offset + 4;\n }\n\n return removePKCS7Padding ? removePadding(outputInt32.buffer) : outputInt32.buffer;\n };\n\n _proto.destroy = function destroy() {\n this.key = undefined;\n this.keySize = undefined;\n this.ksRows = undefined;\n this.sBox = undefined;\n this.invSBox = undefined;\n this.subMix = undefined;\n this.invSubMix = undefined;\n this.keySchedule = undefined;\n this.invKeySchedule = undefined;\n this.rcon = undefined;\n };\n\n return AESDecryptor;\n}();\n\n/* harmony default export */ var aes_decryptor = (AESDecryptor);\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/crypt/decrypter.js\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar decrypter_Decrypter = /*#__PURE__*/function () {\n function Decrypter(observer, config, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$removePKCS7Paddi = _ref.removePKCS7Padding,\n removePKCS7Padding = _ref$removePKCS7Paddi === void 0 ? true : _ref$removePKCS7Paddi;\n\n this.logEnabled = true;\n this.observer = observer;\n this.config = config;\n this.removePKCS7Padding = removePKCS7Padding; // built in decryptor expects PKCS7 padding\n\n if (removePKCS7Padding) {\n try {\n var browserCrypto = global.crypto;\n\n if (browserCrypto) {\n this.subtle = browserCrypto.subtle || browserCrypto.webkitSubtle;\n }\n } catch (e) {}\n }\n\n this.disableWebCrypto = !this.subtle;\n }\n\n var _proto = Decrypter.prototype;\n\n _proto.isSync = function isSync() {\n return this.disableWebCrypto && this.config.enableSoftwareAES;\n };\n\n _proto.decrypt = function decrypt(data, key, iv, callback) {\n var _this = this;\n\n if (this.disableWebCrypto && this.config.enableSoftwareAES) {\n if (this.logEnabled) {\n logger[\"logger\"].log('JS AES decrypt');\n this.logEnabled = false;\n }\n\n var decryptor = this.decryptor;\n\n if (!decryptor) {\n this.decryptor = decryptor = new aes_decryptor();\n }\n\n decryptor.expandKey(key);\n callback(decryptor.decrypt(data, 0, iv, this.removePKCS7Padding));\n } else {\n if (this.logEnabled) {\n logger[\"logger\"].log('WebCrypto AES decrypt');\n this.logEnabled = false;\n }\n\n var subtle = this.subtle;\n\n if (this.key !== key) {\n this.key = key;\n this.fastAesKey = new fast_aes_key(subtle, key);\n }\n\n this.fastAesKey.expandKey().then(function (aesKey) {\n // decrypt using web crypto\n var crypto = new AESCrypto(subtle, iv);\n crypto.decrypt(data, aesKey).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n }).then(function (result) {\n callback(result);\n });\n }).catch(function (err) {\n _this.onWebCryptoError(err, data, key, iv, callback);\n });\n }\n };\n\n _proto.onWebCryptoError = function onWebCryptoError(err, data, key, iv, callback) {\n if (this.config.enableSoftwareAES) {\n logger[\"logger\"].log('WebCrypto Error, disable WebCrypto API');\n this.disableWebCrypto = true;\n this.logEnabled = true;\n this.decrypt(data, key, iv, callback);\n } else {\n logger[\"logger\"].error(\"decrypting error : \" + err.message);\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_DECRYPT_ERROR,\n fatal: true,\n reason: err.message\n });\n }\n };\n\n _proto.destroy = function destroy() {\n var decryptor = this.decryptor;\n\n if (decryptor) {\n decryptor.destroy();\n this.decryptor = undefined;\n }\n };\n\n return Decrypter;\n}();\n\n/* harmony default export */ var decrypter = __webpack_exports__[\"default\"] = (decrypter_Decrypter);\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-inline.js\":\n/*!**************************************************!*\\\n !*** ./src/demux/demuxer-inline.js + 12 modules ***!\n \\**************************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/hls.ts */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/hls.ts */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar crypt_decrypter = __webpack_require__(\"./src/crypt/decrypter.js\");\n\n// EXTERNAL MODULE: ./src/polyfills/number.js\nvar number = __webpack_require__(\"./src/polyfills/number.js\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/demux/adts.js\n/**\n * ADTS parser helper\n * @link https://wiki.multimedia.cx/index.php?title=ADTS\n */\n\n\n\n\nfunction getAudioConfig(observer, data, offset, audioCodec) {\n var adtsObjectType,\n // :int\n adtsSampleingIndex,\n // :int\n adtsExtensionSampleingIndex,\n // :int\n adtsChanelConfig,\n // :int\n config,\n userAgent = navigator.userAgent.toLowerCase(),\n manifestCodec = audioCodec,\n adtsSampleingRates = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350]; // byte 2\n\n adtsObjectType = ((data[offset + 2] & 0xC0) >>> 6) + 1;\n adtsSampleingIndex = (data[offset + 2] & 0x3C) >>> 2;\n\n if (adtsSampleingIndex > adtsSampleingRates.length - 1) {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: true,\n reason: \"invalid ADTS sampling index:\" + adtsSampleingIndex\n });\n return;\n }\n\n adtsChanelConfig = (data[offset + 2] & 0x01) << 2; // byte 3\n\n adtsChanelConfig |= (data[offset + 3] & 0xC0) >>> 6;\n logger[\"logger\"].log(\"manifest codec:\" + audioCodec + \",ADTS data:type:\" + adtsObjectType + \",sampleingIndex:\" + adtsSampleingIndex + \"[\" + adtsSampleingRates[adtsSampleingIndex] + \"Hz],channelConfig:\" + adtsChanelConfig); // firefox: freq less than 24kHz = AAC SBR (HE-AAC)\n\n if (/firefox/i.test(userAgent)) {\n if (adtsSampleingIndex >= 6) {\n adtsObjectType = 5;\n config = new Array(4); // 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\n adtsExtensionSampleingIndex = adtsSampleingIndex - 3;\n } else {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\n } // Android : always use AAC\n\n } else if (userAgent.indexOf('android') !== -1) {\n adtsObjectType = 2;\n config = new Array(2);\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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); // if (manifest codec is HE-AAC or HE-AACv2) OR (manifest codec not specified AND frequency less than 24kHz)\n\n if (audioCodec && (audioCodec.indexOf('mp4a.40.29') !== -1 || audioCodec.indexOf('mp4a.40.5') !== -1) || !audioCodec && adtsSampleingIndex >= 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 adtsExtensionSampleingIndex = adtsSampleingIndex - 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 && (adtsSampleingIndex >= 6 && adtsChanelConfig === 1 || /vivaldi/i.test(userAgent)) || !audioCodec && adtsChanelConfig === 1) {\n adtsObjectType = 2;\n config = new Array(2);\n }\n\n adtsExtensionSampleingIndex = adtsSampleingIndex;\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\n\n config[0] = adtsObjectType << 3; // samplingFrequencyIndex\n\n config[0] |= (adtsSampleingIndex & 0x0E) >> 1;\n config[1] |= (adtsSampleingIndex & 0x01) << 7; // channelConfiguration\n\n config[1] |= adtsChanelConfig << 3;\n\n if (adtsObjectType === 5) {\n // adtsExtensionSampleingIndex\n config[1] |= (adtsExtensionSampleingIndex & 0x0E) >> 1;\n config[2] = (adtsExtensionSampleingIndex & 0x01) << 7; // 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\n config[2] |= 2 << 2;\n config[3] = 0;\n }\n\n return {\n config: config,\n samplerate: adtsSampleingRates[adtsSampleingIndex],\n channelCount: adtsChanelConfig,\n codec: 'mp4a.40.' + adtsObjectType,\n manifestCodec: manifestCodec\n };\n}\nfunction isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xf6) === 0xf0;\n}\nfunction getHeaderLength(data, offset) {\n return data[offset + 1] & 0x01 ? 7 : 9;\n}\nfunction getFullFrameLength(data, offset) {\n return (data[offset + 3] & 0x03) << 11 | data[offset + 4] << 3 | (data[offset + 5] & 0xE0) >>> 5;\n}\nfunction isHeader(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 if (offset + 1 < data.length && isHeaderPattern(data, offset)) {\n return true;\n }\n\n return false;\n}\nfunction adts_probe(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(data, offset)) {\n // ADTS header Length\n var headerLength = getHeaderLength(data, offset);\n\n if (offset + headerLength >= data.length) {\n return false;\n } // ADTS frame Length\n\n\n var frameLength = getFullFrameLength(data, offset);\n\n if (frameLength <= headerLength) {\n return false;\n }\n\n var newOffset = offset + frameLength;\n\n if (newOffset === data.length || newOffset + 1 < data.length && isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n\n return false;\n}\nfunction initTrackConfig(track, observer, data, offset, audioCodec) {\n if (!track.samplerate) {\n var config = getAudioConfig(observer, data, offset, audioCodec);\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[\"logger\"].log(\"parsed codec:\" + track.codec + \",rate:\" + config.samplerate + \",nb channel:\" + config.channelCount);\n }\n}\nfunction getFrameDuration(samplerate) {\n return 1024 * 90000 / samplerate;\n}\nfunction parseFrameHeader(data, offset, pts, frameIndex, frameDuration) {\n var headerLength, frameLength, stamp;\n var length = data.length; // The protection skip bit tells us if we have 2 bytes of CRC data at the end of the ADTS header\n\n headerLength = getHeaderLength(data, offset); // retrieve frame size\n\n frameLength = getFullFrameLength(data, offset);\n frameLength -= headerLength;\n\n if (frameLength > 0 && offset + headerLength + frameLength <= length) {\n stamp = pts + frameIndex * frameDuration; // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n\n return {\n headerLength: headerLength,\n frameLength: frameLength,\n stamp: stamp\n };\n }\n\n return undefined;\n}\nfunction appendFrame(track, data, offset, pts, frameIndex) {\n var frameDuration = getFrameDuration(track.samplerate);\n var header = parseFrameHeader(data, offset, pts, frameIndex, frameDuration);\n\n if (header) {\n var stamp = header.stamp;\n var headerLength = header.headerLength;\n var frameLength = header.frameLength; // logger.log(`AAC frame, offset/length/total/pts:${offset+headerLength}/${frameLength}/${data.byteLength}/${(stamp/90).toFixed(0)}`);\n\n var aacSample = {\n unit: data.subarray(offset + headerLength, offset + headerLength + frameLength),\n pts: stamp,\n dts: stamp\n };\n track.samples.push(aacSample);\n return {\n sample: aacSample,\n length: frameLength + headerLength\n };\n }\n\n return undefined;\n}\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(\"./src/demux/id3.js\");\n\n// CONCATENATED MODULE: ./src/demux/aacdemuxer.js\n\n\n/**\n * AAC demuxer\n */\n\n\n\n\nvar aacdemuxer_AACDemuxer = /*#__PURE__*/function () {\n function AACDemuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n var _proto = AACDemuxer.prototype;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = {\n container: 'audio/adts',\n type: 'audio',\n id: 0,\n sequenceNumber: 0,\n isAAC: true,\n samples: [],\n len: 0,\n manifestCodec: audioCodec,\n duration: duration,\n inputTimeScale: 90000\n };\n };\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n AACDemuxer.probe = function probe(data) {\n if (!data) {\n return false;\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\n\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var offset = id3Data.length;\n\n for (var length = data.length; offset < length; offset++) {\n if (adts_probe(data, offset)) {\n logger[\"logger\"].log('ADTS sync word found !');\n return true;\n }\n }\n\n return false;\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var track = this._audioTrack;\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var timestamp = id3[\"default\"].getTimeStamp(id3Data);\n var pts = Object(number[\"isFiniteNumber\"])(timestamp) ? timestamp * 90 : timeOffset * 90000;\n var frameIndex = 0;\n var stamp = pts;\n var length = data.length;\n var offset = id3Data.length;\n var id3Samples = [{\n pts: stamp,\n dts: stamp,\n data: id3Data\n }];\n\n while (offset < length - 1) {\n if (isHeader(data, offset) && offset + 5 < length) {\n initTrackConfig(track, this.observer, data, offset, track.manifestCodec);\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n logger[\"logger\"].log('Unable to parse AAC frame');\n break;\n }\n } else if (id3[\"default\"].isHeader(data, offset)) {\n id3Data = id3[\"default\"].getID3Data(data, offset);\n id3Samples.push({\n pts: stamp,\n dts: stamp,\n data: id3Data\n });\n offset += id3Data.length;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, {\n samples: []\n }, {\n samples: id3Samples,\n inputTimeScale: 90000\n }, {\n samples: []\n }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n _proto.destroy = function destroy() {};\n\n return AACDemuxer;\n}();\n\n/* harmony default export */ var aacdemuxer = (aacdemuxer_AACDemuxer);\n// EXTERNAL MODULE: ./src/demux/mp4demuxer.js\nvar mp4demuxer = __webpack_require__(\"./src/demux/mp4demuxer.js\");\n\n// CONCATENATED MODULE: ./src/demux/mpegaudio.js\n/**\n * MPEG parser helper\n */\nvar MpegAudio = {\n 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 SamplingRateMap: [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000],\n SamplesCoefficients: [// MPEG 2.5\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ], // Reserved\n [0, // Reserved\n 0, // Layer3\n 0, // Layer2\n 0 // Layer1\n ], // MPEG 2\n [0, // Reserved\n 72, // Layer3\n 144, // Layer2\n 12 // Layer1\n ], // MPEG 1\n [0, // Reserved\n 144, // Layer3\n 144, // Layer2\n 12 // Layer1\n ]],\n BytesInSlot: [0, // Reserved\n 1, // Layer3\n 1, // Layer2\n 4 // Layer1\n ],\n appendFrame: 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 undefined;\n }\n\n var header = this.parseHeader(data, offset);\n\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 };\n }\n\n return undefined;\n },\n parseHeader: function parseHeader(data, offset) {\n var headerB = data[offset + 1] >> 3 & 3;\n var headerC = data[offset + 1] >> 1 & 3;\n var headerE = data[offset + 2] >> 4 & 15;\n var headerF = data[offset + 2] >> 2 & 3;\n var headerG = data[offset + 2] >> 1 & 1;\n\n if (headerB !== 1 && headerE !== 0 && headerE !== 15 && headerF !== 3) {\n var columnInBitrates = headerB === 3 ? 3 - headerC : headerC === 3 ? 3 : 4;\n var bitRate = MpegAudio.BitratesMap[columnInBitrates * 14 + headerE - 1] * 1000;\n var columnInSampleRates = headerB === 3 ? 0 : headerB === 2 ? 1 : 2;\n var sampleRate = MpegAudio.SamplingRateMap[columnInSampleRates * 3 + headerF];\n var channelCount = data[offset + 3] >> 6 === 3 ? 1 : 2; // If bits of channel mode are `11` then it is a single channel (Mono)\n\n var sampleCoefficient = MpegAudio.SamplesCoefficients[headerB][headerC];\n var bytesInSlot = MpegAudio.BytesInSlot[headerC];\n var samplesPerFrame = sampleCoefficient * 8 * bytesInSlot;\n var frameLength = parseInt(sampleCoefficient * bitRate / sampleRate + headerG, 10) * bytesInSlot;\n return {\n sampleRate: sampleRate,\n channelCount: channelCount,\n frameLength: frameLength,\n samplesPerFrame: samplesPerFrame\n };\n }\n\n return undefined;\n },\n isHeaderPattern: function isHeaderPattern(data, offset) {\n return data[offset] === 0xff && (data[offset + 1] & 0xe0) === 0xe0 && (data[offset + 1] & 0x06) !== 0x00;\n },\n isHeader: 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 if (offset + 1 < data.length && this.isHeaderPattern(data, offset)) {\n return true;\n }\n\n return false;\n },\n probe: 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 && this.isHeaderPattern(data, offset)) {\n // MPEG header Length\n var headerLength = 4; // MPEG frame Length\n\n var header = this.parseHeader(data, offset);\n var frameLength = headerLength;\n\n if (header && header.frameLength) {\n frameLength = header.frameLength;\n }\n\n var newOffset = offset + frameLength;\n\n if (newOffset === data.length || newOffset + 1 < data.length && this.isHeaderPattern(data, newOffset)) {\n return true;\n }\n }\n\n return false;\n }\n};\n/* harmony default export */ var mpegaudio = (MpegAudio);\n// CONCATENATED MODULE: ./src/demux/exp-golomb.js\n/**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding scheme used by h264.\n*/\n\n\nvar exp_golomb_ExpGolomb = /*#__PURE__*/function () {\n function ExpGolomb(data) {\n this.data = data; // the number of bytes left to examine in this.data\n\n this.bytesAvailable = data.byteLength; // the current word being examined\n\n this.word = 0; // :uint\n // the number of bits left to examine in the current word\n\n this.bitsAvailable = 0; // :uint\n } // ():void\n\n\n var _proto = ExpGolomb.prototype;\n\n _proto.loadWord = function loadWord() {\n var data = this.data,\n bytesAvailable = this.bytesAvailable,\n position = data.byteLength - bytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, bytesAvailable);\n\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n\n workingBytes.set(data.subarray(position, position + availableBytes));\n this.word = new DataView(workingBytes.buffer).getUint32(0); // track the amount of this.data that has been processed\n\n this.bitsAvailable = availableBytes * 8;\n this.bytesAvailable -= availableBytes;\n } // (count:int):void\n ;\n\n _proto.skipBits = function skipBits(count) {\n var skipBytes; // :int\n\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 } // (size:int):uint\n ;\n\n _proto.readBits = function readBits(size) {\n var bits = Math.min(this.bitsAvailable, size),\n // :uint\n valu = this.word >>> 32 - bits; // :uint\n\n if (size > 32) {\n logger[\"logger\"].error('Cannot read more than 32 bits at a time');\n }\n\n this.bitsAvailable -= bits;\n\n if (this.bitsAvailable > 0) {\n this.word <<= bits;\n } else if (this.bytesAvailable > 0) {\n this.loadWord();\n }\n\n bits = size - bits;\n\n if (bits > 0 && this.bitsAvailable) {\n return valu << bits | this.readBits(bits);\n } else {\n return valu;\n }\n } // ():uint\n ;\n\n _proto.skipLZ = function skipLZ() {\n var leadingZeroCount; // :uint\n\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 } // we exhausted word and still have not found a 1\n\n\n this.loadWord();\n return leadingZeroCount + this.skipLZ();\n } // ():void\n ;\n\n _proto.skipUEG = function skipUEG() {\n this.skipBits(1 + this.skipLZ());\n } // ():void\n ;\n\n _proto.skipEG = function skipEG() {\n this.skipBits(1 + this.skipLZ());\n } // ():uint\n ;\n\n _proto.readUEG = function readUEG() {\n var clz = this.skipLZ(); // :uint\n\n return this.readBits(clz + 1) - 1;\n } // ():int\n ;\n\n _proto.readEG = function readEG() {\n var valu = this.readUEG(); // :int\n\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 } // Some convenience functions\n // :Boolean\n ;\n\n _proto.readBoolean = function readBoolean() {\n return this.readBits(1) === 1;\n } // ():int\n ;\n\n _proto.readUByte = function readUByte() {\n return this.readBits(8);\n } // ():int\n ;\n\n _proto.readUShort = function readUShort() {\n return this.readBits(16);\n } // ():int\n ;\n\n _proto.readUInt = function readUInt() {\n return this.readBits(32);\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 {number} the number of entries in this scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n ;\n\n _proto.skipScalingList = function skipScalingList(count) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n\n lastScale = nextScale === 0 ? lastScale : nextScale;\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 * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n ;\n\n _proto.readSPS = function readSPS() {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n profileIdc,\n profileCompat,\n levelIdc,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n i,\n readUByte = this.readUByte.bind(this),\n readBits = this.readBits.bind(this),\n readUEG = this.readUEG.bind(this),\n readBoolean = this.readBoolean.bind(this),\n skipBits = this.skipBits.bind(this),\n skipEG = this.skipEG.bind(this),\n skipUEG = this.skipUEG.bind(this),\n skipScalingList = this.skipScalingList.bind(this);\n readUByte();\n profileIdc = readUByte(); // profile_idc\n\n profileCompat = readBits(5); // constraint_set[0-4]_flag, u(5)\n\n skipBits(3); // reserved_zero_3bits u(3),\n\n levelIdc = readUByte(); // level_idc u(8)\n\n skipUEG(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n\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\n if (chromaFormatIdc === 3) {\n skipBits(1);\n } // separate_colour_plane_flag\n\n\n skipUEG(); // bit_depth_luma_minus8\n\n skipUEG(); // bit_depth_chroma_minus8\n\n skipBits(1); // qpprime_y_zero_transform_bypass_flag\n\n if (readBoolean()) {\n // seq_scaling_matrix_present_flag\n scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;\n\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\n skipUEG(); // log2_max_frame_num_minus4\n\n var picOrderCntType = readUEG();\n\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\n skipEG(); // offset_for_non_ref_pic\n\n skipEG(); // offset_for_top_to_bottom_field\n\n numRefFramesInPicOrderCntCycle = readUEG();\n\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n skipEG();\n } // offset_for_ref_frame[ i ]\n\n }\n\n skipUEG(); // max_num_ref_frames\n\n skipBits(1); // gaps_in_frame_num_value_allowed_flag\n\n picWidthInMbsMinus1 = readUEG();\n picHeightInMapUnitsMinus1 = readUEG();\n frameMbsOnlyFlag = readBits(1);\n\n if (frameMbsOnlyFlag === 0) {\n skipBits(1);\n } // mb_adaptive_frame_field_flag\n\n\n skipBits(1); // direct_8x8_inference_flag\n\n if (readBoolean()) {\n // frame_cropping_flag\n frameCropLeftOffset = readUEG();\n frameCropRightOffset = readUEG();\n frameCropTopOffset = readUEG();\n frameCropBottomOffset = readUEG();\n }\n\n var pixelRatio = [1, 1];\n\n if (readBoolean()) {\n // vui_parameters_present_flag\n if (readBoolean()) {\n // aspect_ratio_info_present_flag\n var aspectRatioIdc = readUByte();\n\n switch (aspectRatioIdc) {\n case 1:\n pixelRatio = [1, 1];\n break;\n\n case 2:\n pixelRatio = [12, 11];\n break;\n\n case 3:\n pixelRatio = [10, 11];\n break;\n\n case 4:\n pixelRatio = [16, 11];\n break;\n\n case 5:\n pixelRatio = [40, 33];\n break;\n\n case 6:\n pixelRatio = [24, 11];\n break;\n\n case 7:\n pixelRatio = [20, 11];\n break;\n\n case 8:\n pixelRatio = [32, 11];\n break;\n\n case 9:\n pixelRatio = [80, 33];\n break;\n\n case 10:\n pixelRatio = [18, 11];\n break;\n\n case 11:\n pixelRatio = [15, 11];\n break;\n\n case 12:\n pixelRatio = [64, 33];\n break;\n\n case 13:\n pixelRatio = [160, 99];\n break;\n\n case 14:\n pixelRatio = [4, 3];\n break;\n\n case 15:\n pixelRatio = [3, 2];\n break;\n\n case 16:\n pixelRatio = [2, 1];\n break;\n\n case 255:\n {\n pixelRatio = [readUByte() << 8 | readUByte(), readUByte() << 8 | readUByte()];\n break;\n }\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\n _proto.readSliceType = function readSliceType() {\n // skip NALu type\n this.readUByte(); // discard first_mb_in_slice\n\n this.readUEG(); // return slice_type\n\n return this.readUEG();\n };\n\n return ExpGolomb;\n}();\n\n/* harmony default export */ var exp_golomb = (exp_golomb_ExpGolomb);\n// CONCATENATED MODULE: ./src/demux/sample-aes.js\n/**\n * SAMPLE-AES decrypter\n*/\n\n\nvar sample_aes_SampleAesDecrypter = /*#__PURE__*/function () {\n function SampleAesDecrypter(observer, config, decryptdata, discardEPB) {\n this.decryptdata = decryptdata;\n this.discardEPB = discardEPB;\n this.decrypter = new crypt_decrypter[\"default\"](observer, config, {\n removePKCS7Padding: false\n });\n }\n\n var _proto = SampleAesDecrypter.prototype;\n\n _proto.decryptBuffer = function decryptBuffer(encryptedData, callback) {\n this.decrypter.decrypt(encryptedData, this.decryptdata.key.buffer, this.decryptdata.iv.buffer, callback);\n } // AAC - encrypt all full 16 bytes blocks starting from offset 16\n ;\n\n _proto.decryptAacSample = function decryptAacSample(samples, sampleIndex, callback, sync) {\n var curUnit = samples[sampleIndex].unit;\n var encryptedData = curUnit.subarray(16, curUnit.length - curUnit.length % 16);\n var encryptedBuffer = encryptedData.buffer.slice(encryptedData.byteOffset, encryptedData.byteOffset + encryptedData.length);\n var localthis = this;\n this.decryptBuffer(encryptedBuffer, function (decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n curUnit.set(decryptedData, 16);\n\n if (!sync) {\n localthis.decryptAacSamples(samples, sampleIndex + 1, callback);\n }\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\n if (samples[sampleIndex].unit.length < 32) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n this.decryptAacSample(samples, sampleIndex, callback, sync);\n\n if (!sync) {\n return;\n }\n }\n } // AVC - encrypt one 16 bytes block out of ten, starting from offset 32\n ;\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\n for (var inputPos = 32; inputPos <= decodedData.length - 16; inputPos += 160, outputPos += 16) {\n encryptedData.set(decodedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n\n return encryptedData;\n };\n\n _proto.getAvcDecryptedUnit = function getAvcDecryptedUnit(decodedData, decryptedData) {\n decryptedData = new Uint8Array(decryptedData);\n var inputPos = 0;\n\n for (var outputPos = 32; outputPos <= decodedData.length - 16; outputPos += 160, inputPos += 16) {\n decodedData.set(decryptedData.subarray(inputPos, inputPos + 16), outputPos);\n }\n\n return decodedData;\n };\n\n _proto.decryptAvcSample = function decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync) {\n var decodedData = this.discardEPB(curUnit.data);\n var encryptedData = this.getAvcEncryptedData(decodedData);\n var localthis = this;\n this.decryptBuffer(encryptedData.buffer, function (decryptedData) {\n curUnit.data = localthis.getAvcDecryptedUnit(decodedData, decryptedData);\n\n if (!sync) {\n localthis.decryptAvcSamples(samples, sampleIndex, unitIndex + 1, callback);\n }\n });\n };\n\n _proto.decryptAvcSamples = function decryptAvcSamples(samples, sampleIndex, unitIndex, callback) {\n for (;; sampleIndex++, unitIndex = 0) {\n if (sampleIndex >= samples.length) {\n callback();\n return;\n }\n\n var curUnits = samples[sampleIndex].units;\n\n for (;; unitIndex++) {\n if (unitIndex >= curUnits.length) {\n break;\n }\n\n var curUnit = curUnits[unitIndex];\n\n if (curUnit.data.length <= 48 || curUnit.type !== 1 && curUnit.type !== 5) {\n continue;\n }\n\n var sync = this.decrypter.isSync();\n this.decryptAvcSample(samples, sampleIndex, unitIndex, callback, curUnit, sync);\n\n if (!sync) {\n return;\n }\n }\n }\n };\n\n return SampleAesDecrypter;\n}();\n\n/* harmony default export */ var sample_aes = (sample_aes_SampleAesDecrypter);\n// CONCATENATED MODULE: ./src/demux/tsdemuxer.js\n/**\n * highly optimized TS demuxer:\n * parse PAT, PMT\n * extract PES packet from audio and video PIDs\n * extract AVC/H264 NAL units and AAC/ADTS samples from PES packet\n * trigger the remuxer upon parsing completion\n * it also tries to workaround as best as it can audio codec switch (HE-AAC to AAC and vice versa), without having to restart the MediaSource.\n * it also controls the remuxing process :\n * upon discontinuity or level switch detection, it will also notifies the remuxer so that it can reset its state.\n*/\n\n\n\n\n // import Hex from '../utils/hex';\n\n\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\nvar RemuxerTrackIdConfig = {\n video: 1,\n audio: 2,\n id3: 3,\n text: 4\n};\n\nvar tsdemuxer_TSDemuxer = /*#__PURE__*/function () {\n function TSDemuxer(observer, remuxer, config, typeSupported) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.remuxer = remuxer;\n this.sampleAes = null;\n this.pmtUnknownTypes = {};\n }\n\n var _proto = TSDemuxer.prototype;\n\n _proto.setDecryptData = function setDecryptData(decryptdata) {\n if (decryptdata != null && decryptdata.key != null && decryptdata.method === 'SAMPLE-AES') {\n this.sampleAes = new sample_aes(this.observer, this.config, decryptdata, this.discardEPB);\n } else {\n this.sampleAes = null;\n }\n };\n\n TSDemuxer.probe = function probe(data) {\n var syncOffset = TSDemuxer._syncOffset(data);\n\n if (syncOffset < 0) {\n return false;\n } else {\n if (syncOffset) {\n logger[\"logger\"].warn(\"MPEG2-TS detected but first sync word found @ offset \" + syncOffset + \", junk ahead ?\");\n }\n\n return true;\n }\n };\n\n TSDemuxer._syncOffset = function _syncOffset(data) {\n // scan 1000 first bytes\n var scanwindow = Math.min(1000, data.length - 3 * 188);\n var i = 0;\n\n while (i < scanwindow) {\n // a TS fragment should contain at least 3 TS packets, a PAT, a PMT, and one PID, each starting with 0x47\n if (data[i] === 0x47 && data[i + 188] === 0x47 && data[i + 2 * 188] === 0x47) {\n return i;\n } else {\n i++;\n }\n }\n\n return -1;\n }\n /**\n * Creates a track model internal to demuxer used to drive remuxing input\n *\n * @param {string} type 'audio' | 'video' | 'id3' | 'text'\n * @param {number} duration\n * @return {object} TSDemuxer's internal track model\n */\n ;\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: type === 'video' ? 0 : undefined,\n isAAC: type === 'audio' ? true : undefined,\n duration: type === 'audio' ? duration : undefined\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 * @override Implements generic demuxing/remuxing interface (see DemuxerInline)\n * @param {object} initSegment\n * @param {string} audioCodec\n * @param {string} videoCodec\n * @param {number} duration (in TS timescale = 90kHz)\n */\n ;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this.pmtParsed = false;\n this._pmtId = -1;\n this.pmtUnknownTypes = {};\n this._avcTrack = TSDemuxer.createTrack('video', duration);\n this._audioTrack = TSDemuxer.createTrack('audio', duration);\n this._id3Track = TSDemuxer.createTrack('id3', duration);\n this._txtTrack = TSDemuxer.createTrack('text', duration); // flush any partial content\n\n this.aacOverFlow = null;\n this.aacLastPTS = null;\n this.avcSample = null;\n this.audioCodec = audioCodec;\n this.videoCodec = videoCodec;\n this._duration = duration;\n }\n /**\n *\n * @override\n */\n ;\n\n _proto.resetTimeStamp = function resetTimeStamp() {} // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var start,\n len = data.length,\n stt,\n pid,\n atf,\n offset,\n pes,\n unknownPIDs = false;\n this.pmtUnknownTypes = {};\n this.contiguous = contiguous;\n\n var pmtParsed = this.pmtParsed,\n avcTrack = this._avcTrack,\n audioTrack = this._audioTrack,\n id3Track = this._id3Track,\n avcId = avcTrack.pid,\n audioId = audioTrack.pid,\n id3Id = id3Track.pid,\n pmtId = this._pmtId,\n avcData = avcTrack.pesData,\n audioData = audioTrack.pesData,\n id3Data = id3Track.pesData,\n parsePAT = this._parsePAT,\n parsePMT = this._parsePMT.bind(this),\n parsePES = this._parsePES,\n parseAVCPES = this._parseAVCPES.bind(this),\n parseAACPES = this._parseAACPES.bind(this),\n parseMPEGPES = this._parseMPEGPES.bind(this),\n parseID3PES = this._parseID3PES.bind(this);\n\n var syncOffset = TSDemuxer._syncOffset(data); // don't parse last TS packet if incomplete\n\n\n len -= (len + syncOffset) % 188; // loop through TS packets\n\n for (start = syncOffset; start < len; start += 188) {\n if (data[start] === 0x47) {\n stt = !!(data[start + 1] & 0x40); // pid is a 13-bit field starting at the last bit of TS[1]\n\n pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2];\n atf = (data[start + 3] & 0x30) >> 4; // if an adaption field is present, its length is specified by the fifth byte of the TS packet header.\n\n if (atf > 1) {\n offset = start + 5 + data[start + 4]; // continue if there is only adaptation field\n\n if (offset === start + 188) {\n continue;\n }\n } else {\n offset = start + 4;\n }\n\n switch (pid) {\n case avcId:\n if (stt) {\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, false);\n }\n\n avcData = {\n data: [],\n size: 0\n };\n }\n\n if (avcData) {\n avcData.data.push(data.subarray(offset, start + 188));\n avcData.size += start + 188 - offset;\n }\n\n break;\n\n case audioId:\n if (stt) {\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n }\n\n audioData = {\n data: [],\n size: 0\n };\n }\n\n if (audioData) {\n audioData.data.push(data.subarray(offset, start + 188));\n audioData.size += start + 188 - offset;\n }\n\n break;\n\n case id3Id:\n if (stt) {\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(pes);\n }\n\n id3Data = {\n data: [],\n size: 0\n };\n }\n\n if (id3Data) {\n id3Data.data.push(data.subarray(offset, start + 188));\n id3Data.size += start + 188 - offset;\n }\n\n break;\n\n case 0:\n if (stt) {\n offset += data[offset] + 1;\n }\n\n pmtId = this._pmtId = parsePAT(data, offset);\n break;\n\n case pmtId:\n if (stt) {\n offset += data[offset] + 1;\n }\n\n var parsedPIDs = parsePMT(data, offset, this.typeSupported.mpeg === true || this.typeSupported.mp3 === true, this.sampleAes != null); // 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\n avcId = parsedPIDs.avc;\n\n if (avcId > 0) {\n avcTrack.pid = avcId;\n }\n\n audioId = parsedPIDs.audio;\n\n if (audioId > 0) {\n audioTrack.pid = audioId;\n audioTrack.isAAC = parsedPIDs.isAAC;\n }\n\n id3Id = parsedPIDs.id3;\n\n if (id3Id > 0) {\n id3Track.pid = id3Id;\n }\n\n if (unknownPIDs && !pmtParsed) {\n logger[\"logger\"].log('reparse from beginning');\n unknownPIDs = false; // we set it to -188, the += 188 in the for loop will reset start to 0\n\n start = syncOffset - 188;\n }\n\n pmtParsed = this.pmtParsed = true;\n break;\n\n case 17:\n case 0x1fff:\n break;\n\n default:\n unknownPIDs = true;\n break;\n }\n } else {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: false,\n reason: 'TS packet did not start with 0x47'\n });\n }\n } // try to parse last PES packets\n\n\n if (avcData && (pes = parsePES(avcData))) {\n parseAVCPES(pes, true);\n avcTrack.pesData = null;\n } else {\n // either avcData null or PES truncated, keep it for next frag parsing\n avcTrack.pesData = avcData;\n }\n\n if (audioData && (pes = parsePES(audioData))) {\n if (audioTrack.isAAC) {\n parseAACPES(pes);\n } else {\n parseMPEGPES(pes);\n }\n\n audioTrack.pesData = null;\n } else {\n if (audioData && audioData.size) {\n logger[\"logger\"].log('last AAC PES packet truncated,might overlap between fragments');\n } // either audioData null or PES truncated, keep it for next frag parsing\n\n\n audioTrack.pesData = audioData;\n }\n\n if (id3Data && (pes = parsePES(id3Data))) {\n parseID3PES(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 if (this.sampleAes == null) {\n this.remuxer.remux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n } else {\n this.decryptAndRemux(audioTrack, avcTrack, id3Track, this._txtTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.decryptAndRemux = function decryptAndRemux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (audioTrack.samples && audioTrack.isAAC) {\n var localthis = this;\n this.sampleAes.decryptAacSamples(audioTrack.samples, 0, function () {\n localthis.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.decryptAndRemuxAvc = function decryptAndRemuxAvc(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n if (videoTrack.samples) {\n var localthis = this;\n this.sampleAes.decryptAvcSamples(videoTrack.samples, 0, 0, function () {\n localthis.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n });\n } else {\n this.remuxer.remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset);\n }\n };\n\n _proto.destroy = function destroy() {\n this._initPTS = this._initDTS = undefined;\n this._duration = 0;\n };\n\n _proto._parsePAT = 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]; // logger.log('PMT PID:' + this._pmtId);\n };\n\n _proto._trackUnknownPmt = function _trackUnknownPmt(type, logLevel, message) {\n // Only log unknown and unsupported stream types once per append or stream (by resetting this.pmtUnknownTypes)\n // For more information on elementary stream types see:\n // https://en.wikipedia.org/wiki/Program-specific_information#Elementary_stream_types\n var result = this.pmtUnknownTypes[type] || 0;\n\n if (result === 0) {\n this.pmtUnknownTypes[type] = 0;\n logLevel.call(logger[\"logger\"], message);\n }\n\n this.pmtUnknownTypes[type]++;\n return result;\n };\n\n _proto._parsePMT = function _parsePMT(data, offset, mpegSupported, isSampleAes) {\n var sectionLength,\n tableEnd,\n programInfoLength,\n pid,\n result = {\n audio: -1,\n avc: -1,\n id3: -1,\n isAAC: true\n };\n sectionLength = (data[offset + 1] & 0x0f) << 8 | data[offset + 2];\n tableEnd = offset + 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (data[offset + 10] & 0x0f) << 8 | data[offset + 11]; // advance the offset to the first entry in the mapping table\n\n offset += 12 + programInfoLength;\n\n while (offset < tableEnd) {\n pid = (data[offset + 1] & 0x1F) << 8 | data[offset + 2];\n\n switch (data[offset]) {\n case 0xcf:\n // SAMPLE-AES AAC\n if (!isSampleAes) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream');\n\n break;\n }\n\n /* falls through */\n // ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)\n\n case 0x0f:\n // logger.log('AAC PID:' + pid);\n if (result.audio === -1) {\n result.audio = pid;\n }\n\n break;\n // Packetized metadata (ID3)\n\n case 0x15:\n // logger.log('ID3 PID:' + pid);\n if (result.id3 === -1) {\n result.id3 = pid;\n }\n\n break;\n\n case 0xdb:\n // SAMPLE-AES AVC\n if (!isSampleAes) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'H.264 with AES-128-CBC slice encryption found in unencrypted stream');\n\n break;\n }\n\n /* falls through */\n // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)\n\n case 0x1b:\n // logger.log('AVC PID:' + pid);\n if (result.avc === -1) {\n result.avc = pid;\n }\n\n break;\n // ISO/IEC 11172-3 (MPEG-1 audio)\n // or ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)\n\n case 0x03:\n case 0x04:\n // logger.log('MPEG PID:' + pid);\n if (!mpegSupported) {\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'MPEG audio found, not supported in this browser');\n } else if (result.audio === -1) {\n result.audio = pid;\n result.isAAC = false;\n }\n\n break;\n\n case 0x24:\n this._trackUnknownPmt(data[offset], logger[\"logger\"].warn, 'Unsupported HEVC stream type found');\n\n break;\n\n default:\n this._trackUnknownPmt(data[offset], logger[\"logger\"].log, 'Unknown stream type:' + data[offset]);\n\n break;\n } // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n\n offset += ((data[offset + 3] & 0x0F) << 8 | data[offset + 4]) + 5;\n }\n\n return result;\n };\n\n _proto._parsePES = function _parsePES(stream) {\n var i = 0,\n frag,\n pesFlags,\n pesPrefix,\n pesLen,\n pesHdrLen,\n pesData,\n pesPts,\n pesDts,\n payloadStartOffset,\n data = stream.data; // safety check\n\n if (!stream || stream.size === 0) {\n return null;\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\n\n while (data[0].length < 19 && data.length > 1) {\n var newData = new Uint8Array(data[0].length + data[1].length);\n newData.set(data[0]);\n newData.set(data[1], data[0].length);\n data[0] = newData;\n data.splice(1, 1);\n } // retrieve PTS/DTS from first fragment\n\n\n frag = data[0];\n pesPrefix = (frag[0] << 16) + (frag[1] << 8) + frag[2];\n\n if (pesPrefix === 1) {\n pesLen = (frag[4] << 8) + frag[5]; // 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\n if (pesLen && pesLen > stream.size - 6) {\n return null;\n }\n\n pesFlags = frag[7];\n\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 + // 1 << 29\n (frag[10] & 0xFF) * 4194304 + // 1 << 22\n (frag[11] & 0xFE) * 16384 + // 1 << 14\n (frag[12] & 0xFF) * 128 + // 1 << 7\n (frag[13] & 0xFE) / 2;\n\n if (pesFlags & 0x40) {\n pesDts = (frag[14] & 0x0E) * 536870912 + // 1 << 29\n (frag[15] & 0xFF) * 4194304 + // 1 << 22\n (frag[16] & 0xFE) * 16384 + // 1 << 14\n (frag[17] & 0xFF) * 128 + // 1 << 7\n (frag[18] & 0xFE) / 2;\n\n if (pesPts - pesDts > 60 * 90000) {\n logger[\"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\n pesHdrLen = frag[8]; // 9 bytes : 6 bytes for PES header + 3 bytes for PES extension\n\n payloadStartOffset = pesHdrLen + 9;\n\n if (stream.size <= payloadStartOffset) {\n return null;\n }\n\n stream.size -= payloadStartOffset; // reassemble PES packet\n\n pesData = new Uint8Array(stream.size);\n\n for (var j = 0, dataLen = data.length; j < dataLen; j++) {\n frag = data[j];\n var len = frag.byteLength;\n\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\n pesData.set(frag, i);\n i += len;\n }\n\n if (pesLen) {\n // payload size : remove PES header + PES extension\n pesLen -= pesHdrLen + 3;\n }\n\n return {\n data: pesData,\n pts: pesPts,\n dts: pesDts,\n len: pesLen\n };\n } else {\n return null;\n }\n };\n\n _proto.pushAccesUnit = function pushAccesUnit(avcSample, avcTrack) {\n if (avcSample.units.length && avcSample.frame) {\n var samples = avcTrack.samples;\n var nbSamples = samples.length; // if sample does not have PTS/DTS, patch with last sample PTS/DTS\n\n if (isNaN(avcSample.pts)) {\n if (nbSamples) {\n var lastSample = samples[nbSamples - 1];\n avcSample.pts = lastSample.pts;\n avcSample.dts = lastSample.dts;\n } else {\n // dropping samples, no timestamp found\n avcTrack.dropped++;\n return;\n }\n } // only push AVC sample if starting with a keyframe is not mandatory OR\n // if keyframe already found in this fragment OR\n // keyframe found in last fragment (track.sps) AND\n // samples already appended (we already found a keyframe in this fragment) OR fragment is contiguous\n\n\n if (!this.config.forceKeyFrameOnDiscontinuity || avcSample.key === true || avcTrack.sps && (nbSamples || this.contiguous)) {\n avcSample.id = nbSamples;\n samples.push(avcSample);\n } else {\n // dropped samples, track it\n avcTrack.dropped++;\n }\n }\n\n if (avcSample.debug.length) {\n logger[\"logger\"].log(avcSample.pts + '/' + avcSample.dts + ':' + avcSample.debug);\n }\n };\n\n _proto._parseAVCPES = function _parseAVCPES(pes, last) {\n var _this = this;\n\n // logger.log('parse new PES');\n var track = this._avcTrack,\n units = this._parseAVCNALu(pes.data),\n debug = false,\n expGolombDecoder,\n avcSample = this.avcSample,\n push,\n spsfound = false,\n i,\n pushAccesUnit = this.pushAccesUnit.bind(this),\n createAVCSample = function createAVCSample(key, pts, dts, debug) {\n return {\n key: key,\n pts: pts,\n dts: dts,\n units: [],\n debug: debug\n };\n }; // free pes.data to save up some memory\n\n\n pes.data = null; // 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\n if (avcSample && units.length && !track.audFound) {\n pushAccesUnit(avcSample, track);\n avcSample = this.avcSample = createAVCSample(false, pes.pts, pes.dts, '');\n }\n\n units.forEach(function (unit) {\n switch (unit.type) {\n // NDR\n case 1:\n push = true;\n\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n\n if (debug) {\n avcSample.debug += 'NDR ';\n }\n\n avcSample.frame = true;\n var data = unit.data; // only check slice type to detect KF in case SPS found in same packet (any keyframe is preceded by SPS ...)\n\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 exp_golomb(data).readSliceType(); // 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\n if (sliceType === 2 || sliceType === 4 || sliceType === 7 || sliceType === 9) {\n avcSample.key = true;\n }\n }\n\n break;\n // IDR\n\n case 5:\n push = true; // handle PES not starting with AUD\n\n if (!avcSample) {\n avcSample = _this.avcSample = createAVCSample(true, pes.pts, pes.dts, '');\n }\n\n if (debug) {\n avcSample.debug += 'IDR ';\n }\n\n avcSample.key = true;\n avcSample.frame = true;\n break;\n // SEI\n\n case 6:\n push = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'SEI ';\n }\n\n expGolombDecoder = new exp_golomb(_this.discardEPB(unit.data)); // skip frameType\n\n expGolombDecoder.readUByte();\n var payloadType = 0;\n var payloadSize = 0;\n var endOfCaptions = false;\n var b = 0;\n\n while (!endOfCaptions && expGolombDecoder.bytesAvailable > 1) {\n payloadType = 0;\n\n do {\n b = expGolombDecoder.readUByte();\n payloadType += b;\n } while (b === 0xFF); // Parse payload size.\n\n\n payloadSize = 0;\n\n do {\n b = expGolombDecoder.readUByte();\n payloadSize += b;\n } while (b === 0xFF); // TODO: there can be more than one payload in an SEI packet...\n // TODO: need to read type and size in a while loop to get them all\n\n\n if (payloadType === 4 && expGolombDecoder.bytesAvailable !== 0) {\n endOfCaptions = true;\n var countryCode = expGolombDecoder.readUByte();\n\n if (countryCode === 181) {\n var providerCode = expGolombDecoder.readUShort();\n\n if (providerCode === 49) {\n var userStructure = expGolombDecoder.readUInt();\n\n if (userStructure === 0x47413934) {\n var userDataType = expGolombDecoder.readUByte(); // Raw CEA-608 bytes wrapped in CEA-708 packet\n\n if (userDataType === 3) {\n var firstByte = expGolombDecoder.readUByte();\n var secondByte = expGolombDecoder.readUByte();\n var totalCCs = 31 & firstByte;\n var byteArray = [firstByte, secondByte];\n\n for (i = 0; i < totalCCs; i++) {\n // 3 bytes per CC\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n byteArray.push(expGolombDecoder.readUByte());\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, {\n type: 3,\n pts: pes.pts,\n bytes: byteArray\n });\n }\n }\n }\n }\n } else if (payloadType === 5 && expGolombDecoder.bytesAvailable !== 0) {\n endOfCaptions = true;\n\n if (payloadSize > 16) {\n var uuidStrArray = [];\n\n for (i = 0; i < 16; i++) {\n uuidStrArray.push(expGolombDecoder.readUByte().toString(16));\n\n if (i === 3 || i === 5 || i === 7 || i === 9) {\n uuidStrArray.push('-');\n }\n }\n\n var length = payloadSize - 16;\n var userDataPayloadBytes = new Uint8Array(length);\n\n for (i = 0; i < length; i++) {\n userDataPayloadBytes[i] = expGolombDecoder.readUByte();\n }\n\n _this._insertSampleInOrder(_this._txtTrack.samples, {\n pts: pes.pts,\n payloadType: payloadType,\n uuid: uuidStrArray.join(''),\n userDataBytes: userDataPayloadBytes,\n userData: Object(id3[\"utf8ArrayToStr\"])(userDataPayloadBytes.buffer)\n });\n }\n } else if (payloadSize < expGolombDecoder.bytesAvailable) {\n for (i = 0; i < payloadSize; i++) {\n expGolombDecoder.readUByte();\n }\n }\n }\n\n break;\n // SPS\n\n case 7:\n push = true;\n spsfound = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'SPS ';\n }\n\n if (!track.sps) {\n expGolombDecoder = new exp_golomb(unit.data);\n var config = expGolombDecoder.readSPS();\n track.width = config.width;\n track.height = config.height;\n track.pixelRatio = config.pixelRatio;\n track.sps = [unit.data];\n track.duration = _this._duration;\n var codecarray = unit.data.subarray(1, 4);\n var codecstring = 'avc1.';\n\n for (i = 0; i < 3; i++) {\n var h = codecarray[i].toString(16);\n\n if (h.length < 2) {\n h = '0' + h;\n }\n\n codecstring += h;\n }\n\n track.codec = codecstring;\n }\n\n break;\n // PPS\n\n case 8:\n push = true;\n\n if (debug && avcSample) {\n avcSample.debug += 'PPS ';\n }\n\n if (!track.pps) {\n track.pps = [unit.data];\n }\n\n break;\n // AUD\n\n case 9:\n push = false;\n track.audFound = true;\n\n if (avcSample) {\n pushAccesUnit(avcSample, track);\n }\n\n avcSample = _this.avcSample = createAVCSample(false, pes.pts, pes.dts, debug ? 'AUD ' : '');\n break;\n // Filler Data\n\n case 12:\n push = false;\n break;\n\n default:\n push = false;\n\n if (avcSample) {\n avcSample.debug += 'unknown NAL ' + unit.type + ' ';\n }\n\n break;\n }\n\n if (avcSample && push) {\n var _units = avcSample.units;\n\n _units.push(unit);\n }\n }); // if last PES packet, push samples\n\n if (last && avcSample) {\n pushAccesUnit(avcSample, track);\n this.avcSample = null;\n }\n };\n\n _proto._insertSampleInOrder = function _insertSampleInOrder(arr, data) {\n var len = arr.length;\n\n if (len > 0) {\n if (data.pts >= arr[len - 1].pts) {\n arr.push(data);\n } else {\n for (var pos = len - 1; pos >= 0; pos--) {\n if (data.pts < arr[pos].pts) {\n arr.splice(pos, 0, data);\n break;\n }\n }\n }\n } else {\n arr.push(data);\n }\n };\n\n _proto._getLastNalUnit = function _getLastNalUnit() {\n var avcSample = this.avcSample,\n lastUnit; // try to fallback to previous sample if current one is empty\n\n if (!avcSample || avcSample.units.length === 0) {\n var track = this._avcTrack,\n samples = track.samples;\n avcSample = samples[samples.length - 1];\n }\n\n if (avcSample) {\n var units = avcSample.units;\n lastUnit = units[units.length - 1];\n }\n\n return lastUnit;\n };\n\n _proto._parseAVCNALu = function _parseAVCNALu(array) {\n var i = 0,\n len = array.byteLength,\n value,\n overflow,\n track = this._avcTrack,\n state = track.naluState || 0,\n lastState = state;\n var units = [],\n unit,\n unitType,\n lastUnitStart = -1,\n lastUnitType; // 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; // NALu type is value read from offset 0\n\n lastUnitType = array[0] & 0x1f;\n state = 0;\n i = 1;\n }\n\n while (i < len) {\n value = array[i++]; // optimization. state 0 and 1 are the predominant case. let's handle them outside of the switch/case\n\n if (!state) {\n state = value ? 0 : 1;\n continue;\n }\n\n if (state === 1) {\n state = value ? 0 : 2;\n continue;\n } // here we have state either equal to 2 or 3\n\n\n if (!value) {\n state = 3;\n } else if (value === 1) {\n if (lastUnitStart >= 0) {\n unit = {\n data: array.subarray(lastUnitStart, i - state - 1),\n type: lastUnitType\n }; // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);\n\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();\n\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 } // If NAL units are not starting right at the beginning of the PES packet, push preceding data into previous NAL unit.\n\n\n overflow = i - state - 1;\n\n if (overflow > 0) {\n // logger.log('first NALU found with overflow:' + overflow);\n var tmp = new Uint8Array(lastUnit.data.byteLength + overflow);\n tmp.set(lastUnit.data, 0);\n tmp.set(array.subarray(0, overflow), lastUnit.data.byteLength);\n lastUnit.data = tmp;\n }\n }\n } // check if we can read unit type\n\n\n if (i < len) {\n unitType = array[i] & 0x1f; // logger.log('find NALU @ offset:' + i + ',type:' + unitType);\n\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\n if (lastUnitStart >= 0 && state >= 0) {\n unit = {\n data: array.subarray(lastUnitStart, len),\n type: lastUnitType,\n state: state\n };\n units.push(unit); // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);\n } // no NALu found\n\n\n if (units.length === 0) {\n // append pes.data to previous NAL unit\n var _lastUnit = this._getLastNalUnit();\n\n if (_lastUnit) {\n var _tmp = new Uint8Array(_lastUnit.data.byteLength + array.byteLength);\n\n _tmp.set(_lastUnit.data, 0);\n\n _tmp.set(array, _lastUnit.data.byteLength);\n\n _lastUnit.data = _tmp;\n }\n }\n\n track.naluState = state;\n return units;\n }\n /**\n * remove Emulation Prevention bytes from a RBSP\n */\n ;\n\n _proto.discardEPB = function discardEPB(data) {\n var length = data.byteLength,\n EPBPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\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 } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (EPBPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n\n newLength = length - EPBPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === EPBPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n EPBPositions.shift();\n }\n\n newData[i] = data[sourceIndex];\n }\n\n return newData;\n };\n\n _proto._parseAACPES = function _parseAACPES(pes) {\n var track = this._audioTrack,\n data = pes.data,\n pts = pes.pts,\n startOffset = 0,\n aacOverFlow = this.aacOverFlow,\n aacLastPTS = this.aacLastPTS,\n frameDuration,\n frameIndex,\n offset,\n stamp,\n len;\n\n if (aacOverFlow) {\n var tmp = new Uint8Array(aacOverFlow.byteLength + data.byteLength);\n tmp.set(aacOverFlow, 0);\n tmp.set(data, aacOverFlow.byteLength); // logger.log(`AAC: append overflowing ${aacOverFlow.byteLength} bytes to beginning of new PES`);\n\n data = tmp;\n } // look for ADTS header (0xFFFx)\n\n\n for (offset = startOffset, len = data.length; offset < len - 1; offset++) {\n if (isHeader(data, offset)) {\n break;\n }\n } // if ADTS header does not start straight from the beginning of the PES payload, raise an error\n\n\n if (offset) {\n var reason, fatal;\n\n if (offset < len - 1) {\n reason = \"AAC PES did not start with ADTS header,offset:\" + offset;\n fatal = false;\n } else {\n reason = 'no ADTS header found in AAC PES';\n fatal = true;\n }\n\n logger[\"logger\"].warn(\"parsing error:\" + reason);\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: fatal,\n reason: reason\n });\n\n if (fatal) {\n return;\n }\n }\n\n initTrackConfig(track, this.observer, data, offset, this.audioCodec);\n frameIndex = 0;\n frameDuration = getFrameDuration(track.samplerate); // 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\n if (aacOverFlow && aacLastPTS) {\n var newPTS = aacLastPTS + frameDuration;\n\n if (Math.abs(newPTS - pts) > 1) {\n logger[\"logger\"].log(\"AAC: align PTS for overlapping frames by \" + Math.round((newPTS - pts) / 90));\n pts = newPTS;\n }\n } // scan for aac samples\n\n\n while (offset < len) {\n if (isHeader(data, offset)) {\n if (offset + 5 < len) {\n var frame = appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n continue;\n }\n } // We are at an ADTS header, but do not have enough data for a frame\n // Remaining data will be added to aacOverFlow\n\n\n break;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n if (offset < len) {\n aacOverFlow = data.subarray(offset, len); // logger.log(`AAC: overflow detected:${len-offset}`);\n } else {\n aacOverFlow = null;\n }\n\n this.aacOverFlow = aacOverFlow;\n this.aacLastPTS = stamp;\n };\n\n _proto._parseMPEGPES = function _parseMPEGPES(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\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(this._audioTrack, data, offset, pts, frameIndex);\n\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\n _proto._parseID3PES = function _parseID3PES(pes) {\n this._id3Track.samples.push(pes);\n };\n\n return TSDemuxer;\n}();\n\n/* harmony default export */ var tsdemuxer = (tsdemuxer_TSDemuxer);\n// CONCATENATED MODULE: ./src/demux/mp3demuxer.js\n/**\n * MP3 demuxer\n */\n\n\n\n\nvar mp3demuxer_MP3Demuxer = /*#__PURE__*/function () {\n function MP3Demuxer(observer, remuxer, config) {\n this.observer = observer;\n this.config = config;\n this.remuxer = remuxer;\n }\n\n var _proto = MP3Demuxer.prototype;\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n this._audioTrack = {\n container: 'audio/mpeg',\n type: 'audio',\n id: -1,\n sequenceNumber: 0,\n isAAC: false,\n samples: [],\n len: 0,\n manifestCodec: audioCodec,\n duration: duration,\n inputTimeScale: 90000\n };\n };\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n MP3Demuxer.probe = function probe(data) {\n // check if data contains ID3 timestamp and MPEG sync word\n var offset, length;\n var id3Data = id3[\"default\"].getID3Data(data, 0);\n\n if (id3Data && id3[\"default\"].getTimeStamp(id3Data) !== undefined) {\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 for (offset = id3Data.length, length = Math.min(data.length - 1, offset + 100); offset < length; offset++) {\n if (mpegaudio.probe(data, offset)) {\n logger[\"logger\"].log('MPEG Audio sync word found !');\n return true;\n }\n }\n }\n\n return false;\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var id3Data = id3[\"default\"].getID3Data(data, 0) || [];\n var timestamp = id3[\"default\"].getTimeStamp(id3Data);\n var pts = timestamp !== undefined ? 90 * timestamp : timeOffset * 90000;\n var offset = id3Data.length;\n var length = data.length;\n var frameIndex = 0,\n stamp = 0;\n var track = this._audioTrack;\n var id3Samples = [{\n pts: pts,\n dts: pts,\n data: id3Data\n }];\n\n while (offset < length) {\n if (mpegaudio.isHeader(data, offset)) {\n var frame = mpegaudio.appendFrame(track, data, offset, pts, frameIndex);\n\n if (frame) {\n offset += frame.length;\n stamp = frame.sample.pts;\n frameIndex++;\n } else {\n // logger.log('Unable to parse Mpeg audio frame');\n break;\n }\n } else if (id3[\"default\"].isHeader(data, offset)) {\n id3Data = id3[\"default\"].getID3Data(data, offset);\n id3Samples.push({\n pts: stamp,\n dts: stamp,\n data: id3Data\n });\n offset += id3Data.length;\n } else {\n // nothing found, keep looking\n offset++;\n }\n }\n\n this.remuxer.remux(track, {\n samples: []\n }, {\n samples: id3Samples,\n inputTimeScale: 90000\n }, {\n samples: []\n }, timeOffset, contiguous, accurateTimeOffset);\n };\n\n _proto.destroy = function destroy() {};\n\n return MP3Demuxer;\n}();\n\n/* harmony default export */ var mp3demuxer = (mp3demuxer_MP3Demuxer);\n// CONCATENATED MODULE: ./src/remux/aac-helper.js\n/**\n * AAC helper\n */\nvar AAC = /*#__PURE__*/function () {\n function AAC() {}\n\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\n break;\n // handle HE-AAC below (mp4a.40.5 / mp4a.40.29)\n\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\n break;\n }\n\n return null;\n };\n\n return AAC;\n}();\n\n/* harmony default export */ var aac_helper = (AAC);\n// CONCATENATED MODULE: ./src/remux/mp4-generator.js\n/**\n * Generate MP4 Box\n*/\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4 = /*#__PURE__*/function () {\n function MP4() {}\n\n MP4.init = function init() {\n MP4.types = {\n avc1: [],\n // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n '.mp3': [],\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: [],\n smhd: []\n };\n var i;\n\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\n var videoHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n var audioHdlr = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n var stco = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n MP4.STTS = MP4.STSC = MP4.STCO = stco;\n MP4.STSZ = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n MP4.VMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n MP4.SMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]);\n MP4.STSD = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01]); // entry_count\n\n var majorBrand = new Uint8Array([105, 115, 111, 109]); // isom\n\n var avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1\n\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\n MP4.box = function box(type) {\n var payload = Array.prototype.slice.call(arguments, 1),\n size = 8,\n i = payload.length,\n len = i,\n result; // calculate the total size we need to allocate\n\n while (i--) {\n size += payload[i].byteLength;\n }\n\n 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); // copy the payload into the result\n\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\n return result;\n };\n\n MP4.hdlr = function hdlr(type) {\n return MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type]);\n };\n\n MP4.mdat = function mdat(data) {\n return MP4.box(MP4.types.mdat, data);\n };\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, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // timescale\n upperWordDuration >> 24, upperWordDuration >> 16 & 0xFF, upperWordDuration >> 8 & 0xFF, upperWordDuration & 0xFF, lowerWordDuration >> 24, lowerWordDuration >> 16 & 0xFF, lowerWordDuration >> 8 & 0xFF, lowerWordDuration & 0xFF, 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00]));\n };\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\n MP4.mfhd = function mfhd(sequenceNumber) {\n return MP4.box(MP4.types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags\n sequenceNumber >> 24, sequenceNumber >> 16 & 0xFF, sequenceNumber >> 8 & 0xFF, sequenceNumber & 0xFF // sequence_number\n ]));\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\n MP4.moof = function moof(sn, baseMediaDecodeTime, track) {\n return MP4.box(MP4.types.moof, MP4.mfhd(sn), MP4.traf(track, baseMediaDecodeTime));\n }\n /**\n * @param tracks... (optional) {array} the tracks associated with this movie\n */\n ;\n\n MP4.moov = function moov(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trak(tracks[i]);\n }\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\n MP4.mvex = function mvex(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = MP4.trex(tracks[i]);\n }\n\n return MP4.box.apply(null, [MP4.types.mvex].concat(boxes));\n };\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, // version 1\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n timescale >> 24 & 0xFF, timescale >> 16 & 0xFF, timescale >> 8 & 0xFF, timescale & 0xFF, // 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, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // 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, // 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, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return MP4.box(MP4.types.mvhd, bytes);\n };\n\n MP4.sdtp = function sdtp(track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i; // leave the full box header (4 bytes) all zero\n // write the sample table\n\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\n return MP4.box(MP4.types.sdtp, bytes);\n };\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\n MP4.avc1 = function avc1(track) {\n var sps = [],\n pps = [],\n i,\n data,\n len; // 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); // SPS\n\n sps = sps.concat(Array.prototype.slice.call(data));\n } // assemble the PPSs\n\n\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\n var avcc = MP4.box(MP4.types.avcC, new Uint8Array([0x01, // version\n sps[3], // profile\n sps[4], // profile compat\n sps[5], // level\n 0xfc | 3, // 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))),\n // \"PPS\"\n width = track.width,\n height = track.height,\n hSpacing = track.pixelRatio[0],\n vSpacing = track.pixelRatio[1];\n return MP4.box(MP4.types.avc1, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n width >> 8 & 0xFF, width & 0xff, // width\n height >> 8 & 0xFF, height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x12, 0x64, 0x61, 0x69, 0x6C, // 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, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]), // pre_defined = -1\n avcc, MP4.box(MP4.types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0])), // avgBitrate\n MP4.box(MP4.types.pasp, new Uint8Array([hSpacing >> 24, // hSpacing\n hSpacing >> 16 & 0xFF, hSpacing >> 8 & 0xFF, hSpacing & 0xFF, vSpacing >> 24, // vSpacing\n vSpacing >> 16 & 0xFF, vSpacing >> 8 & 0xFF, vSpacing & 0xFF])));\n };\n\n MP4.esds = function esds(track) {\n var configlen = track.config.length;\n return new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x03, // descriptor_type\n 0x17 + configlen, // length\n 0x00, 0x01, // es_id\n 0x00, // stream_priority\n 0x04, // descriptor_type\n 0x0f + configlen, // length\n 0x40, // codec : mpeg4_audio\n 0x15, // stream_type\n 0x00, 0x00, 0x00, // buffer_size\n 0x00, 0x00, 0x00, 0x00, // maxBitrate\n 0x00, 0x00, 0x00, 0x00, // avgBitrate\n 0x05 // descriptor_type\n ].concat([configlen]).concat(track.config).concat([0x06, 0x01, 0x02])); // GASpecificConfig)); // length + audio config descriptor\n };\n\n MP4.mp4a = function mp4a(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types.mp4a, new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]), MP4.box(MP4.types.esds, MP4.esds(track)));\n };\n\n MP4.mp3 = function mp3(track) {\n var samplerate = track.samplerate;\n return MP4.box(MP4.types['.mp3'], new Uint8Array([0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n samplerate >> 8 & 0xFF, samplerate & 0xff, //\n 0x00, 0x00]));\n };\n\n MP4.stsd = function stsd(track) {\n if (track.type === 'audio') {\n if (!track.isAAC && track.codec === 'mp3') {\n return MP4.box(MP4.types.stsd, MP4.STSD, MP4.mp3(track));\n }\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\n MP4.tkhd = function tkhd(track) {\n var id = track.id,\n duration = track.duration * track.timescale,\n width = track.width,\n height = track.height,\n upperWordDuration = Math.floor(duration / (UINT32_MAX + 1)),\n lowerWordDuration = Math.floor(duration % (UINT32_MAX + 1));\n return MP4.box(MP4.types.tkhd, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // modification_time\n id >> 24 & 0xFF, id >> 16 & 0xFF, id >> 8 & 0xFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // 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, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x00, 0x00, // non-audio track volume\n 0x00, 0x00, // 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, // transformation: unity matrix\n width >> 8 & 0xFF, width & 0xFF, 0x00, 0x00, // width\n height >> 8 & 0xFF, height & 0xFF, 0x00, 0x00 // height\n ]));\n };\n\n MP4.traf = function traf(track, baseMediaDecodeTime) {\n var sampleDependencyTable = MP4.sdtp(track),\n id = track.id,\n upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1)),\n lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n return MP4.box(MP4.types.traf, MP4.box(MP4.types.tfhd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF // track_ID\n ])), MP4.box(MP4.types.tfdt, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // 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 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8), // mdat header\n sampleDependencyTable);\n }\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n ;\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\n MP4.trex = function trex(track) {\n var id = track.id;\n return MP4.box(MP4.types.trex, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n id >> 24, id >> 16 & 0XFF, id >> 8 & 0XFF, id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]));\n };\n\n MP4.trun = function trun(track, offset) {\n var samples = track.samples || [],\n len = samples.length,\n arraylen = 12 + 16 * len,\n array = new Uint8Array(arraylen),\n i,\n sample,\n duration,\n size,\n flags,\n cts;\n offset += 8 + arraylen;\n array.set([0x00, // version 0\n 0x00, 0x0f, 0x01, // flags\n len >>> 24 & 0xFF, len >>> 16 & 0xFF, len >>> 8 & 0xFF, len & 0xFF, // sample_count\n offset >>> 24 & 0xFF, offset >>> 16 & 0xFF, offset >>> 8 & 0xFF, offset & 0xFF // data_offset\n ], 0);\n\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, // sample_duration\n size >>> 24 & 0xFF, size >>> 16 & 0xFF, size >>> 8 & 0xFF, size & 0xFF, // 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, // sample_flags\n cts >>> 24 & 0xFF, cts >>> 16 & 0xFF, cts >>> 8 & 0xFF, cts & 0xFF // sample_composition_time_offset\n ], 12 + 16 * i);\n }\n\n return MP4.box(MP4.types.trun, array);\n };\n\n MP4.initSegment = function initSegment(tracks) {\n if (!MP4.types) {\n MP4.init();\n }\n\n var movie = MP4.moov(tracks),\n result;\n result = new Uint8Array(MP4.FTYP.byteLength + movie.byteLength);\n result.set(MP4.FTYP);\n result.set(movie, MP4.FTYP.byteLength);\n return result;\n };\n\n return MP4;\n}();\n\n/* harmony default export */ var mp4_generator = (MP4);\n// CONCATENATED MODULE: ./src/utils/timescale-conversion.ts\nvar MPEG_TS_CLOCK_FREQ_HZ = 90000;\nfunction toTimescaleFromScale(value, destScale, srcScale, round) {\n if (srcScale === void 0) {\n srcScale = 1;\n }\n\n if (round === void 0) {\n round = false;\n }\n\n return toTimescaleFromBase(value, destScale, 1 / srcScale);\n}\nfunction toTimescaleFromBase(value, destScale, srcBase, round) {\n if (srcBase === void 0) {\n srcBase = 1;\n }\n\n if (round === void 0) {\n round = false;\n }\n\n var result = value * destScale * srcBase; // equivalent to `(value * scale) / (1 / base)`\n\n return round ? Math.round(result) : result;\n}\nfunction toMsFromMpegTsClock(value, round) {\n if (round === void 0) {\n round = false;\n }\n\n return toTimescaleFromBase(value, 1000, 1 / MPEG_TS_CLOCK_FREQ_HZ, round);\n}\nfunction toMpegTsClockFromTimescale(value, srcScale) {\n if (srcScale === void 0) {\n srcScale = 1;\n }\n\n return toTimescaleFromBase(value, MPEG_TS_CLOCK_FREQ_HZ, 1 / srcScale);\n}\n// CONCATENATED MODULE: ./src/remux/mp4-remuxer.js\n/**\n * fMP4 remuxer\n*/\n\n\n\n\n\n\nvar MAX_SILENT_FRAME_DURATION_90KHZ = toMpegTsClockFromTimescale(10);\nvar PTS_DTS_SHIFT_TOLERANCE_90KHZ = toMpegTsClockFromTimescale(0.2);\nvar chromeVersion = null;\n\nvar mp4_remuxer_MP4Remuxer = /*#__PURE__*/function () {\n function MP4Remuxer(observer, config, typeSupported, vendor) {\n this.observer = observer;\n this.config = config;\n this.typeSupported = typeSupported;\n this.ISGenerated = false;\n\n if (chromeVersion === null) {\n var result = navigator.userAgent.match(/Chrome\\/(\\d+)/i);\n chromeVersion = result ? parseInt(result[1]) : 0;\n }\n }\n\n var _proto = MP4Remuxer.prototype;\n\n _proto.destroy = function destroy() {};\n\n _proto.resetTimeStamp = function resetTimeStamp(defaultTimeStamp) {\n this._initPTS = this._initDTS = defaultTimeStamp;\n };\n\n _proto.resetInitSegment = function resetInitSegment() {\n this.ISGenerated = false;\n };\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\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 PTSNormalize(minPTS, sample.pts);\n } else if (delta > 0) {\n return minPTS;\n } else {\n return sample.pts;\n }\n }, videoSamples[0].pts);\n\n if (rolloverDetected) {\n logger[\"logger\"].debug('PTS rollover detected');\n }\n\n return startPTS;\n };\n\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset) {\n // generate Init Segment if needed\n if (!this.ISGenerated) {\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n if (this.ISGenerated) {\n var nbAudioSamples = audioTrack.samples.length;\n var nbVideoSamples = videoTrack.samples.length;\n var audioTimeOffset = timeOffset;\n var videoTimeOffset = timeOffset;\n\n if (nbAudioSamples && nbVideoSamples) {\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 = PTSNormalize(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 } // Purposefully remuxing audio before video, so that remuxVideo can use nextAudioPts, which is\n // calculated in remuxAudio.\n // logger.log('nb AAC samples:' + audioTrack.samples.length);\n\n\n if (nbAudioSamples) {\n // if initSegment was generated without video samples, regenerate it again\n if (!audioTrack.timescale) {\n logger[\"logger\"].warn('regenerate InitSegment as audio detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n var audioData = this.remuxAudio(audioTrack, audioTimeOffset, contiguous, accurateTimeOffset); // logger.log('nb AVC samples:' + videoTrack.samples.length);\n\n if (nbVideoSamples) {\n var audioTrackLength;\n\n if (audioData) {\n audioTrackLength = audioData.endPTS - audioData.startPTS;\n } // if initSegment was generated without video samples, regenerate it again\n\n\n if (!videoTrack.timescale) {\n logger[\"logger\"].warn('regenerate InitSegment as video detected');\n this.generateIS(audioTrack, videoTrack, timeOffset);\n }\n\n this.remuxVideo(videoTrack, videoTimeOffset, contiguous, audioTrackLength);\n }\n } else {\n // logger.log('nb AVC samples:' + videoTrack.samples.length);\n if (nbVideoSamples) {\n var videoData = this.remuxVideo(videoTrack, videoTimeOffset, contiguous, 0, accurateTimeOffset);\n\n if (videoData && audioTrack.codec) {\n this.remuxEmptyAudio(audioTrack, audioTimeOffset, contiguous, videoData);\n }\n }\n }\n } // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n\n\n if (id3Track.samples.length) {\n this.remuxID3(id3Track, timeOffset);\n } // logger.log('nb ID3 samples:' + audioTrack.samples.length);\n\n\n if (textTrack.samples.length) {\n this.remuxText(textTrack, timeOffset);\n } // notify end of parsing\n\n\n this.observer.trigger(events[\"default\"].FRAG_PARSED);\n };\n\n _proto.generateIS = function generateIS(audioTrack, videoTrack, timeOffset) {\n var observer = this.observer,\n audioSamples = audioTrack.samples,\n videoSamples = videoTrack.samples,\n typeSupported = this.typeSupported,\n container = 'audio/mp4',\n tracks = {},\n data = {\n tracks: tracks\n },\n computePTSDTS = this._initPTS === undefined,\n initPTS,\n initDTS;\n\n if (computePTSDTS) {\n initPTS = initDTS = Infinity;\n }\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 logger[\"logger\"].log(\"audio sampling rate : \" + audioTrack.samplerate);\n\n if (!audioTrack.isAAC) {\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 }\n\n tracks.audio = {\n container: container,\n codec: audioTrack.codec,\n initSegment: !audioTrack.isAAC && typeSupported.mpeg ? new Uint8Array() : mp4_generator.initSegment([audioTrack]),\n metadata: {\n channelCount: audioTrack.channelCount\n }\n };\n\n if (computePTSDTS) {\n // remember first PTS of this demuxing context. for audio, PTS = DTS\n initPTS = initDTS = audioSamples[0].pts - Math.round(audioTrack.inputTimeScale * timeOffset);\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 var inputTimeScale = videoTrack.inputTimeScale;\n videoTrack.timescale = inputTimeScale;\n tracks.video = {\n container: 'video/mp4',\n codec: videoTrack.codec,\n initSegment: mp4_generator.initSegment([videoTrack]),\n metadata: {\n width: videoTrack.width,\n height: videoTrack.height\n }\n };\n\n if (computePTSDTS) {\n var startPTS = this.getVideoStartPts(videoSamples);\n var startOffset = Math.round(inputTimeScale * timeOffset);\n initDTS = Math.min(initDTS, PTSNormalize(videoSamples[0].dts, startPTS) - startOffset);\n initPTS = Math.min(initPTS, startPTS - startOffset);\n this.observer.trigger(events[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n } else if (computePTSDTS && tracks.audio) {\n // initPTS found for audio-only stream with main and alt audio\n this.observer.trigger(events[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n\n if (Object.keys(tracks).length) {\n observer.trigger(events[\"default\"].FRAG_PARSING_INIT_SEGMENT, data);\n this.ISGenerated = true;\n\n if (computePTSDTS) {\n this._initPTS = initPTS;\n this._initDTS = initDTS;\n }\n } else {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: false,\n reason: 'no audio/video samples found'\n });\n }\n };\n\n _proto.remuxVideo = function remuxVideo(track, timeOffset, contiguous, audioTrackLength) {\n var timeScale = track.timescale;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nbSamples = inputSamples.length;\n var initPTS = this._initPTS;\n var offset = 8;\n var mp4SampleDuration;\n var mdat;\n var moof;\n var firstDTS;\n var lastDTS;\n var minPTS = Number.POSITIVE_INFINITY;\n var maxPTS = Number.NEGATIVE_INFINITY;\n var ptsDtsShift = 0;\n var sortSamples = false; // if parsed fragment is contiguous with last one, let's use last DTS value as reference\n\n var nextAvcDts = this.nextAvcDts;\n\n if (nbSamples === 0) {\n return;\n }\n\n if (!contiguous) {\n var pts = timeOffset * timeScale;\n var cts = inputSamples[0].pts - PTSNormalize(inputSamples[0].dts, inputSamples[0].pts); // if not contiguous, let's use target timeOffset\n\n nextAvcDts = pts - cts;\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\n\n for (var i = 0; i < nbSamples; i++) {\n var sample = inputSamples[i];\n sample.pts = PTSNormalize(sample.pts - initPTS, nextAvcDts);\n sample.dts = PTSNormalize(sample.dts - initPTS, nextAvcDts);\n\n if (sample.dts > sample.pts) {\n ptsDtsShift = Math.max(Math.min(ptsDtsShift, sample.pts - sample.dts), -1 * PTS_DTS_SHIFT_TOLERANCE_90KHZ);\n }\n\n if (sample.dts < inputSamples[i > 0 ? i - 1 : i].dts) {\n sortSamples = true;\n }\n } // sort video samples by DTS then PTS then demux id order\n\n\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 || a.id - b.id;\n });\n } // Get first/last DTS\n\n\n firstDTS = inputSamples[0].dts;\n lastDTS = inputSamples[nbSamples - 1].dts; // on Safari let's signal the same sample duration for all samples\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\n var averageSampleDuration = Math.round((lastDTS - firstDTS) / (nbSamples - 1)); // handle broken streams with PTS < DTS, tolerance up 0.2 seconds\n\n if (ptsDtsShift < 0) {\n if (ptsDtsShift < averageSampleDuration * -2) {\n // Fix for \"CNN special report, with CC\" in test-streams (including Safari browser)\n // With large PTS < DTS errors such as this, we want to correct CTS while maintaining increasing DTS values\n logger[\"logger\"].warn(\"PTS < DTS detected in video samples, offsetting DTS from PTS by \" + toMsFromMpegTsClock(-averageSampleDuration, true) + \" ms\");\n var lastDts = ptsDtsShift;\n\n for (var _i = 0; _i < nbSamples; _i++) {\n inputSamples[_i].dts = lastDts = Math.max(lastDts, inputSamples[_i].pts - averageSampleDuration);\n inputSamples[_i].pts = Math.max(lastDts, inputSamples[_i].pts);\n }\n } else {\n // Fix for \"Custom IV with bad PTS DTS\" in test-streams\n // With smaller PTS < DTS errors we can simply move all DTS back. This increases CTS without causing buffer gaps or decode errors in Safari\n logger[\"logger\"].warn(\"PTS < DTS detected in video samples, shifting DTS by \" + toMsFromMpegTsClock(ptsDtsShift, true) + \" ms to overcome this issue\");\n\n for (var _i2 = 0; _i2 < nbSamples; _i2++) {\n inputSamples[_i2].dts = inputSamples[_i2].dts + ptsDtsShift;\n }\n }\n\n firstDTS = inputSamples[0].dts;\n lastDTS = inputSamples[nbSamples - 1].dts;\n } // if fragment are contiguous, detect hole/overlapping between fragments\n\n\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\n if (foundHole || foundOverlap) {\n if (foundHole) {\n logger[\"logger\"].warn(\"AVC: \" + toMsFromMpegTsClock(delta, true) + \" ms (\" + delta + \"dts) hole between fragments detected, filling it\");\n } else {\n logger[\"logger\"].warn(\"AVC: \" + toMsFromMpegTsClock(-delta, true) + \" ms (\" + delta + \"dts) overlapping between fragments detected\");\n }\n\n firstDTS = nextAvcDts;\n var firstPTS = inputSamples[0].pts - delta;\n inputSamples[0].dts = firstDTS;\n inputSamples[0].pts = firstPTS;\n logger[\"logger\"].log(\"Video: First PTS/DTS adjusted: \" + toMsFromMpegTsClock(firstPTS, true) + \"/\" + toMsFromMpegTsClock(firstDTS, true) + \", delta: \" + toMsFromMpegTsClock(delta, true) + \" ms\");\n }\n }\n\n if (chromeVersion && chromeVersion < 75) {\n firstDTS = Math.max(0, firstDTS);\n }\n\n var nbNalu = 0;\n var naluLen = 0;\n\n for (var _i3 = 0; _i3 < nbSamples; _i3++) {\n // compute total/avc sample length and nb of NAL units\n var _sample = inputSamples[_i3];\n var units = _sample.units;\n var nbUnits = units.length;\n var sampleLen = 0;\n\n for (var j = 0; j < nbUnits; j++) {\n sampleLen += units[j].data.length;\n }\n\n naluLen += sampleLen;\n nbNalu += nbUnits;\n _sample.length = sampleLen; // normalize PTS/DTS\n // ensure sample monotonic DTS\n\n _sample.dts = Math.max(_sample.dts, firstDTS); // ensure that computed value is greater or equal than sample DTS\n\n _sample.pts = Math.max(_sample.pts, _sample.dts, 0);\n minPTS = Math.min(_sample.pts, minPTS);\n maxPTS = Math.max(_sample.pts, maxPTS);\n }\n\n lastDTS = inputSamples[nbSamples - 1].dts;\n /* concatenate the video data and construct the mdat in place\n (need 8 more bytes to fill length and mpdat type) */\n\n var mdatSize = naluLen + 4 * nbNalu + 8;\n\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MUX_ERROR,\n details: errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR,\n fatal: false,\n bytes: mdatSize,\n reason: \"fail allocating video mdat \" + mdatSize\n });\n return;\n }\n\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n\n for (var _i4 = 0; _i4 < nbSamples; _i4++) {\n var avcSample = inputSamples[_i4];\n var avcSampleUnits = avcSample.units;\n var mp4SampleLength = 0;\n var compositionTimeOffset = void 0; // convert NALU bitstream to MP4 format (prepend NALU with size field)\n\n for (var _j = 0, _nbUnits = avcSampleUnits.length; _j < _nbUnits; _j++) {\n var unit = avcSampleUnits[_j];\n var unitData = unit.data;\n var unitDataLen = unit.data.byteLength;\n view.setUint32(offset, unitDataLen);\n offset += 4;\n mdat.set(unitData, offset);\n offset += unitDataLen;\n mp4SampleLength += 4 + unitDataLen;\n } // expected sample duration is the Decoding Timestamp diff of consecutive samples\n\n\n if (_i4 < nbSamples - 1) {\n mp4SampleDuration = inputSamples[_i4 + 1].dts - avcSample.dts;\n } else {\n var config = this.config;\n var lastFrameDuration = avcSample.dts - inputSamples[_i4 > 0 ? _i4 - 1 : _i4].dts;\n\n if (config.stretchShortVideoTrack) {\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 maxBufferHole = config.maxBufferHole;\n var gapTolerance = Math.floor(maxBufferHole * timeScale);\n var deltaToFrameEnd = (audioTrackLength ? minPTS + audioTrackLength * timeScale : this.nextAudioPts) - avcSample.pts;\n\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\n if (mp4SampleDuration < 0) {\n mp4SampleDuration = lastFrameDuration;\n }\n\n logger[\"logger\"].log(\"It is approximately \" + toMsFromMpegTsClock(deltaToFrameEnd, false) + \" ms to the next segment; using duration \" + toMsFromMpegTsClock(mp4SampleDuration, false) + \" ms for the last video frame.\");\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n } else {\n mp4SampleDuration = lastFrameDuration;\n }\n }\n\n compositionTimeOffset = Math.round(avcSample.pts - avcSample.dts); // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${avcSample.pts}/${avcSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(avcSample.pts/4294967296).toFixed(3)}');\n\n outputSamples.push({\n size: mp4SampleLength,\n // constant duration\n duration: mp4SampleDuration,\n cts: compositionTimeOffset,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: avcSample.key ? 2 : 1,\n isNonSync: avcSample.key ? 0 : 1\n }\n });\n } // next AVC sample DTS should be equal to last sample DTS + last sample duration (in PES timescale)\n\n\n this.nextAvcDts = lastDTS + mp4SampleDuration;\n var dropped = track.dropped;\n track.nbNalu = 0;\n track.dropped = 0;\n\n if (outputSamples.length && navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var flags = outputSamples[0].flags; // chrome workaround, mark first sample as being a Random Access Point to avoid sourcebuffer append issue\n // https://code.google.com/p/chromium/issues/detail?id=229412\n\n flags.dependsOn = 2;\n flags.isNonSync = 0;\n }\n\n track.samples = outputSamples;\n moof = mp4_generator.moof(track.sequenceNumber++, firstDTS, track);\n track.samples = [];\n var data = {\n data1: moof,\n data2: mdat,\n startPTS: minPTS / timeScale,\n endPTS: (maxPTS + mp4SampleDuration) / timeScale,\n startDTS: firstDTS / timeScale,\n endDTS: this.nextAvcDts / timeScale,\n type: 'video',\n hasAudio: false,\n hasVideo: true,\n nb: outputSamples.length,\n dropped: dropped\n };\n this.observer.trigger(events[\"default\"].FRAG_PARSING_DATA, data);\n return data;\n };\n\n _proto.remuxAudio = function remuxAudio(track, timeOffset, contiguous, accurateTimeOffset) {\n var inputTimeScale = track.inputTimeScale;\n var mp4timeScale = track.timescale;\n var scaleFactor = inputTimeScale / mp4timeScale;\n var mp4SampleDuration = track.isAAC ? 1024 : 1152;\n var inputSampleDuration = mp4SampleDuration * scaleFactor;\n var initPTS = this._initPTS;\n var rawMPEG = !track.isAAC && this.typeSupported.mpeg;\n var mp4Sample;\n var fillFrame;\n var mdat;\n var moof;\n var firstPTS;\n var lastPTS;\n var offset = rawMPEG ? 0 : 8;\n var inputSamples = track.samples;\n var outputSamples = [];\n var nextAudioPts = this.nextAudioPts; // 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\n contiguous |= inputSamples.length && nextAudioPts && (accurateTimeOffset && Math.abs(timeOffset - nextAudioPts / inputTimeScale) < 0.1 || Math.abs(inputSamples[0].pts - nextAudioPts - initPTS) < 20 * inputSampleDuration); // compute normalized PTS\n\n inputSamples.forEach(function (sample) {\n sample.pts = sample.dts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale);\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\n inputSamples = inputSamples.filter(function (sample) {\n return sample.pts >= 0;\n }); // in case all samples have negative PTS, and have been filtered out, return now\n\n if (inputSamples.length === 0) {\n return;\n }\n\n if (!contiguous) {\n if (!accurateTimeOffset) {\n // if frag are mot contiguous and if we cant trust time offset, let's use first sample PTS as next audio PTS\n nextAudioPts = inputSamples[0].pts;\n } else {\n // if timeOffset is accurate, let's use it as predicted next audio PTS\n nextAudioPts = Math.max(0, timeOffset * inputTimeScale);\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\n if (track.isAAC) {\n var maxAudioFramesDrift = this.config.maxAudioFramesDrift;\n\n for (var i = 0, nextPts = nextAudioPts; i < inputSamples.length;) {\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; // If we're overlapping by more than a duration, drop this sample\n\n if (delta <= -maxAudioFramesDrift * inputSampleDuration) {\n if (contiguous || i > 0) {\n logger[\"logger\"].warn(\"Dropping 1 audio frame @ \" + toMsFromMpegTsClock(nextPts, true) / 1000 + \"s due to \" + toMsFromMpegTsClock(delta, true) + \" ms overlap.\");\n inputSamples.splice(i, 1); // Don't touch nextPtsNorm or i\n } else {\n // When changing qualities we can't trust that audio has been appended up to nextAudioPts\n // Warn about the overlap but do not drop samples as that can introduce buffer gaps\n logger[\"logger\"].warn(\"Audio frame @ \" + toMsFromMpegTsClock(pts, true) / 1000 + \"s overlaps nextAudioPts by \" + toMsFromMpegTsClock(delta, true) + \" ms.\");\n nextPts = pts + inputSampleDuration;\n i++;\n }\n } // eslint-disable-line brace-style\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 else if (delta >= maxAudioFramesDrift * inputSampleDuration && delta < MAX_SILENT_FRAME_DURATION_90KHZ && nextPts) {\n var missing = Math.round(delta / inputSampleDuration);\n logger[\"logger\"].warn(\"Injecting \" + missing + \" audio frames @ \" + toMsFromMpegTsClock(nextPts, true) / 1000 + \"s due to \" + toMsFromMpegTsClock(delta, true) + \" ms gap.\");\n\n for (var j = 0; j < missing; j++) {\n var newStamp = Math.max(nextPts, 0);\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n logger[\"logger\"].log('Unable to get silent frame for given audio codec; duplicating last frame instead.');\n fillFrame = sample.unit.subarray();\n }\n\n inputSamples.splice(i, 0, {\n unit: fillFrame,\n pts: newStamp,\n dts: newStamp\n });\n nextPts += inputSampleDuration;\n i++;\n } // Adjust sample to next expected pts\n\n\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n } else {\n // Otherwise, just adjust pts\n if (Math.abs(delta) > 0.1 * inputSampleDuration) {// logger.log(`Invalid frame delta ${Math.round(delta + inputSampleDuration)} at PTS ${Math.round(pts / 90)} (should be ${Math.round(inputSampleDuration)}).`);\n }\n\n sample.pts = sample.dts = nextPts;\n nextPts += inputSampleDuration;\n i++;\n }\n }\n } // compute mdat size, as we eventually filtered/added some samples\n\n\n var nbSamples = inputSamples.length;\n var mdatSize = 0;\n\n while (nbSamples--) {\n mdatSize += inputSamples[nbSamples].unit.byteLength;\n }\n\n for (var _j2 = 0, _nbSamples = inputSamples.length; _j2 < _nbSamples; _j2++) {\n var audioSample = inputSamples[_j2];\n var unit = audioSample.unit;\n var _pts = audioSample.pts; // logger.log(`Audio/PTS:${toMsFromMpegTsClock(pts, true)}`);\n // if not first sample\n\n if (lastPTS !== undefined && mp4Sample) {\n mp4Sample.duration = Math.round((_pts - lastPTS) / scaleFactor);\n } else {\n var _delta = _pts - nextAudioPts;\n\n var numMissingFrames = 0; // if fragment are contiguous, detect hole/overlapping between fragments\n // contiguous fragments are consecutive fragments from same quality level (same level, new SN = old SN + 1)\n\n if (contiguous && track.isAAC) {\n // log delta\n if (_delta) {\n if (_delta > 0 && _delta < MAX_SILENT_FRAME_DURATION_90KHZ) {\n // Q: why do we have to round here, shouldn't this always result in an integer if timestamps are correct,\n // and if not, shouldn't we actually Math.ceil() instead?\n numMissingFrames = Math.round((_pts - nextAudioPts) / inputSampleDuration);\n logger[\"logger\"].log(toMsFromMpegTsClock(_delta, true) + \" ms hole between AAC samples detected,filling it\");\n\n if (numMissingFrames > 0) {\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n fillFrame = unit.subarray();\n }\n\n mdatSize += numMissingFrames * fillFrame.length;\n } // if we have frame overlap, overlapping for more than half a frame duraion\n\n } else if (_delta < -12) {\n // drop overlapping audio frames... browser will deal with it\n logger[\"logger\"].log(\"drop overlapping AAC sample, expected/parsed/delta: \" + toMsFromMpegTsClock(nextAudioPts, true) + \" ms / \" + toMsFromMpegTsClock(_pts, true) + \" ms / \" + toMsFromMpegTsClock(-_delta, true) + \" ms\");\n mdatSize -= unit.byteLength;\n continue;\n } // set PTS/DTS to expected PTS/DTS\n\n\n _pts = nextAudioPts;\n }\n } // remember first PTS of our audioSamples\n\n\n firstPTS = _pts;\n\n if (mdatSize > 0) {\n mdatSize += offset;\n\n try {\n mdat = new Uint8Array(mdatSize);\n } catch (err) {\n this.observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MUX_ERROR,\n details: errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR,\n fatal: false,\n bytes: mdatSize,\n reason: \"fail allocating audio mdat \" + mdatSize\n });\n return;\n }\n\n if (!rawMPEG) {\n var view = new DataView(mdat.buffer);\n view.setUint32(0, mdatSize);\n mdat.set(mp4_generator.types.mdat, 4);\n }\n } else {\n // no audio samples\n return;\n }\n\n for (var _i5 = 0; _i5 < numMissingFrames; _i5++) {\n fillFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n\n if (!fillFrame) {\n logger[\"logger\"].log('Unable to get silent frame for given audio codec; duplicating this frame instead.');\n fillFrame = unit.subarray();\n }\n\n mdat.set(fillFrame, offset);\n offset += fillFrame.byteLength;\n mp4Sample = {\n size: fillFrame.byteLength,\n cts: 0,\n duration: 1024,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n }\n }\n\n mdat.set(unit, offset);\n var unitLen = unit.byteLength;\n offset += unitLen; // console.log('PTS/DTS/initDTS/normPTS/normDTS/relative PTS : ${audioSample.pts}/${audioSample.dts}/${initDTS}/${ptsnorm}/${dtsnorm}/${(audioSample.pts/4294967296).toFixed(3)}');\n\n mp4Sample = {\n size: unitLen,\n cts: 0,\n duration: 0,\n flags: {\n isLeading: 0,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradPrio: 0,\n dependsOn: 1\n }\n };\n outputSamples.push(mp4Sample);\n lastPTS = _pts;\n }\n\n var lastSampleDuration = 0;\n nbSamples = outputSamples.length; // set last sample duration as being identical to previous sample\n\n if (nbSamples >= 2) {\n lastSampleDuration = outputSamples[nbSamples - 2].duration;\n mp4Sample.duration = lastSampleDuration;\n }\n\n if (nbSamples) {\n // next audio sample PTS should be equal to last sample PTS + duration\n this.nextAudioPts = nextAudioPts = lastPTS + scaleFactor * lastSampleDuration; // logger.log('Audio/PTS/PTSend:' + audioSample.pts.toFixed(0) + '/' + this.nextAacDts.toFixed(0));\n\n track.samples = outputSamples;\n\n if (rawMPEG) {\n moof = new Uint8Array();\n } else {\n moof = mp4_generator.moof(track.sequenceNumber++, firstPTS / scaleFactor, track);\n }\n\n track.samples = [];\n var start = firstPTS / inputTimeScale;\n var end = nextAudioPts / inputTimeScale;\n var audioData = {\n data1: moof,\n data2: mdat,\n startPTS: start,\n endPTS: end,\n startDTS: start,\n endDTS: end,\n type: 'audio',\n hasAudio: true,\n hasVideo: false,\n nb: nbSamples\n };\n this.observer.trigger(events[\"default\"].FRAG_PARSING_DATA, audioData);\n return audioData;\n }\n\n return null;\n };\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; // sync with video's timestamp\n\n var startDTS = (nextAudioPts !== undefined ? nextAudioPts : videoData.startDTS * inputTimeScale) + this._initDTS;\n var endDTS = videoData.endDTS * inputTimeScale + this._initDTS; // one sample's duration value\n\n var sampleDuration = 1024;\n var frameDuration = scaleFactor * sampleDuration; // samples count of this segment's duration\n\n var nbSamples = Math.ceil((endDTS - startDTS) / frameDuration); // silent frame\n\n var silentFrame = aac_helper.getSilentFrame(track.manifestCodec || track.codec, track.channelCount);\n logger[\"logger\"].warn('remux empty Audio'); // Can't remux if we can't generate a silent frame...\n\n if (!silentFrame) {\n logger[\"logger\"].trace('Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!');\n return;\n }\n\n var samples = [];\n\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\n track.samples = samples;\n this.remuxAudio(track, timeOffset, contiguous);\n };\n\n _proto.remuxID3 = function remuxID3(track, timeOffset) {\n var length = track.samples.length;\n\n if (!length) {\n return;\n }\n\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS;\n var initDTS = this._initDTS; // consume samples\n\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index]; // setting id3 pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n\n sample.pts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale) / inputTimeScale;\n sample.dts = PTSNormalize(sample.dts - initDTS, timeOffset * inputTimeScale) / inputTimeScale;\n }\n\n this.observer.trigger(events[\"default\"].FRAG_PARSING_METADATA, {\n samples: track.samples\n });\n track.samples = [];\n };\n\n _proto.remuxText = function remuxText(track, timeOffset) {\n var length = track.samples.length;\n var inputTimeScale = track.inputTimeScale;\n var initPTS = this._initPTS; // consume samples\n\n if (length) {\n for (var index = 0; index < length; index++) {\n var sample = track.samples[index]; // setting text pts, dts to relative time\n // using this._initPTS and this._initDTS to calculate relative time\n\n sample.pts = PTSNormalize(sample.pts - initPTS, timeOffset * inputTimeScale) / inputTimeScale;\n }\n\n track.samples.sort(function (a, b) {\n return a.pts - b.pts;\n });\n this.observer.trigger(events[\"default\"].FRAG_PARSING_USERDATA, {\n samples: track.samples\n });\n }\n\n track.samples = [];\n };\n\n return MP4Remuxer;\n}();\n\nfunction PTSNormalize(value, reference) {\n var offset;\n\n if (reference === undefined) {\n return value;\n }\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\n\n while (Math.abs(value - reference) > 4294967296) {\n value += offset;\n }\n\n return value;\n}\n\n/* harmony default export */ var mp4_remuxer = (mp4_remuxer_MP4Remuxer);\n// CONCATENATED MODULE: ./src/remux/passthrough-remuxer.js\n/**\n * passthrough remuxer\n*/\n\n\nvar passthrough_remuxer_PassThroughRemuxer = /*#__PURE__*/function () {\n function PassThroughRemuxer(observer) {\n this.observer = observer;\n }\n\n var _proto = PassThroughRemuxer.prototype;\n\n _proto.destroy = function destroy() {};\n\n _proto.resetTimeStamp = function resetTimeStamp() {};\n\n _proto.resetInitSegment = function resetInitSegment() {};\n\n _proto.remux = function remux(audioTrack, videoTrack, id3Track, textTrack, timeOffset, contiguous, accurateTimeOffset, rawData) {\n var observer = this.observer;\n var streamType = '';\n\n if (audioTrack) {\n streamType += 'audio';\n }\n\n if (videoTrack) {\n streamType += 'video';\n }\n\n observer.trigger(events[\"default\"].FRAG_PARSING_DATA, {\n data1: rawData,\n startPTS: timeOffset,\n startDTS: timeOffset,\n type: streamType,\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack,\n nb: 1,\n dropped: 0\n }); // notify end of parsing\n\n observer.trigger(events[\"default\"].FRAG_PARSED);\n };\n\n return PassThroughRemuxer;\n}();\n\n/* harmony default export */ var passthrough_remuxer = (passthrough_remuxer_PassThroughRemuxer);\n// CONCATENATED MODULE: ./src/demux/demuxer-inline.js\n/**\n *\n * inline demuxer: probe fragments and instantiate\n * appropriate demuxer depending on content type (TSDemuxer, AACDemuxer, ...)\n *\n */\n\n\n\n\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar now; // performance.now() not available on WebWorker, at least on Safari Desktop\n\ntry {\n now = global.performance.now.bind(global.performance);\n} catch (err) {\n logger[\"logger\"].debug('Unable to use Performance API on this environment');\n now = global.Date.now;\n}\n\nvar demuxer_inline_DemuxerInline = /*#__PURE__*/function () {\n function DemuxerInline(observer, typeSupported, config, vendor) {\n this.observer = observer;\n this.typeSupported = typeSupported;\n this.config = config;\n this.vendor = vendor;\n }\n\n var _proto = DemuxerInline.prototype;\n\n _proto.destroy = function destroy() {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.destroy();\n }\n };\n\n _proto.push = function push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var _this = this;\n\n if (data.byteLength > 0 && decryptdata != null && decryptdata.key != null && decryptdata.method === 'AES-128') {\n var decrypter = this.decrypter;\n\n if (decrypter == null) {\n decrypter = this.decrypter = new crypt_decrypter[\"default\"](this.observer, this.config);\n }\n\n var startTime = now();\n decrypter.decrypt(data, decryptdata.key.buffer, decryptdata.iv.buffer, function (decryptedData) {\n var endTime = now();\n\n _this.observer.trigger(events[\"default\"].FRAG_DECRYPTED, {\n stats: {\n tstart: startTime,\n tdecrypt: endTime\n }\n });\n\n _this.pushDecrypted(new Uint8Array(decryptedData), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n });\n } else {\n this.pushDecrypted(new Uint8Array(data), decryptdata, new Uint8Array(initSegment), audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n };\n\n _proto.pushDecrypted = function pushDecrypted(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS) {\n var demuxer = this.demuxer;\n var remuxer = this.remuxer;\n\n if (!demuxer || // 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 discontinuity || trackSwitch) {\n var observer = this.observer;\n var typeSupported = this.typeSupported;\n var config = this.config; // probing order is TS/MP4/AAC/MP3\n\n var muxConfig = [{\n demux: tsdemuxer,\n remux: mp4_remuxer\n }, {\n demux: mp4demuxer[\"default\"],\n remux: passthrough_remuxer\n }, {\n demux: aacdemuxer,\n remux: mp4_remuxer\n }, {\n demux: mp3demuxer,\n remux: mp4_remuxer\n }]; // probe for content type\n\n var mux;\n\n for (var i = 0, len = muxConfig.length; i < len; i++) {\n mux = muxConfig[i];\n\n if (mux.demux.probe(data)) {\n break;\n }\n }\n\n if (!mux) {\n observer.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_PARSING_ERROR,\n fatal: true,\n reason: 'no demux matching with content found'\n });\n return;\n } // so let's check that current remuxer and demuxer are still valid\n\n\n if (!remuxer || !(remuxer instanceof mux.remux)) {\n remuxer = new mux.remux(observer, config, typeSupported, this.vendor);\n }\n\n if (!demuxer || !(demuxer instanceof mux.demux)) {\n demuxer = new mux.demux(observer, remuxer, config, typeSupported);\n this.probe = mux.demux.probe;\n }\n\n this.demuxer = demuxer;\n this.remuxer = remuxer;\n }\n\n if (discontinuity || trackSwitch) {\n demuxer.resetInitSegment(initSegment, audioCodec, videoCodec, duration);\n remuxer.resetInitSegment();\n }\n\n if (discontinuity) {\n demuxer.resetTimeStamp(defaultInitPTS);\n remuxer.resetTimeStamp(defaultInitPTS);\n }\n\n if (typeof demuxer.setDecryptData === 'function') {\n demuxer.setDecryptData(decryptdata);\n }\n\n demuxer.append(data, timeOffset, contiguous, accurateTimeOffset);\n };\n\n return DemuxerInline;\n}();\n\n/* harmony default export */ var demuxer_inline = __webpack_exports__[\"default\"] = (demuxer_inline_DemuxerInline);\n\n/***/ }),\n\n/***/ \"./src/demux/demuxer-worker.js\":\n/*!*************************************!*\\\n !*** ./src/demux/demuxer-worker.js ***!\n \\*************************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/demux/demuxer.js (referenced with require.resolve) */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _demux_demuxer_inline__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../demux/demuxer-inline */ \"./src/demux/demuxer-inline.js\");\n/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events */ \"./src/events.js\");\n/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_3__);\n/* demuxer web worker.\n * - listen to worker message, and trigger DemuxerInline upon reception of Fragments.\n * - provides MP4 Boxes back to main thread using [transferable objects](https://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast) in order to minimize message passing overhead.\n */\n\n\n\n\n\nvar DemuxerWorker = function DemuxerWorker(self) {\n // observer setup\n var observer = new eventemitter3__WEBPACK_IMPORTED_MODULE_3__[\"EventEmitter\"]();\n\n observer.trigger = function trigger(event) {\n for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n observer.emit.apply(observer, [event, event].concat(data));\n };\n\n observer.off = function off(event) {\n for (var _len2 = arguments.length, data = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n data[_key2 - 1] = arguments[_key2];\n }\n\n observer.removeListener.apply(observer, [event].concat(data));\n };\n\n var forwardMessage = function forwardMessage(ev, data) {\n self.postMessage({\n event: ev,\n data: data\n });\n };\n\n self.addEventListener('message', function (ev) {\n var data = ev.data; // console.log('demuxer cmd:' + data.cmd);\n\n switch (data.cmd) {\n case 'init':\n var config = JSON.parse(data.config);\n self.demuxer = new _demux_demuxer_inline__WEBPACK_IMPORTED_MODULE_0__[\"default\"](observer, data.typeSupported, config, data.vendor);\n Object(_utils_logger__WEBPACK_IMPORTED_MODULE_2__[\"enableLogs\"])(config.debug); // signal end of worker init\n\n forwardMessage('init', null);\n break;\n\n case 'demux':\n self.demuxer.push(data.data, data.decryptdata, data.initSegment, data.audioCodec, data.videoCodec, data.timeOffset, data.discontinuity, data.trackSwitch, data.contiguous, data.duration, data.accurateTimeOffset, data.defaultInitPTS);\n break;\n\n default:\n break;\n }\n }); // forward events to main thread\n\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_DECRYPTED, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSED, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].ERROR, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].INIT_PTS_FOUND, forwardMessage); // special case for FRAG_PARSING_DATA: pass data1/data2 as transferable object (no copy)\n\n observer.on(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_DATA, function (ev, data) {\n var transferable = [];\n var message = {\n event: ev,\n data: data\n };\n\n if (data.data1) {\n message.data1 = data.data1.buffer;\n transferable.push(data.data1.buffer);\n delete data.data1;\n }\n\n if (data.data2) {\n message.data2 = data.data2.buffer;\n transferable.push(data.data2.buffer);\n delete data.data2;\n }\n\n self.postMessage(message, transferable);\n });\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (DemuxerWorker);\n\n/***/ }),\n\n/***/ \"./src/demux/id3.js\":\n/*!**************************!*\\\n !*** ./src/demux/id3.js ***!\n \\**************************/\n/*! exports provided: default, utf8ArrayToStr */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"utf8ArrayToStr\", function() { return utf8ArrayToStr; });\n/* harmony import */ var _utils_get_self_scope__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/get-self-scope */ \"./src/utils/get-self-scope.js\");\n\n/**\n * ID3 parser\n */\n\nvar ID3 = /*#__PURE__*/function () {\n function ID3() {}\n\n /**\n * Returns true if an ID3 header can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 header is found\n */\n ID3.isHeader = 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\n return false;\n }\n /**\n * Returns true if an ID3 footer can be found at offset in data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {boolean} - True if an ID3 footer is found\n */\n ;\n\n ID3.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\n return false;\n }\n /**\n * Returns any adjacent ID3 tags found in data starting at offset, as one block of data\n * @param {Uint8Array} data - The data to search in\n * @param {number} offset - The offset at which to start searching\n * @return {Uint8Array} - The block of data containing any ID3 tags found\n */\n ;\n\n ID3.getID3Data = function getID3Data(data, offset) {\n var front = offset;\n var length = 0;\n\n while (ID3.isHeader(data, offset)) {\n // ID3 header is 10 bytes\n length += 10;\n\n var size = ID3._readSize(data, offset + 6);\n\n length += size;\n\n if (ID3.isFooter(data, offset + 10)) {\n // ID3 footer is 10 bytes\n length += 10;\n }\n\n offset += length;\n }\n\n if (length > 0) {\n return data.subarray(front, front + length);\n }\n\n return undefined;\n };\n\n ID3._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 /**\n * Searches for the Elementary Stream timestamp found in the ID3 data chunk\n * @param {Uint8Array} data - Block of data containing one or more ID3 tags\n * @return {number} - The timestamp\n */\n ;\n\n ID3.getTimeStamp = function getTimeStamp(data) {\n var frames = ID3.getID3Frames(data);\n\n for (var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n\n if (ID3.isTimeStampFrame(frame)) {\n return ID3._readTimeStamp(frame);\n }\n }\n\n return undefined;\n }\n /**\n * Returns true if the ID3 frame is an Elementary Stream timestamp frame\n * @param {ID3 frame} frame\n */\n ;\n\n ID3.isTimeStampFrame = function isTimeStampFrame(frame) {\n return frame && frame.key === 'PRIV' && frame.info === 'com.apple.streaming.transportStreamTimestamp';\n };\n\n ID3._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\n var size = ID3._readSize(data, 4); // skip frame id, size, and flags\n\n\n var offset = 10;\n return {\n type: type,\n size: size,\n data: data.subarray(offset, offset + size)\n };\n }\n /**\n * Returns an array of ID3 frames found in all the ID3 tags in the id3Data\n * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags\n * @return {ID3 frame[]} - Array of ID3 frame objects\n */\n ;\n\n ID3.getID3Frames = function getID3Frames(id3Data) {\n var offset = 0;\n var frames = [];\n\n while (ID3.isHeader(id3Data, offset)) {\n var size = ID3._readSize(id3Data, offset + 6); // skip past ID3 header\n\n\n offset += 10;\n var end = offset + size; // loop through frames in the ID3 tag\n\n while (offset + 8 < end) {\n var frameData = ID3._getFrameData(id3Data.subarray(offset));\n\n var frame = ID3._decodeFrame(frameData);\n\n if (frame) {\n frames.push(frame);\n } // skip frame header and frame data\n\n\n offset += frameData.size + 10;\n }\n\n if (ID3.isFooter(id3Data, offset)) {\n offset += 10;\n }\n }\n\n return frames;\n };\n\n ID3._decodeFrame = function _decodeFrame(frame) {\n if (frame.type === 'PRIV') {\n return ID3._decodePrivFrame(frame);\n } else if (frame.type[0] === 'T') {\n return ID3._decodeTextFrame(frame);\n } else if (frame.type[0] === 'W') {\n return ID3._decodeURLFrame(frame);\n }\n\n return undefined;\n };\n\n ID3._readTimeStamp = function _readTimeStamp(timeStampFrame) {\n if (timeStampFrame.data.byteLength === 8) {\n var data = new Uint8Array(timeStampFrame.data); // timestamp is 33 bit expressed as a big-endian eight-octet number,\n // with the upper 31 bits set to zero.\n\n var pts33Bit = data[3] & 0x1;\n var timestamp = (data[4] << 23) + (data[5] << 15) + (data[6] << 7) + data[7];\n timestamp /= 45;\n\n if (pts33Bit) {\n timestamp += 47721858.84;\n } // 2^32 / 90\n\n\n return Math.round(timestamp);\n }\n\n return undefined;\n };\n\n ID3._decodePrivFrame = function _decodePrivFrame(frame) {\n /*\n Format: <text string>\\0<binary data>\n */\n if (frame.size < 2) {\n return undefined;\n }\n\n var owner = ID3._utf8ArrayToStr(frame.data, true);\n\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\n ID3._decodeTextFrame = function _decodeTextFrame(frame) {\n if (frame.size < 2) {\n return undefined;\n }\n\n if (frame.type === 'TXXX') {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Description}\\0{Value}\n */\n var index = 1;\n\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index), true);\n\n index += description.length + 1;\n\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return {\n key: frame.type,\n info: description,\n data: value\n };\n } else {\n /*\n Format:\n [0] = {Text Encoding}\n [1-?] = {Value}\n */\n var text = ID3._utf8ArrayToStr(frame.data.subarray(1));\n\n return {\n key: frame.type,\n data: text\n };\n }\n };\n\n ID3._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\n var index = 1;\n\n var description = ID3._utf8ArrayToStr(frame.data.subarray(index), true);\n\n index += description.length + 1;\n\n var value = ID3._utf8ArrayToStr(frame.data.subarray(index));\n\n return {\n key: frame.type,\n info: description,\n data: value\n };\n } else {\n /*\n Format:\n [0-?] = {URL}\n */\n var url = ID3._utf8ArrayToStr(frame.data);\n\n return {\n key: frame.type,\n data: url\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\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 ;\n\n ID3._utf8ArrayToStr = function _utf8ArrayToStr(array, exitOnNull) {\n if (exitOnNull === void 0) {\n exitOnNull = false;\n }\n\n var decoder = getTextDecoder();\n\n if (decoder) {\n var decoded = decoder.decode(array);\n\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 } // remove any null characters\n\n\n return decoded.replace(/\\0/g, '');\n }\n\n var len = array.length;\n var c;\n var char2;\n var char3;\n var out = '';\n var i = 0;\n\n while (i < len) {\n c = array[i++];\n\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\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\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\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 default:\n }\n }\n\n return out;\n };\n\n return ID3;\n}();\n\nvar decoder;\n\nfunction getTextDecoder() {\n var global = Object(_utils_get_self_scope__WEBPACK_IMPORTED_MODULE_0__[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\n if (!decoder && typeof global.TextDecoder !== 'undefined') {\n decoder = new global.TextDecoder('utf-8');\n }\n\n return decoder;\n}\n\nvar utf8ArrayToStr = ID3._utf8ArrayToStr;\n/* harmony default export */ __webpack_exports__[\"default\"] = (ID3);\n\n\n/***/ }),\n\n/***/ \"./src/demux/mp4demuxer.js\":\n/*!*********************************!*\\\n !*** ./src/demux/mp4demuxer.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events */ \"./src/events.js\");\n/**\n * MP4 demuxer\n */\n\n\nvar UINT32_MAX = Math.pow(2, 32) - 1;\n\nvar MP4Demuxer = /*#__PURE__*/function () {\n function MP4Demuxer(observer, remuxer) {\n this.observer = observer;\n this.remuxer = remuxer;\n }\n\n var _proto = MP4Demuxer.prototype;\n\n _proto.resetTimeStamp = function resetTimeStamp(initPTS) {\n this.initPTS = initPTS;\n };\n\n _proto.resetInitSegment = function resetInitSegment(initSegment, audioCodec, videoCodec, duration) {\n // jshint unused:false\n if (initSegment && initSegment.byteLength) {\n var initData = this.initData = MP4Demuxer.parseInitSegment(initSegment); // default audio codec if nothing specified\n // TODO : extract that from initsegment\n\n if (audioCodec == null) {\n audioCodec = 'mp4a.40.5';\n }\n\n if (videoCodec == null) {\n videoCodec = 'avc1.42e01e';\n }\n\n var tracks = {};\n\n if (initData.audio && initData.video) {\n tracks.audiovideo = {\n container: 'video/mp4',\n codec: audioCodec + ',' + videoCodec,\n initSegment: duration ? initSegment : null\n };\n } else {\n if (initData.audio) {\n tracks.audio = {\n container: 'audio/mp4',\n codec: audioCodec,\n initSegment: duration ? initSegment : null\n };\n }\n\n if (initData.video) {\n tracks.video = {\n container: 'video/mp4',\n codec: videoCodec,\n initSegment: duration ? initSegment : null\n };\n }\n }\n\n this.observer.trigger(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].FRAG_PARSING_INIT_SEGMENT, {\n tracks: tracks\n });\n } else {\n if (audioCodec) {\n this.audioCodec = audioCodec;\n }\n\n if (videoCodec) {\n this.videoCodec = videoCodec;\n }\n }\n };\n\n MP4Demuxer.probe = function probe(data) {\n // ensure we find a moof box in the first 16 kB\n return MP4Demuxer.findBox({\n data: data,\n start: 0,\n end: Math.min(data.length, 16384)\n }, ['moof']).length > 0;\n };\n\n MP4Demuxer.bin2str = function bin2str(buffer) {\n return String.fromCharCode.apply(null, buffer);\n };\n\n MP4Demuxer.readUint16 = function readUint16(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 8 | buffer[offset + 1];\n return val < 0 ? 65536 + val : val;\n };\n\n MP4Demuxer.readUint32 = function readUint32(buffer, offset) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\n var val = buffer[offset] << 24 | buffer[offset + 1] << 16 | buffer[offset + 2] << 8 | buffer[offset + 3];\n return val < 0 ? 4294967296 + val : val;\n };\n\n MP4Demuxer.writeUint32 = function writeUint32(buffer, offset, value) {\n if (buffer.data) {\n offset += buffer.start;\n buffer = buffer.data;\n }\n\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 } // Find the data for a box specified by its path\n ;\n\n MP4Demuxer.findBox = function findBox(data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults,\n start,\n endbox;\n\n if (data.data) {\n start = data.start;\n end = data.end;\n data = data.data;\n } else {\n start = 0;\n end = data.byteLength;\n }\n\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n\n for (i = start; i < end;) {\n size = MP4Demuxer.readUint32(data, i);\n type = MP4Demuxer.bin2str(data.subarray(i + 4, i + 8));\n endbox = size > 1 ? i + size : end;\n\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({\n data: data,\n start: i + 8,\n end: endbox\n });\n } else {\n // recursively search for the next box along the path\n subresults = MP4Demuxer.findBox({\n data: data,\n start: i + 8,\n end: endbox\n }, path.slice(1));\n\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n\n i = endbox;\n } // we've finished searching all of data\n\n\n return results;\n };\n\n MP4Demuxer.parseSegmentIndex = function parseSegmentIndex(initSegment) {\n var moov = MP4Demuxer.findBox(initSegment, ['moov'])[0];\n var moovEndOffset = moov ? moov.end : null; // we need this in case we need to chop of garbage of the end of current data\n\n var index = 0;\n var sidx = MP4Demuxer.findBox(initSegment, ['sidx']);\n var references;\n\n if (!sidx || !sidx[0]) {\n return null;\n }\n\n references = [];\n sidx = sidx[0];\n var version = sidx.data[0]; // set initial offset, we skip the reference ID (not needed)\n\n index = version === 0 ? 8 : 16;\n var timescale = MP4Demuxer.readUint32(sidx, index);\n index += 4; // TODO: parse earliestPresentationTime and firstOffset\n // usually zero in our case\n\n var earliestPresentationTime = 0;\n var firstOffset = 0;\n\n if (version === 0) {\n index += 8;\n } else {\n index += 16;\n } // skip reserved\n\n\n index += 2;\n var startByte = sidx.end + firstOffset;\n var referencesCount = MP4Demuxer.readUint16(sidx, index);\n index += 2;\n\n for (var i = 0; i < referencesCount; i++) {\n var referenceIndex = index;\n var referenceInfo = MP4Demuxer.readUint32(sidx, referenceIndex);\n referenceIndex += 4;\n var referenceSize = referenceInfo & 0x7FFFFFFF;\n var referenceType = (referenceInfo & 0x80000000) >>> 31;\n\n if (referenceType === 1) {\n console.warn('SIDX has hierarchical references (not supported)');\n return;\n }\n\n var subsegmentDuration = MP4Demuxer.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; // Skipping 1 bit for |startsWithSap|, 3 bits for |sapType|, and 28 bits\n // for |sapDelta|.\n\n referenceIndex += 4; // skip to next ref\n\n index = referenceIndex;\n }\n\n return {\n earliestPresentationTime: earliestPresentationTime,\n timescale: timescale,\n version: version,\n referencesCount: referencesCount,\n references: references,\n moovEndOffset: moovEndOffset\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 init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track type to timescale values or null if\n * the init segment is malformed.\n */\n ;\n\n MP4Demuxer.parseInitSegment = function parseInitSegment(initSegment) {\n var result = [];\n var traks = MP4Demuxer.findBox(initSegment, ['moov', 'trak']);\n traks.forEach(function (trak) {\n var tkhd = MP4Demuxer.findBox(trak, ['tkhd'])[0];\n\n if (tkhd) {\n var version = tkhd.data[tkhd.start];\n var index = version === 0 ? 12 : 20;\n var trackId = MP4Demuxer.readUint32(tkhd, index);\n var mdhd = MP4Demuxer.findBox(trak, ['mdia', 'mdhd'])[0];\n\n if (mdhd) {\n version = mdhd.data[mdhd.start];\n index = version === 0 ? 12 : 20;\n var timescale = MP4Demuxer.readUint32(mdhd, index);\n var hdlr = MP4Demuxer.findBox(trak, ['mdia', 'hdlr'])[0];\n\n if (hdlr) {\n var hdlrType = MP4Demuxer.bin2str(hdlr.data.subarray(hdlr.start + 8, hdlr.start + 12));\n var type = {\n 'soun': 'audio',\n 'vide': 'video'\n }[hdlrType];\n\n if (type) {\n // extract codec info. TODO : parse codec details to be able to build MIME type\n var codecBox = MP4Demuxer.findBox(trak, ['mdia', 'minf', 'stbl', 'stsd']);\n\n if (codecBox.length) {\n codecBox = codecBox[0];\n var codecType = MP4Demuxer.bin2str(codecBox.data.subarray(codecBox.start + 12, codecBox.start + 16));\n _utils_logger__WEBPACK_IMPORTED_MODULE_0__[\"logger\"].log(\"MP4Demuxer:\" + type + \":\" + codecType + \" found\");\n }\n\n result[trackId] = {\n timescale: timescale,\n type: type\n };\n result[type] = {\n timescale: timescale,\n id: trackId\n };\n }\n }\n }\n }\n });\n return result;\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 timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n ;\n\n MP4Demuxer.getStartDTS = function getStartDTS(initData, fragment) {\n var trafs, baseTimes, result; // we need info from two childrend of each track fragment box\n\n trafs = MP4Demuxer.findBox(fragment, ['moof', 'traf']); // determine the start times for each track\n\n baseTimes = [].concat.apply([], trafs.map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n var id, scale, baseTime; // get the track id from the tfhd\n\n id = MP4Demuxer.readUint32(tfhd, 4); // assume a 90kHz clock if no timescale was specified\n\n scale = initData[id].timescale || 90e3; // get the base media decode time from the tfdt\n\n baseTime = MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version, result;\n version = tfdt.data[tfdt.start];\n result = MP4Demuxer.readUint32(tfdt, 4);\n\n if (version === 1) {\n result *= Math.pow(2, 32);\n result += MP4Demuxer.readUint32(tfdt, 8);\n }\n\n return result;\n })[0]; // convert base time to seconds\n\n return baseTime / scale;\n });\n })); // return the minimum\n\n result = Math.min.apply(null, baseTimes);\n return isFinite(result) ? result : 0;\n };\n\n MP4Demuxer.offsetStartDTS = function offsetStartDTS(initData, fragment, timeOffset) {\n MP4Demuxer.findBox(fragment, ['moof', 'traf']).map(function (traf) {\n return MP4Demuxer.findBox(traf, ['tfhd']).map(function (tfhd) {\n // get the track id from the tfhd\n var id = MP4Demuxer.readUint32(tfhd, 4); // assume a 90kHz clock if no timescale was specified\n\n var timescale = initData[id].timescale || 90e3; // get the base media decode time from the tfdt\n\n MP4Demuxer.findBox(traf, ['tfdt']).map(function (tfdt) {\n var version = tfdt.data[tfdt.start];\n var baseMediaDecodeTime = MP4Demuxer.readUint32(tfdt, 4);\n\n if (version === 0) {\n MP4Demuxer.writeUint32(tfdt, 4, baseMediaDecodeTime - timeOffset * timescale);\n } else {\n baseMediaDecodeTime *= Math.pow(2, 32);\n baseMediaDecodeTime += MP4Demuxer.readUint32(tfdt, 8);\n baseMediaDecodeTime -= timeOffset * timescale;\n baseMediaDecodeTime = Math.max(baseMediaDecodeTime, 0);\n var upper = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1));\n var lower = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1));\n MP4Demuxer.writeUint32(tfdt, 4, upper);\n MP4Demuxer.writeUint32(tfdt, 8, lower);\n }\n });\n });\n });\n } // feed incoming data to the front of the parsing pipeline\n ;\n\n _proto.append = function append(data, timeOffset, contiguous, accurateTimeOffset) {\n var initData = this.initData;\n\n if (!initData) {\n this.resetInitSegment(data, this.audioCodec, this.videoCodec, false);\n initData = this.initData;\n }\n\n var startDTS,\n initPTS = this.initPTS;\n\n if (initPTS === undefined) {\n var _startDTS = MP4Demuxer.getStartDTS(initData, data);\n\n this.initPTS = initPTS = _startDTS - timeOffset;\n this.observer.trigger(_events__WEBPACK_IMPORTED_MODULE_1__[\"default\"].INIT_PTS_FOUND, {\n initPTS: initPTS\n });\n }\n\n MP4Demuxer.offsetStartDTS(initData, data, initPTS);\n startDTS = MP4Demuxer.getStartDTS(initData, data);\n this.remuxer.remux(initData.audio, initData.video, null, null, startDTS, contiguous, accurateTimeOffset, data);\n };\n\n _proto.destroy = function destroy() {};\n\n return MP4Demuxer;\n}();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (MP4Demuxer);\n\n/***/ }),\n\n/***/ \"./src/errors.ts\":\n/*!***********************!*\\\n !*** ./src/errors.ts ***!\n \\***********************/\n/*! exports provided: ErrorTypes, ErrorDetails */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ErrorTypes\", function() { return ErrorTypes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ErrorDetails\", function() { return ErrorDetails; });\nvar ErrorTypes;\n/**\n * @enum {ErrorDetails}\n * @typedef {string} ErrorDetail\n */\n\n(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})(ErrorTypes || (ErrorTypes = {}));\n\nvar ErrorDetails;\n\n(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_LICENSE_REQUEST_FAILED\"] = \"keySystemLicenseRequestFailed\";\n ErrorDetails[\"KEY_SYSTEM_NO_INIT_DATA\"] = \"keySystemNoInitData\";\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_SWITCH_ERROR\"] = \"levelSwitchError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_ERROR\"] = \"audioTrackLoadError\";\n ErrorDetails[\"AUDIO_TRACK_LOAD_TIMEOUT\"] = \"audioTrackLoadTimeOut\";\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[\"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_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 || (ErrorDetails = {}));\n\n/***/ }),\n\n/***/ \"./src/events.js\":\n/*!***********************!*\\\n !*** ./src/events.js ***!\n \\***********************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/**\n * @readonly\n * @enum {string}\n */\nvar HlsEvents = {\n // fired before MediaSource is attaching to media element - data: { media }\n MEDIA_ATTACHING: 'hlsMediaAttaching',\n // fired when MediaSource has been succesfully attached to media element - data: { }\n MEDIA_ATTACHED: 'hlsMediaAttached',\n // fired before detaching MediaSource from media element - data: { }\n MEDIA_DETACHING: 'hlsMediaDetaching',\n // fired when MediaSource has been detached from media element - data: { }\n MEDIA_DETACHED: 'hlsMediaDetached',\n // fired when we buffer is going to be reset - data: { }\n BUFFER_RESET: 'hlsBufferReset',\n // fired when we know about the codecs that we need buffers for to push into - data: {tracks : { container, codec, levelCodec, initSegment, metadata }}\n BUFFER_CODECS: 'hlsBufferCodecs',\n // fired when sourcebuffers have been created - data: { tracks : tracks }\n BUFFER_CREATED: 'hlsBufferCreated',\n // fired when we append a segment to the buffer - data: { segment: segment object }\n BUFFER_APPENDING: 'hlsBufferAppending',\n // fired when we are done with appending a media segment to the buffer - data : { parent : segment parent that triggered BUFFER_APPENDING, pending : nb of segments waiting for appending for this segment parent}\n BUFFER_APPENDED: 'hlsBufferAppended',\n // fired when the stream is finished and we want to notify the media buffer that there will be no more data - data: { }\n BUFFER_EOS: 'hlsBufferEos',\n // fired when the media buffer should be flushed - data { startOffset, endOffset }\n BUFFER_FLUSHING: 'hlsBufferFlushing',\n // fired when the media buffer has been flushed - data: { }\n BUFFER_FLUSHED: 'hlsBufferFlushed',\n // fired to signal that a manifest loading starts - data: { url : manifestURL}\n MANIFEST_LOADING: 'hlsManifestLoading',\n // fired after manifest has been loaded - data: { levels : [available quality levels], audioTracks : [ available audio tracks], url : manifestURL, stats : { trequest, tfirst, tload, mtime}}\n MANIFEST_LOADED: 'hlsManifestLoaded',\n // fired after manifest has been parsed - data: { levels : [available quality levels], firstLevel : index of first quality level appearing in Manifest}\n MANIFEST_PARSED: 'hlsManifestParsed',\n // fired when a level switch is requested - data: { level : id of new level }\n LEVEL_SWITCHING: 'hlsLevelSwitching',\n // fired when a level switch is effective - data: { level : id of new level }\n LEVEL_SWITCHED: 'hlsLevelSwitched',\n // fired when a level playlist loading starts - data: { url : level URL, level : id of level being loaded}\n LEVEL_LOADING: 'hlsLevelLoading',\n // fired when a level playlist loading finishes - data: { details : levelDetails object, level : id of loaded level, stats : { trequest, tfirst, tload, mtime} }\n LEVEL_LOADED: 'hlsLevelLoaded',\n // fired when a level's details have been updated based on previous details, after it has been loaded - data: { details : levelDetails object, level : id of updated level }\n LEVEL_UPDATED: 'hlsLevelUpdated',\n // fired when a level's PTS information has been updated after parsing a fragment - data: { details : levelDetails object, level : id of updated level, drift: PTS drift observed when parsing last fragment }\n LEVEL_PTS_UPDATED: 'hlsLevelPtsUpdated',\n // fired to notify that levels have changed after removing a level - data: { levels : [available quality levels] }\n LEVELS_UPDATED: 'hlsLevelsUpdated',\n // fired to notify that audio track lists has been updated - data: { audioTracks : audioTracks }\n AUDIO_TRACKS_UPDATED: 'hlsAudioTracksUpdated',\n // fired when an audio track switching is requested - data: { id : audio track id }\n AUDIO_TRACK_SWITCHING: 'hlsAudioTrackSwitching',\n // fired when an audio track switch actually occurs - data: { id : audio track id }\n AUDIO_TRACK_SWITCHED: 'hlsAudioTrackSwitched',\n // fired when an audio track loading starts - data: { url : audio track URL, id : audio track id }\n AUDIO_TRACK_LOADING: 'hlsAudioTrackLoading',\n // fired when an audio track loading finishes - data: { details : levelDetails object, id : audio track id, stats : { trequest, tfirst, tload, mtime } }\n AUDIO_TRACK_LOADED: 'hlsAudioTrackLoaded',\n // fired to notify that subtitle track lists has been updated - data: { subtitleTracks : subtitleTracks }\n SUBTITLE_TRACKS_UPDATED: 'hlsSubtitleTracksUpdated',\n // fired when an subtitle track switch occurs - data: { id : subtitle track id }\n SUBTITLE_TRACK_SWITCH: 'hlsSubtitleTrackSwitch',\n // fired when a subtitle track loading starts - data: { url : subtitle track URL, id : subtitle track id }\n SUBTITLE_TRACK_LOADING: 'hlsSubtitleTrackLoading',\n // fired when a subtitle track loading finishes - data: { details : levelDetails object, id : subtitle track id, stats : { trequest, tfirst, tload, mtime } }\n SUBTITLE_TRACK_LOADED: 'hlsSubtitleTrackLoaded',\n // fired when a subtitle fragment has been processed - data: { success : boolean, frag : the processed frag }\n SUBTITLE_FRAG_PROCESSED: 'hlsSubtitleFragProcessed',\n // fired when a set of VTTCues to be managed externally has been parsed - data: { type: string, track: string, cues: [ VTTCue ] }\n CUES_PARSED: 'hlsCuesParsed',\n // fired when a text track to be managed externally is found - data: { tracks: [ { label: string, kind: string, default: boolean } ] }\n NON_NATIVE_TEXT_TRACKS_FOUND: 'hlsNonNativeTextTracksFound',\n // fired when the first timestamp is found - data: { id : demuxer id, initPTS: initPTS, frag : fragment object }\n INIT_PTS_FOUND: 'hlsInitPtsFound',\n // fired when a fragment loading starts - data: { frag : fragment object }\n FRAG_LOADING: 'hlsFragLoading',\n // fired when a fragment loading is progressing - data: { frag : fragment object, { trequest, tfirst, loaded } }\n FRAG_LOAD_PROGRESS: 'hlsFragLoadProgress',\n // Identifier for fragment load aborting for emergency switch down - data: { frag : fragment object }\n FRAG_LOAD_EMERGENCY_ABORTED: 'hlsFragLoadEmergencyAborted',\n // fired when a fragment loading is completed - data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length } }\n FRAG_LOADED: 'hlsFragLoaded',\n // fired when a fragment has finished decrypting - data: { id : demuxer id, frag: fragment object, payload : fragment payload, stats : { tstart, tdecrypt } }\n FRAG_DECRYPTED: 'hlsFragDecrypted',\n // fired when Init Segment has been extracted from fragment - data: { id : demuxer id, frag: fragment object, moov : moov MP4 box, codecs : codecs found while parsing fragment }\n FRAG_PARSING_INIT_SEGMENT: 'hlsFragParsingInitSegment',\n // fired when parsing sei text is completed - data: { id : demuxer id, frag: fragment object, samples : [ sei samples pes ] }\n FRAG_PARSING_USERDATA: 'hlsFragParsingUserdata',\n // fired when parsing id3 is completed - data: { id : demuxer id, frag: fragment object, samples : [ id3 samples pes ] }\n FRAG_PARSING_METADATA: 'hlsFragParsingMetadata',\n // fired when data have been extracted from fragment - data: { id : demuxer id, frag: fragment object, data1 : moof MP4 box or TS fragments, data2 : mdat MP4 box or null}\n FRAG_PARSING_DATA: 'hlsFragParsingData',\n // fired when fragment parsing is completed - data: { id : demuxer id, frag: fragment object }\n FRAG_PARSED: 'hlsFragParsed',\n // fired when fragment remuxed MP4 boxes have all been appended into SourceBuffer - data: { id : demuxer id, frag : fragment object, stats : { trequest, tfirst, tload, tparsed, tbuffered, length, bwEstimate } }\n FRAG_BUFFERED: 'hlsFragBuffered',\n // fired when fragment matching with current media position is changing - data : { id : demuxer id, frag : fragment object }\n FRAG_CHANGED: 'hlsFragChanged',\n // Identifier for a FPS drop event - data: { curentDropped, currentDecoded, totalDroppedFrames }\n FPS_DROP: 'hlsFpsDrop',\n // triggered when FPS drop triggers auto level capping - data: { level, droppedlevel }\n FPS_DROP_LEVEL_CAPPING: 'hlsFpsDropLevelCapping',\n // Identifier for an error event - data: { type : error type, details : error details, fatal : if true, hls.js cannot/will not try to recover, if false, hls.js will try to recover,other error specific data }\n ERROR: 'hlsError',\n // fired when hls.js instance starts destroying. Different from MEDIA_DETACHED as one could want to detach and reattach a media to the instance of hls.js to handle mid-rolls for example - data: { }\n DESTROYING: 'hlsDestroying',\n // fired when a decrypt key loading starts - data: { frag : fragment object }\n KEY_LOADING: 'hlsKeyLoading',\n // fired when a decrypt key loading is completed - data: { frag : fragment object, payload : key payload, stats : { trequest, tfirst, tload, length } }\n KEY_LOADED: 'hlsKeyLoaded',\n // fired upon stream controller state transitions - data: { previousState, nextState }\n STREAM_STATE_TRANSITION: 'hlsStreamStateTransition',\n // fired when the live back buffer is reached defined by the liveBackBufferLength config option - data : { bufferEnd: number }\n LIVE_BACK_BUFFER_REACHED: 'hlsLiveBackBufferReached'\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (HlsEvents);\n\n/***/ }),\n\n/***/ \"./src/hls.ts\":\n/*!*********************************!*\\\n !*** ./src/hls.ts + 50 modules ***!\n \\*********************************/\n/*! exports provided: default */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/crypt/decrypter.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/demuxer-inline.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/id3.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/demux/mp4demuxer.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/errors.ts because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/events.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/polyfills/number.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/get-self-scope.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/logger.js because of ./src/demux/demuxer-worker.js */\n/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/eventemitter3/index.js (<- Module is not an ECMAScript module) */\n/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/url-toolkit/src/url-toolkit.js (<- Module is not an ECMAScript module) */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, \"default\", function() { return /* binding */ hls_Hls; });\n\n// NAMESPACE OBJECT: ./src/utils/cues.ts\nvar cues_namespaceObject = {};\n__webpack_require__.r(cues_namespaceObject);\n__webpack_require__.d(cues_namespaceObject, \"newCue\", function() { return newCue; });\n\n// EXTERNAL MODULE: ./node_modules/url-toolkit/src/url-toolkit.js\nvar url_toolkit = __webpack_require__(\"./node_modules/url-toolkit/src/url-toolkit.js\");\n\n// EXTERNAL MODULE: ./src/errors.ts\nvar errors = __webpack_require__(\"./src/errors.ts\");\n\n// EXTERNAL MODULE: ./src/polyfills/number.js\nvar number = __webpack_require__(\"./src/polyfills/number.js\");\n\n// EXTERNAL MODULE: ./src/events.js\nvar events = __webpack_require__(\"./src/events.js\");\n\n// EXTERNAL MODULE: ./src/utils/logger.js\nvar logger = __webpack_require__(\"./src/utils/logger.js\");\n\n// CONCATENATED MODULE: ./src/event-handler.ts\n/*\n*\n* All objects in the event handling chain should inherit from this class\n*\n*/\n\n\n\nvar FORBIDDEN_EVENT_NAMES = {\n 'hlsEventGeneric': true,\n 'hlsHandlerDestroying': true,\n 'hlsHandlerDestroyed': true\n};\n\nvar event_handler_EventHandler = /*#__PURE__*/function () {\n function EventHandler(hls) {\n this.hls = void 0;\n this.handledEvents = void 0;\n this.useGenericHandler = void 0;\n this.hls = hls;\n this.onEvent = this.onEvent.bind(this);\n\n for (var _len = arguments.length, events = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n this.handledEvents = events;\n this.useGenericHandler = true;\n this.registerListeners();\n }\n\n var _proto = EventHandler.prototype;\n\n _proto.destroy = function destroy() {\n this.onHandlerDestroying();\n this.unregisterListeners();\n this.onHandlerDestroyed();\n };\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {};\n\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {};\n\n _proto.isEventHandler = function isEventHandler() {\n return typeof this.handledEvents === 'object' && this.handledEvents.length && typeof this.onEvent === 'function';\n };\n\n _proto.registerListeners = function registerListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n if (FORBIDDEN_EVENT_NAMES[event]) {\n throw new Error('Forbidden event-name: ' + event);\n }\n\n this.hls.on(event, this.onEvent);\n }, this);\n }\n };\n\n _proto.unregisterListeners = function unregisterListeners() {\n if (this.isEventHandler()) {\n this.handledEvents.forEach(function (event) {\n this.hls.off(event, this.onEvent);\n }, this);\n }\n }\n /**\n * arguments: event (string), data (any)\n */\n ;\n\n _proto.onEvent = function onEvent(event, data) {\n this.onEventGeneric(event, data);\n };\n\n _proto.onEventGeneric = function onEventGeneric(event, data) {\n var eventToFunction = function eventToFunction(event, data) {\n var funcName = 'on' + event.replace('hls', '');\n\n if (typeof this[funcName] !== 'function') {\n throw new Error(\"Event \" + event + \" has no generic handler in this \" + this.constructor.name + \" class (tried \" + funcName + \")\");\n }\n\n return this[funcName].bind(this, data);\n };\n\n try {\n eventToFunction.call(this, event, data).call();\n } catch (err) {\n logger[\"logger\"].error(\"An internal error happened while handling event \" + event + \". Error message: \\\"\" + err.message + \"\\\". Here is a stacktrace:\", err);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].INTERNAL_EXCEPTION,\n fatal: false,\n event: event,\n err: err\n });\n }\n };\n\n return EventHandler;\n}();\n\n/* harmony default export */ var event_handler = (event_handler_EventHandler);\n// CONCATENATED MODULE: ./src/types/loader.ts\n/**\n * `type` property values for this loaders' context object\n * @enum\n *\n */\nvar PlaylistContextType;\n/**\n * @enum {string}\n */\n\n(function (PlaylistContextType) {\n PlaylistContextType[\"MANIFEST\"] = \"manifest\";\n PlaylistContextType[\"LEVEL\"] = \"level\";\n PlaylistContextType[\"AUDIO_TRACK\"] = \"audioTrack\";\n PlaylistContextType[\"SUBTITLE_TRACK\"] = \"subtitleTrack\";\n})(PlaylistContextType || (PlaylistContextType = {}));\n\nvar PlaylistLevelType;\n\n(function (PlaylistLevelType) {\n PlaylistLevelType[\"MAIN\"] = \"main\";\n PlaylistLevelType[\"AUDIO\"] = \"audio\";\n PlaylistLevelType[\"SUBTITLE\"] = \"subtitle\";\n})(PlaylistLevelType || (PlaylistLevelType = {}));\n// EXTERNAL MODULE: ./src/demux/mp4demuxer.js\nvar mp4demuxer = __webpack_require__(\"./src/demux/mp4demuxer.js\");\n\n// CONCATENATED MODULE: ./src/loader/level-key.ts\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\nvar level_key_LevelKey = /*#__PURE__*/function () {\n function LevelKey(baseURI, relativeURI) {\n this._uri = null;\n this.baseuri = void 0;\n this.reluri = void 0;\n this.method = null;\n this.key = null;\n this.iv = null;\n this.baseuri = baseURI;\n this.reluri = relativeURI;\n }\n\n _createClass(LevelKey, [{\n key: \"uri\",\n get: function get() {\n if (!this._uri && this.reluri) {\n this._uri = Object(url_toolkit[\"buildAbsoluteURL\"])(this.baseuri, this.reluri, {\n alwaysNormalize: true\n });\n }\n\n return this._uri;\n }\n }]);\n\n return LevelKey;\n}();\n\n\n// CONCATENATED MODULE: ./src/loader/fragment.ts\n\n\n\nfunction fragment_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction fragment_createClass(Constructor, protoProps, staticProps) { if (protoProps) fragment_defineProperties(Constructor.prototype, protoProps); if (staticProps) fragment_defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\nvar ElementaryStreamTypes;\n\n(function (ElementaryStreamTypes) {\n ElementaryStreamTypes[\"AUDIO\"] = \"audio\";\n ElementaryStreamTypes[\"VIDEO\"] = \"video\";\n})(ElementaryStreamTypes || (ElementaryStreamTypes = {}));\n\nvar fragment_Fragment = /*#__PURE__*/function () {\n function Fragment() {\n var _this$_elementaryStre;\n\n this._url = null;\n this._byteRange = null;\n this._decryptdata = null;\n this._elementaryStreams = (_this$_elementaryStre = {}, _this$_elementaryStre[ElementaryStreamTypes.AUDIO] = false, _this$_elementaryStre[ElementaryStreamTypes.VIDEO] = false, _this$_elementaryStre);\n this.deltaPTS = 0;\n this.rawProgramDateTime = null;\n this.programDateTime = null;\n this.title = null;\n this.tagList = [];\n this.cc = void 0;\n this.type = void 0;\n this.relurl = void 0;\n this.baseurl = void 0;\n this.duration = void 0;\n this.start = void 0;\n this.sn = 0;\n this.urlId = 0;\n this.level = 0;\n this.levelkey = void 0;\n this.loader = void 0;\n }\n\n var _proto = Fragment.prototype;\n\n // setByteRange converts a EXT-X-BYTERANGE attribute into a two element array\n _proto.setByteRange = function setByteRange(value, previousFrag) {\n var params = value.split('@', 2);\n var byteRange = [];\n\n if (params.length === 1) {\n byteRange[0] = previousFrag ? previousFrag.byteRangeEndOffset : 0;\n } else {\n byteRange[0] = parseInt(params[1]);\n }\n\n byteRange[1] = parseInt(params[0]) + byteRange[0];\n this._byteRange = byteRange;\n };\n\n /**\n * @param {ElementaryStreamTypes} type\n */\n _proto.addElementaryStream = function addElementaryStream(type) {\n this._elementaryStreams[type] = true;\n }\n /**\n * @param {ElementaryStreamTypes} type\n */\n ;\n\n _proto.hasElementaryStream = function hasElementaryStream(type) {\n return this._elementaryStreams[type] === true;\n }\n /**\n * Utility method for parseLevelPlaylist to create an initialization vector for a given segment\n * @param {number} segmentNumber - segment number to generate IV with\n * @returns {Uint8Array}\n */\n ;\n\n _proto.createInitializationVector = function createInitializationVector(segmentNumber) {\n var uint8View = new Uint8Array(16);\n\n for (var i = 12; i < 16; i++) {\n uint8View[i] = segmentNumber >> 8 * (15 - i) & 0xff;\n }\n\n return uint8View;\n }\n /**\n * Utility method for parseLevelPlaylist to get a fragment's decryption data from the currently parsed encryption key data\n * @param levelkey - a playlist's encryption info\n * @param segmentNumber - the fragment's segment number\n * @returns {LevelKey} - an object to be applied as a fragment's decryptdata\n */\n ;\n\n _proto.setDecryptDataFromLevelKey = function setDecryptDataFromLevelKey(levelkey, segmentNumber) {\n var decryptdata = levelkey;\n\n if ((levelkey === null || levelkey === void 0 ? void 0 : levelkey.method) && levelkey.uri && !levelkey.iv) {\n decryptdata = new level_key_LevelKey(levelkey.baseuri, levelkey.reluri);\n decryptdata.method = levelkey.method;\n decryptdata.iv = this.createInitializationVector(segmentNumber);\n }\n\n return decryptdata;\n };\n\n fragment_createClass(Fragment, [{\n key: \"url\",\n get: function get() {\n if (!this._url && this.relurl) {\n this._url = Object(url_toolkit[\"buildAbsoluteURL\"])(this.baseurl, this.relurl, {\n alwaysNormalize: true\n });\n }\n\n return this._url;\n },\n set: function set(value) {\n this._url = value;\n }\n }, {\n key: \"byteRange\",\n get: function get() {\n if (!this._byteRange) {\n return [];\n }\n\n return this._byteRange;\n }\n /**\n * @type {number}\n */\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: \"decryptdata\",\n get: function get() {\n if (!this.levelkey && !this._decryptdata) {\n return null;\n }\n\n if (!this._decryptdata && this.levelkey) {\n var sn = this.sn;\n\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.levelkey && this.levelkey.method === 'AES-128' && !this.levelkey.iv) {\n logger[\"logger\"].warn(\"missing IV for initialization segment with method=\\\"\" + this.levelkey.method + \"\\\" - compliance issue\");\n }\n /*\n Be converted to a Number.\n 'initSegment' will become NaN.\n NaN, which when converted through ToInt32() -> +0.\n ---\n Explicitly set sn to resulting value from implicit conversions 'initSegment' values for IV generation.\n */\n\n\n sn = 0;\n }\n\n this._decryptdata = this.setDecryptDataFromLevelKey(this.levelkey, sn);\n }\n\n return this._decryptdata;\n }\n }, {\n key: \"endProgramDateTime\",\n get: function get() {\n if (this.programDateTime === null) {\n return null;\n }\n\n if (!Object(number[\"isFiniteNumber\"])(this.programDateTime)) {\n return null;\n }\n\n var duration = !Object(number[\"isFiniteNumber\"])(this.duration) ? 0 : this.duration;\n return this.programDateTime + duration * 1000;\n }\n }, {\n key: \"encrypted\",\n get: function get() {\n return !!(this.decryptdata && this.decryptdata.uri !== null && this.decryptdata.key === null);\n }\n }]);\n\n return Fragment;\n}();\n\n\n// CONCATENATED MODULE: ./src/loader/level.js\n\n\nfunction level_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction level_createClass(Constructor, protoProps, staticProps) { if (protoProps) level_defineProperties(Constructor.prototype, protoProps); if (staticProps) level_defineProperties(Constructor, staticProps); return Constructor; }\n\nvar level_Level = /*#__PURE__*/function () {\n function Level(baseUrl) {\n // Please keep properties in alphabetical order\n this.endCC = 0;\n this.endSN = 0;\n this.fragments = [];\n this.initSegment = null;\n this.live = true;\n this.needSidxRanges = false;\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 = baseUrl;\n this.version = null;\n }\n\n level_createClass(Level, [{\n key: \"hasProgramDateTime\",\n get: function get() {\n return !!(this.fragments[0] && Object(number[\"isFiniteNumber\"])(this.fragments[0].programDateTime));\n }\n }]);\n\n return Level;\n}();\n\n\n// CONCATENATED MODULE: ./src/utils/attr-list.js\nvar DECIMAL_RESOLUTION_REGEX = /^(\\d+)x(\\d+)$/; // eslint-disable-line no-useless-escape\n\nvar ATTR_LIST_REGEX = /\\s*(.+?)\\s*=((?:\\\".*?\\\")|.*?)(?:,|$)/g; // eslint-disable-line no-useless-escape\n// adapted from https://github.com/kanongil/node-m3u8parse/blob/master/attrlist.js\n\nvar AttrList = /*#__PURE__*/function () {\n function AttrList(attrs) {\n if (typeof attrs === 'string') {\n attrs = AttrList.parseAttrList(attrs);\n }\n\n for (var attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n this[attr] = attrs[attr];\n }\n }\n }\n\n var _proto = AttrList.prototype;\n\n _proto.decimalInteger = function decimalInteger(attrName) {\n var intValue = parseInt(this[attrName], 10);\n\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n\n return intValue;\n };\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\n for (var i = 0; i < stringValue.length / 2; i++) {\n value[i] = parseInt(stringValue.slice(i * 2, i * 2 + 2), 16);\n }\n\n return value;\n } else {\n return null;\n }\n };\n\n _proto.hexadecimalIntegerAsNumber = function hexadecimalIntegerAsNumber(attrName) {\n var intValue = parseInt(this[attrName], 16);\n\n if (intValue > Number.MAX_SAFE_INTEGER) {\n return Infinity;\n }\n\n return intValue;\n };\n\n _proto.decimalFloatingPoint = function decimalFloatingPoint(attrName) {\n return parseFloat(this[attrName]);\n };\n\n _proto.enumeratedString = function enumeratedString(attrName) {\n return this[attrName];\n };\n\n _proto.decimalResolution = function decimalResolution(attrName) {\n var res = DECIMAL_RESOLUTION_REGEX.exec(this[attrName]);\n\n if (res === null) {\n return undefined;\n }\n\n return {\n width: parseInt(res[1], 10),\n height: parseInt(res[2], 10)\n };\n };\n\n AttrList.parseAttrList = function parseAttrList(input) {\n var match,\n attrs = {};\n ATTR_LIST_REGEX.lastIndex = 0;\n\n while ((match = ATTR_LIST_REGEX.exec(input)) !== null) {\n var value = match[2],\n quote = '\"';\n\n if (value.indexOf(quote) === 0 && value.lastIndexOf(quote) === value.length - 1) {\n value = value.slice(1, -1);\n }\n\n attrs[match[1]] = value;\n }\n\n return attrs;\n };\n\n return AttrList;\n}();\n\n/* harmony default export */ var attr_list = (AttrList);\n// CONCATENATED MODULE: ./src/utils/codecs.ts\n// from http://mp4ra.org/codecs.html\nvar sampleEntryCodesISO = {\n audio: {\n 'a3ds': true,\n 'ac-3': true,\n 'ac-4': true,\n 'alac': true,\n 'alaw': true,\n 'dra1': true,\n 'dts+': true,\n 'dts-': true,\n 'dtsc': true,\n 'dtse': true,\n 'dtsh': true,\n 'ec-3': true,\n 'enca': true,\n 'g719': true,\n 'g726': true,\n 'm4ae': true,\n 'mha1': true,\n 'mha2': true,\n 'mhm1': true,\n 'mhm2': true,\n 'mlpa': true,\n 'mp4a': true,\n 'raw ': true,\n 'Opus': true,\n 'samr': true,\n 'sawb': true,\n 'sawp': true,\n 'sevc': true,\n 'sqcp': true,\n 'ssmv': true,\n 'twos': true,\n 'ulaw': true\n },\n video: {\n 'avc1': true,\n 'avc2': true,\n 'avc3': true,\n 'avc4': true,\n 'avcp': true,\n 'drac': true,\n 'dvav': true,\n 'dvhe': true,\n 'encv': true,\n 'hev1': true,\n 'hvc1': true,\n 'mjp2': true,\n 'mp4v': true,\n 'mvc1': true,\n 'mvc2': true,\n 'mvc3': true,\n 'mvc4': true,\n 'resv': true,\n 'rv60': true,\n 's263': true,\n 'svc1': true,\n 'svc2': true,\n 'vc-1': true,\n 'vp08': true,\n 'vp09': true\n }\n};\n\nfunction isCodecType(codec, type) {\n var typeCodes = sampleEntryCodesISO[type];\n return !!typeCodes && typeCodes[codec.slice(0, 4)] === true;\n}\n\nfunction isCodecSupportedInMp4(codec, type) {\n return MediaSource.isTypeSupported((type || 'video') + \"/mp4;codecs=\\\"\" + codec + \"\\\"\");\n}\n\n\n// CONCATENATED MODULE: ./src/loader/m3u8-parser.ts\n\n\n\n\n\n\n\n\n\n\n\n/**\n * M3U8 parser\n * @module\n */\n// https://regex101.com is your friend\nvar MASTER_PLAYLIST_REGEX = /(?:#EXT-X-STREAM-INF:([^\\n\\r]*)[\\r\\n]+([^\\r\\n]+)|#EXT-X-SESSION-DATA:([^\\n\\r]*)[\\r\\n]+)/g;\nvar MASTER_PLAYLIST_MEDIA_REGEX = /#EXT-X-MEDIA:(.*)/g;\nvar LEVEL_PLAYLIST_REGEX_FAST = new RegExp([/#EXTINF:\\s*(\\d*(?:\\.\\d+)?)(?:,(.*)\\s+)?/.source, // duration (#EXTINF:<duration>,<title>), group 1 => duration, group 2 => title\n/|(?!#)([\\S+ ?]+)/.source, // segment URI, group 3 => the URI (note newline is not eaten)\n/|#EXT-X-BYTERANGE:*(.+)/.source, // next segment's byterange, group 4 => range spec (x@y)\n/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, // 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');\nvar LEVEL_PLAYLIST_REGEX_SLOW = /(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\\d+))|(?:#EXT-X-(TARGETDURATION): *(\\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\\r?\\n?/;\nvar MP4_REGEX_SUFFIX = /\\.(mp4|m4s|m4v|m4a)$/i;\n\nvar m3u8_parser_M3U8Parser = /*#__PURE__*/function () {\n function M3U8Parser() {}\n\n M3U8Parser.findGroup = function findGroup(groups, mediaGroupId) {\n for (var i = 0; i < groups.length; i++) {\n var group = groups[i];\n\n if (group.id === mediaGroupId) {\n return group;\n }\n }\n };\n\n M3U8Parser.convertAVC1ToAVCOTI = function convertAVC1ToAVCOTI(codec) {\n var avcdata = codec.split('.');\n var result;\n\n if (avcdata.length > 2) {\n result = avcdata.shift() + '.';\n result += parseInt(avcdata.shift()).toString(16);\n result += ('000' + parseInt(avcdata.shift()).toString(16)).substr(-4);\n } else {\n result = codec;\n }\n\n return result;\n };\n\n M3U8Parser.resolve = function resolve(url, baseUrl) {\n return url_toolkit[\"buildAbsoluteURL\"](baseUrl, url, {\n alwaysNormalize: true\n });\n };\n\n M3U8Parser.parseMasterPlaylist = function parseMasterPlaylist(string, baseurl) {\n // TODO(typescript-level)\n var levels = [];\n var sessionData = {};\n var hasSessionData = false;\n MASTER_PLAYLIST_REGEX.lastIndex = 0; // TODO(typescript-level)\n\n function setCodecs(codecs, level) {\n ['video', 'audio'].forEach(function (type) {\n var filtered = codecs.filter(function (codec) {\n return isCodecType(codec, type);\n });\n\n if (filtered.length) {\n var preferred = filtered.filter(function (codec) {\n return codec.lastIndexOf('avc1', 0) === 0 || codec.lastIndexOf('mp4a', 0) === 0;\n });\n level[type + \"Codec\"] = preferred.length > 0 ? preferred[0] : filtered[0]; // remove from list\n\n codecs = codecs.filter(function (codec) {\n return filtered.indexOf(codec) === -1;\n });\n }\n });\n level.unknownCodecs = codecs;\n }\n\n var result;\n\n while ((result = MASTER_PLAYLIST_REGEX.exec(string)) != null) {\n if (result[1]) {\n // '#EXT-X-STREAM-INF' is found, parse level tag in group 1\n // TODO(typescript-level)\n var level = {};\n var attrs = level.attrs = new attr_list(result[1]);\n level.url = M3U8Parser.resolve(result[2], baseurl);\n var resolution = attrs.decimalResolution('RESOLUTION');\n\n if (resolution) {\n level.width = resolution.width;\n level.height = resolution.height;\n }\n\n level.bitrate = attrs.decimalInteger('AVERAGE-BANDWIDTH') || attrs.decimalInteger('BANDWIDTH');\n level.name = attrs.NAME;\n setCodecs([].concat((attrs.CODECS || '').split(/[ ,]+/)), level);\n\n if (level.videoCodec && level.videoCodec.indexOf('avc1') !== -1) {\n level.videoCodec = M3U8Parser.convertAVC1ToAVCOTI(level.videoCodec);\n }\n\n levels.push(level);\n } else if (result[3]) {\n // '#EXT-X-SESSION-DATA' is found, parse session data in group 3\n var sessionAttrs = new attr_list(result[3]);\n\n if (sessionAttrs['DATA-ID']) {\n hasSessionData = true;\n sessionData[sessionAttrs['DATA-ID']] = sessionAttrs;\n }\n }\n }\n\n return {\n levels: levels,\n sessionData: hasSessionData ? sessionData : null\n };\n };\n\n M3U8Parser.parseMasterPlaylistMedia = function parseMasterPlaylistMedia(string, baseurl, type, audioGroups) {\n if (audioGroups === void 0) {\n audioGroups = [];\n }\n\n var result;\n var medias = [];\n var id = 0;\n MASTER_PLAYLIST_MEDIA_REGEX.lastIndex = 0;\n\n while ((result = MASTER_PLAYLIST_MEDIA_REGEX.exec(string)) !== null) {\n var attrs = new attr_list(result[1]);\n\n if (attrs.TYPE === type) {\n var media = {\n attrs: attrs,\n id: id++,\n groupId: attrs['GROUP-ID'],\n instreamId: attrs['INSTREAM-ID'],\n name: attrs.NAME || attrs.LANGUAGE,\n type: type,\n default: attrs.DEFAULT === 'YES',\n autoselect: attrs.AUTOSELECT === 'YES',\n forced: attrs.FORCED === 'YES',\n lang: attrs.LANGUAGE\n };\n\n if (attrs.URI) {\n media.url = M3U8Parser.resolve(attrs.URI, baseurl);\n }\n\n if (audioGroups.length) {\n // If there are audio groups signalled in the manifest, let's look for a matching codec string for this track\n var groupCodec = M3U8Parser.findGroup(audioGroups, media.groupId); // If we don't find the track signalled, lets use the first audio groups codec we have\n // Acting as a best guess\n\n media.audioCodec = groupCodec ? groupCodec.codec : audioGroups[0].codec;\n }\n\n medias.push(media);\n }\n }\n\n return medias;\n };\n\n M3U8Parser.parseLevelPlaylist = function parseLevelPlaylist(string, baseurl, id, type, levelUrlId) {\n var currentSN = 0;\n var totalduration = 0;\n var level = new level_Level(baseurl);\n var discontinuityCounter = 0;\n var prevFrag = null;\n var frag = new fragment_Fragment();\n var result;\n var i;\n var levelkey;\n var firstPdtIndex = null;\n LEVEL_PLAYLIST_REGEX_FAST.lastIndex = 0;\n\n while ((result = LEVEL_PLAYLIST_REGEX_FAST.exec(string)) !== null) {\n var duration = result[1];\n\n if (duration) {\n // INF\n frag.duration = parseFloat(duration); // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\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 (Object(number[\"isFiniteNumber\"])(frag.duration)) {\n var sn = currentSN++;\n frag.type = type;\n frag.start = totalduration;\n\n if (levelkey) {\n frag.levelkey = levelkey;\n }\n\n frag.sn = sn;\n frag.level = id;\n frag.cc = discontinuityCounter;\n frag.urlId = levelUrlId;\n frag.baseurl = baseurl; // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\n frag.relurl = (' ' + result[3]).slice(1);\n assignProgramDateTime(frag, prevFrag);\n level.fragments.push(frag);\n prevFrag = frag;\n totalduration += frag.duration;\n frag = new fragment_Fragment();\n }\n } else if (result[4]) {\n // X-BYTERANGE\n var data = (' ' + result[4]).slice(1);\n\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\n if (firstPdtIndex === null) {\n firstPdtIndex = level.fragments.length;\n }\n } else {\n result = result[0].match(LEVEL_PLAYLIST_REGEX_SLOW);\n\n if (!result) {\n logger[\"logger\"].warn('No matches on slow regex match for level playlist!');\n continue;\n }\n\n for (i = 1; i < result.length; i++) {\n if (typeof result[i] !== 'undefined') {\n break;\n }\n } // avoid sliced strings https://github.com/video-dev/hls.js/issues/939\n\n\n var value1 = (' ' + result[i + 1]).slice(1);\n var value2 = (' ' + result[i + 2]).slice(1);\n\n switch (result[i]) {\n case '#':\n frag.tagList.push(value2 ? [value1, value2] : [value1]);\n break;\n\n case 'PLAYLIST-TYPE':\n level.type = value1.toUpperCase();\n break;\n\n case 'MEDIA-SEQUENCE':\n currentSN = level.startSN = parseInt(value1);\n break;\n\n case 'TARGETDURATION':\n level.targetduration = parseFloat(value1);\n break;\n\n case 'VERSION':\n level.version = parseInt(value1);\n break;\n\n case 'EXTM3U':\n break;\n\n case 'ENDLIST':\n level.live = false;\n break;\n\n case 'DIS':\n discontinuityCounter++;\n frag.tagList.push(['DIS']);\n break;\n\n case 'DISCONTINUITY-SEQ':\n discontinuityCounter = parseInt(value1);\n break;\n\n case 'KEY':\n {\n // https://tools.ietf.org/html/rfc8216#section-4.3.2.4\n var decryptparams = value1;\n var keyAttrs = new attr_list(decryptparams);\n var decryptmethod = keyAttrs.enumeratedString('METHOD');\n var decrypturi = keyAttrs.URI;\n var decryptiv = keyAttrs.hexadecimalInteger('IV'); // From RFC: This attribute is OPTIONAL; its absence indicates an implicit value of \"identity\".\n\n var decryptkeyformat = keyAttrs.KEYFORMAT || 'identity';\n\n if (decryptkeyformat === 'com.apple.streamingkeydelivery') {\n logger[\"logger\"].warn('Keyformat com.apple.streamingkeydelivery is not supported');\n continue;\n }\n\n if (decryptmethod) {\n levelkey = new level_key_LevelKey(baseurl, decrypturi);\n\n if (decrypturi && ['AES-128', 'SAMPLE-AES', 'SAMPLE-AES-CENC'].indexOf(decryptmethod) >= 0) {\n levelkey.method = decryptmethod;\n levelkey.key = null; // Initialization Vector (IV)\n\n levelkey.iv = decryptiv;\n }\n }\n\n break;\n }\n\n case 'START':\n {\n var startAttrs = new attr_list(value1);\n var startTimeOffset = startAttrs.decimalFloatingPoint('TIME-OFFSET'); // TIME-OFFSET can be 0\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n level.startTimeOffset = startTimeOffset;\n }\n\n break;\n }\n\n case 'MAP':\n {\n var mapAttrs = new attr_list(value1);\n frag.relurl = mapAttrs.URI;\n\n if (mapAttrs.BYTERANGE) {\n frag.setByteRange(mapAttrs.BYTERANGE);\n }\n\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n frag = new fragment_Fragment();\n frag.rawProgramDateTime = level.initSegment.rawProgramDateTime;\n break;\n }\n\n default:\n logger[\"logger\"].warn(\"line parsed but not handled: \" + result);\n break;\n }\n }\n }\n\n frag = prevFrag; // logger.log('found ' + level.fragments.length + ' fragments');\n\n if (frag && !frag.relurl) {\n level.fragments.pop();\n totalduration -= frag.duration;\n }\n\n level.totalduration = totalduration;\n level.averagetargetduration = totalduration / level.fragments.length;\n level.endSN = currentSN - 1;\n level.startCC = level.fragments[0] ? level.fragments[0].cc : 0;\n level.endCC = discontinuityCounter;\n\n if (!level.initSegment && level.fragments.length) {\n // this is a bit lurky but HLS really has no other way to tell us\n // if the fragments are TS or MP4, except if we download them :/\n // but this is to be able to handle SIDX.\n if (level.fragments.every(function (frag) {\n return MP4_REGEX_SUFFIX.test(frag.relurl);\n })) {\n logger[\"logger\"].warn('MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX');\n frag = new fragment_Fragment();\n frag.relurl = level.fragments[0].relurl;\n frag.baseurl = baseurl;\n frag.level = id;\n frag.type = type;\n frag.sn = 'initSegment';\n level.initSegment = frag;\n level.needSidxRanges = true;\n }\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\n\n if (firstPdtIndex) {\n backfillProgramDateTimes(level.fragments, firstPdtIndex);\n }\n\n return level;\n };\n\n return M3U8Parser;\n}();\n\n\n\nfunction backfillProgramDateTimes(fragments, startIndex) {\n var fragPrev = fragments[startIndex];\n\n for (var i = startIndex - 1; i >= 0; i--) {\n var frag = fragments[i];\n frag.programDateTime = fragPrev.programDateTime - frag.duration * 1000;\n fragPrev = frag;\n }\n}\n\nfunction assignProgramDateTime(frag, prevFrag) {\n if (frag.rawProgramDateTime) {\n frag.programDateTime = Date.parse(frag.rawProgramDateTime);\n } else if (prevFrag === null || prevFrag === void 0 ? void 0 : prevFrag.programDateTime) {\n frag.programDateTime = prevFrag.endProgramDateTime;\n }\n\n if (!Object(number[\"isFiniteNumber\"])(frag.programDateTime)) {\n frag.programDateTime = null;\n frag.rawProgramDateTime = null;\n }\n}\n// CONCATENATED MODULE: ./src/loader/playlist-loader.ts\n\n\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models.\n *\n * Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks.\n *\n * Uses loader(s) set in config to do actual internal loading of resource tasks.\n *\n * @module\n *\n */\n\n\n\n\n\n\n\nvar _window = window,\n performance = _window.performance;\n/**\n * @constructor\n */\n\nvar playlist_loader_PlaylistLoader = /*#__PURE__*/function (_EventHandler) {\n _inheritsLoose(PlaylistLoader, _EventHandler);\n\n /**\n * @constructs\n * @param {Hls} hls\n */\n function PlaylistLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MANIFEST_LOADING, events[\"default\"].LEVEL_LOADING, events[\"default\"].AUDIO_TRACK_LOADING, events[\"default\"].SUBTITLE_TRACK_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n /**\n * @param {PlaylistContextType} type\n * @returns {boolean}\n */\n\n\n PlaylistLoader.canHaveQualityLevels = function canHaveQualityLevels(type) {\n return type !== PlaylistContextType.AUDIO_TRACK && type !== PlaylistContextType.SUBTITLE_TRACK;\n }\n /**\n * Map context.type to LevelType\n * @param {PlaylistLoaderContext} context\n * @returns {LevelType}\n */\n ;\n\n PlaylistLoader.mapContextToLevelType = function mapContextToLevelType(context) {\n var type = context.type;\n\n switch (type) {\n case PlaylistContextType.AUDIO_TRACK:\n return PlaylistLevelType.AUDIO;\n\n case PlaylistContextType.SUBTITLE_TRACK:\n return PlaylistLevelType.SUBTITLE;\n\n default:\n return PlaylistLevelType.MAIN;\n }\n };\n\n PlaylistLoader.getResponseUrl = function getResponseUrl(response, context) {\n var url = response.url; // 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\n if (url === undefined || url.indexOf('data:') === 0) {\n // fallback to initial URL\n url = context.url;\n }\n\n return url;\n }\n /**\n * Returns defaults or configured loader-type overloads (pLoader and loader config params)\n * Default loader is XHRLoader (see utils)\n * @param {PlaylistLoaderContext} context\n * @returns {Loader} or other compatible configured overload\n */\n ;\n\n var _proto = PlaylistLoader.prototype;\n\n _proto.createInternalLoader = function createInternalLoader(context) {\n var config = this.hls.config;\n var PLoader = config.pLoader;\n var Loader = config.loader; // TODO(typescript-config): Verify once config is typed that InternalLoader always returns a Loader\n\n var InternalLoader = PLoader || Loader;\n var loader = new InternalLoader(config); // TODO - Do we really need to assign the instance or if the dep has been lost\n\n context.loader = loader;\n this.loaders[context.type] = loader;\n return loader;\n };\n\n _proto.getInternalLoader = function getInternalLoader(context) {\n return this.loaders[context.type];\n };\n\n _proto.resetInternalLoader = function resetInternalLoader(contextType) {\n if (this.loaders[contextType]) {\n delete this.loaders[contextType];\n }\n }\n /**\n * Call `destroy` on all internal loader instances mapped (one per context type)\n */\n ;\n\n _proto.destroyInternalLoaders = function destroyInternalLoaders() {\n for (var contextType in this.loaders) {\n var loader = this.loaders[contextType];\n\n if (loader) {\n loader.destroy();\n }\n\n this.resetInternalLoader(contextType);\n }\n };\n\n _proto.destroy = function destroy() {\n this.destroyInternalLoaders();\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onManifestLoading = function onManifestLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.MANIFEST,\n level: 0,\n id: null,\n responseType: 'text'\n });\n };\n\n _proto.onLevelLoading = function onLevelLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.LEVEL,\n level: data.level,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.onAudioTrackLoading = function onAudioTrackLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.AUDIO_TRACK,\n level: null,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.onSubtitleTrackLoading = function onSubtitleTrackLoading(data) {\n this.load({\n url: data.url,\n type: PlaylistContextType.SUBTITLE_TRACK,\n level: null,\n id: data.id,\n responseType: 'text'\n });\n };\n\n _proto.load = function load(context) {\n var config = this.hls.config;\n logger[\"logger\"].debug(\"Loading playlist of type \" + context.type + \", level: \" + context.level + \", id: \" + context.id); // Check if a loader for this context already exists\n\n var loader = this.getInternalLoader(context);\n\n if (loader) {\n var loaderContext = loader.context;\n\n if (loaderContext && loaderContext.url === context.url) {\n // same URL can't overlap\n logger[\"logger\"].trace('playlist request ongoing');\n return false;\n } else {\n logger[\"logger\"].warn(\"aborting previous loader for type: \" + context.type);\n loader.abort();\n }\n }\n\n var maxRetry;\n var timeout;\n var retryDelay;\n var maxRetryDelay; // apply different configs for retries depending on\n // context (manifest, level, audio/subs playlist)\n\n switch (context.type) {\n case PlaylistContextType.MANIFEST:\n maxRetry = config.manifestLoadingMaxRetry;\n timeout = config.manifestLoadingTimeOut;\n retryDelay = config.manifestLoadingRetryDelay;\n maxRetryDelay = config.manifestLoadingMaxRetryTimeout;\n break;\n\n case PlaylistContextType.LEVEL:\n // Disable internal loader retry logic, since we are managing retries in Level Controller\n maxRetry = 0;\n maxRetryDelay = 0;\n retryDelay = 0;\n timeout = config.levelLoadingTimeOut; // TODO Introduce retry settings for audio-track and subtitle-track, it should not use level retry config\n\n break;\n\n default:\n maxRetry = config.levelLoadingMaxRetry;\n timeout = config.levelLoadingTimeOut;\n retryDelay = config.levelLoadingRetryDelay;\n maxRetryDelay = config.levelLoadingMaxRetryTimeout;\n break;\n }\n\n loader = this.createInternalLoader(context);\n var loaderConfig = {\n timeout: timeout,\n maxRetry: maxRetry,\n retryDelay: retryDelay,\n maxRetryDelay: maxRetryDelay\n };\n var loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this)\n };\n logger[\"logger\"].debug(\"Calling internal loader delegate for URL: \" + context.url);\n loader.load(context, loaderConfig, loaderCallbacks);\n return true;\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n if (context.isSidxRequest) {\n this._handleSidxRequest(response, context);\n\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n\n return;\n }\n\n this.resetInternalLoader(context.type);\n\n if (typeof response.data !== 'string') {\n throw new Error('expected responseType of \"text\" for PlaylistLoader');\n }\n\n var string = response.data;\n stats.tload = performance.now(); // stats.mtime = new Date(target.getResponseHeader('Last-Modified'));\n // Validate if it is an M3U8 at all\n\n if (string.indexOf('#EXTM3U') !== 0) {\n this._handleManifestParsingError(response, context, 'no EXTM3U delimiter', networkDetails);\n\n return;\n } // Check if chunk-list or master. handle empty chunk list case (first EXTINF not signaled, but TARGETDURATION present)\n\n\n if (string.indexOf('#EXTINF:') > 0 || string.indexOf('#EXT-X-TARGETDURATION:') > 0) {\n this._handleTrackOrLevelPlaylist(response, stats, context, networkDetails);\n } else {\n this._handleMasterPlaylist(response, stats, context, networkDetails);\n }\n };\n\n _proto.loaderror = function loaderror(response, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n this._handleNetworkError(context, networkDetails, false, response);\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n this._handleNetworkError(context, networkDetails, true);\n } // TODO(typescript-config): networkDetails can currently be a XHR or Fetch impl,\n // but with custom loaders it could be generic investigate this further when config is typed\n ;\n\n _proto._handleMasterPlaylist = function _handleMasterPlaylist(response, stats, context, networkDetails) {\n var hls = this.hls;\n var string = response.data;\n var url = PlaylistLoader.getResponseUrl(response, context);\n\n var _M3U8Parser$parseMast = m3u8_parser_M3U8Parser.parseMasterPlaylist(string, url),\n levels = _M3U8Parser$parseMast.levels,\n sessionData = _M3U8Parser$parseMast.sessionData;\n\n if (!levels.length) {\n this._handleManifestParsingError(response, context, 'no level found in manifest', networkDetails);\n\n return;\n } // multi level playlist, parse level info\n\n\n var audioGroups = levels.map(function (level) {\n return {\n id: level.attrs.AUDIO,\n codec: level.audioCodec\n };\n });\n var audioTracks = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'AUDIO', audioGroups);\n var subtitles = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'SUBTITLES');\n var captions = m3u8_parser_M3U8Parser.parseMasterPlaylistMedia(string, url, 'CLOSED-CAPTIONS');\n\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 = false;\n audioTracks.forEach(function (audioTrack) {\n if (!audioTrack.url) {\n embeddedAudioFound = true;\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\n if (embeddedAudioFound === false && levels[0].audioCodec && !levels[0].attrs.AUDIO) {\n logger[\"logger\"].log('audio codec signaled in quality level, but no embedded audio track signaled, create one');\n audioTracks.unshift({\n type: 'main',\n name: 'main',\n default: false,\n autoselect: false,\n forced: false,\n id: -1,\n attrs: {},\n url: ''\n });\n }\n }\n\n hls.trigger(events[\"default\"].MANIFEST_LOADED, {\n levels: levels,\n audioTracks: audioTracks,\n subtitles: subtitles,\n captions: captions,\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: sessionData\n });\n };\n\n _proto._handleTrackOrLevelPlaylist = function _handleTrackOrLevelPlaylist(response, stats, context, networkDetails) {\n var hls = this.hls;\n var id = context.id,\n level = context.level,\n type = context.type;\n var url = PlaylistLoader.getResponseUrl(response, context); // if the values are null, they will result in the else conditional\n\n var levelUrlId = Object(number[\"isFiniteNumber\"])(id) ? id : 0;\n var levelId = Object(number[\"isFiniteNumber\"])(level) ? level : levelUrlId;\n var levelType = PlaylistLoader.mapContextToLevelType(context);\n var levelDetails = m3u8_parser_M3U8Parser.parseLevelPlaylist(response.data, url, levelId, levelType, levelUrlId); // set stats on level structure\n // TODO(jstackhouse): why? mixing concerns, is it just treated as value bag?\n\n levelDetails.tload = stats.tload;\n\n if (!levelDetails.fragments.length) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].LEVEL_EMPTY_ERROR,\n fatal: false,\n url: url,\n reason: 'no fragments found in level',\n level: typeof context.level === 'number' ? context.level : undefined\n });\n return;\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\n\n if (type === PlaylistContextType.MANIFEST) {\n var singleLevel = {\n url: url,\n details: levelDetails\n };\n hls.trigger(events[\"default\"].MANIFEST_LOADED, {\n levels: [singleLevel],\n audioTracks: [],\n url: url,\n stats: stats,\n networkDetails: networkDetails,\n sessionData: null\n });\n } // save parsing time\n\n\n stats.tparsed = performance.now(); // in case we need SIDX ranges\n // return early after calling load for\n // the SIDX box.\n\n if (levelDetails.needSidxRanges) {\n var sidxUrl = levelDetails.initSegment.url;\n this.load({\n url: sidxUrl,\n isSidxRequest: true,\n type: type,\n level: level,\n levelDetails: levelDetails,\n id: id,\n rangeStart: 0,\n rangeEnd: 2048,\n responseType: 'arraybuffer'\n });\n return;\n } // extend the context with the new levelDetails property\n\n\n context.levelDetails = levelDetails;\n\n this._handlePlaylistLoaded(response, stats, context, networkDetails);\n };\n\n _proto._handleSidxRequest = function _handleSidxRequest(response, context) {\n if (typeof response.data === 'string') {\n throw new Error('sidx request must be made with responseType of array buffer');\n }\n\n var sidxInfo = mp4demuxer[\"default\"].parseSegmentIndex(new Uint8Array(response.data)); // if provided fragment does not contain sidx, early return\n\n if (!sidxInfo) {\n return;\n }\n\n var sidxReferences = sidxInfo.references;\n var levelDetails = context.levelDetails;\n sidxReferences.forEach(function (segmentRef, index) {\n var segRefInfo = segmentRef.info;\n\n if (!levelDetails) {\n return;\n }\n\n var frag = levelDetails.fragments[index];\n\n if (frag.byteRange.length === 0) {\n frag.setByteRange(String(1 + segRefInfo.end - segRefInfo.start) + '@' + String(segRefInfo.start));\n }\n });\n\n if (levelDetails) {\n levelDetails.initSegment.setByteRange(String(sidxInfo.moovEndOffset) + '@0');\n }\n };\n\n _proto._handleManifestParsingError = function _handleManifestParsingError(response, context, reason, networkDetails) {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].MANIFEST_PARSING_ERROR,\n fatal: true,\n url: response.url,\n reason: reason,\n networkDetails: networkDetails\n });\n };\n\n _proto._handleNetworkError = function _handleNetworkError(context, networkDetails, timeout, response) {\n if (timeout === void 0) {\n timeout = false;\n }\n\n if (response === void 0) {\n response = null;\n }\n\n logger[\"logger\"].info(\"A network error occured while loading a \" + context.type + \"-type playlist\");\n var details;\n var fatal;\n var loader = this.getInternalLoader(context);\n\n switch (context.type) {\n case PlaylistContextType.MANIFEST:\n details = timeout ? errors[\"ErrorDetails\"].MANIFEST_LOAD_TIMEOUT : errors[\"ErrorDetails\"].MANIFEST_LOAD_ERROR;\n fatal = true;\n break;\n\n case PlaylistContextType.LEVEL:\n details = timeout ? errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT : errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR;\n fatal = false;\n break;\n\n case PlaylistContextType.AUDIO_TRACK:\n details = timeout ? errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_TIMEOUT : errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR;\n fatal = false;\n break;\n\n default:\n // details = ...?\n fatal = false;\n }\n\n if (loader) {\n loader.abort();\n this.resetInternalLoader(context.type);\n } // TODO(typescript-events): when error events are handled, type this\n\n\n var errorData = {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: details,\n fatal: fatal,\n url: context.url,\n loader: loader,\n context: context,\n networkDetails: networkDetails\n };\n\n if (response) {\n errorData.response = response;\n }\n\n this.hls.trigger(events[\"default\"].ERROR, errorData);\n };\n\n _proto._handlePlaylistLoaded = function _handlePlaylistLoaded(response, stats, context, networkDetails) {\n var type = context.type,\n level = context.level,\n id = context.id,\n levelDetails = context.levelDetails;\n\n if (!levelDetails || !levelDetails.targetduration) {\n this._handleManifestParsingError(response, context, 'invalid target duration', networkDetails);\n\n return;\n }\n\n var canHaveLevels = PlaylistLoader.canHaveQualityLevels(context.type);\n\n if (canHaveLevels) {\n this.hls.trigger(events[\"default\"].LEVEL_LOADED, {\n details: levelDetails,\n level: level || 0,\n id: id || 0,\n stats: stats,\n networkDetails: networkDetails\n });\n } else {\n switch (type) {\n case PlaylistContextType.AUDIO_TRACK:\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n\n case PlaylistContextType.SUBTITLE_TRACK:\n this.hls.trigger(events[\"default\"].SUBTITLE_TRACK_LOADED, {\n details: levelDetails,\n id: id,\n stats: stats,\n networkDetails: networkDetails\n });\n break;\n }\n }\n };\n\n return PlaylistLoader;\n}(event_handler);\n\n/* harmony default export */ var playlist_loader = (playlist_loader_PlaylistLoader);\n// CONCATENATED MODULE: ./src/loader/fragment-loader.js\n\n\n\nfunction fragment_loader_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Fragment Loader\n*/\n\n\n\n\n\nvar fragment_loader_FragmentLoader = /*#__PURE__*/function (_EventHandler) {\n fragment_loader_inheritsLoose(FragmentLoader, _EventHandler);\n\n function FragmentLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FRAG_LOADING) || this;\n _this.loaders = {};\n return _this;\n }\n\n var _proto = FragmentLoader.prototype;\n\n _proto.destroy = function destroy() {\n var loaders = this.loaders;\n\n for (var loaderName in loaders) {\n var loader = loaders[loaderName];\n\n if (loader) {\n loader.destroy();\n }\n }\n\n this.loaders = {};\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onFragLoading = function onFragLoading(data) {\n var frag = data.frag,\n type = frag.type,\n loaders = this.loaders,\n config = this.hls.config,\n FragmentILoader = config.fLoader,\n DefaultILoader = config.loader; // reset fragment state\n\n frag.loaded = 0;\n var loader = loaders[type];\n\n if (loader) {\n logger[\"logger\"].warn(\"abort previous fragment loader for type: \" + type);\n loader.abort();\n }\n\n loader = loaders[type] = frag.loader = config.fLoader ? new FragmentILoader(config) : new DefaultILoader(config);\n var loaderContext, loaderConfig, loaderCallbacks;\n loaderContext = {\n url: frag.url,\n frag: frag,\n responseType: 'arraybuffer',\n progressData: false\n };\n var start = frag.byteRangeStartOffset,\n end = frag.byteRangeEndOffset;\n\n if (Object(number[\"isFiniteNumber\"])(start) && Object(number[\"isFiniteNumber\"])(end)) {\n loaderContext.rangeStart = start;\n loaderContext.rangeEnd = end;\n }\n\n loaderConfig = {\n timeout: config.fragLoadingTimeOut,\n maxRetry: 0,\n retryDelay: 0,\n maxRetryDelay: config.fragLoadingMaxRetryTimeout\n };\n loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this),\n onProgress: this.loadprogress.bind(this)\n };\n loader.load(loaderContext, loaderConfig, loaderCallbacks);\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var payload = response.data,\n frag = context.frag; // detach fragment loader on load success\n\n frag.loader = undefined;\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].FRAG_LOADED, {\n payload: payload,\n frag: frag,\n stats: stats,\n networkDetails: networkDetails\n });\n };\n\n _proto.loaderror = function loaderror(response, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_LOAD_ERROR,\n fatal: false,\n frag: context.frag,\n response: response,\n networkDetails: networkDetails\n });\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n this.loaders[frag.type] = undefined;\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT,\n fatal: false,\n frag: context.frag,\n networkDetails: networkDetails\n });\n } // data will be used for progressive parsing\n ;\n\n _proto.loadprogress = function loadprogress(stats, context, data, networkDetails) {\n if (networkDetails === void 0) {\n networkDetails = null;\n }\n\n // jshint ignore:line\n var frag = context.frag;\n frag.loaded = stats.loaded;\n this.hls.trigger(events[\"default\"].FRAG_LOAD_PROGRESS, {\n frag: frag,\n stats: stats,\n networkDetails: networkDetails\n });\n };\n\n return FragmentLoader;\n}(event_handler);\n\n/* harmony default export */ var fragment_loader = (fragment_loader_FragmentLoader);\n// CONCATENATED MODULE: ./src/loader/key-loader.ts\nfunction key_loader_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Decrypt key Loader\n*/\n\n\n\n\n\nvar key_loader_KeyLoader = /*#__PURE__*/function (_EventHandler) {\n key_loader_inheritsLoose(KeyLoader, _EventHandler);\n\n function KeyLoader(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].KEY_LOADING) || this;\n _this.loaders = {};\n _this.decryptkey = null;\n _this.decrypturl = null;\n return _this;\n }\n\n var _proto = KeyLoader.prototype;\n\n _proto.destroy = function destroy() {\n for (var loaderName in this.loaders) {\n var loader = this.loaders[loaderName];\n\n if (loader) {\n loader.destroy();\n }\n }\n\n this.loaders = {};\n\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onKeyLoading = function onKeyLoading(data) {\n var frag = data.frag;\n var type = frag.type;\n var loader = this.loaders[type];\n\n if (!frag.decryptdata) {\n logger[\"logger\"].warn('Missing decryption data on fragment in onKeyLoading');\n return;\n } // Load the key if the uri is different from previous one, or if the decrypt key has not yet been retrieved\n\n\n var uri = frag.decryptdata.uri;\n\n if (uri !== this.decrypturl || this.decryptkey === null) {\n var config = this.hls.config;\n\n if (loader) {\n logger[\"logger\"].warn(\"abort previous key loader for type:\" + type);\n loader.abort();\n }\n\n if (!uri) {\n logger[\"logger\"].warn('key uri is falsy');\n return;\n }\n\n frag.loader = this.loaders[type] = new config.loader(config);\n this.decrypturl = uri;\n this.decryptkey = null;\n var loaderContext = {\n url: uri,\n frag: frag,\n responseType: 'arraybuffer'\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\n var loaderConfig = {\n timeout: config.fragLoadingTimeOut,\n maxRetry: 0,\n retryDelay: config.fragLoadingRetryDelay,\n maxRetryDelay: config.fragLoadingMaxRetryTimeout\n };\n var loaderCallbacks = {\n onSuccess: this.loadsuccess.bind(this),\n onError: this.loaderror.bind(this),\n onTimeout: this.loadtimeout.bind(this)\n };\n frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);\n } else if (this.decryptkey) {\n // Return the key if it's already been loaded\n frag.decryptdata.key = this.decryptkey;\n this.hls.trigger(events[\"default\"].KEY_LOADED, {\n frag: frag\n });\n }\n };\n\n _proto.loadsuccess = function loadsuccess(response, stats, context) {\n var frag = context.frag;\n\n if (!frag.decryptdata) {\n logger[\"logger\"].error('after key load, decryptdata unset');\n return;\n }\n\n this.decryptkey = frag.decryptdata.key = new Uint8Array(response.data); // detach fragment loader on load success\n\n frag.loader = undefined;\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].KEY_LOADED, {\n frag: frag\n });\n };\n\n _proto.loaderror = function loaderror(response, context) {\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].KEY_LOAD_ERROR,\n fatal: false,\n frag: frag,\n response: response\n });\n };\n\n _proto.loadtimeout = function loadtimeout(stats, context) {\n var frag = context.frag;\n var loader = frag.loader;\n\n if (loader) {\n loader.abort();\n }\n\n delete this.loaders[frag.type];\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].NETWORK_ERROR,\n details: errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT,\n fatal: false,\n frag: frag\n });\n };\n\n return KeyLoader;\n}(event_handler);\n\n/* harmony default export */ var key_loader = (key_loader_KeyLoader);\n// CONCATENATED MODULE: ./src/controller/fragment-tracker.js\n\n\nfunction fragment_tracker_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\nvar FragmentState = {\n NOT_LOADED: 'NOT_LOADED',\n APPENDING: 'APPENDING',\n PARTIAL: 'PARTIAL',\n OK: 'OK'\n};\nvar fragment_tracker_FragmentTracker = /*#__PURE__*/function (_EventHandler) {\n fragment_tracker_inheritsLoose(FragmentTracker, _EventHandler);\n\n function FragmentTracker(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].BUFFER_APPENDED, events[\"default\"].FRAG_BUFFERED, events[\"default\"].FRAG_LOADED) || this;\n _this.bufferPadding = 0.2;\n _this.fragments = Object.create(null);\n _this.timeRanges = Object.create(null);\n _this.config = hls.config;\n return _this;\n }\n\n var _proto = FragmentTracker.prototype;\n\n _proto.destroy = function destroy() {\n this.fragments = Object.create(null);\n this.timeRanges = Object.create(null);\n this.config = null;\n event_handler.prototype.destroy.call(this);\n\n _EventHandler.prototype.destroy.call(this);\n }\n /**\n * Return a Fragment that match the position and levelType.\n * If not found any Fragment, return null\n * @param {number} position\n * @param {LevelType} levelType\n * @returns {Fragment|null}\n */\n ;\n\n _proto.getBufferedFrag = function getBufferedFrag(position, levelType) {\n var fragments = this.fragments;\n var bufferedFrags = Object.keys(fragments).filter(function (key) {\n var fragmentEntity = fragments[key];\n\n if (fragmentEntity.body.type !== levelType) {\n return false;\n }\n\n if (!fragmentEntity.buffered) {\n return false;\n }\n\n var frag = fragmentEntity.body;\n return frag.startPTS <= position && position <= frag.endPTS;\n });\n\n if (bufferedFrags.length === 0) {\n return null;\n } else {\n // https://github.com/video-dev/hls.js/pull/1545#discussion_r166229566\n var bufferedFragKey = bufferedFrags.pop();\n return fragments[bufferedFragKey].body;\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 * @param {String} elementaryStream The elementaryStream of media this is (eg. video/audio)\n * @param {TimeRanges} timeRange TimeRange object from a sourceBuffer\n */\n ;\n\n _proto.detectEvictedFragments = function detectEvictedFragments(elementaryStream, timeRange) {\n var _this2 = this;\n\n // Check if any flagged fragments have been unloaded\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this2.fragments[key];\n\n if (!fragmentEntity || !fragmentEntity.buffered) {\n return;\n }\n\n var esData = fragmentEntity.range[elementaryStream];\n\n if (!esData) {\n return;\n }\n\n var fragmentTimes = esData.time;\n\n for (var i = 0; i < fragmentTimes.length; i++) {\n var time = fragmentTimes[i];\n\n if (!_this2.isTimeBuffered(time.startPTS, time.endPTS, timeRange)) {\n // Unregister partial fragment as it needs to load again to be reused\n _this2.removeFragment(fragmentEntity.body);\n\n break;\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 * @param {Object} fragment Check the fragment against all sourceBuffers loaded\n */\n ;\n\n _proto.detectPartialFragments = function detectPartialFragments(fragment) {\n var _this3 = this;\n\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n\n if (fragmentEntity) {\n fragmentEntity.buffered = true;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n if (fragment.hasElementaryStream(elementaryStream)) {\n var timeRange = _this3.timeRanges[elementaryStream]; // Check for malformed fragments\n // Gaps need to be calculated for each elementaryStream\n\n fragmentEntity.range[elementaryStream] = _this3.getBufferedTimes(fragment.startPTS, fragment.endPTS, timeRange);\n }\n });\n }\n };\n\n _proto.getBufferedTimes = function getBufferedTimes(startPTS, endPTS, timeRange) {\n var fragmentTimes = [];\n var startTime, endTime;\n var fragmentPartial = false;\n\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n\n if (startPTS >= startTime && endPTS <= endTime) {\n // Fragment is entirely contained in buffer\n // No need to check the other timeRange times since it's completely playable\n fragmentTimes.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 // Check for intersection with buffer\n // Get playable sections of the fragment\n fragmentTimes.push({\n startPTS: Math.max(startPTS, timeRange.start(i)),\n endPTS: Math.min(endPTS, timeRange.end(i))\n });\n fragmentPartial = true;\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\n return {\n time: fragmentTimes,\n partial: fragmentPartial\n };\n };\n\n _proto.getFragmentKey = function getFragmentKey(fragment) {\n return fragment.type + \"_\" + fragment.level + \"_\" + fragment.urlId + \"_\" + fragment.sn;\n }\n /**\n * Gets the partial fragment for a certain time\n * @param {Number} time\n * @returns {Object} fragment Returns a partial fragment at a time or null if there is no partial fragment\n */\n ;\n\n _proto.getPartialFragment = function getPartialFragment(time) {\n var _this4 = this;\n\n var timePadding, startTime, endTime;\n var bestFragment = null;\n var bestOverlap = 0;\n Object.keys(this.fragments).forEach(function (key) {\n var fragmentEntity = _this4.fragments[key];\n\n if (_this4.isPartial(fragmentEntity)) {\n startTime = fragmentEntity.body.startPTS - _this4.bufferPadding;\n endTime = fragmentEntity.body.endPTS + _this4.bufferPadding;\n\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\n if (bestOverlap <= timePadding) {\n bestFragment = fragmentEntity.body;\n bestOverlap = timePadding;\n }\n }\n }\n });\n return bestFragment;\n }\n /**\n * @param {Object} fragment The fragment to check\n * @returns {String} Returns the fragment state when a fragment never loaded or if it partially loaded\n */\n ;\n\n _proto.getState = function getState(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n var fragmentEntity = this.fragments[fragKey];\n var state = FragmentState.NOT_LOADED;\n\n if (fragmentEntity !== undefined) {\n if (!fragmentEntity.buffered) {\n state = FragmentState.APPENDING;\n } else if (this.isPartial(fragmentEntity) === true) {\n state = FragmentState.PARTIAL;\n } else {\n state = FragmentState.OK;\n }\n }\n\n return state;\n };\n\n _proto.isPartial = function isPartial(fragmentEntity) {\n return fragmentEntity.buffered === true && (fragmentEntity.range.video !== undefined && fragmentEntity.range.video.partial === true || fragmentEntity.range.audio !== undefined && fragmentEntity.range.audio.partial === true);\n };\n\n _proto.isTimeBuffered = function isTimeBuffered(startPTS, endPTS, timeRange) {\n var startTime, endTime;\n\n for (var i = 0; i < timeRange.length; i++) {\n startTime = timeRange.start(i) - this.bufferPadding;\n endTime = timeRange.end(i) + this.bufferPadding;\n\n if (startPTS >= startTime && endPTS <= endTime) {\n return true;\n }\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\n return false;\n }\n /**\n * Fires when a fragment loading is completed\n */\n ;\n\n _proto.onFragLoaded = function onFragLoaded(e) {\n var fragment = e.frag; // don't track initsegment (for which sn is not a number)\n // don't track frags used for bitrateTest, they're irrelevant.\n\n if (!Object(number[\"isFiniteNumber\"])(fragment.sn) || fragment.bitrateTest) {\n return;\n }\n\n this.fragments[this.getFragmentKey(fragment)] = {\n body: fragment,\n range: Object.create(null),\n buffered: false\n };\n }\n /**\n * Fires when the buffer is updated\n */\n ;\n\n _proto.onBufferAppended = function onBufferAppended(e) {\n var _this5 = this;\n\n // Store the latest timeRanges loaded in the buffer\n this.timeRanges = e.timeRanges;\n Object.keys(this.timeRanges).forEach(function (elementaryStream) {\n var timeRange = _this5.timeRanges[elementaryStream];\n\n _this5.detectEvictedFragments(elementaryStream, timeRange);\n });\n }\n /**\n * Fires after a fragment has been loaded into the source buffer\n */\n ;\n\n _proto.onFragBuffered = function onFragBuffered(e) {\n this.detectPartialFragments(e.frag);\n }\n /**\n * Return true if fragment tracker has the fragment.\n * @param {Object} fragment\n * @returns {boolean}\n */\n ;\n\n _proto.hasFragment = function hasFragment(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n return this.fragments[fragKey] !== undefined;\n }\n /**\n * Remove a fragment from fragment tracker until it is loaded again\n * @param {Object} fragment The fragment to remove\n */\n ;\n\n _proto.removeFragment = function removeFragment(fragment) {\n var fragKey = this.getFragmentKey(fragment);\n delete this.fragments[fragKey];\n }\n /**\n * Remove all fragments from fragment tracker.\n */\n ;\n\n _proto.removeAllFragments = function removeAllFragments() {\n this.fragments = Object.create(null);\n };\n\n return FragmentTracker;\n}(event_handler);\n// CONCATENATED MODULE: ./src/utils/binary-search.ts\nvar 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 {Array<T>} list The array to search.\n * @param {BinarySearchComparison<T>} 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 * @return {T | null} The object if it is found or null otherwise.\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\n while (minIndex <= maxIndex) {\n currentIndex = (minIndex + maxIndex) / 2 | 0;\n currentElement = list[currentIndex];\n var comparisonResult = comparisonFn(currentElement);\n\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\n return null;\n }\n};\n/* harmony default export */ var binary_search = (BinarySearch);\n// CONCATENATED MODULE: ./src/utils/buffer-helper.ts\n/**\n * @module BufferHelper\n *\n * Providing 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*/\nvar BufferHelper = /*#__PURE__*/function () {\n function BufferHelper() {}\n\n /**\n * Return true if `media`'s buffered include `position`\n * @param {Bufferable} media\n * @param {number} position\n * @returns {boolean}\n */\n BufferHelper.isBuffered = function isBuffered(media, position) {\n try {\n if (media) {\n var buffered = media.buffered;\n\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) {// 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\n return false;\n };\n\n BufferHelper.bufferInfo = function bufferInfo(media, pos, maxHoleDuration) {\n try {\n if (media) {\n var vbuffered = media.buffered;\n var buffered = [];\n var i;\n\n for (i = 0; i < vbuffered.length; i++) {\n buffered.push({\n start: vbuffered.start(i),\n end: vbuffered.end(i)\n });\n }\n\n return this.bufferedInfo(buffered, pos, maxHoleDuration);\n }\n } catch (error) {// 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\n return {\n len: 0,\n start: pos,\n end: pos,\n nextStart: undefined\n };\n };\n\n BufferHelper.bufferedInfo = function bufferedInfo(buffered, pos, maxHoleDuration) {\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\n if (diff) {\n return diff;\n } else {\n return b.end - a.end;\n }\n });\n var buffered2 = [];\n\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\n if (buf2len) {\n var buf2end = buffered2[buf2len - 1].end; // if small hole (value between 0 or maxHoleDuration ) or overlapping (negative)\n\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\n var bufferLen = 0; // bufferStartNext can possibly be undefined based on the conditional logic below\n\n var bufferStartNext; // bufferStart and bufferEnd are buffer boundaries around current video position\n\n var bufferStart = pos;\n var bufferEnd = pos;\n\n for (var _i = 0; _i < buffered2.length; _i++) {\n var start = buffered2[_i].start,\n end = buffered2[_i].end; // logger.log('buf start/end:' + buffered.start(i) + '/' + buffered.end(i));\n\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\n return {\n len: bufferLen,\n start: bufferStart,\n end: bufferEnd,\n nextStart: bufferStartNext\n };\n };\n\n return BufferHelper;\n}();\n// EXTERNAL MODULE: ./node_modules/eventemitter3/index.js\nvar eventemitter3 = __webpack_require__(\"./node_modules/eventemitter3/index.js\");\n\n// EXTERNAL MODULE: ./node_modules/webworkify-webpack/index.js\nvar webworkify_webpack = __webpack_require__(\"./node_modules/webworkify-webpack/index.js\");\n\n// EXTERNAL MODULE: ./src/demux/demuxer-inline.js + 12 modules\nvar demuxer_inline = __webpack_require__(\"./src/demux/demuxer-inline.js\");\n\n// CONCATENATED MODULE: ./src/utils/mediasource-helper.ts\n/**\n * MediaSource helper\n */\nfunction getMediaSource() {\n return window.MediaSource || window.WebKitMediaSource;\n}\n// EXTERNAL MODULE: ./src/utils/get-self-scope.js\nvar get_self_scope = __webpack_require__(\"./src/utils/get-self-scope.js\");\n\n// CONCATENATED MODULE: ./src/observer.ts\nfunction observer_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n/**\n * Simple adapter sub-class of Nodejs-like EventEmitter.\n */\n\nvar Observer = /*#__PURE__*/function (_EventEmitter) {\n observer_inheritsLoose(Observer, _EventEmitter);\n\n function Observer() {\n return _EventEmitter.apply(this, arguments) || this;\n }\n\n var _proto = Observer.prototype;\n\n /**\n * We simply want to pass along the event-name itself\n * in every call to a handler, which is the purpose of our `trigger` method\n * extending the standard API.\n */\n _proto.trigger = function trigger(event) {\n for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n this.emit.apply(this, [event, event].concat(data));\n };\n\n return Observer;\n}(eventemitter3[\"EventEmitter\"]);\n// CONCATENATED MODULE: ./src/demux/demuxer.js\n\n\n\n\n\n\n\n\n\n // see https://stackoverflow.com/a/11237259/589493\n\nvar global = Object(get_self_scope[\"getSelfScope\"])(); // safeguard for code that might run both on worker and main thread\n\nvar demuxer_MediaSource = getMediaSource() || {\n isTypeSupported: function isTypeSupported() {\n return false;\n }\n};\n\nvar demuxer_Demuxer = /*#__PURE__*/function () {\n function Demuxer(hls, id) {\n var _this = this;\n\n this.hls = hls;\n this.id = id;\n var observer = this.observer = new Observer();\n var config = hls.config;\n\n var forwardMessage = function forwardMessage(ev, data) {\n data = data || {};\n data.frag = _this.frag;\n data.id = _this.id;\n hls.trigger(ev, data);\n }; // forward events to main thread\n\n\n observer.on(events[\"default\"].FRAG_DECRYPTED, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_INIT_SEGMENT, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_DATA, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSED, forwardMessage);\n observer.on(events[\"default\"].ERROR, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_METADATA, forwardMessage);\n observer.on(events[\"default\"].FRAG_PARSING_USERDATA, forwardMessage);\n observer.on(events[\"default\"].INIT_PTS_FOUND, forwardMessage);\n var typeSupported = {\n mp4: demuxer_MediaSource.isTypeSupported('video/mp4'),\n mpeg: demuxer_MediaSource.isTypeSupported('audio/mpeg'),\n mp3: demuxer_MediaSource.isTypeSupported('audio/mp4; codecs=\"mp3\"')\n }; // navigator.vendor is not always available in Web Worker\n // refer to https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/navigator\n\n var vendor = navigator.vendor;\n\n if (config.enableWorker && typeof Worker !== 'undefined') {\n logger[\"logger\"].log('demuxing in webworker');\n var w;\n\n try {\n w = this.w = webworkify_webpack(/*require.resolve*/(/*! ../demux/demuxer-worker.js */ \"./src/demux/demuxer-worker.js\"));\n this.onwmsg = this.onWorkerMessage.bind(this);\n w.addEventListener('message', this.onwmsg);\n\n w.onerror = function (event) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].INTERNAL_EXCEPTION,\n fatal: true,\n event: 'demuxerWorker',\n err: {\n message: event.message + ' (' + event.filename + ':' + event.lineno + ')'\n }\n });\n };\n\n w.postMessage({\n cmd: 'init',\n typeSupported: typeSupported,\n vendor: vendor,\n id: id,\n config: JSON.stringify(config)\n });\n } catch (err) {\n logger[\"logger\"].warn('Error in worker:', err);\n logger[\"logger\"].error('Error while initializing DemuxerWorker, fallback on DemuxerInline');\n\n if (w) {\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(w.objectURL);\n }\n\n this.demuxer = new demuxer_inline[\"default\"](observer, typeSupported, config, vendor);\n this.w = undefined;\n }\n } else {\n this.demuxer = new demuxer_inline[\"default\"](observer, typeSupported, config, vendor);\n }\n }\n\n var _proto = Demuxer.prototype;\n\n _proto.destroy = function destroy() {\n var w = this.w;\n\n if (w) {\n w.removeEventListener('message', this.onwmsg);\n w.terminate();\n this.w = null;\n } else {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.destroy();\n this.demuxer = null;\n }\n }\n\n var observer = this.observer;\n\n if (observer) {\n observer.removeAllListeners();\n this.observer = null;\n }\n };\n\n _proto.push = function push(data, initSegment, audioCodec, videoCodec, frag, duration, accurateTimeOffset, defaultInitPTS) {\n var w = this.w;\n var timeOffset = Object(number[\"isFiniteNumber\"])(frag.startPTS) ? frag.startPTS : frag.start;\n var decryptdata = frag.decryptdata;\n var lastFrag = this.frag;\n var discontinuity = !(lastFrag && frag.cc === lastFrag.cc);\n var trackSwitch = !(lastFrag && frag.level === lastFrag.level);\n var nextSN = lastFrag && frag.sn === lastFrag.sn + 1;\n var contiguous = !trackSwitch && nextSN;\n\n if (discontinuity) {\n logger[\"logger\"].log(this.id + \":discontinuity detected\");\n }\n\n if (trackSwitch) {\n logger[\"logger\"].log(this.id + \":switch detected\");\n }\n\n this.frag = frag;\n\n if (w) {\n // post fragment payload as transferable objects for ArrayBuffer (no copy)\n w.postMessage({\n cmd: 'demux',\n data: data,\n decryptdata: decryptdata,\n initSegment: initSegment,\n audioCodec: audioCodec,\n videoCodec: videoCodec,\n timeOffset: timeOffset,\n discontinuity: discontinuity,\n trackSwitch: trackSwitch,\n contiguous: contiguous,\n duration: duration,\n accurateTimeOffset: accurateTimeOffset,\n defaultInitPTS: defaultInitPTS\n }, data instanceof ArrayBuffer ? [data] : []);\n } else {\n var demuxer = this.demuxer;\n\n if (demuxer) {\n demuxer.push(data, decryptdata, initSegment, audioCodec, videoCodec, timeOffset, discontinuity, trackSwitch, contiguous, duration, accurateTimeOffset, defaultInitPTS);\n }\n }\n };\n\n _proto.onWorkerMessage = function onWorkerMessage(ev) {\n var data = ev.data,\n hls = this.hls;\n\n switch (data.event) {\n case 'init':\n // revoke the Object URL that was used to create demuxer worker, so as not to leak it\n global.URL.revokeObjectURL(this.w.objectURL);\n break;\n // special case for FRAG_PARSING_DATA: data1 and data2 are transferable objects\n\n case events[\"default\"].FRAG_PARSING_DATA:\n data.data.data1 = new Uint8Array(data.data1);\n\n if (data.data2) {\n data.data.data2 = new Uint8Array(data.data2);\n }\n\n /* falls through */\n\n default:\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 return Demuxer;\n}();\n\n/* harmony default export */ var demux_demuxer = (demuxer_Demuxer);\n// CONCATENATED MODULE: ./src/controller/level-helper.js\n\n\n\n\n\n/**\n * @module LevelHelper\n *\n * Providing methods dealing with playlist sliding and drift\n *\n * TODO: Create an actual `Level` class/model that deals with all this logic in an object-oriented-manner.\n *\n * */\n\nfunction addGroupId(level, type, id) {\n switch (type) {\n case 'audio':\n if (!level.audioGroupIds) {\n level.audioGroupIds = [];\n }\n\n level.audioGroupIds.push(id);\n break;\n\n case 'text':\n if (!level.textGroupIds) {\n level.textGroupIds = [];\n }\n\n level.textGroupIds.push(id);\n break;\n }\n}\nfunction updatePTS(fragments, fromIdx, toIdx) {\n var fragFrom = fragments[fromIdx],\n fragTo = fragments[toIdx],\n fragToPTS = fragTo.startPTS; // if we know startPTS[toIdx]\n\n if (Object(number[\"isFiniteNumber\"])(fragToPTS)) {\n // update fragment duration.\n // it helps to fix drifts between playlist reported duration and fragment real duration\n if (toIdx > fromIdx) {\n fragFrom.duration = fragToPTS - fragFrom.start;\n\n if (fragFrom.duration < 0) {\n logger[\"logger\"].warn(\"negative duration computed for frag \" + fragFrom.sn + \",level \" + fragFrom.level + \", there should be some duration drift between playlist and fragment!\");\n }\n } else {\n fragTo.duration = fragFrom.start - fragToPTS;\n\n if (fragTo.duration < 0) {\n logger[\"logger\"].warn(\"negative duration computed for frag \" + fragTo.sn + \",level \" + fragTo.level + \", there should be some duration drift between playlist and fragment!\");\n }\n }\n } else {\n // we dont know startPTS[toIdx]\n if (toIdx > fromIdx) {\n var contiguous = fragFrom.cc === fragTo.cc;\n fragTo.start = fragFrom.start + (contiguous && fragFrom.minEndPTS ? fragFrom.minEndPTS - fragFrom.start : fragFrom.duration);\n } else {\n fragTo.start = Math.max(fragFrom.start - fragTo.duration, 0);\n }\n }\n}\nfunction updateFragPTSDTS(details, frag, startPTS, endPTS, startDTS, endDTS) {\n // update frag PTS/DTS\n var maxStartPTS = startPTS;\n var minEndPTS = endPTS;\n\n if (Object(number[\"isFiniteNumber\"])(frag.startPTS)) {\n // delta PTS between audio and video\n var deltaPTS = Math.abs(frag.startPTS - startPTS);\n\n if (!Object(number[\"isFiniteNumber\"])(frag.deltaPTS)) {\n frag.deltaPTS = deltaPTS;\n } else {\n frag.deltaPTS = Math.max(deltaPTS, frag.deltaPTS);\n }\n\n maxStartPTS = Math.max(startPTS, frag.startPTS);\n startPTS = Math.min(startPTS, frag.startPTS);\n minEndPTS = Math.min(endPTS, frag.endPTS);\n endPTS = Math.max(endPTS, frag.endPTS);\n startDTS = Math.min(startDTS, frag.startDTS);\n endDTS = Math.max(endDTS, frag.endDTS);\n }\n\n var drift = startPTS - frag.start;\n frag.start = frag.startPTS = startPTS;\n frag.maxStartPTS = maxStartPTS;\n frag.endPTS = endPTS;\n frag.minEndPTS = minEndPTS;\n frag.startDTS = startDTS;\n frag.endDTS = endDTS;\n frag.duration = endPTS - startPTS;\n var sn = frag.sn; // exit if sn out of range\n\n if (!details || sn < details.startSN || sn > details.endSN) {\n return 0;\n }\n\n var fragIdx, fragments, i;\n fragIdx = sn - details.startSN;\n fragments = details.fragments; // 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\n fragments[fragIdx] = frag; // adjust fragment PTS/duration from seqnum-1 to frag 0\n\n for (i = fragIdx; i > 0; i--) {\n updatePTS(fragments, i, i - 1);\n } // adjust fragment PTS/duration from seqnum to last frag\n\n\n for (i = fragIdx; i < fragments.length - 1; i++) {\n updatePTS(fragments, i, i + 1);\n }\n\n details.PTSKnown = true;\n return drift;\n}\nfunction mergeDetails(oldDetails, newDetails) {\n // potentially retrieve cached initsegment\n if (newDetails.initSegment && oldDetails.initSegment) {\n newDetails.initSegment = oldDetails.initSegment;\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\n\n var ccOffset = 0;\n var PTSFrag;\n mapFragmentIntersection(oldDetails, newDetails, function (oldFrag, newFrag) {\n ccOffset = oldFrag.cc - newFrag.cc;\n\n if (Object(number[\"isFiniteNumber\"])(oldFrag.startPTS)) {\n newFrag.start = newFrag.startPTS = oldFrag.startPTS;\n newFrag.endPTS = oldFrag.endPTS;\n newFrag.duration = oldFrag.duration;\n newFrag.backtracked = oldFrag.backtracked;\n newFrag.dropped = oldFrag.dropped;\n PTSFrag = newFrag;\n } // PTS is known when there are overlapping segments\n\n\n newDetails.PTSKnown = true;\n });\n\n if (!newDetails.PTSKnown) {\n return;\n }\n\n if (ccOffset) {\n logger[\"logger\"].log('discontinuity sliding from playlist, take drift into account');\n var newFragments = newDetails.fragments;\n\n for (var i = 0; i < newFragments.length; i++) {\n newFragments[i].cc += ccOffset;\n }\n } // if at least one fragment contains PTS info, recompute PTS information for all fragments\n\n\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 } // if we are here, it means we have fragments overlapping between\n // old and new level. reliable PTS info is thus relying on old level\n\n\n newDetails.PTSKnown = oldDetails.PTSKnown;\n}\nfunction mergeSubtitlePlaylists(oldPlaylist, newPlaylist, referenceStart) {\n if (referenceStart === void 0) {\n referenceStart = 0;\n }\n\n var lastIndex = -1;\n mapFragmentIntersection(oldPlaylist, newPlaylist, function (oldFrag, newFrag, index) {\n newFrag.start = oldFrag.start;\n lastIndex = index;\n });\n var frags = newPlaylist.fragments;\n\n if (lastIndex < 0) {\n frags.forEach(function (frag) {\n frag.start += referenceStart;\n });\n return;\n }\n\n for (var i = lastIndex + 1; i < frags.length; i++) {\n frags[i].start = frags[i - 1].start + frags[i - 1].duration;\n }\n}\nfunction mapFragmentIntersection(oldPlaylist, newPlaylist, intersectionFn) {\n if (!oldPlaylist || !newPlaylist) {\n return;\n }\n\n var start = Math.max(oldPlaylist.startSN, newPlaylist.startSN) - newPlaylist.startSN;\n var end = Math.min(oldPlaylist.endSN, newPlaylist.endSN) - newPlaylist.startSN;\n var delta = newPlaylist.startSN - oldPlaylist.startSN;\n\n for (var i = start; i <= end; i++) {\n var oldFrag = oldPlaylist.fragments[delta + i];\n var newFrag = newPlaylist.fragments[i];\n\n if (!oldFrag || !newFrag) {\n break;\n }\n\n intersectionFn(oldFrag, newFrag, i);\n }\n}\nfunction adjustSliding(oldPlaylist, newPlaylist) {\n var delta = newPlaylist.startSN - oldPlaylist.startSN;\n var oldFragments = oldPlaylist.fragments;\n var newFragments = newPlaylist.fragments;\n\n if (delta < 0 || delta > oldFragments.length) {\n return;\n }\n\n for (var i = 0; i < newFragments.length; i++) {\n newFragments[i].start += oldFragments[delta].start;\n }\n}\nfunction computeReloadInterval(currentPlaylist, newPlaylist, lastRequestTime) {\n var reloadInterval = 1000 * (newPlaylist.averagetargetduration ? newPlaylist.averagetargetduration : newPlaylist.targetduration);\n var minReloadInterval = reloadInterval / 2;\n\n if (currentPlaylist && newPlaylist.endSN === currentPlaylist.endSN) {\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 = minReloadInterval;\n }\n\n if (lastRequestTime) {\n reloadInterval = Math.max(minReloadInterval, reloadInterval - (window.performance.now() - lastRequestTime));\n } // in any case, don't reload more than half of target duration\n\n\n return Math.round(reloadInterval);\n}\n// CONCATENATED MODULE: ./src/utils/time-ranges.ts\n/**\n * TimeRanges to string helper\n */\nvar TimeRanges = {\n toString: function toString(r) {\n var log = '';\n var len = r.length;\n\n for (var i = 0; i < len; i++) {\n log += '[' + r.start(i).toFixed(3) + ',' + r.end(i).toFixed(3) + ']';\n }\n\n return log;\n }\n};\n/* harmony default export */ var time_ranges = (TimeRanges);\n// CONCATENATED MODULE: ./src/utils/discontinuities.js\n\n\n\nfunction findFirstFragWithCC(fragments, cc) {\n var firstFrag = null;\n\n for (var i = 0; i < fragments.length; i += 1) {\n var currentFrag = fragments[i];\n\n if (currentFrag && currentFrag.cc === cc) {\n firstFrag = currentFrag;\n break;\n }\n }\n\n return firstFrag;\n}\nfunction findFragWithCC(fragments, CC) {\n return binary_search.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}\nfunction shouldAlignOnDiscontinuities(lastFrag, lastLevel, details) {\n var shouldAlign = false;\n\n if (lastLevel && lastLevel.details && details) {\n if (details.endCC > details.startCC || lastFrag && lastFrag.cc < details.startCC) {\n shouldAlign = true;\n }\n }\n\n return shouldAlign;\n} // Find the first frag in the previous level which matches the CC of the first frag of the new level\n\nfunction findDiscontinuousReferenceFrag(prevDetails, curDetails) {\n var prevFrags = prevDetails.fragments;\n var curFrags = curDetails.fragments;\n\n if (!curFrags.length || !prevFrags.length) {\n logger[\"logger\"].log('No fragments to align');\n return;\n }\n\n var prevStartFrag = findFirstFragWithCC(prevFrags, curFrags[0].cc);\n\n if (!prevStartFrag || prevStartFrag && !prevStartFrag.startPTS) {\n logger[\"logger\"].log('No frag in previous level to align on');\n return;\n }\n\n return prevStartFrag;\n}\nfunction adjustPts(sliding, details) {\n details.fragments.forEach(function (frag) {\n if (frag) {\n var start = frag.start + sliding;\n frag.start = frag.startPTS = start;\n frag.endPTS = start + frag.duration;\n }\n });\n details.PTSKnown = true;\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\nfunction alignStream(lastFrag, lastLevel, details) {\n alignDiscontinuities(lastFrag, details, lastLevel);\n\n if (!details.PTSKnown && lastLevel) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n}\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 lastLevel - The details of the last loaded level\n * @param details - The details of the new level\n */\n\nfunction alignDiscontinuities(lastFrag, details, lastLevel) {\n if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) {\n var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details);\n\n if (referenceFrag) {\n logger[\"logger\"].log('Adjusting PTS using last level due to CC increase within current level');\n adjustPts(referenceFrag.start, details);\n }\n }\n}\n/**\n * Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level.\n * @param details - The details of the new level\n * @param lastDetails - The details of the last loaded level\n */\n\nfunction alignPDT(details, lastDetails) {\n if (lastDetails && lastDetails.fragments.length) {\n if (!details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {\n return;\n } // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n\n\n var lastPDT = lastDetails.fragments[0].programDateTime;\n var newPDT = details.fragments[0].programDateTime; // date diff is in ms. frag.start is in seconds\n\n var sliding = (newPDT - lastPDT) / 1000 + lastDetails.fragments[0].start;\n\n if (Object(number[\"isFiniteNumber\"])(sliding)) {\n logger[\"logger\"].log(\"adjusting PTS using programDateTime delta, sliding:\" + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}\n// CONCATENATED MODULE: ./src/controller/fragment-finders.ts\n\n\n\n/**\n * Returns first fragment whose endPdt value exceeds the given PDT.\n * @param {Array<Fragment>} fragments - The array of candidate fragments\n * @param {number|null} [PDTValue = null] - The PDT value which must be exceeded\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*|null} fragment - The best matching fragment\n */\nfunction findFragmentByPDT(fragments, PDTValue, maxFragLookUpTolerance) {\n if (PDTValue === null || !Array.isArray(fragments) || !fragments.length || !Object(number[\"isFiniteNumber\"])(PDTValue)) {\n return null;\n } // if less than start\n\n\n var startPDT = fragments[0].programDateTime;\n\n if (PDTValue < (startPDT || 0)) {\n return null;\n }\n\n var endPDT = fragments[fragments.length - 1].endProgramDateTime;\n\n if (PDTValue >= (endPDT || 0)) {\n return null;\n }\n\n maxFragLookUpTolerance = maxFragLookUpTolerance || 0;\n\n for (var seg = 0; seg < fragments.length; ++seg) {\n var frag = fragments[seg];\n\n if (pdtWithinToleranceTest(PDTValue, maxFragLookUpTolerance, frag)) {\n return frag;\n }\n }\n\n return null;\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 {Array<Fragment>} fragments - The array of candidate fragments\n * @param {number} [bufferEnd = 0] - The end of the contiguous buffered range the playhead is currently within\n * @param {number} maxFragLookUpTolerance - The amount of time that a fragment's start/end can be within in order to be considered contiguous\n * @returns {*} foundFrag - The best matching fragment\n */\n\nfunction findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\n\n var fragNext = null;\n\n if (fragPrevious) {\n fragNext = fragments[fragPrevious.sn - fragments[0].sn + 1];\n } else if (bufferEnd === 0 && fragments[0].start === 0) {\n fragNext = fragments[0];\n } // Prefer the next fragment if it's within tolerance\n\n\n if (fragNext && fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext) === 0) {\n return fragNext;\n } // We might be seeking past the tolerance so find the best match\n\n\n var foundFragment = binary_search.search(fragments, fragmentWithinToleranceTest.bind(null, bufferEnd, maxFragLookUpTolerance));\n\n if (foundFragment) {\n return foundFragment;\n } // If no match was found return the next fragment after fragPrevious, or null\n\n\n return fragNext;\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 {number} [bufferEnd = 0] - The end of the current buffered range the playhead is currently within\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {number} - 0 if it matches, 1 if too low, -1 if too high\n */\n\nfunction fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, candidate) {\n if (bufferEnd === void 0) {\n bufferEnd = 0;\n }\n\n if (maxFragLookUpTolerance === void 0) {\n maxFragLookUpTolerance = 0;\n }\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\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\n return 0;\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 {number} [pdtBufferEnd = 0] - The Unix time representing the end of the current buffered range\n * @param {number} [maxFragLookUpTolerance = 0] - The amount of time that a fragment's start can be within in order to be considered contiguous\n * @returns {boolean} True if contiguous, false otherwise\n */\n\nfunction pdtWithinToleranceTest(pdtBufferEnd, maxFragLookUpTolerance, candidate) {\n var candidateLookupTolerance = Math.min(maxFragLookUpTolerance, candidate.duration + (candidate.deltaPTS ? candidate.deltaPTS : 0)) * 1000; // endProgramDateTime can be null, default to zero\n\n var endProgramDateTime = candidate.endProgramDateTime || 0;\n return endProgramDateTime - candidateLookupTolerance > pdtBufferEnd;\n}\n// CONCATENATED MODULE: ./src/controller/gap-controller.js\n\n\n\n\nvar STALL_MINIMUM_DURATION_MS = 250;\nvar MAX_START_GAP_JUMP = 2.0;\nvar SKIP_BUFFER_HOLE_STEP_SECONDS = 0.1;\nvar SKIP_BUFFER_RANGE_START = 0.05;\n\nvar gap_controller_GapController = /*#__PURE__*/function () {\n function GapController(config, media, fragmentTracker, hls) {\n this.config = config;\n this.media = media;\n this.fragmentTracker = fragmentTracker;\n this.hls = hls;\n this.nudgeRetry = 0;\n this.stallReported = false;\n this.stalled = null;\n this.moved = false;\n this.seeking = false;\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 {number} lastCurrentTime Previously read playhead position\n */\n\n\n var _proto = GapController.prototype;\n\n _proto.poll = function poll(lastCurrentTime) {\n var config = this.config,\n media = this.media,\n stalled = this.stalled;\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; // The playhead is moving, no-op\n\n if (currentTime !== lastCurrentTime) {\n this.moved = true;\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\n logger[\"logger\"].warn(\"playback not stuck anymore @\" + currentTime + \", after \" + Math.round(_stalledDuration) + \"ms\");\n this.stallReported = false;\n }\n\n this.stalled = null;\n this.nudgeRetry = 0;\n }\n\n return;\n } // Clear stalled state when beginning or finishing seeking so that we don't report stalls coming out of a seek\n\n\n if (beginSeek || seeked) {\n this.stalled = null;\n } // The playhead should not be moving\n\n\n if (media.paused || media.ended || media.playbackRate === 0 || !media.buffered.length) {\n return;\n }\n\n var bufferInfo = BufferHelper.bufferInfo(media, currentTime, 0);\n var isBuffered = bufferInfo.len > 0;\n var nextStart = bufferInfo.nextStart || 0; // There is no playable buffer (waiting for buffer append)\n\n if (!isBuffered && !nextStart) {\n return;\n }\n\n if (seeking) {\n // Waiting for seeking in a buffered range to complete\n var hasEnoughBuffer = bufferInfo.len > MAX_START_GAP_JUMP; // Next buffered range is too far ahead to jump to while still seeking\n\n var noBufferGap = !nextStart || nextStart - currentTime > MAX_START_GAP_JUMP && !this.fragmentTracker.getPartialFragment(currentTime);\n\n if (hasEnoughBuffer || noBufferGap) {\n return;\n } // Reset moved state when seeking to a point in or before a gap\n\n\n this.moved = false;\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\n\n if (!this.moved && this.stalled) {\n // Jump start gaps within jump threshold\n var startJump = Math.max(nextStart, bufferInfo.start || 0) - currentTime;\n\n if (startJump > 0 && startJump <= MAX_START_GAP_JUMP) {\n this._trySkipBufferHole(null);\n\n return;\n }\n } // Start tracking stall time\n\n\n var tnow = self.performance.now();\n\n if (stalled === null) {\n this.stalled = tnow;\n return;\n }\n\n var stalledDuration = tnow - stalled;\n\n if (!seeking && stalledDuration >= STALL_MINIMUM_DURATION_MS) {\n // Report stalling after trying to fix\n this._reportStall(bufferInfo.len);\n }\n\n var bufferedWithHoles = BufferHelper.bufferInfo(media, currentTime, config.maxBufferHole);\n\n this._tryFixBufferStall(bufferedWithHoles, stalledDuration);\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 ;\n\n _proto._tryFixBufferStall = function _tryFixBufferStall(bufferInfo, stalledDurationMs) {\n var config = this.config,\n fragmentTracker = this.fragmentTracker,\n media = this.media;\n var currentTime = media.currentTime;\n var partial = fragmentTracker.getPartialFragment(currentTime);\n\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); // we return here in this case, meaning\n // the branch below only executes when we don't handle a partial fragment\n\n\n if (targetTime) {\n return;\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\n\n if (bufferInfo.len > config.maxBufferHole && stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {\n logger[\"logger\"].warn('Trying to nudge playhead over buffer-hole'); // 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\n this.stalled = null;\n\n this._tryNudgeBuffer();\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 ;\n\n _proto._reportStall = function _reportStall(bufferLen) {\n var hls = this.hls,\n media = this.media,\n stallReported = this.stallReported;\n\n if (!stallReported) {\n // Report stalled error once\n this.stallReported = true;\n logger[\"logger\"].warn(\"Playback stalling at @\" + media.currentTime + \" due to low buffer (buffer=\" + bufferLen + \")\");\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_STALLED_ERROR,\n fatal: false,\n buffer: bufferLen\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 ;\n\n _proto._trySkipBufferHole = function _trySkipBufferHole(partial) {\n var config = this.config,\n hls = this.hls,\n media = this.media;\n var currentTime = media.currentTime;\n var lastEndTime = 0; // Check if currentTime is between unbuffered regions of partial fragments\n\n for (var i = 0; i < media.buffered.length; i++) {\n var startTime = media.buffered.start(i);\n\n if (currentTime + config.maxBufferHole >= lastEndTime && currentTime < startTime) {\n var targetTime = Math.max(startTime + SKIP_BUFFER_RANGE_START, media.currentTime + SKIP_BUFFER_HOLE_STEP_SECONDS);\n logger[\"logger\"].warn(\"skipping hole, adjusting currentTime from \" + currentTime + \" to \" + targetTime);\n this.moved = true;\n this.stalled = null;\n media.currentTime = targetTime;\n\n if (partial) {\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_SEEK_OVER_HOLE,\n fatal: false,\n reason: \"fragment loaded with buffer holes, seeking from \" + currentTime + \" to \" + targetTime,\n frag: partial\n });\n }\n\n return targetTime;\n }\n\n lastEndTime = media.buffered.end(i);\n }\n\n return 0;\n }\n /**\n * Attempts to fix buffer stalls by advancing the mediaElement's current time by a small amount.\n * @private\n */\n ;\n\n _proto._tryNudgeBuffer = function _tryNudgeBuffer() {\n var config = this.config,\n hls = this.hls,\n media = this.media;\n var currentTime = media.currentTime;\n var nudgeRetry = (this.nudgeRetry || 0) + 1;\n this.nudgeRetry = nudgeRetry;\n\n if (nudgeRetry < config.nudgeMaxRetry) {\n var targetTime = currentTime + nudgeRetry * config.nudgeOffset; // playback stalled in buffered area ... let's nudge currentTime to try to overcome this\n\n logger[\"logger\"].warn(\"Nudging 'currentTime' from \" + currentTime + \" to \" + targetTime);\n media.currentTime = targetTime;\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_NUDGE_ON_STALL,\n fatal: false\n });\n } else {\n logger[\"logger\"].error(\"Playhead still not moving while enough data buffered @\" + currentTime + \" after \" + config.nudgeMaxRetry + \" nudges\");\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_STALLED_ERROR,\n fatal: true\n });\n }\n };\n\n return GapController;\n}();\n\n\n// CONCATENATED MODULE: ./src/task-loop.ts\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction task_loop_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n/**\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 */\nvar TaskLoop = /*#__PURE__*/function (_EventHandler) {\n task_loop_inheritsLoose(TaskLoop, _EventHandler);\n\n function TaskLoop(hls) {\n var _this;\n\n for (var _len = arguments.length, events = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n\n _this = _EventHandler.call.apply(_EventHandler, [this, hls].concat(events)) || this;\n _this._boundTick = void 0;\n _this._tickTimer = null;\n _this._tickInterval = null;\n _this._tickCallCount = 0;\n _this._boundTick = _this.tick.bind(_assertThisInitialized(_this));\n return _this;\n }\n /**\n * @override\n */\n\n\n var _proto = TaskLoop.prototype;\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n // clear all timers before unregistering from event bus\n this.clearNextTick();\n this.clearInterval();\n }\n /**\n * @returns {boolean}\n */\n ;\n\n _proto.hasInterval = function hasInterval() {\n return !!this._tickInterval;\n }\n /**\n * @returns {boolean}\n */\n ;\n\n _proto.hasNextTick = function hasNextTick() {\n return !!this._tickTimer;\n }\n /**\n * @param {number} millis Interval time (ms)\n * @returns {boolean} True when interval has been scheduled, false when already scheduled (no effect)\n */\n ;\n\n _proto.setInterval = function setInterval(millis) {\n if (!this._tickInterval) {\n this._tickInterval = self.setInterval(this._boundTick, millis);\n return true;\n }\n\n return false;\n }\n /**\n * @returns {boolean} True when interval was cleared, false when none was set (no effect)\n */\n ;\n\n _proto.clearInterval = function clearInterval() {\n if (this._tickInterval) {\n self.clearInterval(this._tickInterval);\n this._tickInterval = null;\n return true;\n }\n\n return false;\n }\n /**\n * @returns {boolean} True when timeout was cleared, false when none was set (no effect)\n */\n ;\n\n _proto.clearNextTick = function clearNextTick() {\n if (this._tickTimer) {\n self.clearTimeout(this._tickTimer);\n this._tickTimer = null;\n return true;\n }\n\n return false;\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 ;\n\n _proto.tick = function tick() {\n this._tickCallCount++;\n\n if (this._tickCallCount === 1) {\n this.doTick(); // 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\n if (this._tickCallCount > 1) {\n // make sure only one timer exists at any time at max\n this.clearNextTick();\n this._tickTimer = self.setTimeout(this._boundTick, 0);\n }\n\n this._tickCallCount = 0;\n }\n }\n /**\n * For subclass to implement task logic\n * @abstract\n */\n ;\n\n _proto.doTick = function doTick() {};\n\n return TaskLoop;\n}(event_handler);\n\n\n// CONCATENATED MODULE: ./src/controller/base-stream-controller.js\n\n\nfunction base_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\nvar State = {\n STOPPED: 'STOPPED',\n STARTING: 'STARTING',\n IDLE: 'IDLE',\n PAUSED: 'PAUSED',\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 BUFFER_FLUSHING: 'BUFFER_FLUSHING',\n ENDED: 'ENDED',\n ERROR: 'ERROR',\n WAITING_INIT_PTS: 'WAITING_INIT_PTS',\n WAITING_LEVEL: 'WAITING_LEVEL'\n};\n\nvar base_stream_controller_BaseStreamController = /*#__PURE__*/function (_TaskLoop) {\n base_stream_controller_inheritsLoose(BaseStreamController, _TaskLoop);\n\n function BaseStreamController() {\n return _TaskLoop.apply(this, arguments) || this;\n }\n\n var _proto = BaseStreamController.prototype;\n\n _proto.doTick = function doTick() {};\n\n _proto.startLoad = function startLoad() {};\n\n _proto.stopLoad = function stopLoad() {\n var frag = this.fragCurrent;\n\n if (frag) {\n if (frag.loader) {\n frag.loader.abort();\n }\n\n this.fragmentTracker.removeFragment(frag);\n }\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null;\n this.clearInterval();\n this.clearNextTick();\n this.state = State.STOPPED;\n };\n\n _proto._streamEnded = function _streamEnded(bufferInfo, levelDetails) {\n var fragCurrent = this.fragCurrent,\n fragmentTracker = this.fragmentTracker; // we just got done loading the final fragment and there is no other buffered range after ...\n // rationale is that in case there are any buffered ranges after, it means that there are unbuffered portion in between\n // so we should not switch to ENDED in that case, to be able to buffer them\n // dont switch to ENDED if we need to backtrack last fragment\n\n if (!levelDetails.live && fragCurrent && !fragCurrent.backtracked && fragCurrent.sn === levelDetails.endSN && !bufferInfo.nextStart) {\n var fragState = fragmentTracker.getState(fragCurrent);\n return fragState === FragmentState.PARTIAL || fragState === FragmentState.OK;\n }\n\n return false;\n };\n\n _proto.onMediaSeeking = function onMediaSeeking() {\n var config = this.config,\n media = this.media,\n mediaBuffer = this.mediaBuffer,\n state = this.state;\n var currentTime = media ? media.currentTime : null;\n var bufferInfo = BufferHelper.bufferInfo(mediaBuffer || media, currentTime, this.config.maxBufferHole);\n logger[\"logger\"].log(\"media seeking to \" + (Object(number[\"isFiniteNumber\"])(currentTime) ? currentTime.toFixed(3) : currentTime));\n\n if (state === State.FRAG_LOADING) {\n var fragCurrent = this.fragCurrent; // check if we are seeking to a unbuffered area AND if frag loading is in progress\n\n if (bufferInfo.len === 0 && fragCurrent) {\n var tolerance = config.maxFragLookUpTolerance;\n var fragStartOffset = fragCurrent.start - tolerance;\n var fragEndOffset = fragCurrent.start + fragCurrent.duration + tolerance; // check if we seek position will be out of currently loaded frag range : if out cancel frag load, if in, don't do anything\n\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (fragCurrent.loader) {\n logger[\"logger\"].log('seeking outside of buffer while fragment load in progress, cancel fragment load');\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null; // switch to IDLE state to load new fragment\n\n this.state = State.IDLE;\n } else {\n logger[\"logger\"].log('seeking outside of buffer but within currently loaded fragment range');\n }\n }\n } else if (state === State.ENDED) {\n // if seeking to unbuffered area, clean up fragPrevious\n if (bufferInfo.len === 0) {\n this.fragPrevious = null;\n this.fragCurrent = null;\n } // switch to IDLE state to check for potential new fragment\n\n\n this.state = State.IDLE;\n }\n\n if (media) {\n this.lastCurrentTime = currentTime;\n } // in case seeking occurs although no media buffered, adjust startPosition and nextLoadPosition to seek target\n\n\n if (!this.loadedmetadata) {\n this.nextLoadPosition = this.startPosition = currentTime;\n } // tick to speed up processing\n\n\n this.tick();\n };\n\n _proto.onMediaEnded = function onMediaEnded() {\n // reset startPosition and lastCurrentTime to restart playback @ stream beginning\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this.stopLoad();\n\n _TaskLoop.prototype.onHandlerDestroying.call(this);\n };\n\n _proto.onHandlerDestroyed = function onHandlerDestroyed() {\n this.state = State.STOPPED;\n this.fragmentTracker = null;\n };\n\n _proto.computeLivePosition = function computeLivePosition(sliding, levelDetails) {\n var targetLatency = this.config.liveSyncDuration !== undefined ? this.config.liveSyncDuration : this.config.liveSyncDurationCount * levelDetails.targetduration;\n return sliding + Math.max(0, levelDetails.totalduration - targetLatency);\n };\n\n return BaseStreamController;\n}(TaskLoop);\n\n\n// CONCATENATED MODULE: ./src/controller/stream-controller.js\n\n\n\n\n\n\n\nfunction stream_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction stream_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) stream_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) stream_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar TICK_INTERVAL = 100; // how often to tick in ms\n\nvar stream_controller_StreamController = /*#__PURE__*/function (_BaseStreamController) {\n stream_controller_inheritsLoose(StreamController, _BaseStreamController);\n\n function StreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].LEVEL_LOADED, events[\"default\"].LEVELS_UPDATED, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_LOAD_EMERGENCY_ABORTED, events[\"default\"].FRAG_PARSING_INIT_SEGMENT, events[\"default\"].FRAG_PARSING_DATA, events[\"default\"].FRAG_PARSED, events[\"default\"].ERROR, events[\"default\"].AUDIO_TRACK_SWITCHING, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].BUFFER_CREATED, events[\"default\"].BUFFER_APPENDED, events[\"default\"].BUFFER_FLUSHED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = State.STOPPED;\n _this.stallReported = false;\n _this.gapController = null;\n _this.altAudio = false;\n _this.audioOnly = false;\n _this.bitrateTest = false;\n return _this;\n }\n\n var _proto = StreamController.prototype;\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 this.fragLoadError = 0;\n\n if (!this.startFragRequested) {\n // determine load level\n var startLevel = hls.startLevel;\n\n if (startLevel === -1) {\n if (hls.config.testBandwidth) {\n // -1 : guess start Level by doing a bitrate test by loading first fragment of lowest quality level\n startLevel = 0;\n this.bitrateTest = true;\n } else {\n startLevel = hls.nextAutoLevel;\n }\n } // 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\n\n this.level = hls.nextLoadLevel = startLevel;\n this.loadedmetadata = false;\n } // if startPosition undefined but lastCurrentTime set, set startPosition to last currentTime\n\n\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"logger\"].log(\"override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n startPosition = lastCurrentTime;\n }\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\n _proto.stopLoad = function stopLoad() {\n this.forceStartLoad = false;\n\n _BaseStreamController.prototype.stopLoad.call(this);\n };\n\n _proto.doTick = function doTick() {\n switch (this.state) {\n case State.BUFFER_FLUSHING:\n // in buffer flushing state, reset fragLoadError counter\n this.fragLoadError = 0;\n break;\n\n case State.IDLE:\n this._doTickIdle();\n\n break;\n\n case State.WAITING_LEVEL:\n var level = this.levels[this.level]; // check if playlist is already loaded\n\n if (level && level.details) {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = window.performance.now();\n var retryDate = this.retryDate; // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n\n if (!retryDate || now >= retryDate || this.media && this.media.seeking) {\n logger[\"logger\"].log('mediaController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n\n break;\n\n case State.ERROR:\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n\n default:\n break;\n } // check buffer\n\n\n this._checkBuffer(); // check/update current fragment\n\n\n this._checkFragmentChanged();\n } // Ironically the \"idle\" state is the on we do the most logic in it seems ....\n // NOTE: Maybe we could rather schedule a check for buffer length after half of the currently\n // played segment, or on pause/play/seek instead of naively checking every 100ms?\n ;\n\n _proto._doTickIdle = function _doTickIdle() {\n var hls = this.hls,\n config = hls.config,\n media = this.media; // if start level not parsed yet OR\n // if video not attached AND start fragment already requested OR start frag prefetch disable\n // exit loop, as we either need more info (level not parsed) or we need media to be attached to load new fragment\n\n if (this.levelLastLoaded === undefined || !media && (this.startFragRequested || !config.startFragPrefetch)) {\n return;\n } // If the \"main\" level is audio-only but we are loading an alternate track in the same group, do not load anything\n\n\n if (this.altAudio && this.audioOnly) {\n // Clear audio demuxer state so when switching back to main audio we're not still appending where we left off\n this.demuxer.frag = null;\n return;\n } // if we have not yet loaded any fragment, start loading from start position\n\n\n var pos;\n\n if (this.loadedmetadata) {\n pos = media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n } // determine next load level\n\n\n var level = hls.nextLoadLevel,\n levelInfo = this.levels[level];\n\n if (!levelInfo) {\n return;\n }\n\n var levelBitrate = levelInfo.bitrate,\n maxBufLen; // compute max Buffer Length that we could get from this load level, based on level bitrate.\n\n if (levelBitrate) {\n maxBufLen = Math.max(8 * config.maxBufferSize / levelBitrate, config.maxBufferLength);\n } else {\n maxBufLen = config.maxBufferLength;\n }\n\n maxBufLen = Math.min(maxBufLen, config.maxMaxBufferLength); // determine next candidate fragment to be loaded, based on current position and end of buffer position\n // ensure up to `config.maxMaxBufferLength` of buffer upfront\n\n var maxBufferHole = pos < config.maxBufferHole ? Math.max(MAX_START_GAP_JUMP, config.maxBufferHole) : config.maxBufferHole;\n var bufferInfo = BufferHelper.bufferInfo(this.mediaBuffer ? this.mediaBuffer : media, pos, maxBufferHole);\n var bufferLen = bufferInfo.len; // Stay idle if we are still with buffer margins\n\n if (bufferLen >= maxBufLen) {\n return;\n } // if buffer length is less than maxBufLen try to load a new fragment ...\n\n\n logger[\"logger\"].trace(\"buffer length of \" + bufferLen.toFixed(3) + \" is below max of \" + maxBufLen.toFixed(3) + \". checking for more payload ...\"); // set next load level : this will trigger a playlist load if needed\n\n this.level = hls.nextLoadLevel = level;\n var levelDetails = levelInfo.details; // 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\n if (!levelDetails || levelDetails.live && this.levelLastLoaded !== level) {\n this.state = State.WAITING_LEVEL;\n return;\n }\n\n if (this._streamEnded(bufferInfo, levelDetails)) {\n var data = {};\n\n if (this.altAudio) {\n data.type = 'video';\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_EOS, data);\n this.state = State.ENDED;\n return;\n } // if we have the levelDetails for the selected variant, lets continue enrichen our stream (load keys/fragments or trigger EOS, etc..)\n\n\n this._fetchPayloadOrEos(pos, bufferInfo, levelDetails);\n };\n\n _proto._fetchPayloadOrEos = function _fetchPayloadOrEos(pos, bufferInfo, levelDetails) {\n var fragPrevious = this.fragPrevious,\n level = this.level,\n fragments = levelDetails.fragments,\n fragLen = fragments.length; // empty playlist\n\n if (fragLen === 0) {\n return;\n } // find fragment index, contiguous with end of buffer position\n\n\n var start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n bufferEnd = bufferInfo.end,\n frag;\n\n if (levelDetails.initSegment && !levelDetails.initSegment.data) {\n frag = levelDetails.initSegment;\n } else {\n // in case of live playlist we need to ensure that requested position is not located before playlist start\n if (levelDetails.live) {\n var initialLiveManifestSize = this.config.initialLiveManifestSize;\n\n if (fragLen < initialLiveManifestSize) {\n logger[\"logger\"].warn(\"Can not start playback of a level, reason: not enough fragments \" + fragLen + \" < \" + initialLiveManifestSize);\n return;\n }\n\n frag = this._ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments); // if it explicitely returns null don't load any fragment and exit function now\n\n if (frag === null) {\n return;\n }\n } else {\n // VoD playlist: if bufferEnd before start of playlist, load first fragment\n if (bufferEnd < start) {\n frag = fragments[0];\n }\n }\n }\n\n if (!frag) {\n frag = this._findFragment(start, fragPrevious, fragLen, fragments, bufferEnd, end, levelDetails);\n }\n\n if (frag) {\n if (frag.encrypted) {\n this._loadKey(frag, levelDetails);\n } else {\n this._loadFragment(frag, levelDetails, pos, bufferEnd);\n }\n }\n };\n\n _proto._ensureFragmentAtLivePoint = function _ensureFragmentAtLivePoint(levelDetails, bufferEnd, start, end, fragPrevious, fragments) {\n var config = this.hls.config,\n media = this.media;\n var frag; // check if requested position is within seekable boundaries :\n // logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.media.seeking}`);\n\n var maxLatency = Infinity;\n\n if (config.liveMaxLatencyDuration !== undefined) {\n maxLatency = config.liveMaxLatencyDuration;\n } else if (Object(number[\"isFiniteNumber\"])(config.liveMaxLatencyDurationCount)) {\n maxLatency = config.liveMaxLatencyDurationCount * levelDetails.targetduration;\n }\n\n if (bufferEnd < Math.max(start - config.maxFragLookUpTolerance, end - maxLatency)) {\n var liveSyncPosition = this.liveSyncPosition = this.computeLivePosition(start, levelDetails);\n bufferEnd = liveSyncPosition;\n\n if (media && !media.paused && media.readyState && media.duration > liveSyncPosition && liveSyncPosition > media.currentTime) {\n logger[\"logger\"].log(\"buffer end: \" + bufferEnd.toFixed(3) + \" is located too far from the end of live sliding playlist, reset currentTime to : \" + liveSyncPosition.toFixed(3));\n media.currentTime = liveSyncPosition;\n }\n\n this.nextLoadPosition = liveSyncPosition;\n } // if end of buffer greater than live edge, don't load any fragment\n // this could happen if live playlist intermittently slides in the past.\n // level 1 loaded [182580161,182580167]\n // level 1 loaded [182580162,182580169]\n // Loading 182580168 of [182580162 ,182580169],level 1 ..\n // Loading 182580169 of [182580162 ,182580169],level 1 ..\n // level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168\n // level 1 loaded [182580164,182580171]\n //\n // don't return null in case media not loaded yet (readystate === 0)\n\n\n if (levelDetails.PTSKnown && bufferEnd > end && media && media.readyState) {\n return null;\n }\n\n if (this.startFragRequested && !levelDetails.PTSKnown) {\n /* we are switching level on live playlist, but we don't have any PTS info for that quality level ...\n try to load frag matching with next SN.\n even if SN are not synchronized between playlists, loading this frag will help us\n compute playlist sliding and find the right one after in case it was not the right consecutive one */\n if (fragPrevious) {\n if (levelDetails.hasProgramDateTime) {\n // Relies on PDT in order to switch bitrates (Support EXT-X-DISCONTINUITY without EXT-X-DISCONTINUITY-SEQUENCE)\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with same PDT: \" + fragPrevious.programDateTime);\n frag = findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, config.maxFragLookUpTolerance);\n } else {\n // Uses buffer and sequence number to calculate switch segment (required if using EXT-X-DISCONTINUITY-SEQUENCE)\n var targetSN = fragPrevious.sn + 1;\n\n if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {\n var fragNext = fragments[targetSN - levelDetails.startSN];\n\n if (fragPrevious.cc === fragNext.cc) {\n frag = fragNext;\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with next SN: \" + frag.sn);\n }\n } // next frag SN not available (or not with same continuity counter)\n // look for a frag sharing the same CC\n\n\n if (!frag) {\n frag = binary_search.search(fragments, function (frag) {\n return fragPrevious.cc - frag.cc;\n });\n\n if (frag) {\n logger[\"logger\"].log(\"live playlist, switching playlist, load frag with same CC: \" + frag.sn);\n }\n }\n }\n }\n }\n\n return frag;\n };\n\n _proto._findFragment = function _findFragment(start, fragPreviousLoad, fragmentIndexRange, fragments, bufferEnd, end, levelDetails) {\n var config = this.hls.config;\n var fragNextLoad;\n\n if (bufferEnd < end) {\n var lookupTolerance = bufferEnd > end - config.maxFragLookUpTolerance ? 0 : config.maxFragLookUpTolerance; // 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\n fragNextLoad = findFragmentByPTS(fragPreviousLoad, fragments, bufferEnd, lookupTolerance);\n } else {\n // reach end of playlist\n fragNextLoad = fragments[fragmentIndexRange - 1];\n }\n\n if (fragNextLoad) {\n var curSNIdx = fragNextLoad.sn - levelDetails.startSN;\n var sameLevel = fragPreviousLoad && fragNextLoad.level === fragPreviousLoad.level;\n var prevSnFrag = fragments[curSNIdx - 1];\n var nextSnFrag = fragments[curSNIdx + 1]; // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n\n if (fragPreviousLoad && fragNextLoad.sn === fragPreviousLoad.sn) {\n if (sameLevel && !fragNextLoad.backtracked) {\n if (fragNextLoad.sn < levelDetails.endSN) {\n var deltaPTS = fragPreviousLoad.deltaPTS; // if there is a significant delta between audio and video, larger than max allowed hole,\n // and if previous remuxed fragment did not start with a keyframe. (fragPrevious.dropped)\n // let's try to load previous fragment again to get last keyframe\n // then we will reload again current fragment (that way we should be able to fill the buffer hole ...)\n\n if (deltaPTS && deltaPTS > config.maxBufferHole && fragPreviousLoad.dropped && curSNIdx) {\n fragNextLoad = prevSnFrag;\n logger[\"logger\"].warn('Previous fragment was dropped with large PTS gap between audio and video. Maybe fragment is not starting with a keyframe? Loading previous one to try to overcome this');\n } else {\n fragNextLoad = nextSnFrag;\n\n if (this.fragmentTracker.getState(fragNextLoad) !== FragmentState.OK) {\n logger[\"logger\"].log(\"Re-loading fragment with SN: \" + fragNextLoad.sn);\n }\n }\n } else {\n fragNextLoad = null;\n }\n } else if (fragNextLoad.backtracked) {\n // Only backtrack a max of 1 consecutive fragment to prevent sliding back too far when little or no frags start with keyframes\n if (nextSnFrag && nextSnFrag.backtracked) {\n logger[\"logger\"].warn(\"Already backtracked from fragment \" + nextSnFrag.sn + \", will not backtrack to fragment \" + fragNextLoad.sn + \". Loading fragment \" + nextSnFrag.sn);\n fragNextLoad = nextSnFrag;\n } else {\n // If a fragment has dropped frames and it's in a same level/sequence, load the previous fragment to try and find the keyframe\n // Reset the dropped count now since it won't be reset until we parse the fragment again, which prevents infinite backtracking on the same segment\n logger[\"logger\"].warn('Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe');\n fragNextLoad.dropped = 0;\n\n if (prevSnFrag) {\n fragNextLoad = prevSnFrag;\n fragNextLoad.backtracked = true;\n } else if (curSNIdx) {\n // can't backtrack on very first fragment\n fragNextLoad = null;\n }\n }\n }\n }\n }\n\n return fragNextLoad;\n };\n\n _proto._loadKey = function _loadKey(frag, levelDetails) {\n logger[\"logger\"].log(\"Loading key for \" + frag.sn + \" of [\" + levelDetails.startSN + \"-\" + levelDetails.endSN + \"], level \" + this.level);\n this.state = State.KEY_LOADING;\n this.hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: frag\n });\n };\n\n _proto._loadFragment = function _loadFragment(frag, levelDetails, pos, bufferEnd) {\n // Check if fragment is not loaded\n var fragState = this.fragmentTracker.getState(frag);\n this.fragCurrent = frag;\n\n if (frag.sn !== 'initSegment') {\n this.startFragRequested = true;\n } // Don't update nextLoadPosition for fragments which are not buffered\n\n\n if (Object(number[\"isFiniteNumber\"])(frag.sn) && !frag.bitrateTest) {\n this.nextLoadPosition = frag.start + frag.duration;\n } // Allow backtracked fragments to load\n\n\n if (frag.backtracked || fragState === FragmentState.NOT_LOADED || fragState === FragmentState.PARTIAL) {\n frag.autoLevel = this.hls.autoLevelEnabled;\n frag.bitrateTest = this.bitrateTest;\n logger[\"logger\"].log(\"Loading \" + frag.sn + \" of [\" + levelDetails.startSN + \"-\" + levelDetails.endSN + \"], level \" + this.level + \", \" + (this.loadedmetadata ? 'currentTime' : 'nextLoadPosition') + \": \" + parseFloat(pos.toFixed(3)) + \", bufferEnd: \" + parseFloat(bufferEnd.toFixed(3)));\n this.hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: frag\n }); // lazy demuxer init, as this could take some time ... do it during frag loading\n\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'main');\n }\n\n this.state = State.FRAG_LOADING;\n } else if (fragState === FragmentState.APPENDING) {\n // Lower the buffer size and try again\n if (this._reduceMaxBufferLength(frag.duration)) {\n this.fragmentTracker.removeFragment(frag);\n }\n }\n };\n\n _proto.getBufferedFrag = function getBufferedFrag(position) {\n return this.fragmentTracker.getBufferedFrag(position, PlaylistLevelType.MAIN);\n };\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.endPTS + 0.5);\n }\n\n return null;\n };\n\n _proto._checkFragmentChanged = function _checkFragmentChanged() {\n var fragPlayingCurrent,\n currentTime,\n video = this.media;\n\n if (video && video.readyState && video.seeking === false) {\n 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 (currentTime > this.lastCurrentTime) {\n this.lastCurrentTime = currentTime;\n }\n\n if (BufferHelper.isBuffered(video, currentTime)) {\n fragPlayingCurrent = this.getBufferedFrag(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.getBufferedFrag(currentTime + 0.1);\n }\n\n if (fragPlayingCurrent) {\n var fragPlaying = fragPlayingCurrent;\n\n if (fragPlaying !== this.fragPlaying) {\n this.hls.trigger(events[\"default\"].FRAG_CHANGED, {\n frag: fragPlaying\n });\n var fragPlayingLevel = fragPlaying.level;\n\n if (!this.fragPlaying || this.fragPlaying.level !== fragPlayingLevel) {\n this.hls.trigger(events[\"default\"].LEVEL_SWITCHED, {\n level: fragPlayingLevel\n });\n }\n\n this.fragPlaying = fragPlaying;\n }\n }\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 ;\n\n _proto.immediateLevelSwitch = function immediateLevelSwitch() {\n logger[\"logger\"].log('immediateLevelSwitch');\n\n if (!this.immediateSwitch) {\n this.immediateSwitch = true;\n var media = this.media,\n previouslyPaused;\n\n if (media) {\n previouslyPaused = media.paused;\n\n if (!previouslyPaused) {\n media.pause();\n }\n } else {\n // don't restart playback after instant level switch in case media not attached\n previouslyPaused = true;\n }\n\n this.previouslyPaused = previouslyPaused;\n }\n\n var fragCurrent = this.fragCurrent;\n\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null; // flush everything\n\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n /**\n * on immediate level switch end, after new fragment has been buffered:\n * - nudge video decoder by slightly adjusting video currentTime (if currentTime buffered)\n * - resume the playback if needed\n */\n ;\n\n _proto.immediateLevelSwitchEnd = function immediateLevelSwitchEnd() {\n var media = this.media;\n\n if (media && media.buffered.length) {\n this.immediateSwitch = false;\n\n if (media.currentTime > 0 && BufferHelper.isBuffered(media, media.currentTime)) {\n // only nudge if currentTime is buffered\n media.currentTime -= 0.0001;\n }\n\n if (!this.previouslyPaused) {\n media.play();\n }\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 ;\n\n _proto.nextLevelSwitch = function nextLevelSwitch() {\n var media = this.media; // ensure that media is defined and that metadata are available (to retrieve currentTime)\n\n if (media && media.readyState) {\n var fetchdelay;\n var fragPlayingCurrent = this.getBufferedFrag(media.currentTime);\n\n if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 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.startPTS - 1);\n }\n\n if (!media.paused) {\n // add a safety delay of 1s\n var nextLevelId = this.hls.nextLoadLevel,\n nextLevel = this.levels[nextLevelId],\n fragLastKbps = this.fragLastKbps;\n\n if (fragLastKbps && this.fragCurrent) {\n fetchdelay = this.fragCurrent.duration * nextLevel.bitrate / (1000 * fragLastKbps) + 1;\n } else {\n fetchdelay = 0;\n }\n } else {\n fetchdelay = 0;\n } // logger.log('fetchdelay:'+fetchdelay);\n // find buffer range that will be reached once new fragment will be fetched\n\n\n var bufferedFrag = this.getBufferedFrag(media.currentTime + fetchdelay);\n\n if (bufferedFrag) {\n // we can flush buffer range following this one without stalling playback\n var nextBufferedFrag = this.followingBufferedFrag(bufferedFrag);\n\n if (nextBufferedFrag) {\n // if we are here, we can also cancel any loading/demuxing in progress, as they are useless\n var fragCurrent = this.fragCurrent;\n\n if (fragCurrent && fragCurrent.loader) {\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null; // start flush position is the start PTS of next buffered frag.\n // we use frag.naxStartPTS which is max(audio startPTS, video startPTS).\n // in case there is a small PTS Delta between audio and video, using maxStartPTS avoids flushing last samples from current fragment\n\n var startPts = Math.max(bufferedFrag.endPTS, nextBufferedFrag.maxStartPTS + Math.min(this.config.maxFragLookUpTolerance, nextBufferedFrag.duration));\n this.flushMainBuffer(startPts, Number.POSITIVE_INFINITY);\n }\n }\n }\n };\n\n _proto.flushMainBuffer = function flushMainBuffer(startOffset, endOffset) {\n this.state = State.BUFFER_FLUSHING;\n var flushScope = {\n startOffset: startOffset,\n endOffset: endOffset\n }; // if alternate audio tracks are used, only flush video, otherwise flush everything\n\n if (this.altAudio) {\n flushScope.type = 'video';\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHING, flushScope);\n };\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n var media = this.media = this.mediaBuffer = data.media;\n this.onvseeking = this.onMediaSeeking.bind(this);\n this.onvseeked = this.onMediaSeeked.bind(this);\n this.onvended = this.onMediaEnded.bind(this);\n media.addEventListener('seeking', this.onvseeking);\n media.addEventListener('seeked', this.onvseeked);\n media.addEventListener('ended', this.onvended);\n var config = this.config;\n\n if (this.levels && config.autoStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n\n this.gapController = new gap_controller_GapController(config, media, this.fragmentTracker, this.hls);\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n\n if (media && media.ended) {\n logger[\"logger\"].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n } // reset fragment backtracked flag\n\n\n var levels = this.levels;\n\n if (levels) {\n levels.forEach(function (level) {\n if (level.details) {\n level.details.fragments.forEach(function (fragment) {\n fragment.backtracked = undefined;\n });\n }\n });\n } // remove video listeners\n\n\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('seeked', this.onvseeked);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n\n this.fragmentTracker.removeAllFragments();\n this.media = this.mediaBuffer = null;\n this.loadedmetadata = false;\n this.stopLoad();\n };\n\n _proto.onMediaSeeked = function onMediaSeeked() {\n var media = this.media;\n var currentTime = media ? media.currentTime : undefined;\n\n if (Object(number[\"isFiniteNumber\"])(currentTime)) {\n logger[\"logger\"].log(\"media seeked to \" + currentTime.toFixed(3));\n } // tick to speed up FRAGMENT_PLAYING triggering\n\n\n this.tick();\n };\n\n _proto.onManifestLoading = function onManifestLoading() {\n // reset buffer on manifest loading\n logger[\"logger\"].log('trigger BUFFER_RESET');\n this.hls.trigger(events[\"default\"].BUFFER_RESET);\n this.fragmentTracker.removeAllFragments();\n this.stalled = false;\n this.startPosition = this.lastCurrentTime = 0;\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var aac = false,\n heaac = false,\n codec;\n data.levels.forEach(function (level) {\n // detect if we have different kind of audio codecs used amongst playlists\n codec = level.audioCodec;\n\n if (codec) {\n if (codec.indexOf('mp4a.40.2') !== -1) {\n aac = true;\n }\n\n if (codec.indexOf('mp4a.40.5') !== -1) {\n heaac = true;\n }\n }\n });\n this.audioCodecSwitch = aac && heaac;\n\n if (this.audioCodecSwitch) {\n logger[\"logger\"].log('both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC');\n }\n\n this.altAudio = data.altAudio;\n this.levels = data.levels;\n this.startFragRequested = false;\n var config = this.config;\n\n if (config.autoStartLoad || this.forceStartLoad) {\n this.hls.startLoad(config.startPosition);\n }\n };\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n var newDetails = data.details;\n var newLevelId = data.level;\n var lastLevel = this.levels[this.levelLastLoaded];\n var curLevel = this.levels[newLevelId];\n var duration = newDetails.totalduration;\n var sliding = 0;\n logger[\"logger\"].log(\"level \" + newLevelId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n\n if (newDetails.live || curLevel.details && curLevel.details.live) {\n var curDetails = curLevel.details;\n\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start;\n this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n\n if (newDetails.PTSKnown && Object(number[\"isFiniteNumber\"])(sliding)) {\n logger[\"logger\"].log(\"live playlist sliding:\" + sliding.toFixed(3));\n } else {\n logger[\"logger\"].log('live playlist - outdated PTS, unknown sliding');\n alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n logger[\"logger\"].log('live playlist - first load, unknown sliding');\n newDetails.PTSKnown = false;\n alignStream(this.fragPrevious, lastLevel, newDetails);\n }\n } else {\n newDetails.PTSKnown = false;\n } // override level info\n\n\n curLevel.details = newDetails;\n this.levelLastLoaded = newLevelId;\n this.hls.trigger(events[\"default\"].LEVEL_UPDATED, {\n details: newDetails,\n level: newLevelId\n });\n\n if (this.startFragRequested === false) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1 || this.lastCurrentTime === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n if (startTimeOffset < 0) {\n logger[\"logger\"].log(\"negative start time offset \" + startTimeOffset + \", count from end of last fragment\");\n startTimeOffset = sliding + duration + startTimeOffset;\n }\n\n logger[\"logger\"].log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n // if live playlist, set start position to be fragment N-this.config.liveSyncDurationCount (usually 3)\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"logger\"].log(\"configure startPosition to \" + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n\n this.lastCurrentTime = this.startPosition;\n }\n\n this.nextLoadPosition = this.startPosition;\n } // only switch batck to IDLE state if we were waiting for level to start downloading a new fragment\n\n\n if (this.state === State.WAITING_LEVEL) {\n this.state = State.IDLE;\n } // trigger handler right now\n\n\n this.tick();\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n hls = this.hls,\n levels = this.levels,\n media = this.media;\n var fragLoaded = data.frag;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'main' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var stats = data.stats;\n var currentLevel = levels[fragCurrent.level];\n var details = currentLevel.details; // reset frag bitrate test in any case after frag loaded event\n // if this frag was loaded to perform a bitrate test AND if hls.nextLoadLevel is greater than 0\n // then this means that we should be able to load a fragment at a higher quality level\n\n this.bitrateTest = false;\n this.stats = stats;\n logger[\"logger\"].log(\"Loaded \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level);\n\n if (fragLoaded.bitrateTest && hls.nextLoadLevel) {\n // switch back to IDLE state ... we just loaded a fragment to determine adequate start bitrate and initialize autoswitch algo\n this.state = State.IDLE;\n this.startFragRequested = false;\n stats.tparsed = stats.tbuffered = window.performance.now();\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'main'\n });\n this.tick();\n } else if (fragLoaded.sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = window.performance.now();\n details.initSegment.data = data.payload;\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'main'\n });\n this.tick();\n } else {\n logger[\"logger\"].log(\"Parsing \" + fragCurrent.sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],level \" + fragCurrent.level + \", cc \" + fragCurrent.cc);\n this.state = State.PARSING;\n this.pendingBuffering = true;\n this.appended = false; // Bitrate test frags are not usually buffered so the fragment tracker ignores them. If Hls.js decides to buffer\n // it (and therefore ends up at this line), then the fragment tracker needs to be manually informed.\n\n if (fragLoaded.bitrateTest) {\n fragLoaded.bitrateTest = false;\n this.fragmentTracker.onFragLoaded({\n frag: fragLoaded\n });\n } // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live) and if media is not seeking (this is to overcome potential timestamp drifts between playlists and fragments)\n\n\n var accurateTimeOffset = !(media && media.seeking) && (details.PTSKnown || !details.live);\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n\n var audioCodec = this._getAudioCodec(currentLevel); // transmux the MPEG-TS data to ISO-BMFF segments\n\n\n var demuxer = this.demuxer = this.demuxer || new demux_demuxer(this.hls, 'main');\n demuxer.push(data.payload, initSegmentData, audioCodec, currentLevel.videoCodec, fragCurrent, details.totalduration, accurateTimeOffset);\n }\n }\n\n this.fragLoadError = 0;\n };\n\n _proto.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n trackName,\n track;\n this.audioOnly = tracks.audio && !tracks.video; // if audio track is expected to come from audio stream controller, discard any coming from main\n\n if (this.altAudio && !this.audioOnly) {\n delete tracks.audio;\n } // include levelCodec in audio and video tracks\n\n\n track = tracks.audio;\n\n if (track) {\n var audioCodec = this.levels[this.level].audioCodec,\n ua = navigator.userAgent.toLowerCase();\n\n if (audioCodec && this.audioCodecSwap) {\n logger[\"logger\"].log('swapping playlist audio codec');\n\n if (audioCodec.indexOf('mp4a.40.5') !== -1) {\n audioCodec = 'mp4a.40.2';\n } else {\n audioCodec = 'mp4a.40.5';\n }\n } // in case AAC and HE-AAC audio codecs are signalled in manifest\n // force HE-AAC , as it seems that most browsers prefers that way,\n // except for mono streams OR on FF\n // these conditions might need to be reviewed ...\n\n\n if (this.audioCodecSwitch) {\n // don't force HE-AAC if mono stream\n if (track.metadata.channelCount !== 1 && // don't force HE-AAC if firefox\n ua.indexOf('firefox') === -1) {\n audioCodec = 'mp4a.40.5';\n }\n } // HE-AAC is broken on Android, always signal audio codec as AAC even if variant manifest states otherwise\n\n\n if (ua.indexOf('android') !== -1 && track.container !== 'audio/mpeg') {\n // Exclude mpeg audio\n audioCodec = 'mp4a.40.2';\n logger[\"logger\"].log(\"Android: force audio codec to \" + audioCodec);\n }\n\n track.levelCodec = audioCodec;\n track.id = data.id;\n }\n\n track = tracks.video;\n\n if (track) {\n track.levelCodec = this.levels[this.level].videoCodec;\n track.id = data.id;\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_CODECS, tracks); // loop through tracks that are going to be provided to bufferController\n\n for (trackName in tracks) {\n track = tracks[trackName];\n logger[\"logger\"].log(\"main track:\" + trackName + \",container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n\n if (initSegment) {\n this.appended = true; // arm pending Buffering flag before appending a segment\n\n this.pendingBuffering = true;\n this.hls.trigger(events[\"default\"].BUFFER_APPENDING, {\n type: trackName,\n data: initSegment,\n parent: 'main',\n content: 'initSegment'\n });\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n };\n\n _proto.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && !(data.type === 'audio' && this.altAudio) && // filter out main audio if audio track is loaded through audio stream controller\n this.state === State.PARSING) {\n var level = this.levels[this.level],\n frag = fragCurrent;\n\n if (!Object(number[\"isFiniteNumber\"])(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n if (data.hasAudio === true) {\n frag.addElementaryStream(ElementaryStreamTypes.AUDIO);\n }\n\n if (data.hasVideo === true) {\n frag.addElementaryStream(ElementaryStreamTypes.VIDEO);\n }\n\n logger[\"logger\"].log(\"Parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb + \",dropped:\" + (data.dropped || 0)); // Detect gaps in a fragment and try to fix it by finding a keyframe in the previous fragment (see _findFragments)\n\n if (data.type === 'video') {\n frag.dropped = data.dropped;\n\n if (frag.dropped) {\n if (!frag.backtracked) {\n var levelDetails = level.details;\n\n if (levelDetails && frag.sn === levelDetails.startSN) {\n logger[\"logger\"].warn('missing video frame(s) on first frag, appending with gap', frag.sn);\n } else {\n logger[\"logger\"].warn('missing video frame(s), backtracking fragment', frag.sn); // Return back to the IDLE state without appending to buffer\n // Causes findFragments to backtrack a segment and find the keyframe\n // Audio fragments arriving before video sets the nextLoadPosition, causing _findFragments to skip the backtracked fragment\n\n this.fragmentTracker.removeFragment(frag);\n frag.backtracked = true;\n this.nextLoadPosition = data.startPTS;\n this.state = State.IDLE;\n this.fragPrevious = frag;\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n\n this.tick();\n return;\n }\n } else {\n logger[\"logger\"].warn('Already backtracked on this fragment, appending with the gap', frag.sn);\n }\n } else {\n // Only reset the backtracked flag if we've loaded the frag without any dropped frames\n frag.backtracked = false;\n }\n }\n\n var drift = updateFragPTSDTS(level.details, frag, data.startPTS, data.endPTS, data.startDTS, data.endDTS),\n hls = this.hls;\n hls.trigger(events[\"default\"].LEVEL_PTS_UPDATED, {\n details: level.details,\n level: this.level,\n drift: drift,\n type: data.type,\n start: data.startPTS,\n end: data.endPTS\n }); // has remuxer dropped video frames located before first keyframe ?\n\n [data.data1, data.data2].forEach(function (buffer) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (buffer && buffer.length && _this2.state === State.PARSING) {\n _this2.appended = true; // arm pending Buffering flag before appending a segment\n\n _this2.pendingBuffering = true;\n hls.trigger(events[\"default\"].BUFFER_APPENDING, {\n type: data.type,\n data: buffer,\n parent: 'main',\n content: 'data'\n });\n }\n }); // trigger handler right now\n\n this.tick();\n }\n };\n\n _proto.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'main' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = window.performance.now();\n this.state = State.PARSED;\n\n this._checkAppendedParsed();\n }\n };\n\n _proto.onAudioTrackSwitching = function onAudioTrackSwitching(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 var trackId = data.id; // 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\n if (!altAudio) {\n if (this.mediaBuffer !== this.media) {\n logger[\"logger\"].log('switching on main audio, use media.buffered to schedule main fragment loading');\n this.mediaBuffer = this.media;\n var fragCurrent = this.fragCurrent; // we need to refill audio buffer from main: cancel any frag loading to speed up audio switch\n\n if (fragCurrent.loader) {\n logger[\"logger\"].log('switching to main audio track, cancel main fragment load');\n fragCurrent.loader.abort();\n }\n\n this.fragCurrent = null;\n this.fragPrevious = null; // destroy demuxer to force init segment generation (following audio switch)\n\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n } // switch to IDLE state to load new fragment\n\n\n this.state = State.IDLE;\n }\n\n var hls = this.hls; // If switching from alt to main audio, flush all audio and trigger track switched\n\n if (fromAltAudio) {\n hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n }\n\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n };\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var trackId = data.id,\n altAudio = !!this.hls.audioTracks[trackId].url;\n\n if (altAudio) {\n var videoBuffer = this.videoBuffer; // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered\n\n if (videoBuffer && this.mediaBuffer !== videoBuffer) {\n logger[\"logger\"].log('switching on alternate audio, use video.buffered to schedule main fragment loading');\n this.mediaBuffer = videoBuffer;\n }\n }\n\n this.altAudio = altAudio;\n this.tick();\n };\n\n _proto.onBufferCreated = function onBufferCreated(data) {\n var tracks = data.tracks,\n mediaTrack,\n name,\n alternate = false;\n\n for (var type in tracks) {\n var track = tracks[type];\n\n if (track.id === 'main') {\n name = type;\n mediaTrack = track; // keep video source buffer reference\n\n if (type === 'video') {\n this.videoBuffer = tracks[type].buffer;\n }\n } else {\n alternate = true;\n }\n }\n\n if (alternate && mediaTrack) {\n logger[\"logger\"].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\n _proto.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'main') {\n var state = this.state;\n\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n\n this._checkAppendedParsed();\n }\n }\n };\n\n _proto._checkAppendedParsed = function _checkAppendedParsed() {\n // trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent;\n\n if (frag) {\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n logger[\"logger\"].log(\"main buffered : \" + time_ranges.toString(media.buffered));\n this.fragPrevious = frag;\n var stats = this.stats;\n stats.tbuffered = window.performance.now(); // we should get rid of this.fragLastKbps\n\n this.fragLastKbps = Math.round(8 * stats.total / (stats.tbuffered - stats.tfirst));\n this.hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: frag,\n id: 'main'\n });\n this.state = State.IDLE;\n } // Do not tick when _seekToStartPos needs to be called as seeking to the start can fail on live streams at this point\n\n\n if (this.loadedmetadata || this.startPosition <= 0) {\n this.tick();\n }\n }\n };\n\n _proto.onError = function onError(data) {\n var frag = data.frag || this.fragCurrent; // don't handle frag error not related to main fragment\n\n if (frag && frag.type !== 'main') {\n return;\n } // 0.5 : tolerance needed as some browsers stalls playback before reaching buffered end\n\n\n var mediaBuffered = !!this.media && BufferHelper.isBuffered(this.media, this.media.currentTime) && BufferHelper.isBuffered(this.media, this.media.currentTime + 0.5);\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n if (!data.fatal) {\n // keep retrying until the limit will be reached\n if (this.fragLoadError + 1 <= this.config.fragLoadingMaxRetry) {\n // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n var delay = Math.min(Math.pow(2, this.fragLoadError) * this.config.fragLoadingRetryDelay, this.config.fragLoadingMaxRetryTimeout);\n logger[\"logger\"].warn(\"mediaController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = window.performance.now() + delay; // retry loading state\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\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n\n this.fragLoadError++;\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"logger\"].error(\"mediaController: \" + data.details + \" reaches max retry, redispatch as fatal ...\"); // switch error to fatal\n\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR:\n case errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT:\n if (this.state !== State.ERROR) {\n if (data.fatal) {\n // if fatal error, stop processing\n this.state = State.ERROR;\n logger[\"logger\"].warn(\"streamController: \" + data.details + \",switch to \" + this.state + \" state ...\");\n } else {\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) {\n this.state = State.IDLE;\n }\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'main' && (this.state === State.PARSING || this.state === State.PARSED)) {\n // reduce max buf len if current position is buffered\n if (mediaBuffered) {\n this._reduceMaxBufferLength(this.config.maxBufferLength);\n\n this.state = State.IDLE;\n } else {\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 buffer to recover\n logger[\"logger\"].warn('buffer full error also media.currentTime is not buffered, flush everything');\n this.fragCurrent = null; // flush everything\n\n this.flushMainBuffer(0, Number.POSITIVE_INFINITY);\n }\n }\n\n break;\n\n default:\n break;\n }\n };\n\n _proto._reduceMaxBufferLength = function _reduceMaxBufferLength(minLength) {\n var config = this.config;\n\n if (config.maxMaxBufferLength >= minLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n config.maxMaxBufferLength /= 2;\n logger[\"logger\"].warn(\"main:reduce max buffer length to \" + config.maxMaxBufferLength + \"s\");\n return true;\n }\n\n return false;\n }\n /**\n * Checks the health of the buffer and attempts to resolve playback stalls.\n * @private\n */\n ;\n\n _proto._checkBuffer = function _checkBuffer() {\n var media = this.media;\n\n if (!media || media.readyState === 0) {\n // Exit early if we don't have media or if the media hasn't bufferd anything yet (readyState 0)\n return;\n }\n\n var mediaBuffer = this.mediaBuffer ? this.mediaBuffer : media;\n var buffered = mediaBuffer.buffered;\n\n if (!this.loadedmetadata && buffered.length) {\n this.loadedmetadata = true;\n\n this._seekToStartPos();\n } else if (this.immediateSwitch) {\n this.immediateLevelSwitchEnd();\n } else {\n this.gapController.poll(this.lastCurrentTime, buffered);\n }\n };\n\n _proto.onFragLoadEmergencyAborted = function onFragLoadEmergencyAborted() {\n this.state = State.IDLE; // if loadedmetadata is not set, it means that we are emergency switch down on first frag\n // in that case, reset startFragRequested flag\n\n if (!this.loadedmetadata) {\n this.startFragRequested = false;\n this.nextLoadPosition = this.startPosition;\n }\n\n this.tick();\n };\n\n _proto.onBufferFlushed = function onBufferFlushed() {\n /* after successful buffer flushing, filter flushed fragments from bufferedFrags\n use mediaBuffered instead of media (so that we will check against video.buffered ranges in case of alt audio track)\n */\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n\n if (media) {\n // filter fragments potentially evicted from buffer. this is to avoid memleak on live streams\n var elementaryStreamType = this.audioOnly ? ElementaryStreamTypes.AUDIO : ElementaryStreamTypes.VIDEO;\n this.fragmentTracker.detectEvictedFragments(elementaryStreamType, media.buffered);\n } // move to IDLE once flush complete. this should trigger new fragment loading\n\n\n this.state = State.IDLE; // reset reference to frag\n\n this.fragPrevious = null;\n };\n\n _proto.onLevelsUpdated = function onLevelsUpdated(data) {\n this.levels = data.levels;\n };\n\n _proto.swapAudioCodec = function swapAudioCodec() {\n this.audioCodecSwap = !this.audioCodecSwap;\n }\n /**\n * Seeks to the set startPosition if not equal to the mediaElement's current time.\n * @private\n */\n ;\n\n _proto._seekToStartPos = function _seekToStartPos() {\n var media = this.media;\n var currentTime = media.currentTime;\n var startPosition = this.startPosition; // 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\n if (currentTime !== startPosition && startPosition >= 0) {\n if (media.seeking) {\n logger[\"logger\"].log(\"could not seek to \" + startPosition + \", already seeking at \" + currentTime);\n return;\n }\n\n var bufferStart = media.buffered.length ? media.buffered.start(0) : 0;\n var delta = bufferStart - startPosition;\n\n if (delta > 0 && delta < this.config.maxBufferHole) {\n logger[\"logger\"].log(\"adjusting start position by \" + delta + \" to match buffer start\");\n startPosition += delta;\n this.startPosition = startPosition;\n }\n\n logger[\"logger\"].log(\"seek to target start position \" + startPosition + \" from current time \" + currentTime + \". ready state \" + media.readyState);\n media.currentTime = startPosition;\n }\n };\n\n _proto._getAudioCodec = function _getAudioCodec(currentLevel) {\n var audioCodec = this.config.defaultAudioCodec || currentLevel.audioCodec;\n\n if (this.audioCodecSwap) {\n logger[\"logger\"].log('swapping playlist audio codec');\n\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 }\n\n return audioCodec;\n };\n\n stream_controller_createClass(StreamController, [{\n key: \"state\",\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"logger\"].log(\"main stream-controller: \" + previousState + \"->\" + nextState);\n this.hls.trigger(events[\"default\"].STREAM_STATE_TRANSITION, {\n previousState: previousState,\n nextState: nextState\n });\n }\n },\n get: function get() {\n return this._state;\n }\n }, {\n key: \"currentLevel\",\n get: function get() {\n var media = this.media;\n\n if (media) {\n var frag = this.getBufferedFrag(media.currentTime);\n\n if (frag) {\n return frag.level;\n }\n }\n\n return -1;\n }\n }, {\n key: \"nextBufferedFrag\",\n get: function get() {\n var media = this.media;\n\n if (media) {\n // first get end range of current fragment\n return this.followingBufferedFrag(this.getBufferedFrag(media.currentTime));\n } else {\n return null;\n }\n }\n }, {\n key: \"nextLevel\",\n get: function get() {\n var frag = this.nextBufferedFrag;\n\n if (frag) {\n return frag.level;\n } else {\n return -1;\n }\n }\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n return this._liveSyncPosition;\n },\n set: function set(value) {\n this._liveSyncPosition = value;\n }\n }]);\n\n return StreamController;\n}(base_stream_controller_BaseStreamController);\n\n/* harmony default export */ var stream_controller = (stream_controller_StreamController);\n// CONCATENATED MODULE: ./src/controller/level-controller.js\nfunction level_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction level_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) level_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) level_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction level_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Level Controller\n*/\n\n\n\n\n\n\nvar chromeOrFirefox;\n\nvar level_controller_LevelController = /*#__PURE__*/function (_EventHandler) {\n level_controller_inheritsLoose(LevelController, _EventHandler);\n\n function LevelController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MANIFEST_LOADED, events[\"default\"].LEVEL_LOADED, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].FRAG_LOADED, events[\"default\"].ERROR) || this;\n _this.canload = false;\n _this.currentLevelIndex = null;\n _this.manualLevelIndex = -1;\n _this.timer = null;\n chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());\n return _this;\n }\n\n var _proto = LevelController.prototype;\n\n _proto.onHandlerDestroying = function onHandlerDestroying() {\n this.clearTimer();\n this.manualLevelIndex = -1;\n };\n\n _proto.clearTimer = function clearTimer() {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n _proto.startLoad = function startLoad() {\n var levels = this._levels;\n this.canload = true;\n this.levelRetryCount = 0; // clean up live level details to force reload them, and reset load errors\n\n if (levels) {\n levels.forEach(function (level) {\n level.loadError = 0;\n var levelDetails = level.details;\n\n if (levelDetails && levelDetails.live) {\n level.details = undefined;\n }\n });\n } // speed up live playlist refresh if timer exists\n\n\n if (this.timer !== null) {\n this.loadLevel();\n }\n };\n\n _proto.stopLoad = function stopLoad() {\n this.canload = false;\n };\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var levels = [];\n var audioTracks = [];\n var bitrateStart;\n var levelSet = {};\n var levelFromSet = null;\n var videoCodecFound = false;\n var audioCodecFound = false; // regroup redundant levels together\n\n data.levels.forEach(function (level) {\n var attributes = level.attrs;\n level.loadError = 0;\n level.fragmentError = false;\n videoCodecFound = videoCodecFound || !!level.videoCodec;\n audioCodecFound = audioCodecFound || !!level.audioCodec; // erase audio codec info if browser does not support mp4a.40.34.\n // demuxer will autodetect codec and fallback to mpeg/audio\n\n if (chromeOrFirefox && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {\n level.audioCodec = undefined;\n }\n\n levelFromSet = levelSet[level.bitrate]; // FIXME: we would also have to match the resolution here\n\n if (!levelFromSet) {\n level.url = [level.url];\n level.urlId = 0;\n levelSet[level.bitrate] = level;\n levels.push(level);\n } else {\n levelFromSet.url.push(level.url);\n }\n\n if (attributes) {\n if (attributes.AUDIO) {\n addGroupId(levelFromSet || level, 'audio', attributes.AUDIO);\n }\n\n if (attributes.SUBTITLES) {\n addGroupId(levelFromSet || level, 'text', attributes.SUBTITLES);\n }\n }\n }); // remove audio-only level if we also have levels with audio+video codecs signalled\n\n if (videoCodecFound && audioCodecFound) {\n levels = levels.filter(function (_ref) {\n var videoCodec = _ref.videoCodec;\n return !!videoCodec;\n });\n } // only keep levels with supported audio/video codecs\n\n\n levels = levels.filter(function (_ref2) {\n var audioCodec = _ref2.audioCodec,\n videoCodec = _ref2.videoCodec;\n return (!audioCodec || isCodecSupportedInMp4(audioCodec, 'audio')) && (!videoCodec || isCodecSupportedInMp4(videoCodec, 'video'));\n });\n\n if (data.audioTracks) {\n audioTracks = data.audioTracks.filter(function (track) {\n return !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio');\n }); // Reassign id's after filtering since they're used as array indices\n\n audioTracks.forEach(function (track, index) {\n track.id = index;\n });\n }\n\n if (levels.length > 0) {\n // start bitrate is the first bitrate of the manifest\n bitrateStart = levels[0].bitrate; // sort level on bitrate\n\n levels.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n this._levels = levels; // find index of first level in sorted levels\n\n for (var i = 0; i < levels.length; i++) {\n if (levels[i].bitrate === bitrateStart) {\n this._firstLevel = i;\n logger[\"logger\"].log(\"manifest loaded,\" + levels.length + \" level(s) found, first bitrate:\" + bitrateStart);\n break;\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\n\n var audioOnly = audioCodecFound && !videoCodecFound;\n this.hls.trigger(events[\"default\"].MANIFEST_PARSED, {\n levels: levels,\n audioTracks: audioTracks,\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 } else {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].MANIFEST_INCOMPATIBLE_CODECS_ERROR,\n fatal: true,\n url: this.hls.url,\n reason: 'no level with compatible codecs found in manifest'\n });\n }\n };\n\n _proto.setLevelInternal = function setLevelInternal(newLevel) {\n var levels = this._levels;\n var hls = this.hls; // check if level idx is valid\n\n if (newLevel >= 0 && newLevel < levels.length) {\n // stopping live reloading timer if any\n this.clearTimer();\n\n if (this.currentLevelIndex !== newLevel) {\n logger[\"logger\"].log(\"switching to level \" + newLevel);\n this.currentLevelIndex = newLevel;\n var levelProperties = levels[newLevel];\n levelProperties.level = newLevel;\n hls.trigger(events[\"default\"].LEVEL_SWITCHING, levelProperties);\n }\n\n var level = levels[newLevel];\n var levelDetails = level.details; // check if we need to load playlist for this level\n\n if (!levelDetails || levelDetails.live) {\n // level not retrieved yet, or live playlist we need to (re)load it\n var urlId = level.urlId;\n hls.trigger(events[\"default\"].LEVEL_LOADING, {\n url: level.url[urlId],\n level: newLevel,\n id: urlId\n });\n }\n } else {\n // invalid level id given, trigger error\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].OTHER_ERROR,\n details: errors[\"ErrorDetails\"].LEVEL_SWITCH_ERROR,\n level: newLevel,\n fatal: false,\n reason: 'invalid level idx'\n });\n }\n };\n\n _proto.onError = function onError(data) {\n if (data.fatal) {\n if (data.type === errors[\"ErrorTypes\"].NETWORK_ERROR) {\n this.clearTimer();\n }\n\n return;\n }\n\n var levelError = false,\n fragmentError = false;\n var levelIndex; // try to recover not fatal errors\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n levelIndex = data.frag.level;\n fragmentError = true;\n break;\n\n case errors[\"ErrorDetails\"].LEVEL_LOAD_ERROR:\n case errors[\"ErrorDetails\"].LEVEL_LOAD_TIMEOUT:\n levelIndex = data.context.level;\n levelError = true;\n break;\n\n case errors[\"ErrorDetails\"].REMUX_ALLOC_ERROR:\n levelIndex = data.level;\n levelError = true;\n break;\n }\n\n if (levelIndex !== undefined) {\n this.recoverLevel(data, levelIndex, levelError, fragmentError);\n }\n }\n /**\n * Switch to a redundant stream if any available.\n * If redundant stream is not available, emergency switch down if ABR mode is enabled.\n *\n * @param {Object} errorEvent\n * @param {Number} levelIndex current level index\n * @param {Boolean} levelError\n * @param {Boolean} fragmentError\n */\n // FIXME Find a better abstraction where fragment/level retry management is well decoupled\n ;\n\n _proto.recoverLevel = function recoverLevel(errorEvent, levelIndex, levelError, fragmentError) {\n var _this2 = this;\n\n var config = this.hls.config;\n var errorDetails = errorEvent.details;\n var level = this._levels[levelIndex];\n var redundantLevels, delay, nextLevel;\n level.loadError++;\n level.fragmentError = fragmentError;\n\n if (levelError) {\n if (this.levelRetryCount + 1 <= config.levelLoadingMaxRetry) {\n // exponential backoff capped to max retry timeout\n delay = Math.min(Math.pow(2, this.levelRetryCount) * config.levelLoadingRetryDelay, config.levelLoadingMaxRetryTimeout); // Schedule level reload\n\n this.timer = setTimeout(function () {\n return _this2.loadLevel();\n }, delay); // boolean used to inform stream controller not to switch back to IDLE on non fatal error\n\n errorEvent.levelRetry = true;\n this.levelRetryCount++;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \", retry in \" + delay + \" ms, current retry count is \" + this.levelRetryCount);\n } else {\n logger[\"logger\"].error(\"level controller, cannot recover from \" + errorDetails + \" error\");\n this.currentLevelIndex = null; // stopping live reloading timer if any\n\n this.clearTimer(); // switch error to fatal\n\n errorEvent.fatal = true;\n return;\n }\n } // Try any redundant streams if available for both errors: level and fragment\n // If level.loadError reaches redundantLevels it means that we tried them all, no hope => let's switch down\n\n\n if (levelError || fragmentError) {\n redundantLevels = level.url.length;\n\n if (redundantLevels > 1 && level.loadError < redundantLevels) {\n level.urlId = (level.urlId + 1) % redundantLevels;\n level.details = undefined;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \" for level \" + levelIndex + \": switching to redundant URL-id \" + level.urlId); // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);\n // console.log('New video quality level audio group id:', level.attrs.AUDIO);\n } else {\n // Search for available level\n if (this.manualLevelIndex === -1) {\n // When lowest level has been reached, let's start hunt from the top\n nextLevel = levelIndex === 0 ? this._levels.length - 1 : levelIndex - 1;\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \": switch to \" + nextLevel);\n this.hls.nextAutoLevel = this.currentLevelIndex = nextLevel;\n } else if (fragmentError) {\n // Allow fragment retry as long as configuration allows.\n // reset this._level so that another call to set level() will trigger again a frag load\n logger[\"logger\"].warn(\"level controller, \" + errorDetails + \": reload a fragment\");\n this.currentLevelIndex = null;\n }\n }\n }\n } // reset errors on the successful load of a fragment\n ;\n\n _proto.onFragLoaded = function onFragLoaded(_ref3) {\n var frag = _ref3.frag;\n\n if (frag !== undefined && frag.type === 'main') {\n var level = this._levels[frag.level];\n\n if (level !== undefined) {\n level.fragmentError = false;\n level.loadError = 0;\n this.levelRetryCount = 0;\n }\n }\n };\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n var _this3 = this;\n\n var level = data.level,\n details = data.details; // only process level loaded events matching with expected level\n\n if (level !== this.currentLevelIndex) {\n return;\n }\n\n var curLevel = this._levels[level]; // reset level load error counter on successful level loaded only if there is no issues with fragments\n\n if (!curLevel.fragmentError) {\n curLevel.loadError = 0;\n this.levelRetryCount = 0;\n } // if current playlist is a live playlist, arm a timer to reload it\n\n\n if (details.live) {\n var reloadInterval = computeReloadInterval(curLevel.details, details, data.stats.trequest);\n logger[\"logger\"].log(\"live playlist, reload in \" + Math.round(reloadInterval) + \" ms\");\n this.timer = setTimeout(function () {\n return _this3.loadLevel();\n }, reloadInterval);\n } else {\n this.clearTimer();\n }\n };\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var audioGroupId = this.hls.audioTracks[data.id].groupId;\n var currentLevel = this.hls.levels[this.currentLevelIndex];\n\n if (!currentLevel) {\n return;\n }\n\n if (currentLevel.audioGroupIds) {\n var urlId = -1;\n\n for (var i = 0; i < currentLevel.audioGroupIds.length; i++) {\n if (currentLevel.audioGroupIds[i] === audioGroupId) {\n urlId = i;\n break;\n }\n }\n\n if (urlId !== currentLevel.urlId) {\n currentLevel.urlId = urlId;\n this.startLoad();\n }\n }\n };\n\n _proto.loadLevel = function loadLevel() {\n logger[\"logger\"].debug('call to loadLevel');\n\n if (this.currentLevelIndex !== null && this.canload) {\n var levelObject = this._levels[this.currentLevelIndex];\n\n if (typeof levelObject === 'object' && levelObject.url.length > 0) {\n var level = this.currentLevelIndex;\n var id = levelObject.urlId;\n var url = levelObject.url[id];\n logger[\"logger\"].log(\"Attempt loading level index \" + level + \" with URL-id \" + id); // 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\n this.hls.trigger(events[\"default\"].LEVEL_LOADING, {\n url: url,\n level: level,\n id: id\n });\n }\n }\n };\n\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n var levels = this.levels.filter(function (level, index) {\n if (index !== levelIndex) {\n return true;\n }\n\n if (level.url.length > 1 && urlId !== undefined) {\n level.url = level.url.filter(function (url, id) {\n return id !== urlId;\n });\n level.urlId = 0;\n return true;\n }\n\n return false;\n }).map(function (level, index) {\n var details = level.details;\n\n if (details && details.fragments) {\n details.fragments.forEach(function (fragment) {\n fragment.level = index;\n });\n }\n\n return level;\n });\n this._levels = levels;\n this.hls.trigger(events[\"default\"].LEVELS_UPDATED, {\n levels: levels\n });\n };\n\n level_controller_createClass(LevelController, [{\n key: \"levels\",\n get: function get() {\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\n if (levels) {\n newLevel = Math.min(newLevel, levels.length - 1);\n\n if (this.currentLevelIndex !== newLevel || !levels[newLevel].details) {\n this.setLevelInternal(newLevel);\n }\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\n if (this._startLevel === undefined) {\n this._startLevel = newLevel;\n }\n\n if (newLevel !== -1) {\n this.level = newLevel;\n }\n }\n }, {\n key: \"firstLevel\",\n get: function get() {\n return this._firstLevel;\n },\n set: function set(newLevel) {\n this._firstLevel = newLevel;\n }\n }, {\n key: \"startLevel\",\n get: function get() {\n // hls.startLevel takes precedence over config.startLevel\n // if none of these values are defined, fallback on this._firstLevel (first quality level appearing in variant manifest)\n if (this._startLevel === undefined) {\n var configStartLevel = this.hls.config.startLevel;\n\n if (configStartLevel !== undefined) {\n return configStartLevel;\n } else {\n return this._firstLevel;\n }\n } else {\n return this._startLevel;\n }\n },\n set: function set(newLevel) {\n this._startLevel = newLevel;\n }\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n if (this.manualLevelIndex !== -1) {\n return this.manualLevelIndex;\n } else {\n return this.hls.nextAutoLevel;\n }\n },\n set: function set(nextLevel) {\n this.level = nextLevel;\n\n if (this.manualLevelIndex === -1) {\n this.hls.nextAutoLevel = nextLevel;\n }\n }\n }]);\n\n return LevelController;\n}(event_handler);\n\n\n// EXTERNAL MODULE: ./src/demux/id3.js\nvar id3 = __webpack_require__(\"./src/demux/id3.js\");\n\n// CONCATENATED MODULE: ./src/utils/texttrack-utils.ts\nfunction sendAddTrackEvent(track, videoEl) {\n var event;\n\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\n event.track = track;\n videoEl.dispatchEvent(event);\n}\nfunction clearCurrentCues(track) {\n if (track === null || track === void 0 ? void 0 : track.cues) {\n while (track.cues.length > 0) {\n track.removeCue(track.cues[0]);\n }\n }\n}\n/**\n * Given a list of Cues, finds the closest cue matching the given time.\n * Modified verison of binary search O(log(n)).\n *\n * @export\n * @param {(TextTrackCueList | TextTrackCue[])} cues - List of cues.\n * @param {number} time - Target time, to find closest cue to.\n * @returns {TextTrackCue}\n */\n\nfunction getClosestCue(cues, time) {\n // If the offset is less than the first element, the first element is the closest.\n if (time < cues[0].endTime) {\n return cues[0];\n } // If the offset is greater than the last cue, the last is the closest.\n\n\n if (time > cues[cues.length - 1].endTime) {\n return cues[cues.length - 1];\n }\n\n var left = 0;\n var right = cues.length - 1;\n\n while (left <= right) {\n var mid = Math.floor((right + left) / 2);\n\n if (time < cues[mid].endTime) {\n right = mid - 1;\n } else if (time > cues[mid].endTime) {\n left = mid + 1;\n } else {\n // If it's not lower or higher, it must be equal.\n return cues[mid];\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\n\n return cues[left].endTime - time < time - cues[right].endTime ? cues[left] : cues[right];\n}\n// CONCATENATED MODULE: ./src/controller/id3-track-controller.js\nfunction id3_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * id3 metadata track controller\n*/\n\n\n\n\nvar MIN_CUE_DURATION = 0.25;\n\nvar id3_track_controller_ID3TrackController = /*#__PURE__*/function (_EventHandler) {\n id3_track_controller_inheritsLoose(ID3TrackController, _EventHandler);\n\n function ID3TrackController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].FRAG_PARSING_METADATA, events[\"default\"].LIVE_BACK_BUFFER_REACHED) || this;\n _this.id3Track = undefined;\n _this.media = undefined;\n return _this;\n }\n\n var _proto = ID3TrackController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n } // Add ID3 metatadata text track.\n ;\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n this.media = data.media;\n\n if (!this.media) {}\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n clearCurrentCues(this.id3Track);\n this.id3Track = undefined;\n this.media = undefined;\n };\n\n _proto.getID3Track = function getID3Track(textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n var textTrack = textTracks[i];\n\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\n return this.media.addTextTrack('metadata', 'id3');\n };\n\n _proto.onFragParsingMetadata = function onFragParsingMetadata(data) {\n var fragment = data.frag;\n var samples = data.samples; // create track dynamically\n\n if (!this.id3Track) {\n this.id3Track = this.getID3Track(this.media.textTracks);\n this.id3Track.mode = 'hidden';\n } // Attempt to recreate Safari functionality by creating\n // WebKitDataCue objects when available and store the decoded\n // ID3 data in the value property of the cue\n\n\n var Cue = window.WebKitDataCue || window.VTTCue || window.TextTrackCue;\n\n for (var i = 0; i < samples.length; i++) {\n var frames = id3[\"default\"].getID3Frames(samples[i].data);\n\n if (frames) {\n // Ensure the pts is positive - sometimes it's reported as a small negative number\n var startTime = Math.max(samples[i].pts, 0);\n var endTime = i < samples.length - 1 ? samples[i + 1].pts : fragment.endPTS;\n\n if (!endTime) {\n endTime = fragment.start + fragment.duration;\n }\n\n var timeDiff = endTime - startTime;\n\n if (timeDiff <= 0) {\n endTime = startTime + MIN_CUE_DURATION;\n }\n\n for (var j = 0; j < frames.length; j++) {\n var frame = frames[j]; // Safari doesn't put the timestamp frame in the TextTrack\n\n if (!id3[\"default\"].isTimeStampFrame(frame)) {\n var cue = new Cue(startTime, endTime, '');\n cue.value = frame;\n this.id3Track.addCue(cue);\n }\n }\n }\n }\n };\n\n _proto.onLiveBackBufferReached = function onLiveBackBufferReached(_ref) {\n var bufferEnd = _ref.bufferEnd;\n var id3Track = this.id3Track;\n\n if (!id3Track || !id3Track.cues || !id3Track.cues.length) {\n return;\n }\n\n var foundCue = getClosestCue(id3Track.cues, bufferEnd);\n\n if (!foundCue) {\n return;\n }\n\n while (id3Track.cues[0] !== foundCue) {\n id3Track.removeCue(id3Track.cues[0]);\n }\n };\n\n return ID3TrackController;\n}(event_handler);\n\n/* harmony default export */ var id3_track_controller = (id3_track_controller_ID3TrackController);\n// CONCATENATED MODULE: ./src/is-supported.ts\n\nfunction is_supported_isSupported() {\n var mediaSource = getMediaSource();\n\n if (!mediaSource) {\n return false;\n }\n\n var sourceBuffer = self.SourceBuffer || self.WebKitSourceBuffer;\n var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"'); // if SourceBuffer is exposed ensure its API is valid\n // safari and old version of Chrome doe not expose SourceBuffer globally so checking SourceBuffer.prototype is impossible\n\n var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';\n return !!isTypeSupported && !!sourceBufferValidAPI;\n}\n// CONCATENATED MODULE: ./src/utils/ewma.ts\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 */\nvar EWMA = /*#__PURE__*/function () {\n // About half of the estimated value will be from the last |halfLife| samples by weight.\n function EWMA(halfLife) {\n this.alpha_ = void 0;\n this.estimate_ = void 0;\n this.totalWeight_ = void 0;\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_ = 0;\n this.totalWeight_ = 0;\n }\n\n var _proto = EWMA.prototype;\n\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\n _proto.getTotalWeight = function getTotalWeight() {\n return this.totalWeight_;\n };\n\n _proto.getEstimate = function getEstimate() {\n if (this.alpha_) {\n var zeroFactor = 1 - Math.pow(this.alpha_, this.totalWeight_);\n return this.estimate_ / zeroFactor;\n } else {\n return this.estimate_;\n }\n };\n\n return EWMA;\n}();\n\n/* harmony default export */ var ewma = (EWMA);\n// CONCATENATED MODULE: ./src/utils/ewma-bandwidth-estimator.ts\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\nvar ewma_bandwidth_estimator_EwmaBandWidthEstimator = /*#__PURE__*/function () {\n // TODO(typescript-hls)\n function EwmaBandWidthEstimator(hls, slow, fast, defaultEstimate) {\n this.hls = void 0;\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.hls = hls;\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 }\n\n var _proto = EwmaBandWidthEstimator.prototype;\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 durationS = durationMs / 1000,\n // value is bandwidth in bits/s\n bandwidthInBps = numBits / durationS;\n this.fast_.sample(durationS, bandwidthInBps);\n this.slow_.sample(durationS, bandwidthInBps);\n };\n\n _proto.canEstimate = function canEstimate() {\n var fast = this.fast_;\n return fast && fast.getTotalWeight() >= this.minWeight_;\n };\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\n _proto.destroy = function destroy() {};\n\n return EwmaBandWidthEstimator;\n}();\n\n/* harmony default export */ var ewma_bandwidth_estimator = (ewma_bandwidth_estimator_EwmaBandWidthEstimator);\n// CONCATENATED MODULE: ./src/controller/abr-controller.js\n\n\n\nfunction abr_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction abr_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) abr_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) abr_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction abr_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction abr_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * simple ABR Controller\n * - compute next level based on last fragment bw heuristics\n * - implement an abandon rules triggered if we have less than 2 frag buffered and if computed bw shows that we risk buffer stalling\n */\n\n\n\n\n\n\nvar abr_controller_window = window,\n abr_controller_performance = abr_controller_window.performance;\n\nvar abr_controller_AbrController = /*#__PURE__*/function (_EventHandler) {\n abr_controller_inheritsLoose(AbrController, _EventHandler);\n\n function AbrController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FRAG_LOADING, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_BUFFERED, events[\"default\"].ERROR) || this;\n _this.lastLoadedFragLevel = 0;\n _this._nextAutoLevel = -1;\n _this.hls = hls;\n _this.timer = null;\n _this._bwEstimator = null;\n _this.onCheck = _this._abandonRulesCheck.bind(abr_controller_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = AbrController.prototype;\n\n _proto.destroy = function destroy() {\n this.clearTimer();\n event_handler.prototype.destroy.call(this);\n };\n\n _proto.onFragLoading = function onFragLoading(data) {\n var frag = data.frag;\n\n if (frag.type === 'main') {\n if (!this.timer) {\n this.fragCurrent = frag;\n this.timer = setInterval(this.onCheck, 100);\n } // lazy init of BwEstimator, rationale is that we use different params for Live/VoD\n // so we need to wait for stream manifest / playlist type to instantiate it.\n\n\n if (!this._bwEstimator) {\n var hls = this.hls;\n var config = hls.config;\n var level = frag.level;\n var isLive = hls.levels[level].details.live;\n var ewmaFast;\n var ewmaSlow;\n\n if (isLive) {\n ewmaFast = config.abrEwmaFastLive;\n ewmaSlow = config.abrEwmaSlowLive;\n } else {\n ewmaFast = config.abrEwmaFastVoD;\n ewmaSlow = config.abrEwmaSlowVoD;\n }\n\n this._bwEstimator = new ewma_bandwidth_estimator(hls, ewmaSlow, ewmaFast, config.abrEwmaDefaultEstimate);\n }\n }\n };\n\n _proto._abandonRulesCheck = function _abandonRulesCheck() {\n /*\n monitor fragment retrieval time...\n we compute expected time of arrival of the complete fragment.\n we compare it to expected time of buffer starvation\n */\n var hls = this.hls;\n var video = hls.media;\n var frag = this.fragCurrent;\n\n if (!frag) {\n return;\n }\n\n var loader = frag.loader; // if loader has been destroyed or loading has been aborted, stop timer and return\n\n if (!loader || loader.stats && loader.stats.aborted) {\n logger[\"logger\"].warn('frag loader destroy or aborted, disarm abandonRules');\n this.clearTimer(); // reset forced auto level value so that next level will be selected\n\n this._nextAutoLevel = -1;\n return;\n }\n\n var stats = loader.stats;\n /* only monitor frag retrieval time if\n (video not paused OR first fragment being loaded(ready state === HAVE_NOTHING = 0)) AND autoswitching enabled AND not lowest level (=> means that we have several levels) */\n\n if (video && stats && (!video.paused && video.playbackRate !== 0 || !video.readyState) && frag.autoLevel && frag.level) {\n var requestDelay = abr_controller_performance.now() - stats.trequest;\n var playbackRate = Math.abs(video.playbackRate); // monitor fragment load progress after half of expected fragment duration,to stabilize bitrate\n\n if (requestDelay > 500 * frag.duration / playbackRate) {\n var levels = hls.levels;\n var loadRate = Math.max(1, stats.bw ? stats.bw / 8 : stats.loaded * 1000 / requestDelay); // byte/s; at least 1 byte/s to avoid division by zero\n // compute expected fragment length using frag duration and level bitrate. also ensure that expected len is gte than already loaded size\n\n var level = levels[frag.level];\n\n if (!level) {\n return;\n }\n\n var levelBitrate = level.realBitrate ? Math.max(level.realBitrate, level.bitrate) : level.bitrate;\n var expectedLen = stats.total ? stats.total : Math.max(stats.loaded, Math.round(frag.duration * levelBitrate / 8));\n var pos = video.currentTime;\n var fragLoadedDelay = (expectedLen - stats.loaded) / loadRate;\n var bufferStarvationDelay = (BufferHelper.bufferInfo(video, pos, hls.config.maxBufferHole).end - pos) / playbackRate; // consider emergency switch down only if we have less than 2 frag buffered AND\n // time to finish loading current fragment is bigger than buffer starvation delay\n // ie if we risk buffer starvation if bw does not increase quickly\n\n if (bufferStarvationDelay < 2 * frag.duration / playbackRate && fragLoadedDelay > bufferStarvationDelay) {\n var minAutoLevel = hls.minAutoLevel;\n var fragLevelNextLoadedDelay;\n var nextLoadLevel; // lets iterate through lower level and try to find the biggest one that could avoid rebuffering\n // we start from current level - 1 and we step down , until we find a matching level\n\n for (nextLoadLevel = frag.level - 1; nextLoadLevel > minAutoLevel; nextLoadLevel--) {\n // compute time to load next fragment at lower level\n // 0.8 : consider only 80% of current bw to be conservative\n // 8 = bits per byte (bps/Bps)\n var levelNextBitrate = levels[nextLoadLevel].realBitrate ? Math.max(levels[nextLoadLevel].realBitrate, levels[nextLoadLevel].bitrate) : levels[nextLoadLevel].bitrate;\n\n var _fragLevelNextLoadedDelay = frag.duration * levelNextBitrate / (8 * 0.8 * loadRate);\n\n if (_fragLevelNextLoadedDelay < bufferStarvationDelay) {\n // we found a lower level that be rebuffering free with current estimated bw !\n break;\n }\n } // only emergency switch down if it takes less time to load new fragment at lowest level instead\n // of finishing loading current one ...\n\n\n if (fragLevelNextLoadedDelay < fragLoadedDelay) {\n logger[\"logger\"].warn(\"loading too slow, abort fragment loading and switch to level \" + nextLoadLevel + \":fragLoadedDelay[\" + nextLoadLevel + \"]<fragLoadedDelay[\" + (frag.level - 1) + \"];bufferStarvationDelay:\" + fragLevelNextLoadedDelay.toFixed(1) + \"<\" + fragLoadedDelay.toFixed(1) + \":\" + bufferStarvationDelay.toFixed(1)); // force next load level in auto mode\n\n hls.nextLoadLevel = nextLoadLevel; // update bw estimate for this fragment before cancelling load (this will help reducing the bw)\n\n this._bwEstimator.sample(requestDelay, stats.loaded); // abort fragment loading\n\n\n loader.abort(); // stop abandon rules timer\n\n this.clearTimer();\n hls.trigger(events[\"default\"].FRAG_LOAD_EMERGENCY_ABORTED, {\n frag: frag,\n stats: stats\n });\n }\n }\n }\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag;\n\n if (frag.type === 'main' && Object(number[\"isFiniteNumber\"])(frag.sn)) {\n // stop monitoring bw once frag loaded\n this.clearTimer(); // store level id after successful fragment load\n\n this.lastLoadedFragLevel = frag.level; // reset forced auto level value so that next level will be selected\n\n this._nextAutoLevel = -1; // compute level average bitrate\n\n if (this.hls.config.abrMaxWithRealBitrate) {\n var level = this.hls.levels[frag.level];\n var loadedBytes = (level.loaded ? level.loaded.bytes : 0) + data.stats.loaded;\n var loadedDuration = (level.loaded ? level.loaded.duration : 0) + data.frag.duration;\n level.loaded = {\n bytes: loadedBytes,\n duration: loadedDuration\n };\n level.realBitrate = Math.round(8 * loadedBytes / loadedDuration);\n } // if fragment has been loaded to perform a bitrate test,\n\n\n if (data.frag.bitrateTest) {\n var stats = data.stats;\n stats.tparsed = stats.tbuffered = stats.tload;\n this.onFragBuffered(data);\n }\n }\n };\n\n _proto.onFragBuffered = function onFragBuffered(data) {\n var stats = data.stats;\n var frag = data.frag; // only update stats on first frag buffering\n // if same frag is loaded multiple times, it might be in browser cache, and loaded quickly\n // and leading to wrong bw estimation\n // on bitrate test, also only update stats once (if tload = tbuffered == on FRAG_LOADED)\n\n if (stats.aborted !== true && frag.type === 'main' && Object(number[\"isFiniteNumber\"])(frag.sn) && (!frag.bitrateTest || stats.tload === stats.tbuffered)) {\n // use tparsed-trequest instead of tbuffered-trequest to compute fragLoadingProcessing; rationale is that buffer appending only happens once media is attached\n // in case we use config.startFragPrefetch while media is not attached yet, fragment might be parsed while media not attached yet, but it will only be buffered on media attached\n // as a consequence it could happen really late in the process. meaning that appending duration might appears huge ... leading to underestimated throughput estimation\n var fragLoadingProcessingMs = stats.tparsed - stats.trequest;\n logger[\"logger\"].log(\"latency/loading/parsing/append/kbps:\" + Math.round(stats.tfirst - stats.trequest) + \"/\" + Math.round(stats.tload - stats.tfirst) + \"/\" + Math.round(stats.tparsed - stats.tload) + \"/\" + Math.round(stats.tbuffered - stats.tparsed) + \"/\" + Math.round(8 * stats.loaded / (stats.tbuffered - stats.trequest)));\n\n this._bwEstimator.sample(fragLoadingProcessingMs, stats.loaded);\n\n stats.bwEstimate = this._bwEstimator.getEstimate(); // if fragment has been loaded to perform a bitrate test, (hls.startLevel = -1), store bitrate test delay duration\n\n if (frag.bitrateTest) {\n this.bitrateTestDelay = fragLoadingProcessingMs / 1000;\n } else {\n this.bitrateTestDelay = 0;\n }\n }\n };\n\n _proto.onError = function onError(data) {\n // stop timer in case of frag loading error\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n this.clearTimer();\n break;\n\n default:\n break;\n }\n };\n\n _proto.clearTimer = function clearTimer() {\n clearInterval(this.timer);\n this.timer = null;\n } // return next auto level\n ;\n\n _proto._findBestLevel = function _findBestLevel(currentLevel, currentFragDuration, currentBw, minAutoLevel, maxAutoLevel, maxFetchDuration, bwFactor, bwUpFactor, levels) {\n for (var i = maxAutoLevel; i >= minAutoLevel; i--) {\n var levelInfo = levels[i];\n\n if (!levelInfo) {\n continue;\n }\n\n var levelDetails = levelInfo.details;\n var avgDuration = levelDetails ? levelDetails.totalduration / levelDetails.fragments.length : currentFragDuration;\n var live = levelDetails ? levelDetails.live : false;\n var adjustedbw = void 0; // 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\n if (i <= currentLevel) {\n adjustedbw = bwFactor * currentBw;\n } else {\n adjustedbw = bwUpFactor * currentBw;\n }\n\n var bitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n var fetchDuration = bitrate * avgDuration / adjustedbw;\n logger[\"logger\"].trace(\"level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: \" + i + \"/\" + Math.round(adjustedbw) + \"/\" + bitrate + \"/\" + avgDuration + \"/\" + maxFetchDuration + \"/\" + fetchDuration); // if adjusted bw is greater than level bitrate AND\n\n if (adjustedbw > bitrate && ( // 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 || live && !this.bitrateTestDelay || fetchDuration < maxFetchDuration)) {\n // as we are looping from highest to lowest, this will return the best achievable quality level\n return i;\n }\n } // not enough time budget even with quality level 0 ... rebuffering might happen\n\n\n return -1;\n };\n\n abr_controller_createClass(AbrController, [{\n key: \"nextAutoLevel\",\n get: function get() {\n var forcedAutoLevel = this._nextAutoLevel;\n var bwEstimator = this._bwEstimator; // in case next auto level has been forced, and bw not available or not reliable, return forced value\n\n if (forcedAutoLevel !== -1 && (!bwEstimator || !bwEstimator.canEstimate())) {\n return forcedAutoLevel;\n } // compute next level using ABR logic\n\n\n var nextABRAutoLevel = this._nextABRAutoLevel; // if forced auto level has been defined, use it to cap ABR computed quality level\n\n if (forcedAutoLevel !== -1) {\n nextABRAutoLevel = Math.min(forcedAutoLevel, nextABRAutoLevel);\n }\n\n return nextABRAutoLevel;\n },\n set: function set(nextLevel) {\n this._nextAutoLevel = nextLevel;\n }\n }, {\n key: \"_nextABRAutoLevel\",\n get: function get() {\n var hls = this.hls;\n var maxAutoLevel = hls.maxAutoLevel,\n levels = hls.levels,\n config = hls.config,\n minAutoLevel = hls.minAutoLevel;\n var video = hls.media;\n var currentLevel = this.lastLoadedFragLevel;\n var currentFragDuration = this.fragCurrent ? this.fragCurrent.duration : 0;\n var pos = video ? video.currentTime : 0; // playbackRate is the absolute value of the playback rate; if video.playbackRate is 0, we use 1 to load as\n // if we're playing back at the normal rate.\n\n var playbackRate = video && video.playbackRate !== 0 ? Math.abs(video.playbackRate) : 1.0;\n var avgbw = this._bwEstimator ? this._bwEstimator.getEstimate() : config.abrEwmaDefaultEstimate; // bufferStarvationDelay is the wall-clock time left until the playback buffer is exhausted.\n\n var bufferStarvationDelay = (BufferHelper.bufferInfo(video, pos, config.maxBufferHole).end - pos) / playbackRate; // 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\n var bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay, config.abrBandWidthFactor, config.abrBandWidthUpFactor, levels);\n\n if (bestLevel >= 0) {\n return bestLevel;\n } else {\n logger[\"logger\"].trace('rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering'); // not possible to get rid of rebuffering ... let's try to find level that will guarantee less than maxStarvationDelay of rebuffering\n // if no matching level found, logic will return 0\n\n var maxStarvationDelay = currentFragDuration ? Math.min(currentFragDuration, config.maxStarvationDelay) : config.maxStarvationDelay;\n var bwFactor = config.abrBandWidthFactor;\n var bwUpFactor = config.abrBandWidthUpFactor;\n\n if (bufferStarvationDelay === 0) {\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\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[\"logger\"].trace(\"bitrate test took \" + Math.round(1000 * bitrateTestDelay) + \"ms, set first fragment max fetchDuration to \" + Math.round(1000 * maxStarvationDelay) + \" ms\"); // don't use conservative factor on bitrate test\n\n bwFactor = bwUpFactor = 1;\n }\n }\n\n bestLevel = this._findBestLevel(currentLevel, currentFragDuration, avgbw, minAutoLevel, maxAutoLevel, bufferStarvationDelay + maxStarvationDelay, bwFactor, bwUpFactor, levels);\n return Math.max(bestLevel, 0);\n }\n }\n }]);\n\n return AbrController;\n}(event_handler);\n\n/* harmony default export */ var abr_controller = (abr_controller_AbrController);\n// CONCATENATED MODULE: ./src/controller/buffer-controller.ts\n\n\nfunction buffer_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Buffer Controller\n */\n\n\n\n\n\nvar buffer_controller_MediaSource = getMediaSource();\n\nvar buffer_controller_BufferController = /*#__PURE__*/function (_EventHandler) {\n buffer_controller_inheritsLoose(BufferController, _EventHandler);\n\n // the value that we have set mediasource.duration to\n // (the actual duration may be tweaked slighly by the browser)\n // the value that we want to set mediaSource.duration to\n // the target duration of the current media playlist\n // current stream state: true - for live broadcast, false - for VoD content\n // cache the self generated object url to detect hijack of video tag\n // signals that the sourceBuffers need to be flushed\n // signals that mediaSource should have endOfStream called\n // this is optional because this property is removed from the class sometimes\n // The number of BUFFER_CODEC events received before any sourceBuffers are created\n // The total number of BUFFER_CODEC events received\n // A reference to the attached media element\n // A reference to the active media source\n // List of pending segments to be appended to source buffer\n // A guard to see if we are currently appending to the source buffer\n // counters\n function BufferController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].BUFFER_RESET, events[\"default\"].BUFFER_APPENDING, events[\"default\"].BUFFER_CODECS, events[\"default\"].BUFFER_EOS, events[\"default\"].BUFFER_FLUSHING, events[\"default\"].LEVEL_PTS_UPDATED, events[\"default\"].LEVEL_UPDATED) || this;\n _this._msDuration = null;\n _this._levelDuration = null;\n _this._levelTargetDuration = 10;\n _this._live = null;\n _this._objectUrl = null;\n _this._needsFlush = false;\n _this._needsEos = false;\n _this.config = void 0;\n _this.audioTimestampOffset = void 0;\n _this.bufferCodecEventsExpected = 0;\n _this._bufferCodecEventsTotal = 0;\n _this.media = null;\n _this.mediaSource = null;\n _this.segments = [];\n _this.parent = void 0;\n _this.appending = false;\n _this.appended = 0;\n _this.appendError = 0;\n _this.flushBufferCounter = 0;\n _this.tracks = {};\n _this.pendingTracks = {};\n _this.sourceBuffer = {};\n _this.flushRange = [];\n\n _this._onMediaSourceOpen = function () {\n logger[\"logger\"].log('media source opened');\n\n _this.hls.trigger(events[\"default\"].MEDIA_ATTACHED, {\n media: _this.media\n });\n\n var mediaSource = _this.mediaSource;\n\n if (mediaSource) {\n // once received, don't listen anymore to sourceopen event\n mediaSource.removeEventListener('sourceopen', _this._onMediaSourceOpen);\n }\n\n _this.checkPendingTracks();\n };\n\n _this._onMediaSourceClose = function () {\n logger[\"logger\"].log('media source closed');\n };\n\n _this._onMediaSourceEnded = function () {\n logger[\"logger\"].log('media source ended');\n };\n\n _this._onSBUpdateEnd = function () {\n // update timestampOffset\n if (_this.audioTimestampOffset && _this.sourceBuffer.audio) {\n var audioBuffer = _this.sourceBuffer.audio;\n logger[\"logger\"].warn(\"change mpeg audio timestamp offset from \" + audioBuffer.timestampOffset + \" to \" + _this.audioTimestampOffset);\n audioBuffer.timestampOffset = _this.audioTimestampOffset;\n delete _this.audioTimestampOffset;\n }\n\n if (_this._needsFlush) {\n _this.doFlush();\n }\n\n if (_this._needsEos) {\n _this.checkEos();\n }\n\n _this.appending = false;\n var parent = _this.parent; // count nb of pending segments waiting for appending on this sourcebuffer\n\n var pending = _this.segments.reduce(function (counter, segment) {\n return segment.parent === parent ? counter + 1 : counter;\n }, 0); // this.sourceBuffer is better to use than media.buffered as it is closer to the PTS data from the fragments\n\n\n var timeRanges = {};\n var sbSet = _this.sourceBuffer;\n\n for (var streamType in sbSet) {\n var sb = sbSet[streamType];\n\n if (!sb) {\n throw Error(\"handling source buffer update end error: source buffer for \" + streamType + \" uninitilized and unable to update buffered TimeRanges.\");\n }\n\n timeRanges[streamType] = sb.buffered;\n }\n\n _this.hls.trigger(events[\"default\"].BUFFER_APPENDED, {\n parent: parent,\n pending: pending,\n timeRanges: timeRanges\n }); // don't append in flushing mode\n\n\n if (!_this._needsFlush) {\n _this.doAppending();\n }\n\n _this.updateMediaElementDuration(); // appending goes first\n\n\n if (pending === 0) {\n _this.flushLiveBackBuffer();\n }\n };\n\n _this._onSBUpdateError = function (event) {\n logger[\"logger\"].error('sourceBuffer error:', event); // according to http://www.w3.org/TR/media-source/#sourcebuffer-append-error\n // this error might not always be fatal (it is fatal if decode error is set, in that case\n // it will be followed by a mediaElement error ...)\n\n _this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_APPENDING_ERROR,\n fatal: false\n }); // we don't need to do more than that, as accordin to the spec, updateend will be fired just after\n\n };\n\n _this.config = hls.config;\n return _this;\n }\n\n var _proto = BufferController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n };\n\n _proto.onLevelPtsUpdated = function onLevelPtsUpdated(data) {\n var type = data.type;\n var audioTrack = this.tracks.audio; // 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). At the time of change we issue\n // `SourceBuffer.abort()` and adjusting `SourceBuffer.timestampOffset` if `SourceBuffer.updating` is false or awaiting `updateend`\n // event if SB is in updating state.\n // More info here: https://github.com/video-dev/hls.js/issues/332#issuecomment-257986486\n\n if (type === 'audio' && audioTrack && audioTrack.container === 'audio/mpeg') {\n // Chrome audio mp3 track\n var audioBuffer = this.sourceBuffer.audio;\n\n if (!audioBuffer) {\n throw Error('Level PTS Updated and source buffer for audio uninitalized');\n }\n\n var delta = Math.abs(audioBuffer.timestampOffset - data.start); // adjust timestamp offset if time delta is greater than 100ms\n\n if (delta > 0.1) {\n var updating = audioBuffer.updating;\n\n try {\n audioBuffer.abort();\n } catch (err) {\n logger[\"logger\"].warn('can not abort audio buffer: ' + err);\n }\n\n if (!updating) {\n logger[\"logger\"].warn('change mpeg audio timestamp offset from ' + audioBuffer.timestampOffset + ' to ' + data.start);\n audioBuffer.timestampOffset = data.start;\n } else {\n this.audioTimestampOffset = data.start;\n }\n }\n }\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n // in case of alt audio (where all tracks have urls) 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\n if (data.audio && !data.video || !data.altAudio) {\n codecEvents = 1;\n }\n\n this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = codecEvents;\n logger[\"logger\"].log(this.bufferCodecEventsExpected + \" bufferCodec event(s) expected\");\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n var media = this.media = data.media;\n\n if (media && buffer_controller_MediaSource) {\n // setup the media source\n var ms = this.mediaSource = new buffer_controller_MediaSource(); // Media Source listeners\n\n ms.addEventListener('sourceopen', this._onMediaSourceOpen);\n ms.addEventListener('sourceended', this._onMediaSourceEnded);\n ms.addEventListener('sourceclose', this._onMediaSourceClose); // link video and media Source\n\n media.src = window.URL.createObjectURL(ms); // cache the locally generated object url\n\n this._objectUrl = media.src;\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n logger[\"logger\"].log('media source detaching');\n var ms = this.mediaSource;\n\n if (ms) {\n if (ms.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 ms.endOfStream();\n } catch (err) {\n logger[\"logger\"].warn(\"onMediaDetaching:\" + err.message + \" while calling endOfStream\");\n }\n }\n\n ms.removeEventListener('sourceopen', this._onMediaSourceOpen);\n ms.removeEventListener('sourceended', this._onMediaSourceEnded);\n ms.removeEventListener('sourceclose', this._onMediaSourceClose); // Detach properly the MediaSource from the HTMLMediaElement as\n // suggested in https://github.com/w3c/media-source/issues/53.\n\n if (this.media) {\n if (this._objectUrl) {\n window.URL.revokeObjectURL(this._objectUrl);\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\n\n if (this.media.src === this._objectUrl) {\n this.media.removeAttribute('src');\n this.media.load();\n } else {\n logger[\"logger\"].warn('media.src was changed by a third party - skip cleanup');\n }\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 this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n }\n\n this.hls.trigger(events[\"default\"].MEDIA_DETACHED);\n };\n\n _proto.checkPendingTracks = function checkPendingTracks() {\n var bufferCodecEventsExpected = this.bufferCodecEventsExpected,\n pendingTracks = this.pendingTracks; // 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\n var pendingTracksCount = Object.keys(pendingTracks).length;\n\n if (pendingTracksCount && !bufferCodecEventsExpected || pendingTracksCount === 2) {\n // ok, let's create them now !\n this.createSourceBuffers(pendingTracks);\n this.pendingTracks = {}; // append any pending segments now !\n\n this.doAppending();\n }\n };\n\n _proto.onBufferReset = function onBufferReset() {\n var sourceBuffer = this.sourceBuffer;\n\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n\n try {\n if (sb) {\n if (this.mediaSource) {\n this.mediaSource.removeSourceBuffer(sb);\n }\n\n sb.removeEventListener('updateend', this._onSBUpdateEnd);\n sb.removeEventListener('error', this._onSBUpdateError);\n }\n } catch (err) {}\n }\n\n this.sourceBuffer = {};\n this.flushRange = [];\n this.segments = [];\n this.appended = 0;\n };\n\n _proto.onBufferCodecs = function onBufferCodecs(tracks) {\n var _this2 = this;\n\n // if source buffer(s) not created yet, appended buffer tracks in this.pendingTracks\n // if sourcebuffers already created, do nothing ...\n if (Object.keys(this.sourceBuffer).length) {\n return;\n }\n\n Object.keys(tracks).forEach(function (trackName) {\n _this2.pendingTracks[trackName] = tracks[trackName];\n });\n this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0);\n\n if (this.mediaSource && this.mediaSource.readyState === 'open') {\n this.checkPendingTracks();\n }\n };\n\n _proto.createSourceBuffers = function createSourceBuffers(tracks) {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n if (!mediaSource) {\n throw Error('createSourceBuffers called when mediaSource was null');\n }\n\n for (var trackName in tracks) {\n if (!sourceBuffer[trackName]) {\n var track = tracks[trackName];\n\n if (!track) {\n throw Error(\"source buffer exists for track \" + trackName + \", however track does not\");\n } // use levelCodec as first priority\n\n\n var codec = track.levelCodec || track.codec;\n var mimeType = track.container + \";codecs=\" + codec;\n logger[\"logger\"].log(\"creating sourceBuffer(\" + mimeType + \")\");\n\n try {\n var sb = sourceBuffer[trackName] = mediaSource.addSourceBuffer(mimeType);\n sb.addEventListener('updateend', this._onSBUpdateEnd);\n sb.addEventListener('error', this._onSBUpdateError);\n this.tracks[trackName] = {\n buffer: sb,\n codec: codec,\n id: track.id,\n container: track.container,\n levelCodec: track.levelCodec\n };\n } catch (err) {\n logger[\"logger\"].error(\"error while trying to add sourceBuffer:\" + err.message);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].BUFFER_ADD_CODEC_ERROR,\n fatal: false,\n err: err,\n mimeType: mimeType\n });\n }\n }\n }\n\n this.hls.trigger(events[\"default\"].BUFFER_CREATED, {\n tracks: this.tracks\n });\n };\n\n _proto.onBufferAppending = function onBufferAppending(data) {\n if (!this._needsFlush) {\n if (!this.segments) {\n this.segments = [data];\n } else {\n this.segments.push(data);\n }\n\n this.doAppending();\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\n _proto.onBufferEos = function onBufferEos(data) {\n for (var type in this.sourceBuffer) {\n if (!data.type || data.type === type) {\n var sb = this.sourceBuffer[type];\n\n if (sb && !sb.ended) {\n sb.ended = true;\n logger[\"logger\"].log(type + \" sourceBuffer now EOS\");\n }\n }\n }\n\n this.checkEos();\n } // if all source buffers are marked as ended, signal endOfStream() to MediaSource.\n ;\n\n _proto.checkEos = function checkEos() {\n var sourceBuffer = this.sourceBuffer,\n mediaSource = this.mediaSource;\n\n if (!mediaSource || mediaSource.readyState !== 'open') {\n this._needsEos = false;\n return;\n }\n\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n if (!sb) continue;\n\n if (!sb.ended) {\n return;\n }\n\n if (sb.updating) {\n this._needsEos = true;\n return;\n }\n }\n\n logger[\"logger\"].log('all media data are available, signal endOfStream() to MediaSource and stop loading fragment'); // Notify the media element that it now has all of the media data\n\n try {\n mediaSource.endOfStream();\n } catch (e) {\n logger[\"logger\"].warn('exception while calling mediaSource.endOfStream()');\n }\n\n this._needsEos = false;\n };\n\n _proto.onBufferFlushing = function onBufferFlushing(data) {\n if (data.type) {\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: data.type\n });\n } else {\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: 'video'\n });\n this.flushRange.push({\n start: data.startOffset,\n end: data.endOffset,\n type: 'audio'\n });\n } // attempt flush immediately\n\n\n this.flushBufferCounter = 0;\n this.doFlush();\n };\n\n _proto.flushLiveBackBuffer = function flushLiveBackBuffer() {\n // clear back buffer for live only\n if (!this._live) {\n return;\n }\n\n var liveBackBufferLength = this.config.liveBackBufferLength;\n\n if (!isFinite(liveBackBufferLength) || liveBackBufferLength < 0) {\n return;\n }\n\n if (!this.media) {\n logger[\"logger\"].error('flushLiveBackBuffer called without attaching media');\n return;\n }\n\n var currentTime = this.media.currentTime;\n var sourceBuffer = this.sourceBuffer;\n var bufferTypes = Object.keys(sourceBuffer);\n var targetBackBufferPosition = currentTime - Math.max(liveBackBufferLength, this._levelTargetDuration);\n\n for (var index = bufferTypes.length - 1; index >= 0; index--) {\n var bufferType = bufferTypes[index];\n var sb = sourceBuffer[bufferType];\n\n if (sb) {\n var buffered = sb.buffered; // when target buffer start exceeds actual buffer start\n\n if (buffered.length > 0 && targetBackBufferPosition > buffered.start(0)) {\n // remove buffer up until current time minus minimum back buffer length (removing buffer too close to current\n // time will lead to playback freezing)\n // credits for level target duration - https://github.com/videojs/http-streaming/blob/3132933b6aa99ddefab29c10447624efd6fd6e52/src/segment-loader.js#L91\n if (this.removeBufferRange(bufferType, sb, 0, targetBackBufferPosition)) {\n this.hls.trigger(events[\"default\"].LIVE_BACK_BUFFER_REACHED, {\n bufferEnd: targetBackBufferPosition\n });\n }\n }\n }\n }\n };\n\n _proto.onLevelUpdated = function onLevelUpdated(_ref) {\n var details = _ref.details;\n\n if (details.fragments.length > 0) {\n this._levelDuration = details.totalduration + details.fragments[0].start;\n this._levelTargetDuration = details.averagetargetduration || details.targetduration || 10;\n this._live = details.live;\n this.updateMediaElementDuration();\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 ;\n\n _proto.updateMediaElementDuration = function updateMediaElementDuration() {\n var config = this.config;\n var duration;\n\n if (this._levelDuration === null || !this.media || !this.mediaSource || !this.sourceBuffer || this.media.readyState === 0 || this.mediaSource.readyState !== 'open') {\n return;\n }\n\n for (var type in this.sourceBuffer) {\n var sb = this.sourceBuffer[type];\n\n if (sb && sb.updating === true) {\n // can't set duration whilst a buffer is updating\n return;\n }\n }\n\n duration = this.media.duration; // initialise to the value that the media source is reporting\n\n if (this._msDuration === null) {\n this._msDuration = this.mediaSource.duration;\n }\n\n if (this._live === true && config.liveDurationInfinity === true) {\n // Override duration to Infinity\n logger[\"logger\"].log('Media Source duration is set to Infinity');\n this._msDuration = this.mediaSource.duration = Infinity;\n } else if (this._levelDuration > this._msDuration && this._levelDuration > duration || !Object(number[\"isFiniteNumber\"])(duration)) {\n // levelDuration was the last value we set.\n // not using mediaSource.duration as the browser may tweak this value\n // only update Media Source duration if its value increase, this is to avoid\n // flushing already buffered portion when switching between quality level\n logger[\"logger\"].log(\"Updating Media Source duration to \" + this._levelDuration.toFixed(3));\n this._msDuration = this.mediaSource.duration = this._levelDuration;\n }\n };\n\n _proto.doFlush = function doFlush() {\n // loop through all buffer ranges to flush\n while (this.flushRange.length) {\n var range = this.flushRange[0]; // flushBuffer will abort any buffer append in progress and flush Audio/Video Buffer\n\n if (this.flushBuffer(range.start, range.end, range.type)) {\n // range flushed, remove from flush array\n this.flushRange.shift();\n this.flushBufferCounter = 0;\n } else {\n this._needsFlush = true; // avoid looping, wait for SB update end to retrigger a flush\n\n return;\n }\n }\n\n if (this.flushRange.length === 0) {\n // everything flushed\n this._needsFlush = false; // let's recompute this.appended, which is used to avoid flush looping\n\n var appended = 0;\n var sourceBuffer = this.sourceBuffer;\n\n try {\n for (var type in sourceBuffer) {\n var sb = sourceBuffer[type];\n\n if (sb) {\n appended += sb.buffered.length;\n }\n }\n } catch (error) {\n // error could be thrown while accessing buffered, in case sourcebuffer has already been removed from MediaSource\n // this is harmess at this stage, catch this to avoid reporting an internal exception\n logger[\"logger\"].error('error while accessing sourceBuffer.buffered');\n }\n\n this.appended = appended;\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHED);\n }\n };\n\n _proto.doAppending = function doAppending() {\n var config = this.config,\n hls = this.hls,\n segments = this.segments,\n sourceBuffer = this.sourceBuffer;\n\n if (!Object.keys(sourceBuffer).length) {\n // early exit if no source buffers have been initialized yet\n return;\n }\n\n if (!this.media || this.media.error) {\n this.segments = [];\n logger[\"logger\"].error('trying to append although a media error occured, flush segment and abort');\n return;\n }\n\n if (this.appending) {\n // logger.log(`sb appending in progress`);\n return;\n }\n\n var segment = segments.shift();\n\n if (!segment) {\n // handle undefined shift\n return;\n }\n\n try {\n var sb = sourceBuffer[segment.type];\n\n if (!sb) {\n // in case we don't have any source buffer matching with this segment type,\n // it means that Mediasource fails to create sourcebuffer\n // discard this segment, and trigger update end\n this._onSBUpdateEnd();\n\n return;\n }\n\n if (sb.updating) {\n // if we are still updating the source buffer from the last segment, place this back at the front of the queue\n segments.unshift(segment);\n return;\n } // reset sourceBuffer ended flag before appending segment\n\n\n sb.ended = false; // logger.log(`appending ${segment.content} ${type} SB, size:${segment.data.length}, ${segment.parent}`);\n\n this.parent = segment.parent;\n sb.appendBuffer(segment.data);\n this.appendError = 0;\n this.appended++;\n this.appending = true;\n } catch (err) {\n // in case any error occured while appending, put back segment in segments table\n logger[\"logger\"].error(\"error while trying to append buffer:\" + err.message);\n segments.unshift(segment);\n var event = {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n parent: segment.parent,\n details: '',\n fatal: false\n };\n\n if (err.code === 22) {\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 this.segments = [];\n event.details = errors[\"ErrorDetails\"].BUFFER_FULL_ERROR;\n } else {\n this.appendError++;\n event.details = errors[\"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 help recovering this\n */\n\n if (this.appendError > config.appendErrorMaxRetry) {\n logger[\"logger\"].log(\"fail \" + config.appendErrorMaxRetry + \" times to append segment in sourceBuffer\");\n this.segments = [];\n event.fatal = true;\n }\n }\n\n hls.trigger(events[\"default\"].ERROR, event);\n }\n }\n /*\n flush specified buffered range,\n return true once range has been flushed.\n as sourceBuffer.remove() is asynchronous, flushBuffer will be retriggered on sourceBuffer update end\n */\n ;\n\n _proto.flushBuffer = function flushBuffer(startOffset, endOffset, sbType) {\n var sourceBuffer = this.sourceBuffer; // exit if no sourceBuffers are initialized\n\n if (!Object.keys(sourceBuffer).length) {\n return true;\n }\n\n var currentTime = 'null';\n\n if (this.media) {\n currentTime = this.media.currentTime.toFixed(3);\n }\n\n logger[\"logger\"].log(\"flushBuffer,pos/start/end: \" + currentTime + \"/\" + startOffset + \"/\" + endOffset); // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n\n if (this.flushBufferCounter >= this.appended) {\n logger[\"logger\"].warn('abort flushing too many retries');\n return true;\n }\n\n var sb = sourceBuffer[sbType]; // we are going to flush buffer, mark source buffer as 'not ended'\n\n if (sb) {\n sb.ended = false;\n\n if (!sb.updating) {\n if (this.removeBufferRange(sbType, sb, startOffset, endOffset)) {\n this.flushBufferCounter++;\n return false;\n }\n } else {\n logger[\"logger\"].warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n\n logger[\"logger\"].log('buffer flushed'); // everything flushed !\n\n return true;\n }\n /**\n * Removes first buffered range from provided source buffer that lies within given start and end offsets.\n *\n * @param {string} type Type of the source buffer, logging purposes only.\n * @param {SourceBuffer} sb Target SourceBuffer instance.\n * @param {number} startOffset\n * @param {number} endOffset\n *\n * @returns {boolean} True when source buffer remove requested.\n */\n ;\n\n _proto.removeBufferRange = function removeBufferRange(type, sb, startOffset, endOffset) {\n try {\n for (var i = 0; i < sb.buffered.length; i++) {\n var bufStart = sb.buffered.start(i);\n var bufEnd = sb.buffered.end(i);\n var removeStart = Math.max(bufStart, startOffset);\n var removeEnd = Math.min(bufEnd, endOffset);\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n\n if (Math.min(removeEnd, bufEnd) - removeStart > 0.5) {\n var currentTime = 'null';\n\n if (this.media) {\n currentTime = this.media.currentTime.toString();\n }\n\n logger[\"logger\"].log(\"sb remove \" + type + \" [\" + removeStart + \",\" + removeEnd + \"], of [\" + bufStart + \",\" + bufEnd + \"], pos:\" + currentTime);\n sb.remove(removeStart, removeEnd);\n return true;\n }\n }\n } catch (error) {\n logger[\"logger\"].warn('removeBufferRange failed', error);\n }\n\n return false;\n };\n\n return BufferController;\n}(event_handler);\n\n/* harmony default export */ var buffer_controller = (buffer_controller_BufferController);\n// CONCATENATED MODULE: ./src/controller/cap-level-controller.js\nfunction cap_level_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction cap_level_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) cap_level_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) cap_level_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction cap_level_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * cap stream level to media size dimension controller\n*/\n\n\n\nvar cap_level_controller_CapLevelController = /*#__PURE__*/function (_EventHandler) {\n cap_level_controller_inheritsLoose(CapLevelController, _EventHandler);\n\n function CapLevelController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].FPS_DROP_LEVEL_CAPPING, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].LEVELS_UPDATED, events[\"default\"].BUFFER_CODECS, events[\"default\"].MEDIA_DETACHING) || this;\n _this.autoLevelCapping = Number.POSITIVE_INFINITY;\n _this.firstLevel = null;\n _this.levels = [];\n _this.media = null;\n _this.restrictedLevels = [];\n _this.timer = null;\n _this.clientRect = null;\n return _this;\n }\n\n var _proto = CapLevelController.prototype;\n\n _proto.destroy = function destroy() {\n if (this.hls.config.capLevelToPlayerSize) {\n this.media = null;\n this.clientRect = null;\n this.stopCapping();\n }\n };\n\n _proto.onFpsDropLevelCapping = function onFpsDropLevelCapping(data) {\n // Don't add a restricted level more than once\n if (CapLevelController.isLevelAllowed(data.droppedLevel, this.restrictedLevels)) {\n this.restrictedLevels.push(data.droppedLevel);\n }\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media instanceof window.HTMLVideoElement ? data.media : null;\n };\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var hls = this.hls;\n this.restrictedLevels = [];\n this.levels = data.levels;\n this.firstLevel = data.firstLevel;\n\n if (hls.config.capLevelToPlayerSize && data.video) {\n // Start capping immediately if the manifest has signaled video codecs\n this.startCapping();\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\n _proto.onBufferCodecs = function onBufferCodecs(data) {\n var hls = this.hls;\n\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\n _proto.onLevelsUpdated = function onLevelsUpdated(data) {\n this.levels = data.levels;\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n this.stopCapping();\n };\n\n _proto.detectPlayerSize = function detectPlayerSize() {\n if (this.media) {\n var levelsLength = this.levels ? this.levels.length : 0;\n\n if (levelsLength) {\n var hls = this.hls;\n hls.autoLevelCapping = this.getMaxLevel(levelsLength - 1);\n\n if (hls.autoLevelCapping > this.autoLevelCapping) {\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 hls.streamController.nextLevelSwitch();\n }\n\n this.autoLevelCapping = hls.autoLevelCapping;\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 ;\n\n _proto.getMaxLevel = function getMaxLevel(capLevelIndex) {\n var _this2 = this;\n\n if (!this.levels) {\n return -1;\n }\n\n var validLevels = this.levels.filter(function (level, index) {\n return CapLevelController.isLevelAllowed(index, _this2.restrictedLevels) && index <= capLevelIndex;\n });\n this.clientRect = null;\n return CapLevelController.getMaxLevelByMediaSize(validLevels, this.mediaWidth, this.mediaHeight);\n };\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\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n this.hls.firstLevel = this.getMaxLevel(this.firstLevel);\n clearInterval(this.timer);\n this.timer = setInterval(this.detectPlayerSize.bind(this), 1000);\n this.detectPlayerSize();\n };\n\n _proto.stopCapping = function stopCapping() {\n this.restrictedLevels = [];\n this.firstLevel = null;\n this.autoLevelCapping = Number.POSITIVE_INFINITY;\n\n if (this.timer) {\n this.timer = clearInterval(this.timer);\n this.timer = null;\n }\n };\n\n _proto.getDimensions = function getDimensions() {\n if (this.clientRect) {\n return this.clientRect;\n }\n\n var media = this.media;\n var boundsRect = {\n width: 0,\n height: 0\n };\n\n if (media) {\n var clientRect = media.getBoundingClientRect();\n boundsRect.width = clientRect.width;\n boundsRect.height = clientRect.height;\n\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\n this.clientRect = boundsRect;\n return boundsRect;\n };\n\n CapLevelController.isLevelAllowed = function isLevelAllowed(level, restrictedLevels) {\n if (restrictedLevels === void 0) {\n restrictedLevels = [];\n }\n\n return restrictedLevels.indexOf(level) === -1;\n };\n\n CapLevelController.getMaxLevelByMediaSize = function getMaxLevelByMediaSize(levels, width, height) {\n if (!levels || levels && !levels.length) {\n return -1;\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\n\n var atGreatestBandiwdth = function atGreatestBandiwdth(curLevel, nextLevel) {\n if (!nextLevel) {\n return true;\n }\n\n return curLevel.width !== nextLevel.width || curLevel.height !== nextLevel.height;\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\n\n var maxLevelIndex = levels.length - 1;\n\n for (var i = 0; i < levels.length; i += 1) {\n var level = levels[i];\n\n if ((level.width >= width || level.height >= height) && atGreatestBandiwdth(level, levels[i + 1])) {\n maxLevelIndex = i;\n break;\n }\n }\n\n return maxLevelIndex;\n };\n\n cap_level_controller_createClass(CapLevelController, [{\n key: \"mediaWidth\",\n get: function get() {\n return this.getDimensions().width * CapLevelController.contentScaleFactor;\n }\n }, {\n key: \"mediaHeight\",\n get: function get() {\n return this.getDimensions().height * CapLevelController.contentScaleFactor;\n }\n }], [{\n key: \"contentScaleFactor\",\n get: function get() {\n var pixelRatio = 1;\n\n try {\n pixelRatio = window.devicePixelRatio;\n } catch (e) {}\n\n return pixelRatio;\n }\n }]);\n\n return CapLevelController;\n}(event_handler);\n\n/* harmony default export */ var cap_level_controller = (cap_level_controller_CapLevelController);\n// CONCATENATED MODULE: ./src/controller/fps-controller.js\nfunction fps_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * FPS Controller\n*/\n\n\n\nvar fps_controller_window = window,\n fps_controller_performance = fps_controller_window.performance;\n\nvar fps_controller_FPSController = /*#__PURE__*/function (_EventHandler) {\n fps_controller_inheritsLoose(FPSController, _EventHandler);\n\n function FPSController(hls) {\n return _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING) || this;\n }\n\n var _proto = FPSController.prototype;\n\n _proto.destroy = function destroy() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n\n this.isVideoPlaybackQualityAvailable = false;\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n var config = this.hls.config;\n\n if (config.capLevelOnFPSDrop) {\n var video = this.video = data.media instanceof window.HTMLVideoElement ? data.media : null;\n\n if (typeof video.getVideoPlaybackQuality === 'function') {\n this.isVideoPlaybackQualityAvailable = true;\n }\n\n clearInterval(this.timer);\n this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);\n }\n };\n\n _proto.checkFPS = function checkFPS(video, decodedFrames, droppedFrames) {\n var currentTime = fps_controller_performance.now();\n\n if (decodedFrames) {\n if (this.lastTime) {\n var currentPeriod = currentTime - this.lastTime,\n currentDropped = droppedFrames - this.lastDroppedFrames,\n currentDecoded = decodedFrames - this.lastDecodedFrames,\n droppedFPS = 1000 * currentDropped / currentPeriod,\n hls = this.hls;\n hls.trigger(events[\"default\"].FPS_DROP, {\n currentDropped: currentDropped,\n currentDecoded: currentDecoded,\n totalDroppedFrames: droppedFrames\n });\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[\"logger\"].warn('drop FPS ratio greater than max allowed value for currentLevel: ' + currentLevel);\n\n if (currentLevel > 0 && (hls.autoLevelCapping === -1 || hls.autoLevelCapping >= currentLevel)) {\n currentLevel = currentLevel - 1;\n hls.trigger(events[\"default\"].FPS_DROP_LEVEL_CAPPING, {\n level: currentLevel,\n droppedLevel: hls.currentLevel\n });\n hls.autoLevelCapping = currentLevel;\n hls.streamController.nextLevelSwitch();\n }\n }\n }\n }\n\n this.lastTime = currentTime;\n this.lastDroppedFrames = droppedFrames;\n this.lastDecodedFrames = decodedFrames;\n }\n };\n\n _proto.checkFPSInterval = function checkFPSInterval() {\n var video = this.video;\n\n if (video) {\n if (this.isVideoPlaybackQualityAvailable) {\n var videoPlaybackQuality = video.getVideoPlaybackQuality();\n this.checkFPS(video, videoPlaybackQuality.totalVideoFrames, videoPlaybackQuality.droppedVideoFrames);\n } else {\n this.checkFPS(video, video.webkitDecodedFrameCount, video.webkitDroppedFrameCount);\n }\n }\n };\n\n return FPSController;\n}(event_handler);\n\n/* harmony default export */ var fps_controller = (fps_controller_FPSController);\n// CONCATENATED MODULE: ./src/utils/xhr-loader.js\n/**\n * XHR based logger\n*/\n\n\nvar xhr_loader_XhrLoader = /*#__PURE__*/function () {\n function XhrLoader(config) {\n if (config && config.xhrSetup) {\n this.xhrSetup = config.xhrSetup;\n }\n }\n\n var _proto = XhrLoader.prototype;\n\n _proto.destroy = function destroy() {\n this.abort();\n this.loader = null;\n };\n\n _proto.abort = function abort() {\n var loader = this.loader;\n\n if (loader && loader.readyState !== 4) {\n this.stats.aborted = true;\n loader.abort();\n }\n\n window.clearTimeout(this.requestTimeout);\n this.requestTimeout = null;\n window.clearTimeout(this.retryTimeout);\n this.retryTimeout = null;\n };\n\n _proto.load = function load(context, config, callbacks) {\n this.context = context;\n this.config = config;\n this.callbacks = callbacks;\n this.stats = {\n trequest: window.performance.now(),\n retry: 0\n };\n this.retryDelay = config.retryDelay;\n this.loadInternal();\n };\n\n _proto.loadInternal = function loadInternal() {\n var xhr,\n context = this.context;\n xhr = this.loader = new window.XMLHttpRequest();\n var stats = this.stats;\n stats.tfirst = 0;\n stats.loaded = 0;\n var xhrSetup = this.xhrSetup;\n\n try {\n if (xhrSetup) {\n try {\n xhrSetup(xhr, context.url);\n } catch (e) {\n // fix xhrSetup: (xhr, url) => {xhr.setRequestHeader(\"Content-Language\", \"test\");}\n // not working, as xhr.setRequestHeader expects xhr.readyState === OPEN\n xhr.open('GET', context.url, true);\n xhrSetup(xhr, context.url);\n }\n }\n\n if (!xhr.readyState) {\n xhr.open('GET', context.url, true);\n }\n } catch (e) {\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: e.message\n }, context, xhr);\n return;\n }\n\n if (context.rangeEnd) {\n xhr.setRequestHeader('Range', 'bytes=' + context.rangeStart + '-' + (context.rangeEnd - 1));\n }\n\n xhr.onreadystatechange = this.readystatechange.bind(this);\n xhr.onprogress = this.loadprogress.bind(this);\n xhr.responseType = context.responseType; // setup timeout before we perform request\n\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), this.config.timeout);\n xhr.send();\n };\n\n _proto.readystatechange = function readystatechange(event) {\n var xhr = event.currentTarget,\n readyState = xhr.readyState,\n stats = this.stats,\n context = this.context,\n config = this.config; // don't proceed if xhr has been aborted\n\n if (stats.aborted) {\n return;\n } // >= HEADERS_RECEIVED\n\n\n if (readyState >= 2) {\n // clear xhr timeout and rearm it if readyState less than 4\n window.clearTimeout(this.requestTimeout);\n\n if (stats.tfirst === 0) {\n stats.tfirst = Math.max(window.performance.now(), stats.trequest);\n }\n\n if (readyState === 4) {\n var status = xhr.status; // http status between 200 to 299 are all successful\n\n if (status >= 200 && status < 300) {\n stats.tload = Math.max(stats.tfirst, window.performance.now());\n var data, len;\n\n if (context.responseType === 'arraybuffer') {\n data = xhr.response;\n len = data.byteLength;\n } else {\n data = xhr.responseText;\n len = data.length;\n }\n\n stats.loaded = stats.total = len;\n var response = {\n url: xhr.responseURL,\n data: data\n };\n this.callbacks.onSuccess(response, stats, context, xhr);\n } else {\n // if max nb of retries reached or if http status between 400 and 499 (such error cannot be recovered, retrying is useless), return error\n if (stats.retry >= config.maxRetry || status >= 400 && status < 499) {\n logger[\"logger\"].error(status + \" while loading \" + context.url);\n this.callbacks.onError({\n code: status,\n text: xhr.statusText\n }, context, xhr);\n } else {\n // retry\n logger[\"logger\"].warn(status + \" while loading \" + context.url + \", retrying in \" + this.retryDelay + \"...\"); // aborts and resets internal state\n\n this.destroy(); // schedule retry\n\n this.retryTimeout = window.setTimeout(this.loadInternal.bind(this), this.retryDelay); // set exponential backoff\n\n this.retryDelay = Math.min(2 * this.retryDelay, config.maxRetryDelay);\n stats.retry++;\n }\n }\n } else {\n // readyState >= 2 AND readyState !==4 (readyState = HEADERS_RECEIVED || LOADING) rearm timeout as xhr not finished yet\n this.requestTimeout = window.setTimeout(this.loadtimeout.bind(this), config.timeout);\n }\n }\n };\n\n _proto.loadtimeout = function loadtimeout() {\n logger[\"logger\"].warn(\"timeout while loading \" + this.context.url);\n this.callbacks.onTimeout(this.stats, this.context, null);\n };\n\n _proto.loadprogress = function loadprogress(event) {\n var xhr = event.currentTarget,\n stats = this.stats;\n stats.loaded = event.loaded;\n\n if (event.lengthComputable) {\n stats.total = event.total;\n }\n\n var onProgress = this.callbacks.onProgress;\n\n if (onProgress) {\n // third arg is to provide on progress data\n onProgress(stats, this.context, null, xhr);\n }\n };\n\n return XhrLoader;\n}();\n\n/* harmony default export */ var xhr_loader = (xhr_loader_XhrLoader);\n// CONCATENATED MODULE: ./src/controller/audio-track-controller.js\nfunction audio_track_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction audio_track_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) audio_track_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) audio_track_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction audio_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n/**\n * @class AudioTrackController\n * @implements {EventHandler}\n *\n * Handles main manifest and audio-track metadata loaded,\n * owns and exposes the selectable audio-tracks data-models.\n *\n * Exposes internal interface to select available audio-tracks.\n *\n * Handles errors on loading audio-track playlists. Manages fallback mechanism\n * with redundants tracks (group-IDs).\n *\n * Handles level-loading and group-ID switches for video (fallback on video levels),\n * and eventually adapts the audio-track group-ID to match.\n *\n * @fires AUDIO_TRACK_LOADING\n * @fires AUDIO_TRACK_SWITCHING\n * @fires AUDIO_TRACKS_UPDATED\n * @fires ERROR\n *\n */\n\nvar audio_track_controller_AudioTrackController = /*#__PURE__*/function (_TaskLoop) {\n audio_track_controller_inheritsLoose(AudioTrackController, _TaskLoop);\n\n function AudioTrackController(hls) {\n var _this;\n\n _this = _TaskLoop.call(this, hls, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_PARSED, events[\"default\"].AUDIO_TRACK_LOADED, events[\"default\"].AUDIO_TRACK_SWITCHED, events[\"default\"].LEVEL_LOADED, events[\"default\"].ERROR) || this;\n /**\n * @private\n * Currently selected index in `tracks`\n * @member {number} trackId\n */\n\n _this._trackId = -1;\n /**\n * @private\n * If should select tracks according to default track attribute\n * @member {boolean} _selectDefaultTrack\n */\n\n _this._selectDefaultTrack = true;\n /**\n * @public\n * All tracks available\n * @member {AudioTrack[]}\n */\n\n _this.tracks = [];\n /**\n * @public\n * List of blacklisted audio track IDs (that have caused failure)\n * @member {number[]}\n */\n\n _this.trackIdBlacklist = Object.create(null);\n /**\n * @public\n * The currently running group ID for audio\n * (we grab this on manifest-parsed and new level-loaded)\n * @member {string}\n */\n\n _this.audioGroupId = null;\n return _this;\n }\n /**\n * Reset audio tracks on new manifest loading.\n */\n\n\n var _proto = AudioTrackController.prototype;\n\n _proto.onManifestLoading = function onManifestLoading() {\n this.tracks = [];\n this._trackId = -1;\n this._selectDefaultTrack = true;\n }\n /**\n * Store tracks data from manifest parsed data.\n *\n * Trigger AUDIO_TRACKS_UPDATED event.\n *\n * @param {*} data\n */\n ;\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n var tracks = this.tracks = data.audioTracks || [];\n this.hls.trigger(events[\"default\"].AUDIO_TRACKS_UPDATED, {\n audioTracks: tracks\n });\n\n this._selectAudioGroup(this.hls.nextLoadLevel);\n }\n /**\n * Store track details of loaded track in our data-model.\n *\n * Set-up metadata update interval task for live-mode streams.\n *\n * @param {*} data\n */\n ;\n\n _proto.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n if (data.id >= this.tracks.length) {\n logger[\"logger\"].warn('Invalid audio track id:', data.id);\n return;\n }\n\n logger[\"logger\"].log(\"audioTrack \" + data.id + \" loaded\");\n this.tracks[data.id].details = data.details; // check if current playlist is a live playlist\n // and if we have already our reload interval setup\n\n if (data.details.live && !this.hasInterval()) {\n // if live playlist we will have to reload it periodically\n // set reload period to playlist target duration\n var updatePeriodMs = data.details.targetduration * 1000;\n this.setInterval(updatePeriodMs);\n }\n\n if (!data.details.live && this.hasInterval()) {\n // playlist is not live and timer is scheduled: cancel it\n this.clearInterval();\n }\n }\n /**\n * Update the internal group ID to any audio-track we may have set manually\n * or because of a failure-handling fallback.\n *\n * Quality-levels should update to that group ID in this case.\n *\n * @param {*} data\n */\n ;\n\n _proto.onAudioTrackSwitched = function onAudioTrackSwitched(data) {\n var audioGroupId = this.tracks[data.id].groupId;\n\n if (audioGroupId && this.audioGroupId !== audioGroupId) {\n this.audioGroupId = audioGroupId;\n }\n }\n /**\n * When a level gets loaded, if it has redundant audioGroupIds (in the same ordinality as it's redundant URLs)\n * we are setting our audio-group ID internally to the one set, if it is different from the group ID currently set.\n *\n * If group-ID got update, we re-select the appropriate audio-track with this group-ID matching the currently\n * selected one (based on NAME property).\n *\n * @param {*} data\n */\n ;\n\n _proto.onLevelLoaded = function onLevelLoaded(data) {\n this._selectAudioGroup(data.level);\n }\n /**\n * Handle network errors loading audio track manifests\n * and also pausing on any netwok errors.\n *\n * @param {ErrorEventData} data\n */\n ;\n\n _proto.onError = function onError(data) {\n // Only handle network errors\n if (data.type !== errors[\"ErrorTypes\"].NETWORK_ERROR) {\n return;\n } // If fatal network error, cancel update task\n\n\n if (data.fatal) {\n this.clearInterval();\n } // If not an audio-track loading error don't handle further\n\n\n if (data.details !== errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR) {\n return;\n }\n\n logger[\"logger\"].warn('Network failure on audio-track id:', data.context.id);\n\n this._handleLoadError();\n }\n /**\n * @type {AudioTrack[]} Audio-track list we own\n */\n ;\n\n /**\n * @private\n * @param {number} newId\n */\n _proto._setAudioTrack = function _setAudioTrack(newId) {\n // noop on same audio track id as already set\n if (this._trackId === newId && this.tracks[this._trackId].details) {\n logger[\"logger\"].debug('Same id as current audio-track passed, and track details available -> no-op');\n return;\n } // check if level idx is valid\n\n\n if (newId < 0 || newId >= this.tracks.length) {\n logger[\"logger\"].warn('Invalid id passed to audio-track controller');\n return;\n }\n\n var audioTrack = this.tracks[newId];\n logger[\"logger\"].log(\"Now switching to audio-track index \" + newId); // stopping live reloading timer if any\n\n this.clearInterval();\n this._trackId = newId;\n var url = audioTrack.url,\n type = audioTrack.type,\n id = audioTrack.id;\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHING, {\n id: id,\n type: type,\n url: url\n });\n\n this._loadTrackDetailsIfNeeded(audioTrack);\n }\n /**\n * @override\n */\n ;\n\n _proto.doTick = function doTick() {\n this._updateTrack(this._trackId);\n }\n /**\n * @param levelId\n * @private\n */\n ;\n\n _proto._selectAudioGroup = function _selectAudioGroup(levelId) {\n var levelInfo = this.hls.levels[levelId];\n\n if (!levelInfo || !levelInfo.audioGroupIds) {\n return;\n }\n\n var audioGroupId = levelInfo.audioGroupIds[levelInfo.urlId];\n\n if (this.audioGroupId !== audioGroupId) {\n this.audioGroupId = audioGroupId;\n\n this._selectInitialAudioTrack();\n }\n }\n /**\n * Select initial track\n * @private\n */\n ;\n\n _proto._selectInitialAudioTrack = function _selectInitialAudioTrack() {\n var _this2 = this;\n\n var tracks = this.tracks;\n\n if (!tracks.length) {\n return;\n }\n\n var currentAudioTrack = this.tracks[this._trackId];\n var name = null;\n\n if (currentAudioTrack) {\n name = currentAudioTrack.name;\n } // Pre-select default tracks if there are any\n\n\n if (this._selectDefaultTrack) {\n var defaultTracks = tracks.filter(function (track) {\n return track.default;\n });\n\n if (defaultTracks.length) {\n tracks = defaultTracks;\n } else {\n logger[\"logger\"].warn('No default audio tracks defined');\n }\n }\n\n var trackFound = false;\n\n var traverseTracks = function traverseTracks() {\n // Select track with right group ID\n tracks.forEach(function (track) {\n if (trackFound) {\n return;\n } // We need to match the (pre-)selected group ID\n // and the NAME of the current track.\n\n\n if ((!_this2.audioGroupId || track.groupId === _this2.audioGroupId) && (!name || name === track.name)) {\n // If there was a previous track try to stay with the same `NAME`.\n // It should be unique across tracks of same group, and consistent through redundant track groups.\n _this2._setAudioTrack(track.id);\n\n trackFound = true;\n }\n });\n };\n\n traverseTracks();\n\n if (!trackFound) {\n name = null;\n traverseTracks();\n }\n\n if (!trackFound) {\n logger[\"logger\"].error(\"No track found for running audio group-ID: \" + this.audioGroupId);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR,\n fatal: true\n });\n }\n }\n /**\n * @private\n * @param {AudioTrack} audioTrack\n * @returns {boolean}\n */\n ;\n\n _proto._needsTrackLoading = function _needsTrackLoading(audioTrack) {\n var details = audioTrack.details,\n url = audioTrack.url;\n\n if (!details || details.live) {\n // check if we face an audio track embedded in main playlist (audio track without URI attribute)\n return !!url;\n }\n\n return false;\n }\n /**\n * @private\n * @param {AudioTrack} audioTrack\n */\n ;\n\n _proto._loadTrackDetailsIfNeeded = function _loadTrackDetailsIfNeeded(audioTrack) {\n if (this._needsTrackLoading(audioTrack)) {\n var url = audioTrack.url,\n id = audioTrack.id; // track not retrieved yet, or live playlist we need to (re)load it\n\n logger[\"logger\"].log(\"loading audio-track playlist for id: \" + id);\n this.hls.trigger(events[\"default\"].AUDIO_TRACK_LOADING, {\n url: url,\n id: id\n });\n }\n }\n /**\n * @private\n * @param {number} newId\n */\n ;\n\n _proto._updateTrack = function _updateTrack(newId) {\n // check if level idx is valid\n if (newId < 0 || newId >= this.tracks.length) {\n return;\n } // stopping live reloading timer if any\n\n\n this.clearInterval();\n this._trackId = newId;\n logger[\"logger\"].log(\"trying to update audio-track \" + newId);\n var audioTrack = this.tracks[newId];\n\n this._loadTrackDetailsIfNeeded(audioTrack);\n }\n /**\n * @private\n */\n ;\n\n _proto._handleLoadError = function _handleLoadError() {\n // First, let's black list current track id\n this.trackIdBlacklist[this._trackId] = true; // Let's try to fall back on a functional audio-track with the same group ID\n\n var previousId = this._trackId;\n var _this$tracks$previous = this.tracks[previousId],\n name = _this$tracks$previous.name,\n language = _this$tracks$previous.language,\n groupId = _this$tracks$previous.groupId;\n logger[\"logger\"].warn(\"Loading failed on audio track id: \" + previousId + \", group-id: \" + groupId + \", name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\"); // Find a non-blacklisted track ID with the same NAME\n // At least a track that is not blacklisted, thus on another group-ID.\n\n var newId = previousId;\n\n for (var i = 0; i < this.tracks.length; i++) {\n if (this.trackIdBlacklist[i]) {\n continue;\n }\n\n var newTrack = this.tracks[i];\n\n if (newTrack.name === name) {\n newId = i;\n break;\n }\n }\n\n if (newId === previousId) {\n logger[\"logger\"].warn(\"No fallback audio-track found for name/language: \\\"\" + name + \"\\\" / \\\"\" + language + \"\\\"\");\n return;\n }\n\n logger[\"logger\"].log('Attempting audio-track fallback id:', newId, 'group-id:', this.tracks[newId].groupId);\n\n this._setAudioTrack(newId);\n };\n\n audio_track_controller_createClass(AudioTrackController, [{\n key: \"audioTracks\",\n get: function get() {\n return this.tracks;\n }\n /**\n * @type {number} Index into audio-tracks list of currently selected track.\n */\n\n }, {\n key: \"audioTrack\",\n get: function get() {\n return this._trackId;\n }\n /**\n * Select current track by index\n */\n ,\n set: function set(newId) {\n this._setAudioTrack(newId); // If audio track is selected from API then don't choose from the manifest default track\n\n\n this._selectDefaultTrack = false;\n }\n }]);\n\n return AudioTrackController;\n}(TaskLoop);\n\n/* harmony default export */ var audio_track_controller = (audio_track_controller_AudioTrackController);\n// CONCATENATED MODULE: ./src/controller/audio-stream-controller.js\n\n\n\n\nfunction audio_stream_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction audio_stream_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) audio_stream_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) audio_stream_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction audio_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/*\n * Audio Stream Controller\n*/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar audio_stream_controller_window = window,\n audio_stream_controller_performance = audio_stream_controller_window.performance;\nvar audio_stream_controller_TICK_INTERVAL = 100; // how often to tick in ms\n\nvar audio_stream_controller_AudioStreamController = /*#__PURE__*/function (_BaseStreamController) {\n audio_stream_controller_inheritsLoose(AudioStreamController, _BaseStreamController);\n\n function AudioStreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].AUDIO_TRACKS_UPDATED, events[\"default\"].AUDIO_TRACK_SWITCHING, events[\"default\"].AUDIO_TRACK_LOADED, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].FRAG_PARSING_INIT_SEGMENT, events[\"default\"].FRAG_PARSING_DATA, events[\"default\"].FRAG_PARSED, events[\"default\"].ERROR, events[\"default\"].BUFFER_RESET, events[\"default\"].BUFFER_CREATED, events[\"default\"].BUFFER_APPENDED, events[\"default\"].BUFFER_FLUSHED, events[\"default\"].INIT_PTS_FOUND) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.audioCodecSwap = false;\n _this._state = State.STOPPED;\n _this.initPTS = [];\n _this.waitingFragment = null;\n _this.videoTrackCC = null;\n _this.waitingVideoCC = null;\n return _this;\n } // Signal that video PTS was found\n\n\n var _proto = AudioStreamController.prototype;\n\n _proto.onInitPtsFound = function onInitPtsFound(data) {\n var demuxerId = data.id,\n cc = data.frag.cc,\n initPTS = data.initPTS;\n\n if (demuxerId === 'main') {\n // Always update the new INIT PTS\n // Can change due level switch\n this.initPTS[cc] = initPTS;\n this.videoTrackCC = cc;\n logger[\"logger\"].log(\"InitPTS for cc: \" + cc + \" found from main: \" + initPTS); // If we are waiting we need to demux/remux the waiting frag\n // With the new initPTS\n\n if (this.state === State.WAITING_INIT_PTS) {\n this.tick();\n }\n }\n };\n\n _proto.startLoad = function startLoad(startPosition) {\n if (this.tracks) {\n var lastCurrentTime = this.lastCurrentTime;\n this.stopLoad();\n this.setInterval(audio_stream_controller_TICK_INTERVAL);\n this.fragLoadError = 0;\n\n if (lastCurrentTime > 0 && startPosition === -1) {\n logger[\"logger\"].log(\"audio:override startPosition with lastCurrentTime @\" + lastCurrentTime.toFixed(3));\n this.state = State.IDLE;\n } else {\n this.lastCurrentTime = this.startPosition ? this.startPosition : startPosition;\n this.state = State.STARTING;\n }\n\n this.nextLoadPosition = this.startPosition = this.lastCurrentTime;\n this.tick();\n } else {\n this.startPosition = startPosition;\n this.state = State.STOPPED;\n }\n };\n\n _proto.doTick = function doTick() {\n var pos,\n track,\n trackDetails,\n hls = this.hls,\n config = hls.config; // logger.log('audioStream:' + this.state);\n\n switch (this.state) {\n case State.ERROR: // don't do anything in error state to avoid breaking further ...\n\n case State.PAUSED: // don't do anything in paused state either ...\n\n case State.BUFFER_FLUSHING:\n break;\n\n case State.STARTING:\n this.state = State.WAITING_TRACK;\n this.loadedmetadata = false;\n break;\n\n case State.IDLE:\n var tracks = this.tracks; // audio tracks not received => exit loop\n\n if (!tracks) {\n break;\n } // if video not attached AND\n // start fragment already requested OR start frag prefetch disable\n // exit loop\n // => if media not attached but start frag prefetch is enabled and start frag not requested yet, we will not exit loop\n\n\n if (!this.media && (this.startFragRequested || !config.startFragPrefetch)) {\n break;\n } // determine next candidate fragment to be loaded, based on current position and\n // end of buffer position\n // if we have not yet loaded any fragment, start loading from start position\n\n\n if (this.loadedmetadata) {\n pos = this.media.currentTime;\n } else {\n pos = this.nextLoadPosition;\n\n if (pos === undefined) {\n break;\n }\n }\n\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n var videoBuffer = this.videoBuffer ? this.videoBuffer : this.media;\n var maxBufferHole = pos < config.maxBufferHole ? Math.max(MAX_START_GAP_JUMP, config.maxBufferHole) : config.maxBufferHole;\n var bufferInfo = BufferHelper.bufferInfo(media, pos, maxBufferHole);\n var mainBufferInfo = BufferHelper.bufferInfo(videoBuffer, pos, maxBufferHole);\n var bufferLen = bufferInfo.len;\n var bufferEnd = bufferInfo.end;\n var fragPrevious = this.fragPrevious; // ensure we buffer at least config.maxBufferLength (default 30s) or config.maxMaxBufferLength (default: 600s)\n // whichever is smaller.\n // once we reach that threshold, don't buffer more than video (mainBufferInfo.len)\n\n var maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength);\n var maxBufLen = Math.max(maxConfigBuffer, mainBufferInfo.len);\n var audioSwitch = this.audioSwitch;\n var trackId = this.trackId; // if buffer length is less than maxBufLen try to load a new fragment\n\n if ((bufferLen < maxBufLen || audioSwitch) && trackId < tracks.length) {\n trackDetails = tracks[trackId].details; // if track info not retrieved yet, switch state and wait for track retrieval\n\n if (typeof trackDetails === 'undefined') {\n this.state = State.WAITING_TRACK;\n break;\n }\n\n if (!audioSwitch && this._streamEnded(bufferInfo, trackDetails)) {\n this.hls.trigger(events[\"default\"].BUFFER_EOS, {\n type: 'audio'\n });\n this.state = State.ENDED;\n return;\n } // find fragment index, contiguous with end of buffer position\n\n\n var fragments = trackDetails.fragments,\n fragLen = fragments.length,\n start = fragments[0].start,\n end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration,\n frag; // When switching audio track, reload audio as close as possible to currentTime\n\n if (audioSwitch) {\n if (trackDetails.live && !trackDetails.PTSKnown) {\n logger[\"logger\"].log('switching audiotrack, live stream, unknown PTS,load first fragment');\n bufferEnd = 0;\n } else {\n bufferEnd = pos; // if currentTime (pos) is less than alt audio playlist start time, it means that alt audio is ahead of currentTime\n\n if (trackDetails.PTSKnown && pos < start) {\n // if everything is buffered from pos to start or if audio buffer upfront, let's seek to start\n if (bufferInfo.end > start || bufferInfo.nextStart) {\n logger[\"logger\"].log('alt audio track ahead of main track, seek to start of alt audio track');\n this.media.currentTime = start + 0.05;\n } else {\n return;\n }\n }\n }\n }\n\n if (trackDetails.initSegment && !trackDetails.initSegment.data) {\n frag = trackDetails.initSegment;\n } // eslint-disable-line brace-style\n // if bufferEnd before start of playlist, load first fragment\n else if (bufferEnd <= start) {\n frag = fragments[0];\n\n if (this.videoTrackCC !== null && frag.cc !== this.videoTrackCC) {\n // Ensure we find a fragment which matches the continuity of the video track\n frag = findFragWithCC(fragments, this.videoTrackCC);\n }\n\n if (trackDetails.live && frag.loadIdx && frag.loadIdx === this.fragLoadIdx) {\n // we just loaded this first fragment, and we are still lagging behind the start of the live playlist\n // let's force seek to start\n var nextBuffered = bufferInfo.nextStart ? bufferInfo.nextStart : start;\n logger[\"logger\"].log(\"no alt audio available @currentTime:\" + this.media.currentTime + \", seeking @\" + (nextBuffered + 0.05));\n this.media.currentTime = nextBuffered + 0.05;\n return;\n }\n } else {\n var foundFrag;\n var maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var fragNext = fragPrevious ? fragments[fragPrevious.sn - fragments[0].sn + 1] : undefined;\n\n if (bufferEnd < end) {\n if (bufferEnd > end - maxFragLookUpTolerance) {\n maxFragLookUpTolerance = 0;\n } // Prefer the next fragment if it's within tolerance\n\n\n if (fragNext && !fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, fragNext)) {\n foundFrag = fragNext;\n } else {\n foundFrag = binary_search.search(fragments, function (frag) {\n return fragmentWithinToleranceTest(bufferEnd, maxFragLookUpTolerance, frag);\n });\n }\n } else {\n // reach end of playlist\n foundFrag = fragments[fragLen - 1];\n }\n\n if (foundFrag) {\n frag = foundFrag;\n start = foundFrag.start; // logger.log('find SN matching with pos:' + bufferEnd + ':' + frag.sn);\n\n if (fragPrevious && frag.level === fragPrevious.level && frag.sn === fragPrevious.sn) {\n if (frag.sn < trackDetails.endSN) {\n frag = fragments[frag.sn + 1 - trackDetails.startSN];\n\n if (this.fragmentTracker.getState(frag) !== FragmentState.OK) {\n logger[\"logger\"].log(\"SN just loaded, load next one: \" + frag.sn);\n }\n } else {\n frag = null;\n }\n }\n }\n }\n\n if (frag) {\n // logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));\n if (frag.encrypted) {\n logger[\"logger\"].log(\"Loading key for \" + frag.sn + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId);\n this.state = State.KEY_LOADING;\n hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: frag\n });\n } else {\n // only load if fragment is not loaded or if in audio switch\n // we force a frag loading in audio switch as fragment tracker might not have evicted previous frags in case of quick audio switch\n this.fragCurrent = frag;\n\n if (audioSwitch || this.fragmentTracker.getState(frag) === FragmentState.NOT_LOADED) {\n logger[\"logger\"].log(\"Loading \" + frag.sn + \", cc: \" + frag.cc + \" of [\" + trackDetails.startSN + \" ,\" + trackDetails.endSN + \"],track \" + trackId + \", \" + (this.loadedmetadata ? 'currentTime' : 'nextLoadPosition') + \": \" + pos + \", bufferEnd: \" + bufferEnd.toFixed(3));\n\n if (frag.sn !== 'initSegment') {\n this.startFragRequested = true;\n }\n\n if (Object(number[\"isFiniteNumber\"])(frag.sn)) {\n this.nextLoadPosition = frag.start + frag.duration;\n }\n\n hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: frag\n });\n this.state = State.FRAG_LOADING;\n }\n }\n }\n }\n\n break;\n\n case State.WAITING_TRACK:\n track = this.tracks[this.trackId]; // check if playlist is already loaded\n\n if (track && track.details) {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.FRAG_LOADING_WAITING_RETRY:\n var now = audio_stream_controller_performance.now();\n var retryDate = this.retryDate;\n media = this.media;\n var isSeeking = media && media.seeking; // if current time is gt than retryDate, or if media seeking let's switch to IDLE state to retry loading\n\n if (!retryDate || now >= retryDate || isSeeking) {\n logger[\"logger\"].log('audioStreamController: retryDate reached, switch back to IDLE state');\n this.state = State.IDLE;\n }\n\n break;\n\n case State.WAITING_INIT_PTS:\n // Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS\n var waitingFrag = this.waitingFragment;\n\n if (waitingFrag) {\n var waitingFragCC = waitingFrag.frag.cc;\n\n if (this.initPTS[waitingFragCC] !== undefined) {\n this.waitingFragment = null;\n this.state = State.FRAG_LOADING;\n this.onFragLoaded(waitingFrag);\n } else if (this.videoTrackCC !== this.waitingVideoCC) {\n // Drop waiting fragment if videoTrackCC has changed since waitingFragment was set and initPTS was not found\n logger[\"logger\"].log(\"Waiting fragment cc (\" + waitingFragCC + \") cancelled because video is at cc \" + this.videoTrackCC);\n this.clearWaitingFragment();\n } else {\n // Drop waiting fragment if an earlier fragment is needed\n var _bufferInfo = BufferHelper.bufferInfo(this.mediaBuffer, this.media.currentTime, config.maxBufferHole);\n\n var waitingFragmentAtPosition = fragmentWithinToleranceTest(_bufferInfo.end, config.maxFragLookUpTolerance, waitingFrag.frag);\n\n if (waitingFragmentAtPosition < 0) {\n logger[\"logger\"].log(\"Waiting fragment cc (\" + waitingFragCC + \") @ \" + waitingFrag.frag.start + \" cancelled because another fragment at \" + _bufferInfo.end + \" is needed\");\n this.clearWaitingFragment();\n }\n }\n } else {\n this.state = State.IDLE;\n }\n\n break;\n\n case State.STOPPED:\n case State.FRAG_LOADING:\n case State.PARSING:\n case State.PARSED:\n case State.ENDED:\n break;\n\n default:\n break;\n }\n };\n\n _proto.clearWaitingFragment = function clearWaitingFragment() {\n var waitingFrag = this.waitingFragment;\n\n if (waitingFrag) {\n this.fragmentTracker.removeFragment(waitingFrag.frag);\n this.waitingFragment = null;\n this.waitingVideoCC = null;\n this.state = State.IDLE;\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(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\n if (this.tracks && config.autoStartLoad) {\n this.startLoad(config.startPosition);\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var media = this.media;\n\n if (media && media.ended) {\n logger[\"logger\"].log('MSE detaching and video ended, reset startPosition');\n this.startPosition = this.lastCurrentTime = 0;\n } // remove video listeners\n\n\n if (media) {\n media.removeEventListener('seeking', this.onvseeking);\n media.removeEventListener('ended', this.onvended);\n this.onvseeking = this.onvseeked = this.onvended = null;\n }\n\n this.media = this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n this.fragmentTracker.removeAllFragments();\n this.stopLoad();\n };\n\n _proto.onAudioTracksUpdated = function onAudioTracksUpdated(data) {\n logger[\"logger\"].log('audio tracks updated');\n this.tracks = data.audioTracks;\n };\n\n _proto.onAudioTrackSwitching = function onAudioTrackSwitching(data) {\n // if any URL found on new audio track, it is an alternate audio track\n var altAudio = !!data.url;\n this.trackId = data.id;\n this.fragCurrent = null;\n this.clearWaitingFragment();\n this.state = State.PAUSED; // destroy useless demuxer when switching audio to main\n\n if (!altAudio) {\n if (this.demuxer) {\n this.demuxer.destroy();\n this.demuxer = null;\n }\n } else {\n // switching to audio track, start timer if not already started\n this.setInterval(audio_stream_controller_TICK_INTERVAL);\n } // should we switch tracks ?\n\n\n if (altAudio) {\n this.audioSwitch = true; // main audio track are handled by stream-controller, just do something if switching to alt audio track\n\n this.state = State.IDLE;\n }\n\n this.tick();\n };\n\n _proto.onAudioTrackLoaded = function onAudioTrackLoaded(data) {\n var newDetails = data.details,\n trackId = data.id,\n track = this.tracks[trackId],\n curDetails = track.details,\n duration = newDetails.totalduration,\n sliding = 0;\n logger[\"logger\"].log(\"track \" + trackId + \" loaded [\" + newDetails.startSN + \",\" + newDetails.endSN + \"],duration:\" + duration);\n\n if (newDetails.live || curDetails && curDetails.live) {\n if (curDetails && newDetails.fragments.length > 0) {\n // we already have details for that level, merge them\n mergeDetails(curDetails, newDetails);\n sliding = newDetails.fragments[0].start; // TODO\n // this.liveSyncPosition = this.computeLivePosition(sliding, curDetails);\n\n if (newDetails.PTSKnown) {\n logger[\"logger\"].log(\"live audio playlist sliding:\" + sliding.toFixed(3));\n } else {\n logger[\"logger\"].log('live audio playlist - outdated PTS, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n logger[\"logger\"].log('live audio playlist - first load, unknown sliding');\n }\n } else {\n newDetails.PTSKnown = false;\n }\n\n track.details = newDetails; // compute start position\n\n if (!this.startFragRequested) {\n // compute start position if set to -1. use it straight away if value is defined\n if (this.startPosition === -1) {\n // first, check if start time offset has been set in playlist, if yes, use this value\n var startTimeOffset = newDetails.startTimeOffset;\n\n if (Object(number[\"isFiniteNumber\"])(startTimeOffset)) {\n logger[\"logger\"].log(\"start time offset found in playlist, adjust startPosition to \" + startTimeOffset);\n this.startPosition = startTimeOffset;\n } else {\n if (newDetails.live) {\n this.startPosition = this.computeLivePosition(sliding, newDetails);\n logger[\"logger\"].log(\"compute startPosition for audio-track to \" + this.startPosition);\n } else {\n this.startPosition = 0;\n }\n }\n }\n\n this.nextLoadPosition = this.startPosition;\n } // only switch batck to IDLE state if we were waiting for track to start downloading a new fragment\n\n\n if (this.state === State.WAITING_TRACK) {\n this.state = State.IDLE;\n } // trigger handler right now\n\n\n this.tick();\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n this.tick();\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent,\n fragLoaded = data.frag;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && fragLoaded.type === 'audio' && fragLoaded.level === fragCurrent.level && fragLoaded.sn === fragCurrent.sn) {\n var track = this.tracks[this.trackId],\n details = track.details,\n duration = details.totalduration,\n trackId = fragCurrent.level,\n sn = fragCurrent.sn,\n cc = fragCurrent.cc,\n audioCodec = this.config.defaultAudioCodec || track.audioCodec || 'mp4a.40.2',\n stats = this.stats = data.stats;\n\n if (sn === 'initSegment') {\n this.state = State.IDLE;\n stats.tparsed = stats.tbuffered = audio_stream_controller_performance.now();\n details.initSegment.data = data.payload;\n this.hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: fragCurrent,\n id: 'audio'\n });\n this.tick();\n } else {\n this.state = State.PARSING; // transmux the MPEG-TS data to ISO-BMFF segments\n\n this.appended = false;\n\n if (!this.demuxer) {\n this.demuxer = new demux_demuxer(this.hls, 'audio');\n } // Check if we have video initPTS\n // If not we need to wait for it\n\n\n var initPTS = this.initPTS[cc];\n var initSegmentData = details.initSegment ? details.initSegment.data : [];\n\n if (initPTS !== undefined) {\n this.pendingBuffering = true;\n logger[\"logger\"].log(\"Demuxing \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId); // time Offset is accurate if level PTS is known, or if playlist is not sliding (not live)\n\n var accurateTimeOffset = false; // details.PTSKnown || !details.live;\n\n this.demuxer.push(data.payload, initSegmentData, audioCodec, null, fragCurrent, duration, accurateTimeOffset, initPTS);\n } else {\n logger[\"logger\"].log(\"Unknown video PTS for cc \" + cc + \", waiting for video PTS before demuxing audio frag \" + sn + \" of [\" + details.startSN + \" ,\" + details.endSN + \"],track \" + trackId);\n this.waitingFragment = data;\n this.waitingVideoCC = this.videoTrackCC;\n this.state = State.WAITING_INIT_PTS;\n }\n }\n }\n\n this.fragLoadError = 0;\n };\n\n _proto.onFragParsingInitSegment = function onFragParsingInitSegment(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var tracks = data.tracks,\n track; // delete any video track found on audio demuxer\n\n if (tracks.video) {\n delete tracks.video;\n } // include levelCodec in audio and video tracks\n\n\n track = tracks.audio;\n\n if (track) {\n track.levelCodec = track.codec;\n track.id = data.id;\n this.hls.trigger(events[\"default\"].BUFFER_CODECS, tracks);\n logger[\"logger\"].log(\"audio track:audio,container:\" + track.container + \",codecs[level/parsed]=[\" + track.levelCodec + \"/\" + track.codec + \"]\");\n var initSegment = track.initSegment;\n\n if (initSegment) {\n var appendObj = {\n type: 'audio',\n data: initSegment,\n parent: 'audio',\n content: 'initSegment'\n };\n\n if (this.audioSwitch) {\n this.pendingData = [appendObj];\n } else {\n this.appended = true; // arm pending Buffering flag before appending a segment\n\n this.pendingBuffering = true;\n this.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n }\n };\n\n _proto.onFragParsingData = function onFragParsingData(data) {\n var _this2 = this;\n\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && data.type === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n var trackId = this.trackId,\n track = this.tracks[trackId],\n hls = this.hls;\n\n if (!Object(number[\"isFiniteNumber\"])(data.endPTS)) {\n data.endPTS = data.startPTS + fragCurrent.duration;\n data.endDTS = data.startDTS + fragCurrent.duration;\n }\n\n fragCurrent.addElementaryStream(ElementaryStreamTypes.AUDIO);\n logger[\"logger\"].log(\"parsed \" + data.type + \",PTS:[\" + data.startPTS.toFixed(3) + \",\" + data.endPTS.toFixed(3) + \"],DTS:[\" + data.startDTS.toFixed(3) + \"/\" + data.endDTS.toFixed(3) + \"],nb:\" + data.nb);\n updateFragPTSDTS(track.details, fragCurrent, data.startPTS, data.endPTS);\n var media = this.media;\n var appendOnBufferFlush = false; // Only flush audio from old audio tracks when PTS is known on new audio track\n\n if (this.audioSwitch) {\n if (media && media.readyState) {\n var currentTime = media.currentTime;\n logger[\"logger\"].log('switching audio track : currentTime:' + currentTime);\n\n if (currentTime >= data.startPTS) {\n logger[\"logger\"].log('switching audio track : flushing all audio');\n this.state = State.BUFFER_FLUSHING;\n hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n appendOnBufferFlush = true; // Lets announce that the initial audio track switch flush occur\n\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n } else {\n // Lets announce that the initial audio track switch flush occur\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: trackId\n });\n }\n }\n\n var pendingData = this.pendingData;\n\n if (!pendingData) {\n logger[\"logger\"].warn('Apparently attempt to enqueue media payload without codec initialization data upfront');\n hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].MEDIA_ERROR,\n details: null,\n fatal: true\n });\n return;\n }\n\n if (!this.audioSwitch) {\n [data.data1, data.data2].forEach(function (buffer) {\n if (buffer && buffer.length) {\n pendingData.push({\n type: data.type,\n data: buffer,\n parent: 'audio',\n content: 'data'\n });\n }\n });\n\n if (!appendOnBufferFlush && pendingData.length) {\n pendingData.forEach(function (appendObj) {\n // only append in PARSING state (rationale is that an appending error could happen synchronously on first segment appending)\n // in that case it is useless to append following segments\n if (_this2.state === State.PARSING) {\n // arm pending Buffering flag before appending a segment\n _this2.pendingBuffering = true;\n\n _this2.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n }\n });\n this.pendingData = [];\n this.appended = true;\n }\n } // trigger handler right now\n\n\n this.tick();\n }\n };\n\n _proto.onFragParsed = function onFragParsed(data) {\n var fragCurrent = this.fragCurrent;\n var fragNew = data.frag;\n\n if (fragCurrent && data.id === 'audio' && fragNew.sn === fragCurrent.sn && fragNew.level === fragCurrent.level && this.state === State.PARSING) {\n this.stats.tparsed = audio_stream_controller_performance.now();\n this.state = State.PARSED;\n\n this._checkAppendedParsed();\n }\n };\n\n _proto.onBufferReset = function onBufferReset() {\n // reset reference to sourcebuffers\n this.mediaBuffer = this.videoBuffer = null;\n this.loadedmetadata = false;\n };\n\n _proto.onBufferCreated = function onBufferCreated(data) {\n var audioTrack = data.tracks.audio;\n\n if (audioTrack) {\n this.mediaBuffer = audioTrack.buffer;\n this.loadedmetadata = true;\n }\n\n if (data.tracks.video) {\n this.videoBuffer = data.tracks.video.buffer;\n }\n };\n\n _proto.onBufferAppended = function onBufferAppended(data) {\n if (data.parent === 'audio') {\n var state = this.state;\n\n if (state === State.PARSING || state === State.PARSED) {\n // check if all buffers have been appended\n this.pendingBuffering = data.pending > 0;\n\n this._checkAppendedParsed();\n }\n }\n };\n\n _proto._checkAppendedParsed = function _checkAppendedParsed() {\n // trigger handler right now\n if (this.state === State.PARSED && (!this.appended || !this.pendingBuffering)) {\n var frag = this.fragCurrent,\n stats = this.stats,\n hls = this.hls;\n\n if (frag) {\n this.fragPrevious = frag;\n stats.tbuffered = audio_stream_controller_performance.now();\n hls.trigger(events[\"default\"].FRAG_BUFFERED, {\n stats: stats,\n frag: frag,\n id: 'audio'\n });\n var media = this.mediaBuffer ? this.mediaBuffer : this.media;\n\n if (media) {\n logger[\"logger\"].log(\"audio buffered : \" + time_ranges.toString(media.buffered));\n }\n\n if (this.audioSwitch && this.appended) {\n this.audioSwitch = false;\n hls.trigger(events[\"default\"].AUDIO_TRACK_SWITCHED, {\n id: this.trackId\n });\n }\n\n this.state = State.IDLE;\n }\n\n this.tick();\n }\n };\n\n _proto.onError = function onError(data) {\n var frag = data.frag; // don't handle frag error not related to audio fragment\n\n if (frag && frag.type !== 'audio') {\n return;\n }\n\n switch (data.details) {\n case errors[\"ErrorDetails\"].FRAG_LOAD_ERROR:\n case errors[\"ErrorDetails\"].FRAG_LOAD_TIMEOUT:\n var _frag = data.frag; // don't handle frag error not related to audio fragment\n\n if (_frag && _frag.type !== 'audio') {\n break;\n }\n\n if (!data.fatal) {\n var loadError = this.fragLoadError;\n\n if (loadError) {\n loadError++;\n } else {\n loadError = 1;\n }\n\n var config = this.config;\n\n if (loadError <= config.fragLoadingMaxRetry) {\n this.fragLoadError = loadError; // exponential backoff capped to config.fragLoadingMaxRetryTimeout\n\n var delay = Math.min(Math.pow(2, loadError - 1) * config.fragLoadingRetryDelay, config.fragLoadingMaxRetryTimeout);\n logger[\"logger\"].warn(\"AudioStreamController: frag loading failed, retry in \" + delay + \" ms\");\n this.retryDate = audio_stream_controller_performance.now() + delay; // retry loading state\n\n this.state = State.FRAG_LOADING_WAITING_RETRY;\n } else {\n logger[\"logger\"].error(\"AudioStreamController: \" + data.details + \" reaches max retry, redispatch as fatal ...\"); // switch error to fatal\n\n data.fatal = true;\n this.state = State.ERROR;\n }\n }\n\n break;\n\n case errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_ERROR:\n case errors[\"ErrorDetails\"].AUDIO_TRACK_LOAD_TIMEOUT:\n case errors[\"ErrorDetails\"].KEY_LOAD_ERROR:\n case errors[\"ErrorDetails\"].KEY_LOAD_TIMEOUT:\n // when in ERROR state, don't switch back to IDLE state in case a non-fatal error is received\n if (this.state !== State.ERROR) {\n // if fatal error, stop processing, otherwise move to IDLE to retry loading\n this.state = data.fatal ? State.ERROR : State.IDLE;\n logger[\"logger\"].warn(\"AudioStreamController: \" + data.details + \" while loading frag, now switching to \" + this.state + \" state ...\");\n }\n\n break;\n\n case errors[\"ErrorDetails\"].BUFFER_FULL_ERROR:\n // if in appending state\n if (data.parent === 'audio' && (this.state === State.PARSING || this.state === State.PARSED)) {\n var media = this.mediaBuffer,\n currentTime = this.media.currentTime,\n mediaBuffered = media && BufferHelper.isBuffered(media, currentTime) && BufferHelper.isBuffered(media, currentTime + 0.5); // reduce max buf len if current position is buffered\n\n if (mediaBuffered) {\n var _config = this.config;\n\n if (_config.maxMaxBufferLength >= _config.maxBufferLength) {\n // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...\n _config.maxMaxBufferLength /= 2;\n logger[\"logger\"].warn(\"AudioStreamController: reduce max buffer length to \" + _config.maxMaxBufferLength + \"s\");\n }\n\n this.state = State.IDLE;\n } else {\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 logger[\"logger\"].warn('AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer');\n this.fragCurrent = null; // flush everything\n\n this.state = State.BUFFER_FLUSHING;\n this.hls.trigger(events[\"default\"].BUFFER_FLUSHING, {\n startOffset: 0,\n endOffset: Number.POSITIVE_INFINITY,\n type: 'audio'\n });\n }\n }\n\n break;\n\n default:\n break;\n }\n };\n\n _proto.onBufferFlushed = function onBufferFlushed() {\n var _this3 = this;\n\n var pendingData = this.pendingData;\n\n if (pendingData && pendingData.length) {\n logger[\"logger\"].log('AudioStreamController: appending pending audio data after buffer flushed');\n pendingData.forEach(function (appendObj) {\n _this3.hls.trigger(events[\"default\"].BUFFER_APPENDING, appendObj);\n });\n this.appended = true;\n this.pendingData = [];\n this.state = State.PARSED;\n } else {\n // move to IDLE once flush complete. this should trigger new fragment loading\n this.state = State.IDLE; // reset reference to frag\n\n this.fragPrevious = null;\n this.tick();\n }\n };\n\n audio_stream_controller_createClass(AudioStreamController, [{\n key: \"state\",\n set: function set(nextState) {\n if (this.state !== nextState) {\n var previousState = this.state;\n this._state = nextState;\n logger[\"logger\"].log(\"audio stream:\" + previousState + \"->\" + nextState);\n }\n },\n get: function get() {\n return this._state;\n }\n }]);\n\n return AudioStreamController;\n}(base_stream_controller_BaseStreamController);\n\n/* harmony default export */ var audio_stream_controller = (audio_stream_controller_AudioStreamController);\n// CONCATENATED MODULE: ./src/utils/vttcue.js\n/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* harmony default export */ var vttcue = ((function () {\n if (typeof window !== 'undefined' && window.VTTCue) {\n return window.VTTCue;\n }\n\n var autoKeyword = 'auto';\n var directionSetting = {\n '': true,\n lr: true,\n rl: true\n };\n var alignSetting = {\n start: true,\n middle: true,\n end: true,\n left: true,\n right: true\n };\n\n function findDirectionSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n }\n\n function findAlignSetting(value) {\n if (typeof value !== 'string') {\n return false;\n }\n\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n }\n\n function extend(obj) {\n var i = 1;\n\n for (; i < arguments.length; i++) {\n var cobj = arguments[i];\n\n for (var p in cobj) {\n obj[p] = cobj[p];\n }\n }\n\n return obj;\n }\n\n function VTTCue(startTime, endTime, text) {\n var cue = this;\n var baseObj = {};\n baseObj.enumerable = true;\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n\n cue.hasBeenReset = false;\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = '';\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = '';\n var _snapToLines = true;\n var _line = 'auto';\n var _lineAlign = 'start';\n var _position = 50;\n var _positionAlign = 'middle';\n var _size = 50;\n var _align = 'middle';\n Object.defineProperty(cue, 'id', extend({}, baseObj, {\n get: function get() {\n return _id;\n },\n set: function set(value) {\n _id = '' + value;\n }\n }));\n Object.defineProperty(cue, 'pauseOnExit', extend({}, baseObj, {\n get: function get() {\n return _pauseOnExit;\n },\n set: function set(value) {\n _pauseOnExit = !!value;\n }\n }));\n Object.defineProperty(cue, 'startTime', extend({}, baseObj, {\n get: function get() {\n return _startTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('Start time must be set to a number.');\n }\n\n _startTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'endTime', extend({}, baseObj, {\n get: function get() {\n return _endTime;\n },\n set: function set(value) {\n if (typeof value !== 'number') {\n throw new TypeError('End time must be set to a number.');\n }\n\n _endTime = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'text', extend({}, baseObj, {\n get: function get() {\n return _text;\n },\n set: function set(value) {\n _text = '' + value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'region', extend({}, baseObj, {\n get: function get() {\n return _region;\n },\n set: function set(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'vertical', extend({}, baseObj, {\n get: function get() {\n return _vertical;\n },\n set: function set(value) {\n var setting = findDirectionSetting(value); // Have to check for false because the setting an be an empty string.\n\n if (setting === false) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _vertical = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'snapToLines', extend({}, baseObj, {\n get: function get() {\n return _snapToLines;\n },\n set: function set(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'line', extend({}, baseObj, {\n get: function get() {\n return _line;\n },\n set: function set(value) {\n if (typeof value !== 'number' && value !== autoKeyword) {\n throw new SyntaxError('An invalid number or illegal string was specified.');\n }\n\n _line = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'lineAlign', extend({}, baseObj, {\n get: function get() {\n return _lineAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'position', extend({}, baseObj, {\n get: function get() {\n return _position;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Position must be between 0 and 100.');\n }\n\n _position = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'positionAlign', extend({}, baseObj, {\n get: function get() {\n return _positionAlign;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'size', extend({}, baseObj, {\n get: function get() {\n return _size;\n },\n set: function set(value) {\n if (value < 0 || value > 100) {\n throw new Error('Size must be between 0 and 100.');\n }\n\n _size = value;\n this.hasBeenReset = true;\n }\n }));\n Object.defineProperty(cue, 'align', extend({}, baseObj, {\n get: function get() {\n return _align;\n },\n set: function set(value) {\n var setting = findAlignSetting(value);\n\n if (!setting) {\n throw new SyntaxError('An invalid or illegal string was specified.');\n }\n\n _align = setting;\n this.hasBeenReset = true;\n }\n }));\n /**\n * Other <track> spec defined properties\n */\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n\n cue.displayState = void 0;\n }\n /**\n * VTTCue methods\n */\n\n\n VTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n var WebVTT = window.WebVTT;\n return WebVTT.convertCueToDOMTree(window, this.text);\n };\n\n return VTTCue;\n})());\n// CONCATENATED MODULE: ./src/utils/vttparser.js\n/*\n * Source: https://github.com/mozilla/vtt.js/blob/master/dist/vtt.js#L1716\n */\n\n\nvar StringDecoder = function StringDecoder() {\n return {\n decode: function decode(data) {\n if (!data) {\n return '';\n }\n\n if (typeof data !== 'string') {\n throw new Error('Error - expected string data.');\n }\n\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nfunction VTTParser() {\n this.window = window;\n this.state = 'INITIAL';\n this.buffer = '';\n this.decoder = new StringDecoder();\n this.regionList = [];\n} // Try to parse input as a time stamp.\n\n\nfunction parseTimeStamp(input) {\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{2})(:\\d{2})?\\.(\\d{3})/);\n\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(':', ''), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n} // A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\n\n\nfunction Settings() {\n this.values = Object.create(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function set(k, v) {\n if (!this.get(k) && v !== '') {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function get(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function has(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function alt(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function integer(k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function percent(k, v) {\n var m;\n\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n\n return false;\n }\n}; // Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\n\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n\n for (var i in groups) {\n if (typeof groups[i] !== 'string') {\n continue;\n }\n\n var kv = groups[i].split(keyValueDelim);\n\n if (kv.length !== 2) {\n continue;\n }\n\n var k = kv[0];\n var v = kv[1];\n callback(k, v);\n }\n}\n\nvar defaults = new vttcue(0, 0, 0); // 'middle' was changed to 'center' in the spec: https://github.com/w3c/webvtt/pull/244\n// Safari doesn't yet support this change, but FF and Chrome do.\n\nvar center = defaults.align === 'middle' ? 'middle' : 'center';\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input; // 4.1 WebVTT timestamp\n\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n\n if (ts === null) {\n throw new Error('Malformed timestamp: ' + oInput);\n } // Remove time stamp from input.\n\n\n input = input.replace(/^[^\\sa-zA-Z-]+/, '');\n return ts;\n } // 4.4.2 WebVTT cue settings\n\n\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'region':\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n\n break;\n\n case 'vertical':\n settings.alt(k, v, ['rl', 'lr']);\n break;\n\n case 'line':\n var vals = v.split(','),\n vals0 = vals[0];\n settings.integer(k, vals0);\n\n if (settings.percent(k, vals0)) {\n settings.set('snapToLines', false);\n }\n\n settings.alt(k, vals0, ['auto']);\n\n if (vals.length === 2) {\n settings.alt('lineAlign', vals[1], ['start', center, 'end']);\n }\n\n break;\n\n case 'position':\n vals = v.split(',');\n settings.percent(k, vals[0]);\n\n if (vals.length === 2) {\n settings.alt('positionAlign', vals[1], ['start', center, 'end', 'line-left', 'line-right', 'auto']);\n }\n\n break;\n\n case 'size':\n settings.percent(k, v);\n break;\n\n case 'align':\n settings.alt(k, v, ['start', center, 'end', 'left', 'right']);\n break;\n }\n }, /:/, /\\s/); // Apply default values for any missing fields.\n\n cue.region = settings.get('region', null);\n cue.vertical = settings.get('vertical', '');\n var line = settings.get('line', 'auto');\n\n if (line === 'auto' && defaults.line === -1) {\n // set numeric line number for Safari\n line = -1;\n }\n\n cue.line = line;\n cue.lineAlign = settings.get('lineAlign', 'start');\n cue.snapToLines = settings.get('snapToLines', true);\n cue.size = settings.get('size', 100);\n cue.align = settings.get('align', center);\n var position = settings.get('position', 'auto');\n\n if (position === 'auto' && defaults.position === 50) {\n // set numeric position for Safari\n position = cue.align === 'start' || cue.align === 'left' ? 0 : cue.align === 'end' || cue.align === 'right' ? 100 : 50;\n }\n\n cue.position = position;\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, '');\n } // 4.1 WebVTT cue timings.\n\n\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n\n skipWhitespace();\n\n if (input.substr(0, 3) !== '-->') {\n // (3) next characters must match '-->'\n throw new Error('Malformed time stamp (time stamps must be separated by \\'-->\\'): ' + oInput);\n }\n\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n // 4.1 WebVTT cue settings list.\n\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\nfunction fixLineBreaks(input) {\n return input.replace(/<br(?: \\/)?>/gi, '\\n');\n}\n\nVTTParser.prototype = {\n parse: function parse(data) {\n var self = this; // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {\n stream: true\n });\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n buffer = fixLineBreaks(buffer);\n\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n\n var line = buffer.substr(0, pos); // Advance the buffer early in case we fail below.\n\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n\n self.buffer = buffer.substr(pos);\n return line;\n } // 3.2 WebVTT metadata header syntax\n\n\n function parseHeader(input) {\n parseOptions(input, function (k, v) {\n switch (k) {\n case 'Region':\n // 3.3 WebVTT region metadata header syntax\n // console.log('parse region', v);\n // parseRegion(v);\n break;\n }\n }, /:/);\n } // 5.1 WebVTT file parsing.\n\n\n try {\n var line;\n\n if (self.state === 'INITIAL') {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine(); // strip of UTF-8 BOM if any\n // https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n\n var m = line.match(/^()?WEBVTT([ \\t].*)?$/);\n\n if (!m || !m[0]) {\n throw new Error('Malformed WebVTT signature.');\n }\n\n self.state = 'HEADER';\n }\n\n var alreadyCollectedLine = false;\n\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case 'HEADER':\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = 'ID';\n }\n\n continue;\n\n case 'NOTE':\n // Ignore NOTE blocks.\n if (!line) {\n self.state = 'ID';\n }\n\n continue;\n\n case 'ID':\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = 'NOTE';\n break;\n } // 19-29 - Allow any number of line terminators, then initialize new cue values.\n\n\n if (!line) {\n continue;\n }\n\n self.cue = new vttcue(0, 0, '');\n self.state = 'CUE'; // 30-39 - Check if self line contains an optional identifier or timing data.\n\n if (line.indexOf('-->') === -1) {\n self.cue.id = line;\n continue;\n }\n\n // Process line as start of a cue.\n\n /* falls through */\n\n case 'CUE':\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = 'BADCUE';\n continue;\n }\n\n self.state = 'CUETEXT';\n continue;\n\n case 'CUETEXT':\n var hasSubstring = line.indexOf('-->') !== -1; // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n if (self.oncue) {\n self.oncue(self.cue);\n }\n\n self.cue = null;\n self.state = 'ID';\n continue;\n }\n\n if (self.cue.text) {\n self.cue.text += '\\n';\n }\n\n self.cue.text += line;\n continue;\n\n case 'BADCUE':\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = 'ID';\n }\n\n continue;\n }\n }\n } catch (e) {\n // If we are currently parsing a cue, report what we have.\n if (self.state === 'CUETEXT' && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n\n self.cue = null; // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n\n self.state = self.state === 'INITIAL' ? 'BADWEBVTT' : 'BADCUE';\n }\n\n return this;\n },\n flush: function flush() {\n var self = this;\n\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode(); // Synthesize the end of the current cue or region.\n\n if (self.cue || self.state === 'HEADER') {\n self.buffer += '\\n\\n';\n self.parse();\n } // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n\n\n if (self.state === 'INITIAL') {\n throw new Error('Malformed WebVTT signature.');\n }\n } catch (e) {\n throw e;\n }\n\n if (self.onflush) {\n self.onflush();\n }\n\n return this;\n }\n};\n\n/* harmony default export */ var vttparser = (VTTParser);\n// CONCATENATED MODULE: ./src/utils/cues.ts\n\nfunction newCue(track, startTime, endTime, captionScreen) {\n var result = [];\n var row; // the type data states this is VTTCue, but it can potentially be a TextTrackCue on old browsers\n\n var cue;\n var indenting;\n var indent;\n var text;\n var VTTCue = window.VTTCue || TextTrackCue;\n\n for (var r = 0; r < captionScreen.rows.length; r++) {\n row = captionScreen.rows[r];\n indenting = true;\n indent = 0;\n text = '';\n\n if (!row.isEmpty()) {\n for (var c = 0; c < row.chars.length; c++) {\n if (row.chars[c].uchar.match(/\\s/) && indenting) {\n indent++;\n } else {\n text += row.chars[c].uchar;\n indenting = false;\n }\n } // To be used for cleaning-up orphaned roll-up captions\n\n\n row.cueStartTime = startTime; // Give a slight bump to the endTime if it's equal to startTime to avoid a SyntaxError in IE\n\n if (startTime === endTime) {\n endTime += 0.0001;\n }\n\n cue = new VTTCue(startTime, endTime, fixLineBreaks(text.trim()));\n\n if (indent >= 16) {\n indent--;\n } else {\n indent++;\n } // VTTCue.line get's flakey when using controls, so let's now include line 13&14\n // also, drop line 1 since it's to close to the top\n\n\n if (navigator.userAgent.match(/Firefox\\//)) {\n cue.line = r + 1;\n } else {\n cue.line = r > 7 ? r - 2 : r + 1;\n }\n\n cue.align = 'left'; // Clamp the position between 0 and 100 - if out of these bounds, Firefox throws an exception and captions break\n\n cue.position = Math.max(0, Math.min(100, 100 * (indent / 32)));\n result.push(cue);\n\n if (track) {\n track.addCue(cue);\n }\n }\n }\n\n return result;\n}\n// CONCATENATED MODULE: ./src/utils/cea-608-parser.ts\n\n/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\n\nvar specialCea608CharsCodes = {\n 0x2a: 0xe1,\n // lowercase a, acute accent\n 0x5c: 0xe9,\n // lowercase e, acute accent\n 0x5e: 0xed,\n // lowercase i, acute accent\n 0x5f: 0xf3,\n // lowercase o, acute accent\n 0x60: 0xfa,\n // lowercase u, acute accent\n 0x7b: 0xe7,\n // lowercase c with cedilla\n 0x7c: 0xf7,\n // division symbol\n 0x7d: 0xd1,\n // uppercase N tilde\n 0x7e: 0xf1,\n // lowercase n tilde\n 0x7f: 0x2588,\n // Full block\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae,\n // Registered symbol (R)\n 0x81: 0xb0,\n // degree sign\n 0x82: 0xbd,\n // 1/2 symbol\n 0x83: 0xbf,\n // Inverted (open) question mark\n 0x84: 0x2122,\n // Trademark symbol (TM)\n 0x85: 0xa2,\n // Cents symbol\n 0x86: 0xa3,\n // Pounds sterling\n 0x87: 0x266a,\n // Music 8'th note\n 0x88: 0xe0,\n // lowercase a, grave accent\n 0x89: 0x20,\n // transparent space (regular)\n 0x8a: 0xe8,\n // lowercase e, grave accent\n 0x8b: 0xe2,\n // lowercase a, circumflex accent\n 0x8c: 0xea,\n // lowercase e, circumflex accent\n 0x8d: 0xee,\n // lowercase i, circumflex accent\n 0x8e: 0xf4,\n // lowercase o, circumflex accent\n 0x8f: 0xfb,\n // lowercase u, circumflex accent\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1,\n // capital letter A with acute\n 0x91: 0xc9,\n // capital letter E with acute\n 0x92: 0xd3,\n // capital letter O with acute\n 0x93: 0xda,\n // capital letter U with acute\n 0x94: 0xdc,\n // capital letter U with diaresis\n 0x95: 0xfc,\n // lowercase letter U with diaeresis\n 0x96: 0x2018,\n // opening single quote\n 0x97: 0xa1,\n // inverted exclamation mark\n 0x98: 0x2a,\n // asterisk\n 0x99: 0x2019,\n // closing single quote\n 0x9a: 0x2501,\n // box drawings heavy horizontal\n 0x9b: 0xa9,\n // copyright sign\n 0x9c: 0x2120,\n // Service mark\n 0x9d: 0x2022,\n // (round) bullet\n 0x9e: 0x201c,\n // Left double quotation mark\n 0x9f: 0x201d,\n // Right double quotation mark\n 0xa0: 0xc0,\n // uppercase A, grave accent\n 0xa1: 0xc2,\n // uppercase A, circumflex\n 0xa2: 0xc7,\n // uppercase C with cedilla\n 0xa3: 0xc8,\n // uppercase E, grave accent\n 0xa4: 0xca,\n // uppercase E, circumflex\n 0xa5: 0xcb,\n // capital letter E with diaresis\n 0xa6: 0xeb,\n // lowercase letter e with diaresis\n 0xa7: 0xce,\n // uppercase I, circumflex\n 0xa8: 0xcf,\n // uppercase I, with diaresis\n 0xa9: 0xef,\n // lowercase i, with diaresis\n 0xaa: 0xd4,\n // uppercase O, circumflex\n 0xab: 0xd9,\n // uppercase U, grave accent\n 0xac: 0xf9,\n // lowercase u, grave accent\n 0xad: 0xdb,\n // uppercase U, circumflex\n 0xae: 0xab,\n // left-pointing double angle quotation mark\n 0xaf: 0xbb,\n // right-pointing double angle quotation mark\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3,\n // Uppercase A, tilde\n 0xb1: 0xe3,\n // Lowercase a, tilde\n 0xb2: 0xcd,\n // Uppercase I, acute accent\n 0xb3: 0xcc,\n // Uppercase I, grave accent\n 0xb4: 0xec,\n // Lowercase i, grave accent\n 0xb5: 0xd2,\n // Uppercase O, grave accent\n 0xb6: 0xf2,\n // Lowercase o, grave accent\n 0xb7: 0xd5,\n // Uppercase O, tilde\n 0xb8: 0xf5,\n // Lowercase o, tilde\n 0xb9: 0x7b,\n // Open curly brace\n 0xba: 0x7d,\n // Closing curly brace\n 0xbb: 0x5c,\n // Backslash\n 0xbc: 0x5e,\n // Caret\n 0xbd: 0x5f,\n // Underscore\n 0xbe: 0x7c,\n // Pipe (vertical line)\n 0xbf: 0x223c,\n // Tilde operator\n 0xc0: 0xc4,\n // Uppercase A, umlaut\n 0xc1: 0xe4,\n // Lowercase A, umlaut\n 0xc2: 0xd6,\n // Uppercase O, umlaut\n 0xc3: 0xf6,\n // Lowercase o, umlaut\n 0xc4: 0xdf,\n // Esszett (sharp S)\n 0xc5: 0xa5,\n // Yen symbol\n 0xc6: 0xa4,\n // Generic currency sign\n 0xc7: 0x2503,\n // Box drawings heavy vertical\n 0xc8: 0xc5,\n // Uppercase A, ring\n 0xc9: 0xe5,\n // Lowercase A, ring\n 0xca: 0xd8,\n // Uppercase O, stroke\n 0xcb: 0xf8,\n // Lowercase o, strok\n 0xcc: 0x250f,\n // Box drawings heavy down and right\n 0xcd: 0x2513,\n // Box drawings heavy down and left\n 0xce: 0x2517,\n // Box drawings heavy up and right\n 0xcf: 0x251b // Box drawings heavy up and left\n\n};\n/**\n * Utils\n */\n\nvar getCharForByte = function getCharForByte(_byte) {\n var charCode = _byte;\n\n if (specialCea608CharsCodes.hasOwnProperty(_byte)) {\n charCode = specialCea608CharsCodes[_byte];\n }\n\n return String.fromCharCode(charCode);\n};\n\nvar NR_ROWS = 15;\nvar NR_COLS = 100; // Tables to look up row from PAC data\n\nvar rowsLowCh1 = {\n 0x11: 1,\n 0x12: 3,\n 0x15: 5,\n 0x16: 7,\n 0x17: 9,\n 0x10: 11,\n 0x13: 12,\n 0x14: 14\n};\nvar rowsHighCh1 = {\n 0x11: 2,\n 0x12: 4,\n 0x15: 6,\n 0x16: 8,\n 0x17: 10,\n 0x13: 13,\n 0x14: 15\n};\nvar rowsLowCh2 = {\n 0x19: 1,\n 0x1A: 3,\n 0x1D: 5,\n 0x1E: 7,\n 0x1F: 9,\n 0x18: 11,\n 0x1B: 12,\n 0x1C: 14\n};\nvar rowsHighCh2 = {\n 0x19: 2,\n 0x1A: 4,\n 0x1D: 6,\n 0x1E: 8,\n 0x1F: 10,\n 0x1B: 13,\n 0x1C: 15\n};\nvar backgroundColors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'black', 'transparent'];\nvar VerboseLevel;\n\n(function (VerboseLevel) {\n VerboseLevel[VerboseLevel[\"ERROR\"] = 0] = \"ERROR\";\n VerboseLevel[VerboseLevel[\"TEXT\"] = 1] = \"TEXT\";\n VerboseLevel[VerboseLevel[\"WARNING\"] = 2] = \"WARNING\";\n VerboseLevel[VerboseLevel[\"INFO\"] = 2] = \"INFO\";\n VerboseLevel[VerboseLevel[\"DEBUG\"] = 3] = \"DEBUG\";\n VerboseLevel[VerboseLevel[\"DATA\"] = 3] = \"DATA\";\n})(VerboseLevel || (VerboseLevel = {}));\n\nvar cea_608_parser_CaptionsLogger = /*#__PURE__*/function () {\n function CaptionsLogger() {\n this.time = null;\n this.verboseLevel = VerboseLevel.ERROR;\n }\n\n var _proto = CaptionsLogger.prototype;\n\n _proto.log = function log(severity, msg) {\n if (this.verboseLevel >= severity) {\n logger[\"logger\"].log(this.time + \" [\" + severity + \"] \" + msg);\n }\n };\n\n return CaptionsLogger;\n}();\n\nvar numArrayToHexArray = function numArrayToHexArray(numArray) {\n var hexArray = [];\n\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n\n return hexArray;\n};\n\nvar PenState = /*#__PURE__*/function () {\n function PenState(foreground, underline, italics, background, flash) {\n this.foreground = void 0;\n this.underline = void 0;\n this.italics = void 0;\n this.background = void 0;\n this.flash = void 0;\n this.foreground = foreground || 'white';\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || 'black';\n this.flash = flash || false;\n }\n\n var _proto2 = PenState.prototype;\n\n _proto2.reset = function reset() {\n this.foreground = 'white';\n this.underline = false;\n this.italics = false;\n this.background = 'black';\n this.flash = false;\n };\n\n _proto2.setStyles = function setStyles(styles) {\n var attribs = ['foreground', 'underline', 'italics', 'background', 'flash'];\n\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n };\n\n _proto2.isDefault = function isDefault() {\n return this.foreground === 'white' && !this.underline && !this.italics && this.background === 'black' && !this.flash;\n };\n\n _proto2.equals = function equals(other) {\n return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash;\n };\n\n _proto2.copy = function copy(newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n };\n\n _proto2.toString = function toString() {\n return 'color=' + this.foreground + ', underline=' + this.underline + ', italics=' + this.italics + ', background=' + this.background + ', flash=' + this.flash;\n };\n\n return PenState;\n}();\n/**\n * Unicode character with styling and background.\n * @constructor\n */\n\n\nvar StyledUnicodeChar = /*#__PURE__*/function () {\n function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n this.uchar = void 0;\n this.penState = void 0;\n this.uchar = uchar || ' '; // unicode character\n\n this.penState = new PenState(foreground, underline, italics, background, flash);\n }\n\n var _proto3 = StyledUnicodeChar.prototype;\n\n _proto3.reset = function reset() {\n this.uchar = ' ';\n this.penState.reset();\n };\n\n _proto3.setChar = function setChar(uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n };\n\n _proto3.setPenState = function setPenState(newPenState) {\n this.penState.copy(newPenState);\n };\n\n _proto3.equals = function equals(other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n };\n\n _proto3.copy = function copy(newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n };\n\n _proto3.isEmpty = function isEmpty() {\n return this.uchar === ' ' && this.penState.isDefault();\n };\n\n return StyledUnicodeChar;\n}();\n/**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\n\n\nvar Row = /*#__PURE__*/function () {\n function Row(logger) {\n this.chars = void 0;\n this.pos = void 0;\n this.currPenState = void 0;\n this.cueStartTime = void 0;\n this.logger = void 0;\n this.chars = [];\n\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n\n this.logger = logger;\n this.pos = 0;\n this.currPenState = new PenState();\n }\n\n var _proto4 = Row.prototype;\n\n _proto4.equals = function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n };\n\n _proto4.copy = function copy(other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n };\n\n _proto4.isEmpty = function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n }\n /**\n * Set the cursor to a valid column.\n */\n ;\n\n _proto4.setCursor = function setCursor(absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n\n if (this.pos < 0) {\n this.logger.log(VerboseLevel.DEBUG, 'Negative cursor position ' + this.pos);\n this.pos = 0;\n } else if (this.pos > NR_COLS) {\n this.logger.log(VerboseLevel.DEBUG, 'Too large cursor position ' + this.pos);\n this.pos = NR_COLS;\n }\n }\n /**\n * Move the cursor relative to current position.\n */\n ;\n\n _proto4.moveCursor = function moveCursor(relPos) {\n var newPos = this.pos + relPos;\n\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n\n this.setCursor(newPos);\n }\n /**\n * Backspace, move one step back and clear character.\n */\n ;\n\n _proto4.backSpace = function backSpace() {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(' ', this.currPenState);\n };\n\n _proto4.insertChar = function insertChar(_byte2) {\n if (_byte2 >= 0x90) {\n // Extended char\n this.backSpace();\n }\n\n var _char = getCharForByte(_byte2);\n\n if (this.pos >= NR_COLS) {\n this.logger.log(VerboseLevel.ERROR, 'Cannot insert ' + _byte2.toString(16) + ' (' + _char + ') at position ' + this.pos + '. Skipping it!');\n return;\n }\n\n this.chars[this.pos].setChar(_char, this.currPenState);\n this.moveCursor(1);\n };\n\n _proto4.clearFromPos = function clearFromPos(startPos) {\n var i;\n\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n };\n\n _proto4.clear = function clear() {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n };\n\n _proto4.clearToEndOfRow = function clearToEndOfRow() {\n this.clearFromPos(this.pos);\n };\n\n _proto4.getTextString = function getTextString() {\n var chars = [];\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n var _char2 = this.chars[i].uchar;\n\n if (_char2 !== ' ') {\n empty = false;\n }\n\n chars.push(_char2);\n }\n\n if (empty) {\n return '';\n } else {\n return chars.join('');\n }\n };\n\n _proto4.setPenStyles = function setPenStyles(styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n };\n\n return Row;\n}();\n/**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n */\n\nvar CaptionScreen = /*#__PURE__*/function () {\n function CaptionScreen(logger) {\n this.rows = void 0;\n this.currRow = void 0;\n this.nrRollUpRows = void 0;\n this.lastOutputScreen = void 0;\n this.logger = void 0;\n this.rows = [];\n\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row(logger));\n } // Note that we use zero-based numbering (0-14)\n\n\n this.logger = logger;\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.lastOutputScreen = null;\n this.reset();\n }\n\n var _proto5 = CaptionScreen.prototype;\n\n _proto5.reset = function reset() {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n\n this.currRow = NR_ROWS - 1;\n };\n\n _proto5.equals = function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n };\n\n _proto5.copy = function copy(other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n };\n\n _proto5.isEmpty = function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n };\n\n _proto5.backSpace = function backSpace() {\n var row = this.rows[this.currRow];\n row.backSpace();\n };\n\n _proto5.clearToEndOfRow = function clearToEndOfRow() {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n }\n /**\n * Insert a character (without styling) in the current row.\n */\n ;\n\n _proto5.insertChar = function insertChar(_char3) {\n var row = this.rows[this.currRow];\n row.insertChar(_char3);\n };\n\n _proto5.setPen = function setPen(styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n };\n\n _proto5.moveCursor = function moveCursor(relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n };\n\n _proto5.setCursor = function setCursor(absPos) {\n this.logger.log(VerboseLevel.INFO, 'setCursor: ' + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n };\n\n _proto5.setPAC = function setPAC(pacData) {\n this.logger.log(VerboseLevel.INFO, 'pacData = ' + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n } // Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n\n\n if (this.nrRollUpRows && this.currRow !== newRow) {\n // clear all rows first\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n } // Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n // topRowIndex - the start of rows to copy (inclusive index)\n\n\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows; // We only copy if the last position was already shown.\n // We use the cueStartTime value to check this.\n\n var lastOutputScreen = this.lastOutputScreen;\n\n if (lastOutputScreen) {\n var prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime;\n var time = this.logger.time;\n\n if (prevLineTime && time !== null && prevLineTime < time) {\n for (var _i = 0; _i < this.nrRollUpRows; _i++) {\n this.rows[newRow - this.nrRollUpRows + _i + 1].copy(lastOutputScreen.rows[topRowIndex + _i]);\n }\n }\n }\n }\n\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n\n var styles = {\n foreground: pacData.color,\n underline: pacData.underline,\n italics: pacData.italics,\n background: 'black',\n flash: false\n };\n this.setPen(styles);\n }\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n ;\n\n _proto5.setBkgData = function setBkgData(bkgData) {\n this.logger.log(VerboseLevel.INFO, 'bkgData = ' + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); // Space\n };\n\n _proto5.setRollUpRows = function setRollUpRows(nrRows) {\n this.nrRollUpRows = nrRows;\n };\n\n _proto5.rollUp = function rollUp() {\n if (this.nrRollUpRows === null) {\n this.logger.log(VerboseLevel.DEBUG, 'roll_up but nrRollUpRows not set yet');\n return; // Not properly setup\n }\n\n this.logger.log(VerboseLevel.TEXT, this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n this.logger.log(VerboseLevel.INFO, 'Rolling up'); // this.logger.log(VerboseLevel.TEXT, this.get_display_text())\n }\n /**\n * Get all non-empty rows with as unicode text.\n */\n ;\n\n _proto5.getDisplayText = function getDisplayText(asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = '';\n var rowNr = -1;\n\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n\n if (rowText) {\n rowNr = i + 1;\n\n if (asOneRow) {\n displayText.push('Row ' + rowNr + ': \\'' + rowText + '\\'');\n } else {\n displayText.push(rowText.trim());\n }\n }\n }\n\n if (displayText.length > 0) {\n if (asOneRow) {\n text = '[' + displayText.join(' | ') + ']';\n } else {\n text = displayText.join('\\n');\n }\n }\n\n return text;\n };\n\n _proto5.getTextAndFormat = function getTextAndFormat() {\n return this.rows;\n };\n\n return CaptionScreen;\n}(); // var modes = ['MODE_ROLL-UP', 'MODE_POP-ON', 'MODE_PAINT-ON', 'MODE_TEXT'];\n\nvar Cea608Channel = /*#__PURE__*/function () {\n function Cea608Channel(channelNumber, outputFilter, logger) {\n this.chNr = void 0;\n this.outputFilter = void 0;\n this.mode = void 0;\n this.verbose = void 0;\n this.displayedMemory = void 0;\n this.nonDisplayedMemory = void 0;\n this.lastOutputScreen = void 0;\n this.currRollUpRow = void 0;\n this.writeScreen = void 0;\n this.cueStartTime = void 0;\n this.logger = void 0;\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen(logger);\n this.nonDisplayedMemory = new CaptionScreen(logger);\n this.lastOutputScreen = new CaptionScreen(logger);\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n\n this.logger = logger;\n }\n\n var _proto6 = Cea608Channel.prototype;\n\n _proto6.reset = function reset() {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.outputFilter.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n };\n\n _proto6.getHandler = function getHandler() {\n return this.outputFilter;\n };\n\n _proto6.setHandler = function setHandler(newHandler) {\n this.outputFilter = newHandler;\n };\n\n _proto6.setPAC = function setPAC(pacData) {\n this.writeScreen.setPAC(pacData);\n };\n\n _proto6.setBkgData = function setBkgData(bkgData) {\n this.writeScreen.setBkgData(bkgData);\n };\n\n _proto6.setMode = function setMode(newMode) {\n if (newMode === this.mode) {\n return;\n }\n\n this.mode = newMode;\n this.logger.log(VerboseLevel.INFO, 'MODE=' + newMode);\n\n if (this.mode === 'MODE_POP-ON') {\n this.writeScreen = this.nonDisplayedMemory;\n } else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n\n if (this.mode !== 'MODE_ROLL-UP') {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n\n this.mode = newMode;\n };\n\n _proto6.insertChars = function insertChars(chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n\n var screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';\n this.logger.log(VerboseLevel.INFO, screen + ': ' + this.writeScreen.getDisplayText(true));\n\n if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n this.logger.log(VerboseLevel.TEXT, 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n };\n\n _proto6.ccRCL = function ccRCL() {\n // Resume Caption Loading (switch mode to Pop On)\n this.logger.log(VerboseLevel.INFO, 'RCL - Resume Caption Loading');\n this.setMode('MODE_POP-ON');\n };\n\n _proto6.ccBS = function ccBS() {\n // BackSpace\n this.logger.log(VerboseLevel.INFO, 'BS - BackSpace');\n\n if (this.mode === 'MODE_TEXT') {\n return;\n }\n\n this.writeScreen.backSpace();\n\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n };\n\n _proto6.ccAOF = function ccAOF() {// Reserved (formerly Alarm Off)\n };\n\n _proto6.ccAON = function ccAON() {// Reserved (formerly Alarm On)\n };\n\n _proto6.ccDER = function ccDER() {\n // Delete to End of Row\n this.logger.log(VerboseLevel.INFO, 'DER- Delete to End of Row');\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n };\n\n _proto6.ccRU = function ccRU(nrRows) {\n // Roll-Up Captions-2,3,or 4 Rows\n this.logger.log(VerboseLevel.INFO, 'RU(' + nrRows + ') - Roll Up');\n this.writeScreen = this.displayedMemory;\n this.setMode('MODE_ROLL-UP');\n this.writeScreen.setRollUpRows(nrRows);\n };\n\n _proto6.ccFON = function ccFON() {\n // Flash On\n this.logger.log(VerboseLevel.INFO, 'FON - Flash On');\n this.writeScreen.setPen({\n flash: true\n });\n };\n\n _proto6.ccRDC = function ccRDC() {\n // Resume Direct Captioning (switch mode to PaintOn)\n this.logger.log(VerboseLevel.INFO, 'RDC - Resume Direct Captioning');\n this.setMode('MODE_PAINT-ON');\n };\n\n _proto6.ccTR = function ccTR() {\n // Text Restart in text mode (not supported, however)\n this.logger.log(VerboseLevel.INFO, 'TR');\n this.setMode('MODE_TEXT');\n };\n\n _proto6.ccRTD = function ccRTD() {\n // Resume Text Display in Text mode (not supported, however)\n this.logger.log(VerboseLevel.INFO, 'RTD');\n this.setMode('MODE_TEXT');\n };\n\n _proto6.ccEDM = function ccEDM() {\n // Erase Displayed Memory\n this.logger.log(VerboseLevel.INFO, 'EDM - Erase Displayed Memory');\n this.displayedMemory.reset();\n this.outputDataUpdate(true);\n };\n\n _proto6.ccCR = function ccCR() {\n // Carriage Return\n this.logger.log(VerboseLevel.INFO, 'CR - Carriage Return');\n this.writeScreen.rollUp();\n this.outputDataUpdate(true);\n };\n\n _proto6.ccENM = function ccENM() {\n // Erase Non-Displayed Memory\n this.logger.log(VerboseLevel.INFO, 'ENM - Erase Non-displayed Memory');\n this.nonDisplayedMemory.reset();\n };\n\n _proto6.ccEOC = function ccEOC() {\n // End of Caption (Flip Memories)\n this.logger.log(VerboseLevel.INFO, 'EOC - End Of Caption');\n\n if (this.mode === 'MODE_POP-ON') {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n this.logger.log(VerboseLevel.TEXT, 'DISP: ' + this.displayedMemory.getDisplayText());\n }\n\n this.outputDataUpdate(true);\n };\n\n _proto6.ccTO = function ccTO(nrCols) {\n // Tab Offset 1,2, or 3 columns\n this.logger.log(VerboseLevel.INFO, 'TO(' + nrCols + ') - Tab Offset');\n this.writeScreen.moveCursor(nrCols);\n };\n\n _proto6.ccMIDROW = function ccMIDROW(secondByte) {\n // Parse MIDROW command\n var styles = {\n flash: false\n };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta'];\n styles.foreground = colors[colorIndex];\n } else {\n styles.foreground = 'white';\n }\n\n this.logger.log(VerboseLevel.INFO, 'MIDROW: ' + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n };\n\n _proto6.outputDataUpdate = function outputDataUpdate(dispatch) {\n if (dispatch === void 0) {\n dispatch = false;\n }\n\n var time = this.logger.time;\n\n if (time === null) {\n return;\n }\n\n if (this.outputFilter) {\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n // Start of a new cue\n this.cueStartTime = time;\n } else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n this.outputFilter.newCue(this.cueStartTime, time, this.lastOutputScreen);\n\n if (dispatch && this.outputFilter.dispatchCue) {\n this.outputFilter.dispatchCue();\n }\n\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : time;\n }\n }\n\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n };\n\n _proto6.cueSplitAtTime = function cueSplitAtTime(t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n\n this.cueStartTime = t;\n }\n }\n };\n\n return Cea608Channel;\n}();\n\nvar Cea608Parser = /*#__PURE__*/function () {\n function Cea608Parser(field, out1, out2) {\n this.channels = void 0;\n this.currentChannel = 0;\n this.cmdHistory = void 0;\n this.logger = void 0;\n var logger = new cea_608_parser_CaptionsLogger();\n this.channels = [null, new Cea608Channel(field, out1, logger), new Cea608Channel(field + 1, out2, logger)];\n this.cmdHistory = createCmdHistory();\n this.logger = logger;\n }\n\n var _proto7 = Cea608Parser.prototype;\n\n _proto7.getHandler = function getHandler(channel) {\n return this.channels[channel].getHandler();\n };\n\n _proto7.setHandler = function setHandler(channel, newHandler) {\n this.channels[channel].setHandler(newHandler);\n }\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n ;\n\n _proto7.addData = function addData(time, byteList) {\n var cmdFound;\n var a;\n var b;\n var charsFound = false;\n this.logger.time = time;\n\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n\n if (a === 0 && b === 0) {\n continue;\n } else {\n this.logger.log(VerboseLevel.DATA, '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');\n }\n\n cmdFound = this.parseCmd(a, b);\n\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n\n if (charsFound) {\n var currChNr = this.currentChannel;\n\n if (currChNr && currChNr > 0) {\n var channel = this.channels[currChNr];\n channel.insertChars(charsFound);\n } else {\n this.logger.log(VerboseLevel.WARNING, 'No channel found yet. TEXT-MODE?');\n }\n }\n }\n\n if (!cmdFound && !charsFound) {\n this.logger.log(VerboseLevel.WARNING, 'Couldn\\'t parse cleaned data ' + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n }\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n ;\n\n _proto7.parseCmd = function parseCmd(a, b) {\n var cmdHistory = this.cmdHistory;\n var cond1 = (a === 0x14 || a === 0x1C || a === 0x15 || a === 0x1D) && b >= 0x20 && b <= 0x2F;\n var cond2 = (a === 0x17 || a === 0x1F) && b >= 0x21 && b <= 0x23;\n\n if (!(cond1 || cond2)) {\n return false;\n }\n\n if (hasCmdRepeated(a, b, cmdHistory)) {\n setLastCmd(null, null, cmdHistory);\n this.logger.log(VerboseLevel.DEBUG, 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');\n return true;\n }\n\n var chNr = a === 0x14 || a === 0x15 || a === 0x17 ? 1 : 2;\n var channel = this.channels[chNr];\n\n if (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) {\n if (b === 0x20) {\n channel.ccRCL();\n } else if (b === 0x21) {\n channel.ccBS();\n } else if (b === 0x22) {\n channel.ccAOF();\n } else if (b === 0x23) {\n channel.ccAON();\n } else if (b === 0x24) {\n channel.ccDER();\n } else if (b === 0x25) {\n channel.ccRU(2);\n } else if (b === 0x26) {\n channel.ccRU(3);\n } else if (b === 0x27) {\n channel.ccRU(4);\n } else if (b === 0x28) {\n channel.ccFON();\n } else if (b === 0x29) {\n channel.ccRDC();\n } else if (b === 0x2A) {\n channel.ccTR();\n } else if (b === 0x2B) {\n channel.ccRTD();\n } else if (b === 0x2C) {\n channel.ccEDM();\n } else if (b === 0x2D) {\n channel.ccCR();\n } else if (b === 0x2E) {\n channel.ccENM();\n } else if (b === 0x2F) {\n channel.ccEOC();\n }\n } else {\n // a == 0x17 || a == 0x1F\n channel.ccTO(b - 0x20);\n }\n\n setLastCmd(a, b, cmdHistory);\n this.currentChannel = chNr;\n return true;\n }\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n ;\n\n _proto7.parseMidrow = function parseMidrow(a, b) {\n var chNr = 0;\n\n if ((a === 0x11 || a === 0x19) && b >= 0x20 && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n } else {\n chNr = 2;\n }\n\n if (chNr !== this.currentChannel) {\n this.logger.log(VerboseLevel.ERROR, 'Mismatch channel in midrow parsing');\n return false;\n }\n\n var channel = this.channels[chNr];\n\n if (!channel) {\n return false;\n }\n\n channel.ccMIDROW(b);\n this.logger.log(VerboseLevel.DEBUG, 'MIDROW (' + numArrayToHexArray([a, b]) + ')');\n return true;\n }\n\n return false;\n }\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n ;\n\n _proto7.parsePAC = function parsePAC(a, b) {\n var row;\n var cmdHistory = this.cmdHistory;\n var case1 = (a >= 0x11 && a <= 0x17 || a >= 0x19 && a <= 0x1F) && b >= 0x40 && b <= 0x7F;\n var case2 = (a === 0x10 || a === 0x18) && b >= 0x40 && b <= 0x5F;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n if (hasCmdRepeated(a, b, cmdHistory)) {\n setLastCmd(null, null, cmdHistory);\n return true; // Repeated commands are dropped (once)\n }\n\n var chNr = a <= 0x17 ? 1 : 2;\n\n if (b >= 0x40 && b <= 0x5F) {\n row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];\n } else {\n // 0x60 <= b <= 0x7F\n row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n\n var channel = this.channels[chNr];\n\n if (!channel) {\n return false;\n }\n\n channel.setPAC(this.interpretPAC(row, b));\n setLastCmd(a, b, cmdHistory);\n this.currentChannel = chNr;\n return true;\n }\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n ;\n\n _proto7.interpretPAC = function interpretPAC(row, _byte3) {\n var pacIndex = _byte3;\n var pacData = {\n color: null,\n italics: false,\n indent: null,\n underline: false,\n row: row\n };\n\n if (_byte3 > 0x5F) {\n pacIndex = _byte3 - 0x60;\n } else {\n pacIndex = _byte3 - 0x40;\n }\n\n pacData.underline = (pacIndex & 1) === 1;\n\n if (pacIndex <= 0xd) {\n pacData.color = ['white', 'green', 'blue', 'cyan', 'red', 'yellow', 'magenta', 'white'][Math.floor(pacIndex / 2)];\n } else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = 'white';\n } else {\n pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4;\n }\n\n return pacData; // Note that row has zero offset. The spec uses 1.\n }\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n ;\n\n _proto7.parseChars = function parseChars(a, b) {\n var channelNr;\n var charCodes = null;\n var charCode1 = null;\n\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n } else {\n channelNr = 1;\n charCode1 = a;\n }\n\n if (charCode1 >= 0x11 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n } else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n } else {\n oneCode = b + 0x90;\n }\n\n this.logger.log(VerboseLevel.INFO, 'Special char \\'' + getCharForByte(oneCode) + '\\' in channel ' + channelNr);\n charCodes = [oneCode];\n } else if (a >= 0x20 && a <= 0x7f) {\n charCodes = b === 0 ? [a] : [a, b];\n }\n\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n this.logger.log(VerboseLevel.DEBUG, 'Char codes = ' + hexCodes.join(','));\n setLastCmd(a, b, this.cmdHistory);\n }\n\n return charCodes;\n }\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns {Boolean} Tells if background attributes are found\n */\n ;\n\n _proto7.parseBackgroundAttributes = function parseBackgroundAttributes(a, b) {\n var case1 = (a === 0x10 || a === 0x18) && b >= 0x20 && b <= 0x2f;\n var case2 = (a === 0x17 || a === 0x1f) && b >= 0x2d && b <= 0x2f;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n var index;\n var bkgData = {};\n\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + '_semi';\n }\n } else if (b === 0x2d) {\n bkgData.background = 'transparent';\n } else {\n bkgData.foreground = 'black';\n\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n\n var chNr = a <= 0x17 ? 1 : 2;\n var channel = this.channels[chNr];\n channel.setBkgData(bkgData);\n setLastCmd(a, b, this.cmdHistory);\n return true;\n }\n /**\n * Reset state of parser and its channels.\n */\n ;\n\n _proto7.reset = function reset() {\n for (var i = 0; i < Object.keys(this.channels).length; i++) {\n var channel = this.channels[i];\n\n if (channel) {\n channel.reset();\n }\n }\n\n this.cmdHistory = createCmdHistory();\n }\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n ;\n\n _proto7.cueSplitAtTime = function cueSplitAtTime(t) {\n for (var i = 0; i < this.channels.length; i++) {\n var channel = this.channels[i];\n\n if (channel) {\n channel.cueSplitAtTime(t);\n }\n }\n };\n\n return Cea608Parser;\n}();\n\nfunction setLastCmd(a, b, cmdHistory) {\n cmdHistory.a = a;\n cmdHistory.b = b;\n}\n\nfunction hasCmdRepeated(a, b, cmdHistory) {\n return cmdHistory.a === a && cmdHistory.b === b;\n}\n\nfunction createCmdHistory() {\n return {\n a: null,\n b: null\n };\n}\n\n/* harmony default export */ var cea_608_parser = (Cea608Parser);\n// CONCATENATED MODULE: ./src/utils/output-filter.ts\nvar OutputFilter = /*#__PURE__*/function () {\n function OutputFilter(timelineController, trackName) {\n this.timelineController = void 0;\n this.cueRanges = [];\n this.trackName = void 0;\n this.startTime = null;\n this.endTime = null;\n this.screen = null;\n this.timelineController = timelineController;\n this.trackName = trackName;\n }\n\n var _proto = OutputFilter.prototype;\n\n _proto.dispatchCue = function dispatchCue() {\n if (this.startTime === null) {\n return;\n }\n\n this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen, this.cueRanges);\n this.startTime = null;\n };\n\n _proto.newCue = function newCue(startTime, endTime, screen) {\n if (this.startTime === null || this.startTime > startTime) {\n this.startTime = startTime;\n }\n\n this.endTime = endTime;\n this.screen = screen;\n this.timelineController.createCaptionsTrack(this.trackName);\n };\n\n _proto.reset = function reset() {\n this.cueRanges = [];\n };\n\n return OutputFilter;\n}();\n\n\n// CONCATENATED MODULE: ./src/utils/webvtt-parser.js\n\n\n\n\n\n // String.prototype.startsWith is not supported in IE11\n\nvar startsWith = function startsWith(inputString, searchString, position) {\n return inputString.substr(position || 0, searchString.length) === searchString;\n};\n\nvar webvtt_parser_cueString2millis = function cueString2millis(timeString) {\n var ts = parseInt(timeString.substr(-3));\n var secs = parseInt(timeString.substr(-6, 2));\n var mins = parseInt(timeString.substr(-9, 2));\n var hours = timeString.length > 9 ? parseInt(timeString.substr(0, timeString.indexOf(':'))) : 0;\n\n if (!Object(number[\"isFiniteNumber\"])(ts) || !Object(number[\"isFiniteNumber\"])(secs) || !Object(number[\"isFiniteNumber\"])(mins) || !Object(number[\"isFiniteNumber\"])(hours)) {\n throw Error(\"Malformed X-TIMESTAMP-MAP: Local:\" + timeString);\n }\n\n ts += 1000 * secs;\n ts += 60 * 1000 * mins;\n ts += 60 * 60 * 1000 * hours;\n return ts;\n}; // From https://github.com/darkskyapp/string-hash\n\n\nvar hash = function hash(text) {\n var hash = 5381;\n var i = text.length;\n\n while (i) {\n hash = hash * 33 ^ text.charCodeAt(--i);\n }\n\n return (hash >>> 0).toString();\n};\n\nvar calculateOffset = function calculateOffset(vttCCs, cc, presentationTime) {\n var currCC = vttCCs[cc];\n var prevCC = vttCCs[currCC.prevCC]; // This is the first discontinuity or cues have been processed since the last discontinuity\n // Offset = current discontinuity time\n\n if (!prevCC || !prevCC.new && currCC.new) {\n vttCCs.ccOffset = vttCCs.presentationOffset = currCC.start;\n currCC.new = false;\n return;\n } // There have been discontinuities since cues were last parsed.\n // Offset = time elapsed\n\n\n while (prevCC && prevCC.new) {\n vttCCs.ccOffset += currCC.start - prevCC.start;\n currCC.new = false;\n currCC = prevCC;\n prevCC = vttCCs[currCC.prevCC];\n }\n\n vttCCs.presentationOffset = presentationTime;\n};\n\nvar WebVTTParser = {\n parse: function parse(vttByteArray, syncPTS, vttCCs, cc, callBack, errorCallBack) {\n // Convert byteArray into string, replacing any somewhat exotic linefeeds with \"\\n\", then split on that character.\n var re = /\\r\\n|\\n\\r|\\n|\\r/g; // Uint8Array.prototype.reduce is not implemented in IE11\n\n var vttLines = Object(id3[\"utf8ArrayToStr\"])(new Uint8Array(vttByteArray)).trim().replace(re, '\\n').split('\\n');\n var cueTime = '00:00.000';\n var mpegTs = 0;\n var localTime = 0;\n var presentationTime = 0;\n var cues = [];\n var parsingError;\n var inHeader = true;\n var timestampMap = false; // let VTTCue = VTTCue || window.TextTrackCue;\n // Create parser object using VTTCue with TextTrackCue fallback on certain browsers.\n\n var parser = new vttparser();\n\n parser.oncue = function (cue) {\n // Adjust cue timing; clamp cues to start no earlier than - and drop cues that don't end after - 0 on timeline.\n var currCC = vttCCs[cc];\n var cueOffset = vttCCs.ccOffset; // Update offsets for new discontinuities\n\n if (currCC && currCC.new) {\n if (localTime !== undefined) {\n // When local time is provided, offset = discontinuity start time - local time\n cueOffset = vttCCs.ccOffset = currCC.start;\n } else {\n calculateOffset(vttCCs, cc, presentationTime);\n }\n }\n\n if (presentationTime) {\n // If we have MPEGTS, offset = presentation time + discontinuity offset\n cueOffset = presentationTime - vttCCs.presentationOffset;\n }\n\n if (timestampMap) {\n cue.startTime += cueOffset - localTime;\n cue.endTime += cueOffset - localTime;\n } // Create a unique hash id for a cue based on start/end times and text.\n // This helps timeline-controller to avoid showing repeated captions.\n\n\n cue.id = hash(cue.startTime.toString()) + hash(cue.endTime.toString()) + hash(cue.text); // Fix encoding of special characters. TODO: Test with all sorts of weird characters.\n\n cue.text = decodeURIComponent(encodeURIComponent(cue.text));\n\n if (cue.endTime > 0) {\n cues.push(cue);\n }\n };\n\n parser.onparsingerror = function (e) {\n parsingError = e;\n };\n\n parser.onflush = function () {\n if (parsingError && errorCallBack) {\n errorCallBack(parsingError);\n return;\n }\n\n callBack(cues);\n }; // Go through contents line by line.\n\n\n vttLines.forEach(function (line) {\n if (inHeader) {\n // Look for X-TIMESTAMP-MAP in header.\n if (startsWith(line, 'X-TIMESTAMP-MAP=')) {\n // Once found, no more are allowed anyway, so stop searching.\n inHeader = false;\n timestampMap = true; // Extract LOCAL and MPEGTS.\n\n line.substr(16).split(',').forEach(function (timestamp) {\n if (startsWith(timestamp, 'LOCAL:')) {\n cueTime = timestamp.substr(6);\n } else if (startsWith(timestamp, 'MPEGTS:')) {\n mpegTs = parseInt(timestamp.substr(7));\n }\n });\n\n try {\n // Calculate subtitle offset in milliseconds.\n if (syncPTS + (vttCCs[cc].start * 90000 || 0) < 0) {\n syncPTS += 8589934592;\n } // Adjust MPEGTS by sync PTS.\n\n\n mpegTs -= syncPTS; // Convert cue time to seconds\n\n localTime = webvtt_parser_cueString2millis(cueTime) / 1000; // Convert MPEGTS to seconds from 90kHz.\n\n presentationTime = mpegTs / 90000;\n } catch (e) {\n timestampMap = false;\n parsingError = e;\n } // Return without parsing X-TIMESTAMP-MAP line.\n\n\n return;\n } else if (line === '') {\n inHeader = false;\n }\n } // Parse line by default.\n\n\n parser.parse(line + '\\n');\n });\n parser.flush();\n }\n};\n/* harmony default export */ var webvtt_parser = (WebVTTParser);\n// CONCATENATED MODULE: ./src/controller/timeline-controller.ts\n\n\n\nfunction timeline_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction timeline_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\n\n\nvar timeline_controller_TimelineController = /*#__PURE__*/function (_EventHandler) {\n timeline_controller_inheritsLoose(TimelineController, _EventHandler);\n\n function TimelineController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHING, events[\"default\"].MEDIA_DETACHING, events[\"default\"].FRAG_PARSING_USERDATA, events[\"default\"].FRAG_DECRYPTED, events[\"default\"].MANIFEST_LOADING, events[\"default\"].MANIFEST_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].INIT_PTS_FOUND) || this;\n _this.media = null;\n _this.config = void 0;\n _this.enabled = true;\n _this.Cues = void 0;\n _this.textTracks = [];\n _this.tracks = [];\n _this.initPTS = [];\n _this.unparsedVttFrags = [];\n _this.captionsTracks = {};\n _this.nonNativeCaptionsTracks = {};\n _this.captionsProperties = void 0;\n _this.cea608Parser1 = void 0;\n _this.cea608Parser2 = void 0;\n _this.lastSn = -1;\n _this.prevCC = -1;\n _this.vttCCs = newVTTCCs();\n _this.hls = hls;\n _this.config = hls.config;\n _this.Cues = hls.config.cueHandler;\n _this.captionsProperties = {\n textTrack1: {\n label: _this.config.captionsTextTrack1Label,\n languageCode: _this.config.captionsTextTrack1LanguageCode\n },\n textTrack2: {\n label: _this.config.captionsTextTrack2Label,\n languageCode: _this.config.captionsTextTrack2LanguageCode\n },\n textTrack3: {\n label: _this.config.captionsTextTrack3Label,\n languageCode: _this.config.captionsTextTrack3LanguageCode\n },\n textTrack4: {\n label: _this.config.captionsTextTrack4Label,\n languageCode: _this.config.captionsTextTrack4LanguageCode\n }\n };\n\n if (_this.config.enableCEA708Captions) {\n var channel1 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack1');\n var channel2 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack2');\n var channel3 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack3');\n var channel4 = new OutputFilter(timeline_controller_assertThisInitialized(_this), 'textTrack4');\n _this.cea608Parser1 = new cea_608_parser(1, channel1, channel2);\n _this.cea608Parser2 = new cea_608_parser(3, channel3, channel4);\n }\n\n return _this;\n }\n\n var _proto = TimelineController.prototype;\n\n _proto.addCues = function addCues(trackName, startTime, endTime, screen, cueRanges) {\n // skip cues which overlap more than 50% with previously parsed time ranges\n var merged = false;\n\n for (var i = cueRanges.length; i--;) {\n var cueRange = cueRanges[i];\n var overlap = intersection(cueRange[0], cueRange[1], startTime, endTime);\n\n if (overlap >= 0) {\n cueRange[0] = Math.min(cueRange[0], startTime);\n cueRange[1] = Math.max(cueRange[1], endTime);\n merged = true;\n\n if (overlap / (endTime - startTime) > 0.5) {\n return;\n }\n }\n }\n\n if (!merged) {\n cueRanges.push([startTime, endTime]);\n }\n\n if (this.config.renderTextTracksNatively) {\n this.Cues.newCue(this.captionsTracks[trackName], startTime, endTime, screen);\n } else {\n var cues = this.Cues.newCue(null, startTime, endTime, screen);\n this.hls.trigger(events[\"default\"].CUES_PARSED, {\n type: 'captions',\n cues: cues,\n track: trackName\n });\n }\n } // Triggered when an initial PTS is found; used for synchronisation of WebVTT.\n ;\n\n _proto.onInitPtsFound = function onInitPtsFound(data) {\n var _this2 = this;\n\n var frag = data.frag,\n id = data.id,\n initPTS = data.initPTS;\n var unparsedVttFrags = this.unparsedVttFrags;\n\n if (id === 'main') {\n this.initPTS[frag.cc] = initPTS;\n } // Due to asynchronous processing, initial PTS may arrive later than the first VTT fragments are loaded.\n // Parse any unparsed fragments upon receiving the initial PTS.\n\n\n if (unparsedVttFrags.length) {\n this.unparsedVttFrags = [];\n unparsedVttFrags.forEach(function (frag) {\n _this2.onFragLoaded(frag);\n });\n }\n };\n\n _proto.getExistingTrack = function getExistingTrack(trackName) {\n var media = this.media;\n\n if (media) {\n for (var i = 0; i < media.textTracks.length; i++) {\n var textTrack = media.textTracks[i];\n\n if (textTrack[trackName]) {\n return textTrack;\n }\n }\n }\n\n return null;\n };\n\n _proto.createCaptionsTrack = function createCaptionsTrack(trackName) {\n if (this.config.renderTextTracksNatively) {\n this.createNativeTrack(trackName);\n } else {\n this.createNonNativeTrack(trackName);\n }\n };\n\n _proto.createNativeTrack = function createNativeTrack(trackName) {\n if (this.captionsTracks[trackName]) {\n return;\n }\n\n var captionsProperties = this.captionsProperties,\n captionsTracks = this.captionsTracks,\n media = this.media;\n var _captionsProperties$t = captionsProperties[trackName],\n label = _captionsProperties$t.label,\n languageCode = _captionsProperties$t.languageCode; // Enable reuse of existing text track.\n\n var existingTrack = this.getExistingTrack(trackName);\n\n if (!existingTrack) {\n var textTrack = this.createTextTrack('captions', label, languageCode);\n\n if (textTrack) {\n // Set a special property on the track so we know it's managed by Hls.js\n textTrack[trackName] = true;\n captionsTracks[trackName] = textTrack;\n }\n } else {\n captionsTracks[trackName] = existingTrack;\n clearCurrentCues(captionsTracks[trackName]);\n sendAddTrackEvent(captionsTracks[trackName], media);\n }\n };\n\n _proto.createNonNativeTrack = function createNonNativeTrack(trackName) {\n if (this.nonNativeCaptionsTracks[trackName]) {\n return;\n } // Create a list of a single track for the provider to consume\n\n\n var trackProperties = this.captionsProperties[trackName];\n\n if (!trackProperties) {\n return;\n }\n\n var label = trackProperties.label;\n var track = {\n _id: trackName,\n label: label,\n kind: 'captions',\n default: trackProperties.media ? !!trackProperties.media.default : false,\n closedCaptions: trackProperties.media\n };\n this.nonNativeCaptionsTracks[trackName] = track;\n this.hls.trigger(events[\"default\"].NON_NATIVE_TEXT_TRACKS_FOUND, {\n tracks: [track]\n });\n };\n\n _proto.createTextTrack = function createTextTrack(kind, label, lang) {\n var media = this.media;\n\n if (!media) {\n return;\n }\n\n return media.addTextTrack(kind, label, lang);\n };\n\n _proto.destroy = function destroy() {\n _EventHandler.prototype.destroy.call(this);\n };\n\n _proto.onMediaAttaching = function onMediaAttaching(data) {\n this.media = data.media;\n\n this._cleanTracks();\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var captionsTracks = this.captionsTracks;\n Object.keys(captionsTracks).forEach(function (trackName) {\n clearCurrentCues(captionsTracks[trackName]);\n delete captionsTracks[trackName];\n });\n this.nonNativeCaptionsTracks = {};\n };\n\n _proto.onManifestLoading = function onManifestLoading() {\n this.lastSn = -1; // Detect discontiguity in fragment parsing\n\n this.prevCC = -1;\n this.vttCCs = newVTTCCs(); // Detect discontinuity in subtitle manifests\n\n this._cleanTracks();\n\n this.tracks = [];\n this.captionsTracks = {};\n this.nonNativeCaptionsTracks = {};\n };\n\n _proto._cleanTracks = function _cleanTracks() {\n // clear outdated subtitles\n var media = this.media;\n\n if (!media) {\n return;\n }\n\n var textTracks = media.textTracks;\n\n if (textTracks) {\n for (var i = 0; i < textTracks.length; i++) {\n clearCurrentCues(textTracks[i]);\n }\n }\n };\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n this.textTracks = [];\n this.unparsedVttFrags = this.unparsedVttFrags || [];\n this.initPTS = [];\n\n if (this.cea608Parser1 && this.cea608Parser2) {\n this.cea608Parser1.reset();\n this.cea608Parser2.reset();\n }\n\n if (this.config.enableWebVTT) {\n var tracks = data.subtitles || [];\n var sameTracks = this.tracks && tracks && this.tracks.length === tracks.length;\n this.tracks = data.subtitles || [];\n\n if (this.config.renderTextTracksNatively) {\n var inUseTracks = this.media ? this.media.textTracks : [];\n this.tracks.forEach(function (track, index) {\n var textTrack;\n\n if (index < inUseTracks.length) {\n var inUseTrack = null;\n\n for (var i = 0; i < inUseTracks.length; i++) {\n if (canReuseVttTextTrack(inUseTracks[i], track)) {\n inUseTrack = inUseTracks[i];\n break;\n }\n } // Reuse tracks with the same label, but do not reuse 608/708 tracks\n\n\n if (inUseTrack) {\n textTrack = inUseTrack;\n }\n }\n\n if (!textTrack) {\n textTrack = _this3.createTextTrack('subtitles', track.name, track.lang);\n }\n\n if (track.default) {\n textTrack.mode = _this3.hls.subtitleDisplay ? 'showing' : 'hidden';\n } else {\n textTrack.mode = 'disabled';\n }\n\n _this3.textTracks.push(textTrack);\n });\n } else if (!sameTracks && this.tracks && this.tracks.length) {\n // Create a list of tracks for the provider to consume\n var tracksList = this.tracks.map(function (track) {\n return {\n label: track.name,\n kind: track.type.toLowerCase(),\n default: track.default,\n subtitleTrack: track\n };\n });\n this.hls.trigger(events[\"default\"].NON_NATIVE_TEXT_TRACKS_FOUND, {\n tracks: tracksList\n });\n }\n }\n\n if (this.config.enableCEA708Captions && data.captions) {\n data.captions.forEach(function (captionsTrack) {\n var instreamIdMatch = /(?:CC|SERVICE)([1-4])/.exec(captionsTrack.instreamId);\n\n if (!instreamIdMatch) {\n return;\n }\n\n var trackName = \"textTrack\" + instreamIdMatch[1];\n var trackProperties = _this3.captionsProperties[trackName];\n\n if (!trackProperties) {\n return;\n }\n\n trackProperties.label = captionsTrack.name;\n\n if (captionsTrack.lang) {\n // optional attribute\n trackProperties.languageCode = captionsTrack.lang;\n }\n\n trackProperties.media = captionsTrack;\n });\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var frag = data.frag,\n payload = data.payload;\n var cea608Parser1 = this.cea608Parser1,\n cea608Parser2 = this.cea608Parser2,\n initPTS = this.initPTS,\n lastSn = this.lastSn,\n unparsedVttFrags = this.unparsedVttFrags;\n\n if (frag.type === 'main') {\n var sn = frag.sn; // if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack\n\n if (frag.sn !== lastSn + 1) {\n if (cea608Parser1 && cea608Parser2) {\n cea608Parser1.reset();\n cea608Parser2.reset();\n }\n }\n\n this.lastSn = sn;\n } // eslint-disable-line brace-style\n // If fragment is subtitle type, parse as WebVTT.\n else if (frag.type === 'subtitle') {\n if (payload.byteLength) {\n // We need an initial synchronisation PTS. Store fragments as long as none has arrived.\n if (!Object(number[\"isFiniteNumber\"])(initPTS[frag.cc])) {\n unparsedVttFrags.push(data);\n\n if (initPTS.length) {\n // finish unsuccessfully, otherwise the subtitle-stream-controller could be blocked from loading new frags.\n this.hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n }\n\n return;\n }\n\n var decryptData = frag.decryptdata; // If the subtitles are not encrypted, parse VTTs now. Otherwise, we need to wait.\n\n if (decryptData == null || decryptData.key == null || decryptData.method !== 'AES-128') {\n this._parseVTTs(frag, payload);\n }\n } else {\n // In case there is no payload, finish unsuccessfully.\n this.hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n }\n }\n };\n\n _proto._parseVTTs = function _parseVTTs(frag, payload) {\n var _this4 = this;\n\n var hls = this.hls,\n prevCC = this.prevCC,\n textTracks = this.textTracks,\n vttCCs = this.vttCCs;\n\n if (!vttCCs[frag.cc]) {\n vttCCs[frag.cc] = {\n start: frag.start,\n prevCC: prevCC,\n new: true\n };\n this.prevCC = frag.cc;\n } // Parse the WebVTT file contents.\n\n\n webvtt_parser.parse(payload, this.initPTS[frag.cc], vttCCs, frag.cc, function (cues) {\n if (_this4.config.renderTextTracksNatively) {\n var currentTrack = textTracks[frag.level]; // WebVTTParser.parse is an async method and if the currently selected text track mode is set to \"disabled\"\n // before parsing is done then don't try to access currentTrack.cues.getCueById as cues will be null\n // and trying to access getCueById method of cues will throw an exception\n // Because we check if the mode is diabled, we can force check `cues` below. They can't be null.\n\n if (currentTrack.mode === 'disabled') {\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n return;\n } // Add cues and trigger event with success true.\n\n\n cues.forEach(function (cue) {\n // Sometimes there are cue overlaps on segmented vtts so the same\n // cue can appear more than once in different vtt files.\n // This avoid showing duplicated cues with same timecode and text.\n if (!currentTrack.cues.getCueById(cue.id)) {\n try {\n currentTrack.addCue(cue);\n\n if (!currentTrack.cues.getCueById(cue.id)) {\n throw new Error(\"addCue is failed for: \" + cue);\n }\n } catch (err) {\n logger[\"logger\"].debug(\"Failed occurred on adding cues: \" + err);\n var textTrackCue = new window.TextTrackCue(cue.startTime, cue.endTime, cue.text);\n textTrackCue.id = cue.id;\n currentTrack.addCue(textTrackCue);\n }\n }\n });\n } else {\n var trackId = _this4.tracks[frag.level].default ? 'default' : 'subtitles' + frag.level;\n hls.trigger(events[\"default\"].CUES_PARSED, {\n type: 'subtitles',\n cues: cues,\n track: trackId\n });\n }\n\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: true,\n frag: frag\n });\n }, function (e) {\n // Something went wrong while parsing. Trigger event with success false.\n logger[\"logger\"].log(\"Failed to parse VTT cue: \" + e);\n hls.trigger(events[\"default\"].SUBTITLE_FRAG_PROCESSED, {\n success: false,\n frag: frag\n });\n });\n };\n\n _proto.onFragDecrypted = function onFragDecrypted(data) {\n var frag = data.frag,\n payload = data.payload;\n\n if (frag.type === 'subtitle') {\n if (!Object(number[\"isFiniteNumber\"])(this.initPTS[frag.cc])) {\n this.unparsedVttFrags.push(data);\n return;\n }\n\n this._parseVTTs(frag, payload);\n }\n };\n\n _proto.onFragParsingUserdata = function onFragParsingUserdata(data) {\n var cea608Parser1 = this.cea608Parser1,\n cea608Parser2 = this.cea608Parser2;\n\n if (!this.enabled || !(cea608Parser1 && cea608Parser2)) {\n return;\n } // If the event contains captions (found in the bytes property), push all bytes into the parser immediately\n // It will create the proper timestamps based on the PTS value\n\n\n for (var i = 0; i < data.samples.length; i++) {\n var ccBytes = data.samples[i].bytes;\n\n if (ccBytes) {\n var ccdatas = this.extractCea608Data(ccBytes);\n cea608Parser1.addData(data.samples[i].pts, ccdatas[0]);\n cea608Parser2.addData(data.samples[i].pts, ccdatas[1]);\n }\n }\n };\n\n _proto.extractCea608Data = function extractCea608Data(byteArray) {\n var count = byteArray[0] & 31;\n var position = 2;\n var actualCCBytes = [[], []];\n\n for (var j = 0; j < count; j++) {\n var tmpByte = byteArray[position++];\n var ccbyte1 = 0x7F & byteArray[position++];\n var ccbyte2 = 0x7F & byteArray[position++];\n var ccValid = (4 & tmpByte) !== 0;\n var ccType = 3 & tmpByte;\n\n if (ccbyte1 === 0 && ccbyte2 === 0) {\n continue;\n }\n\n if (ccValid) {\n if (ccType === 0 || ccType === 1) {\n actualCCBytes[ccType].push(ccbyte1);\n actualCCBytes[ccType].push(ccbyte2);\n }\n }\n }\n\n return actualCCBytes;\n };\n\n return TimelineController;\n}(event_handler);\n\nfunction canReuseVttTextTrack(inUseTrack, manifestTrack) {\n return inUseTrack && inUseTrack.label === manifestTrack.name && !(inUseTrack.textTrack1 || inUseTrack.textTrack2);\n}\n\nfunction intersection(x1, x2, y1, y2) {\n return Math.min(x2, y2) - Math.max(x1, y1);\n}\n\nfunction newVTTCCs() {\n return {\n ccOffset: 0,\n presentationOffset: 0,\n 0: {\n start: 0,\n prevCC: -1,\n new: false\n }\n };\n}\n\n/* harmony default export */ var timeline_controller = (timeline_controller_TimelineController);\n// CONCATENATED MODULE: ./src/controller/subtitle-track-controller.js\n\n\n\n\nfunction subtitle_track_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction subtitle_track_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) subtitle_track_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) subtitle_track_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction subtitle_track_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\nvar subtitle_track_controller_SubtitleTrackController = /*#__PURE__*/function (_EventHandler) {\n subtitle_track_controller_inheritsLoose(SubtitleTrackController, _EventHandler);\n\n function SubtitleTrackController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].MANIFEST_LOADED, events[\"default\"].SUBTITLE_TRACK_LOADED) || this;\n _this.tracks = [];\n _this.trackId = -1;\n _this.media = null;\n _this.stopped = true;\n /**\n * @member {boolean} subtitleDisplay Enable/disable subtitle display rendering\n */\n\n _this.subtitleDisplay = true;\n /**\n * Keeps reference to a default track id when media has not been attached yet\n * @member {number}\n */\n\n _this.queuedDefaultTrack = null;\n return _this;\n }\n\n var _proto = SubtitleTrackController.prototype;\n\n _proto.destroy = function destroy() {\n event_handler.prototype.destroy.call(this);\n } // Listen for subtitle track change, then extract the current track ID.\n ;\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n var _this2 = this;\n\n this.media = data.media;\n\n if (!this.media) {\n return;\n }\n\n if (Object(number[\"isFiniteNumber\"])(this.queuedDefaultTrack)) {\n this.subtitleTrack = this.queuedDefaultTrack;\n this.queuedDefaultTrack = null;\n }\n\n this.trackChangeListener = this._onTextTracksChanged.bind(this);\n this.useTextTrackPolling = !(this.media.textTracks && 'onchange' in this.media.textTracks);\n\n if (this.useTextTrackPolling) {\n this.subtitlePollingInterval = setInterval(function () {\n _this2.trackChangeListener();\n }, 500);\n } else {\n this.media.textTracks.addEventListener('change', this.trackChangeListener);\n }\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n if (!this.media) {\n return;\n }\n\n if (this.useTextTrackPolling) {\n clearInterval(this.subtitlePollingInterval);\n } else {\n this.media.textTracks.removeEventListener('change', this.trackChangeListener);\n }\n\n if (Object(number[\"isFiniteNumber\"])(this.subtitleTrack)) {\n this.queuedDefaultTrack = this.subtitleTrack;\n }\n\n var textTracks = filterSubtitleTracks(this.media.textTracks); // Clear loaded cues on media detachment from tracks\n\n textTracks.forEach(function (track) {\n clearCurrentCues(track);\n }); // Disable all subtitle tracks before detachment so when reattached only tracks in that content are enabled.\n\n this.subtitleTrack = -1;\n this.media = null;\n } // Fired whenever a new manifest is loaded.\n ;\n\n _proto.onManifestLoaded = function onManifestLoaded(data) {\n var _this3 = this;\n\n var tracks = data.subtitles || [];\n this.tracks = tracks;\n this.hls.trigger(events[\"default\"].SUBTITLE_TRACKS_UPDATED, {\n subtitleTracks: tracks\n }); // loop through available subtitle tracks and autoselect default if needed\n // TODO: improve selection logic to handle forced, etc\n\n tracks.forEach(function (track) {\n if (track.default) {\n // setting this.subtitleTrack will trigger internal logic\n // if media has not been attached yet, it will fail\n // we keep a reference to the default track id\n // and we'll set subtitleTrack when onMediaAttached is triggered\n if (_this3.media) {\n _this3.subtitleTrack = track.id;\n } else {\n _this3.queuedDefaultTrack = track.id;\n }\n }\n });\n };\n\n _proto.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var _this4 = this;\n\n var id = data.id,\n details = data.details;\n var trackId = this.trackId,\n tracks = this.tracks;\n var currentTrack = tracks[trackId];\n\n if (id >= tracks.length || id !== trackId || !currentTrack || this.stopped) {\n this._clearReloadTimer();\n\n return;\n }\n\n logger[\"logger\"].log(\"subtitle track \" + id + \" loaded\");\n\n if (details.live) {\n var reloadInterval = computeReloadInterval(currentTrack.details, details, data.stats.trequest);\n logger[\"logger\"].log(\"Reloading live subtitle playlist in \" + reloadInterval + \"ms\");\n this.timer = setTimeout(function () {\n _this4._loadCurrentTrack();\n }, reloadInterval);\n } else {\n this._clearReloadTimer();\n }\n };\n\n _proto.startLoad = function startLoad() {\n this.stopped = false;\n\n this._loadCurrentTrack();\n };\n\n _proto.stopLoad = function stopLoad() {\n this.stopped = true;\n\n this._clearReloadTimer();\n }\n /** get alternate subtitle tracks list from playlist **/\n ;\n\n _proto._clearReloadTimer = function _clearReloadTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n };\n\n _proto._loadCurrentTrack = function _loadCurrentTrack() {\n var trackId = this.trackId,\n tracks = this.tracks,\n hls = this.hls;\n var currentTrack = tracks[trackId];\n\n if (trackId < 0 || !currentTrack || currentTrack.details && !currentTrack.details.live) {\n return;\n }\n\n logger[\"logger\"].log(\"Loading subtitle track \" + trackId);\n hls.trigger(events[\"default\"].SUBTITLE_TRACK_LOADING, {\n url: currentTrack.url,\n id: trackId\n });\n }\n /**\n * Disables the old subtitleTrack and sets current mode on the next subtitleTrack.\n * This operates on the DOM textTracks.\n * A value of -1 will disable all subtitle tracks.\n * @param newId - The id of the next track to enable\n * @private\n */\n ;\n\n _proto._toggleTrackModes = function _toggleTrackModes(newId) {\n var media = this.media,\n subtitleDisplay = this.subtitleDisplay,\n trackId = this.trackId;\n\n if (!media) {\n return;\n }\n\n var textTracks = filterSubtitleTracks(media.textTracks);\n\n if (newId === -1) {\n [].slice.call(textTracks).forEach(function (track) {\n track.mode = 'disabled';\n });\n } else {\n var oldTrack = textTracks[trackId];\n\n if (oldTrack) {\n oldTrack.mode = 'disabled';\n }\n }\n\n var nextTrack = textTracks[newId];\n\n if (nextTrack) {\n nextTrack.mode = subtitleDisplay ? 'showing' : 'hidden';\n }\n }\n /**\n * This method is responsible for validating the subtitle index and periodically reloading if live.\n * Dispatches the SUBTITLE_TRACK_SWITCH event, which instructs the subtitle-stream-controller to load the selected track.\n * @param newId - The id of the subtitle track to activate.\n */\n ;\n\n _proto._setSubtitleTrackInternal = function _setSubtitleTrackInternal(newId) {\n var hls = this.hls,\n tracks = this.tracks;\n\n if (!Object(number[\"isFiniteNumber\"])(newId) || newId < -1 || newId >= tracks.length) {\n return;\n }\n\n this.trackId = newId;\n logger[\"logger\"].log(\"Switching to subtitle track \" + newId);\n hls.trigger(events[\"default\"].SUBTITLE_TRACK_SWITCH, {\n id: newId\n });\n\n this._loadCurrentTrack();\n };\n\n _proto._onTextTracksChanged = function _onTextTracksChanged() {\n // Media is undefined when switching streams via loadSource()\n if (!this.media || !this.hls.config.renderTextTracksNatively) {\n return;\n }\n\n var trackId = -1;\n var tracks = filterSubtitleTracks(this.media.textTracks);\n\n for (var id = 0; id < tracks.length; id++) {\n if (tracks[id].mode === 'hidden') {\n // Do not break in case there is a following track with showing.\n trackId = id;\n } else if (tracks[id].mode === 'showing') {\n trackId = id;\n break;\n }\n } // Setting current subtitleTrack will invoke code.\n\n\n this.subtitleTrack = trackId;\n };\n\n subtitle_track_controller_createClass(SubtitleTrackController, [{\n key: \"subtitleTracks\",\n get: function get() {\n return this.tracks;\n }\n /** get index of the selected subtitle track (index in subtitle track lists) **/\n\n }, {\n key: \"subtitleTrack\",\n get: function get() {\n return this.trackId;\n }\n /** select a subtitle track, based on its index in subtitle track lists**/\n ,\n set: function set(subtitleTrackId) {\n if (this.trackId !== subtitleTrackId) {\n this._toggleTrackModes(subtitleTrackId);\n\n this._setSubtitleTrackInternal(subtitleTrackId);\n }\n }\n }]);\n\n return SubtitleTrackController;\n}(event_handler);\n\nfunction filterSubtitleTracks(textTrackList) {\n var tracks = [];\n\n for (var i = 0; i < textTrackList.length; i++) {\n var track = textTrackList[i]; // Edge adds a track without a label; we don't want to use it\n\n if (track.kind === 'subtitles' && track.label) {\n tracks.push(textTrackList[i]);\n }\n }\n\n return tracks;\n}\n\n/* harmony default export */ var subtitle_track_controller = (subtitle_track_controller_SubtitleTrackController);\n// EXTERNAL MODULE: ./src/crypt/decrypter.js + 3 modules\nvar decrypter = __webpack_require__(\"./src/crypt/decrypter.js\");\n\n// CONCATENATED MODULE: ./src/controller/subtitle-stream-controller.js\nfunction subtitle_stream_controller_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction subtitle_stream_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * @class SubtitleStreamController\n */\n\n\n\n\n\n\n\n\nvar subtitle_stream_controller_window = window,\n subtitle_stream_controller_performance = subtitle_stream_controller_window.performance;\nvar subtitle_stream_controller_TICK_INTERVAL = 500; // how often to tick in ms\n\nvar subtitle_stream_controller_SubtitleStreamController = /*#__PURE__*/function (_BaseStreamController) {\n subtitle_stream_controller_inheritsLoose(SubtitleStreamController, _BaseStreamController);\n\n function SubtitleStreamController(hls, fragmentTracker) {\n var _this;\n\n _this = _BaseStreamController.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHING, events[\"default\"].ERROR, events[\"default\"].KEY_LOADED, events[\"default\"].FRAG_LOADED, events[\"default\"].SUBTITLE_TRACKS_UPDATED, events[\"default\"].SUBTITLE_TRACK_SWITCH, events[\"default\"].SUBTITLE_TRACK_LOADED, events[\"default\"].SUBTITLE_FRAG_PROCESSED, events[\"default\"].LEVEL_UPDATED) || this;\n _this.fragmentTracker = fragmentTracker;\n _this.config = hls.config;\n _this.state = State.STOPPED;\n _this.tracks = [];\n _this.tracksBuffered = [];\n _this.currentTrackId = -1;\n _this.decrypter = new decrypter[\"default\"](hls, hls.config); // lastAVStart stores the time in seconds for the start time of a level load\n\n _this.lastAVStart = 0;\n _this._onMediaSeeking = _this.onMediaSeeking.bind(subtitle_stream_controller_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = SubtitleStreamController.prototype;\n\n _proto.startLoad = function startLoad() {\n this.stopLoad();\n this.state = State.IDLE; // Check if we already have a track with necessary details to load fragments\n\n var currentTrack = this.tracks[this.currentTrackId];\n\n if (currentTrack && currentTrack.details) {\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n this.tick();\n }\n };\n\n _proto.onSubtitleFragProcessed = function onSubtitleFragProcessed(data) {\n var frag = data.frag,\n success = data.success;\n this.fragPrevious = frag;\n this.state = State.IDLE;\n\n if (!success) {\n return;\n }\n\n var buffered = this.tracksBuffered[this.currentTrackId];\n\n if (!buffered) {\n return;\n } // Create/update a buffered array matching the interface used by BufferHelper.bufferedInfo\n // so we can re-use the logic used to detect how much have been buffered\n\n\n var timeRange;\n var fragStart = frag.start;\n\n for (var i = 0; i < buffered.length; i++) {\n if (fragStart >= buffered[i].start && fragStart <= buffered[i].end) {\n timeRange = buffered[i];\n break;\n }\n }\n\n var fragEnd = frag.start + frag.duration;\n\n if (timeRange) {\n timeRange.end = fragEnd;\n } else {\n timeRange = {\n start: fragStart,\n end: fragEnd\n };\n buffered.push(timeRange);\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(_ref) {\n var media = _ref.media;\n this.media = media;\n media.addEventListener('seeking', this._onMediaSeeking);\n this.state = State.IDLE;\n };\n\n _proto.onMediaDetaching = function onMediaDetaching() {\n var _this2 = this;\n\n if (!this.media) {\n return;\n }\n\n this.media.removeEventListener('seeking', this._onMediaSeeking);\n this.fragmentTracker.removeAllFragments();\n this.currentTrackId = -1;\n this.tracks.forEach(function (track) {\n _this2.tracksBuffered[track.id] = [];\n });\n this.media = null;\n this.state = State.STOPPED;\n } // If something goes wrong, proceed to next frag, if we were processing one.\n ;\n\n _proto.onError = function onError(data) {\n var frag = data.frag; // don't handle error not related to subtitle fragment\n\n if (!frag || frag.type !== 'subtitle') {\n return;\n }\n\n if (this.fragCurrent && this.fragCurrent.loader) {\n this.fragCurrent.loader.abort();\n }\n\n this.state = State.IDLE;\n } // Got all new subtitle tracks.\n ;\n\n _proto.onSubtitleTracksUpdated = function onSubtitleTracksUpdated(data) {\n var _this3 = this;\n\n logger[\"logger\"].log('subtitle tracks updated');\n this.tracksBuffered = [];\n this.tracks = data.subtitleTracks;\n this.tracks.forEach(function (track) {\n _this3.tracksBuffered[track.id] = [];\n });\n };\n\n _proto.onSubtitleTrackSwitch = function onSubtitleTrackSwitch(data) {\n this.currentTrackId = data.id;\n\n if (!this.tracks || !this.tracks.length || this.currentTrackId === -1) {\n this.clearInterval();\n return;\n } // Check if track has the necessary details to load fragments\n\n\n var currentTrack = this.tracks[this.currentTrackId];\n\n if (currentTrack && currentTrack.details) {\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n }\n } // Got a new set of subtitle fragments.\n ;\n\n _proto.onSubtitleTrackLoaded = function onSubtitleTrackLoaded(data) {\n var id = data.id,\n details = data.details;\n var currentTrackId = this.currentTrackId,\n tracks = this.tracks;\n var currentTrack = tracks[currentTrackId];\n\n if (id >= tracks.length || id !== currentTrackId || !currentTrack) {\n return;\n }\n\n if (details.live) {\n mergeSubtitlePlaylists(currentTrack.details, details, this.lastAVStart);\n }\n\n currentTrack.details = details;\n this.setInterval(subtitle_stream_controller_TICK_INTERVAL);\n };\n\n _proto.onKeyLoaded = function onKeyLoaded() {\n if (this.state === State.KEY_LOADING) {\n this.state = State.IDLE;\n }\n };\n\n _proto.onFragLoaded = function onFragLoaded(data) {\n var fragCurrent = this.fragCurrent;\n var decryptData = data.frag.decryptdata;\n var fragLoaded = data.frag;\n var hls = this.hls;\n\n if (this.state === State.FRAG_LOADING && fragCurrent && data.frag.type === 'subtitle' && fragCurrent.sn === data.frag.sn) {\n // check to see if the payload needs to be decrypted\n if (data.payload.byteLength > 0 && decryptData && decryptData.key && decryptData.method === 'AES-128') {\n var startTime = subtitle_stream_controller_performance.now(); // decrypt the subtitles\n\n this.decrypter.decrypt(data.payload, decryptData.key.buffer, decryptData.iv.buffer, function (decryptedData) {\n var endTime = subtitle_stream_controller_performance.now();\n hls.trigger(events[\"default\"].FRAG_DECRYPTED, {\n frag: fragLoaded,\n payload: decryptedData,\n stats: {\n tstart: startTime,\n tdecrypt: endTime\n }\n });\n });\n }\n }\n };\n\n _proto.onLevelUpdated = function onLevelUpdated(_ref2) {\n var details = _ref2.details;\n var frags = details.fragments;\n this.lastAVStart = frags.length ? frags[0].start : 0;\n };\n\n _proto.doTick = function doTick() {\n if (!this.media) {\n this.state = State.IDLE;\n return;\n }\n\n switch (this.state) {\n case State.IDLE:\n {\n var config = this.config,\n currentTrackId = this.currentTrackId,\n fragmentTracker = this.fragmentTracker,\n media = this.media,\n tracks = this.tracks;\n\n if (!tracks || !tracks[currentTrackId] || !tracks[currentTrackId].details) {\n break;\n }\n\n var maxBufferHole = config.maxBufferHole,\n maxFragLookUpTolerance = config.maxFragLookUpTolerance;\n var maxConfigBuffer = Math.min(config.maxBufferLength, config.maxMaxBufferLength);\n var bufferedInfo = BufferHelper.bufferedInfo(this._getBuffered(), media.currentTime, maxBufferHole);\n var bufferEnd = bufferedInfo.end,\n bufferLen = bufferedInfo.len;\n var trackDetails = tracks[currentTrackId].details;\n var fragments = trackDetails.fragments;\n var fragLen = fragments.length;\n var end = fragments[fragLen - 1].start + fragments[fragLen - 1].duration;\n\n if (bufferLen > maxConfigBuffer) {\n return;\n }\n\n var foundFrag;\n var fragPrevious = this.fragPrevious;\n\n if (bufferEnd < end) {\n if (fragPrevious && trackDetails.hasProgramDateTime) {\n foundFrag = findFragmentByPDT(fragments, fragPrevious.endProgramDateTime, maxFragLookUpTolerance);\n }\n\n if (!foundFrag) {\n foundFrag = findFragmentByPTS(fragPrevious, fragments, bufferEnd, maxFragLookUpTolerance);\n }\n } else {\n foundFrag = fragments[fragLen - 1];\n }\n\n if (foundFrag && foundFrag.encrypted) {\n logger[\"logger\"].log(\"Loading key for \" + foundFrag.sn);\n this.state = State.KEY_LOADING;\n this.hls.trigger(events[\"default\"].KEY_LOADING, {\n frag: foundFrag\n });\n } else if (foundFrag && fragmentTracker.getState(foundFrag) === FragmentState.NOT_LOADED) {\n // only load if fragment is not loaded\n this.fragCurrent = foundFrag;\n this.state = State.FRAG_LOADING;\n this.hls.trigger(events[\"default\"].FRAG_LOADING, {\n frag: foundFrag\n });\n }\n }\n }\n };\n\n _proto.stopLoad = function stopLoad() {\n this.lastAVStart = 0;\n this.fragPrevious = null;\n\n _BaseStreamController.prototype.stopLoad.call(this);\n };\n\n _proto._getBuffered = function _getBuffered() {\n return this.tracksBuffered[this.currentTrackId] || [];\n };\n\n _proto.onMediaSeeking = function onMediaSeeking() {\n if (this.fragCurrent) {\n var currentTime = this.media ? this.media.currentTime : 0;\n var tolerance = this.config.maxFragLookUpTolerance;\n var fragStartOffset = this.fragCurrent.start - tolerance;\n var fragEndOffset = this.fragCurrent.start + this.fragCurrent.duration + tolerance; // check if position will be out of currently loaded frag range after seeking : if out, cancel frag load, if in, don't do anything\n\n if (currentTime < fragStartOffset || currentTime > fragEndOffset) {\n if (this.fragCurrent.loader) {\n this.fragCurrent.loader.abort();\n }\n\n this.fragmentTracker.removeFragment(this.fragCurrent);\n this.fragCurrent = null;\n this.fragPrevious = null; // switch to IDLE state to load new fragment\n\n this.state = State.IDLE; // speed up things\n\n this.tick();\n }\n }\n };\n\n return SubtitleStreamController;\n}(base_stream_controller_BaseStreamController);\n// CONCATENATED MODULE: ./src/utils/mediakeys-helper.ts\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMediaKeySystemAccess\n */\nvar KeySystems;\n\n(function (KeySystems) {\n KeySystems[\"WIDEVINE\"] = \"com.widevine.alpha\";\n KeySystems[\"PLAYREADY\"] = \"com.microsoft.playready\";\n})(KeySystems || (KeySystems = {}));\n\nvar requestMediaKeySystemAccess = function () {\n if (typeof window !== 'undefined' && window.navigator && window.navigator.requestMediaKeySystemAccess) {\n return window.navigator.requestMediaKeySystemAccess.bind(window.navigator);\n } else {\n return null;\n }\n}();\n\n\n// CONCATENATED MODULE: ./src/controller/eme-controller.ts\nfunction eme_controller_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction eme_controller_createClass(Constructor, protoProps, staticProps) { if (protoProps) eme_controller_defineProperties(Constructor.prototype, protoProps); if (staticProps) eme_controller_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction eme_controller_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n/**\n * @author Stephan Hesse <disparat@gmail.com> | <tchakabam@gmail.com>\n *\n * DRM support for Hls.js\n */\n\n\n\n\n\nvar MAX_LICENSE_REQUEST_FAILURES = 3;\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemConfiguration\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @param {object} drmSystemOptions Optional parameters/requirements for the key-system\n * @returns {Array<MediaSystemConfiguration>} An array of supported configurations\n */\n\nvar createWidevineMediaKeySystemConfigurations = function createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs, drmSystemOptions) {\n /* jshint ignore:line */\n var baseConfig = {\n // initDataTypes: ['keyids', 'mp4'],\n // label: \"\",\n // persistentState: \"not-allowed\", // or \"required\" ?\n // distinctiveIdentifier: \"not-allowed\", // or \"required\" ?\n // sessionTypes: ['temporary'],\n audioCapabilities: [],\n // { contentType: 'audio/mp4; codecs=\"mp4a.40.2\"' }\n videoCapabilities: [] // { contentType: 'video/mp4; codecs=\"avc1.42E01E\"' }\n\n };\n audioCodecs.forEach(function (codec) {\n baseConfig.audioCapabilities.push({\n contentType: \"audio/mp4; codecs=\\\"\" + codec + \"\\\"\",\n robustness: drmSystemOptions.audioRobustness || ''\n });\n });\n videoCodecs.forEach(function (codec) {\n baseConfig.videoCapabilities.push({\n contentType: \"video/mp4; codecs=\\\"\" + codec + \"\\\"\",\n robustness: drmSystemOptions.videoRobustness || ''\n });\n });\n return [baseConfig];\n};\n/**\n * The idea here is to handle key-system (and their respective platforms) specific configuration differences\n * in order to work with the local requestMediaKeySystemAccess method.\n *\n * We can also rule-out platform-related key-system support at this point by throwing an error.\n *\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @throws will throw an error if a unknown key system is passed\n * @returns {Array<MediaSystemConfiguration>} A non-empty Array of MediaKeySystemConfiguration objects\n */\n\n\nvar eme_controller_getSupportedMediaKeySystemConfigurations = function getSupportedMediaKeySystemConfigurations(keySystem, audioCodecs, videoCodecs, drmSystemOptions) {\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n return createWidevineMediaKeySystemConfigurations(audioCodecs, videoCodecs, drmSystemOptions);\n\n default:\n throw new Error(\"Unknown key-system: \" + keySystem);\n }\n};\n\n/**\n * Controller to deal with encrypted media extensions (EME)\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API\n *\n * @class\n * @constructor\n */\nvar eme_controller_EMEController = /*#__PURE__*/function (_EventHandler) {\n eme_controller_inheritsLoose(EMEController, _EventHandler);\n\n /**\n * @constructs\n * @param {Hls} hls Our Hls.js instance\n */\n function EMEController(hls) {\n var _this;\n\n _this = _EventHandler.call(this, hls, events[\"default\"].MEDIA_ATTACHED, events[\"default\"].MEDIA_DETACHED, events[\"default\"].MANIFEST_PARSED) || this;\n _this._widevineLicenseUrl = void 0;\n _this._licenseXhrSetup = void 0;\n _this._emeEnabled = void 0;\n _this._requestMediaKeySystemAccess = void 0;\n _this._drmSystemOptions = void 0;\n _this._config = void 0;\n _this._mediaKeysList = [];\n _this._media = null;\n _this._hasSetMediaKeys = false;\n _this._requestLicenseFailureCount = 0;\n _this.mediaKeysPromise = null;\n\n _this._onMediaEncrypted = function (e) {\n logger[\"logger\"].log(\"Media is encrypted using \\\"\" + e.initDataType + \"\\\" init data type\");\n\n if (!_this.mediaKeysPromise) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no CDM access or no keys have been requested');\n\n _this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_KEYS,\n fatal: true\n });\n\n return;\n }\n\n var finallySetKeyAndStartSession = function finallySetKeyAndStartSession(mediaKeys) {\n if (!_this._media) {\n return;\n }\n\n _this._attemptSetMediaKeys(mediaKeys);\n\n _this._generateRequestWithPreferredKeySession(e.initDataType, e.initData);\n }; // Could use `Promise.finally` but some Promise polyfills are missing it\n\n\n _this.mediaKeysPromise.then(finallySetKeyAndStartSession).catch(finallySetKeyAndStartSession);\n };\n\n _this._config = hls.config;\n _this._widevineLicenseUrl = _this._config.widevineLicenseUrl;\n _this._licenseXhrSetup = _this._config.licenseXhrSetup;\n _this._emeEnabled = _this._config.emeEnabled;\n _this._requestMediaKeySystemAccess = _this._config.requestMediaKeySystemAccessFunc;\n _this._drmSystemOptions = hls.config.drmSystemOptions;\n return _this;\n }\n /**\n * @param {string} keySystem Identifier for the key-system, see `KeySystems` enum\n * @returns {string} License server URL for key-system (if any configured, otherwise causes error)\n * @throws if a unsupported keysystem is passed\n */\n\n\n var _proto = EMEController.prototype;\n\n _proto.getLicenseServerUrl = function getLicenseServerUrl(keySystem) {\n switch (keySystem) {\n case KeySystems.WIDEVINE:\n if (!this._widevineLicenseUrl) {\n break;\n }\n\n return this._widevineLicenseUrl;\n }\n\n throw new Error(\"no license server URL configured for key-system \\\"\" + keySystem + \"\\\"\");\n }\n /**\n * Requests access object and adds it to our list upon success\n * @private\n * @param {string} keySystem System ID (see `KeySystems`)\n * @param {Array<string>} audioCodecs List of required audio codecs to support\n * @param {Array<string>} videoCodecs List of required video codecs to support\n * @throws When a unsupported KeySystem is passed\n */\n ;\n\n _proto._attemptKeySystemAccess = function _attemptKeySystemAccess(keySystem, audioCodecs, videoCodecs) {\n var _this2 = this;\n\n // This can throw, but is caught in event handler callpath\n var mediaKeySystemConfigs = eme_controller_getSupportedMediaKeySystemConfigurations(keySystem, audioCodecs, videoCodecs, this._drmSystemOptions);\n logger[\"logger\"].log('Requesting encrypted media key-system access'); // expecting interface like window.navigator.requestMediaKeySystemAccess\n\n var keySystemAccessPromise = this.requestMediaKeySystemAccess(keySystem, mediaKeySystemConfigs);\n this.mediaKeysPromise = keySystemAccessPromise.then(function (mediaKeySystemAccess) {\n return _this2._onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess);\n });\n keySystemAccessPromise.catch(function (err) {\n logger[\"logger\"].error(\"Failed to obtain key-system \\\"\" + keySystem + \"\\\" access:\", err);\n });\n };\n\n /**\n * Handles obtaining access to a key-system\n * @private\n * @param {string} keySystem\n * @param {MediaKeySystemAccess} mediaKeySystemAccess https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySystemAccess\n */\n _proto._onMediaKeySystemAccessObtained = function _onMediaKeySystemAccessObtained(keySystem, mediaKeySystemAccess) {\n var _this3 = this;\n\n logger[\"logger\"].log(\"Access for key-system \\\"\" + keySystem + \"\\\" obtained\");\n var mediaKeysListItem = {\n mediaKeysSessionInitialized: false,\n mediaKeySystemAccess: mediaKeySystemAccess,\n mediaKeySystemDomain: keySystem\n };\n\n this._mediaKeysList.push(mediaKeysListItem);\n\n var mediaKeysPromise = Promise.resolve().then(function () {\n return mediaKeySystemAccess.createMediaKeys();\n }).then(function (mediaKeys) {\n mediaKeysListItem.mediaKeys = mediaKeys;\n logger[\"logger\"].log(\"Media-keys created for key-system \\\"\" + keySystem + \"\\\"\");\n\n _this3._onMediaKeysCreated();\n\n return mediaKeys;\n });\n mediaKeysPromise.catch(function (err) {\n logger[\"logger\"].error('Failed to create media-keys:', err);\n });\n return mediaKeysPromise;\n }\n /**\n * Handles key-creation (represents access to CDM). We are going to create key-sessions upon this\n * for all existing keys where no session exists yet.\n *\n * @private\n */\n ;\n\n _proto._onMediaKeysCreated = function _onMediaKeysCreated() {\n var _this4 = this;\n\n // check for all key-list items if a session exists, otherwise, create one\n this._mediaKeysList.forEach(function (mediaKeysListItem) {\n if (!mediaKeysListItem.mediaKeysSession) {\n // mediaKeys is definitely initialized here\n mediaKeysListItem.mediaKeysSession = mediaKeysListItem.mediaKeys.createSession();\n\n _this4._onNewMediaKeySession(mediaKeysListItem.mediaKeysSession);\n }\n });\n }\n /**\n * @private\n * @param {*} keySession\n */\n ;\n\n _proto._onNewMediaKeySession = function _onNewMediaKeySession(keySession) {\n var _this5 = this;\n\n logger[\"logger\"].log(\"New key-system session \" + keySession.sessionId);\n keySession.addEventListener('message', function (event) {\n _this5._onKeySessionMessage(keySession, event.message);\n }, false);\n }\n /**\n * @private\n * @param {MediaKeySession} keySession\n * @param {ArrayBuffer} message\n */\n ;\n\n _proto._onKeySessionMessage = function _onKeySessionMessage(keySession, message) {\n logger[\"logger\"].log('Got EME message event, creating license request');\n\n this._requestLicense(message, function (data) {\n logger[\"logger\"].log(\"Received license data (length: \" + (data ? data.byteLength : data) + \"), updating key-session\");\n keySession.update(data);\n });\n }\n /**\n * @private\n * @param e {MediaEncryptedEvent}\n */\n ;\n\n /**\n * @private\n */\n _proto._attemptSetMediaKeys = function _attemptSetMediaKeys(mediaKeys) {\n if (!this._media) {\n throw new Error('Attempted to set mediaKeys without first attaching a media element');\n }\n\n if (!this._hasSetMediaKeys) {\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem || !keysListItem.mediaKeys) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no CDM access or no keys have been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_KEYS,\n fatal: true\n });\n return;\n }\n\n logger[\"logger\"].log('Setting keys for encrypted media');\n\n this._media.setMediaKeys(keysListItem.mediaKeys);\n\n this._hasSetMediaKeys = true;\n }\n }\n /**\n * @private\n */\n ;\n\n _proto._generateRequestWithPreferredKeySession = function _generateRequestWithPreferredKeySession(initDataType, initData) {\n var _this6 = this;\n\n // FIXME: see if we can/want/need-to really to deal with several potential key-sessions?\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem) {\n logger[\"logger\"].error('Fatal: Media is encrypted but not any key-system access has been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n\n if (keysListItem.mediaKeysSessionInitialized) {\n logger[\"logger\"].warn('Key-Session already initialized but requested again');\n return;\n }\n\n var keySession = keysListItem.mediaKeysSession;\n\n if (!keySession) {\n logger[\"logger\"].error('Fatal: Media is encrypted but no key-session existing');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_SESSION,\n fatal: true\n });\n return;\n } // initData is null if the media is not CORS-same-origin\n\n\n if (!initData) {\n logger[\"logger\"].warn('Fatal: initData required for generating a key session is null');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_INIT_DATA,\n fatal: true\n });\n return;\n }\n\n logger[\"logger\"].log(\"Generating key-session request for \\\"\" + initDataType + \"\\\" init data type\");\n keysListItem.mediaKeysSessionInitialized = true;\n keySession.generateRequest(initDataType, initData).then(function () {\n logger[\"logger\"].debug('Key-session generation succeeded');\n }).catch(function (err) {\n logger[\"logger\"].error('Error generating key-session request:', err);\n\n _this6.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_SESSION,\n fatal: false\n });\n });\n }\n /**\n * @private\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n * @returns {XMLHttpRequest} Unsent (but opened state) XHR object\n * @throws if XMLHttpRequest construction failed\n */\n ;\n\n _proto._createLicenseXhr = function _createLicenseXhr(url, keyMessage, callback) {\n var xhr = new XMLHttpRequest();\n var licenseXhrSetup = this._licenseXhrSetup;\n\n try {\n if (licenseXhrSetup) {\n try {\n licenseXhrSetup(xhr, url);\n } catch (e) {\n // let's try to open before running setup\n xhr.open('POST', url, true);\n licenseXhrSetup(xhr, url);\n }\n } // if licenseXhrSetup did not yet call open, let's do it now\n\n\n if (!xhr.readyState) {\n xhr.open('POST', url, true);\n }\n } catch (e) {\n // IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS\n throw new Error(\"issue setting up KeySystem license XHR \" + e);\n } // Because we set responseType to ArrayBuffer here, callback is typed as handling only array buffers\n\n\n xhr.responseType = 'arraybuffer';\n xhr.onreadystatechange = this._onLicenseRequestReadyStageChange.bind(this, xhr, url, keyMessage, callback);\n return xhr;\n }\n /**\n * @private\n * @param {XMLHttpRequest} xhr\n * @param {string} url License server URL\n * @param {ArrayBuffer} keyMessage Message data issued by key-system\n * @param {function} callback Called when XHR has succeeded\n */\n ;\n\n _proto._onLicenseRequestReadyStageChange = function _onLicenseRequestReadyStageChange(xhr, url, keyMessage, callback) {\n switch (xhr.readyState) {\n case 4:\n if (xhr.status === 200) {\n this._requestLicenseFailureCount = 0;\n logger[\"logger\"].log('License request succeeded');\n\n if (xhr.responseType !== 'arraybuffer') {\n logger[\"logger\"].warn('xhr response type was not set to the expected arraybuffer for license request');\n }\n\n callback(xhr.response);\n } else {\n logger[\"logger\"].error(\"License Request XHR failed (\" + url + \"). Status: \" + xhr.status + \" (\" + xhr.statusText + \")\");\n this._requestLicenseFailureCount++;\n\n if (this._requestLicenseFailureCount > MAX_LICENSE_REQUEST_FAILURES) {\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n return;\n }\n\n var attemptsLeft = MAX_LICENSE_REQUEST_FAILURES - this._requestLicenseFailureCount + 1;\n logger[\"logger\"].warn(\"Retrying license request, \" + attemptsLeft + \" attempts left\");\n\n this._requestLicense(keyMessage, callback);\n }\n\n break;\n }\n }\n /**\n * @private\n * @param {MediaKeysListItem} keysListItem\n * @param {ArrayBuffer} keyMessage\n * @returns {ArrayBuffer} Challenge data posted to license server\n * @throws if KeySystem is unsupported\n */\n ;\n\n _proto._generateLicenseRequestChallenge = function _generateLicenseRequestChallenge(keysListItem, keyMessage) {\n switch (keysListItem.mediaKeySystemDomain) {\n // case KeySystems.PLAYREADY:\n // from https://github.com/MicrosoftEdge/Demos/blob/master/eme/scripts/demo.js\n\n /*\n if (this.licenseType !== this.LICENSE_TYPE_WIDEVINE) {\n // For PlayReady CDMs, we need to dig the Challenge out of the XML.\n var keyMessageXml = new DOMParser().parseFromString(String.fromCharCode.apply(null, new Uint16Array(keyMessage)), 'application/xml');\n if (keyMessageXml.getElementsByTagName('Challenge')[0]) {\n challenge = atob(keyMessageXml.getElementsByTagName('Challenge')[0].childNodes[0].nodeValue);\n } else {\n throw 'Cannot find <Challenge> in key message';\n }\n var headerNames = keyMessageXml.getElementsByTagName('name');\n var headerValues = keyMessageXml.getElementsByTagName('value');\n if (headerNames.length !== headerValues.length) {\n throw 'Mismatched header <name>/<value> pair in key message';\n }\n for (var i = 0; i < headerNames.length; i++) {\n xhr.setRequestHeader(headerNames[i].childNodes[0].nodeValue, headerValues[i].childNodes[0].nodeValue);\n }\n }\n break;\n */\n case KeySystems.WIDEVINE:\n // For Widevine CDMs, the challenge is the keyMessage.\n return keyMessage;\n }\n\n throw new Error(\"unsupported key-system: \" + keysListItem.mediaKeySystemDomain);\n }\n /**\n * @private\n * @param keyMessage\n * @param callback\n */\n ;\n\n _proto._requestLicense = function _requestLicense(keyMessage, callback) {\n logger[\"logger\"].log('Requesting content license for key-system');\n var keysListItem = this._mediaKeysList[0];\n\n if (!keysListItem) {\n logger[\"logger\"].error('Fatal error: Media is encrypted but no key-system access has been obtained yet');\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_NO_ACCESS,\n fatal: true\n });\n return;\n }\n\n try {\n var _url = this.getLicenseServerUrl(keysListItem.mediaKeySystemDomain);\n\n var _xhr = this._createLicenseXhr(_url, keyMessage, callback);\n\n logger[\"logger\"].log(\"Sending license request to URL: \" + _url);\n\n var challenge = this._generateLicenseRequestChallenge(keysListItem, keyMessage);\n\n _xhr.send(challenge);\n } catch (e) {\n logger[\"logger\"].error(\"Failure requesting DRM license: \" + e);\n this.hls.trigger(events[\"default\"].ERROR, {\n type: errors[\"ErrorTypes\"].KEY_SYSTEM_ERROR,\n details: errors[\"ErrorDetails\"].KEY_SYSTEM_LICENSE_REQUEST_FAILED,\n fatal: true\n });\n }\n };\n\n _proto.onMediaAttached = function onMediaAttached(data) {\n if (!this._emeEnabled) {\n return;\n }\n\n var media = data.media; // keep reference of media\n\n this._media = media;\n media.addEventListener('encrypted', this._onMediaEncrypted);\n };\n\n _proto.onMediaDetached = function onMediaDetached() {\n var media = this._media;\n var mediaKeysList = this._mediaKeysList;\n\n if (!media) {\n return;\n }\n\n media.removeEventListener('encrypted', this._onMediaEncrypted);\n this._media = null;\n this._mediaKeysList = []; // Close all sessions and remove media keys from the video element.\n\n Promise.all(mediaKeysList.map(function (mediaKeysListItem) {\n if (mediaKeysListItem.mediaKeysSession) {\n return mediaKeysListItem.mediaKeysSession.close().catch(function () {// Ignore errors when closing the sessions. Closing a session that\n // generated no key requests will throw an error.\n });\n }\n })).then(function () {\n return media.setMediaKeys(null);\n }).catch(function () {// Ignore any failures while removing media keys from the video element.\n });\n } // TODO: Use manifest types here when they are defined\n ;\n\n _proto.onManifestParsed = function onManifestParsed(data) {\n if (!this._emeEnabled) {\n return;\n }\n\n var audioCodecs = data.levels.map(function (level) {\n return level.audioCodec;\n });\n var videoCodecs = data.levels.map(function (level) {\n return level.videoCodec;\n });\n\n this._attemptKeySystemAccess(KeySystems.WIDEVINE, audioCodecs, videoCodecs);\n };\n\n eme_controller_createClass(EMEController, [{\n key: \"requestMediaKeySystemAccess\",\n get: function get() {\n if (!this._requestMediaKeySystemAccess) {\n throw new Error('No requestMediaKeySystemAccess function configured');\n }\n\n return this._requestMediaKeySystemAccess;\n }\n }]);\n\n return EMEController;\n}(event_handler);\n\n/* harmony default export */ var eme_controller = (eme_controller_EMEController);\n// CONCATENATED MODULE: ./src/config.ts\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * HLS config\n */\n\n\n\n\n // import FetchLoader from './utils/fetch-loader';\n\n\n\n\n\n\n\n\n\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\nvar hlsDefaultConfig = _objectSpread(_objectSpread({\n autoStartLoad: true,\n // used by stream-controller\n startPosition: -1,\n // used by stream-controller\n defaultAudioCodec: void 0,\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 initialLiveManifestSize: 1,\n // used by stream-controller\n maxBufferLength: 30,\n // used by stream-controller\n maxBufferSize: 60 * 1000 * 1000,\n // used by stream-controller\n maxBufferHole: 0.5,\n // used by stream-controller\n lowBufferWatchdogPeriod: 0.5,\n // used by stream-controller\n highBufferWatchdogPeriod: 3,\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 stream-controller\n liveMaxLatencyDurationCount: Infinity,\n // used by stream-controller\n liveSyncDuration: void 0,\n // used by stream-controller\n liveMaxLatencyDuration: void 0,\n // used by stream-controller\n liveDurationInfinity: false,\n // used by buffer-controller\n liveBackBufferLength: Infinity,\n // used by buffer-controller\n maxMaxBufferLength: 600,\n // used by stream-controller\n enableWorker: true,\n // used by demuxer\n enableSoftwareAES: true,\n // used by decrypter\n manifestLoadingTimeOut: 10000,\n // used by playlist-loader\n manifestLoadingMaxRetry: 1,\n // used by playlist-loader\n manifestLoadingRetryDelay: 1000,\n // used by playlist-loader\n manifestLoadingMaxRetryTimeout: 64000,\n // used by playlist-loader\n startLevel: void 0,\n // used by level-controller\n levelLoadingTimeOut: 10000,\n // used by playlist-loader\n levelLoadingMaxRetry: 4,\n // used by playlist-loader\n levelLoadingRetryDelay: 1000,\n // used by playlist-loader\n levelLoadingMaxRetryTimeout: 64000,\n // used by playlist-loader\n fragLoadingTimeOut: 20000,\n // used by fragment-loader\n fragLoadingMaxRetry: 6,\n // used by fragment-loader\n fragLoadingRetryDelay: 1000,\n // used by fragment-loader\n fragLoadingMaxRetryTimeout: 64000,\n // used by fragment-loader\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: xhr_loader,\n // loader: FetchLoader,\n fLoader: void 0,\n // used by fragment-loader\n pLoader: void 0,\n // used by playlist-loader\n xhrSetup: void 0,\n // used by xhr-loader\n licenseXhrSetup: void 0,\n // used by eme-controller\n // fetchSetup: void 0,\n abrController: abr_controller,\n bufferController: buffer_controller,\n capLevelController: cap_level_controller,\n fpsController: fps_controller,\n stretchShortVideoTrack: false,\n // used by mp4-remuxer\n maxAudioFramesDrift: 1,\n // used by mp4-remuxer\n forceKeyFrameOnDiscontinuity: true,\n // used by ts-demuxer\n abrEwmaFastLive: 3,\n // used by abr-controller\n abrEwmaSlowLive: 9,\n // used by abr-controller\n abrEwmaFastVoD: 3,\n // used by abr-controller\n abrEwmaSlowVoD: 9,\n // used by abr-controller\n abrEwmaDefaultEstimate: 5e5,\n // 500 kbps // used by abr-controller\n abrBandWidthFactor: 0.95,\n // used by abr-controller\n abrBandWidthUpFactor: 0.7,\n // used by abr-controller\n abrMaxWithRealBitrate: false,\n // used by abr-controller\n maxStarvationDelay: 4,\n // used by abr-controller\n maxLoadingDelay: 4,\n // used by abr-controller\n minAutoBitrate: 0,\n // used by hls\n emeEnabled: false,\n // used by eme-controller\n widevineLicenseUrl: void 0,\n // used by eme-controller\n drmSystemOptions: {},\n // used by eme-controller\n requestMediaKeySystemAccessFunc: requestMediaKeySystemAccess,\n // used by eme-controller\n testBandwidth: true\n}, timelineConfig()), {}, {\n subtitleStreamController: true ? subtitle_stream_controller_SubtitleStreamController : undefined,\n subtitleTrackController: true ? subtitle_track_controller : undefined,\n timelineController: true ? timeline_controller : undefined,\n audioStreamController: true ? audio_stream_controller : undefined,\n audioTrackController: true ? audio_track_controller : undefined,\n emeController: true ? eme_controller : undefined\n});\n\nfunction timelineConfig() {\n return {\n cueHandler: cues_namespaceObject,\n // used by timeline-controller\n enableCEA708Captions: true,\n // used by timeline-controller\n enableWebVTT: true,\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// CONCATENATED MODULE: ./src/hls.ts\nfunction hls_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction hls_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { hls_ownKeys(Object(source), true).forEach(function (key) { hls_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { hls_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction hls_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction hls_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction hls_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction hls_createClass(Constructor, protoProps, staticProps) { if (protoProps) hls_defineProperties(Constructor.prototype, protoProps); if (staticProps) hls_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction hls_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @module Hls\n * @class\n * @constructor\n */\n\nvar hls_Hls = /*#__PURE__*/function (_Observer) {\n hls_inheritsLoose(Hls, _Observer);\n\n /**\n * @type {boolean}\n */\n Hls.isSupported = function isSupported() {\n return is_supported_isSupported();\n }\n /**\n * @type {HlsEvents}\n */\n ;\n\n hls_createClass(Hls, null, [{\n key: \"version\",\n\n /**\n * @type {string}\n */\n get: function get() {\n return \"0.14.16\";\n }\n }, {\n key: \"Events\",\n get: function get() {\n return events[\"default\"];\n }\n /**\n * @type {HlsErrorTypes}\n */\n\n }, {\n key: \"ErrorTypes\",\n get: function get() {\n return errors[\"ErrorTypes\"];\n }\n /**\n * @type {HlsErrorDetails}\n */\n\n }, {\n key: \"ErrorDetails\",\n get: function get() {\n return errors[\"ErrorDetails\"];\n }\n /**\n * @type {HlsConfig}\n */\n\n }, {\n key: \"DefaultConfig\",\n get: function get() {\n if (!Hls.defaultConfig) {\n return hlsDefaultConfig;\n }\n\n return Hls.defaultConfig;\n }\n /**\n * @type {HlsConfig}\n */\n ,\n set: function set(defaultConfig) {\n Hls.defaultConfig = defaultConfig;\n }\n /**\n * Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.\n *\n * @constructs Hls\n * @param {HlsConfig} config\n */\n\n }]);\n\n function Hls(userConfig) {\n var _this;\n\n if (userConfig === void 0) {\n userConfig = {};\n }\n\n _this = _Observer.call(this) || this;\n _this.config = void 0;\n _this._autoLevelCapping = void 0;\n _this.abrController = void 0;\n _this.capLevelController = void 0;\n _this.levelController = void 0;\n _this.streamController = void 0;\n _this.networkControllers = void 0;\n _this.audioTrackController = void 0;\n _this.subtitleTrackController = void 0;\n _this.emeController = void 0;\n _this.coreComponents = void 0;\n _this.media = null;\n _this.url = null;\n var defaultConfig = Hls.DefaultConfig;\n\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 } // Shallow clone\n\n\n _this.config = hls_objectSpread(hls_objectSpread({}, defaultConfig), userConfig);\n\n var _assertThisInitialize = hls_assertThisInitialized(_this),\n config = _assertThisInitialize.config;\n\n if (config.liveMaxLatencyDurationCount !== void 0 && config.liveMaxLatencyDurationCount <= config.liveSyncDurationCount) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDurationCount\" must be gt \"liveSyncDurationCount\"');\n }\n\n if (config.liveMaxLatencyDuration !== void 0 && (config.liveSyncDuration === void 0 || config.liveMaxLatencyDuration <= config.liveSyncDuration)) {\n throw new Error('Illegal hls.js config: \"liveMaxLatencyDuration\" must be gt \"liveSyncDuration\"');\n }\n\n Object(logger[\"enableLogs\"])(config.debug);\n _this._autoLevelCapping = -1; // core controllers and network loaders\n\n /**\n * @member {AbrController} abrController\n */\n\n var abrController = _this.abrController = new config.abrController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var bufferController = new config.bufferController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var capLevelController = _this.capLevelController = new config.capLevelController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var fpsController = new config.fpsController(hls_assertThisInitialized(_this)); // eslint-disable-line new-cap\n\n var playListLoader = new playlist_loader(hls_assertThisInitialized(_this));\n var fragmentLoader = new fragment_loader(hls_assertThisInitialized(_this));\n var keyLoader = new key_loader(hls_assertThisInitialized(_this));\n var id3TrackController = new id3_track_controller(hls_assertThisInitialized(_this)); // network controllers\n\n /**\n * @member {LevelController} levelController\n */\n\n var levelController = _this.levelController = new level_controller_LevelController(hls_assertThisInitialized(_this)); // FIXME: FragmentTracker must be defined before StreamController because the order of event handling is important\n\n var fragmentTracker = new fragment_tracker_FragmentTracker(hls_assertThisInitialized(_this));\n /**\n * @member {StreamController} streamController\n */\n\n var streamController = _this.streamController = new stream_controller(hls_assertThisInitialized(_this), fragmentTracker);\n var networkControllers = [levelController, streamController]; // optional audio stream controller\n\n /**\n * @var {ICoreComponent | Controller}\n */\n\n var Controller = config.audioStreamController;\n\n if (Controller) {\n networkControllers.push(new Controller(hls_assertThisInitialized(_this), fragmentTracker));\n }\n /**\n * @member {INetworkController[]} networkControllers\n */\n\n\n _this.networkControllers = networkControllers;\n /**\n * @var {ICoreComponent[]}\n */\n\n var coreComponents = [playListLoader, fragmentLoader, keyLoader, abrController, bufferController, capLevelController, fpsController, id3TrackController, fragmentTracker]; // optional audio track and subtitle controller\n\n Controller = config.audioTrackController;\n\n if (Controller) {\n var audioTrackController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {AudioTrackController} audioTrackController\n */\n\n _this.audioTrackController = audioTrackController;\n coreComponents.push(audioTrackController);\n }\n\n Controller = config.subtitleTrackController;\n\n if (Controller) {\n var subtitleTrackController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {SubtitleTrackController} subtitleTrackController\n */\n\n _this.subtitleTrackController = subtitleTrackController;\n networkControllers.push(subtitleTrackController);\n }\n\n Controller = config.emeController;\n\n if (Controller) {\n var emeController = new Controller(hls_assertThisInitialized(_this));\n /**\n * @member {EMEController} emeController\n */\n\n _this.emeController = emeController;\n coreComponents.push(emeController);\n } // optional subtitle controllers\n\n\n Controller = config.subtitleStreamController;\n\n if (Controller) {\n networkControllers.push(new Controller(hls_assertThisInitialized(_this), fragmentTracker));\n }\n\n Controller = config.timelineController;\n\n if (Controller) {\n coreComponents.push(new Controller(hls_assertThisInitialized(_this)));\n }\n /**\n * @member {ICoreComponent[]}\n */\n\n\n _this.coreComponents = coreComponents;\n return _this;\n }\n /**\n * Dispose of the instance\n */\n\n\n var _proto = Hls.prototype;\n\n _proto.destroy = function destroy() {\n logger[\"logger\"].log('destroy');\n this.trigger(events[\"default\"].DESTROYING);\n this.detachMedia();\n this.coreComponents.concat(this.networkControllers).forEach(function (component) {\n component.destroy();\n });\n this.url = null;\n this.removeAllListeners();\n this._autoLevelCapping = -1;\n }\n /**\n * Attach a media element\n * @param {HTMLMediaElement} media\n */\n ;\n\n _proto.attachMedia = function attachMedia(media) {\n logger[\"logger\"].log('attachMedia');\n this.media = media;\n this.trigger(events[\"default\"].MEDIA_ATTACHING, {\n media: media\n });\n }\n /**\n * Detach from the media\n */\n ;\n\n _proto.detachMedia = function detachMedia() {\n logger[\"logger\"].log('detachMedia');\n this.trigger(events[\"default\"].MEDIA_DETACHING);\n this.media = null;\n }\n /**\n * Set the source URL. Can be relative or absolute.\n * @param {string} url\n */\n ;\n\n _proto.loadSource = function loadSource(url) {\n url = url_toolkit[\"buildAbsoluteURL\"](window.location.href, url, {\n alwaysNormalize: true\n });\n logger[\"logger\"].log(\"loadSource:\" + url);\n this.url = url; // when attaching to a source URL, trigger a playlist load\n\n this.trigger(events[\"default\"].MANIFEST_LOADING, {\n url: url\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 {number} startPosition Set the start position to stream from\n * @default -1 None (from earliest point)\n */\n ;\n\n _proto.startLoad = function startLoad(startPosition) {\n if (startPosition === void 0) {\n startPosition = -1;\n }\n\n logger[\"logger\"].log(\"startLoad(\" + startPosition + \")\");\n this.networkControllers.forEach(function (controller) {\n controller.startLoad(startPosition);\n });\n }\n /**\n * Stop loading of any stream data.\n */\n ;\n\n _proto.stopLoad = function stopLoad() {\n logger[\"logger\"].log('stopLoad');\n this.networkControllers.forEach(function (controller) {\n controller.stopLoad();\n });\n }\n /**\n * Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1)\n */\n ;\n\n _proto.swapAudioCodec = function swapAudioCodec() {\n logger[\"logger\"].log('swapAudioCodec');\n this.streamController.swapAudioCodec();\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 ;\n\n _proto.recoverMediaError = function recoverMediaError() {\n logger[\"logger\"].log('recoverMediaError');\n var media = this.media;\n this.detachMedia();\n\n if (media) {\n this.attachMedia(media);\n }\n }\n /**\n * Remove a loaded level from the list of levels, or a level url in from a list of redundant level urls.\n * This can be used to remove a rendition or playlist url that errors frequently from the list of levels that a user\n * or hls.js can choose from.\n *\n * @param levelIndex {number} The quality level index to of the level to remove\n * @param urlId {number} The quality level url index in the case that fallback levels are available. Defaults to 0.\n */\n ;\n\n _proto.removeLevel = function removeLevel(levelIndex, urlId) {\n if (urlId === void 0) {\n urlId = 0;\n }\n\n this.levelController.removeLevel(levelIndex, urlId);\n }\n /**\n * @type {QualityLevel[]}\n */\n // todo(typescript-levelController)\n ;\n\n hls_createClass(Hls, [{\n key: \"levels\",\n get: function get() {\n return this.levelController.levels;\n }\n /**\n * Index of quality level currently played\n * @type {number}\n */\n\n }, {\n key: \"currentLevel\",\n get: function get() {\n return this.streamController.currentLevel;\n }\n /**\n * Set quality level index immediately .\n * This will flush the current buffer to replace the quality asap.\n * That means playback will interrupt at least shortly to re-buffer and re-sync eventually.\n * @param newLevel {number} -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set currentLevel:\" + newLevel);\n this.loadLevel = newLevel;\n this.streamController.immediateLevelSwitch();\n }\n /**\n * Index of next quality level loaded as scheduled by stream controller.\n * @type {number}\n */\n\n }, {\n key: \"nextLevel\",\n get: function get() {\n return this.streamController.nextLevel;\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 * @type {number} -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set nextLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n this.streamController.nextLevelSwitch();\n }\n /**\n * Return the quality level of the currently or last (of none is loaded currently) segment\n * @type {number}\n */\n\n }, {\n key: \"loadLevel\",\n get: function get() {\n return this.levelController.level;\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 * @type {number} newLevel -1 for automatic level selection\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set loadLevel:\" + newLevel);\n this.levelController.manualLevel = newLevel;\n }\n /**\n * get next quality level loaded\n * @type {number}\n */\n\n }, {\n key: \"nextLoadLevel\",\n get: function get() {\n return this.levelController.nextLoadLevel;\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 * @type {number} level\n */\n ,\n set: function set(level) {\n this.levelController.nextLoadLevel = level;\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 * @type {number}\n */\n\n }, {\n key: \"firstLevel\",\n get: function get() {\n return Math.max(this.levelController.firstLevel, this.minAutoLevel);\n }\n /**\n * Sets \"first-level\", see getter.\n * @type {number}\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set firstLevel:\" + newLevel);\n this.levelController.firstLevel = newLevel;\n }\n /**\n * Return start level (level of first fragment that will be played back)\n * if not overrided by user, first level appearing in manifest will be used as start level\n * if -1 : automatic start level selection, playback will start from level matching download bandwidth\n * (determined from download of first segment)\n * @type {number}\n */\n\n }, {\n key: \"startLevel\",\n get: function get() {\n return this.levelController.startLevel;\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 * @type {number} newLevel\n */\n ,\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set startLevel:\" + newLevel); // if not in automatic start level detection, ensure startLevel is greater than minAutoLevel\n\n if (newLevel !== -1) {\n newLevel = Math.max(newLevel, this.minAutoLevel);\n }\n\n this.levelController.startLevel = newLevel;\n }\n /**\n * set dynamically set capLevelToPlayerSize against (`CapLevelController`)\n *\n * @type {boolean}\n */\n\n }, {\n key: \"capLevelToPlayerSize\",\n set: function set(shouldStartCapping) {\n var newCapLevelToPlayerSize = !!shouldStartCapping;\n\n if (newCapLevelToPlayerSize !== this.config.capLevelToPlayerSize) {\n if (newCapLevelToPlayerSize) {\n this.capLevelController.startCapping(); // If capping occurs, nextLevelSwitch will happen based on size.\n } else {\n this.capLevelController.stopCapping();\n this.autoLevelCapping = -1;\n this.streamController.nextLevelSwitch(); // Now we're uncapped, get the next level asap.\n }\n\n this.config.capLevelToPlayerSize = newCapLevelToPlayerSize;\n }\n }\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n\n }, {\n key: \"autoLevelCapping\",\n get: function get() {\n return this._autoLevelCapping;\n }\n /**\n * get bandwidth estimate\n * @type {number}\n */\n ,\n\n /**\n * Capping/max level value that should be used by automatic level selection algorithm (`ABRController`)\n * @type {number}\n */\n set: function set(newLevel) {\n logger[\"logger\"].log(\"set autoLevelCapping:\" + newLevel);\n this._autoLevelCapping = newLevel;\n }\n /**\n * True when automatic level selection enabled\n * @type {boolean}\n */\n\n }, {\n key: \"bandwidthEstimate\",\n get: function get() {\n var bwEstimator = this.abrController._bwEstimator;\n return bwEstimator ? bwEstimator.getEstimate() : NaN;\n }\n }, {\n key: \"autoLevelEnabled\",\n get: function get() {\n return this.levelController.manualLevel === -1;\n }\n /**\n * Level set manually (if any)\n * @type {number}\n */\n\n }, {\n key: \"manualLevel\",\n get: function get() {\n return this.levelController.manualLevel;\n }\n /**\n * min level selectable in auto mode according to config.minAutoBitrate\n * @type {number}\n */\n\n }, {\n key: \"minAutoLevel\",\n get: function get() {\n var levels = this.levels,\n minAutoBitrate = this.config.minAutoBitrate;\n var len = levels ? levels.length : 0;\n\n for (var i = 0; i < len; i++) {\n var levelNextBitrate = levels[i].realBitrate ? Math.max(levels[i].realBitrate, levels[i].bitrate) : levels[i].bitrate;\n\n if (levelNextBitrate > minAutoBitrate) {\n return i;\n }\n }\n\n return 0;\n }\n /**\n * max level selectable in auto mode according to autoLevelCapping\n * @type {number}\n */\n\n }, {\n key: \"maxAutoLevel\",\n get: function get() {\n var levels = this.levels,\n autoLevelCapping = this.autoLevelCapping;\n var maxAutoLevel;\n\n if (autoLevelCapping === -1 && levels && levels.length) {\n maxAutoLevel = levels.length - 1;\n } else {\n maxAutoLevel = autoLevelCapping;\n }\n\n return maxAutoLevel;\n }\n /**\n * next automatically selected quality level\n * @type {number}\n */\n\n }, {\n key: \"nextAutoLevel\",\n get: function get() {\n // ensure next auto level is between min and max auto level\n return Math.min(Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), this.maxAutoLevel);\n }\n /**\n * 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 succesful frag loading at forced level,\n * this value will be resetted to -1 by ABR controller.\n * @type {number}\n */\n ,\n set: function set(nextLevel) {\n this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, nextLevel);\n }\n /**\n * @type {AudioTrack[]}\n */\n // todo(typescript-audioTrackController)\n\n }, {\n key: \"audioTracks\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTracks : [];\n }\n /**\n * index of the selected audio track (index in audio track lists)\n * @type {number}\n */\n\n }, {\n key: \"audioTrack\",\n get: function get() {\n var audioTrackController = this.audioTrackController;\n return audioTrackController ? audioTrackController.audioTrack : -1;\n }\n /**\n * selects an audio track, based on its index in audio track lists\n * @type {number}\n */\n ,\n set: function set(audioTrackId) {\n var audioTrackController = this.audioTrackController;\n\n if (audioTrackController) {\n audioTrackController.audioTrack = audioTrackId;\n }\n }\n /**\n * @type {Seconds}\n */\n\n }, {\n key: \"liveSyncPosition\",\n get: function get() {\n return this.streamController.liveSyncPosition;\n }\n /**\n * get alternate subtitle tracks list from playlist\n * @type {SubtitleTrack[]}\n */\n // todo(typescript-subtitleTrackController)\n\n }, {\n key: \"subtitleTracks\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTracks : [];\n }\n /**\n * index of the selected subtitle track (index in subtitle track lists)\n * @type {number}\n */\n\n }, {\n key: \"subtitleTrack\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleTrack : -1;\n }\n /**\n * select an subtitle track, based on its index in subtitle track lists\n * @type {number}\n */\n ,\n set: function set(subtitleTrackId) {\n var subtitleTrackController = this.subtitleTrackController;\n\n if (subtitleTrackController) {\n subtitleTrackController.subtitleTrack = subtitleTrackId;\n }\n }\n /**\n * @type {boolean}\n */\n\n }, {\n key: \"subtitleDisplay\",\n get: function get() {\n var subtitleTrackController = this.subtitleTrackController;\n return subtitleTrackController ? subtitleTrackController.subtitleDisplay : false;\n }\n /**\n * Enable/disable subtitle display rendering\n * @type {boolean}\n */\n ,\n set: function set(value) {\n var subtitleTrackController = this.subtitleTrackController;\n\n if (subtitleTrackController) {\n subtitleTrackController.subtitleDisplay = value;\n }\n }\n }]);\n\n return Hls;\n}(Observer);\n\nhls_Hls.defaultConfig = void 0;\n\n\n/***/ }),\n\n/***/ \"./src/polyfills/number.js\":\n/*!*********************************!*\\\n !*** ./src/polyfills/number.js ***!\n \\*********************************/\n/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isFiniteNumber\", function() { return isFiniteNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MAX_SAFE_INTEGER\", function() { return MAX_SAFE_INTEGER; });\nvar isFiniteNumber = Number.isFinite || function (value) {\n return typeof value === 'number' && isFinite(value);\n};\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;\n\n/***/ }),\n\n/***/ \"./src/utils/get-self-scope.js\":\n/*!*************************************!*\\\n !*** ./src/utils/get-self-scope.js ***!\n \\*************************************/\n/*! exports provided: getSelfScope */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getSelfScope\", function() { return getSelfScope; });\nfunction getSelfScope() {\n // see https://stackoverflow.com/a/11237259/589493\n if (typeof window === 'undefined') {\n /* eslint-disable-next-line no-undef */\n return self;\n } else {\n return window;\n }\n}\n\n/***/ }),\n\n/***/ \"./src/utils/logger.js\":\n/*!*****************************!*\\\n !*** ./src/utils/logger.js ***!\n \\*****************************/\n/*! exports provided: enableLogs, logger */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"enableLogs\", function() { return enableLogs; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"logger\", function() { return logger; });\n/* harmony import */ var _get_self_scope__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get-self-scope */ \"./src/utils/get-self-scope.js\");\n\n\nfunction noop() {}\n\nvar fakeLogger = {\n trace: noop,\n debug: noop,\n log: noop,\n warn: noop,\n info: noop,\n error: noop\n};\nvar exportedLogger = fakeLogger; // 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\nfunction formatMsg(type, msg) {\n msg = '[' + type + '] > ' + msg;\n return msg;\n}\n\nvar global = Object(_get_self_scope__WEBPACK_IMPORTED_MODULE_0__[\"getSelfScope\"])();\n\nfunction consolePrintFn(type) {\n var func = global.console[type];\n\n if (func) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args[0]) {\n args[0] = formatMsg(type, args[0]);\n }\n\n func.apply(global.console, args);\n };\n }\n\n return noop;\n}\n\nfunction exportLoggerFunctions(debugConfig) {\n for (var _len2 = arguments.length, functions = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n functions[_key2 - 1] = arguments[_key2];\n }\n\n functions.forEach(function (type) {\n exportedLogger[type] = debugConfig[type] ? debugConfig[type].bind(debugConfig) : consolePrintFn(type);\n });\n}\n\nvar enableLogs = function enableLogs(debugConfig) {\n // check that console is available\n if (global.console && debugConfig === true || typeof debugConfig === 'object') {\n exportLoggerFunctions(debugConfig, // Remove out from list here to hard-disable a log-level\n // 'trace',\n 'debug', 'log', 'info', 'warn', 'error'); // Some browsers don't allow to use bind on console object anyway\n // fallback to default if needed\n\n try {\n exportedLogger.log();\n } catch (e) {\n exportedLogger = fakeLogger;\n }\n } else {\n exportedLogger = fakeLogger;\n }\n};\nvar logger = exportedLogger;\n\n/***/ })\n\n/******/ })[\"default\"];\n});\n//# sourceMappingURL=hls.js.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/hls.js/dist/hls.js\n// module id = 0\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"video.js\",\"commonjs2\":\"video.js\",\"amd\":\"video.js\",\"root\":\"videojs\"}\n// module id = 1\n// module chunks = 0","'use strict';\n\nvar Hls = require('hls.js');\n\nif (!window.Hls) {\n window.Hls = Hls; // expose hls.js constructor\n}\n\n/**\n * hls.js source handler\n * @param source\n * @param tech\n * @constructor\n */\nfunction Html5HlsJS(source, tech) {\n var options = tech.options_;\n var el = tech.el();\n var duration = null;\n var hls = this.hls = new Hls(options.hlsjsConfig);\n\n /**\n * creates an error handler function\n * @returns {Function}\n */\n function errorHandlerFactory() {\n var _recoverDecodingErrorDate = null;\n var _recoverAudioCodecErrorDate = null;\n\n return function() {\n var now = Date.now();\n\n if (!_recoverDecodingErrorDate || (now - _recoverDecodingErrorDate) > 2000) {\n _recoverDecodingErrorDate = now;\n hls.recoverMediaError();\n }\n else if (!_recoverAudioCodecErrorDate || (now - _recoverAudioCodecErrorDate) > 2000) {\n _recoverAudioCodecErrorDate = now;\n hls.swapAudioCodec();\n hls.recoverMediaError();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n };\n }\n\n // create separate error handlers for hlsjs and the video tag\n var hlsjsErrorHandler = errorHandlerFactory();\n var videoTagErrorHandler = errorHandlerFactory();\n\n // listen to error events coming from the video tag\n el.addEventListener('error', function(e) {\n var mediaError = e.currentTarget.error;\n\n if (mediaError.code === mediaError.MEDIA_ERR_DECODE) {\n videoTagErrorHandler();\n }\n else {\n console.error('Error loading media: File could not be played');\n }\n });\n\n /**\n * Destroys the Hls instance\n */\n this.dispose = function() {\n hls.destroy();\n };\n\n /**\n * returns the duration of the stream, or Infinity if live video\n * @returns {Infinity|number}\n */\n this.duration = function() {\n return duration || el.duration || 0;\n };\n\n // update live status on level load\n hls.on(Hls.Events.LEVEL_LOADED, function(event, data) {\n duration = data.details.live ? Infinity : data.details.totalduration;\n });\n\n // try to recover on fatal errors\n hls.on(Hls.Events.ERROR, function(event, data) {\n if (data.fatal) {\n switch (data.type) {\n case Hls.ErrorTypes.NETWORK_ERROR:\n hls.startLoad();\n break;\n case Hls.ErrorTypes.MEDIA_ERROR:\n hlsjsErrorHandler();\n break;\n default:\n console.error('Error loading media: File could not be played');\n break;\n }\n }\n });\n\n Object.keys(Hls.Events).forEach(function(key) {\n var eventName = Hls.Events[key];\n hls.on(eventName, function(event, data) {\n tech.trigger(eventName, data);\n });\n });\n\n // Intercept native TextTrack calls and route to video.js directly only\n // if native text tracks are not supported on this browser.\n if (!tech.featuresNativeTextTracks) {\n Object.defineProperty(el, 'textTracks', {\n value: tech.textTracks,\n writable: false\n });\n el.addTextTrack = function() {\n return tech.addTextTrack.apply(tech, arguments);\n };\n }\n\n // attach hlsjs to videotag\n hls.attachMedia(el);\n hls.loadSource(source.src);\n}\n\nvar hlsTypeRE = /^application\\/(x-mpegURL|vnd\\.apple\\.mpegURL)$/i;\nvar hlsExtRE = /\\.m3u8/i;\n\nvar HlsSourceHandler = {\n canHandleSource: function(source) {\n if (source.skipContribHlsJs) {\n return '';\n }\n else if (hlsTypeRE.test(source.type)) {\n return 'probably';\n }\n else if (hlsExtRE.test(source.src)) {\n return 'maybe';\n }\n else {\n return '';\n }\n },\n handleSource: function(source, tech) {\n return new Html5HlsJS(source, tech);\n },\n canPlayType: function(type) {\n if (hlsTypeRE.test(type)) {\n return 'probably';\n }\n\n return '';\n }\n};\n\nif (Hls.isSupported()) {\n var videojs = require('video.js'); // resolved UMD-wise through webpack\n\n // support es6 style import\n videojs = videojs && videojs.default || videojs;\n\n if (videojs) {\n var html5Tech = videojs.getTech && videojs.getTech('Html5'); // videojs6 (partially on videojs5 too)\n html5Tech = html5Tech || (videojs.getComponent && videojs.getComponent('Html5')); // videojs5\n\n if (html5Tech) {\n html5Tech.registerSourceHandler(HlsSourceHandler, 0);\n }\n }\n else {\n console.warn('videojs-contrib-hls.js: Couldn\\'t find find window.videojs nor require(\\'video.js\\')');\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/videojs.hlsjs.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file