@mux/mux-audio 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var U=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var dt=(i,e,t)=>e in i?U(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var ct=(i,e)=>{for(var t in e)U(i,t,{get:e[t],enumerable:!0})},ht=(i,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of lt(e))!ut.call(i,u)&&u!==t&&U(i,u,{get:()=>e[u],enumerable:!(a=ot(e,u))||a.enumerable});return i};var mt=i=>ht(U({},"__esModule",{value:!0}),i);var F=(i,e,t)=>(dt(i,typeof e!="symbol"?e+"":e,t),t),q=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var c=(i,e,t)=>(q(i,e,"read from private field"),t?t.call(i):e.get(i)),h=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},b=(i,e,t,a)=>(q(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t);var g=(i,e,t)=>(q(i,e,"access private method"),t);var _t={};ct(_t,{AudioEvents:()=>Q,MediaError:()=>l.MediaError,default:()=>Ct});module.exports=mt(_t);var v=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends v{}globalThis.DocumentFragment=i}var I=class extends v{},$=class extends v{},pt={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(I)}},N,z=class{constructor(e,t={}){h(this,N,void 0);b(this,N,t==null?void 0:t.detail)}get detail(){return c(this,N)}initCustomEvent(){}};N=new WeakMap;function ft(i,e){return new I}var X={document:{createElement:ft},DocumentFragment,customElements:pt,CustomEvent:z,EventTarget:v,HTMLElement:I,HTMLVideoElement:$},Z=typeof window=="undefined"||typeof globalThis.customElements=="undefined",j=Z?X:globalThis,vt=Z?X.document:globalThis.document;var l=require("@mux/playback-core");var bt=()=>{try{return"0.11.1"}catch{}return"UNKNOWN"},gt=bt(),tt=()=>gt;var Q=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],et,W=(et=globalThis.document)==null?void 0:et.createElement("template");W&&(W.innerHTML=`
1
+ "use strict";var H=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var mt=(i,e,t)=>e in i?H(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var pt=(i,e)=>{for(var t in e)H(i,t,{get:e[t],enumerable:!0})},bt=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of ct(e))!ht.call(i,d)&&d!==t&&H(i,d,{get:()=>e[d],enumerable:!(o=dt(e,d))||o.enumerable});return i};var ft=i=>bt(H({},"__esModule",{value:!0}),i);var $=(i,e,t)=>(mt(i,typeof e!="symbol"?e+"":e,t),t),z=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var l=(i,e,t)=>(z(i,e,"read from private field"),t?t.call(i):e.get(i)),c=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},b=(i,e,t,o)=>(z(i,e,"write to private field"),o?o.call(i,t):e.set(i,t),t);var f=(i,e,t)=>(z(i,e,"access private method"),t);var kt={};pt(kt,{AudioEvents:()=>Z,MediaError:()=>u.MediaError,default:()=>_t});module.exports=ft(kt);var _=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends _{}globalThis.DocumentFragment=i}var D=class extends _{},W=class extends _{},gt={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(D)}},N,J=class{constructor(e,t={}){c(this,N,void 0);b(this,N,t==null?void 0:t.detail)}get detail(){return l(this,N)}initCustomEvent(){}};N=new WeakMap;function Et(i,e){return new D}var tt={document:{createElement:Et},DocumentFragment,customElements:gt,CustomEvent:J,EventTarget:_,HTMLElement:D,HTMLVideoElement:W},et=typeof window=="undefined"||typeof globalThis.customElements=="undefined",G=et?tt:globalThis,St=et?tt.document:globalThis.document;var u=require("@mux/playback-core");var At=()=>{try{return"0.11.2"}catch{}return"UNKNOWN"},yt=At(),it=()=>yt;var Z=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],st,Q=(st=globalThis.document)==null?void 0:st.createElement("template");Q&&(Q.innerHTML=`
2
2
  <style>
3
3
  :host {
4
4
  display: inline-flex;
@@ -13,7 +13,7 @@
13
13
  </style>
14
14
  <slot name="media"></slot>
15
15
  <slot></slot>
16
- `);var it,J=(it=globalThis.document)==null?void 0:it.createElement("template");J&&(J.innerHTML=`
16
+ `);var rt,X=(rt=globalThis.document)==null?void 0:rt.createElement("template");X&&(X.innerHTML=`
17
17
  <style>
18
18
  :host {
19
19
  display: inline-block;
@@ -36,5 +36,5 @@
36
36
  </style>
37
37
  <slot name="media"></slot>
38
38
  <slot></slot>
39
- `);var st=(i,{tag:e,is:t})=>{var k,E,C,p,rt,S,R,_,P,K,nt,Y,at;let a=(k=globalThis.document)==null?void 0:k.createElement(e,{is:t}),u=a?Et(a):[];return E=class extends i{constructor(){super();h(this,_);h(this,K);h(this,Y);h(this,S,void 0);h(this,R,void 0);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var r,m,f;return g(r=E,p,rt).call(r),[...(f=(m=a==null?void 0:a.constructor)==null?void 0:m.observedAttributes)!=null?f:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var s,r,m;return(m=(r=(s=c(this,R))!=null?s:this.shadowRoot.querySelector(e))!=null?r:this.querySelector(":scope > slot[slot=media]"))!=null?m:this.querySelector(e)}set nativeEl(s){b(this,R,s)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(s){this.toggleAttribute("muted",!!s)}get src(){return this.getAttribute("src")}set src(s){this.setAttribute("src",`${s}`)}get preload(){var s,r;return(r=this.getAttribute("preload"))!=null?r:(s=this.nativeEl)==null?void 0:s.preload}set preload(s){this.setAttribute("preload",`${s}`)}handleEvent(s){s.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(s.type,{detail:s.detail}))}attributeChangedCallback(s,r,m){g(this,_,P).call(this),g(this,Y,at).call(this,s,r,m)}connectedCallback(){g(this,_,P).call(this)}},C=new WeakMap,p=new WeakSet,rt=function(){if(c(this,C))return;b(this,C,!0);let s=new Set(this.observedAttributes);s.delete("muted");for(let r of u){if(r in this.prototype)continue;if(typeof a[r]=="function")this.prototype[r]=function(...f){return g(this,_,P).call(this),this.call?this.call(r,...f):this.nativeEl[r].apply(this.nativeEl,f)};else{let f={get(){var d,y,M;g(this,_,P).call(this);let o=r.toLowerCase();if(s.has(o)){let T=this.getAttribute(o);return T===null?!1:T===""?!0:T}return(M=(d=this.get)==null?void 0:d.call(this,r))!=null?M:(y=this.nativeEl)==null?void 0:y[r]}};r!==r.toUpperCase()&&(f.set=function(o){g(this,_,P).call(this);let d=r.toLowerCase();if(s.has(d)){o===!0||o===!1||o==null?this.toggleAttribute(d,!!o):this.setAttribute(d,o);return}if(this.set){this.set(r,o);return}this.nativeEl[r]=o}),Object.defineProperty(this.prototype,r,f)}}},S=new WeakMap,R=new WeakMap,_=new WeakSet,P=function(){var m,f;if(c(this,S))return;if(b(this,S,!0),!this.nativeEl){let o=document.createElement(e,{is:t});o.part=e,this.shadowRoot.append(o)}this.nativeEl.muted=this.hasAttribute("muted");for(let o of u)g(this,K,nt).call(this,o);let s=new Map,r=this.shadowRoot.querySelector("slot:not([name])");r==null||r.addEventListener("slotchange",()=>{let o=new Map(s);r.assignedElements().filter(d=>["track","source"].includes(d.localName)).forEach(d=>{var M,T;o.delete(d);let y=s.get(d);y||(y=d.cloneNode(),s.set(d,y)),(T=(M=this.nativeEl).append)==null||T.call(M,y)}),o.forEach(d=>d.remove())});for(let o of this.constructor.Events)(f=(m=this.shadowRoot).addEventListener)==null||f.call(m,o,this,!0)},K=new WeakSet,nt=function(s){if(Object.prototype.hasOwnProperty.call(this,s)){let r=this[s];delete this[s],this[s]=r}},Y=new WeakSet,at=function(s,r,m){var f,o,d,y,M,T;["id","class"].includes(s)||(m===null?(o=(f=this.nativeEl).removeAttribute)==null||o.call(f,s):((y=(d=this.nativeEl).getAttribute)==null?void 0:y.call(d,s))!=m&&((T=(M=this.nativeEl).setAttribute)==null||T.call(M,s,m)))},h(E,p),F(E,"Events",Q),F(E,"template",e.endsWith("audio")?W:J),h(E,C,void 0),E};function Et(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var Lt=globalThis.document?st(HTMLElement,{tag:"video"}):class{},H=globalThis.document?st(HTMLElement,{tag:"audio"}):class{};var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},At=Object.values(n),yt=tt(),Tt="mux-audio",A,O,w,x,B,L,G,D=class extends H{constructor(){super();h(this,L);h(this,A,void 0);h(this,O,void 0);h(this,w,void 0);h(this,x,{});h(this,B,void 0);b(this,w,(0,l.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...At,...(t=H.observedAttributes)!=null?t:[]]}get playerInitTime(){return c(this,w)}get playerSoftwareName(){return Tt}get playerSoftwareVersion(){return yt}get _hls(){var t;return(t=c(this,A))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(n.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(n.DEBUG,""):this.removeAttribute(n.DEBUG))}get disableCookies(){return this.hasAttribute(n.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(n.DISABLE_COOKIES,""):this.removeAttribute(n.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(n.START_TIME);if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(n.START_TIME):this.setAttribute(n.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(n.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(n.PLAYBACK_ID,t):this.removeAttribute(n.PLAYBACK_ID))}get ended(){return(0,l.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(n.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(n.ENV_KEY,t):this.removeAttribute(n.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(n.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(n.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(n.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(n.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(n.STREAM_TYPE,t):this.removeAttribute(n.STREAM_TYPE))}getStartDate(){return(0,l.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,l.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(n.PREFER_PLAYBACK);if(t===l.PlaybackTypes.MSE||t===l.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===l.PlaybackTypes.MSE||t===l.PlaybackTypes.NATIVE?this.setAttribute(n.PREFER_PLAYBACK,t):this.removeAttribute(n.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(a=>a.startsWith("metadata-")&&![n.METADATA_URL].includes(a)).reduce((a,u)=>{let k=this.getAttribute(u);return k!=null&&(a[u.replace(/^metadata-/,"").replace(/-/g,"_")]=k),a},{}),...c(this,x)}}set metadata(t){b(this,x,t!=null?t:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",c(this,x)))}get _hlsConfig(){return c(this,B)}set _hlsConfig(t){b(this,B,t)}load(){b(this,A,(0,l.initialize)(this,this.nativeEl,c(this,A)))}unload(){(0,l.teardown)(this.nativeEl,c(this,A)),b(this,A,void 0)}attributeChangedCallback(t,a,u){var E,C;switch(H.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,a,u),t){case"src":{let p=!!a,V=!!u;!p&&V?g(this,L,G).call(this):p&&!V?this.unload():p&&V&&(this.unload(),g(this,L,G).call(this));break}case"autoplay":if(u===a)break;(E=c(this,A))==null||E.setAutoplay(this.autoplay);break;case"preload":if(u===a)break;(C=c(this,A))==null||C.setPreload(u);break;case n.PLAYBACK_ID:this.src=(0,l.toMuxVideoURL)(this);break;case n.DEBUG:{let p=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=p);break}case n.METADATA_URL:u&&fetch(u).then(p=>p.json()).then(p=>this.metadata=p).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${u}!`));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!c(this,A)&&g(this,L,G).call(this)}disconnectedCallback(){this.unload()}};A=new WeakMap,O=new WeakMap,w=new WeakMap,x=new WeakMap,B=new WeakMap,L=new WeakSet,G=async function(){c(this,O)||(await b(this,O,Promise.resolve()),b(this,O,null),this.load())};j.customElements.get("mux-audio")||(j.customElements.define("mux-audio",D),j.MuxAudioElement=D);var Ct=D;
39
+ `);var nt=(i,{tag:e,is:t})=>{var C,g,y,p,ot,x,L,M,T,k,Y,at,U,lt,j,ut;let o=(C=globalThis.document)==null?void 0:C.createElement(e,{is:t}),d=o?Tt(o):[];return g=class extends i{constructor(){super();c(this,T);c(this,Y);c(this,U);c(this,j);c(this,x,void 0);c(this,L,void 0);c(this,M,new Map);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var r,a,m;return f(r=g,p,ot).call(r),[...(m=(a=o==null?void 0:o.constructor)==null?void 0:a.observedAttributes)!=null?m:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var s,r,a;return(a=(r=(s=l(this,L))!=null?s:this.shadowRoot.querySelector(e))!=null?r:this.querySelector(":scope > [slot=media]"))!=null?a:this.querySelector(e)}set nativeEl(s){b(this,L,s)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(s){this.toggleAttribute("muted",!!s)}get src(){return this.getAttribute("src")}set src(s){this.setAttribute("src",`${s}`)}get preload(){var s,r;return(r=this.getAttribute("preload"))!=null?r:(s=this.nativeEl)==null?void 0:s.preload}set preload(s){this.setAttribute("preload",`${s}`)}init(){var s,r;if(!this.nativeEl){let a=document.createElement(e,{is:t});a.part=e,this.shadowRoot.querySelector('slot[name="media"]').append(a)}this.nativeEl.muted=this.hasAttribute("muted");for(let a of d)f(this,U,lt).call(this,a);this.shadowRoot.addEventListener("slotchange",this);for(let a of this.constructor.Events)(r=(s=this.shadowRoot).addEventListener)==null||r.call(s,a,this,!0)}handleEvent(s){if(s.type==="slotchange"){f(this,Y,at).call(this);return}s.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(s.type,{detail:s.detail}))}attributeChangedCallback(s,r,a){f(this,T,k).call(this),f(this,j,ut).call(this,s,r,a)}connectedCallback(){f(this,T,k).call(this)}},y=new WeakMap,p=new WeakSet,ot=function(){if(l(this,y))return;b(this,y,!0);let s=new Set(this.observedAttributes);s.delete("muted");for(let r of d){if(r in this.prototype)continue;if(typeof o[r]=="function")this.prototype[r]=function(...m){return f(this,T,k).call(this),this.call?this.call(r,...m):this.nativeEl[r].apply(this.nativeEl,m)};else{let m={get(){var A,R,I;f(this,T,k).call(this);let h=r.toLowerCase();if(s.has(h)){let v=this.getAttribute(h);return v===null?!1:v===""?!0:v}return(I=(A=this.get)==null?void 0:A.call(this,r))!=null?I:(R=this.nativeEl)==null?void 0:R[r]}};r!==r.toUpperCase()&&(m.set=function(h){f(this,T,k).call(this);let A=r.toLowerCase();if(s.has(A)){h===!0||h===!1||h==null?this.toggleAttribute(A,!!h):this.setAttribute(A,h);return}if(this.set){this.set(r,h);return}this.nativeEl[r]=h}),Object.defineProperty(this.prototype,r,m)}}},x=new WeakMap,L=new WeakMap,M=new WeakMap,T=new WeakSet,k=function(){l(this,x)||(b(this,x,!0),this.init())},Y=new WeakSet,at=function(){let s=new Map(l(this,M));this.shadowRoot.querySelector("slot:not([name])").assignedElements().filter(r=>["track","source"].includes(r.localName)).forEach(r=>{var m,h;s.delete(r);let a=l(this,M).get(r);a||(a=r.cloneNode(),l(this,M).set(r,a)),(h=(m=this.nativeEl).append)==null||h.call(m,a)}),s.forEach(r=>r.remove())},U=new WeakSet,lt=function(s){if(Object.prototype.hasOwnProperty.call(this,s)){let r=this[s];delete this[s],this[s]=r}},j=new WeakSet,ut=function(s,r,a){var m,h,A,R,I,v;["id","class"].includes(s)||!g.observedAttributes.includes(s)&&this.constructor.observedAttributes.includes(s)||(a===null?(h=(m=this.nativeEl).removeAttribute)==null||h.call(m,s):((R=(A=this.nativeEl).getAttribute)==null?void 0:R.call(A,s))!=a&&((v=(I=this.nativeEl).setAttribute)==null||v.call(I,s,a)))},c(g,p),$(g,"Events",Z),$(g,"template",e.endsWith("audio")?Q:X),c(g,y,void 0),g};function Tt(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var It=globalThis.document?nt(HTMLElement,{tag:"video"}):class{},V=globalThis.document?nt(HTMLElement,{tag:"audio"}):class{};var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Ct=Object.values(n),Mt=it(),vt="mux-audio",E,P,B,O,K,S,F,w=class extends V{constructor(){super();c(this,S);c(this,E,void 0);c(this,P,void 0);c(this,B,void 0);c(this,O,{});c(this,K,void 0);b(this,B,(0,u.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...Ct,...(t=V.observedAttributes)!=null?t:[]]}get playerInitTime(){return l(this,B)}get playerSoftwareName(){return vt}get playerSoftwareVersion(){return Mt}get _hls(){var t;return(t=l(this,E))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(n.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(n.DEBUG,""):this.removeAttribute(n.DEBUG))}get disableCookies(){return this.hasAttribute(n.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(n.DISABLE_COOKIES,""):this.removeAttribute(n.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(n.START_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(n.START_TIME):this.setAttribute(n.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(n.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(n.PLAYBACK_ID,t):this.removeAttribute(n.PLAYBACK_ID))}get ended(){return(0,u.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(n.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(n.ENV_KEY,t):this.removeAttribute(n.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(n.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(n.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(n.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(n.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(n.STREAM_TYPE,t):this.removeAttribute(n.STREAM_TYPE))}getStartDate(){return(0,u.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,u.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(n.PREFER_PLAYBACK);if(t===u.PlaybackTypes.MSE||t===u.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===u.PlaybackTypes.MSE||t===u.PlaybackTypes.NATIVE?this.setAttribute(n.PREFER_PLAYBACK,t):this.removeAttribute(n.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(o=>o.startsWith("metadata-")&&![n.METADATA_URL].includes(o)).reduce((o,d)=>{let C=this.getAttribute(d);return C!=null&&(o[d.replace(/^metadata-/,"").replace(/-/g,"_")]=C),o},{}),...l(this,O)}}set metadata(t){b(this,O,t!=null?t:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",l(this,O)))}get _hlsConfig(){return l(this,K)}set _hlsConfig(t){b(this,K,t)}load(){b(this,E,(0,u.initialize)(this,this.nativeEl,l(this,E)))}unload(){(0,u.teardown)(this.nativeEl,l(this,E)),b(this,E,void 0)}attributeChangedCallback(t,o,d){var g,y;switch(V.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,o,d),t){case"src":{let p=!!o,q=!!d;!p&&q?f(this,S,F).call(this):p&&!q?this.unload():p&&q&&(this.unload(),f(this,S,F).call(this));break}case"autoplay":if(d===o)break;(g=l(this,E))==null||g.setAutoplay(this.autoplay);break;case"preload":if(d===o)break;(y=l(this,E))==null||y.setPreload(d);break;case n.PLAYBACK_ID:this.src=(0,u.toMuxVideoURL)(this);break;case n.DEBUG:{let p=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=p);break}case n.METADATA_URL:d&&fetch(d).then(p=>p.json()).then(p=>this.metadata=p).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${d}!`));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!l(this,E)&&f(this,S,F).call(this)}disconnectedCallback(){this.unload()}};E=new WeakMap,P=new WeakMap,B=new WeakMap,O=new WeakMap,K=new WeakMap,S=new WeakSet,F=async function(){l(this,P)||(await b(this,P,Promise.resolve()),b(this,P,null),this.load())};G.customElements.get("mux-audio")||(G.customElements.define("mux-audio",w),G.MuxAudioElement=w);var _t=w;
40
40
  //# sourceMappingURL=index.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/polyfills/index.ts", "../src/env.ts", "../../../node_modules/custom-media-element/custom-media-element.js"],
4
- "sourcesContent": ["import { globalThis } from './polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n getStartDate,\n getCurrentPdt,\n getEnded,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport { CustomAudioElement, Events as AudioEvents } from 'custom-media-element';\nimport { HlsConfig } from 'hls.js';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n #_hlsConfig?: Partial<HlsConfig>;\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get ended() {\n // This ensures that edge case media that doesn't properly end will\n // still announce itself as \"ended\".\n return getEnded(this.nativeEl, this._hls);\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n getStartDate() {\n return getStartDate(this.nativeEl, this._hls);\n }\n\n get currentPdt() {\n return getCurrentPdt(this.nativeEl, this._hls);\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n const inferredMetadataAttrs: { [key: string]: string } = this.getAttributeNames()\n .filter((attrName) => {\n return attrName.startsWith('metadata-') && !([Attributes.METADATA_URL] as string[]).includes(attrName);\n })\n .reduce((currAttrs, attrName) => {\n const value = this.getAttribute(attrName);\n if (value != null) {\n currAttrs[attrName.replace(/^metadata-/, '').replace(/-/g, '_') as string] = value;\n }\n return currAttrs;\n }, {} as { [key: string]: string });\n\n return {\n ...inferredMetadataAttrs,\n ...this.#metadata,\n };\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n get _hlsConfig() {\n return this.#_hlsConfig;\n }\n\n set _hlsConfig(val: Readonly<Partial<HlsConfig>> | undefined) {\n this.#_hlsConfig = val;\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n // Only forward the attributes to the native media element that are not handled.\n const isNativeAttr = CustomAudioElement.observedAttributes.includes(attrName);\n if (isNativeAttr && !['src', 'autoplay', 'preload'].includes(attrName)) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n this.src = toMuxVideoURL(this) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch(() => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback?.();\n if (this.nativeEl && this.src && !this.#core) {\n this.#requestLoad();\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "/* eslint @typescript-eslint/no-empty-function: \"off\", @typescript-eslint/no-unused-vars: \"off\" */\n\nclass EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event: Event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements: CustomElementRegistry = {\n get(_name: string) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement as unknown as CustomElementConstructor);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg: string, eventInitDict: CustomEventInit = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName: string, _options?: ElementCreationOptions): HTMLElement {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\n// const isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\n// const GlobalThis = isServer ? globalThisShim : globalThis;\n// const Document = isServer ? globalThisShim.document : globalThis.document;\n//\n// export { GlobalThis as globalThis, Document as document };\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\ntype GlobalThis = typeof globalThis;\nconst internalGlobalThis: GlobalThis = (isServer ? globalThisShim : globalThis) as GlobalThis;\nconst internalDocument: Document = (isServer ? globalThisShim.document : globalThis.document) as Document;\n\nexport { internalGlobalThis as globalThis, internalDocument as document };\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "/**\n * Custom Media Element\n * Based on https://github.com/muxinc/custom-video-element - Mux - MIT License\n *\n * The goal is to create an element that works just like the video element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\n// The onevent like props are weirdly set on the HTMLElement prototype with other\n// generic events making it impossible to pick these specific to HTMLMediaElement.\nexport const Events = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'encrypted',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n 'waitingforkey',\n 'resize',\n 'enterpictureinpicture',\n 'leavepictureinpicture',\n 'webkitbeginfullscreen',\n 'webkitendfullscreen',\n 'webkitpresentationmodechanged',\n];\n\nexport const audioTemplate = globalThis.document?.createElement('template');\n\nif (audioTemplate) {\n audioTemplate.innerHTML = /*html*/`\n <style>\n :host {\n display: inline-flex;\n line-height: 0;\n flex-direction: column;\n justify-content: end;\n }\n\n audio {\n width: 100%;\n }\n </style>\n <slot name=\"media\"></slot>\n <slot></slot>\n `;\n}\n\n// If the `media` slot is used leave the styling up to the user.\n// It's a more consistent behavior pre and post custom element upgrade.\n\nexport const videoTemplate = globalThis.document?.createElement('template');\n\nif (videoTemplate) {\n videoTemplate.innerHTML = /*html*/`\n <style>\n :host {\n display: inline-block;\n line-height: 0;\n }\n\n video {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n object-fit: var(--media-object-fit, contain);\n object-position: var(--media-object-position, 50% 50%);\n }\n\n video::-webkit-media-text-track-container {\n transform: var(--media-webkit-text-track-transform);\n transition: var(--media-webkit-text-track-transition);\n }\n </style>\n <slot name=\"media\"></slot>\n <slot></slot>\n `;\n}\n\n/**\n * @see https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/\n */\nexport const CustomMediaMixin = (superclass, { tag, is }) => {\n\n // `is` makes it possible to extend a custom built-in. e.g. castable-video\n const nativeElTest = globalThis.document?.createElement(tag, { is });\n const nativeElProps = nativeElTest ? getNativeElProps(nativeElTest) : [];\n\n return class CustomMedia extends superclass {\n static Events = Events;\n static template = tag.endsWith('audio') ? audioTemplate : videoTemplate;\n static #isDefined;\n\n static get observedAttributes() {\n CustomMedia.#define();\n\n // Include any attributes from the custom built-in.\n const natAttrs = nativeElTest?.constructor?.observedAttributes ?? [];\n\n return [\n ...natAttrs,\n 'autopictureinpicture',\n 'disablepictureinpicture',\n 'disableremoteplayback',\n 'autoplay',\n 'controls',\n 'controlslist',\n 'crossorigin',\n 'loop',\n 'muted',\n 'playsinline',\n 'poster',\n 'preload',\n 'src',\n ];\n }\n\n static #define() {\n if (this.#isDefined) return;\n this.#isDefined = true;\n\n const propsToAttrs = new Set(this.observedAttributes);\n // defaultMuted maps to the muted attribute, handled manually below.\n propsToAttrs.delete('muted');\n\n // Passthrough native el functions from the custom el to the native el\n for (let prop of nativeElProps) {\n if (prop in this.prototype) continue;\n\n const type = typeof nativeElTest[prop];\n if (type == 'function') {\n // Function\n this.prototype[prop] = function (...args) {\n this.#init();\n\n const fn = () => {\n if (this.call) return this.call(prop, ...args);\n return this.nativeEl[prop].apply(this.nativeEl, args);\n };\n\n return fn();\n };\n } else {\n // Some properties like src, preload, defaultMuted are handled manually.\n\n // Getter\n let config = {\n get() {\n this.#init();\n\n let attr = prop.toLowerCase();\n if (propsToAttrs.has(attr)) {\n const val = this.getAttribute(attr);\n return val === null ? false : val === '' ? true : val;\n }\n\n return this.get?.(prop) ?? this.nativeEl?.[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.#init();\n\n let attr = prop.toLowerCase();\n if (propsToAttrs.has(attr)) {\n if (val === true || val === false || val == null) {\n this.toggleAttribute(attr, Boolean(val));\n } else {\n this.setAttribute(attr, val);\n }\n return;\n }\n\n if (this.set) {\n this.set(prop, val);\n return;\n }\n\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(this.prototype, prop, config);\n }\n }\n }\n\n #isInit;\n #nativeEl;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.append(this.constructor.template.content.cloneNode(true));\n }\n\n // If the custom element is defined before the custom element's HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing in the attributeChangedCallback or\n // connectedCallback or accessing any properties.\n }\n\n get nativeEl() {\n return this.#nativeEl\n ?? this.shadowRoot.querySelector(tag)\n ?? this.querySelector(':scope > slot[slot=media]')\n ?? this.querySelector(tag);\n }\n\n set nativeEl(val) {\n this.#nativeEl = val;\n }\n\n get defaultMuted() {\n return this.hasAttribute('muted');\n }\n\n set defaultMuted(val) {\n this.toggleAttribute('muted', Boolean(val));\n }\n\n get src() {\n return this.getAttribute('src');\n }\n\n set src(val) {\n this.setAttribute('src', `${val}`);\n }\n\n get preload() {\n return this.getAttribute('preload') ?? this.nativeEl?.preload;\n }\n\n set preload(val) {\n this.setAttribute('preload', `${val}`);\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n\n // If there is no nativeEl by now, create it.\n if (!this.nativeEl) {\n const nativeEl = document.createElement(tag, { is });\n nativeEl.part = tag;\n this.shadowRoot.append(nativeEl);\n }\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // Get around this by setting the muted property manually.\n this.nativeEl.muted = this.hasAttribute('muted');\n\n for (let prop of nativeElProps) {\n this.#upgradeProperty(prop);\n }\n\n // Keep some native child elements like track and source in sync.\n const childMap = new Map();\n // An unnamed <slot> will be filled with all of the custom element's\n // top-level child nodes that do not have the slot attribute.\n const slotEl = this.shadowRoot.querySelector('slot:not([name])');\n slotEl?.addEventListener('slotchange', () => {\n const removeNativeChildren = new Map(childMap);\n slotEl\n .assignedElements()\n .filter((el) => ['track', 'source'].includes(el.localName))\n .forEach((el) => {\n // If the source or track is still in the assigned elements keep it.\n removeNativeChildren.delete(el);\n // Re-use clones if possible.\n let clone = childMap.get(el);\n if (!clone) {\n clone = el.cloneNode();\n childMap.set(el, clone);\n }\n this.nativeEl.append?.(clone);\n });\n removeNativeChildren.forEach((el) => el.remove());\n });\n\n // The video events are dispatched on the CustomMediaElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n for (let type of this.constructor.Events) {\n this.shadowRoot.addEventListener?.(type, this, true);\n }\n }\n\n handleEvent(evt) {\n if (evt.target !== this.nativeEl) return;\n this.dispatchEvent(new CustomEvent(evt.type, { detail: evt.detail }));\n }\n\n #upgradeProperty(prop) {\n // Sets properties that are set before the custom element is upgraded.\n // https://web.dev/custom-elements-best-practices/#make-properties-lazy\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n // Delete the set property from this instance.\n delete this[prop];\n // Set the value again via the (prototype) setter on this class.\n this[prop] = value;\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n this.#forwardAttribute(attrName, oldValue, newValue);\n }\n\n #forwardAttribute(attrName, oldValue, newValue) {\n // Ignore a few that don't need to be passed.\n if (['id', 'class'].includes(attrName)) {\n return;\n }\n\n if (newValue === null) {\n this.nativeEl.removeAttribute?.(attrName);\n } else {\n if (this.nativeEl.getAttribute?.(attrName) != newValue) {\n this.nativeEl.setAttribute?.(attrName, newValue);\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n };\n};\n\nfunction getNativeElProps(nativeElTest) {\n // Map all native element properties to the custom element\n // so that they're applied to the native element.\n // Skipping HTMLElement because of things like \"attachShadow\"\n // causing issues. Most of those props still need to apply to\n // the custom element.\n let nativeElProps = [];\n\n // Walk the prototype chain up to HTMLElement.\n // This will grab all super class props in between.\n // i.e. VideoElement and MediaElement\n for (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n nativeElProps.push(...Object.getOwnPropertyNames(proto));\n }\n\n return nativeElProps;\n}\n\nexport const CustomVideoElement = globalThis.document ? CustomMediaMixin(HTMLElement, { tag: 'video' }) : class {};\n\nexport const CustomAudioElement = globalThis.document ? CustomMediaMixin(HTMLElement, { tag: 'audio' }) : class {};\n"],
5
- "mappings": "k8BAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,wCAAAC,KAAA,eAAAC,GAAAJ,ICEA,IAAMK,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAe,CAC3B,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,C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7B,MACF,IAAK,UACH,GAAIQ,IAAaD,EACf,OAEFE,EAAAR,EAAA,KAAKZ,KAAL,MAAAoB,EAAY,WAAWD,GACvB,MACF,KAAKxB,EAAW,YACd,KAAK,OAAM,iBAAc,IAAI,EAC7B,MACF,KAAKA,EAAW,MAAO,CACrB,IAAM6B,EAAQ,KAAK,MACb,KAAK,KAET,QAAQ,KACN,+HACF,EAEI,KAAK,OACT,KAAK,KAAK,OAAO,MAAQA,GAE3B,KACF,CACA,KAAK7B,EAAW,aACVwB,GACF,MAAMA,CAAQ,EACX,KAAMM,GAASA,EAAK,KAAK,CAAC,EAC1B,KAAMC,GAAU,KAAK,SAAWA,CAAK,EACrC,MAAM,IAAM,QAAQ,MAAM,2DAA2DP,CAAQ,GAAG,CAAC,EAEtG,MACF,QACE,KACJ,CACF,CAEA,mBAA0B,CAlY5B,IAAAR,GAmYIA,EAAA,MAAM,oBAAN,MAAAA,EAAA,WACI,KAAK,UAAY,KAAK,KAAO,CAACC,EAAA,KAAKZ,IACrCuB,EAAA,KAAKlB,EAAAC,GAAL,UAEJ,CAEA,sBAAuB,CACrB,KAAK,OAAO,CACd,CACF,EAjVEN,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YAmPMC,EAAA,YAAAC,EAAY,gBAAG,CACfM,EAAA,KAAKX,KACT,MAAOS,EAAA,KAAKT,EAAiB,QAAQ,QAAQ,GAC7CS,EAAA,KAAKT,EAAiB,MACtB,KAAK,KAAK,EACZ,EA4FG0B,EAAW,eAAe,IAAI,WAAW,IAC5CA,EAAW,eAAe,OAAO,YAAapB,CAAe,EAE7DoB,EAAW,gBAAkBpB,GAK/B,IAAOqB,GAAQC",
6
- "names": ["src_exports", "__export", "Events", "src_default", "__toCommonJS", "EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "internalGlobalThis", "internalDocument", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "Events", "_a", "audioTemplate", "videoTemplate", "CustomMediaMixin", "superclass", "tag", "is", "_b", "_isDefined", "_define", "define_fn", "_isInit", "_nativeEl", "_init", "init_fn", "_upgradeProperty", "upgradeProperty_fn", "_forwardAttribute", "forwardAttribute_fn", "nativeElTest", "nativeElProps", "getNativeElProps", "__privateAdd", "_c", "__privateMethod", "__privateGet", "val", "__privateSet", "evt", "attrName", "oldValue", "newValue", "propsToAttrs", "prop", "args", "config", "attr", "nativeEl", "childMap", "slotEl", "removeNativeChildren", "el", "clone", "type", "value", "_d", "_e", "_f", "__publicField", "proto", "CustomVideoElement", "CustomAudioElement", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "__hlsConfig", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement", "__privateAdd", "__privateSet", "_a", "__privateGet", "val", "num", "attrName", "currAttrs", "value", "oldValue", "newValue", "_b", "hadSrc", "hasSrc", "__privateMethod", "debug", "resp", "json", "internalGlobalThis", "src_default", "MuxAudioElement"]
4
+ "sourcesContent": ["import { globalThis } from './polyfills';\nimport {\n initialize,\n teardown,\n generatePlayerInitTime,\n MuxMediaProps,\n StreamTypes,\n PlaybackTypes,\n ValueOf,\n toMuxVideoURL,\n Metadata,\n MediaError,\n getStartDate,\n getCurrentPdt,\n getEnded,\n} from '@mux/playback-core';\nimport type { PlaybackCore, PlaybackEngine, ExtensionMimeTypeMap } from '@mux/playback-core';\nimport { getPlayerVersion } from './env';\n// this must be imported after playback-core for the polyfill to be included\nimport { CustomAudioElement, Events as AudioEvents } from 'custom-media-element';\nimport { HlsConfig } from 'hls.js';\n\n/** @TODO make the relationship between name+value smarter and more deriveable (CJP) */\ntype AttributeNames = {\n ENV_KEY: 'env-key';\n DEBUG: 'debug';\n METADATA_URL: 'metadata-url';\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain';\n DISABLE_COOKIES: 'disable-cookies';\n PLAYBACK_ID: 'playback-id';\n PREFER_PLAYBACK: 'prefer-playback';\n TYPE: 'type';\n STREAM_TYPE: 'stream-type';\n START_TIME: 'start-time';\n};\n\nconst Attributes: AttributeNames = {\n ENV_KEY: 'env-key',\n DEBUG: 'debug',\n PLAYBACK_ID: 'playback-id',\n METADATA_URL: 'metadata-url',\n PREFER_PLAYBACK: 'prefer-playback',\n BEACON_COLLECTION_DOMAIN: 'beacon-collection-domain',\n DISABLE_COOKIES: 'disable-cookies',\n TYPE: 'type',\n STREAM_TYPE: 'stream-type',\n START_TIME: 'start-time',\n};\n\nconst AttributeNameValues = Object.values(Attributes);\n\nconst playerSoftwareVersion = getPlayerVersion();\nconst playerSoftwareName = 'mux-audio';\n\nclass MuxAudioElement extends CustomAudioElement implements Partial<MuxMediaProps> {\n static get observedAttributes() {\n return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];\n }\n\n #core?: PlaybackCore;\n #loadRequested?: Promise<void> | null;\n #playerInitTime: number;\n #metadata: Readonly<Metadata> = {};\n #_hlsConfig?: Partial<HlsConfig>;\n\n constructor() {\n super();\n this.#playerInitTime = generatePlayerInitTime();\n }\n\n get playerInitTime() {\n return this.#playerInitTime;\n }\n\n get playerSoftwareName() {\n return playerSoftwareName;\n }\n\n get playerSoftwareVersion() {\n return playerSoftwareVersion;\n }\n\n // Keeping this named \"_hls\" since it's exposed for unadvertised \"advanced usage\" via getter that assumes specifically hls.js (CJP)\n get _hls(): PlaybackEngine | undefined {\n return this.#core?.engine;\n }\n\n get mux(): Readonly<HTMLAudioElement['mux']> | undefined {\n return this.nativeEl.mux;\n }\n\n get src() {\n // Use the attribute value as the source of truth.\n // No need to store it in two places.\n // This avoids needing a to read the attribute initially and update the src.\n return this.getAttribute('src') as string;\n }\n\n set src(val: string) {\n // If being set by attributeChangedCallback,\n // dont' cause an infinite loop\n if (val === this.src) return;\n\n if (val == null) {\n this.removeAttribute('src');\n } else {\n this.setAttribute('src', val);\n }\n }\n\n get preload() {\n const val = this.getAttribute('preload') as HTMLMediaElement['preload'];\n if (val === '') return 'auto';\n if (['none', 'metadata', 'auto'].includes(val)) return val;\n return super.preload;\n }\n\n set preload(val) {\n // don't cause an infinite loop\n // check the attribute because an empty string maps to the `auto` prop\n if (val == this.getAttribute('preload')) return;\n\n if (['', 'none', 'metadata', 'auto'].includes(val)) {\n this.setAttribute('preload', val);\n } else {\n this.removeAttribute('preload');\n }\n }\n\n get debug(): boolean {\n return this.getAttribute(Attributes.DEBUG) != null;\n }\n\n set debug(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.debug) return;\n\n if (val) {\n this.setAttribute(Attributes.DEBUG, '');\n } else {\n this.removeAttribute(Attributes.DEBUG);\n }\n }\n\n get disableCookies(): boolean {\n return this.hasAttribute(Attributes.DISABLE_COOKIES);\n }\n\n set disableCookies(val: boolean) {\n // dont' cause an infinite loop\n if (val === this.disableCookies) return;\n\n if (val) {\n this.setAttribute(Attributes.DISABLE_COOKIES, '');\n } else {\n this.removeAttribute(Attributes.DISABLE_COOKIES);\n }\n }\n\n get startTime(): number | undefined {\n const val = this.getAttribute(Attributes.START_TIME);\n if (val == null) return undefined;\n const num = +val;\n return !Number.isNaN(num) ? num : undefined;\n }\n\n set startTime(val: number | undefined) {\n // dont' cause an infinite loop\n if (val === this.startTime) return;\n\n if (val == null) {\n this.removeAttribute(Attributes.START_TIME);\n } else {\n this.setAttribute(Attributes.START_TIME, `${val}`);\n }\n }\n\n get playbackId(): string | undefined {\n return this.getAttribute(Attributes.PLAYBACK_ID) ?? undefined;\n }\n\n set playbackId(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.playbackId) return;\n\n if (val) {\n this.setAttribute(Attributes.PLAYBACK_ID, val);\n } else {\n this.removeAttribute(Attributes.PLAYBACK_ID);\n }\n }\n\n get ended() {\n // This ensures that edge case media that doesn't properly end will\n // still announce itself as \"ended\".\n return getEnded(this.nativeEl, this._hls);\n }\n\n get envKey(): string | undefined {\n return this.getAttribute(Attributes.ENV_KEY) ?? undefined;\n }\n\n set envKey(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.envKey) return;\n\n if (val) {\n this.setAttribute(Attributes.ENV_KEY, val);\n } else {\n this.removeAttribute(Attributes.ENV_KEY);\n }\n }\n\n get beaconCollectionDomain(): string | undefined {\n return this.getAttribute(Attributes.BEACON_COLLECTION_DOMAIN) ?? undefined;\n }\n\n set beaconCollectionDomain(val: string | undefined) {\n // dont' cause an infinite loop\n if (val === this.beaconCollectionDomain) return;\n\n if (val) {\n this.setAttribute(Attributes.BEACON_COLLECTION_DOMAIN, val);\n } else {\n this.removeAttribute(Attributes.BEACON_COLLECTION_DOMAIN);\n }\n }\n\n get streamType(): ValueOf<StreamTypes> | undefined {\n // getAttribute doesn't know that this attribute is well defined. Should explore extending for MuxVideo (CJP)\n return (this.getAttribute(Attributes.STREAM_TYPE) as ValueOf<StreamTypes>) ?? undefined;\n }\n\n set streamType(val: ValueOf<StreamTypes> | undefined) {\n // dont' cause an infinite loop\n if (val === this.streamType) return;\n\n if (val) {\n this.setAttribute(Attributes.STREAM_TYPE, val);\n } else {\n this.removeAttribute(Attributes.STREAM_TYPE);\n }\n }\n\n getStartDate() {\n return getStartDate(this.nativeEl, this._hls);\n }\n\n get currentPdt() {\n return getCurrentPdt(this.nativeEl, this._hls);\n }\n\n get preferPlayback(): ValueOf<PlaybackTypes> | undefined {\n const val = this.getAttribute(Attributes.PREFER_PLAYBACK);\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) return val;\n return undefined;\n }\n\n set preferPlayback(val: ValueOf<PlaybackTypes> | undefined) {\n if (val === this.preferPlayback) return;\n\n if (val === PlaybackTypes.MSE || val === PlaybackTypes.NATIVE) {\n this.setAttribute(Attributes.PREFER_PLAYBACK, val);\n } else {\n this.removeAttribute(Attributes.PREFER_PLAYBACK);\n }\n }\n\n get metadata() {\n const inferredMetadataAttrs: { [key: string]: string } = this.getAttributeNames()\n .filter((attrName) => {\n return attrName.startsWith('metadata-') && !([Attributes.METADATA_URL] as string[]).includes(attrName);\n })\n .reduce((currAttrs, attrName) => {\n const value = this.getAttribute(attrName);\n if (value != null) {\n currAttrs[attrName.replace(/^metadata-/, '').replace(/-/g, '_') as string] = value;\n }\n return currAttrs;\n }, {} as { [key: string]: string });\n\n return {\n ...inferredMetadataAttrs,\n ...this.#metadata,\n };\n }\n\n set metadata(val: Readonly<Metadata> | undefined) {\n this.#metadata = val ?? {};\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src.'\n );\n this.mux.emit('hb', this.#metadata);\n }\n }\n\n get _hlsConfig() {\n return this.#_hlsConfig;\n }\n\n set _hlsConfig(val: Readonly<Partial<HlsConfig>> | undefined) {\n this.#_hlsConfig = val;\n }\n\n async #requestLoad() {\n if (this.#loadRequested) return;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.load();\n }\n\n load() {\n this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);\n }\n\n unload() {\n teardown(this.nativeEl, this.#core);\n this.#core = undefined;\n }\n\n attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) {\n // Only forward the attributes to the native media element that are not handled.\n const isNativeAttr = CustomAudioElement.observedAttributes.includes(attrName);\n if (isNativeAttr && !['src', 'autoplay', 'preload'].includes(attrName)) {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n\n switch (attrName) {\n case 'src': {\n const hadSrc = !!oldValue;\n const hasSrc = !!newValue;\n if (!hadSrc && hasSrc) {\n this.#requestLoad();\n } else if (hadSrc && !hasSrc) {\n this.unload();\n /** @TODO Test this thoroughly (async?) and confirm unload() necessary (CJP) */\n } else if (hadSrc && hasSrc) {\n this.unload();\n this.#requestLoad();\n }\n break;\n }\n case 'autoplay':\n if (newValue === oldValue) {\n break;\n }\n /** In case newValue is an empty string or null, use this.autoplay which translates to booleans (WL) */\n this.#core?.setAutoplay(this.autoplay);\n break;\n case 'preload':\n if (newValue === oldValue) {\n break;\n }\n this.#core?.setPreload(newValue as HTMLMediaElement['preload']);\n break;\n case Attributes.PLAYBACK_ID:\n this.src = toMuxVideoURL(this) as string;\n break;\n case Attributes.DEBUG: {\n const debug = this.debug;\n if (!!this.mux) {\n /** @TODO Link to docs for a more detailed discussion (CJP) */\n console.info(\n 'Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src.'\n );\n }\n if (!!this._hls) {\n this._hls.config.debug = debug;\n }\n break;\n }\n case Attributes.METADATA_URL:\n if (newValue) {\n fetch(newValue)\n .then((resp) => resp.json())\n .then((json) => (this.metadata = json))\n .catch(() => console.error(`Unable to load or parse metadata JSON from metadata-url ${newValue}!`));\n }\n break;\n default:\n break;\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback?.();\n if (this.nativeEl && this.src && !this.#core) {\n this.#requestLoad();\n }\n }\n\n disconnectedCallback() {\n this.unload();\n }\n}\n\ntype MuxAudioElementType = typeof MuxAudioElement;\ndeclare global {\n var MuxAudioElement: MuxAudioElementType; // eslint-disable-line\n}\n\nif (!globalThis.customElements.get('mux-audio')) {\n globalThis.customElements.define('mux-audio', MuxAudioElement);\n /** @TODO consider externalizing this (breaks standard modularity) */\n globalThis.MuxAudioElement = MuxAudioElement;\n}\n\nexport { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents };\n\nexport default MuxAudioElement;\n", "/* eslint @typescript-eslint/no-empty-function: \"off\", @typescript-eslint/no-unused-vars: \"off\" */\n\nclass EventTarget {\n addEventListener() {}\n removeEventListener() {}\n dispatchEvent(_event: Event) {\n return true;\n }\n}\n\n// @github/template-parts requires DocumentFragment to be available on globalThis for SSR\nif (typeof DocumentFragment === 'undefined') {\n class DocumentFragment extends EventTarget {}\n // @ts-ignore\n globalThis.DocumentFragment = DocumentFragment;\n}\n\nclass HTMLElement extends EventTarget {}\nclass HTMLVideoElement extends EventTarget {}\n\nconst customElements: CustomElementRegistry = {\n get(_name: string) {\n return undefined;\n },\n define(_name, _constructor, _options) {},\n upgrade(_root) {},\n whenDefined(_name) {\n return Promise.resolve(HTMLElement as unknown as CustomElementConstructor);\n },\n};\n\nclass CustomEvent {\n #detail;\n get detail() {\n return this.#detail;\n }\n constructor(typeArg: string, eventInitDict: CustomEventInit = {}) {\n // super(typeArg, eventInitDict);\n this.#detail = eventInitDict?.detail;\n }\n initCustomEvent() {}\n}\n\nfunction createElement(_tagName: string, _options?: ElementCreationOptions): HTMLElement {\n return new HTMLElement();\n}\n\nconst globalThisShim = {\n document: {\n createElement,\n },\n DocumentFragment,\n customElements,\n CustomEvent,\n EventTarget,\n HTMLElement,\n HTMLVideoElement,\n};\n\n// const isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\n// const GlobalThis = isServer ? globalThisShim : globalThis;\n// const Document = isServer ? globalThisShim.document : globalThis.document;\n//\n// export { GlobalThis as globalThis, Document as document };\nconst isServer = typeof window === 'undefined' || typeof globalThis.customElements === 'undefined';\ntype GlobalThis = typeof globalThis;\nconst internalGlobalThis: GlobalThis = (isServer ? globalThisShim : globalThis) as GlobalThis;\nconst internalDocument: Document = (isServer ? globalThisShim.document : globalThis.document) as Document;\n\nexport { internalGlobalThis as globalThis, internalDocument as document };\n", "export const isMaybeBrowser = () => typeof window != 'undefined';\n// @ts-ignore\nexport const isMaybeServer = () => typeof global != 'undefined';\n\nconst getEnvPlayerVersion = () => {\n try {\n // @ts-ignore\n return PLAYER_VERSION as string;\n } catch {}\n return 'UNKNOWN';\n};\n\nconst player_version: string = getEnvPlayerVersion();\n\nexport const getPlayerVersion = () => player_version;\n", "/**\n * Custom Media Element\n * Based on https://github.com/muxinc/custom-video-element - Mux - MIT License\n *\n * The goal is to create an element that works just like the video element\n * but can be extended/sub-classed, because native elements cannot be\n * extended today across browsers.\n */\n\n// The onevent like props are weirdly set on the HTMLElement prototype with other\n// generic events making it impossible to pick these specific to HTMLMediaElement.\nexport const Events = [\n 'abort',\n 'canplay',\n 'canplaythrough',\n 'durationchange',\n 'emptied',\n 'encrypted',\n 'ended',\n 'error',\n 'loadeddata',\n 'loadedmetadata',\n 'loadstart',\n 'pause',\n 'play',\n 'playing',\n 'progress',\n 'ratechange',\n 'seeked',\n 'seeking',\n 'stalled',\n 'suspend',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n 'waitingforkey',\n 'resize',\n 'enterpictureinpicture',\n 'leavepictureinpicture',\n 'webkitbeginfullscreen',\n 'webkitendfullscreen',\n 'webkitpresentationmodechanged',\n];\n\nexport const audioTemplate = globalThis.document?.createElement('template');\n\nif (audioTemplate) {\n audioTemplate.innerHTML = /*html*/`\n <style>\n :host {\n display: inline-flex;\n line-height: 0;\n flex-direction: column;\n justify-content: end;\n }\n\n audio {\n width: 100%;\n }\n </style>\n <slot name=\"media\"></slot>\n <slot></slot>\n `;\n}\n\n// If the `media` slot is used leave the styling up to the user.\n// It's a more consistent behavior pre and post custom element upgrade.\n\nexport const videoTemplate = globalThis.document?.createElement('template');\n\nif (videoTemplate) {\n videoTemplate.innerHTML = /*html*/`\n <style>\n :host {\n display: inline-block;\n line-height: 0;\n }\n\n video {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n object-fit: var(--media-object-fit, contain);\n object-position: var(--media-object-position, 50% 50%);\n }\n\n video::-webkit-media-text-track-container {\n transform: var(--media-webkit-text-track-transform);\n transition: var(--media-webkit-text-track-transition);\n }\n </style>\n <slot name=\"media\"></slot>\n <slot></slot>\n `;\n}\n\n/**\n * @see https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/\n */\nexport const CustomMediaMixin = (superclass, { tag, is }) => {\n\n // `is` makes it possible to extend a custom built-in. e.g. castable-video\n const nativeElTest = globalThis.document?.createElement(tag, { is });\n const nativeElProps = nativeElTest ? getNativeElProps(nativeElTest) : [];\n\n return class CustomMedia extends superclass {\n static Events = Events;\n static template = tag.endsWith('audio') ? audioTemplate : videoTemplate;\n static #isDefined;\n\n static get observedAttributes() {\n CustomMedia.#define();\n\n // Include any attributes from the custom built-in.\n const natAttrs = nativeElTest?.constructor?.observedAttributes ?? [];\n\n return [\n ...natAttrs,\n 'autopictureinpicture',\n 'disablepictureinpicture',\n 'disableremoteplayback',\n 'autoplay',\n 'controls',\n 'controlslist',\n 'crossorigin',\n 'loop',\n 'muted',\n 'playsinline',\n 'poster',\n 'preload',\n 'src',\n ];\n }\n\n static #define() {\n if (this.#isDefined) return;\n this.#isDefined = true;\n\n const propsToAttrs = new Set(this.observedAttributes);\n // defaultMuted maps to the muted attribute, handled manually below.\n propsToAttrs.delete('muted');\n\n // Passthrough native el functions from the custom el to the native el\n for (let prop of nativeElProps) {\n if (prop in this.prototype) continue;\n\n const type = typeof nativeElTest[prop];\n if (type == 'function') {\n // Function\n this.prototype[prop] = function (...args) {\n this.#init();\n\n const fn = () => {\n if (this.call) return this.call(prop, ...args);\n return this.nativeEl[prop].apply(this.nativeEl, args);\n };\n\n return fn();\n };\n } else {\n // Some properties like src, preload, defaultMuted are handled manually.\n\n // Getter\n let config = {\n get() {\n this.#init();\n\n let attr = prop.toLowerCase();\n if (propsToAttrs.has(attr)) {\n const val = this.getAttribute(attr);\n return val === null ? false : val === '' ? true : val;\n }\n\n return this.get?.(prop) ?? this.nativeEl?.[prop];\n },\n };\n\n if (prop !== prop.toUpperCase()) {\n // Setter (not a CONSTANT)\n config.set = function (val) {\n this.#init();\n\n let attr = prop.toLowerCase();\n if (propsToAttrs.has(attr)) {\n if (val === true || val === false || val == null) {\n this.toggleAttribute(attr, Boolean(val));\n } else {\n this.setAttribute(attr, val);\n }\n return;\n }\n\n if (this.set) {\n this.set(prop, val);\n return;\n }\n\n this.nativeEl[prop] = val;\n };\n }\n\n Object.defineProperty(this.prototype, prop, config);\n }\n }\n }\n\n #isInit;\n #nativeEl;\n #childMap = new Map();\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.append(this.constructor.template.content.cloneNode(true));\n }\n\n // If the custom element is defined before the custom element's HTML is parsed\n // no attributes will be available in the constructor (construction process).\n // Wait until initializing in the attributeChangedCallback or\n // connectedCallback or accessing any properties.\n }\n\n get nativeEl() {\n return this.#nativeEl\n ?? this.shadowRoot.querySelector(tag)\n ?? this.querySelector(':scope > [slot=media]')\n ?? this.querySelector(tag);\n }\n\n set nativeEl(val) {\n this.#nativeEl = val;\n }\n\n get defaultMuted() {\n return this.hasAttribute('muted');\n }\n\n set defaultMuted(val) {\n this.toggleAttribute('muted', Boolean(val));\n }\n\n get src() {\n return this.getAttribute('src');\n }\n\n set src(val) {\n this.setAttribute('src', `${val}`);\n }\n\n get preload() {\n return this.getAttribute('preload') ?? this.nativeEl?.preload;\n }\n\n set preload(val) {\n this.setAttribute('preload', `${val}`);\n }\n\n #init() {\n if (this.#isInit) return;\n this.#isInit = true;\n this.init();\n }\n\n init() {\n // If there is no nativeEl by now, create it.\n if (!this.nativeEl) {\n const nativeEl = document.createElement(tag, { is });\n nativeEl.part = tag;\n const mediaSlot = this.shadowRoot.querySelector('slot[name=\"media\"]');\n mediaSlot.append(nativeEl);\n }\n\n // Neither Chrome or Firefox support setting the muted attribute\n // after using document.createElement.\n // Get around this by setting the muted property manually.\n this.nativeEl.muted = this.hasAttribute('muted');\n\n for (let prop of nativeElProps) {\n this.#upgradeProperty(prop);\n }\n\n this.shadowRoot.addEventListener('slotchange', this);\n\n for (let type of this.constructor.Events) {\n this.shadowRoot.addEventListener?.(type, this, true);\n }\n }\n\n handleEvent(event) {\n\n if (event.type === 'slotchange') {\n this.#syncMediaChildren();\n return;\n }\n\n if (event.target === this.nativeEl) {\n // The video events are dispatched on the CustomMediaElement instance.\n // This makes it possible to add event listeners before the element is upgraded.\n this.dispatchEvent(new CustomEvent(event.type, { detail: event.detail }));\n }\n }\n\n /**\n * Keep some native child elements like track and source in sync.\n * An unnamed <slot> will be filled with all of the custom element's\n * top-level child nodes that do not have the slot attribute.\n */\n #syncMediaChildren() {\n const removeNativeChildren = new Map(this.#childMap);\n\n this.shadowRoot.querySelector('slot:not([name])')\n .assignedElements()\n .filter((el) => ['track', 'source'].includes(el.localName))\n .forEach((el) => {\n // If the source or track is still in the assigned elements keep it.\n removeNativeChildren.delete(el);\n // Re-use clones if possible.\n let clone = this.#childMap.get(el);\n if (!clone) {\n clone = el.cloneNode();\n this.#childMap.set(el, clone);\n }\n this.nativeEl.append?.(clone);\n });\n\n removeNativeChildren.forEach((el) => el.remove());\n }\n\n #upgradeProperty(prop) {\n // Sets properties that are set before the custom element is upgraded.\n // https://web.dev/custom-elements-best-practices/#make-properties-lazy\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n // Delete the set property from this instance.\n delete this[prop];\n // Set the value again via the (prototype) setter on this class.\n this[prop] = value;\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n // Initialize right after construction when the attributes become available.\n this.#init();\n this.#forwardAttribute(attrName, oldValue, newValue);\n }\n\n #forwardAttribute(attrName, oldValue, newValue) {\n // Ignore a few that don't need to be passed.\n if (['id', 'class'].includes(attrName)) {\n return;\n }\n\n // Ignore setting custom attributes from the child class.\n // They should not have any effect on the native element, it adds noise in the DOM.\n if (!CustomMedia.observedAttributes.includes(attrName)\n && this.constructor.observedAttributes.includes(attrName)\n ) {\n return;\n }\n\n if (newValue === null) {\n this.nativeEl.removeAttribute?.(attrName);\n } else {\n if (this.nativeEl.getAttribute?.(attrName) != newValue) {\n this.nativeEl.setAttribute?.(attrName, newValue);\n }\n }\n }\n\n connectedCallback() {\n this.#init();\n }\n };\n};\n\nfunction getNativeElProps(nativeElTest) {\n // Map all native element properties to the custom element\n // so that they're applied to the native element.\n // Skipping HTMLElement because of things like \"attachShadow\"\n // causing issues. Most of those props still need to apply to\n // the custom element.\n let nativeElProps = [];\n\n // Walk the prototype chain up to HTMLElement.\n // This will grab all super class props in between.\n // i.e. VideoElement and MediaElement\n for (\n let proto = Object.getPrototypeOf(nativeElTest);\n proto && proto !== HTMLElement.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n nativeElProps.push(...Object.getOwnPropertyNames(proto));\n }\n\n return nativeElProps;\n}\n\nexport const CustomVideoElement = globalThis.document ? CustomMediaMixin(HTMLElement, { tag: 'video' }) : class {};\n\nexport const CustomAudioElement = globalThis.document ? CustomMediaMixin(HTMLElement, { tag: 'audio' }) : class {};\n"],
5
+ "mappings": "k8BAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,wCAAAC,KAAA,eAAAC,GAAAJ,ICEA,IAAMK,EAAN,KAAkB,CAChB,kBAAmB,CAAC,CACpB,qBAAsB,CAAC,CACvB,cAAcC,EAAe,CAC3B,MAAO,EACT,CACF,EAGA,GAAI,OAAO,kBAAqB,YAAa,CAC3C,MAAMC,UAAyBF,CAAY,CAAC,CAE5C,WAAW,iBAAmBE,CAChC,CAEA,IAAMC,EAAN,cAA0BH,CAAY,CAAC,EACjCI,EAAN,cAA+BJ,CAAY,CAAC,EAEtCK,GAAwC,CAC5C,IAAIC,EAAe,CAEnB,EACA,OAAOA,EAAOC,EAAcC,EAAU,CAAC,EACvC,QAAQC,EAAO,CAAC,EAChB,YAAYH,EAAO,CACjB,OAAO,QAAQ,QAAQH,CAAkD,CAC3E,CACF,EA7BAO,EA+BMC,EAAN,KAAkB,CAKhB,YAAYC,EAAiBC,EAAiC,CAAC,EAAG,CAJlEC,EAAA,KAAAJ,EAAA,QAMEK,EAAA,KAAKL,EAAUG,GAAA,YAAAA,EAAe,OAChC,CANA,IAAI,QAAS,CACX,OAAOG,EAAA,KAAKN,EACd,CAKA,iBAAkB,CAAC,CACrB,EATEA,EAAA,YAWF,SAASO,GAAcC,EAAkBV,EAAgD,CACvF,OAAO,IAAIL,CACb,CAEA,IAAMgB,GAAiB,CACrB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B,KACF,CACA,KAAK7B,EAAW,aACVwB,GACF,MAAMA,CAAQ,EACX,KAAMM,GAASA,EAAK,KAAK,CAAC,EAC1B,KAAMC,GAAU,KAAK,SAAWA,CAAK,EACrC,MAAM,IAAM,QAAQ,MAAM,2DAA2DP,CAAQ,GAAG,CAAC,EAEtG,MACF,QACE,KACJ,CACF,CAEA,mBAA0B,CAlY5B,IAAAR,GAmYIA,EAAA,MAAM,oBAAN,MAAAA,EAAA,WACI,KAAK,UAAY,KAAK,KAAO,CAACC,EAAA,KAAKZ,IACrCuB,EAAA,KAAKlB,EAAAC,GAAL,UAEJ,CAEA,sBAAuB,CACrB,KAAK,OAAO,CACd,CACF,EAjVEN,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YACAC,EAAA,YAmPMC,EAAA,YAAAC,EAAY,gBAAG,CACfM,EAAA,KAAKX,KACT,MAAOS,EAAA,KAAKT,EAAiB,QAAQ,QAAQ,GAC7CS,EAAA,KAAKT,EAAiB,MACtB,KAAK,KAAK,EACZ,EA4FG0B,EAAW,eAAe,IAAI,WAAW,IAC5CA,EAAW,eAAe,OAAO,YAAapB,CAAe,EAE7DoB,EAAW,gBAAkBpB,GAK/B,IAAOqB,GAAQC",
6
+ "names": ["src_exports", "__export", "Events", "src_default", "__toCommonJS", "EventTarget", "_event", "DocumentFragment", "HTMLElement", "HTMLVideoElement", "customElements", "_name", "_constructor", "_options", "_root", "_detail", "CustomEvent", "typeArg", "eventInitDict", "__privateAdd", "__privateSet", "__privateGet", "createElement", "_tagName", "globalThisShim", "isServer", "internalGlobalThis", "internalDocument", "import_playback_core", "getEnvPlayerVersion", "player_version", "getPlayerVersion", "Events", "_a", "audioTemplate", "videoTemplate", "CustomMediaMixin", "superclass", "tag", "is", "_b", "_isDefined", "_define", "define_fn", "_isInit", "_nativeEl", "_childMap", "_init", "init_fn", "_syncMediaChildren", "syncMediaChildren_fn", "_upgradeProperty", "upgradeProperty_fn", "_forwardAttribute", "forwardAttribute_fn", "nativeElTest", "nativeElProps", "getNativeElProps", "__privateAdd", "_c", "__privateMethod", "__privateGet", "val", "__privateSet", "nativeEl", "prop", "type", "event", "attrName", "oldValue", "newValue", "propsToAttrs", "args", "config", "attr", "removeNativeChildren", "el", "clone", "value", "_d", "_e", "_f", "__publicField", "proto", "CustomVideoElement", "CustomAudioElement", "Attributes", "AttributeNameValues", "playerSoftwareVersion", "getPlayerVersion", "playerSoftwareName", "_core", "_loadRequested", "_playerInitTime", "_metadata", "__hlsConfig", "_requestLoad", "requestLoad_fn", "MuxAudioElement", "CustomAudioElement", "__privateAdd", "__privateSet", "_a", "__privateGet", "val", "num", "attrName", "currAttrs", "value", "oldValue", "newValue", "_b", "hadSrc", "hasSrc", "__privateMethod", "debug", "resp", "json", "internalGlobalThis", "src_default", "MuxAudioElement"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var at=Object.defineProperty;var ot=(s,e,t)=>e in s?at(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var V=(s,e,t)=>(ot(s,typeof e!="symbol"?e+"":e,t),t),F=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var u=(s,e,t)=>(F(s,e,"read from private field"),t?t.call(s):e.get(s)),d=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},f=(s,e,t,o)=>(F(s,e,"write to private field"),o?o.call(s,t):e.set(s,t),t);var b=(s,e,t)=>(F(s,e,"access private method"),t);var k=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class s extends k{}globalThis.DocumentFragment=s}var R=class extends k{},q=class extends k{},lt={get(s){},define(s,e,t){},upgrade(s){},whenDefined(s){return Promise.resolve(R)}},I,$=class{constructor(e,t={}){d(this,I,void 0);f(this,I,t==null?void 0:t.detail)}get detail(){return u(this,I)}initCustomEvent(){}};I=new WeakMap;function ut(s,e){return new R}var J={document:{createElement:ut},DocumentFragment,customElements:lt,CustomEvent:$,EventTarget:k,HTMLElement:R,HTMLVideoElement:q},Q=typeof window=="undefined"||typeof globalThis.customElements=="undefined",Y=Q?J:globalThis,kt=Q?J.document:globalThis.document;import{initialize as mt,teardown as pt,generatePlayerInitTime as ft,PlaybackTypes as j,toMuxVideoURL as bt,MediaError as Ut,getStartDate as gt,getCurrentPdt as Et,getEnded as At}from"@mux/playback-core";var dt=()=>{try{return"0.11.1"}catch{}return"UNKNOWN"},ct=dt(),X=()=>ct;var et=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Z,z=(Z=globalThis.document)==null?void 0:Z.createElement("template");z&&(z.innerHTML=`
1
+ var ut=Object.defineProperty;var dt=(r,s,t)=>s in r?ut(r,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[s]=t;var q=(r,s,t)=>(dt(r,typeof s!="symbol"?s+"":s,t),t),$=(r,s,t)=>{if(!s.has(r))throw TypeError("Cannot "+t)};var l=(r,s,t)=>($(r,s,"read from private field"),t?t.call(r):s.get(r)),u=(r,s,t)=>{if(s.has(r))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(r):s.set(r,t)},p=(r,s,t,a)=>($(r,s,"write to private field"),a?a.call(r,t):s.set(r,t),t);var b=(r,s,t)=>($(r,s,"access private method"),t);var v=class{addEventListener(){}removeEventListener(){}dispatchEvent(s){return!0}};if(typeof DocumentFragment=="undefined"){class r extends v{}globalThis.DocumentFragment=r}var I=class extends v{},z=class extends v{},ct={get(r){},define(r,s,t){},upgrade(r){},whenDefined(r){return Promise.resolve(I)}},D,W=class{constructor(s,t={}){u(this,D,void 0);p(this,D,t==null?void 0:t.detail)}get detail(){return l(this,D)}initCustomEvent(){}};D=new WeakMap;function ht(r,s){return new I}var X={document:{createElement:ht},DocumentFragment,customElements:ct,CustomEvent:W,EventTarget:v,HTMLElement:I,HTMLVideoElement:z},Z=typeof window=="undefined"||typeof globalThis.customElements=="undefined",j=Z?X:globalThis,Ot=Z?X.document:globalThis.document;import{initialize as ft,teardown as gt,generatePlayerInitTime as Et,PlaybackTypes as G,toMuxVideoURL as At,MediaError as Gt,getStartDate as yt,getCurrentPdt as Tt,getEnded as Ct}from"@mux/playback-core";var mt=()=>{try{return"0.11.2"}catch{}return"UNKNOWN"},pt=mt(),tt=()=>pt;var st=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],et,J=(et=globalThis.document)==null?void 0:et.createElement("template");J&&(J.innerHTML=`
2
2
  <style>
3
3
  :host {
4
4
  display: inline-flex;
@@ -13,7 +13,7 @@ var at=Object.defineProperty;var ot=(s,e,t)=>e in s?at(s,e,{enumerable:!0,config
13
13
  </style>
14
14
  <slot name="media"></slot>
15
15
  <slot></slot>
16
- `);var tt,W=(tt=globalThis.document)==null?void 0:tt.createElement("template");W&&(W.innerHTML=`
16
+ `);var it,Q=(it=globalThis.document)==null?void 0:it.createElement("template");Q&&(Q.innerHTML=`
17
17
  <style>
18
18
  :host {
19
19
  display: inline-block;
@@ -36,5 +36,5 @@ var at=Object.defineProperty;var ot=(s,e,t)=>e in s?at(s,e,{enumerable:!0,config
36
36
  </style>
37
37
  <slot name="media"></slot>
38
38
  <slot></slot>
39
- `);var it=(s,{tag:e,is:t})=>{var M,g,T,m,st,L,S,C,v,B,rt,K,nt;let o=(M=globalThis.document)==null?void 0:M.createElement(e,{is:t}),h=o?ht(o):[];return g=class extends s{constructor(){super();d(this,C);d(this,B);d(this,K);d(this,L,void 0);d(this,S,void 0);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var r,c,p;return b(r=g,m,st).call(r),[...(p=(c=o==null?void 0:o.constructor)==null?void 0:c.observedAttributes)!=null?p:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var i,r,c;return(c=(r=(i=u(this,S))!=null?i:this.shadowRoot.querySelector(e))!=null?r:this.querySelector(":scope > slot[slot=media]"))!=null?c:this.querySelector(e)}set nativeEl(i){f(this,S,i)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(i){this.toggleAttribute("muted",!!i)}get src(){return this.getAttribute("src")}set src(i){this.setAttribute("src",`${i}`)}get preload(){var i,r;return(r=this.getAttribute("preload"))!=null?r:(i=this.nativeEl)==null?void 0:i.preload}set preload(i){this.setAttribute("preload",`${i}`)}handleEvent(i){i.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}attributeChangedCallback(i,r,c){b(this,C,v).call(this),b(this,K,nt).call(this,i,r,c)}connectedCallback(){b(this,C,v).call(this)}},T=new WeakMap,m=new WeakSet,st=function(){if(u(this,T))return;f(this,T,!0);let i=new Set(this.observedAttributes);i.delete("muted");for(let r of h){if(r in this.prototype)continue;if(typeof o[r]=="function")this.prototype[r]=function(...p){return b(this,C,v).call(this),this.call?this.call(r,...p):this.nativeEl[r].apply(this.nativeEl,p)};else{let p={get(){var l,A,_;b(this,C,v).call(this);let a=r.toLowerCase();if(i.has(a)){let y=this.getAttribute(a);return y===null?!1:y===""?!0:y}return(_=(l=this.get)==null?void 0:l.call(this,r))!=null?_:(A=this.nativeEl)==null?void 0:A[r]}};r!==r.toUpperCase()&&(p.set=function(a){b(this,C,v).call(this);let l=r.toLowerCase();if(i.has(l)){a===!0||a===!1||a==null?this.toggleAttribute(l,!!a):this.setAttribute(l,a);return}if(this.set){this.set(r,a);return}this.nativeEl[r]=a}),Object.defineProperty(this.prototype,r,p)}}},L=new WeakMap,S=new WeakMap,C=new WeakSet,v=function(){var c,p;if(u(this,L))return;if(f(this,L,!0),!this.nativeEl){let a=document.createElement(e,{is:t});a.part=e,this.shadowRoot.append(a)}this.nativeEl.muted=this.hasAttribute("muted");for(let a of h)b(this,B,rt).call(this,a);let i=new Map,r=this.shadowRoot.querySelector("slot:not([name])");r==null||r.addEventListener("slotchange",()=>{let a=new Map(i);r.assignedElements().filter(l=>["track","source"].includes(l.localName)).forEach(l=>{var _,y;a.delete(l);let A=i.get(l);A||(A=l.cloneNode(),i.set(l,A)),(y=(_=this.nativeEl).append)==null||y.call(_,A)}),a.forEach(l=>l.remove())});for(let a of this.constructor.Events)(p=(c=this.shadowRoot).addEventListener)==null||p.call(c,a,this,!0)},B=new WeakSet,rt=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){let r=this[i];delete this[i],this[i]=r}},K=new WeakSet,nt=function(i,r,c){var p,a,l,A,_,y;["id","class"].includes(i)||(c===null?(a=(p=this.nativeEl).removeAttribute)==null||a.call(p,i):((A=(l=this.nativeEl).getAttribute)==null?void 0:A.call(l,i))!=c&&((y=(_=this.nativeEl).setAttribute)==null||y.call(_,i,c)))},d(g,m),V(g,"Events",et),V(g,"template",e.endsWith("audio")?z:W),d(g,T,void 0),g};function ht(s){let e=[];for(let t=Object.getPrototypeOf(s);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}var xt=globalThis.document?it(HTMLElement,{tag:"video"}):class{},U=globalThis.document?it(HTMLElement,{tag:"audio"}):class{};var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},yt=Object.values(n),Tt=X(),Ct="mux-audio",E,P,D,O,w,x,H,N=class extends U{constructor(){super();d(this,x);d(this,E,void 0);d(this,P,void 0);d(this,D,void 0);d(this,O,{});d(this,w,void 0);f(this,D,ft())}static get observedAttributes(){var t;return[...yt,...(t=U.observedAttributes)!=null?t:[]]}get playerInitTime(){return u(this,D)}get playerSoftwareName(){return Ct}get playerSoftwareVersion(){return Tt}get _hls(){var t;return(t=u(this,E))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(n.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(n.DEBUG,""):this.removeAttribute(n.DEBUG))}get disableCookies(){return this.hasAttribute(n.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(n.DISABLE_COOKIES,""):this.removeAttribute(n.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(n.START_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(n.START_TIME):this.setAttribute(n.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(n.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(n.PLAYBACK_ID,t):this.removeAttribute(n.PLAYBACK_ID))}get ended(){return At(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(n.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(n.ENV_KEY,t):this.removeAttribute(n.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(n.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(n.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(n.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(n.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(n.STREAM_TYPE,t):this.removeAttribute(n.STREAM_TYPE))}getStartDate(){return gt(this.nativeEl,this._hls)}get currentPdt(){return Et(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(n.PREFER_PLAYBACK);if(t===j.MSE||t===j.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===j.MSE||t===j.NATIVE?this.setAttribute(n.PREFER_PLAYBACK,t):this.removeAttribute(n.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(o=>o.startsWith("metadata-")&&![n.METADATA_URL].includes(o)).reduce((o,h)=>{let M=this.getAttribute(h);return M!=null&&(o[h.replace(/^metadata-/,"").replace(/-/g,"_")]=M),o},{}),...u(this,O)}}set metadata(t){f(this,O,t!=null?t:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",u(this,O)))}get _hlsConfig(){return u(this,w)}set _hlsConfig(t){f(this,w,t)}load(){f(this,E,mt(this,this.nativeEl,u(this,E)))}unload(){pt(this.nativeEl,u(this,E)),f(this,E,void 0)}attributeChangedCallback(t,o,h){var g,T;switch(U.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,o,h),t){case"src":{let m=!!o,G=!!h;!m&&G?b(this,x,H).call(this):m&&!G?this.unload():m&&G&&(this.unload(),b(this,x,H).call(this));break}case"autoplay":if(h===o)break;(g=u(this,E))==null||g.setAutoplay(this.autoplay);break;case"preload":if(h===o)break;(T=u(this,E))==null||T.setPreload(h);break;case n.PLAYBACK_ID:this.src=bt(this);break;case n.DEBUG:{let m=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=m);break}case n.METADATA_URL:h&&fetch(h).then(m=>m.json()).then(m=>this.metadata=m).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${h}!`));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!u(this,E)&&b(this,x,H).call(this)}disconnectedCallback(){this.unload()}};E=new WeakMap,P=new WeakMap,D=new WeakMap,O=new WeakMap,w=new WeakMap,x=new WeakSet,H=async function(){u(this,P)||(await f(this,P,Promise.resolve()),f(this,P,null),this.load())};Y.customElements.get("mux-audio")||(Y.customElements.define("mux-audio",N),Y.MuxAudioElement=N);var Gt=N;export{et as AudioEvents,Ut as MediaError,Gt as default};
39
+ `);var rt=(r,{tag:s,is:t})=>{var T,f,A,m,nt,S,x,C,y,_,K,ot,Y,at,U,lt;let a=(T=globalThis.document)==null?void 0:T.createElement(s,{is:t}),h=a?bt(a):[];return f=class extends r{constructor(){super();u(this,y);u(this,K);u(this,Y);u(this,U);u(this,S,void 0);u(this,x,void 0);u(this,C,new Map);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0)))}static get observedAttributes(){var i,o,c;return b(i=f,m,nt).call(i),[...(c=(o=a==null?void 0:a.constructor)==null?void 0:o.observedAttributes)!=null?c:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var e,i,o;return(o=(i=(e=l(this,x))!=null?e:this.shadowRoot.querySelector(s))!=null?i:this.querySelector(":scope > [slot=media]"))!=null?o:this.querySelector(s)}set nativeEl(e){p(this,x,e)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",!!e)}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src",`${e}`)}get preload(){var e,i;return(i=this.getAttribute("preload"))!=null?i:(e=this.nativeEl)==null?void 0:e.preload}set preload(e){this.setAttribute("preload",`${e}`)}init(){var e,i;if(!this.nativeEl){let o=document.createElement(s,{is:t});o.part=s,this.shadowRoot.querySelector('slot[name="media"]').append(o)}this.nativeEl.muted=this.hasAttribute("muted");for(let o of h)b(this,Y,at).call(this,o);this.shadowRoot.addEventListener("slotchange",this);for(let o of this.constructor.Events)(i=(e=this.shadowRoot).addEventListener)==null||i.call(e,o,this,!0)}handleEvent(e){if(e.type==="slotchange"){b(this,K,ot).call(this);return}e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))}attributeChangedCallback(e,i,o){b(this,y,_).call(this),b(this,U,lt).call(this,e,i,o)}connectedCallback(){b(this,y,_).call(this)}},A=new WeakMap,m=new WeakSet,nt=function(){if(l(this,A))return;p(this,A,!0);let e=new Set(this.observedAttributes);e.delete("muted");for(let i of h){if(i in this.prototype)continue;if(typeof a[i]=="function")this.prototype[i]=function(...c){return b(this,y,_).call(this),this.call?this.call(i,...c):this.nativeEl[i].apply(this.nativeEl,c)};else{let c={get(){var E,L,R;b(this,y,_).call(this);let d=i.toLowerCase();if(e.has(d)){let M=this.getAttribute(d);return M===null?!1:M===""?!0:M}return(R=(E=this.get)==null?void 0:E.call(this,i))!=null?R:(L=this.nativeEl)==null?void 0:L[i]}};i!==i.toUpperCase()&&(c.set=function(d){b(this,y,_).call(this);let E=i.toLowerCase();if(e.has(E)){d===!0||d===!1||d==null?this.toggleAttribute(E,!!d):this.setAttribute(E,d);return}if(this.set){this.set(i,d);return}this.nativeEl[i]=d}),Object.defineProperty(this.prototype,i,c)}}},S=new WeakMap,x=new WeakMap,C=new WeakMap,y=new WeakSet,_=function(){l(this,S)||(p(this,S,!0),this.init())},K=new WeakSet,ot=function(){let e=new Map(l(this,C));this.shadowRoot.querySelector("slot:not([name])").assignedElements().filter(i=>["track","source"].includes(i.localName)).forEach(i=>{var c,d;e.delete(i);let o=l(this,C).get(i);o||(o=i.cloneNode(),l(this,C).set(i,o)),(d=(c=this.nativeEl).append)==null||d.call(c,o)}),e.forEach(i=>i.remove())},Y=new WeakSet,at=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){let i=this[e];delete this[e],this[e]=i}},U=new WeakSet,lt=function(e,i,o){var c,d,E,L,R,M;["id","class"].includes(e)||!f.observedAttributes.includes(e)&&this.constructor.observedAttributes.includes(e)||(o===null?(d=(c=this.nativeEl).removeAttribute)==null||d.call(c,e):((L=(E=this.nativeEl).getAttribute)==null?void 0:L.call(E,e))!=o&&((M=(R=this.nativeEl).setAttribute)==null||M.call(R,e,o)))},u(f,m),q(f,"Events",st),q(f,"template",s.endsWith("audio")?J:Q),u(f,A,void 0),f};function bt(r){let s=[];for(let t=Object.getPrototypeOf(r);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))s.push(...Object.getOwnPropertyNames(t));return s}var Rt=globalThis.document?rt(HTMLElement,{tag:"video"}):class{},H=globalThis.document?rt(HTMLElement,{tag:"audio"}):class{};var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Mt=Object.values(n),vt=tt(),_t="mux-audio",g,k,w,P,B,O,V,N=class extends H{constructor(){super();u(this,O);u(this,g,void 0);u(this,k,void 0);u(this,w,void 0);u(this,P,{});u(this,B,void 0);p(this,w,Et())}static get observedAttributes(){var t;return[...Mt,...(t=H.observedAttributes)!=null?t:[]]}get playerInitTime(){return l(this,w)}get playerSoftwareName(){return _t}get playerSoftwareVersion(){return vt}get _hls(){var t;return(t=l(this,g))==null?void 0:t.engine}get mux(){return this.nativeEl.mux}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get preload(){let t=this.getAttribute("preload");return t===""?"auto":["none","metadata","auto"].includes(t)?t:super.preload}set preload(t){t!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(t)?this.setAttribute("preload",t):this.removeAttribute("preload"))}get debug(){return this.getAttribute(n.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(n.DEBUG,""):this.removeAttribute(n.DEBUG))}get disableCookies(){return this.hasAttribute(n.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(n.DISABLE_COOKIES,""):this.removeAttribute(n.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(n.START_TIME);if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(n.START_TIME):this.setAttribute(n.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(n.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(n.PLAYBACK_ID,t):this.removeAttribute(n.PLAYBACK_ID))}get ended(){return Ct(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(n.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(n.ENV_KEY,t):this.removeAttribute(n.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(n.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(n.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(n.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(n.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(n.STREAM_TYPE,t):this.removeAttribute(n.STREAM_TYPE))}getStartDate(){return yt(this.nativeEl,this._hls)}get currentPdt(){return Tt(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(n.PREFER_PLAYBACK);if(t===G.MSE||t===G.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===G.MSE||t===G.NATIVE?this.setAttribute(n.PREFER_PLAYBACK,t):this.removeAttribute(n.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(a=>a.startsWith("metadata-")&&![n.METADATA_URL].includes(a)).reduce((a,h)=>{let T=this.getAttribute(h);return T!=null&&(a[h.replace(/^metadata-/,"").replace(/-/g,"_")]=T),a},{}),...l(this,P)}}set metadata(t){p(this,P,t!=null?t:{}),this.mux&&(console.info("Some metadata values may not be overridable at this time. Make sure you set all metadata to override before setting the src."),this.mux.emit("hb",l(this,P)))}get _hlsConfig(){return l(this,B)}set _hlsConfig(t){p(this,B,t)}load(){p(this,g,ft(this,this.nativeEl,l(this,g)))}unload(){gt(this.nativeEl,l(this,g)),p(this,g,void 0)}attributeChangedCallback(t,a,h){var f,A;switch(H.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,a,h),t){case"src":{let m=!!a,F=!!h;!m&&F?b(this,O,V).call(this):m&&!F?this.unload():m&&F&&(this.unload(),b(this,O,V).call(this));break}case"autoplay":if(h===a)break;(f=l(this,g))==null||f.setAutoplay(this.autoplay);break;case"preload":if(h===a)break;(A=l(this,g))==null||A.setPreload(h);break;case n.PLAYBACK_ID:this.src=At(this);break;case n.DEBUG:{let m=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=m);break}case n.METADATA_URL:h&&fetch(h).then(m=>m.json()).then(m=>this.metadata=m).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${h}!`));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!l(this,g)&&b(this,O,V).call(this)}disconnectedCallback(){this.unload()}};g=new WeakMap,k=new WeakMap,w=new WeakMap,P=new WeakMap,B=new WeakMap,O=new WeakSet,V=async function(){l(this,k)||(await p(this,k,Promise.resolve()),p(this,k,null),this.load())};j.customElements.get("mux-audio")||(j.customElements.define("mux-audio",N),j.MuxAudioElement=N);var qt=N;export{st as AudioEvents,Gt as MediaError,qt as default};
40
40
  //# sourceMappingURL=index.mjs.map