@mux/mux-audio
Advanced tools
Comparing version 0.13.3 to 0.13.4
@@ -1,2 +0,2 @@ | ||
"use strict";var U=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var ht=(i,e,t)=>e in i?U(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var mt=(i,e)=>{for(var t in e)U(i,t,{get:e[t],enumerable:!0})},ft=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of dt(e))!ct.call(i,d)&&d!==t&&U(i,d,{get:()=>e[d],enumerable:!(o=lt(e,d))||o.enumerable});return i};var bt=i=>ft(U({},"__esModule",{value:!0}),i);var $=(i,e,t)=>(ht(i,typeof e!="symbol"?e+"":e,t),t),z=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var u=(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)},g=(i,e,t,o)=>(z(i,e,"write to private field"),o?o.call(i,t):e.set(i,t),t);var m=(i,e,t)=>(z(i,e,"access private method"),t);var Rt={};mt(Rt,{Attributes:()=>n,AudioEvents:()=>X,MediaError:()=>l.MediaError,default:()=>Pt});module.exports=bt(Rt);var v=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment=="undefined"){class i extends v{}globalThis.DocumentFragment=i}var w=class extends v{},W=class extends v{},pt={get(i){},define(i,e,t){},upgrade(i){},whenDefined(i){return Promise.resolve(w)}},B,J=class{constructor(e,t={}){c(this,B,void 0);g(this,B,t==null?void 0:t.detail)}get detail(){return u(this,B)}initCustomEvent(){}};B=new WeakMap;function gt(i,e){return new w}var Z={document:{createElement:gt},DocumentFragment,customElements:pt,CustomEvent:J,EventTarget:v,HTMLElement:w,HTMLVideoElement:W},tt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",V=tt?Z:globalThis,It=tt?Z.document:globalThis.document;var l=require("@mux/playback-core");var At=()=>{try{return"0.13.3"}catch{}return"UNKNOWN"},Et=At(),et=()=>Et;var X=["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"];function yt(i){return` | ||
"use strict";var U=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var ht=(e,i,t)=>i in e?U(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var mt=(e,i)=>{for(var t in i)U(e,t,{get:i[t],enumerable:!0})},ft=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of dt(i))!ct.call(e,d)&&d!==t&&U(e,d,{get:()=>i[d],enumerable:!(o=lt(i,d))||o.enumerable});return e};var bt=e=>ft(U({},"__esModule",{value:!0}),e);var $=(e,i,t)=>(ht(e,typeof i!="symbol"?i+"":i,t),t),z=(e,i,t)=>{if(!i.has(e))throw TypeError("Cannot "+t)};var u=(e,i,t)=>(z(e,i,"read from private field"),t?t.call(e):i.get(e)),c=(e,i,t)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,t)},g=(e,i,t,o)=>(z(e,i,"write to private field"),o?o.call(e,t):i.set(e,t),t);var m=(e,i,t)=>(z(e,i,"access private method"),t);var Rt={};mt(Rt,{Attributes:()=>n,AudioEvents:()=>X,MediaError:()=>l.MediaError,default:()=>Pt});module.exports=bt(Rt);var v=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class e extends v{}globalThis.DocumentFragment=e}var w=class extends v{},W=class extends v{},pt={get(e){},define(e,i,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(w)}},B,J=class{constructor(i,t={}){c(this,B,void 0);g(this,B,t==null?void 0:t.detail)}get detail(){return u(this,B)}initCustomEvent(){}};B=new WeakMap;function gt(e,i){return new w}var Z={document:{createElement:gt},DocumentFragment,customElements:pt,CustomEvent:J,EventTarget:v,HTMLElement:w,HTMLVideoElement:W},tt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",V=tt?Z:globalThis,It=tt?Z.document:globalThis.document;var l=require("@mux/playback-core");var At=()=>{try{return"0.13.4"}catch{}return"UNKNOWN"},Et=At(),et=()=>Et;var X=["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"];function yt(e){return` | ||
<style> | ||
@@ -15,6 +15,6 @@ :host { | ||
<slot name="media"> | ||
<audio${ut(i)}></audio> | ||
<audio${ut(e)}></audio> | ||
</slot> | ||
<slot></slot> | ||
`}function Tt(i){return` | ||
`}function Tt(e){return` | ||
<style> | ||
@@ -41,6 +41,6 @@ :host { | ||
<slot name="media"> | ||
<video${ut(i)}></video> | ||
<video${ut(e)}></video> | ||
</slot> | ||
<slot></slot> | ||
`}var rt=(i,{tag:e,is:t})=>{var T,S,b,f,M,nt,I,L,C,E,_,x,Q,j,ot,H,at;let o=(S=(T=globalThis.document)==null?void 0:T.createElement)==null?void 0:S.call(T,e,{is:t}),d=o?Mt(o):[];return b=class extends i{constructor(){super();c(this,E);c(this,x);c(this,j);c(this,H);c(this,I,void 0);c(this,L,void 0);c(this,C,new Map)}static get observedAttributes(){var r,a,p;return m(r=b,M,nt).call(r),[...(p=(a=o==null?void 0:o.constructor)==null?void 0:a.observedAttributes)!=null?p:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var s,r,a;return m(this,E,_).call(this),(a=(r=(s=u(this,L))!=null?s:this.shadowRoot.querySelector(e))!=null?r:this.querySelector(":scope > [slot=media]"))!=null?a:this.querySelector(e)}set nativeEl(s){g(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.shadowRoot){this.attachShadow({mode:"open"});let a=_t(this.attributes);t&&(a.is=t),e&&(a.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(a)}this.nativeEl.muted=this.hasAttribute("muted");for(let a of d)m(this,j,ot).call(this,a);this.shadowRoot.addEventListener("slotchange",this),m(this,x,Q).call(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"){m(this,x,Q).call(this);return}s.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(s.type,{detail:s.detail}))}attributeChangedCallback(s,r,a){m(this,E,_).call(this),m(this,H,at).call(this,s,r,a)}connectedCallback(){m(this,E,_).call(this)}},f=new WeakMap,M=new WeakSet,nt=function(){if(u(this,f))return;g(this,f,!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(...p){return m(this,E,_).call(this),this.call?this.call(r,...p):this.nativeEl[r].apply(this.nativeEl,p)};else{let p={get(){var y,N,D;m(this,E,_).call(this);let h=r.toLowerCase();if(s.has(h)){let k=this.getAttribute(h);return k===null?!1:k===""?!0:k}return(D=(y=this.get)==null?void 0:y.call(this,r))!=null?D:(N=this.nativeEl)==null?void 0:N[r]}};r!==r.toUpperCase()&&(p.set=function(h){m(this,E,_).call(this);let y=r.toLowerCase();if(s.has(y)){h===!0||h===!1||h==null?this.toggleAttribute(y,!!h):this.setAttribute(y,h);return}if(this.set){this.set(r,h);return}this.nativeEl[r]=h}),Object.defineProperty(this.prototype,r,p)}}},I=new WeakMap,L=new WeakMap,C=new WeakMap,E=new WeakSet,_=function(){u(this,I)||(g(this,I,!0),this.init())},x=new WeakSet,Q=function(){let s=new Map(u(this,C));this.shadowRoot.querySelector("slot:not([name])").assignedElements({flatten:!0}).filter(r=>["track","source"].includes(r.localName)).forEach(r=>{var p,h;s.delete(r);let a=u(this,C).get(r);a||(a=r.cloneNode(),u(this,C).set(r,a)),(h=(p=this.nativeEl).append)==null||h.call(p,a),a.localName==="track"&&a.default&&(a.kind==="chapters"||a.kind==="metadata")&&a.track.mode==="disabled"&&(a.track.mode="hidden")}),s.forEach(r=>r.remove())},j=new WeakSet,ot=function(s){if(Object.prototype.hasOwnProperty.call(this,s)){let r=this[s];delete this[s],this[s]=r}},H=new WeakSet,at=function(s,r,a){var p,h,y,N,D,k;["id","class"].includes(s)||!b.observedAttributes.includes(s)&&this.constructor.observedAttributes.includes(s)||(a===null?(h=(p=this.nativeEl).removeAttribute)==null||h.call(p,s):((N=(y=this.nativeEl).getAttribute)==null?void 0:N.call(y,s))!=a&&((k=(D=this.nativeEl).setAttribute)==null||k.call(D,s,a)))},c(b,M),$(b,"getTemplateHTML",e.endsWith("audio")?yt:Tt),$(b,"shadowRootOptions",{mode:"open"}),$(b,"Events",X),c(b,f,void 0),b};function Mt(i){let e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))e.push(...Object.getOwnPropertyNames(t));return e}function ut(i){let e="";for(let t in i){let o=i[t];o===""?e+=` ${t}`:e+=` ${t}="${o}"`}return e}function _t(i){let e={};for(let t of i)e[t.name]=t.value;return e}var it,Dt=rt((it=globalThis.HTMLElement)!=null?it:class{},{tag:"video"}),st,F=rt((st=globalThis.HTMLElement)!=null?st:class{},{tag:"audio"});var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Ct=Object.values(n),kt=et(),vt="mux-audio",A,P,G,R,Y,O,q,K=class extends F{constructor(){super();c(this,O);c(this,A,void 0);c(this,P,void 0);c(this,G,void 0);c(this,R,{});c(this,Y,void 0);g(this,G,(0,l.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...Ct,...(t=F.observedAttributes)!=null?t:[]]}get playerInitTime(){return u(this,G)}get playerSoftwareName(){return vt}get playerSoftwareVersion(){return kt}get _hls(){var t;return(t=u(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 disableTracking(){return this.hasAttribute(n.DISABLE_TRACKING)}set disableTracking(t){t!==this.disableTracking&&this.toggleAttribute(n.DISABLE_TRACKING,!!t)}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 programStartTime(){let t=this.getAttribute(n.PROGRAM_START_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set programStartTime(t){t==null?this.removeAttribute(n.PROGRAM_START_TIME):this.setAttribute(n.PROGRAM_START_TIME,`${t}`)}get programEndTime(){let t=this.getAttribute(n.PROGRAM_END_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set programEndTime(t){t==null?this.removeAttribute(n.PROGRAM_END_TIME):this.setAttribute(n.PROGRAM_END_TIME,`${t}`)}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(o=>o.startsWith("metadata-")&&![n.METADATA_URL].includes(o)).reduce((o,d)=>{let T=this.getAttribute(d);return T!=null&&(o[d.replace(/^metadata-/,"").replace(/-/g,"_")]=T),o},{}),...u(this,R)}}set metadata(t){g(this,R,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,R)))}get _hlsConfig(){return u(this,Y)}set _hlsConfig(t){g(this,Y,t)}load(){g(this,A,(0,l.initialize)(this,this.nativeEl,u(this,A)))}unload(){(0,l.teardown)(this.nativeEl,u(this,A)),g(this,A,void 0)}attributeChangedCallback(t,o,d){var S,b;switch(F.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,o,d),t){case"src":{let f=!!o,M=!!d;!f&&M?m(this,O,q).call(this):f&&!M?this.unload():f&&M&&(this.unload(),m(this,O,q).call(this));break}case"autoplay":if(d===o)break;(S=u(this,A))==null||S.setAutoplay(this.autoplay);break;case"preload":if(d===o)break;(b=u(this,A))==null||b.setPreload(d);break;case n.PLAYBACK_ID:this.src=(0,l.toMuxVideoURL)(this);break;case n.DEBUG:{let f=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=f);break}case n.METADATA_URL:d&&fetch(d).then(f=>f.json()).then(f=>this.metadata=f).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&&!u(this,A)&&m(this,O,q).call(this)}disconnectedCallback(){this.unload()}};A=new WeakMap,P=new WeakMap,G=new WeakMap,R=new WeakMap,Y=new WeakMap,O=new WeakSet,q=async function(){u(this,P)||(await g(this,P,Promise.resolve()),g(this,P,null),this.load())};V.customElements.get("mux-audio")||(V.customElements.define("mux-audio",K),V.MuxAudioElement=K);var Pt=K; | ||
`}var rt=(e,{tag:i,is:t})=>{var T,S,b,f,M,nt,I,L,C,E,_,x,Q,j,ot,H,at;let o=(S=(T=globalThis.document)==null?void 0:T.createElement)==null?void 0:S.call(T,i,{is:t}),d=o?Mt(o):[];return b=class extends e{constructor(){super();c(this,E);c(this,x);c(this,j);c(this,H);c(this,I,void 0);c(this,L,void 0);c(this,C,new Map)}static get observedAttributes(){var r,a,p;return m(r=b,M,nt).call(r),[...(p=(a=o==null?void 0:o.constructor)==null?void 0:a.observedAttributes)!=null?p:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var s,r,a;return m(this,E,_).call(this),(a=(r=(s=u(this,L))!=null?s:this.shadowRoot.querySelector(i))!=null?r:this.querySelector(":scope > [slot=media]"))!=null?a:this.querySelector(i)}set nativeEl(s){g(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.shadowRoot){this.attachShadow({mode:"open"});let a=_t(this.attributes);t&&(a.is=t),i&&(a.part=i),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(a)}this.nativeEl.muted=this.hasAttribute("muted");for(let a of d)m(this,j,ot).call(this,a);this.shadowRoot.addEventListener("slotchange",this),m(this,x,Q).call(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"){m(this,x,Q).call(this);return}s.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(s.type,{detail:s.detail}))}attributeChangedCallback(s,r,a){m(this,E,_).call(this),m(this,H,at).call(this,s,r,a)}connectedCallback(){m(this,E,_).call(this)}},f=new WeakMap,M=new WeakSet,nt=function(){if(u(this,f))return;g(this,f,!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(...p){return m(this,E,_).call(this),this.call?this.call(r,...p):this.nativeEl[r].apply(this.nativeEl,p)};else{let p={get(){var y,N,D;m(this,E,_).call(this);let h=r.toLowerCase();if(s.has(h)){let k=this.getAttribute(h);return k===null?!1:k===""?!0:k}return(D=(y=this.get)==null?void 0:y.call(this,r))!=null?D:(N=this.nativeEl)==null?void 0:N[r]}};r!==r.toUpperCase()&&(p.set=function(h){m(this,E,_).call(this);let y=r.toLowerCase();if(s.has(y)){h===!0||h===!1||h==null?this.toggleAttribute(y,!!h):this.setAttribute(y,h);return}if(this.set){this.set(r,h);return}this.nativeEl[r]=h}),Object.defineProperty(this.prototype,r,p)}}},I=new WeakMap,L=new WeakMap,C=new WeakMap,E=new WeakSet,_=function(){u(this,I)||(g(this,I,!0),this.init())},x=new WeakSet,Q=function(){let s=new Map(u(this,C));this.shadowRoot.querySelector("slot:not([name])").assignedElements({flatten:!0}).filter(r=>["track","source"].includes(r.localName)).forEach(r=>{var p,h;s.delete(r);let a=u(this,C).get(r);a||(a=r.cloneNode(),u(this,C).set(r,a)),(h=(p=this.nativeEl).append)==null||h.call(p,a),a.localName==="track"&&a.default&&(a.kind==="chapters"||a.kind==="metadata")&&a.track.mode==="disabled"&&(a.track.mode="hidden")}),s.forEach(r=>r.remove())},j=new WeakSet,ot=function(s){if(Object.prototype.hasOwnProperty.call(this,s)){let r=this[s];delete this[s],this[s]=r}},H=new WeakSet,at=function(s,r,a){var p,h,y,N,D,k;["id","class"].includes(s)||!b.observedAttributes.includes(s)&&this.constructor.observedAttributes.includes(s)||(a===null?(h=(p=this.nativeEl).removeAttribute)==null||h.call(p,s):((N=(y=this.nativeEl).getAttribute)==null?void 0:N.call(y,s))!=a&&((k=(D=this.nativeEl).setAttribute)==null||k.call(D,s,a)))},c(b,M),$(b,"getTemplateHTML",i.endsWith("audio")?yt:Tt),$(b,"shadowRootOptions",{mode:"open"}),$(b,"Events",X),c(b,f,void 0),b};function Mt(e){let i=[];for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t))i.push(...Object.getOwnPropertyNames(t));return i}function ut(e){let i="";for(let t in e){let o=e[t];o===""?i+=` ${t}`:i+=` ${t}="${o}"`}return i}function _t(e){let i={};for(let t of e)i[t.name]=t.value;return i}var it,Dt=rt((it=globalThis.HTMLElement)!=null?it:class{},{tag:"video"}),st,F=rt((st=globalThis.HTMLElement)!=null?st:class{},{tag:"audio"});var n={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Ct=Object.values(n),kt=et(),vt="mux-audio",A,P,G,R,Y,O,q,K=class extends F{constructor(){super();c(this,O);c(this,A,void 0);c(this,P,void 0);c(this,G,void 0);c(this,R,{});c(this,Y,void 0);g(this,G,(0,l.generatePlayerInitTime)())}static get observedAttributes(){var t;return[...Ct,...(t=F.observedAttributes)!=null?t:[]]}get playerInitTime(){return u(this,G)}get playerSoftwareName(){return vt}get playerSoftwareVersion(){return kt}get _hls(){var t;return(t=u(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 disableTracking(){return this.hasAttribute(n.DISABLE_TRACKING)}set disableTracking(t){t!==this.disableTracking&&this.toggleAttribute(n.DISABLE_TRACKING,!!t)}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 programStartTime(){let t=this.getAttribute(n.PROGRAM_START_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set programStartTime(t){t==null?this.removeAttribute(n.PROGRAM_START_TIME):this.setAttribute(n.PROGRAM_START_TIME,`${t}`)}get programEndTime(){let t=this.getAttribute(n.PROGRAM_END_TIME);if(t==null)return;let o=+t;return Number.isNaN(o)?void 0:o}set programEndTime(t){t==null?this.removeAttribute(n.PROGRAM_END_TIME):this.setAttribute(n.PROGRAM_END_TIME,`${t}`)}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(o=>o.startsWith("metadata-")&&![n.METADATA_URL].includes(o)).reduce((o,d)=>{let T=this.getAttribute(d);return T!=null&&(o[d.replace(/^metadata-/,"").replace(/-/g,"_")]=T),o},{}),...u(this,R)}}set metadata(t){g(this,R,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,R)))}get _hlsConfig(){return u(this,Y)}set _hlsConfig(t){g(this,Y,t)}load(){g(this,A,(0,l.initialize)(this,this.nativeEl,u(this,A)))}unload(){(0,l.teardown)(this.nativeEl,u(this,A)),g(this,A,void 0)}attributeChangedCallback(t,o,d){var S,b;switch(F.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,o,d),t){case"src":{let f=!!o,M=!!d;!f&&M?m(this,O,q).call(this):f&&!M?this.unload():f&&M&&(this.unload(),m(this,O,q).call(this));break}case"autoplay":if(d===o)break;(S=u(this,A))==null||S.setAutoplay(this.autoplay);break;case"preload":if(d===o)break;(b=u(this,A))==null||b.setPreload(d);break;case n.PLAYBACK_ID:this.src=(0,l.toMuxVideoURL)(this);break;case n.DEBUG:{let f=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=f);break}case n.METADATA_URL:d&&fetch(d).then(f=>f.json()).then(f=>this.metadata=f).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&&!u(this,A)&&m(this,O,q).call(this)}disconnectedCallback(){this.unload()}};A=new WeakMap,P=new WeakMap,G=new WeakMap,R=new WeakMap,Y=new WeakMap,O=new WeakSet,q=async function(){u(this,P)||(await g(this,P,Promise.resolve()),g(this,P,null),this.load())};V.customElements.get("mux-audio")||(V.customElements.define("mux-audio",K),V.MuxAudioElement=K);var Pt=K; | ||
//# sourceMappingURL=index.cjs.js.map |
{ | ||
"name": "@mux/mux-audio", | ||
"version": "0.13.3", | ||
"version": "0.13.4", | ||
"description": "A custom mux audio element for the browser that Just Works™", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
"clean": "shx rm -rf dist/ && shx rm -rf src/polyfills", | ||
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx", | ||
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/ --ext .js,.jsx,.ts,.tsx", | ||
"test": "web-test-runner **/*test.js --port 8003 --coverage --config test/web-test-runner.config.mjs --root-dir ../..", | ||
@@ -69,3 +69,3 @@ "posttest": "replace 'SF:src/' 'SF:packages/mux-audio/src/' coverage/lcov.info --silent", | ||
"dependencies": { | ||
"@mux/playback-core": "0.25.2", | ||
"@mux/playback-core": "0.26.0", | ||
"custom-media-element": "~1.3.1" | ||
@@ -75,4 +75,4 @@ }, | ||
"@open-wc/testing": "^4.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.48.0", | ||
"@typescript-eslint/parser": "^5.48.0", | ||
"@typescript-eslint/eslint-plugin": "^8.3.0", | ||
"@typescript-eslint/parser": "^8.3.0", | ||
"@web/dev-server-esbuild": "^1.0.2", | ||
@@ -83,3 +83,3 @@ "@web/dev-server-import-maps": "^0.2.1", | ||
"esbuild": "^0.19.8", | ||
"eslint": "^8.24.0", | ||
"eslint": "^9.9.1", | ||
"hls.js": "~1.5.11", | ||
@@ -89,5 +89,5 @@ "npm-run-all": "^4.1.5", | ||
"shx": "^0.3.4", | ||
"typescript": "^4.9.4" | ||
"typescript": "^5.5.4" | ||
}, | ||
"gitHead": "94210d8ddb22e9d15369329ced978781eebf3402" | ||
"gitHead": "5ae58b9de16ae2dcd807276bb6539c1f8cfab800" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5559406
4417
+ Added@mux/playback-core@0.26.0(transitive)
+ Addedmux-embed@5.4.1(transitive)
- Removed@mux/playback-core@0.25.2(transitive)
- Removedmux-embed@5.2.1(transitive)
Updated@mux/playback-core@0.26.0