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.25.2-canary.0-2722b6e to 0.25.2-canary.0-3437ced

12

dist/cjs.json

@@ -20,3 +20,3 @@ {

"src/types.ts": {
"bytes": 5800,
"bytes": 5827,
"imports": [],

@@ -26,3 +26,3 @@ "format": "esm"

"src/util.ts": {
"bytes": 3300,
"bytes": 3368,
"imports": [

@@ -118,3 +118,3 @@ {

"src/index.ts": {
"bytes": 43460,
"bytes": 45747,
"imports": [

@@ -185,3 +185,3 @@ {

"inputs": {},
"bytes": 121958
"bytes": 124608
},

@@ -205,3 +205,3 @@ "dist/index.cjs.js": {

"src/index.ts": {
"bytesInOutput": 14574
"bytesInOutput": 14766
},

@@ -236,5 +236,5 @@ "src/hls.ts": {

},
"bytes": 25618
"bytes": 25810
}
}
}

@@ -20,3 +20,3 @@ {

"src/types.ts": {
"bytes": 5800,
"bytes": 5827,
"imports": [],

@@ -26,3 +26,3 @@ "format": "esm"

"src/util.ts": {
"bytes": 3300,
"bytes": 3368,
"imports": [

@@ -118,3 +118,3 @@ {

"src/index.ts": {
"bytes": 43460,
"bytes": 45747,
"imports": [

@@ -185,3 +185,3 @@ {

"inputs": {},
"bytes": 119900
"bytes": 122550
},

@@ -268,3 +268,3 @@ "dist/index.mjs": {

"src/index.ts": {
"bytesInOutput": 13069
"bytesInOutput": 13261
},

@@ -299,5 +299,5 @@ "src/hls.ts": {

},
"bytes": 24882
"bytes": 25074
}
}
}

@@ -30,3 +30,3 @@ {

"src/types.ts": {
"bytes": 5800,
"bytes": 5827,
"imports": [],

@@ -36,3 +36,3 @@ "format": "esm"

"src/util.ts": {
"bytes": 3300,
"bytes": 3368,
"imports": [

@@ -128,3 +128,3 @@ {

"src/index.ts": {
"bytes": 43460,
"bytes": 45747,
"imports": [

@@ -195,3 +195,3 @@ {

"inputs": {},
"bytes": 2148092
"bytes": 2150742
},

@@ -237,8 +237,8 @@ "dist/playback-core.js": {

"src/index.ts": {
"bytesInOutput": 13140
"bytesInOutput": 13332
}
},
"bytes": 503667
"bytes": 503859
}
}
}

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

"use strict";var rt=Object.create;var H=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty;var ct=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},pe=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ot(t))!it.call(e,r)&&r!==n&&H(e,r,{get:()=>t[r],enumerable:!(a=at(t,r))||a.enumerable});return e};var le=(e,t,n)=>(n=e!=null?rt(st(e)):{},pe(t||!e||!e.__esModule?H(n,"default",{value:e,enumerable:!0}):n,e)),ut=e=>pe(H({},"__esModule",{value:!0}),e);var wt={};ct(wt,{AutoplayTypes:()=>h,CmcdTypeValues:()=>pt,CmcdTypes:()=>C,ExtensionMimeTypeMap:()=>v,Hls:()=>y,MaxResolution:()=>yt,MediaError:()=>x,MimeTypeShorthandMap:()=>A,MinResolution:()=>Tt,PlaybackTypes:()=>_,RenditionOrder:()=>mt,StreamTypes:()=>g,addChapters:()=>Q,addCuePoints:()=>X,addTextTrack:()=>U,allMediaTypes:()=>ft,generatePlayerInitTime:()=>Lt,generateUUID:()=>Fe,getActiveChapter:()=>Z,getActiveCuePoint:()=>G,getAppCertificate:()=>Ge,getChapters:()=>Ce,getCuePoints:()=>Pe,getCurrentPdt:()=>Ae,getDRMConfig:()=>Xe,getEnded:()=>Be,getError:()=>Ct,getLicenseKey:()=>je,getLiveEdgeStart:()=>At,getMediaPlaylistLinesFromMultivariantPlaylistSrc:()=>He,getSeekable:()=>K,getStartDate:()=>he,getStreamInfoFromHlsjsLevelDetails:()=>Oe,getStreamInfoFromPlaylistLines:()=>Ne,getStreamInfoFromSrcAndType:()=>_e,getStreamType:()=>te,getStreamTypeConfig:()=>ze,getTargetLiveWindow:()=>ht,getTextTrack:()=>P,initialize:()=>St,isKeyOf:()=>N,isMuxVideoSrc:()=>ie,isPseudoEnded:()=>Ke,isStuckOnLastFragment:()=>oe,loadMedia:()=>Ze,mux:()=>w.default,muxMediaState:()=>M,removeTextTrack:()=>xe,setupChapters:()=>ee,setupCuePoints:()=>j,setupHls:()=>qe,setupMux:()=>Qe,setupNativeFairplayDRM:()=>Je,shorthandKeys:()=>lt,teardown:()=>$e,toAppCertURL:()=>se,toDRMTypeFromKeySystem:()=>Re,toLicenseKeyURL:()=>S,toMuxVideoURL:()=>kt,toPlaybackIdFromSrc:()=>re,updateStreamInfoFromHlsjsLevelDetails:()=>Ve,updateStreamInfoFromSrc:()=>W});module.exports=ut(wt);var w=le(require("mux-embed"));var fe=le(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 x=b;var dt=e=>e==null,N=(e,t)=>dt(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"},pt=Object.values(C),v={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},A={HLS:v.M3U8},lt=Object.keys(A),ft=[...Object.values(v),"hls","HLS"],yt={upTo720p:"720p",upTo1080p:"1080p",upTo1440p:"1440p",upTo2160p:"2160p"},Tt={noLessThan480p:"480p",noLessThan540p:"540p",noLessThan720p:"720p",noLessThan1080p:"1080p",noLessThan1440p:"1440p",noLessThan2160p:"2160p"},mt={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 N(a,A)?A[a]:t}let{src:n}=e;return n?gt(n):""},B=e=>e==="VOD"?g.ON_DEMAND:g.LIVE,$=e=>e==="EVENT"?Number.POSITIVE_INFINITY:e==="VOD"?Number.NaN:0,gt=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 N(r,v)?v[r]:""};var Mt=Object.values(h),me=e=>typeof e=="boolean"||typeof e=="string"&&Mt.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,p=a.config.maxBufferSize,u=c=>{r(c);let l=c!=null?c:n.preload;s||l==="none"||(l==="metadata"?(a.config.maxBufferLength=1,a.config.maxBufferSize=1):(a.config.maxBufferLength=i,a.config.maxBufferSize=p),d())},d=()=>{!o&&t&&(o=!0,a.loadSource(t))};return T(n,"play",()=>{s=!0,a.config.maxBufferLength=i,a.config.maxBufferSize=p,d()},{once:!0}),u(e),u};function be(e,t){var p;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[l,f]of d.levels.entries()){let m=c.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);n.set(f,`${l}`),m.id=`${l}`}}),t.on(y.Events.AUDIO_TRACKS_UPDATED,function(u,d){s();for(let c of d.audioTracks){let l=c.default?"main":"alternative",f=e.addAudioTrack(l,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(l=>l.enabled))==null?void 0:c.id),d=t.audioTracks.map(l=>l.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 l=d.levels.map(m=>n.get(m));for(let m of e.videoRenditions)m.id&&!l.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,l=(f,m)=>{c||(c=!Number.isFinite(m.endOffset))};t.on(y.Events.BUFFER_FLUSHING,l),t.nextLevel=u,t.off(y.Events.BUFFER_FLUSHING,l),c||t.trigger(y.Events.BUFFER_FLUSHING,{startOffset:d+10,endOffset:1/0,type:"video"})};(p=e.videoRenditions)==null||p.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,p=t.subtitleTracks.findIndex(({lang:d,name:c,type:l})=>d==(i==null?void 0:i.lang)&&c===s.label&&l.toLowerCase()===s.kind);U(e,s.kind,s.label,i==null?void 0:i.lang,`${s.kind}${p}`)})});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:p,name:u,type:d})=>p==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 p=i.mode==="disabled";p&&(i.mode="hidden"),s.forEach(u=>{var d;(d=i.cues)!=null&&d.getCueById(u.id)||i.addCue(u)}),p&&(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"]'),p=(s=i==null?void 0:i.getAttribute("src"))!=null?s:"";i==null||i.removeAttribute("src"),setTimeout(()=>{i==null||i.setAttribute("src",p)},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 xe(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 Le(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 p,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=(p=r==null?void 0:r.cues)==null?void 0:p[d],l=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,l,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 Le(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:p})=>i<=a&&p>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 Le(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:p})=>i<=a&&p>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"},Re=e=>{if(e.includes("fps"))return F.FAIRPLAY;if(e.includes("playready"))return F.PLAYREADY;if(e.includes("widevine"))return F.WIDEVINE},He=async e=>fetch(e).then(t=>t.text()).then(t=>{let n=t.split(`
"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(`
`))}),Ne=e=>{var s,i,p;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")),l=(p=c==null?void 0:c.split(":"))==null?void 0:p[1];o=+(l!=null?l:6)*3}}return{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o}},_e=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 He(e);return Ne(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,p;let{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o}=await _e(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})),((p=M.get(t))!=null?p:{}).streamType=a,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Oe=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}},Ve=(e,t,n)=>{var i,p,u,d,c,l,f,m;let{streamType:a,targetLiveWindow:r,liveEdgeStartOffset:o,lowLatency:s}=Oe(e);if(a===g.LIVE){s?(n.config.backBufferLength=(i=n.userConfig.backBufferLength)!=null?i:4,n.config.maxFragLookUpTolerance=(p=n.userConfig.maxFragLookUpTolerance)!=null?p:.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(L){return t.seekable.start(L)},end(L){var I;return L>this.length||L<0||Number.isFinite(t.duration)?t.seekable.end(L):(I=n.liveSyncPosition)!=null?I:t.seekable.end(L)}});((c=M.get(t))!=null?c:{}).seekable=E}((l=M.get(t))!=null?l:{}).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,Se,bt=(Se=(De=globalThis==null?void 0:globalThis.navigator)==null?void 0:De.userAgent)!=null?Se:"",vt=bt.toLowerCase().indexOf("android")!==-1,M=new WeakMap,k="mux.com",we,Ie,Ue=(Ie=(we=y).isSupported)==null?void 0:Ie.call(we),xt=vt,Lt=()=>w.default.utils.now(),Fe=w.default.utils.generateUUID,kt=({playbackId:e,customDomain:t=k,maxResolution:n,minResolution:a,renditionOrder:r,programStartTime:o,programEndTime:s,tokens:{playback:i}={},extraSourceParams:p={}}={})=>{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((l,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(p).forEach(([l,f])=>{f!=null&&c.searchParams.set(l,f)})),c.toString()},Pt=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},Et=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=Pt(e.playbackId))!=null?n:re(e.src))!=null?a:e.src},Ct=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},ht=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},At=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,Dt=(e,t,n=ae)=>Math.abs(e-t)<=n,We=(e,t,n=ae)=>e>t||Dt(e,t,n),Ke=(e,t=ae)=>e.paused&&We(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(l=>!!l.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},Be=(e,t)=>e.ended||e.loop?e.ended:t&&oe(e,t)?!0:Ke(e),St=(e,t,n)=>{$e(t,n);let{metadata:a={}}=e,{view_session_id:r=Fe()}=a,o=Et(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=qe(e,t),p=Me(e,t,i);Qe(e,t,i),Ze(e,t,i),j(t),ee(t);let u=ge(e,t,i);return{engine:i,setAutoplay:u,setPreload:p}},$e=(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",tt),e.removeEventListener("error",ne),e.removeEventListener("durationchange",et),M.delete(e),e.dispatchEvent(new Event("teardown")))};function Ye(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||!(Ue&&(s||xt)))}var qe=(e,t)=>{let{debug:n,streamType:a,startTime:r=-1,metadata:o,preferCmcd:s,_hlsConfig:i={}}=e,u=D(e)===v.M3U8,d=Ye(e,t);if(u&&!d&&Ue){let c={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},l=ze(a),f=Xe(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:(L,I)=>{var ce,ue;if(s&&s!==C.QUERY)return;let R=new URL(I);if(!R.searchParams.has("CMCD"))return;let nt=((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",nt),L.open("GET",R)},...c,...l,...f,...i})}},ze=e=>e===g.LIVE?{backBufferLength:8}:{},Xe=e=>{let{drmToken:t,src:n,playbackId:a=re(n),drmTypeCb:r}=e;return!t||!a?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:S(e,"fairplay"),serverCertificateUrl:se(e,"fairplay")},"com.widevine.alpha":{licenseUrl:S(e,"widevine")},"com.microsoft.playready":{licenseUrl:S(e,"playready")}},requestMediaKeySystemAccessFunc:(o,s)=>(o==="com.widevine.alpha"&&(s=[...s.map(i=>{var u;let p=(u=i.videoCapabilities)==null?void 0:u.map(d=>({...d,robustness:"HW_SECURE_ALL"}));return{...i,videoCapabilities:p}}),...s]),navigator.requestMediaKeySystemAccess(o,s).then(i=>{let p=Re(o);return r==null||r(p),i}))}},Ge=async e=>await(await fetch(e)).arrayBuffer(),je=async(e,t)=>{let a=await(await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e})).arrayBuffer();return new Uint8Array(a)},Je=(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(l=>{var f;return(f=e.drmTypeCb)==null||f.call(e,F.FAIRPLAY),l})).createMediaKeys(),c=await Ge(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})}),p=await je(i,S(e,"fairplay"));return await s.update(p),s}catch(r){console.error(`Could not start encrypted playback due to exception "${r}"`)}})},S=({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())},Qe=(e,t,n)=>{var s;let{envKey:a,disableTracking:r}=e,o=ie(e);if(!r&&(a||o)){let{playerInitTime:i,playerSoftwareName:p,playerSoftwareVersion:u,beaconCollectionDomain:d,debug:c,disableCookies:l}=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;w.default.monitor(t,{debug:c,beaconCollectionDomain:d,hlsjs:n,Hls:n?y:void 0,automaticErrorTracking:!1,errorTranslator:m,disableCookies:l,data:{...a?{env_key:a}:{},player_software_name:p,player_software:p,player_software_version:u,player_init_time:i,...f}})}},Ze=(e,t,n)=>{var u;let a=Ye(e,t),{src:r}=e,o=()=>{t.ended||!Be(t,n)||(oe(t,n)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},s,i,p=()=>{var l,f;let d=(l=K(t))==null?void 0:l.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",p),t&&a){let d=D(e);if(typeof r=="string"){let c=()=>{if(te(t)!==g.LIVE||Number.isFinite(t.duration))return;let l=setInterval(p,1e3);t.addEventListener("teardown",()=>{clearInterval(l)},{once:!0}),T(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(l)})};if(t.preload==="none"){let l=()=>{W(r,t,d).then(c),t.removeEventListener("loadedmetadata",f)},f=()=>{W(r,t,d).then(c),t.removeEventListener("play",l)};T(t,"play",l,{once:!0}),T(t,"loadedmetadata",f,{once:!0})}else W(r,t,d).then(c);e.drmToken&&Je(e,t),t.setAttribute("src",r),e.startTime&&(((u=M.get(t))!=null?u:{}).startTime=e.startTime,t.addEventListener("durationchange",et,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",tt),t.addEventListener("error",ne),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(l=>{l.remove()})},{once:!0}),T(t,"pause",o),T(t,"seeked",o),T(t,"play",()=>{t.ended||We(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)=>{Ve(c.details,t,n),p(),te(t)===g.LIVE&&!Number.isFinite(t.duration)&&(n.on(y.Events.LEVEL_UPDATED,p),T(t,"durationchange",()=>{Number.isFinite(t.duration)&&n.off(y.Events.LEVELS_UPDATED,p)}))}),n.on(y.Events.ERROR,(d,c)=>{let l={[y.ErrorTypes.NETWORK_ERROR]:x.MEDIA_ERR_NETWORK,[y.ErrorTypes.MEDIA_ERROR]:x.MEDIA_ERR_DECODE},f=new x("",l[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 et(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 tt(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 x(n,a);if(t.src&&(a!==x.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 x))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}))}
`))}),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}))}
//# sourceMappingURL=index.cjs.js.map

@@ -30,3 +30,3 @@ {

"src/types.ts": {
"bytes": 5800,
"bytes": 5827,
"imports": [],

@@ -36,3 +36,3 @@ "format": "esm"

"src/util.ts": {
"bytes": 3300,
"bytes": 3368,
"imports": [

@@ -128,3 +128,3 @@ {

"src/index.ts": {
"bytes": 43460,
"bytes": 45747,
"imports": [

@@ -195,3 +195,3 @@ {

"inputs": {},
"bytes": 2148091
"bytes": 2150741
},

@@ -300,8 +300,8 @@ "dist/playback-core.mjs": {

"src/index.ts": {
"bytesInOutput": 13140
"bytesInOutput": 13332
}
},
"bytes": 505019
"bytes": 505211
}
}
}

@@ -1,2 +0,2 @@

/// <reference types="mux-embed/dist/types/mux-embed" />
import { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import mux from 'mux-embed';

@@ -8,3 +8,2 @@ import Hls from './hls';

import { getStartDate, getCurrentPdt } from './pdt';
import { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import { StreamTypes, MediaTypes } from './types';

@@ -27,3 +26,3 @@ import { HlsConfig } from 'hls.js';

};
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | '') => Promise<{
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | "") => Promise<{
streamType: "on-demand" | "live";

@@ -37,3 +36,3 @@ targetLiveWindow: number;

}>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | '') => Promise<void>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | "") => Promise<void>;
export declare const getStreamInfoFromHlsjsLevelDetails: (levelDetails: any) => {

@@ -45,3 +44,16 @@ streamType: "on-demand" | "live";

};
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, 'config' | 'userConfig' | 'liveSyncPosition'>) => void;
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, "config" | "userConfig" | "liveSyncPosition">) => void;
declare global {
interface NavigatorUAData {
platform: string;
mobile: boolean;
brands: Array<{
brand: string;
version: string;
}>;
}
interface Navigator {
userAgentData?: NavigatorUAData;
}
}
export declare const muxMediaState: WeakMap<HTMLMediaElement, Partial<MuxMediaProps> & {

@@ -78,22 +90,22 @@ seekable?: TimeRanges;

/** Should we add audio fragments logic here, too? (CJP) */
'levels' | 'currentLevel'>) => boolean | undefined;
"levels" | "currentLevel">) => boolean | undefined;
export declare const getEnded: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
'levels' | 'currentLevel'>) => boolean;
"levels" | "currentLevel">) => boolean;
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
engine: Hls | undefined;
setAutoplay: (newAutoplay?: import("./types").Autoplay | undefined) => void;
setPreload: (val?: "" | "none" | "metadata" | "auto" | undefined) => void;
setAutoplay: (newAutoplay?: import("./types").Autoplay) => void;
setPreload: (val?: HTMLMediaElement["preload"]) => void;
};
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" | "drmToken" | "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" | "drmToken" | "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 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 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 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;
import { PlaybackEngine } from './types';
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement['preload']) => void;
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement["preload"]) => void;

@@ -1,2 +0,2 @@

/// <reference types="mux-embed/dist/types/mux-embed" />
/// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" />
import { Options } from 'mux-embed';

@@ -3,0 +3,0 @@ import { MediaError } from './errors';

@@ -9,3 +9,3 @@ import { HlsPlaylistTypes, MuxMediaProps } from './types';

];
export declare const getType: (props: Partial<Pick<MuxMediaProps, 'type' | 'src'>>) => "" | import("./types").MediaTypes;
export declare const getType: (props: Partial<Pick<MuxMediaProps, "type" | "src">>) => "" | import("./types").MediaTypes;
export declare const toStreamTypeFromPlaylistType: (playlistType: HlsPlaylistTypes) => "on-demand" | "live";

@@ -12,0 +12,0 @@ export declare const toTargetLiveWindowFromPlaylistType: (playlistType: HlsPlaylistTypes) => number;

@@ -1,2 +0,2 @@

/// <reference types="mux-embed/dist/types/mux-embed" />
import type { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import mux from 'mux-embed';

@@ -8,3 +8,2 @@ import Hls from './hls';

import { getStartDate, getCurrentPdt } from './pdt';
import type { ValueOf, PlaybackCore, MuxMediaProps, MuxMediaPropsInternal, MaxResolutionValue, MinResolutionValue, RenditionOrderValue } from './types';
import { StreamTypes, MediaTypes } from './types';

@@ -27,3 +26,3 @@ import type { HlsConfig } from 'hls.js';

};
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | '') => Promise<{
export declare const getStreamInfoFromSrcAndType: (src: string, type?: MediaTypes | "") => Promise<{
streamType: "on-demand" | "live";

@@ -37,3 +36,3 @@ targetLiveWindow: number;

}>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | '') => Promise<void>;
export declare const updateStreamInfoFromSrc: (src: string, mediaEl: HTMLMediaElement, type?: MediaTypes | "") => Promise<void>;
export declare const getStreamInfoFromHlsjsLevelDetails: (levelDetails: any) => {

@@ -45,3 +44,16 @@ streamType: "on-demand" | "live";

};
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, 'config' | 'userConfig' | 'liveSyncPosition'>) => void;
export declare const updateStreamInfoFromHlsjsLevelDetails: (levelDetails: any, mediaEl: HTMLMediaElement, hls: Pick<Hls, "config" | "userConfig" | "liveSyncPosition">) => void;
declare global {
interface NavigatorUAData {
platform: string;
mobile: boolean;
brands: Array<{
brand: string;
version: string;
}>;
}
interface Navigator {
userAgentData?: NavigatorUAData;
}
}
export declare const muxMediaState: WeakMap<HTMLMediaElement, Partial<MuxMediaProps> & {

@@ -78,22 +90,22 @@ seekable?: TimeRanges;

/** Should we add audio fragments logic here, too? (CJP) */
'levels' | 'currentLevel'>) => boolean | undefined;
"levels" | "currentLevel">) => boolean | undefined;
export declare const getEnded: (mediaEl: HTMLMediaElement, hls?: Pick<Hls,
/** Should we add audio fragments logic here, too? (CJP) */
'levels' | 'currentLevel'>) => boolean;
"levels" | "currentLevel">) => boolean;
export declare const initialize: (props: Partial<MuxMediaPropsInternal>, mediaEl: HTMLMediaElement, core?: PlaybackCore) => {
engine: Hls | undefined;
setAutoplay: (newAutoplay?: import("./types").Autoplay | undefined) => void;
setPreload: (val?: "" | "none" | "metadata" | "auto" | undefined) => void;
setAutoplay: (newAutoplay?: import("./types").Autoplay) => void;
setPreload: (val?: HTMLMediaElement["preload"]) => void;
};
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" | "drmToken" | "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" | "drmToken" | "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 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 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 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;
import { PlaybackEngine } from './types';
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement['preload']) => void;
export declare const setupPreload: ({ preload, src }: Partial<HTMLMediaElement>, mediaEl: HTMLMediaElement, hls?: PlaybackEngine) => (val?: HTMLMediaElement["preload"]) => void;

@@ -1,2 +0,2 @@

/// <reference types="mux-embed/dist/types/mux-embed" />
/// <reference path="../../../../node_modules/mux-embed/dist/types/mux-embed.d.ts" preserve="true" />
import type { Options } from 'mux-embed';

@@ -3,0 +3,0 @@ import type { MediaError } from './errors';

@@ -6,3 +6,3 @@ import type { HlsPlaylistTypes, MuxMediaProps } from './types';

export declare const toPlaybackIdParts: (playbackIdWithOptionalParams: string) => [string, string?];
export declare const getType: (props: Partial<Pick<MuxMediaProps, 'type' | 'src'>>) => "" | import("./types").MediaTypes;
export declare const getType: (props: Partial<Pick<MuxMediaProps, "type" | "src">>) => "" | import("./types").MediaTypes;
export declare const toStreamTypeFromPlaylistType: (playlistType: HlsPlaylistTypes) => "on-demand" | "live";

@@ -9,0 +9,0 @@ export declare const toTargetLiveWindowFromPlaylistType: (playlistType: HlsPlaylistTypes) => number;

{
"name": "@mux/playback-core",
"version": "0.25.2-canary.0-2722b6e",
"version": "0.25.2-canary.0-3437ced",
"description": "Core library for media playback in the browser shared by mux elements",

@@ -41,3 +41,3 @@ "main": "./dist/index.cjs.js",

"clean": "shx rm -rf dist/",
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/ --ext .js,.jsx,.ts,.tsx",
"test": "web-test-runner **/*.test.js --port 8004 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",

@@ -68,3 +68,4 @@ "posttest": "replace 'SF:src/' 'SF:packages/playback-core/src/' coverage/lcov.info --silent",

"@open-wc/testing": "^4.0.0",
"@typescript-eslint/parser": "^5.48.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@web/dev-server-esbuild": "^1.0.2",

@@ -75,7 +76,7 @@ "@web/dev-server-import-maps": "^0.2.1",

"esbuild": "^0.19.8",
"eslint": "^8.24.0",
"eslint": "^9.9.1",
"npm-run-all": "^4.1.5",
"shx": "^0.3.4",
"typescript": "^4.9.4"
"typescript": "^5.5.4"
}
}

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