Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mux/playback-core

Package Overview
Dependencies
Maintainers
1
Versions
553
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/playback-core - npm Package Compare versions

Comparing version 0.26.0-canary.0-2577b78 to 0.26.0-canary.0-4d0b670

dist/types-ts3.4/request-errors.d.ts

235

dist/cjs.json

@@ -1,234 +0,1 @@

{
"inputs": {
"src/hls.ts": {
"bytes": 127,
"imports": [
{
"path": "hls.js",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/errors.ts": {
"bytes": 1336,
"imports": [],
"format": "esm"
},
"src/types.ts": {
"bytes": 5827,
"imports": [],
"format": "esm"
},
"src/util.ts": {
"bytes": 3368,
"imports": [
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
},
"src/autoplay.ts": {
"bytes": 5113,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/preload.ts": {
"bytes": 1932,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/media-tracks.ts": {
"bytes": 4294,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/text-tracks.ts": {
"bytes": 13461,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
}
],
"format": "esm"
},
"src/pdt.ts": {
"bytes": 1104,
"imports": [
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/index.ts": {
"bytes": 45747,
"imports": [
{
"path": "mux-embed",
"kind": "import-statement",
"external": true
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "src/errors.ts",
"kind": "import-statement",
"original": "./errors"
},
{
"path": "src/autoplay.ts",
"kind": "import-statement",
"original": "./autoplay"
},
{
"path": "src/preload.ts",
"kind": "import-statement",
"original": "./preload"
},
{
"path": "src/media-tracks.ts",
"kind": "import-statement",
"original": "./media-tracks"
},
{
"path": "src/text-tracks.ts",
"kind": "import-statement",
"original": "./text-tracks"
},
{
"path": "src/pdt.ts",
"kind": "import-statement",
"original": "./pdt"
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
}
},
"outputs": {
"dist/index.cjs.js.map": {
"imports": [],
"exports": [],
"inputs": {},
"bytes": 124608
},
"dist/index.cjs.js": {
"imports": [
{
"path": "mux-embed",
"kind": "require-call",
"external": true
},
{
"path": "hls.js",
"kind": "require-call",
"external": true
}
],
"exports": [],
"entryPoint": "src/index.ts",
"inputs": {
"src/index.ts": {
"bytesInOutput": 14766
},
"src/hls.ts": {
"bytesInOutput": 42
},
"src/errors.ts": {
"bytesInOutput": 837
},
"src/types.ts": {
"bytesInOutput": 591
},
"src/util.ts": {
"bytesInOutput": 698
},
"src/autoplay.ts": {
"bytesInOutput": 1057
},
"src/preload.ts": {
"bytesInOutput": 562
},
"src/media-tracks.ts": {
"bytesInOutput": 1465
},
"src/text-tracks.ts": {
"bytesInOutput": 4807
},
"src/pdt.ts": {
"bytesInOutput": 360
}
},
"bytes": 25810
}
}
}
{"inputs":{"src/hls.ts":{"bytes":127,"imports":[{"path":"hls.js","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":2928,"imports":[],"format":"esm"},"src/types.ts":{"bytes":5929,"imports":[],"format":"esm"},"lang/en.json":{"bytes":42,"imports":[],"format":"esm"},"src/util.ts":{"bytes":5796,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"lang/en.json","kind":"import-statement","original":"../lang/en.json"}],"format":"esm"},"src/autoplay.ts":{"bytes":5113,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/preload.ts":{"bytes":1932,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/media-tracks.ts":{"bytes":4294,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/text-tracks.ts":{"bytes":13461,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"./types","kind":"import-statement","external":true},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/pdt.ts":{"bytes":1104,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/request-errors.ts":{"bytes":11048,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/index.ts":{"bytes":60305,"imports":[{"path":"mux-embed","kind":"import-statement","external":true},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/autoplay.ts","kind":"import-statement","original":"./autoplay"},{"path":"src/preload.ts","kind":"import-statement","original":"./preload"},{"path":"src/media-tracks.ts","kind":"import-statement","original":"./media-tracks"},{"path":"src/text-tracks.ts","kind":"import-statement","original":"./text-tracks"},{"path":"src/pdt.ts","kind":"import-statement","original":"./pdt"},{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"hls.js","kind":"import-statement","external":true},{"path":"src/request-errors.ts","kind":"import-statement","original":"./request-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"dist/index.cjs.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":167950},"dist/index.cjs.js":{"imports":[{"path":"mux-embed","kind":"require-call","external":true},{"path":"hls.js","kind":"require-call","external":true},{"path":"hls.js","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":21468},"src/hls.ts":{"bytesInOutput":42},"src/errors.ts":{"bytesInOutput":1623},"src/types.ts":{"bytesInOutput":591},"lang/en.json":{"bytesInOutput":24},"src/util.ts":{"bytesInOutput":1378},"src/autoplay.ts":{"bytesInOutput":1061},"src/preload.ts":{"bytesInOutput":562},"src/media-tracks.ts":{"bytesInOutput":1465},"src/text-tracks.ts":{"bytesInOutput":4828},"src/pdt.ts":{"bytesInOutput":360},"src/request-errors.ts":{"bytesInOutput":3908}},"bytes":37935}}}

@@ -1,297 +0,1 @@

{
"inputs": {
"src/hls.ts": {
"bytes": 127,
"imports": [
{
"path": "hls.js",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/errors.ts": {
"bytes": 1336,
"imports": [],
"format": "esm"
},
"src/types.ts": {
"bytes": 5827,
"imports": [],
"format": "esm"
},
"src/util.ts": {
"bytes": 3368,
"imports": [
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
},
"src/autoplay.ts": {
"bytes": 5113,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/preload.ts": {
"bytes": 1932,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/media-tracks.ts": {
"bytes": 4294,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/text-tracks.ts": {
"bytes": 13461,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
}
],
"format": "esm"
},
"src/pdt.ts": {
"bytes": 1104,
"imports": [
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/index.ts": {
"bytes": 45747,
"imports": [
{
"path": "mux-embed",
"kind": "import-statement",
"external": true
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "src/errors.ts",
"kind": "import-statement",
"original": "./errors"
},
{
"path": "src/autoplay.ts",
"kind": "import-statement",
"original": "./autoplay"
},
{
"path": "src/preload.ts",
"kind": "import-statement",
"original": "./preload"
},
{
"path": "src/media-tracks.ts",
"kind": "import-statement",
"original": "./media-tracks"
},
{
"path": "src/text-tracks.ts",
"kind": "import-statement",
"original": "./text-tracks"
},
{
"path": "src/pdt.ts",
"kind": "import-statement",
"original": "./pdt"
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
}
},
"outputs": {
"dist/index.mjs.map": {
"imports": [],
"exports": [],
"inputs": {},
"bytes": 122550
},
"dist/index.mjs": {
"imports": [
{
"path": "mux-embed",
"kind": "import-statement",
"external": true
},
{
"path": "hls.js",
"kind": "import-statement",
"external": true
}
],
"exports": [
"AutoplayTypes",
"CmcdTypeValues",
"CmcdTypes",
"ExtensionMimeTypeMap",
"Hls",
"MaxResolution",
"MediaError",
"MimeTypeShorthandMap",
"MinResolution",
"PlaybackTypes",
"RenditionOrder",
"StreamTypes",
"addChapters",
"addCuePoints",
"addTextTrack",
"allMediaTypes",
"generatePlayerInitTime",
"generateUUID",
"getActiveChapter",
"getActiveCuePoint",
"getAppCertificate",
"getChapters",
"getCuePoints",
"getCurrentPdt",
"getDRMConfig",
"getEnded",
"getError",
"getLicenseKey",
"getLiveEdgeStart",
"getMediaPlaylistLinesFromMultivariantPlaylistSrc",
"getSeekable",
"getStartDate",
"getStreamInfoFromHlsjsLevelDetails",
"getStreamInfoFromPlaylistLines",
"getStreamInfoFromSrcAndType",
"getStreamType",
"getStreamTypeConfig",
"getTargetLiveWindow",
"getTextTrack",
"initialize",
"isKeyOf",
"isMuxVideoSrc",
"isPseudoEnded",
"isStuckOnLastFragment",
"loadMedia",
"mux",
"muxMediaState",
"removeTextTrack",
"setupChapters",
"setupCuePoints",
"setupHls",
"setupMux",
"setupNativeFairplayDRM",
"shorthandKeys",
"teardown",
"toAppCertURL",
"toDRMTypeFromKeySystem",
"toLicenseKeyURL",
"toMuxVideoURL",
"toPlaybackIdFromSrc",
"updateStreamInfoFromHlsjsLevelDetails",
"updateStreamInfoFromSrc"
],
"entryPoint": "src/index.ts",
"inputs": {
"src/index.ts": {
"bytesInOutput": 13261
},
"src/hls.ts": {
"bytesInOutput": 32
},
"src/errors.ts": {
"bytesInOutput": 837
},
"src/types.ts": {
"bytesInOutput": 591
},
"src/util.ts": {
"bytesInOutput": 697
},
"src/autoplay.ts": {
"bytesInOutput": 1057
},
"src/preload.ts": {
"bytesInOutput": 562
},
"src/media-tracks.ts": {
"bytesInOutput": 1465
},
"src/text-tracks.ts": {
"bytesInOutput": 4816
},
"src/pdt.ts": {
"bytesInOutput": 360
}
},
"bytes": 25074
}
}
}
{"inputs":{"../../node_modules/mux-embed/dist/mux.mjs":{"bytes":84239,"imports":[],"format":"esm"},"../../node_modules/hls.js/dist/hls.mjs":{"bytes":994232,"imports":[],"format":"esm"},"src/hls.ts":{"bytes":127,"imports":[{"path":"../../node_modules/hls.js/dist/hls.mjs","kind":"import-statement","original":"hls.js"}],"format":"esm"},"src/errors.ts":{"bytes":2928,"imports":[],"format":"esm"},"src/types.ts":{"bytes":5929,"imports":[],"format":"esm"},"lang/en.json":{"bytes":42,"imports":[],"format":"esm"},"src/util.ts":{"bytes":5796,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"lang/en.json","kind":"import-statement","original":"../lang/en.json"}],"format":"esm"},"src/autoplay.ts":{"bytes":5113,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/preload.ts":{"bytes":1932,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/media-tracks.ts":{"bytes":4294,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/text-tracks.ts":{"bytes":13461,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"./types","kind":"import-statement","external":true},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/pdt.ts":{"bytes":1104,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/request-errors.ts":{"bytes":11048,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/index.ts":{"bytes":60305,"imports":[{"path":"../../node_modules/mux-embed/dist/mux.mjs","kind":"import-statement","original":"mux-embed"},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/autoplay.ts","kind":"import-statement","original":"./autoplay"},{"path":"src/preload.ts","kind":"import-statement","original":"./preload"},{"path":"src/media-tracks.ts","kind":"import-statement","original":"./media-tracks"},{"path":"src/text-tracks.ts","kind":"import-statement","original":"./text-tracks"},{"path":"src/pdt.ts","kind":"import-statement","original":"./pdt"},{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"../../node_modules/hls.js/dist/hls.mjs","kind":"import-statement","original":"hls.js"},{"path":"src/request-errors.ts","kind":"import-statement","original":"./request-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"dist/playback-core.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2187218},"dist/playback-core.mjs":{"imports":[],"exports":["AutoplayTypes","CmcdTypeValues","CmcdTypes","ExtensionMimeTypeMap","Hls","MaxResolution","MediaError","MimeTypeShorthandMap","MinResolution","MuxErrorCategory","MuxErrorCode","MuxJWTAud","PlaybackTypes","RenditionOrder","StreamTypes","addChapters","addCuePoints","addTextTrack","allMediaTypes","errorCategoryToTokenNameOrPrefix","generatePlayerInitTime","generateUUID","getActiveChapter","getActiveCuePoint","getAppCertificate","getChapters","getCuePoints","getCurrentPdt","getDRMConfig","getEnded","getError","getLicenseKey","getLiveEdgeStart","getMediaPlaylistLinesFromMultivariantPlaylistSrc","getSeekable","getStartDate","getStreamInfoFromHlsjsLevelDetails","getStreamInfoFromPlaylistLines","getStreamInfoFromSrcAndType","getStreamType","getStreamTypeConfig","getTargetLiveWindow","getTextTrack","i18n","initialize","isKeyOf","isMuxVideoSrc","isPseudoEnded","isStuckOnLastFragment","loadMedia","mux","muxMediaState","parseJwt","removeTextTrack","setupChapters","setupCuePoints","setupHls","setupMux","setupNativeFairplayDRM","shorthandKeys","teardown","toAppCertURL","toDRMTypeFromKeySystem","toLicenseKeyURL","toMuxVideoURL","toPlaybackIdFromSrc","toPlaybackIdParts","updateStreamInfoFromHlsjsLevelDetails","updateStreamInfoFromSrc"],"entryPoint":"src/index.ts","inputs":{"../../node_modules/mux-embed/dist/mux.mjs":{"bytesInOutput":83766},"../../node_modules/hls.js/dist/hls.mjs":{"bytesInOutput":393143},"src/hls.ts":{"bytesInOutput":10},"src/errors.ts":{"bytesInOutput":1641},"src/types.ts":{"bytesInOutput":602},"lang/en.json":{"bytesInOutput":25},"src/util.ts":{"bytesInOutput":1393},"src/autoplay.ts":{"bytesInOutput":1074},"src/preload.ts":{"bytesInOutput":563},"src/media-tracks.ts":{"bytesInOutput":1472},"src/text-tracks.ts":{"bytesInOutput":4854},"src/pdt.ts":{"bytesInOutput":360},"src/request-errors.ts":{"bytesInOutput":3931},"src/index.ts":{"bytesInOutput":19760}},"bytes":514394}}}

@@ -1,239 +0,1 @@

{
"inputs": {
"../../node_modules/mux-embed/dist/mux.mjs": {
"bytes": 84239,
"imports": [],
"format": "esm"
},
"../../node_modules/hls.js/dist/hls.mjs": {
"bytes": 994232,
"imports": [],
"format": "esm"
},
"src/hls.ts": {
"bytes": 127,
"imports": [
{
"path": "../../node_modules/hls.js/dist/hls.mjs",
"kind": "import-statement",
"original": "hls.js"
}
],
"format": "esm"
},
"src/errors.ts": {
"bytes": 1336,
"imports": [],
"format": "esm"
},
"src/types.ts": {
"bytes": 5827,
"imports": [],
"format": "esm"
},
"src/util.ts": {
"bytes": 3368,
"imports": [
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
},
"src/autoplay.ts": {
"bytes": 5113,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/preload.ts": {
"bytes": 1932,
"imports": [
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/media-tracks.ts": {
"bytes": 4294,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
}
],
"format": "esm"
},
"src/text-tracks.ts": {
"bytes": 13461,
"imports": [
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "./types",
"kind": "import-statement",
"external": true
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
}
],
"format": "esm"
},
"src/pdt.ts": {
"bytes": 1104,
"imports": [
{
"path": "./types",
"kind": "import-statement",
"external": true
}
],
"format": "esm"
},
"src/index.ts": {
"bytes": 45747,
"imports": [
{
"path": "../../node_modules/mux-embed/dist/mux.mjs",
"kind": "import-statement",
"original": "mux-embed"
},
{
"path": "src/hls.ts",
"kind": "import-statement",
"original": "./hls"
},
{
"path": "src/errors.ts",
"kind": "import-statement",
"original": "./errors"
},
{
"path": "src/autoplay.ts",
"kind": "import-statement",
"original": "./autoplay"
},
{
"path": "src/preload.ts",
"kind": "import-statement",
"original": "./preload"
},
{
"path": "src/media-tracks.ts",
"kind": "import-statement",
"original": "./media-tracks"
},
{
"path": "src/text-tracks.ts",
"kind": "import-statement",
"original": "./text-tracks"
},
{
"path": "src/pdt.ts",
"kind": "import-statement",
"original": "./pdt"
},
{
"path": "src/util.ts",
"kind": "import-statement",
"original": "./util"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
},
{
"path": "src/types.ts",
"kind": "import-statement",
"original": "./types"
}
],
"format": "esm"
}
},
"outputs": {
"dist/playback-core.js.map": {
"imports": [],
"exports": [],
"inputs": {},
"bytes": 2144033
},
"dist/playback-core.js": {
"imports": [],
"exports": [],
"entryPoint": "src/index.ts",
"inputs": {
"../../node_modules/mux-embed/dist/mux.mjs": {
"bytesInOutput": 83766
},
"../../node_modules/hls.js/dist/hls.mjs": {
"bytesInOutput": 393113
},
"src/hls.ts": {
"bytesInOutput": 9
},
"src/errors.ts": {
"bytesInOutput": 852
},
"src/types.ts": {
"bytesInOutput": 602
},
"src/util.ts": {
"bytesInOutput": 710
},
"src/autoplay.ts": {
"bytesInOutput": 1072
},
"src/preload.ts": {
"bytesInOutput": 563
},
"src/media-tracks.ts": {
"bytesInOutput": 1465
},
"src/text-tracks.ts": {
"bytesInOutput": 4849
},
"src/pdt.ts": {
"bytesInOutput": 360
},
"src/index.ts": {
"bytesInOutput": 13332
}
},
"bytes": 500995
}
}
}
{"inputs":{"../../node_modules/mux-embed/dist/mux.mjs":{"bytes":84239,"imports":[],"format":"esm"},"../../node_modules/hls.js/dist/hls.mjs":{"bytes":994232,"imports":[],"format":"esm"},"src/hls.ts":{"bytes":127,"imports":[{"path":"../../node_modules/hls.js/dist/hls.mjs","kind":"import-statement","original":"hls.js"}],"format":"esm"},"src/errors.ts":{"bytes":2928,"imports":[],"format":"esm"},"src/types.ts":{"bytes":5929,"imports":[],"format":"esm"},"lang/en.json":{"bytes":42,"imports":[],"format":"esm"},"src/util.ts":{"bytes":5796,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"lang/en.json","kind":"import-statement","original":"../lang/en.json"}],"format":"esm"},"src/autoplay.ts":{"bytes":5113,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/preload.ts":{"bytes":1932,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/media-tracks.ts":{"bytes":4294,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"}],"format":"esm"},"src/text-tracks.ts":{"bytes":13461,"imports":[{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"./types","kind":"import-statement","external":true},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/pdt.ts":{"bytes":1104,"imports":[{"path":"./types","kind":"import-statement","external":true}],"format":"esm"},"src/request-errors.ts":{"bytes":11048,"imports":[{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/index.ts":{"bytes":60305,"imports":[{"path":"../../node_modules/mux-embed/dist/mux.mjs","kind":"import-statement","original":"mux-embed"},{"path":"src/hls.ts","kind":"import-statement","original":"./hls"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/autoplay.ts","kind":"import-statement","original":"./autoplay"},{"path":"src/preload.ts","kind":"import-statement","original":"./preload"},{"path":"src/media-tracks.ts","kind":"import-statement","original":"./media-tracks"},{"path":"src/text-tracks.ts","kind":"import-statement","original":"./text-tracks"},{"path":"src/pdt.ts","kind":"import-statement","original":"./pdt"},{"path":"src/util.ts","kind":"import-statement","original":"./util"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"../../node_modules/hls.js/dist/hls.mjs","kind":"import-statement","original":"hls.js"},{"path":"src/request-errors.ts","kind":"import-statement","original":"./request-errors"},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"dist/playback-core.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2187219},"dist/playback-core.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"../../node_modules/mux-embed/dist/mux.mjs":{"bytesInOutput":83766},"../../node_modules/hls.js/dist/hls.mjs":{"bytesInOutput":393143},"src/hls.ts":{"bytesInOutput":10},"src/errors.ts":{"bytesInOutput":1641},"src/types.ts":{"bytesInOutput":602},"lang/en.json":{"bytesInOutput":25},"src/util.ts":{"bytesInOutput":1393},"src/autoplay.ts":{"bytesInOutput":1074},"src/preload.ts":{"bytesInOutput":563},"src/media-tracks.ts":{"bytesInOutput":1472},"src/text-tracks.ts":{"bytesInOutput":4854},"src/pdt.ts":{"bytesInOutput":360},"src/request-errors.ts":{"bytesInOutput":3931},"src/index.ts":{"bytesInOutput":19760}},"bytes":512896}}}

@@ -1,4 +0,13 @@

"use strict";var st=Object.create;var N=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ut=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var n in t)N(e,n,{get:t[n],enumerable:!0})},le=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ct(t))!dt.call(e,r)&&r!==n&&N(e,r,{get:()=>t[r],enumerable:!(a=it(t,r))||a.enumerable});return e};var pe=(e,t,n)=>(n=e!=null?st(ut(e)):{},le(t||!e||!e.__esModule?N(n,"default",{value:e,enumerable:!0}):n,e)),pt=e=>le(N({},"__esModule",{value:!0}),e);var Ht={};lt(Ht,{AutoplayTypes:()=>h,CmcdTypeValues:()=>yt,CmcdTypes:()=>C,ExtensionMimeTypeMap:()=>v,Hls:()=>y,MaxResolution:()=>gt,MediaError:()=>L,MimeTypeShorthandMap:()=>A,MinResolution:()=>Mt,PlaybackTypes:()=>_,RenditionOrder:()=>bt,StreamTypes:()=>g,addChapters:()=>Q,addCuePoints:()=>X,addTextTrack:()=>U,allMediaTypes:()=>mt,generatePlayerInitTime:()=>Ct,generateUUID:()=>Be,getActiveChapter:()=>Z,getActiveCuePoint:()=>G,getAppCertificate:()=>Qe,getChapters:()=>Ce,getCuePoints:()=>Pe,getCurrentPdt:()=>Ae,getDRMConfig:()=>Je,getEnded:()=>qe,getError:()=>wt,getLicenseKey:()=>Ze,getLiveEdgeStart:()=>It,getMediaPlaylistLinesFromMultivariantPlaylistSrc:()=>Oe,getSeekable:()=>K,getStartDate:()=>he,getStreamInfoFromHlsjsLevelDetails:()=>Fe,getStreamInfoFromPlaylistLines:()=>Ve,getStreamInfoFromSrcAndType:()=>Ue,getStreamType:()=>te,getStreamTypeConfig:()=>je,getTargetLiveWindow:()=>St,getTextTrack:()=>P,initialize:()=>Nt,isKeyOf:()=>H,isMuxVideoSrc:()=>ie,isPseudoEnded:()=>Ye,isStuckOnLastFragment:()=>oe,loadMedia:()=>nt,mux:()=>S.default,muxMediaState:()=>M,removeTextTrack:()=>Le,setupChapters:()=>ee,setupCuePoints:()=>j,setupHls:()=>Ge,setupMux:()=>tt,setupNativeFairplayDRM:()=>et,shorthandKeys:()=>Tt,teardown:()=>ze,toAppCertURL:()=>se,toDRMTypeFromKeySystem:()=>_e,toLicenseKeyURL:()=>w,toMuxVideoURL:()=>ht,toPlaybackIdFromSrc:()=>re,updateStreamInfoFromHlsjsLevelDetails:()=>We,updateStreamInfoFromSrc:()=>W});module.exports=pt(Ht);var S=pe(require("mux-embed"));var fe=pe(require("hls.js")),y=fe.default;var b=class b extends Error{constructor(n,a=b.MEDIA_ERR_CUSTOM,r,o){var s;super(n);this.name="MediaError",this.code=a,this.context=o,this.fatal=r!=null?r:a>=b.MEDIA_ERR_NETWORK&&a<=b.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(s=b.defaultMessages[this.code])!=null?s:"")}};b.MEDIA_ERR_ABORTED=1,b.MEDIA_ERR_NETWORK=2,b.MEDIA_ERR_DECODE=3,b.MEDIA_ERR_SRC_NOT_SUPPORTED=4,b.MEDIA_ERR_ENCRYPTED=5,b.MEDIA_ERR_CUSTOM=100,b.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var L=b;var ft=e=>e==null,H=(e,t)=>ft(t)?!1:e in t,h={ANY:"any",MUTED:"muted"},g={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},_={MSE:"mse",NATIVE:"native"},C={HEADER:"header",QUERY:"query",NONE:"none"},yt=Object.values(C),v={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},A={HLS:v.M3U8},Tt=Object.keys(A),mt=[...Object.values(v),"hls","HLS"],gt={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},Mt={noLessThan480p:"480p",noLessThan540p:"540p",noLessThan720p:"720p",noLessThan1080p:"1080p",noLessThan1440p:"1440p",noLessThan2160p:"2160p"},bt={DESCENDING:"desc"};var T=(e,t,n,a,r=e)=>{r.addEventListener(t,n,a),e.addEventListener("teardown",()=>{r.removeEventListener(t,n)},{once:!0})};function ye(e,t,n){t&&n>t&&(n=t);for(let a=0;a<e.length;a++)if(e.start(a)<=n&&e.end(a)>=n)return!0;return!1}var Te=e=>{let t=e.indexOf("?");if(t<0)return[e];let n=e.slice(0,t),a=e.slice(t);return[n,a]},D=e=>{let t=e.type;if(t){let a=t.toUpperCase();return H(a,A)?A[a]:t}let{src:n}=e;return n?vt(n):""},B=e=>e==="VOD"?g.ON_DEMAND:g.LIVE,$=e=>e==="EVENT"?Number.POSITIVE_INFINITY:e==="VOD"?Number.NaN:0,vt=e=>{let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let n=t.lastIndexOf(".");if(n<0)return"";let r=t.slice(n+1).toUpperCase();return H(r,v)?v[r]:""};var Lt=Object.values(h),me=e=>typeof e=="boolean"||typeof e=="string"&&Lt.includes(e),ge=(e,t,n)=>{let{autoplay:a}=e,r=!1,o=!1,s=me(a)?a:!!a,i=()=>{r||T(t,"playing",()=>{r=!0},{once:!0})};if(i(),T(t,"loadstart",()=>{r=!1,i(),Y(t,s)},{once:!0}),T(t,"loadstart",()=>{n||(e.streamType&&e.streamType!==g.UNKNOWN?o=e.streamType===g.LIVE:o=!Number.isFinite(t.duration)),Y(t,s)},{once:!0}),n&&n.once(y.Events.LEVEL_LOADED,(u,d)=>{var c;e.streamType&&e.streamType!==g.UNKNOWN?o=e.streamType===g.LIVE:o=(c=d.details.live)!=null?c:!1}),!s){let u=()=>{!o||Number.isFinite(e.startTime)||(n!=null&&n.liveSyncPosition?t.currentTime=n.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.seekable.end(0)))};n&&T(t,"play",()=>{t.preload==="metadata"?n.once(y.Events.LEVEL_UPDATED,u):u()},{once:!0})}return u=>{r||(s=me(u)?u:!!u,Y(t,s))}},Y=(e,t)=>{if(!t)return;let n=e.muted,a=()=>e.muted=n;switch(t){case h.ANY:e.play().catch(()=>{e.muted=!0,e.play().catch(a)});break;case h.MUTED:e.muted=!0,e.play().catch(a);break;default:e.play().catch(()=>{});break}};var Me=({preload:e,src:t},n,a)=>{let r=c=>{c!=null&&["","none","metadata","auto"].includes(c)?n.setAttribute("preload",c):n.removeAttribute("preload")};if(!a)return r(e),r;let o=!1,s=!1,i=a.config.maxBufferLength,l=a.config.maxBufferSize,u=c=>{r(c);let p=c!=null?c:n.preload;s||p==="none"||(p==="metadata"?(a.config.maxBufferLength=1,a.config.maxBufferSize=1):(a.config.maxBufferLength=i,a.config.maxBufferSize=l),d())},d=()=>{!o&&t&&(o=!0,a.loadSource(t))};return T(n,"play",()=>{s=!0,a.config.maxBufferLength=i,a.config.maxBufferSize=l,d()},{once:!0}),u(e),u};function be(e,t){var l;if(!("videoTracks"in e))return;let n=new WeakMap;t.on(y.Events.MANIFEST_PARSED,function(u,d){i();let c=e.addVideoTrack("main");c.selected=!0;for(let[p,f]of d.levels.entries()){let m=c.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);n.set(f,`${p}`),m.id=`${p}`}}),t.on(y.Events.AUDIO_TRACKS_UPDATED,function(u,d){s();for(let c of d.audioTracks){let p=c.default?"main":"alternative",f=e.addAudioTrack(p,c.name,c.lang);f.id=`${c.id}`,c.default&&(f.enabled=!0)}}),e.audioTracks.addEventListener("change",()=>{var c;let u=+((c=[...e.audioTracks].find(p=>p.enabled))==null?void 0:c.id),d=t.audioTracks.map(p=>p.id);u!=t.audioTrack&&d.includes(u)&&(t.audioTrack=u)}),t.on(y.Events.LEVELS_UPDATED,function(u,d){var f;let c=e.videoTracks[(f=e.videoTracks.selectedIndex)!=null?f:0];if(!c)return;let p=d.levels.map(m=>n.get(m));for(let m of e.videoRenditions)m.id&&!p.includes(m.id)&&c.removeRendition(m)});let a=u=>{let d=u.target.selectedIndex;d!=t.nextLevel&&r(d)},r=u=>{let d=e.currentTime,c=!1,p=(f,m)=>{c||(c=!Number.isFinite(m.endOffset))};t.on(y.Events.BUFFER_FLUSHING,p),t.nextLevel=u,t.off(y.Events.BUFFER_FLUSHING,p),c||t.trigger(y.Events.BUFFER_FLUSHING,{startOffset:d+10,endOffset:1/0,type:"video"})};(l=e.videoRenditions)==null||l.addEventListener("change",a);let o=()=>{for(let u of e.videoTracks)e.removeVideoTrack(u)},s=()=>{for(let u of e.audioTracks)e.removeAudioTrack(u)},i=()=>{o(),s()};t.once(y.Events.DESTROYING,i)}var q=e=>"time"in e?e.time:e.startTime;function ve(e,t){t.on(y.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:o})=>{o.forEach(s=>{var u;let i=(u=s.subtitleTrack)!=null?u:s.closedCaptions,l=t.subtitleTracks.findIndex(({lang:d,name:c,type:p})=>d==(i==null?void 0:i.lang)&&c===s.label&&p.toLowerCase()===s.kind);U(e,s.kind,s.label,i==null?void 0:i.lang,`${s.kind}${l}`)})});let n=()=>{var s;if(!t.subtitleTracks.length)return;let r=Array.from(e.textTracks).find(i=>i.id&&i.mode==="showing"&&["subtitles","captions"].includes(i.kind)),o=`${(s=t.subtitleTracks[t.subtitleTrack])==null?void 0:s.type.toLowerCase()}${t.subtitleTrack}`;if(r&&(t.subtitleTrack<0||(r==null?void 0:r.id)!==o)){let i=t.subtitleTracks.findIndex(({lang:l,name:u,type:d})=>l==r.language&&u===r.label&&d.toLowerCase()===r.kind);t.subtitleTrack=i}r&&(r==null?void 0:r.id)===o&&r.cues&&Array.from(r.cues).forEach(i=>{r.addCue(i)})};e.textTracks.addEventListener("change",n),t.on(y.Events.CUES_PARSED,(r,{track:o,cues:s})=>{let i=e.textTracks.getTrackById(o);if(!i)return;let l=i.mode==="disabled";l&&(i.mode="hidden"),s.forEach(u=>{var d;(d=i.cues)!=null&&d.getCueById(u.id)||i.addCue(u)}),l&&(i.mode="disabled")}),t.once(y.Events.DESTROYING,()=>{e.textTracks.removeEventListener("change",n),e.querySelectorAll("track[data-removeondestroy]").forEach(o=>{o.remove()})});let a=()=>{Array.from(e.textTracks).forEach(r=>{var o,s;if(!["subtitles","caption"].includes(r.kind)&&r.label==="thumbnails"){if(!((o=r.cues)!=null&&o.length)){let i=e.querySelector('track[label="thumbnails"]'),l=(s=i==null?void 0:i.getAttribute("src"))!=null?s:"";i==null||i.removeAttribute("src"),setTimeout(()=>{i==null||i.setAttribute("src",l)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};t.once(y.Events.MANIFEST_LOADED,a),t.once(y.Events.MEDIA_ATTACHED,a)}function U(e,t,n,a,r){let o=document.createElement("track");return o.kind=t,o.label=n,a&&(o.srclang=a),r&&(o.id=r),o.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",o.setAttribute("data-removeondestroy",""),e.append(o),o.track}function Le(e,t){let n=Array.prototype.find.call(e.querySelectorAll("track"),a=>a.track===t);n==null||n.remove()}function P(e,t,n){var a;return(a=Array.from(e.querySelectorAll("track")).find(r=>r.track.label===t&&r.track.kind===n))==null?void 0:a.track}async function xe(e,t,n,a){let r=P(e,n,a);return r||(r=U(e,a,n),r.mode="hidden",await new Promise(o=>setTimeout(()=>o(void 0),0))),r.mode!=="hidden"&&(r.mode="hidden"),[...t].sort((o,s)=>q(s)-q(o)).forEach(o=>{var l,u;let s=o.value,i=q(o);if("endTime"in o&&o.endTime!=null)r==null||r.addCue(new VTTCue(i,o.endTime,a==="chapters"?s:JSON.stringify(s!=null?s:null)));else{let d=Array.prototype.findIndex.call(r==null?void 0:r.cues,m=>m.startTime>=i),c=(l=r==null?void 0:r.cues)==null?void 0:l[d],p=c?c.startTime:Number.isFinite(e.duration)?e.duration:Number.MAX_SAFE_INTEGER,f=(u=r==null?void 0:r.cues)==null?void 0:u[d-1];f&&(f.endTime=i),r==null||r.addCue(new VTTCue(i,p,a==="chapters"?s:JSON.stringify(s!=null?s:null)))}}),e.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r}var z="cuepoints",ke=Object.freeze({label:z});async function X(e,t,n=ke){return xe(e,t,n.label,"metadata")}var O=e=>({time:e.startTime,value:JSON.parse(e.text)});function Pe(e,t={label:z}){let n=P(e,t.label,"metadata");return n!=null&&n.cues?Array.from(n.cues,a=>O(a)):[]}function G(e,t={label:z}){var o,s;let n=P(e,t.label,"metadata");if(!((o=n==null?void 0:n.activeCues)!=null&&o.length))return;if(n.activeCues.length===1)return O(n.activeCues[0]);let{currentTime:a}=e,r=Array.prototype.find.call((s=n.activeCues)!=null?s:[],({startTime:i,endTime:l})=>i<=a&&l>a);return O(r||n.activeCues[0])}async function j(e,t=ke){return new Promise(n=>{T(e,"loadstart",async()=>{let a=await X(e,[],t);T(e,"cuechange",()=>{let r=G(e);if(r){let o=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});e.dispatchEvent(o)}},{},a),n(a)})})}var J="chapters",Ee=Object.freeze({label:J}),V=e=>({startTime:e.startTime,endTime:e.endTime,value:e.text});async function Q(e,t,n=Ee){return xe(e,t,n.label,"chapters")}function Ce(e,t={label:J}){var a;let n=P(e,t.label,"chapters");return(a=n==null?void 0:n.cues)!=null&&a.length?Array.from(n.cues,r=>V(r)):[]}function Z(e,t={label:J}){var o,s;let n=P(e,t.label,"chapters");if(!((o=n==null?void 0:n.activeCues)!=null&&o.length))return;if(n.activeCues.length===1)return V(n.activeCues[0]);let{currentTime:a}=e,r=Array.prototype.find.call((s=n.activeCues)!=null?s:[],({startTime:i,endTime:l})=>i<=a&&l>a);return V(r||n.activeCues[0])}async function ee(e,t=Ee){return new Promise(n=>{T(e,"loadstart",async()=>{let a=await Q(e,[],t);T(e,"cuechange",()=>{let r=Z(e);if(r){let o=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});e.dispatchEvent(o)}},{},a),n(a)})})}function he(e,t){if(t){let n=t.playingDate;if(n!=null)return new Date(n.getTime()-e.currentTime*1e3)}return typeof e.getStartDate=="function"?e.getStartDate():new Date(NaN)}function Ae(e,t){if(t&&t.playingDate)return t.playingDate;if(typeof e.getStartDate=="function"){let n=e.getStartDate();return new Date(n.getTime()+e.currentTime*1e3)}return new Date(NaN)}var F={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},_e=e=>{if(e.includes("fps"))return F.FAIRPLAY;if(e.includes("playready"))return F.PLAYREADY;if(e.includes("widevine"))return F.WIDEVINE},Oe=async e=>fetch(e).then(t=>t.text()).then(t=>{let n=t.split(`
`).find((a,r,o)=>r&&o[r-1].startsWith("#EXT-X-STREAM-INF"));return fetch(n).then(a=>a.text()).then(a=>a.split(`
`))}),Ve=e=>{var s,i,l;let n=(i=((s=e.find(u=>u.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?s:"").split(":")[1])==null?void 0:i.trim(),a=B(n),r=$(n),o;if(a===g.LIVE){let u=e.find(c=>c.startsWith("#EXT-X-PART-INF"));if(!!u)o=+u.split(":")[1].split("=")[1]*2;else{let c=e.find(m=>m.startsWith("#EXT-X-TARGETDURATION")),p=(l=c==null?void 0:c.split(":"))==null?void 0:l[1];o=+(p!=null?p:6)*3}}return{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o}},Ue=async(e,t)=>{if(t===v.MP4)return{streamType:g.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(t===v.M3U8){let n=await Oe(e);return Ve(n)}return console.error(`Media type ${t} is an unrecognized or unsupported type for src ${e}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},W=async(e,t,n=D({src:e}))=>{var s,i,l;let{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o}=await Ue(e,n);((s=M.get(t))!=null?s:{}).liveEdgeStartOffset=o,((i=M.get(t))!=null?i:{}).targetLiveWindow=r,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((l=M.get(t))!=null?l:{}).streamType=a,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Fe=e=>{var s;let t=e.type,n=B(t),a=$(t),r,o=!!((s=e.partList)!=null&&s.length);return n===g.LIVE&&(r=o?e.partTarget*2:e.targetduration*3),{streamType:n,targetLiveWindow:a,liveEdgeStartOffset:r,lowLatency:o}},We=(e,t,n)=>{var i,l,u,d,c,p,f,m;let{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o,lowLatency:s}=Fe(e);if(a===g.LIVE){s?(n.config.backBufferLength=(i=n.userConfig.backBufferLength)!=null?i:4,n.config.maxFragLookUpTolerance=(l=n.userConfig.maxFragLookUpTolerance)!=null?l:.001,n.config.abrBandWidthUpFactor=(u=n.userConfig.abrBandWidthUpFactor)!=null?u:n.config.abrBandWidthFactor):n.config.backBufferLength=(d=n.userConfig.backBufferLength)!=null?d:8;let E=Object.freeze({get length(){return t.seekable.length},start(x){return t.seekable.start(x)},end(x){var I;return x>this.length||x<0||Number.isFinite(t.duration)?t.seekable.end(x):(I=n.liveSyncPosition)!=null?I:t.seekable.end(x)}});((c=M.get(t))!=null?c:{}).seekable=E}((p=M.get(t))!=null?p:{}).liveEdgeStartOffset=o,((f=M.get(t))!=null?f:{}).targetLiveWindow=r,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((m=M.get(t))!=null?m:{}).streamType=a,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},De,we,xt=(we=(De=globalThis==null?void 0:globalThis.navigator)==null?void 0:De.userAgent)!=null?we:"",Se,Ie,Re,kt=(Re=(Ie=(Se=globalThis==null?void 0:globalThis.navigator)==null?void 0:Se.userAgentData)==null?void 0:Ie.platform)!=null?Re:"",Pt=xt.toLowerCase().includes("android")||["x11","android"].some(e=>kt.toLowerCase().includes(e)),M=new WeakMap,k="mux.com",Ne,He,Ke=(He=(Ne=y).isSupported)==null?void 0:He.call(Ne),Et=Pt,Ct=()=>S.default.utils.now(),Be=S.default.utils.generateUUID,ht=({playbackId:e,customDomain:t=k,maxResolution:n,minResolution:a,renditionOrder:r,programStartTime:o,programEndTime:s,tokens:{playback:i}={},extraSourceParams:l={}}={})=>{if(!e)return;let[u,d=""]=Te(e),c=new URL(`https://stream.${t}/${u}.m3u8${d}`);return i||c.searchParams.has("token")?(c.searchParams.forEach((p,f)=>{f!="token"&&c.searchParams.delete(f)}),i&&c.searchParams.set("token",i)):(n&&c.searchParams.set("max_resolution",n),a&&(c.searchParams.set("min_resolution",a),n&&+n.slice(0,-1)<+a.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",a,"maxResolution",n)),r&&c.searchParams.set("rendition_order",r),o&&c.searchParams.set("program_start_time",`${o}`),s&&c.searchParams.set("program_end_time",`${s}`),Object.entries(l).forEach(([p,f])=>{f!=null&&c.searchParams.set(p,f)})),c.toString()},At=e=>{if(!e)return;let[t]=e.split("?");return t||void 0},re=e=>{if(!e||!e.startsWith("https://stream."))return;let[t]=new URL(e).pathname.slice(1).split(".m3u8");return t||void 0},Dt=e=>{var t,n,a;return(t=e==null?void 0:e.metadata)!=null&&t.video_id?e.metadata.video_id:ie(e)&&(a=(n=At(e.playbackId))!=null?n:re(e.src))!=null?a:e.src},wt=e=>{var t;return(t=M.get(e))==null?void 0:t.error},te=e=>{var t,n;return(n=(t=M.get(e))==null?void 0:t.streamType)!=null?n:g.UNKNOWN},St=e=>{var t,n;return(n=(t=M.get(e))==null?void 0:t.targetLiveWindow)!=null?n:Number.NaN},K=e=>{var t,n;return(n=(t=M.get(e))==null?void 0:t.seekable)!=null?n:e.seekable},It=e=>{var a;let t=(a=M.get(e))==null?void 0:a.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let n=K(e);return n.length?n.end(n.length-1)-t:Number.NaN},ae=.034,Rt=(e,t,n=ae)=>Math.abs(e-t)<=n,$e=(e,t,n=ae)=>e>t||Rt(e,t,n),Ye=(e,t=ae)=>e.paused&&$e(e.currentTime,e.duration,t),oe=(e,t)=>{var u,d,c;if(!t||!e.buffered.length)return;if(e.readyState>2)return!1;let n=t.currentLevel>=0?(d=(u=t.levels)==null?void 0:u[t.currentLevel])==null?void 0:d.details:(c=t.levels.find(p=>!!p.details))==null?void 0:c.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(e.currentTime<e.duration-(n.targetduration+.5))return!1;let r=a[a.length-1];if(e.currentTime<=r.start)return!1;let o=r.start+r.duration/2,s=e.buffered.start(e.buffered.length-1),i=e.buffered.end(e.buffered.length-1);return o>s&&o<i},qe=(e,t)=>e.ended||e.loop?e.ended:t&&oe(e,t)?!0:Ye(e),Nt=(e,t,n)=>{ze(t,n);let{metadata:a={}}=e,{view_session_id:r=Be()}=a,o=Dt(e);a.view_session_id=r,a.video_id=o,e.metadata=a;let s=d=>{var c;(c=t.mux)==null||c.emit("hb",{view_drm_type:d})};e.drmTypeCb=s,M.set(t,{});let i=Ge(e,t),l=Me(e,t,i);tt(e,t,i),nt(e,t,i),j(t),ee(t);let u=ge(e,t,i);return{engine:i,setAutoplay:u,setPreload:l}},ze=(e,t)=>{let n=t==null?void 0:t.engine;n&&(n.detachMedia(),n.destroy()),e!=null&&e.mux&&!e.mux.deleted&&(e.mux.destroy(),delete e.mux),e&&(e.removeAttribute("src"),e.load(),e.removeEventListener("error",at),e.removeEventListener("error",ne),e.removeEventListener("durationchange",rt),M.delete(e),e.dispatchEvent(new Event("teardown")))};function Xe(e,t){var u;let n=D(e);if(!(n===v.M3U8))return!0;let r=!n||((u=t.canPlayType(n))!=null?u:!0),{preferPlayback:o}=e,s=o===_.MSE,i=o===_.NATIVE;return r&&(i||!(Ke&&(s||Et)))}var Ge=(e,t)=>{let{debug:n,streamType:a,startTime:r=-1,metadata:o,preferCmcd:s,_hlsConfig:i={}}=e,u=D(e)===v.M3U8,d=Xe(e,t);if(u&&!d&&Ke){let c={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},p=je(a),f=Je(e),m=s!==C.NONE?{useHeaders:s===C.HEADER,sessionId:o==null?void 0:o.view_session_id,contentId:o==null?void 0:o.video_id}:void 0;return new y({debug:n,startPosition:r,cmcd:m,xhrSetup:(x,I)=>{var ce,ue;if(s&&s!==C.QUERY)return;let R=new URL(I);if(!R.searchParams.has("CMCD"))return;let ot=((ue=(ce=R.searchParams.get("CMCD"))==null?void 0:ce.split(","))!=null?ue:[]).filter(de=>de.startsWith("sid")||de.startsWith("cid")).join(",");R.searchParams.set("CMCD",ot),x.open("GET",R)},...c,...p,...f,...i})}},je=e=>e===g.LIVE?{backBufferLength:8}:{},Je=e=>{let{drmToken:t,src:n,playbackId:a=re(n),drmTypeCb:r}=e;return!t||!a?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:w(e,"fairplay"),serverCertificateUrl:se(e,"fairplay")},"com.widevine.alpha":{licenseUrl:w(e,"widevine")},"com.microsoft.playready":{licenseUrl:w(e,"playready")}},requestMediaKeySystemAccessFunc:(o,s)=>(o==="com.widevine.alpha"&&(s=[...s.map(i=>{var u;let l=(u=i.videoCapabilities)==null?void 0:u.map(d=>({...d,robustness:"HW_SECURE_ALL"}));return{...i,videoCapabilities:l}}),...s]),navigator.requestMediaKeySystemAccess(o,s).then(i=>{let l=_e(o);return r==null||r(l),i}))}},Qe=async e=>await(await fetch(e)).arrayBuffer(),Ze=async(e,t)=>{let a=await(await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e})).arrayBuffer();return new Uint8Array(a)},et=(e,t)=>{T(t,"encrypted",async a=>{try{let r=a.initDataType;if(r!=="skd"){console.error(`Received unexpected initialization data type "${r}"`);return}if(!t.mediaKeys){let d=await(await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[r],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(p=>{var f;return(f=e.drmTypeCb)==null||f.call(e,F.FAIRPLAY),p})).createMediaKeys(),c=await Qe(se(e,"fairplay"));await d.setServerCertificate(c),await t.setMediaKeys(d)}let o=a.initData;if(o==null){console.error(`Could not start encrypted playback due to missing initData in ${a.type} event`);return}let s=t.mediaKeys.createSession();s.generateRequest(r,o);let i=await new Promise(u=>{s.addEventListener("message",d=>{u(d.message)},{once:!0})}),l=await Ze(i,w(e,"fairplay"));return await s.update(l),s}catch(r){console.error(`Could not start encrypted playback due to exception "${r}"`)}})},w=({playbackId:e,drmToken:t,customDomain:n=k},a)=>`https://license.${n.toLocaleLowerCase().endsWith(k)?n:k}/license/${a}/${e}?token=${t}`,se=({playbackId:e,drmToken:t,customDomain:n=k},a)=>`https://license.${n.toLocaleLowerCase().endsWith(k)?n:k}/appcert/${a}/${e}?token=${t}`,ie=({playbackId:e,src:t,customDomain:n})=>{if(e)return!0;if(typeof t!="string")return!1;let a=window==null?void 0:window.location.href,r=new URL(t,a).hostname.toLocaleLowerCase();return r.includes(k)||!!n&&r.includes(n.toLocaleLowerCase())},tt=(e,t,n)=>{var s;let{envKey:a,disableTracking:r}=e,o=ie(e);if(!r&&(a||o)){let{playerInitTime:i,playerSoftwareName:l,playerSoftwareVersion:u,beaconCollectionDomain:d,debug:c,disableCookies:p}=e,f={...e.metadata,video_title:((s=e==null?void 0:e.metadata)==null?void 0:s.video_title)||void 0},m=E=>typeof E.player_error_code=="string"?!1:typeof e.errorTranslator=="function"?e.errorTranslator(E):E;S.default.monitor(t,{debug:c,beaconCollectionDomain:d,hlsjs:n,Hls:n?y:void 0,automaticErrorTracking:!1,errorTranslator:m,disableCookies:p,data:{...a?{env_key:a}:{},player_software_name:l,player_software:l,player_software_version:u,player_init_time:i,...f}})}},nt=(e,t,n)=>{var u;let a=Xe(e,t),{src:r}=e,o=()=>{t.ended||!qe(t,n)||(oe(t,n)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},s,i,l=()=>{var p,f;let d=(p=K(t))==null?void 0:p.start(0),c=(f=K(t))==null?void 0:f.end(0);(i!==c||s!==d)&&t.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),s=d,i=c};if(T(t,"durationchange",l),t&&a){let d=D(e);if(typeof r=="string"){let c=()=>{if(te(t)!==g.LIVE||Number.isFinite(t.duration))return;let p=setInterval(l,1e3);t.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),T(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(p)})};if(t.preload==="none"){let p=()=>{W(r,t,d).then(c),t.removeEventListener("loadedmetadata",f)},f=()=>{W(r,t,d).then(c),t.removeEventListener("play",p)};T(t,"play",p,{once:!0}),T(t,"loadedmetadata",f,{once:!0})}else W(r,t,d).then(c);e.drmToken&&et(e,t),t.setAttribute("src",r),e.startTime&&(((u=M.get(t))!=null?u:{}).startTime=e.startTime,t.addEventListener("durationchange",rt,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",at),t.addEventListener("error",ne),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(p=>{p.remove()})},{once:!0}),T(t,"pause",o),T(t,"seeked",o),T(t,"play",()=>{t.ended||$e(t.currentTime,t.duration)&&(t.currentTime=t.seekable.length?t.seekable.start(0):0)})}else n&&r?(n.once(y.Events.LEVEL_LOADED,(d,c)=>{We(c.details,t,n),l(),te(t)===g.LIVE&&!Number.isFinite(t.duration)&&(n.on(y.Events.LEVEL_UPDATED,l),T(t,"durationchange",()=>{Number.isFinite(t.duration)&&n.off(y.Events.LEVELS_UPDATED,l)}))}),n.on(y.Events.ERROR,(d,c)=>{let p={[y.ErrorTypes.NETWORK_ERROR]:L.MEDIA_ERR_NETWORK,[y.ErrorTypes.MEDIA_ERROR]:L.MEDIA_ERR_DECODE},f=new L("",p[c.type]);f.fatal=c.fatal,f.data=c,t.dispatchEvent(new CustomEvent("error",{detail:f}))}),t.addEventListener("error",ne),T(t,"waiting",o),be(e,n),ve(t,n),n.attachMedia(t)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function rt(e){var a;let t=e.target,n=(a=M.get(t))==null?void 0:a.startTime;if(n&&ye(t.seekable,t.duration,n)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=n,r&&(t.preload="auto")}}async function at(e){if(!e.isTrusted)return;e.stopImmediatePropagation();let t=e.target;if(!(t!=null&&t.error))return;let{message:n,code:a}=t.error,r=new L(n,a);if(t.src&&(a!==L.MEDIA_ERR_DECODE||a!==void 0))try{let{status:o}=await fetch(t.src);r.data={response:{code:o}}}catch{}t.dispatchEvent(new CustomEvent("error",{detail:r}))}function ne(e){var a,r;if(!(e instanceof CustomEvent)||!(e.detail instanceof L))return;let t=e.target,n=e.detail;!n||!n.fatal||(((a=M.get(t))!=null?a:{}).error=n,(r=t.mux)==null||r.emit("error",{player_error_code:n.code,player_error_message:n.message,player_error_context:n.context}))}
"use strict";var xt=Object.create;var $=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var kt=(e,t)=>{for(var r in t)$(e,r,{get:t[r],enumerable:!0})},be=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dt(t))!_t.call(e,o)&&o!==r&&$(e,o,{get:()=>t[o],enumerable:!(n=vt(t,o))||n.enumerable});return e};var xe=(e,t,r)=>(r=e!=null?xt(Pt(e)):{},be(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),ht=e=>be($({},"__esModule",{value:!0}),e);var er={};kt(er,{AutoplayTypes:()=>U,CmcdTypeValues:()=>Lt,CmcdTypes:()=>w,ExtensionMimeTypeMap:()=>L,Hls:()=>R,MaxResolution:()=>St,MediaError:()=>f,MimeTypeShorthandMap:()=>H,MinResolution:()=>wt,MuxErrorCategory:()=>C,MuxErrorCode:()=>g,MuxJWTAud:()=>X,PlaybackTypes:()=>B,RenditionOrder:()=>Ot,StreamTypes:()=>D,addChapters:()=>le,addCuePoints:()=>ie,addTextTrack:()=>z,allMediaTypes:()=>At,errorCategoryToTokenNameOrPrefix:()=>O,generatePlayerInitTime:()=>Jt,generateUUID:()=>at,getActiveChapter:()=>pe,getActiveCuePoint:()=>ce,getAppCertificate:()=>Et,getChapters:()=>Ke,getCuePoints:()=>Ve,getCurrentPdt:()=>We,getDRMConfig:()=>yt,getEnded:()=>dt,getError:()=>it,getLicenseKey:()=>mt,getLiveEdgeStart:()=>zt,getMediaPlaylistLinesFromMultivariantPlaylistSrc:()=>Qe,getSeekable:()=>Z,getStartDate:()=>Ye,getStreamInfoFromHlsjsLevelDetails:()=>rt,getStreamInfoFromPlaylistLines:()=>Ze,getStreamInfoFromSrcAndType:()=>et,getStreamType:()=>Te,getStreamTypeConfig:()=>Tt,getTargetLiveWindow:()=>qt,getTextTrack:()=>A,i18n:()=>m,initialize:()=>Qt,isKeyOf:()=>S,isMuxVideoSrc:()=>Me,isPseudoEnded:()=>ut,isStuckOnLastFragment:()=>me,loadMedia:()=>Rt,mux:()=>W.default,muxMediaState:()=>P,parseJwt:()=>G,removeTextTrack:()=>Oe,setupChapters:()=>fe,setupCuePoints:()=>ue,setupHls:()=>ft,setupMux:()=>Mt,setupNativeFairplayDRM:()=>gt,shorthandKeys:()=>It,teardown:()=>lt,toAppCertURL:()=>ge,toDRMTypeFromKeySystem:()=>Xe,toLicenseKeyURL:()=>Y,toMuxVideoURL:()=>Gt,toPlaybackIdFromSrc:()=>st,toPlaybackIdParts:()=>V,updateStreamInfoFromHlsjsLevelDetails:()=>nt,updateStreamInfoFromSrc:()=>tt});module.exports=ht(er);var W=xe(require("mux-embed"));var ve=xe(require("hls.js")),R=ve.default;var C={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},g={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},O=e=>e===C.VIDEO?"playback":e,_=class _ extends Error{constructor(r,n=_.MEDIA_ERR_CUSTOM,o,a){var s;super(r);this.name="MediaError",this.code=n,this.context=a,this.fatal=o!=null?o:n>=_.MEDIA_ERR_NETWORK&&n<=_.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(s=_.defaultMessages[this.code])!=null?s:"")}};_.MEDIA_ERR_ABORTED=1,_.MEDIA_ERR_NETWORK=2,_.MEDIA_ERR_DECODE=3,_.MEDIA_ERR_SRC_NOT_SUPPORTED=4,_.MEDIA_ERR_ENCRYPTED=5,_.MEDIA_ERR_CUSTOM=100,_.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var f=_;var Nt=e=>e==null,S=(e,t)=>Nt(t)?!1:e in t,U={ANY:"any",MUTED:"muted"},D={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},B={MSE:"mse",NATIVE:"native"},w={HEADER:"header",QUERY:"query",NONE:"none"},Lt=Object.values(w),L={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},H={HLS:L.M3U8},It=Object.keys(H),At=[...Object.values(L),"hls","HLS"],St={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},wt={noLessThan480p:"480p",noLessThan540p:"540p",noLessThan720p:"720p",noLessThan1080p:"1080p",noLessThan1440p:"1440p",noLessThan2160p:"2160p"},Ot={DESCENDING:"desc"};var Ut="en",J={code:Ut};var x=(e,t,r,n,o=e)=>{o.addEventListener(t,r,n),e.addEventListener("teardown",()=>{o.removeEventListener(t,r)},{once:!0})};function De(e,t,r){t&&r>t&&(r=t);for(let n=0;n<e.length;n++)if(e.start(n)<=r&&e.end(n)>=r)return!0;return!1}var V=e=>{let t=e.indexOf("?");if(t<0)return[e];let r=e.slice(0,t),n=e.slice(t);return[r,n]},F=e=>{let t=e.type;if(t){let n=t.toUpperCase();return S(n,H)?H[n]:t}let{src:r}=e;return r?Ht(r):""},re=e=>e==="VOD"?D.ON_DEMAND:D.LIVE,ne=e=>e==="EVENT"?Number.POSITIVE_INFINITY:e==="VOD"?Number.NaN:0,Ht=e=>{let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let r=t.lastIndexOf(".");if(r<0)return"";let o=t.slice(r+1).toUpperCase();return S(o,L)?L[o]:""},G=e=>{let t=(e!=null?e:"").split(".")[1];if(t)try{let r=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(r).split("").map(function(o){return"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n)}catch{return}},Pe=({exp:e},t=Date.now())=>!e||e*1e3<t,_e=({sub:e},t)=>e!==t,ke=({aud:e},t)=>!e,he=({aud:e},t)=>e!==t,Ne="en";function m(e,t=!0){var o,a;let r=t&&(a=(o=J)==null?void 0:o[e])!=null?a:e,n=t?J.code:Ne;return new te(r,n)}var te=class{constructor(t,r=(n=>(n=J)!=null?n:Ne)()){this.message=t,this.locale=r}format(t){return this.message.replace(/\{(\w+)\}/g,(r,n)=>{var o;return(o=t[n])!=null?o:""})}toString(){return this.message}};var Vt=Object.values(U),Le=e=>typeof e=="boolean"||typeof e=="string"&&Vt.includes(e),Ie=(e,t,r)=>{let{autoplay:n}=e,o=!1,a=!1,s=Le(n)?n:!!n,u=()=>{o||x(t,"playing",()=>{o=!0},{once:!0})};if(u(),x(t,"loadstart",()=>{o=!1,u(),oe(t,s)},{once:!0}),x(t,"loadstart",()=>{r||(e.streamType&&e.streamType!==D.UNKNOWN?a=e.streamType===D.LIVE:a=!Number.isFinite(t.duration)),oe(t,s)},{once:!0}),r&&r.once(R.Events.LEVEL_LOADED,(c,i)=>{var d;e.streamType&&e.streamType!==D.UNKNOWN?a=e.streamType===D.LIVE:a=(d=i.details.live)!=null?d:!1}),!s){let c=()=>{!a||Number.isFinite(e.startTime)||(r!=null&&r.liveSyncPosition?t.currentTime=r.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.seekable.end(0)))};r&&x(t,"play",()=>{t.preload==="metadata"?r.once(R.Events.LEVEL_UPDATED,c):c()},{once:!0})}return c=>{o||(s=Le(c)?c:!!c,oe(t,s))}},oe=(e,t)=>{if(!t)return;let r=e.muted,n=()=>e.muted=r;switch(t){case U.ANY:e.play().catch(()=>{e.muted=!0,e.play().catch(n)});break;case U.MUTED:e.muted=!0,e.play().catch(n);break;default:e.play().catch(()=>{});break}};var Ae=({preload:e,src:t},r,n)=>{let o=d=>{d!=null&&["","none","metadata","auto"].includes(d)?r.setAttribute("preload",d):r.removeAttribute("preload")};if(!n)return o(e),o;let a=!1,s=!1,u=n.config.maxBufferLength,p=n.config.maxBufferSize,c=d=>{o(d);let l=d!=null?d:r.preload;s||l==="none"||(l==="metadata"?(n.config.maxBufferLength=1,n.config.maxBufferSize=1):(n.config.maxBufferLength=u,n.config.maxBufferSize=p),i())},i=()=>{!a&&t&&(a=!0,n.loadSource(t))};return x(r,"play",()=>{s=!0,n.config.maxBufferLength=u,n.config.maxBufferSize=p,i()},{once:!0}),c(e),c};function Se(e,t){var p;if(!("videoTracks"in e))return;let r=new WeakMap;t.on(R.Events.MANIFEST_PARSED,function(c,i){u();let d=e.addVideoTrack("main");d.selected=!0;for(let[l,T]of i.levels.entries()){let y=d.addRendition(T.url[0],T.width,T.height,T.videoCodec,T.bitrate);r.set(T,`${l}`),y.id=`${l}`}}),t.on(R.Events.AUDIO_TRACKS_UPDATED,function(c,i){s();for(let d of i.audioTracks){let l=d.default?"main":"alternative",T=e.addAudioTrack(l,d.name,d.lang);T.id=`${d.id}`,d.default&&(T.enabled=!0)}}),e.audioTracks.addEventListener("change",()=>{var d;let c=+((d=[...e.audioTracks].find(l=>l.enabled))==null?void 0:d.id),i=t.audioTracks.map(l=>l.id);c!=t.audioTrack&&i.includes(c)&&(t.audioTrack=c)}),t.on(R.Events.LEVELS_UPDATED,function(c,i){var T;let d=e.videoTracks[(T=e.videoTracks.selectedIndex)!=null?T:0];if(!d)return;let l=i.levels.map(y=>r.get(y));for(let y of e.videoRenditions)y.id&&!l.includes(y.id)&&d.removeRendition(y)});let n=c=>{let i=c.target.selectedIndex;i!=t.nextLevel&&o(i)},o=c=>{let i=e.currentTime,d=!1,l=(T,y)=>{d||(d=!Number.isFinite(y.endOffset))};t.on(R.Events.BUFFER_FLUSHING,l),t.nextLevel=c,t.off(R.Events.BUFFER_FLUSHING,l),d||t.trigger(R.Events.BUFFER_FLUSHING,{startOffset:i+10,endOffset:1/0,type:"video"})};(p=e.videoRenditions)==null||p.addEventListener("change",n);let a=()=>{for(let c of e.videoTracks)e.removeVideoTrack(c)},s=()=>{for(let c of e.audioTracks)e.removeAudioTrack(c)},u=()=>{a(),s()};t.once(R.Events.DESTROYING,u)}var ae=e=>"time"in e?e.time:e.startTime;function we(e,t){t.on(R.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(o,{tracks:a})=>{a.forEach(s=>{var c;let u=(c=s.subtitleTrack)!=null?c:s.closedCaptions,p=t.subtitleTracks.findIndex(({lang:i,name:d,type:l})=>i==(u==null?void 0:u.lang)&&d===s.label&&l.toLowerCase()===s.kind);z(e,s.kind,s.label,u==null?void 0:u.lang,`${s.kind}${p}`)})});let r=()=>{var s;if(!t.subtitleTracks.length)return;let o=Array.from(e.textTracks).find(u=>u.id&&u.mode==="showing"&&["subtitles","captions"].includes(u.kind)),a=`${(s=t.subtitleTracks[t.subtitleTrack])==null?void 0:s.type.toLowerCase()}${t.subtitleTrack}`;if(o&&(t.subtitleTrack<0||(o==null?void 0:o.id)!==a)){let u=t.subtitleTracks.findIndex(({lang:p,name:c,type:i})=>p==o.language&&c===o.label&&i.toLowerCase()===o.kind);t.subtitleTrack=u}o&&(o==null?void 0:o.id)===a&&o.cues&&Array.from(o.cues).forEach(u=>{o.addCue(u)})};e.textTracks.addEventListener("change",r),t.on(R.Events.CUES_PARSED,(o,{track:a,cues:s})=>{let u=e.textTracks.getTrackById(a);if(!u)return;let p=u.mode==="disabled";p&&(u.mode="hidden"),s.forEach(c=>{var i;(i=u.cues)!=null&&i.getCueById(c.id)||u.addCue(c)}),p&&(u.mode="disabled")}),t.once(R.Events.DESTROYING,()=>{e.textTracks.removeEventListener("change",r),e.querySelectorAll("track[data-removeondestroy]").forEach(a=>{a.remove()})});let n=()=>{Array.from(e.textTracks).forEach(o=>{var a,s;if(!["subtitles","caption"].includes(o.kind)&&o.label==="thumbnails"){if(!((a=o.cues)!=null&&a.length)){let u=e.querySelector('track[label="thumbnails"]'),p=(s=u==null?void 0:u.getAttribute("src"))!=null?s:"";u==null||u.removeAttribute("src"),setTimeout(()=>{u==null||u.setAttribute("src",p)},0)}o.mode!=="hidden"&&(o.mode="hidden")}})};t.once(R.Events.MANIFEST_LOADED,n),t.once(R.Events.MEDIA_ATTACHED,n)}function z(e,t,r,n,o){let a=document.createElement("track");return a.kind=t,a.label=r,n&&(a.srclang=n),o&&(a.id=o),a.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),e.append(a),a.track}function Oe(e,t){let r=Array.prototype.find.call(e.querySelectorAll("track"),n=>n.track===t);r==null||r.remove()}function A(e,t,r){var n;return(n=Array.from(e.querySelectorAll("track")).find(o=>o.track.label===t&&o.track.kind===r))==null?void 0:n.track}async function Ue(e,t,r,n){let o=A(e,r,n);return o||(o=z(e,n,r),o.mode="hidden",await new Promise(a=>setTimeout(()=>a(void 0),0))),o.mode!=="hidden"&&(o.mode="hidden"),[...t].sort((a,s)=>ae(s)-ae(a)).forEach(a=>{var p,c;let s=a.value,u=ae(a);if("endTime"in a&&a.endTime!=null)o==null||o.addCue(new VTTCue(u,a.endTime,n==="chapters"?s:JSON.stringify(s!=null?s:null)));else{let i=Array.prototype.findIndex.call(o==null?void 0:o.cues,y=>y.startTime>=u),d=(p=o==null?void 0:o.cues)==null?void 0:p[i],l=d?d.startTime:Number.isFinite(e.duration)?e.duration:Number.MAX_SAFE_INTEGER,T=(c=o==null?void 0:o.cues)==null?void 0:c[i-1];T&&(T.endTime=u),o==null||o.addCue(new VTTCue(u,l,n==="chapters"?s:JSON.stringify(s!=null?s:null)))}}),e.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),o}var se="cuepoints",He=Object.freeze({label:se});async function ie(e,t,r=He){return Ue(e,t,r.label,"metadata")}var j=e=>({time:e.startTime,value:JSON.parse(e.text)});function Ve(e,t={label:se}){let r=A(e,t.label,"metadata");return r!=null&&r.cues?Array.from(r.cues,n=>j(n)):[]}function ce(e,t={label:se}){var a,s;let r=A(e,t.label,"metadata");if(!((a=r==null?void 0:r.activeCues)!=null&&a.length))return;if(r.activeCues.length===1)return j(r.activeCues[0]);let{currentTime:n}=e,o=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:u,endTime:p})=>u<=n&&p>n);return j(o||r.activeCues[0])}async function ue(e,t=He){return new Promise(r=>{x(e,"loadstart",async()=>{let n=await ie(e,[],t);x(e,"cuechange",()=>{let o=ce(e);if(o){let a=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:o});e.dispatchEvent(a)}},{},n),r(n)})})}var de="chapters",Fe=Object.freeze({label:de}),q=e=>({startTime:e.startTime,endTime:e.endTime,value:e.text});async function le(e,t,r=Fe){return Ue(e,t,r.label,"chapters")}function Ke(e,t={label:de}){var n;let r=A(e,t.label,"chapters");return(n=r==null?void 0:r.cues)!=null&&n.length?Array.from(r.cues,o=>q(o)):[]}function pe(e,t={label:de}){var a,s;let r=A(e,t.label,"chapters");if(!((a=r==null?void 0:r.activeCues)!=null&&a.length))return;if(r.activeCues.length===1)return q(r.activeCues[0]);let{currentTime:n}=e,o=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:u,endTime:p})=>u<=n&&p>n);return q(o||r.activeCues[0])}async function fe(e,t=Fe){return new Promise(r=>{x(e,"loadstart",async()=>{let n=await le(e,[],t);x(e,"cuechange",()=>{let o=pe(e);if(o){let a=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:o});e.dispatchEvent(a)}},{},n),r(n)})})}function Ye(e,t){if(t){let r=t.playingDate;if(r!=null)return new Date(r.getTime()-e.currentTime*1e3)}return typeof e.getStartDate=="function"?e.getStartDate():new Date(NaN)}function We(e,t){if(t&&t.playingDate)return t.playingDate;if(typeof e.getStartDate=="function"){let r=e.getStartDate();return new Date(r.getTime()+e.currentTime*1e3)}return new Date(NaN)}var k=require("hls.js");var X={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},Ft=e=>{if(e===C.VIDEO)return X.VIDEO;if(e===C.DRM)return X.DRM},Kt=(e,t)=>{var o,a;let r=O(e),n=`${r}Token`;return(o=t.tokens)!=null&&o[r]?(a=t.tokens)==null?void 0:a[r]:S(n,t)?t[n]:void 0},K=(e,t,r,n=!1,o=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var v,N;if(o){let M=m("Your device appears to be offline",n),b=void 0,E=f.MEDIA_ERR_NETWORK,h=new f(M,E,!0,b);return h.errorCategory=t,h.muxCode=g.NETWORK_OFFLINE,h.data=e,h}let s="status"in e?e.status:e.code,u=Date.now(),p=f.MEDIA_ERR_NETWORK;if(s===200)return;let c=O(t),i=Kt(t,r),d=Ft(t),[l]=V((v=r.playbackId)!=null?v:"");if(!s||!l)return;let T=G(i);if(i&&!T){let M=m("The {tokenNamePrefix}-token provided is invalid or malformed.",n).format({tokenNamePrefix:c}),b=m("Compact JWT string: {token}",n).format({token:i}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_TOKEN_MALFORMED,E.data=e,E}if(s>=500){let M=new f("",p,!0);return M.errorCategory=t,M.muxCode=g.NETWORK_UNKNOWN_ERROR,M}if(s===403)if(T){if(Pe(T,u)){let M={timeStyle:"medium",dateStyle:"medium"},b=m("The video\u2019s secured {tokenNamePrefix}-token has expired.",n).format({tokenNamePrefix:c}),E=m("Expired at: {expiredDate}. Current time: {currentDate}.",n).format({expiredDate:new Intl.DateTimeFormat("en",M).format((N=T.exp)!=null?N:0*1e3),currentDate:new Intl.DateTimeFormat("en",M).format(u)}),h=new f(b,p,!0,E);return h.errorCategory=t,h.muxCode=g.NETWORK_TOKEN_EXPIRED,h.data=e,h}if(_e(T,l)){let M=m("The video\u2019s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",n).format({tokenNamePrefix:c}),b=m("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",n).format({tokenNamePrefix:c,playbackId:l,tokenPlaybackId:T.sub}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_TOKEN_SUB_MISMATCH,E.data=e,E}if(ke(T,d)){let M=m("The {tokenNamePrefix}-token is formatted with incorrect information.",n).format({tokenNamePrefix:c}),b=m("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",n).format({tokenNamePrefix:c,expectedAud:d}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_TOKEN_AUD_MISSING,E.data=e,E}if(he(T,d)){let M=m("The {tokenNamePrefix}-token is formatted with incorrect information.",n).format({tokenNamePrefix:c}),b=m("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",n).format({tokenNamePrefix:c,expectedAud:d,aud:T.aud}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_TOKEN_AUD_MISMATCH,E.data=e,E}}else{let M=m("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",n).format({tokenNamePrefix:c,category:t}),b=m("Specified playback ID: {playbackId}",n).format({playbackId:l}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_TOKEN_MISSING,E.data=e,E}if(s===412){let M=m("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",n),b=m("Specified playback ID: {playbackId}",n).format({playbackId:l}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_NOT_READY,E.data=e,E}if(s===404){let M=m("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",n),b=m("Specified playback ID: {playbackId}",n).format({playbackId:l}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_NOT_FOUND,E.data=e,E}if(s===400){let M=m("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),b=m("Specified playback ID: {playbackId}",n).format({playbackId:l}),E=new f(M,p,!0,b);return E.errorCategory=t,E.muxCode=g.NETWORK_INVALID_URL,E.data=e,E}let y=new f("",p,!0);return y.errorCategory=t,y.muxCode=g.NETWORK_UNKNOWN_ERROR,y.data=e,y};var Q={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},Xe=e=>{if(e.includes("fps"))return Q.FAIRPLAY;if(e.includes("playready"))return Q.PLAYREADY;if(e.includes("widevine"))return Q.WIDEVINE},Qe=async e=>fetch(e).then(t=>t.status!==200?Promise.reject(t):t.text()).then(t=>{let r=t.split(`
`).find((n,o,a)=>o&&a[o-1].startsWith("#EXT-X-STREAM-INF"));return fetch(r).then(n=>n.status!==200?Promise.reject(n):n.text()).then(n=>n.split(`
`))}),Ze=e=>{var s,u,p;let r=(u=((s=e.find(c=>c.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?s:"").split(":")[1])==null?void 0:u.trim(),n=re(r),o=ne(r),a;if(n===D.LIVE){let c=e.find(d=>d.startsWith("#EXT-X-PART-INF"));if(!!c)a=+c.split(":")[1].split("=")[1]*2;else{let d=e.find(y=>y.startsWith("#EXT-X-TARGETDURATION")),l=(p=d==null?void 0:d.split(":"))==null?void 0:p[1];a=+(l!=null?l:6)*3}}return{streamType:n,targetLiveWindow:o,liveEdgeStartOffset:a}},et=async(e,t)=>{if(t===L.MP4)return{streamType:D.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0};if(t===L.M3U8){let r=await Qe(e);return Ze(r)}return console.error(`Media type ${t} is an unrecognized or unsupported type for src ${e}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0}},tt=async(e,t,r=F({src:e}))=>{var s,u,p;let{streamType:n,targetLiveWindow:o,liveEdgeStartOffset:a}=await et(e,r);((s=P.get(t))!=null?s:{}).liveEdgeStartOffset=a,((u=P.get(t))!=null?u:{}).targetLiveWindow=o,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((p=P.get(t))!=null?p:{}).streamType=n,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},rt=e=>{var s;let t=e.type,r=re(t),n=ne(t),o,a=!!((s=e.partList)!=null&&s.length);return r===D.LIVE&&(o=a?e.partTarget*2:e.targetduration*3),{streamType:r,targetLiveWindow:n,liveEdgeStartOffset:o,lowLatency:a}},nt=(e,t,r)=>{var u,p,c,i,d,l,T,y;let{streamType:n,targetLiveWindow:o,liveEdgeStartOffset:a,lowLatency:s}=rt(e);if(n===D.LIVE){s?(r.config.backBufferLength=(u=r.userConfig.backBufferLength)!=null?u:4,r.config.maxFragLookUpTolerance=(p=r.userConfig.maxFragLookUpTolerance)!=null?p:.001,r.config.abrBandWidthUpFactor=(c=r.userConfig.abrBandWidthUpFactor)!=null?c:r.config.abrBandWidthFactor):r.config.backBufferLength=(i=r.userConfig.backBufferLength)!=null?i:8;let v=Object.freeze({get length(){return t.seekable.length},start(N){return t.seekable.start(N)},end(N){var M;return N>this.length||N<0||Number.isFinite(t.duration)?t.seekable.end(N):(M=r.liveSyncPosition)!=null?M:t.seekable.end(N)}});((d=P.get(t))!=null?d:{}).seekable=v}((l=P.get(t))!=null?l:{}).liveEdgeStartOffset=a,((T=P.get(t))!=null?T:{}).targetLiveWindow=o,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((y=P.get(t))!=null?y:{}).streamType=n,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},$e,Be,Yt=(Be=($e=globalThis==null?void 0:globalThis.navigator)==null?void 0:$e.userAgent)!=null?Be:"",Je,Ge,je,Wt=(je=(Ge=(Je=globalThis==null?void 0:globalThis.navigator)==null?void 0:Je.userAgentData)==null?void 0:Ge.platform)!=null?je:"",$t=Yt.toLowerCase().includes("android")||["x11","android"].some(e=>Wt.toLowerCase().includes(e)),P=new WeakMap,I="mux.com",qe,ze,ot=(ze=(qe=R).isSupported)==null?void 0:ze.call(qe),Bt=$t,Jt=()=>W.default.utils.now(),at=W.default.utils.generateUUID,Gt=({playbackId:e,customDomain:t=I,maxResolution:r,minResolution:n,renditionOrder:o,programStartTime:a,programEndTime:s,playbackToken:u,tokens:{playback:p=u}={},extraSourceParams:c={}}={})=>{if(!e)return;let[i,d=""]=V(e),l=new URL(`https://stream.${t}/${i}.m3u8${d}`);return p||l.searchParams.has("token")?(l.searchParams.forEach((T,y)=>{y!="token"&&l.searchParams.delete(y)}),p&&l.searchParams.set("token",p)):(r&&l.searchParams.set("max_resolution",r),n&&(l.searchParams.set("min_resolution",n),r&&+r.slice(0,-1)<+n.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",n,"maxResolution",r)),o&&l.searchParams.set("rendition_order",o),a&&l.searchParams.set("program_start_time",`${a}`),s&&l.searchParams.set("program_end_time",`${s}`),Object.entries(c).forEach(([T,y])=>{y!=null&&l.searchParams.set(T,y)})),l.toString()},ee=e=>{if(!e)return;let[t]=e.split("?");return t||void 0},st=e=>{if(!e||!e.startsWith("https://stream."))return;let[t]=new URL(e).pathname.slice(1).split(".m3u8");return t||void 0},jt=e=>{var t,r,n;return(t=e==null?void 0:e.metadata)!=null&&t.video_id?e.metadata.video_id:Me(e)&&(n=(r=ee(e.playbackId))!=null?r:st(e.src))!=null?n:e.src},it=e=>{var t;return(t=P.get(e))==null?void 0:t.error},Te=e=>{var t,r;return(r=(t=P.get(e))==null?void 0:t.streamType)!=null?r:D.UNKNOWN},qt=e=>{var t,r;return(r=(t=P.get(e))==null?void 0:t.targetLiveWindow)!=null?r:Number.NaN},Z=e=>{var t,r;return(r=(t=P.get(e))==null?void 0:t.seekable)!=null?r:e.seekable},zt=e=>{var n;let t=(n=P.get(e))==null?void 0:n.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let r=Z(e);return r.length?r.end(r.length-1)-t:Number.NaN},Ee=.034,Xt=(e,t,r=Ee)=>Math.abs(e-t)<=r,ct=(e,t,r=Ee)=>e>t||Xt(e,t,r),ut=(e,t=Ee)=>e.paused&&ct(e.currentTime,e.duration,t),me=(e,t)=>{var c,i,d;if(!t||!e.buffered.length)return;if(e.readyState>2)return!1;let r=t.currentLevel>=0?(i=(c=t.levels)==null?void 0:c[t.currentLevel])==null?void 0:i.details:(d=t.levels.find(l=>!!l.details))==null?void 0:d.details;if(!r||r.live)return;let{fragments:n}=r;if(!(n!=null&&n.length))return;if(e.currentTime<e.duration-(r.targetduration+.5))return!1;let o=n[n.length-1];if(e.currentTime<=o.start)return!1;let a=o.start+o.duration/2,s=e.buffered.start(e.buffered.length-1),u=e.buffered.end(e.buffered.length-1);return a>s&&a<u},dt=(e,t)=>e.ended||e.loop?e.ended:t&&me(e,t)?!0:ut(e),Qt=(e,t,r)=>{lt(t,r);let{metadata:n={}}=e,{view_session_id:o=at()}=n,a=jt(e);n.view_session_id=o,n.video_id=a,e.metadata=n;let s=i=>{var d;(d=t.mux)==null||d.emit("hb",{view_drm_type:i})};e.drmTypeCb=s,P.set(t,{});let u=ft(e,t),p=Ae(e,t,u);Mt(e,t,u),Rt(e,t,u),ue(t),fe(t);let c=Ie(e,t,u);return{engine:u,setAutoplay:c,setPreload:p}},lt=(e,t)=>{let r=t==null?void 0:t.engine;r&&(r.detachMedia(),r.destroy()),e!=null&&e.mux&&!e.mux.deleted&&(e.mux.destroy(),delete e.mux),e&&(e.removeAttribute("src"),e.load(),e.removeEventListener("error",bt),e.removeEventListener("error",ye),e.removeEventListener("durationchange",Ct),P.delete(e),e.dispatchEvent(new Event("teardown")))};function pt(e,t){var c;let r=F(e);if(!(r===L.M3U8))return!0;let o=!r||((c=t.canPlayType(r))!=null?c:!0),{preferPlayback:a}=e,s=a===B.MSE,u=a===B.NATIVE;return o&&(u||!(ot&&(s||Bt)))}var ft=(e,t)=>{let{debug:r,streamType:n,startTime:o=-1,metadata:a,preferCmcd:s,_hlsConfig:u={}}=e,c=F(e)===L.M3U8,i=pt(e,t);if(c&&!i&&ot){let d={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},l=Tt(n),T=yt(e),y=s!==w.NONE?{useHeaders:s===w.HEADER,sessionId:a==null?void 0:a.view_session_id,contentId:a==null?void 0:a.video_id}:void 0;return new R({debug:r,startPosition:o,cmcd:y,xhrSetup:(N,M)=>{var h,Re;if(s&&s!==w.QUERY)return;let b=new URL(M);if(!b.searchParams.has("CMCD"))return;let E=((Re=(h=b.searchParams.get("CMCD"))==null?void 0:h.split(","))!=null?Re:[]).filter(Ce=>Ce.startsWith("sid")||Ce.startsWith("cid")).join(",");b.searchParams.set("CMCD",E),N.open("GET",b)},...d,...l,...T,...u})}},Tt=e=>e===D.LIVE?{backBufferLength:8}:{},yt=e=>{let{tokens:{drm:t}={},playbackId:r,drmTypeCb:n}=e,o=ee(r);return!t||!o?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Y(e,"fairplay"),serverCertificateUrl:ge(e,"fairplay")},"com.widevine.alpha":{licenseUrl:Y(e,"widevine")},"com.microsoft.playready":{licenseUrl:Y(e,"playready")}},requestMediaKeySystemAccessFunc:(a,s)=>(a==="com.widevine.alpha"&&(s=[...s.map(u=>{var c;let p=(c=u.videoCapabilities)==null?void 0:c.map(i=>({...i,robustness:"HW_SECURE_ALL"}));return{...u,videoCapabilities:p}}),...s]),navigator.requestMediaKeySystemAccess(a,s).then(u=>{let p=Xe(a);return n==null||n(p),u}))}},Et=async e=>{let t=await fetch(e);return t.status!==200?Promise.reject(t):await t.arrayBuffer()},mt=async(e,t)=>{let r=await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e});if(r.status!==200)return Promise.reject(r);let n=await r.arrayBuffer();return new Uint8Array(n)},gt=(e,t)=>{x(t,"encrypted",async n=>{try{let o=n.initDataType;if(o!=="skd"){console.error(`Received unexpected initialization data type "${o}"`);return}if(!t.mediaKeys){let c=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[o],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(d=>{var l;return(l=e.drmTypeCb)==null||l.call(e,Q.FAIRPLAY),d}).catch(()=>{let d=m("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),l=new f(d,f.MEDIA_ERR_ENCRYPTED,!0);l.errorCategory=C.DRM,l.muxCode=g.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,t.dispatchEvent(new CustomEvent("error",{detail:l}))});if(!c)return;let i=await c.createMediaKeys();try{let d=await Et(ge(e,"fairplay")).catch(l=>{if(l instanceof Response){let T=K(l,C.DRM,e);return console.error("mediaError",T==null?void 0:T.message,T==null?void 0:T.context),T?Promise.reject(T):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(l)});await i.setServerCertificate(d).catch(()=>{let l=m("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),T=new f(l,f.MEDIA_ERR_ENCRYPTED,!0);return T.errorCategory=C.DRM,T.muxCode=g.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(T)})}catch(d){t.dispatchEvent(new CustomEvent("error",{detail:d}));return}await t.setMediaKeys(i)}let a=n.initData;if(a==null){console.error(`Could not start encrypted playback due to missing initData in ${n.type} event`);return}let s=t.mediaKeys.createSession();s.addEventListener("keystatuseschange",()=>{s.keyStatuses.forEach(c=>{let i;if(c==="internal-error"){let d=m("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");i=new f(d,f.MEDIA_ERR_ENCRYPTED,!0),i.errorCategory=C.DRM,i.muxCode=g.ENCRYPTED_CDM_ERROR}else if(c==="output-restricted"||c==="output-downscaled"){let d=m("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");i=new f(d,f.MEDIA_ERR_ENCRYPTED,!1),i.errorCategory=C.DRM,i.muxCode=g.ENCRYPTED_OUTPUT_RESTRICTED}i&&t.dispatchEvent(new CustomEvent("error",{detail:i}))})});let u=await Promise.all([s.generateRequest(o,a).catch(()=>{let c=m("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),i=new f(c,f.MEDIA_ERR_ENCRYPTED,!0);i.errorCategory=C.DRM,i.muxCode=g.ENCRYPTED_GENERATE_REQUEST_FAILED,t.dispatchEvent(new CustomEvent("error",{detail:i}))}),new Promise(c=>{s.addEventListener("message",i=>{c(i.message)},{once:!0})})]).then(([,c])=>c);s.generateRequest(o,a);let p=await mt(u,Y(e,"fairplay")).catch(c=>{if(c instanceof Response){let i=K(c,C.DRM,e);return console.error("mediaError",i==null?void 0:i.message,i==null?void 0:i.context),i?Promise.reject(i):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(c)});await s.update(p).catch(()=>{let c=m("Failed to update DRM license. This may be an issue with the player or your protected content."),i=new f(c,f.MEDIA_ERR_ENCRYPTED,!0);return i.errorCategory=C.DRM,i.muxCode=g.ENCRYPTED_UPDATE_LICENSE_FAILED,Promise.reject(i)})}catch(o){t.dispatchEvent(new CustomEvent("error",{detail:o}));return}})},Y=({playbackId:e,tokens:{drm:t}={},customDomain:r=I},n)=>{let o=ee(e);return`https://license.${r.toLocaleLowerCase().endsWith(I)?r:I}/license/${n}/${o}?token=${t}`},ge=({playbackId:e,tokens:{drm:t}={},customDomain:r=I},n)=>{let o=ee(e);return`https://license.${r.toLocaleLowerCase().endsWith(I)?r:I}/appcert/${n}/${o}?token=${t}`},Me=({playbackId:e,src:t,customDomain:r})=>{if(e)return!0;if(typeof t!="string")return!1;let n=window==null?void 0:window.location.href,o=new URL(t,n).hostname.toLocaleLowerCase();return o.includes(I)||!!r&&o.includes(r.toLocaleLowerCase())},Mt=(e,t,r)=>{var s;let{envKey:n,disableTracking:o}=e,a=Me(e);if(!o&&(n||a)){let{playerInitTime:u,playerSoftwareName:p,playerSoftwareVersion:c,beaconCollectionDomain:i,debug:d,disableCookies:l}=e,T={...e.metadata,video_title:((s=e==null?void 0:e.metadata)==null?void 0:s.video_title)||void 0},y=v=>typeof v.player_error_code=="string"?!1:typeof e.errorTranslator=="function"?e.errorTranslator(v):v;W.default.monitor(t,{debug:d,beaconCollectionDomain:i,hlsjs:r,Hls:r?R:void 0,automaticErrorTracking:!1,errorTranslator:y,disableCookies:l,data:{...n?{env_key:n}:{},player_software_name:p,player_software:p,player_software_version:c,player_init_time:u,...T}})}},Rt=(e,t,r)=>{var c,i;let n=pt(e,t),{src:o}=e,a=()=>{t.ended||!dt(t,r)||(me(t,r)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},s,u,p=()=>{var T,y;let d=(T=Z(t))==null?void 0:T.start(0),l=(y=Z(t))==null?void 0:y.end(0);(u!==l||s!==d)&&t.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),s=d,u=l};if(x(t,"durationchange",p),t&&n){let d=F(e);if(typeof o=="string"){let l=()=>{if(Te(t)!==D.LIVE||Number.isFinite(t.duration))return;let y=setInterval(p,1e3);t.addEventListener("teardown",()=>{clearInterval(y)},{once:!0}),x(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(y)})},T=async()=>tt(o,t,d).then(l).catch(y=>{if(y instanceof Response){let v=K(y,C.VIDEO,e);if(v){t.dispatchEvent(new CustomEvent("error",{detail:v}));return}}else y instanceof Error});if(t.preload==="none"){let y=()=>{T(),t.removeEventListener("loadedmetadata",v)},v=()=>{T(),t.removeEventListener("play",y)};x(t,"play",y,{once:!0}),x(t,"loadedmetadata",v,{once:!0})}else T();(c=e.tokens)!=null&&c.drm?gt(e,t):x(t,"encrypted",()=>{let y=m("Attempting to play DRM-protected content without providing a DRM token."),v=new f(y,f.MEDIA_ERR_ENCRYPTED,!0);v.errorCategory=C.DRM,v.muxCode=g.ENCRYPTED_MISSING_TOKEN,t.dispatchEvent(new CustomEvent("error",{detail:v}))},{once:!0}),t.setAttribute("src",o),e.startTime&&(((i=P.get(t))!=null?i:{}).startTime=e.startTime,t.addEventListener("durationchange",Ct,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",bt),t.addEventListener("error",ye),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(T=>{T.remove()})},{once:!0}),x(t,"pause",a),x(t,"seeked",a),x(t,"play",()=>{t.ended||ct(t.currentTime,t.duration)&&(t.currentTime=t.seekable.length?t.seekable.start(0):0)})}else r&&o?(r.once(R.Events.LEVEL_LOADED,(d,l)=>{nt(l.details,t,r),p(),Te(t)===D.LIVE&&!Number.isFinite(t.duration)&&(r.on(R.Events.LEVEL_UPDATED,p),x(t,"durationchange",()=>{Number.isFinite(t.duration)&&r.off(R.Events.LEVELS_UPDATED,p)}))}),r.on(R.Events.ERROR,(d,l)=>{t.dispatchEvent(new CustomEvent("error",{detail:Zt(l,e)}))}),t.addEventListener("error",ye),x(t,"waiting",a),Se(e,r),we(t,r),r.attachMedia(t)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function Ct(e){var n;let t=e.target,r=(n=P.get(t))==null?void 0:n.startTime;if(r&&De(t.seekable,t.duration,r)){let o=t.preload==="auto";o&&(t.preload="none"),t.currentTime=r,o&&(t.preload="auto")}}async function bt(e){if(!e.isTrusted)return;e.stopImmediatePropagation();let t=e.target;if(!(t!=null&&t.error))return;let{message:r,code:n}=t.error,o=new f(r,n);if(t.src&&n===f.MEDIA_ERR_SRC_NOT_SUPPORTED&&t.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var s;let a=(s=it(t))!=null?s:t.error;(a==null?void 0:a.code)===f.MEDIA_ERR_SRC_NOT_SUPPORTED&&t.dispatchEvent(new CustomEvent("error",{detail:o}))},500);return}if(t.src&&(n!==f.MEDIA_ERR_DECODE||n!==void 0))try{let{status:a}=await fetch(t.src);o.data={response:{code:a}}}catch{}t.dispatchEvent(new CustomEvent("error",{detail:o}))}function ye(e){var n,o;if(!(e instanceof CustomEvent)||!(e.detail instanceof f))return;let t=e.target,r=e.detail;!r||!r.fatal||(((n=P.get(t))!=null?n:{}).error=r,(o=t.mux)==null||o.emit("error",{player_error_code:r.code,player_error_message:r.message,player_error_context:r.context}))}var Zt=(e,t)=>{var u,p,c;console.error("getErrorFromHlsErrorData()",e);let r={[R.ErrorTypes.NETWORK_ERROR]:f.MEDIA_ERR_NETWORK,[R.ErrorTypes.MEDIA_ERROR]:f.MEDIA_ERR_DECODE,[R.ErrorTypes.KEY_SYSTEM_ERROR]:f.MEDIA_ERR_ENCRYPTED},n=i=>[k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(i.details)?f.MEDIA_ERR_NETWORK:r[i.type],o=i=>{if(i.type===k.ErrorTypes.KEY_SYSTEM_ERROR)return C.DRM;if(i.type===k.ErrorTypes.NETWORK_ERROR)return C.VIDEO},a,s=n(e);if(s===f.MEDIA_ERR_NETWORK&&e.response){let i=(u=o(e))!=null?u:C.VIDEO;a=(p=K(e.response,i,t))!=null?p:new f("",s)}else if(s===f.MEDIA_ERR_ENCRYPTED)if(e.details===k.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let i=m("Attempting to play DRM-protected content without providing a DRM token.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_MISSING_TOKEN}else if(e.details===k.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let i=m("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(e.details===k.ErrorDetails.KEY_SYSTEM_NO_SESSION){let i=m("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,!0),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(e.details===k.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let i=m("Failed to update DRM license. This may be an issue with the player or your protected content.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(e.details===k.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let i=m("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(e.details===k.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let i=m("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_CDM_ERROR}else if(e.details===k.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let i=m("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");a=new f(i,f.MEDIA_ERR_ENCRYPTED,!1),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_OUTPUT_RESTRICTED}else a=new f(e.error.message,f.MEDIA_ERR_ENCRYPTED,e.fatal),a.errorCategory=C.DRM,a.muxCode=g.ENCRYPTED_ERROR;else a=new f("",s,e.fatal);return a.context||(a.context=`${e.url?`url: ${e.url}
`:""}${e.response&&(e.response.code||e.response.text)?`response: ${e.response.code}, ${e.response.text}
`:""}${e.reason?`failure reason: ${e.reason}
`:""}${e.level?`level: ${e.level}
`:""}${e.parent?`parent stream controller: ${e.parent}
`:""}${e.buffer?`buffer length: ${e.buffer}
`:""}${e.error?`error: ${e.error}
`:""}${e.event?`event: ${e.event}
`:""}${e.err?`error message: ${(c=e.err)==null?void 0:c.message}
`:""}`),a.data=e,a};
//# sourceMappingURL=index.cjs.js.map

@@ -0,7 +1,42 @@

export declare const MuxErrorCategory: {
readonly VIDEO: "video";
readonly THUMBNAIL: "thumbnail";
readonly STORYBOARD: "storyboard";
readonly DRM: "drm";
};
export declare const MuxErrorCode: {
readonly NOT_AN_ERROR: 0;
readonly NETWORK_OFFLINE: 2000002;
readonly NETWORK_UNKNOWN_ERROR: 2000000;
readonly NETWORK_NO_STATUS: 2000001;
readonly NETWORK_INVALID_URL: 2400000;
readonly NETWORK_NOT_FOUND: 2404000;
readonly NETWORK_NOT_READY: 2412000;
readonly NETWORK_GENERIC_SERVER_FAIL: 2500000;
readonly NETWORK_TOKEN_MISSING: 2403201;
readonly NETWORK_TOKEN_MALFORMED: 2412202;
readonly NETWORK_TOKEN_EXPIRED: 2403210;
readonly NETWORK_TOKEN_AUD_MISSING: 2403221;
readonly NETWORK_TOKEN_AUD_MISMATCH: 2403222;
readonly NETWORK_TOKEN_SUB_MISMATCH: 2403232;
readonly ENCRYPTED_ERROR: 5000000;
readonly ENCRYPTED_UNSUPPORTED_KEY_SYSTEM: 5000001;
readonly ENCRYPTED_GENERATE_REQUEST_FAILED: 5000002;
readonly ENCRYPTED_UPDATE_LICENSE_FAILED: 5000003;
readonly ENCRYPTED_UPDATE_SERVER_CERT_FAILED: 5000004;
readonly ENCRYPTED_CDM_ERROR: 5000005;
readonly ENCRYPTED_OUTPUT_RESTRICTED: 5000006;
readonly ENCRYPTED_MISSING_TOKEN: 5000002;
};
export type MuxErrorCategory = typeof MuxErrorCategory;
export type MuxErrorCode = typeof MuxErrorCode;
export type MuxErrorCategoryValue = MuxErrorCategory[keyof MuxErrorCategory];
export type MuxErrorCodeValue = MuxErrorCode[keyof MuxErrorCode];
export declare const errorCategoryToTokenNameOrPrefix: (category: MuxErrorCategoryValue) => "thumbnail" | "storyboard" | "drm" | "playback";
export declare class MediaError extends Error {
static MEDIA_ERR_ABORTED: number;
static MEDIA_ERR_NETWORK: number;
static MEDIA_ERR_DECODE: number;
static MEDIA_ERR_SRC_NOT_SUPPORTED: number;
static MEDIA_ERR_ENCRYPTED: number;
static MEDIA_ERR_ABORTED: 1;
static MEDIA_ERR_NETWORK: 2;
static MEDIA_ERR_DECODE: 3;
static MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
static MEDIA_ERR_ENCRYPTED: 5;
static MEDIA_ERR_CUSTOM: number;

@@ -11,2 +46,4 @@ static defaultMessages: Record<number, string>;

code: number;
muxCode?: MuxErrorCodeValue;
errorCategory?: MuxErrorCategoryValue;
context?: string;

@@ -13,0 +50,0 @@ fatal: boolean;

@@ -1,11 +0,13 @@

import { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MuxMediaPropTypes } from './types';
import mux from 'mux-embed';
import Hls from './hls';
import { HlsInterface } from './hls';
import { MediaError } from './errors';
import { MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix } from './errors';
import { addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters } from './text-tracks';
import { getStartDate, getCurrentPdt } from './pdt';
import { toPlaybackIdParts, i18n, parseJwt } from './util';
import { StreamTypes, MediaTypes } from './types';
import { HlsConfig } from 'hls.js';
export { mux, Hls, MediaError, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, };
import { MuxJWTAud } from './request-errors';
export { mux, Hls, MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix, MuxJWTAud, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, toPlaybackIdParts, i18n, parseJwt, };
export * from './types';

@@ -61,18 +63,4 @@ declare const DRMType: {

export declare const generateUUID: () => string;
type MuxVideoURLProps = Partial<{
playbackId: string;
customDomain: string;
maxResolution: MaxResolutionValue;
minResolution: MinResolutionValue;
renditionOrder: RenditionOrderValue;
programStartTime: number;
programEndTime: number;
tokens: Partial<{
playback: string;
storyboard: string;
thumbnail: string;
}>;
extraSourceParams: Record<string, any>;
}>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
type MuxVideoURLProps = Partial<Pick<MuxMediaPropTypes, 'playbackId' | 'customDomain' | 'maxResolution' | 'minResolution' | 'renditionOrder' | 'programStartTime' | 'programEndTime' | 'tokens' | 'playbackToken' | 'extraSourceParams'>>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, playbackToken, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
export declare const toPlaybackIdFromSrc: (src: string | undefined) => string | undefined;

@@ -97,12 +85,12 @@ export declare const getError: (mediaEl: HTMLMediaElement) => globalThis.MediaError | (globalThis.MediaError & MediaError) | null | undefined;

export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "drmToken" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "tokens" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "drmToken" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "tokens" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getAppCertificate: (appCertificateUrl: string) => Promise<ArrayBuffer>;
export declare const getLicenseKey: (message: ArrayBuffer, licenseServerUrl: string) => Promise<Uint8Array>;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId, drmToken: token, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId, drmToken: token, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "playbackToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "src" | "customDomain">>) => boolean;
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, "envKey" | "playerInitTime" | "beaconCollectionDomain" | "errorTranslator" | "metadata" | "debug" | "playerSoftwareName" | "playerSoftwareVersion" | "playbackId" | "src" | "customDomain" | "disableCookies" | "disableTracking">>, mediaEl: HTMLMediaElement, hlsjs?: HlsInterface) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "drmToken" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "tokens" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;

@@ -87,2 +87,8 @@ /// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" />

export type RenditionOrderValue = ValueOf<typeof RenditionOrder>;
export type Tokens = {
playback?: string;
drm?: string;
thumbnail?: string;
storyboard?: string;
};
export type MuxMediaPropTypes = {

@@ -98,2 +104,3 @@ _hlsConfig?: Partial<HlsConfig>;

drmToken?: string;
playbackToken?: string;
envKey: MetaData['env_key'];

@@ -116,9 +123,5 @@ error?: HTMLMediaElement['error'] | MediaError;

targetLiveWindow: number;
tokens: Partial<{
drm: string;
playback: string;
storyboard: string;
thumbnail: string;
}>;
tokens: Tokens;
type: MediaTypes;
extraSourceParams: Record<string, any>;
};

@@ -125,0 +128,0 @@ export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload' | 'error' | 'seekable'>>;

@@ -13,2 +13,13 @@ import { HlsPlaylistTypes, MuxMediaProps } from './types';

export declare const inferMimeTypeFromURL: (url: string) => "" | "application/vnd.apple.mpegurl" | "video/mp4";
export type MuxJWT = {
sub: string;
aud: 'v' | 't' | 'g' | 's' | 'd';
exp: number;
};
export declare const parseJwt: (token: string | undefined) => Partial<MuxJWT> | undefined;
export declare const isJWTExpired: ({ exp }: Partial<Pick<MuxJWT, "exp">>, referenceTime?: number) => boolean;
export declare const isJWTSubMismatch: ({ sub }: Partial<Pick<MuxJWT, "sub">>, expectedSub: string | undefined) => boolean;
export declare const isJWTAudMissing: ({ aud }: Partial<Pick<MuxJWT, "aud">>, _expectedAud: string | undefined) => boolean;
export declare const isJWTAudMismatch: ({ aud }: Partial<Pick<MuxJWT, "aud">>, expectedAud: string | undefined) => boolean;
export declare function i18n(str: string, translate?: boolean): any;
export {};

@@ -0,7 +1,42 @@

export declare const MuxErrorCategory: {
readonly VIDEO: "video";
readonly THUMBNAIL: "thumbnail";
readonly STORYBOARD: "storyboard";
readonly DRM: "drm";
};
export declare const MuxErrorCode: {
readonly NOT_AN_ERROR: 0;
readonly NETWORK_OFFLINE: 2000002;
readonly NETWORK_UNKNOWN_ERROR: 2000000;
readonly NETWORK_NO_STATUS: 2000001;
readonly NETWORK_INVALID_URL: 2400000;
readonly NETWORK_NOT_FOUND: 2404000;
readonly NETWORK_NOT_READY: 2412000;
readonly NETWORK_GENERIC_SERVER_FAIL: 2500000;
readonly NETWORK_TOKEN_MISSING: 2403201;
readonly NETWORK_TOKEN_MALFORMED: 2412202;
readonly NETWORK_TOKEN_EXPIRED: 2403210;
readonly NETWORK_TOKEN_AUD_MISSING: 2403221;
readonly NETWORK_TOKEN_AUD_MISMATCH: 2403222;
readonly NETWORK_TOKEN_SUB_MISMATCH: 2403232;
readonly ENCRYPTED_ERROR: 5000000;
readonly ENCRYPTED_UNSUPPORTED_KEY_SYSTEM: 5000001;
readonly ENCRYPTED_GENERATE_REQUEST_FAILED: 5000002;
readonly ENCRYPTED_UPDATE_LICENSE_FAILED: 5000003;
readonly ENCRYPTED_UPDATE_SERVER_CERT_FAILED: 5000004;
readonly ENCRYPTED_CDM_ERROR: 5000005;
readonly ENCRYPTED_OUTPUT_RESTRICTED: 5000006;
readonly ENCRYPTED_MISSING_TOKEN: 5000002;
};
export type MuxErrorCategory = typeof MuxErrorCategory;
export type MuxErrorCode = typeof MuxErrorCode;
export type MuxErrorCategoryValue = MuxErrorCategory[keyof MuxErrorCategory];
export type MuxErrorCodeValue = MuxErrorCode[keyof MuxErrorCode];
export declare const errorCategoryToTokenNameOrPrefix: (category: MuxErrorCategoryValue) => "thumbnail" | "storyboard" | "drm" | "playback";
export declare class MediaError extends Error {
static MEDIA_ERR_ABORTED: number;
static MEDIA_ERR_NETWORK: number;
static MEDIA_ERR_DECODE: number;
static MEDIA_ERR_SRC_NOT_SUPPORTED: number;
static MEDIA_ERR_ENCRYPTED: number;
static MEDIA_ERR_ABORTED: 1;
static MEDIA_ERR_NETWORK: 2;
static MEDIA_ERR_DECODE: 3;
static MEDIA_ERR_SRC_NOT_SUPPORTED: 4;
static MEDIA_ERR_ENCRYPTED: 5;
static MEDIA_ERR_CUSTOM: number;

@@ -11,2 +46,4 @@ static defaultMessages: Record<number, string>;

code: number;
muxCode?: MuxErrorCodeValue;
errorCategory?: MuxErrorCategoryValue;
context?: string;

@@ -13,0 +50,0 @@ fatal: boolean;

@@ -1,11 +0,13 @@

import type { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import type { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MuxMediaPropTypes } from './types';
import mux from 'mux-embed';
import Hls from './hls';
import type { HlsInterface } from './hls';
import { MediaError } from './errors';
import { MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix } from './errors';
import { addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters } from './text-tracks';
import { getStartDate, getCurrentPdt } from './pdt';
import { toPlaybackIdParts, i18n, parseJwt } from './util';
import { StreamTypes, MediaTypes } from './types';
import type { HlsConfig } from 'hls.js';
export { mux, Hls, MediaError, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, };
import { type HlsConfig } from 'hls.js';
import { MuxJWTAud } from './request-errors';
export { mux, Hls, MediaError, MuxErrorCategory, MuxErrorCode, errorCategoryToTokenNameOrPrefix, MuxJWTAud, addTextTrack, removeTextTrack, getTextTrack, addCuePoints, getCuePoints, getActiveCuePoint, setupCuePoints, addChapters, getChapters, getActiveChapter, setupChapters, getStartDate, getCurrentPdt, toPlaybackIdParts, i18n, parseJwt, };
export * from './types';

@@ -61,18 +63,4 @@ declare const DRMType: {

export declare const generateUUID: () => string;
type MuxVideoURLProps = Partial<{
playbackId: string;
customDomain: string;
maxResolution: MaxResolutionValue;
minResolution: MinResolutionValue;
renditionOrder: RenditionOrderValue;
programStartTime: number;
programEndTime: number;
tokens: Partial<{
playback: string;
storyboard: string;
thumbnail: string;
}>;
extraSourceParams: Record<string, any>;
}>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
type MuxVideoURLProps = Partial<Pick<MuxMediaPropTypes, 'playbackId' | 'customDomain' | 'maxResolution' | 'minResolution' | 'renditionOrder' | 'programStartTime' | 'programEndTime' | 'tokens' | 'playbackToken' | 'extraSourceParams'>>;
export declare const toMuxVideoURL: ({ playbackId: playbackIdWithParams, customDomain: domain, maxResolution, minResolution, renditionOrder, programStartTime, programEndTime, playbackToken, tokens: { playback: token }, extraSourceParams, }?: MuxVideoURLProps) => string | undefined;
export declare const toPlaybackIdFromSrc: (src: string | undefined) => string | undefined;

@@ -97,12 +85,12 @@ export declare const getError: (mediaEl: HTMLMediaElement) => globalThis.MediaError | (globalThis.MediaError & MediaError) | null | undefined;

export declare const teardown: (mediaEl?: HTMLMediaElement | null, core?: PlaybackCore) => void;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "drmToken" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const setupHls: (props: Partial<Pick<MuxMediaPropsInternal, "debug" | "streamType" | "type" | "startTime" | "metadata" | "preferCmcd" | "_hlsConfig" | "tokens" | "drmTypeCb">>, mediaEl: Pick<HTMLMediaElement, "canPlayType">) => Hls | undefined;
export declare const getStreamTypeConfig: (streamType?: ValueOf<StreamTypes>) => {};
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "drmToken" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getDRMConfig: (props: Partial<Pick<MuxMediaPropsInternal, "src" | "playbackId" | "tokens" | "customDomain" | "drmTypeCb">>) => Partial<HlsConfig>;
export declare const getAppCertificate: (appCertificateUrl: string) => Promise<ArrayBuffer>;
export declare const getLicenseKey: (message: ArrayBuffer, licenseServerUrl: string) => Promise<Uint8Array>;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId, drmToken: token, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId, drmToken: token, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "drmToken" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const setupNativeFairplayDRM: (props: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "playbackToken" | "customDomain" | "drmTypeCb">>, mediaEl: HTMLMediaElement) => void;
export declare const toLicenseKeyURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const toAppCertURL: ({ playbackId: playbackIdWithParams, tokens: { drm: token }, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "tokens" | "customDomain">>, scheme: "widevine" | "playready" | "fairplay") => string;
export declare const isMuxVideoSrc: ({ playbackId, src, customDomain, }: Partial<Pick<MuxMediaPropsInternal, "playbackId" | "src" | "customDomain">>) => boolean;
export declare const setupMux: (props: Partial<Pick<MuxMediaPropsInternal, "envKey" | "playerInitTime" | "beaconCollectionDomain" | "errorTranslator" | "metadata" | "debug" | "playerSoftwareName" | "playerSoftwareVersion" | "playbackId" | "src" | "customDomain" | "disableCookies" | "disableTracking">>, mediaEl: HTMLMediaElement, hlsjs?: HlsInterface) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "drmToken" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;
export declare const loadMedia: (props: Partial<Pick<MuxMediaProps, "preferPlayback" | "src" | "type" | "startTime" | "streamType" | "autoplay" | "playbackId" | "tokens" | "customDomain">>, mediaEl: HTMLMediaElement, hls?: Pick<Hls, "config" | "on" | "once" | "off" | "trigger" | "startLoad" | "stopLoad" | "recoverMediaError" | "destroy" | "loadSource" | "attachMedia" | "liveSyncPosition" | "subtitleTracks" | "subtitleTrack" | "userConfig" | "audioTrack" | "audioTracks" | "autoLevelEnabled" | "nextLevel" | "levels" | "currentLevel">) => void;

@@ -87,2 +87,8 @@ /// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" preserve="true" />

export type RenditionOrderValue = ValueOf<typeof RenditionOrder>;
export type Tokens = {
playback?: string;
drm?: string;
thumbnail?: string;
storyboard?: string;
};
export type MuxMediaPropTypes = {

@@ -98,2 +104,3 @@ _hlsConfig?: Partial<HlsConfig>;

drmToken?: string;
playbackToken?: string;
envKey: MetaData['env_key'];

@@ -116,9 +123,5 @@ error?: HTMLMediaElement['error'] | MediaError;

targetLiveWindow: number;
tokens: Partial<{
drm: string;
playback: string;
storyboard: string;
thumbnail: string;
}>;
tokens: Tokens;
type: MediaTypes;
extraSourceParams: Record<string, any>;
};

@@ -125,0 +128,0 @@ export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload' | 'error' | 'seekable'>>;

@@ -10,2 +10,13 @@ import type { HlsPlaylistTypes, MuxMediaProps } from './types';

export declare const inferMimeTypeFromURL: (url: string) => "" | "application/vnd.apple.mpegurl" | "video/mp4";
export type MuxJWT = {
sub: string;
aud: 'v' | 't' | 'g' | 's' | 'd';
exp: number;
};
export declare const parseJwt: (token: string | undefined) => Partial<MuxJWT> | undefined;
export declare const isJWTExpired: ({ exp }: Partial<Pick<MuxJWT, "exp">>, referenceTime?: number) => boolean;
export declare const isJWTSubMismatch: ({ sub }: Partial<Pick<MuxJWT, "sub">>, expectedSub: string | undefined) => boolean;
export declare const isJWTAudMissing: ({ aud }: Partial<Pick<MuxJWT, "aud">>, _expectedAud: string | undefined) => boolean;
export declare const isJWTAudMismatch: ({ aud }: Partial<Pick<MuxJWT, "aud">>, expectedAud: string | undefined) => boolean;
export declare function i18n(str: string, translate?: boolean): any;
export {};
{
"name": "@mux/playback-core",
"version": "0.26.0-canary.0-2577b78",
"version": "0.26.0-canary.0-4d0b670",
"description": "Core library for media playback in the browser shared by mux elements",

@@ -50,6 +50,6 @@ "main": "./dist/index.cjs.js",

"dev": "npm-run-all --parallel dev:types dev:cjs dev:esm dev:iife dev:esm-module",
"build:esm": "esbuild --metafile=./dist/esm.json src/index.ts --target=es2019 --bundle --sourcemap --format=esm --outdir=dist --out-extension:.js=.mjs --external:mux-embed --external:hls.js",
"build:esm-module": "esbuild --metafile=./dist/module.json src/index.ts --target=es2019 --bundle --sourcemap --format=esm --outfile=./dist/playback-core.mjs",
"build:cjs": "esbuild --metafile=./dist/cjs.json src/index.ts --target=es2019 --bundle --sourcemap --format=cjs --outdir=dist --out-extension:.js=.cjs.js --external:mux-embed --external:hls.js",
"build:iife": "esbuild --metafile=./dist/iife.json src/index.ts --target=es2019 --bundle --sourcemap --format=iife --outfile=./dist/playback-core.js",
"build:esm": "esbuilder src/index.ts --sourcemap --format=esm --out-extension:.js=.mjs --external:mux-embed --external:hls.js",
"build:esm-module": "esbuilder src/index.ts --sourcemap --format=esm --outfile=./dist/playback-core.mjs",
"build:cjs": "esbuilder src/index.ts --sourcemap --format=cjs --out-extension:.js=.cjs.js --external:mux-embed --external:hls.js",
"build:iife": "esbuilder src/index.ts --sourcemap --format=iife --outfile=./dist/playback-core.js",
"prebuild:types": "shx mkdir -p ./dist/types && shx cp ../../types/** ./dist/types/",

@@ -67,2 +67,3 @@ "build:types": "tsc",

"devDependencies": {
"@mux/esbuilder": "0.1.0",
"@open-wc/testing": "^4.0.0",

@@ -69,0 +70,0 @@ "@typescript-eslint/eslint-plugin": "^8.3.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc