@mux/mux-audio
Advanced tools
Comparing version 0.14.0-canary.0-2fbb2c1 to 0.14.0-canary.0-44b4261
@@ -31,3 +31,3 @@ { | ||
"src/index.ts": { | ||
"bytes": 15363, | ||
"bytes": 15909, | ||
"imports": [ | ||
@@ -68,3 +68,3 @@ { | ||
"inputs": {}, | ||
"bytes": 47141 | ||
"bytes": 47931 | ||
}, | ||
@@ -83,3 +83,3 @@ "dist/index.cjs.js": { | ||
"src/index.ts": { | ||
"bytesInOutput": 7671 | ||
"bytesInOutput": 7979 | ||
}, | ||
@@ -96,5 +96,5 @@ "src/polyfills/index.ts": { | ||
}, | ||
"bytes": 16014 | ||
"bytes": 16322 | ||
} | ||
} | ||
} |
@@ -31,3 +31,3 @@ { | ||
"src/index.ts": { | ||
"bytes": 15363, | ||
"bytes": 15909, | ||
"imports": [ | ||
@@ -68,3 +68,3 @@ { | ||
"inputs": {}, | ||
"bytes": 47328 | ||
"bytes": 48119 | ||
}, | ||
@@ -84,2 +84,3 @@ "dist/index.mjs": { | ||
"default", | ||
"generatePlayerInitTime", | ||
"playerSoftwareName", | ||
@@ -94,3 +95,3 @@ "playerSoftwareVersion" | ||
"src/index.ts": { | ||
"bytesInOutput": 7499 | ||
"bytesInOutput": 7755 | ||
}, | ||
@@ -104,5 +105,5 @@ "src/env.ts": { | ||
}, | ||
"bytes": 15556 | ||
"bytes": 15841 | ||
} | ||
} | ||
} |
@@ -67,3 +67,3 @@ { | ||
"src/index.ts": { | ||
"bytes": 15363, | ||
"bytes": 15909, | ||
"imports": [ | ||
@@ -104,3 +104,3 @@ { | ||
"inputs": {}, | ||
"bytes": 2242762 | ||
"bytes": 2243553 | ||
}, | ||
@@ -131,8 +131,8 @@ "dist/mux-audio.js": { | ||
"src/index.ts": { | ||
"bytesInOutput": 7365 | ||
"bytesInOutput": 7621 | ||
} | ||
}, | ||
"bytes": 528696 | ||
"bytes": 528952 | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict";var F=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var Et=(e,i,t)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var Tt=(e,i)=>{for(var t in i)F(e,t,{get:i[t],enumerable:!0})},yt=(e,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of gt(i))!pt.call(e,l)&&l!==t&&F(e,l,{get:()=>i[l],enumerable:!(n=At(i,l))||n.enumerable});return e};var _t=e=>yt(F({},"__esModule",{value:!0}),e);var k=(e,i,t)=>(Et(e,typeof i!="symbol"?i+"":i,t),t),Q=(e,i,t)=>{if(!i.has(e))throw TypeError("Cannot "+t)};var d=(e,i,t)=>(Q(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)},A=(e,i,t,n)=>(Q(e,i,"write to private field"),n?n.call(e,t):i.set(e,t),t);var b=(e,i,t)=>(Q(e,i,"access private method"),t);var Lt={};Tt(Lt,{Attributes:()=>r,AudioEvents:()=>it,MediaError:()=>h.MediaError,default:()=>It,playerSoftwareName:()=>rt,playerSoftwareVersion:()=>st});module.exports=_t(Lt);var O=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class e extends O{}globalThis.DocumentFragment=e}var B=class extends O{},X=class extends O{},Mt={get(e){},define(e,i,t){},getName(e){return null},upgrade(e){},whenDefined(e){return Promise.resolve(B)}},Y,Z=class{constructor(i,t={}){c(this,Y,void 0);A(this,Y,t==null?void 0:t.detail)}get detail(){return d(this,Y)}initCustomEvent(){}};Y=new WeakMap;function Ct(e,i){return new B}var nt={document:{createElement:Ct},DocumentFragment,customElements:Mt,CustomEvent:Z,EventTarget:O,HTMLElement:B,HTMLVideoElement:X},ot=typeof window=="undefined"||typeof globalThis.customElements=="undefined",z=ot?nt:globalThis,wt=ot?nt.document:globalThis.document;var h=require("@mux/playback-core");var kt=()=>{try{return"0.14.0"}catch{}return"UNKNOWN"},St=kt(),at=()=>St;var it=["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 Pt(e){return` | ||
"use strict";var F=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var Et=(i,s,t)=>s in i?F(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t;var Tt=(i,s)=>{for(var t in s)F(i,t,{get:s[t],enumerable:!0})},yt=(i,s,t,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let h of gt(s))!pt.call(i,h)&&h!==t&&F(i,h,{get:()=>s[h],enumerable:!(n=At(s,h))||n.enumerable});return i};var _t=i=>yt(F({},"__esModule",{value:!0}),i);var P=(i,s,t)=>(Et(i,typeof s!="symbol"?s+"":s,t),t),Q=(i,s,t)=>{if(!s.has(i))throw TypeError("Cannot "+t)};var d=(i,s,t)=>(Q(i,s,"read from private field"),t?t.call(i):s.get(i)),c=(i,s,t)=>{if(s.has(i))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(i):s.set(i,t)},A=(i,s,t,n)=>(Q(i,s,"write to private field"),n?n.call(i,t):s.set(i,t),t);var b=(i,s,t)=>(Q(i,s,"access private method"),t);var Lt={};Tt(Lt,{Attributes:()=>e,AudioEvents:()=>it,MediaError:()=>l.MediaError,default:()=>vt,generatePlayerInitTime:()=>l.generatePlayerInitTime,playerSoftwareName:()=>rt,playerSoftwareVersion:()=>st});module.exports=_t(Lt);var S=class{addEventListener(){}removeEventListener(){}dispatchEvent(s){return!0}};if(typeof DocumentFragment=="undefined"){class i extends S{}globalThis.DocumentFragment=i}var B=class extends S{},X=class extends S{},Mt={get(i){},define(i,s,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(B)}},Y,Z=class{constructor(s,t={}){c(this,Y,void 0);A(this,Y,t==null?void 0:t.detail)}get detail(){return d(this,Y)}initCustomEvent(){}};Y=new WeakMap;function Ct(i,s){return new B}var nt={document:{createElement:Ct},DocumentFragment,customElements:Mt,CustomEvent:Z,EventTarget:S,HTMLElement:B,HTMLVideoElement:X},ot=typeof window=="undefined"||typeof globalThis.customElements=="undefined",z=ot?nt:globalThis,wt=ot?nt.document:globalThis.document;var l=require("@mux/playback-core");var Pt=()=>{try{return"0.14.0"}catch{}return"UNKNOWN"},kt=Pt(),at=()=>kt;var it=["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 It(i){return` | ||
<style> | ||
@@ -15,6 +15,6 @@ :host { | ||
<slot name="media"> | ||
<audio${bt(e)}></audio> | ||
<audio${bt(i)}></audio> | ||
</slot> | ||
<slot></slot> | ||
`}function Ot(e){return` | ||
`}function St(i){return` | ||
<style> | ||
@@ -41,6 +41,6 @@ :host { | ||
<slot name="media"> | ||
<video${bt(e)}></video> | ||
<video${bt(i)}></video> | ||
</slot> | ||
<slot></slot> | ||
`}function mt(e,{tag:i,is:t}){var E,C,p,g,_,lt,I,L,M,D,y,S,x,tt,$,ct,w,et,V,ht,q,ft;let n=(C=(E=globalThis.document)==null?void 0:E.createElement)==null?void 0:C.call(E,i,{is:t}),l=n?Nt(n):[];return p=class extends e{constructor(){super(...arguments);c(this,y);c(this,x);c(this,$);c(this,w);c(this,V);c(this,q);c(this,I,!1);c(this,L,null);c(this,M,new Map);c(this,D,void 0);k(this,"get");k(this,"set");k(this,"call")}static get observedAttributes(){var o,f,u;return b(o=p,_,lt).call(o),[...(u=(f=n==null?void 0:n.constructor)==null?void 0:f.observedAttributes)!=null?u:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var s,o,f,u,a;return b(this,y,S).call(this),(a=(u=(o=(s=d(this,L))!=null?s:this.querySelector(":scope > [slot=media]"))!=null?o:this.querySelector(i))!=null?u:(f=this.shadowRoot)==null?void 0:f.querySelector(i))!=null?a:null}set nativeEl(s){A(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,o;return(o=this.getAttribute("preload"))!=null?o:(s=this.nativeEl)==null?void 0:s.preload}set preload(s){this.setAttribute("preload",`${s}`)}init(){var s;if(!this.shadowRoot){this.attachShadow({mode:"open"});let o=Rt(this.attributes);t&&(o.is=t),i&&(o.part=i),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(o)}this.nativeEl.muted=this.hasAttribute("muted");for(let o of l)b(this,V,ht).call(this,o);A(this,D,new MutationObserver(b(this,$,ct).bind(this))),this.shadowRoot.addEventListener("slotchange",this),b(this,x,tt).call(this);for(let o of this.constructor.Events)(s=this.shadowRoot)==null||s.addEventListener(o,this,!0)}handleEvent(s){if(s.type==="slotchange"){b(this,x,tt).call(this);return}s.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(s.type,{detail:s.detail}))}attributeChangedCallback(s,o,f){b(this,y,S).call(this),b(this,q,ft).call(this,s,o,f)}connectedCallback(){b(this,y,S).call(this)}},g=new WeakMap,_=new WeakSet,lt=function(){if(d(this,g))return;A(this,g,!0);let s=new Set(this.observedAttributes);s.delete("muted");for(let o of l)if(!(o in this.prototype))if(typeof n[o]=="function")this.prototype[o]=function(...f){return b(this,y,S).call(this),(()=>{var m;if(this.call)return this.call(o,...f);let a=(m=this.nativeEl)==null?void 0:m[o];return a==null?void 0:a.apply(this.nativeEl,f)})()};else{let f={get(){var a,m,K;b(this,y,S).call(this);let u=o.toLowerCase();if(s.has(u)){let P=this.getAttribute(u);return P===null?!1:P===""?!0:P}return(K=(a=this.get)==null?void 0:a.call(this,o))!=null?K:(m=this.nativeEl)==null?void 0:m[o]}};o!==o.toUpperCase()&&(f.set=function(u){b(this,y,S).call(this);let a=o.toLowerCase();if(s.has(a)){u===!0||u===!1||u==null?this.toggleAttribute(a,!!u):this.setAttribute(a,u);return}if(this.set){this.set(o,u);return}this.nativeEl&&(this.nativeEl[o]=u)}),Object.defineProperty(this.prototype,o,f)}},I=new WeakMap,L=new WeakMap,M=new WeakMap,D=new WeakMap,y=new WeakSet,S=function(){d(this,I)||(A(this,I,!0),this.init())},x=new WeakSet,tt=function(){var u;let s=new Map(d(this,M)),o=(u=this.shadowRoot)==null?void 0:u.querySelector("slot:not([name])");(o==null?void 0:o.assignedElements({flatten:!0}).filter(a=>["track","source"].includes(a.localName))).forEach(a=>{var K,P;s.delete(a);let m=d(this,M).get(a);m||(m=a.cloneNode(),d(this,M).set(a,m),(K=d(this,D))==null||K.observe(a,{attributes:!0})),(P=this.nativeEl)==null||P.append(m),b(this,w,et).call(this,m)}),s.forEach((a,m)=>{a.remove(),d(this,M).delete(m)})},$=new WeakSet,ct=function(s){var o;for(let f of s)if(f.type==="attributes"){let{target:u,attributeName:a}=f,m=d(this,M).get(u);m&&a&&(m.setAttribute(a,(o=u.getAttribute(a))!=null?o:""),b(this,w,et).call(this,m))}},w=new WeakSet,et=function(s){s&&s.localName==="track"&&s.default&&(s.kind==="chapters"||s.kind==="metadata")&&s.track.mode==="disabled"&&(s.track.mode="hidden")},V=new WeakSet,ht=function(s){if(Object.prototype.hasOwnProperty.call(this,s)){let o=this[s];delete this[s],this[s]=o}},q=new WeakSet,ft=function(s,o,f){var u,a,m;["id","class"].includes(s)||!p.observedAttributes.includes(s)&&this.constructor.observedAttributes.includes(s)||(f===null?(u=this.nativeEl)==null||u.removeAttribute(s):((a=this.nativeEl)==null?void 0:a.getAttribute(s))!==f&&((m=this.nativeEl)==null||m.setAttribute(s,f)))},c(p,_),k(p,"getTemplateHTML",i.endsWith("audio")?Pt:Ot),k(p,"shadowRootOptions",{mode:"open"}),k(p,"Events",it),c(p,g,!1),p}function Nt(e){let i=[];for(let t=Object.getPrototypeOf(e);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let n=Object.getOwnPropertyNames(t);i.push(...n)}return i}function bt(e){let i="";for(let t in e){let n=e[t];n===""?i+=` ${t}`:i+=` ${t}="${n}"`}return i}function Rt(e){let i={};for(let t of e)i[t.name]=t.value;return i}var ut,Gt=mt((ut=globalThis.HTMLElement)!=null?ut:class{},{tag:"video"}),dt,W=mt((dt=globalThis.HTMLElement)!=null?dt:class{},{tag:"audio"});var r={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",PLAYBACK_TOKEN:"playback-token",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",CUSTOM_DOMAIN:"custom-domain",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},vt=Object.values(r),st=at(),rt="mux-audio",T,N,U,R,j,H,v,J,G=class extends W{constructor(){super();c(this,v);c(this,T,void 0);c(this,N,void 0);c(this,U,void 0);c(this,R,{});c(this,j,{});c(this,H,void 0);A(this,U,(0,h.generatePlayerInitTime)())}static get NAME(){return rt}static get VERSION(){return st}static get observedAttributes(){var t;return[...vt,...(t=W.observedAttributes)!=null?t:[]]}get playerInitTime(){return d(this,U)}get playerSoftwareName(){return rt}get playerSoftwareVersion(){return st}get _hls(){var t;return(t=d(this,T))==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(r.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(r.DEBUG,""):this.removeAttribute(r.DEBUG))}get disableTracking(){return this.hasAttribute(r.DISABLE_TRACKING)}set disableTracking(t){t!==this.disableTracking&&this.toggleAttribute(r.DISABLE_TRACKING,!!t)}get disableCookies(){return this.hasAttribute(r.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(r.DISABLE_COOKIES,""):this.removeAttribute(r.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(r.START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(r.START_TIME):this.setAttribute(r.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(r.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(r.PLAYBACK_ID,t):this.removeAttribute(r.PLAYBACK_ID))}get programStartTime(){let t=this.getAttribute(r.PROGRAM_START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set programStartTime(t){t==null?this.removeAttribute(r.PROGRAM_START_TIME):this.setAttribute(r.PROGRAM_START_TIME,`${t}`)}get programEndTime(){let t=this.getAttribute(r.PROGRAM_END_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set programEndTime(t){t==null?this.removeAttribute(r.PROGRAM_END_TIME):this.setAttribute(r.PROGRAM_END_TIME,`${t}`)}get assetStartTime(){let t=this.getAttribute(r.ASSET_START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set assetStartTime(t){t==null?this.removeAttribute(r.ASSET_START_TIME):this.setAttribute(r.ASSET_START_TIME,`${t}`)}get assetEndTime(){let t=this.getAttribute(r.ASSET_END_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set assetEndTime(t){t==null?this.removeAttribute(r.ASSET_END_TIME):this.setAttribute(r.ASSET_END_TIME,`${t}`)}get customDomain(){var t;return(t=this.getAttribute(r.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(r.CUSTOM_DOMAIN,t):this.removeAttribute(r.CUSTOM_DOMAIN))}get playbackToken(){var t,n,l,E;if(this.hasAttribute(r.PLAYBACK_TOKEN))return(t=this.getAttribute(r.PLAYBACK_TOKEN))!=null?t:void 0;if(this.hasAttribute(r.PLAYBACK_ID)){let[,C]=(0,h.toPlaybackIdParts)((n=this.playbackId)!=null?n:"");return(l=new URLSearchParams(C).get("token"))!=null?l:void 0}if(this.src)return(E=new URLSearchParams(this.src).get("token"))!=null?E:void 0}set playbackToken(t){t!==this.playbackToken&&(t?this.setAttribute(r.PLAYBACK_TOKEN,t):this.removeAttribute(r.PLAYBACK_TOKEN))}get tokens(){let t=this.getAttribute(r.PLAYBACK_TOKEN);return{...d(this,j),...t!=null?{playback:t}:{}}}set tokens(t){A(this,j,t!=null?t:{})}get ended(){return(0,h.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(r.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(r.ENV_KEY,t):this.removeAttribute(r.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(r.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(r.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(r.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(r.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(r.STREAM_TYPE,t):this.removeAttribute(r.STREAM_TYPE))}getStartDate(){return(0,h.getStartDate)(this.nativeEl,this._hls)}get currentPdt(){return(0,h.getCurrentPdt)(this.nativeEl,this._hls)}get preferPlayback(){let t=this.getAttribute(r.PREFER_PLAYBACK);if(t===h.PlaybackTypes.MSE||t===h.PlaybackTypes.NATIVE)return t}set preferPlayback(t){t!==this.preferPlayback&&(t===h.PlaybackTypes.MSE||t===h.PlaybackTypes.NATIVE?this.setAttribute(r.PREFER_PLAYBACK,t):this.removeAttribute(r.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![r.METADATA_URL].includes(n)).reduce((n,l)=>{let E=this.getAttribute(l);return E!=null&&(n[l.replace(/^metadata-/,"").replace(/-/g,"_")]=E),n},{}),...d(this,R)}}set metadata(t){A(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",d(this,R)))}get _hlsConfig(){return d(this,H)}set _hlsConfig(t){A(this,H,t)}load(){A(this,T,(0,h.initialize)(this,this.nativeEl,d(this,T)))}unload(){(0,h.teardown)(this.nativeEl,d(this,T)),A(this,T,void 0)}attributeChangedCallback(t,n,l){var C,p;switch(W.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,n,l),t){case"src":{let g=!!n,_=!!l;!g&&_?b(this,v,J).call(this):g&&!_?this.unload():g&&_&&(this.unload(),b(this,v,J).call(this));break}case"autoplay":if(l===n)break;(C=d(this,T))==null||C.setAutoplay(this.autoplay);break;case"preload":if(l===n)break;(p=d(this,T))==null||p.setPreload(l);break;case r.PLAYBACK_ID:this.src=(0,h.toMuxVideoURL)(this);break;case r.DEBUG:{let g=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=g);break}case r.METADATA_URL:l&&fetch(l).then(g=>g.json()).then(g=>this.metadata=g).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${l}!`));break;default:break}}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this.nativeEl&&this.src&&!d(this,T)&&b(this,v,J).call(this)}disconnectedCallback(){this.unload()}};T=new WeakMap,N=new WeakMap,U=new WeakMap,R=new WeakMap,j=new WeakMap,H=new WeakMap,v=new WeakSet,J=async function(){d(this,N)||(await A(this,N,Promise.resolve()),A(this,N,null),this.load())};z.customElements.get("mux-audio")||(z.customElements.define("mux-audio",G),z.MuxAudioElement=G);var It=G; | ||
`}function mt(i,{tag:s,is:t}){var E,C,p,g,_,lt,v,L,M,D,y,k,x,tt,$,ht,w,et,V,ct,q,ft;let n=(C=(E=globalThis.document)==null?void 0:E.createElement)==null?void 0:C.call(E,s,{is:t}),h=n?Nt(n):[];return p=class extends i{constructor(){super(...arguments);c(this,y);c(this,x);c(this,$);c(this,w);c(this,V);c(this,q);c(this,v,!1);c(this,L,null);c(this,M,new Map);c(this,D,void 0);P(this,"get");P(this,"set");P(this,"call")}static get observedAttributes(){var o,f,u;return b(o=p,_,lt).call(o),[...(u=(f=n==null?void 0:n.constructor)==null?void 0:f.observedAttributes)!=null?u:[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get nativeEl(){var r,o,f,u,a;return b(this,y,k).call(this),(a=(u=(o=(r=d(this,L))!=null?r:this.querySelector(":scope > [slot=media]"))!=null?o:this.querySelector(s))!=null?u:(f=this.shadowRoot)==null?void 0:f.querySelector(s))!=null?a:null}set nativeEl(r){A(this,L,r)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(r){this.toggleAttribute("muted",r)}get src(){return this.getAttribute("src")}set src(r){this.setAttribute("src",`${r}`)}get preload(){var r,o;return(o=this.getAttribute("preload"))!=null?o:(r=this.nativeEl)==null?void 0:r.preload}set preload(r){this.setAttribute("preload",`${r}`)}init(){var r;if(!this.shadowRoot){this.attachShadow({mode:"open"});let o=Ot(this.attributes);t&&(o.is=t),s&&(o.part=s),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(o)}this.nativeEl.muted=this.hasAttribute("muted");for(let o of h)b(this,V,ct).call(this,o);A(this,D,new MutationObserver(b(this,$,ht).bind(this))),this.shadowRoot.addEventListener("slotchange",this),b(this,x,tt).call(this);for(let o of this.constructor.Events)(r=this.shadowRoot)==null||r.addEventListener(o,this,!0)}handleEvent(r){if(r.type==="slotchange"){b(this,x,tt).call(this);return}r.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(r.type,{detail:r.detail}))}attributeChangedCallback(r,o,f){b(this,y,k).call(this),b(this,q,ft).call(this,r,o,f)}connectedCallback(){b(this,y,k).call(this)}},g=new WeakMap,_=new WeakSet,lt=function(){if(d(this,g))return;A(this,g,!0);let r=new Set(this.observedAttributes);r.delete("muted");for(let o of h)if(!(o in this.prototype))if(typeof n[o]=="function")this.prototype[o]=function(...f){return b(this,y,k).call(this),(()=>{var m;if(this.call)return this.call(o,...f);let a=(m=this.nativeEl)==null?void 0:m[o];return a==null?void 0:a.apply(this.nativeEl,f)})()};else{let f={get(){var a,m,K;b(this,y,k).call(this);let u=o.toLowerCase();if(r.has(u)){let I=this.getAttribute(u);return I===null?!1:I===""?!0:I}return(K=(a=this.get)==null?void 0:a.call(this,o))!=null?K:(m=this.nativeEl)==null?void 0:m[o]}};o!==o.toUpperCase()&&(f.set=function(u){b(this,y,k).call(this);let a=o.toLowerCase();if(r.has(a)){u===!0||u===!1||u==null?this.toggleAttribute(a,!!u):this.setAttribute(a,u);return}if(this.set){this.set(o,u);return}this.nativeEl&&(this.nativeEl[o]=u)}),Object.defineProperty(this.prototype,o,f)}},v=new WeakMap,L=new WeakMap,M=new WeakMap,D=new WeakMap,y=new WeakSet,k=function(){d(this,v)||(A(this,v,!0),this.init())},x=new WeakSet,tt=function(){var u;let r=new Map(d(this,M)),o=(u=this.shadowRoot)==null?void 0:u.querySelector("slot:not([name])");(o==null?void 0:o.assignedElements({flatten:!0}).filter(a=>["track","source"].includes(a.localName))).forEach(a=>{var K,I;r.delete(a);let m=d(this,M).get(a);m||(m=a.cloneNode(),d(this,M).set(a,m),(K=d(this,D))==null||K.observe(a,{attributes:!0})),(I=this.nativeEl)==null||I.append(m),b(this,w,et).call(this,m)}),r.forEach((a,m)=>{a.remove(),d(this,M).delete(m)})},$=new WeakSet,ht=function(r){var o;for(let f of r)if(f.type==="attributes"){let{target:u,attributeName:a}=f,m=d(this,M).get(u);m&&a&&(m.setAttribute(a,(o=u.getAttribute(a))!=null?o:""),b(this,w,et).call(this,m))}},w=new WeakSet,et=function(r){r&&r.localName==="track"&&r.default&&(r.kind==="chapters"||r.kind==="metadata")&&r.track.mode==="disabled"&&(r.track.mode="hidden")},V=new WeakSet,ct=function(r){if(Object.prototype.hasOwnProperty.call(this,r)){let o=this[r];delete this[r],this[r]=o}},q=new WeakSet,ft=function(r,o,f){var u,a,m;["id","class"].includes(r)||!p.observedAttributes.includes(r)&&this.constructor.observedAttributes.includes(r)||(f===null?(u=this.nativeEl)==null||u.removeAttribute(r):((a=this.nativeEl)==null?void 0:a.getAttribute(r))!==f&&((m=this.nativeEl)==null||m.setAttribute(r,f)))},c(p,_),P(p,"getTemplateHTML",s.endsWith("audio")?It:St),P(p,"shadowRootOptions",{mode:"open"}),P(p,"Events",it),c(p,g,!1),p}function Nt(i){let s=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){let n=Object.getOwnPropertyNames(t);s.push(...n)}return s}function bt(i){let s="";for(let t in i){let n=i[t];n===""?s+=` ${t}`:s+=` ${t}="${n}"`}return s}function Ot(i){let s={};for(let t of i)s[t.name]=t.value;return s}var ut,Gt=mt((ut=globalThis.HTMLElement)!=null?ut:class{},{tag:"video"}),dt,W=mt((dt=globalThis.HTMLElement)!=null?dt:class{},{tag:"audio"});var e={PLAYER_INIT_TIME:"player-init-time",ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",PLAYBACK_TOKEN:"playback-token",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PREFER_PLAYBACK:"prefer-playback",CUSTOM_DOMAIN:"custom-domain",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Rt=Object.values(e),st=at(),rt="mux-audio",T,N,U,O,j,H,R,J,G=class extends W{constructor(){super();c(this,R);c(this,T,void 0);c(this,N,void 0);c(this,U,void 0);c(this,O,{});c(this,j,{});c(this,H,void 0);A(this,U,(0,l.generatePlayerInitTime)())}static get NAME(){return rt}static get VERSION(){return st}static get observedAttributes(){var t;return[...Rt,...(t=W.observedAttributes)!=null?t:[]]}get playerInitTime(){return this.hasAttribute(e.PLAYER_INIT_TIME)?+this.getAttribute(e.PLAYER_INIT_TIME):d(this,U)}set playerInitTime(t){t!=this.playerInitTime&&(t==null?this.removeAttribute(e.PLAYER_INIT_TIME):this.setAttribute(e.PLAYER_INIT_TIME,`${+t}`))}get playerSoftwareName(){return rt}get playerSoftwareVersion(){return st}get _hls(){var t;return(t=d(this,T))==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(e.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(e.DEBUG,""):this.removeAttribute(e.DEBUG))}get disableTracking(){return this.hasAttribute(e.DISABLE_TRACKING)}set disableTracking(t){t!==this.disableTracking&&this.toggleAttribute(e.DISABLE_TRACKING,!!t)}get disableCookies(){return this.hasAttribute(e.DISABLE_COOKIES)}set disableCookies(t){t!==this.disableCookies&&(t?this.setAttribute(e.DISABLE_COOKIES,""):this.removeAttribute(e.DISABLE_COOKIES))}get startTime(){let t=this.getAttribute(e.START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(e.START_TIME):this.setAttribute(e.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(e.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(e.PLAYBACK_ID,t):this.removeAttribute(e.PLAYBACK_ID))}get programStartTime(){let t=this.getAttribute(e.PROGRAM_START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set programStartTime(t){t==null?this.removeAttribute(e.PROGRAM_START_TIME):this.setAttribute(e.PROGRAM_START_TIME,`${t}`)}get programEndTime(){let t=this.getAttribute(e.PROGRAM_END_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set programEndTime(t){t==null?this.removeAttribute(e.PROGRAM_END_TIME):this.setAttribute(e.PROGRAM_END_TIME,`${t}`)}get assetStartTime(){let t=this.getAttribute(e.ASSET_START_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set assetStartTime(t){t==null?this.removeAttribute(e.ASSET_START_TIME):this.setAttribute(e.ASSET_START_TIME,`${t}`)}get assetEndTime(){let t=this.getAttribute(e.ASSET_END_TIME);if(t==null)return;let n=+t;return Number.isNaN(n)?void 0:n}set assetEndTime(t){t==null?this.removeAttribute(e.ASSET_END_TIME):this.setAttribute(e.ASSET_END_TIME,`${t}`)}get customDomain(){var t;return(t=this.getAttribute(e.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(e.CUSTOM_DOMAIN,t):this.removeAttribute(e.CUSTOM_DOMAIN))}get playbackToken(){var t,n,h,E;if(this.hasAttribute(e.PLAYBACK_TOKEN))return(t=this.getAttribute(e.PLAYBACK_TOKEN))!=null?t:void 0;if(this.hasAttribute(e.PLAYBACK_ID)){let[,C]=(0,l.toPlaybackIdParts)((n=this.playbackId)!=null?n:"");return(h=new URLSearchParams(C).get("token"))!=null?h:void 0}if(this.src)return(E=new URLSearchParams(this.src).get("token"))!=null?E:void 0}set playbackToken(t){t!==this.playbackToken&&(t?this.setAttribute(e.PLAYBACK_TOKEN,t):this.removeAttribute(e.PLAYBACK_TOKEN))}get tokens(){let t=this.getAttribute(e.PLAYBACK_TOKEN);return{...d(this,j),...t!=null?{playback:t}:{}}}set tokens(t){A(this,j,t!=null?t:{})}get ended(){return(0,l.getEnded)(this.nativeEl,this._hls)}get envKey(){var t;return(t=this.getAttribute(e.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(e.ENV_KEY,t):this.removeAttribute(e.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(e.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(e.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(e.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(e.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(e.STREAM_TYPE,t):this.removeAttribute(e.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(e.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(e.PREFER_PLAYBACK,t):this.removeAttribute(e.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(n=>n.startsWith("metadata-")&&![e.METADATA_URL].includes(n)).reduce((n,h)=>{let E=this.getAttribute(h);return E!=null&&(n[h.replace(/^metadata-/,"").replace(/-/g,"_")]=E),n},{}),...d(this,O)}}set metadata(t){A(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",d(this,O)))}get _hlsConfig(){return d(this,H)}set _hlsConfig(t){A(this,H,t)}load(){A(this,T,(0,l.initialize)(this,this.nativeEl,d(this,T)))}unload(){(0,l.teardown)(this.nativeEl,d(this,T)),A(this,T,void 0)}attributeChangedCallback(t,n,h){var C,p;switch(W.observedAttributes.includes(t)&&!["src","autoplay","preload"].includes(t)&&super.attributeChangedCallback(t,n,h),t){case"src":{let g=!!n,_=!!h;!g&&_?b(this,R,J).call(this):g&&!_?this.unload():g&&_&&(this.unload(),b(this,R,J).call(this));break}case"autoplay":if(h===n)break;(C=d(this,T))==null||C.setAutoplay(this.autoplay);break;case"preload":if(h===n)break;(p=d(this,T))==null||p.setPreload(h);break;case e.PLAYBACK_ID:this.src=(0,l.toMuxVideoURL)(this);break;case e.DEBUG:{let g=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=g);break}case e.METADATA_URL:h&&fetch(h).then(g=>g.json()).then(g=>this.metadata=g).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&&!d(this,T)&&b(this,R,J).call(this)}disconnectedCallback(){this.unload()}};T=new WeakMap,N=new WeakMap,U=new WeakMap,O=new WeakMap,j=new WeakMap,H=new WeakMap,R=new WeakSet,J=async function(){d(this,N)||(await A(this,N,Promise.resolve()),A(this,N,null),this.load())};z.customElements.get("mux-audio")||(z.customElements.define("mux-audio",G),z.MuxAudioElement=G);var vt=G; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -67,3 +67,3 @@ { | ||
"src/index.ts": { | ||
"bytes": 15363, | ||
"bytes": 15909, | ||
"imports": [ | ||
@@ -104,3 +104,3 @@ { | ||
"inputs": {}, | ||
"bytes": 2242762 | ||
"bytes": 2243553 | ||
}, | ||
@@ -114,2 +114,3 @@ "dist/mux-audio.mjs": { | ||
"default", | ||
"generatePlayerInitTime", | ||
"playerSoftwareName", | ||
@@ -139,8 +140,8 @@ "playerSoftwareVersion" | ||
"src/index.ts": { | ||
"bytesInOutput": 7365 | ||
"bytesInOutput": 7621 | ||
} | ||
}, | ||
"bytes": 528798 | ||
"bytes": 529083 | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { PlaybackTypes, MediaError } from '@mux/playback-core'; | ||
import { generatePlayerInitTime, PlaybackTypes, MediaError } from '@mux/playback-core'; | ||
import { ExtensionMimeTypeMap, Metadata, MuxMediaProps, PlaybackEngine, StreamTypes, ValueOf } from '@mux/playback-core'; | ||
@@ -6,2 +6,3 @@ import { CustomAudioElement, Events as AudioEvents } from 'custom-media-element'; | ||
export declare const Attributes: { | ||
readonly PLAYER_INIT_TIME: "player-init-time"; | ||
readonly ENV_KEY: "env-key"; | ||
@@ -33,3 +34,3 @@ readonly DEBUG: "debug"; | ||
constructor(); | ||
readonly playerInitTime: number; | ||
playerInitTime: number; | ||
readonly playerSoftwareName: string; | ||
@@ -83,3 +84,3 @@ readonly playerSoftwareVersion: string; | ||
} | ||
export { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents }; | ||
export { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents, generatePlayerInitTime, }; | ||
export default MuxAudioElement; |
@@ -1,2 +0,2 @@ | ||
import { PlaybackTypes, MediaError } from '@mux/playback-core'; | ||
import { generatePlayerInitTime, PlaybackTypes, MediaError } from '@mux/playback-core'; | ||
import type { ExtensionMimeTypeMap, Metadata, MuxMediaProps, PlaybackEngine, StreamTypes, ValueOf } from '@mux/playback-core'; | ||
@@ -6,2 +6,3 @@ import { CustomAudioElement, Events as AudioEvents } from 'custom-media-element'; | ||
export declare const Attributes: { | ||
readonly PLAYER_INIT_TIME: "player-init-time"; | ||
readonly ENV_KEY: "env-key"; | ||
@@ -34,2 +35,3 @@ readonly DEBUG: "debug"; | ||
get playerInitTime(): number; | ||
set playerInitTime(val: number); | ||
get playerSoftwareName(): string; | ||
@@ -108,3 +110,3 @@ get playerSoftwareVersion(): string; | ||
} | ||
export { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents }; | ||
export { PlaybackEngine, PlaybackEngine as Hls, ExtensionMimeTypeMap as MimeTypes, MediaError, AudioEvents, generatePlayerInitTime, }; | ||
export default MuxAudioElement; |
{ | ||
"name": "@mux/mux-audio", | ||
"version": "0.14.0-canary.0-2fbb2c1", | ||
"version": "0.14.0-canary.0-44b4261", | ||
"description": "A custom mux audio element for the browser that Just Works™", | ||
@@ -64,7 +64,6 @@ "keywords": [ | ||
"build": "npm-run-all --parallel 'build:esm --minify' 'build:iife --minify' 'build:cjs --minify' 'build:esm-module --minify'", | ||
"create-release-notes": "create-release-notes ./CHANGELOG.md", | ||
"publish-release": "../../scripts/publish.sh" | ||
}, | ||
"dependencies": { | ||
"@mux/playback-core": "0.27.0-canary.0-2fbb2c1", | ||
"@mux/playback-core": "0.27.0", | ||
"custom-media-element": "~1.4.1" | ||
@@ -78,3 +77,3 @@ }, | ||
"@web/dev-server-import-maps": "^0.2.1", | ||
"@web/test-runner": "^0.18.2", | ||
"@web/test-runner": "^0.19.0", | ||
"downlevel-dts": "^0.11.0", | ||
@@ -81,0 +80,0 @@ "esbuild": "^0.19.8", |
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
5730067
5081
+ Added@mux/playback-core@0.27.0(transitive)
+ Addedmux-embed@5.7.0(transitive)
- Removed@mux/playback-core@0.27.0-canary.0-2fbb2c1(transitive)
- Removedmux-embed@5.6.0(transitive)
Updated@mux/playback-core@0.27.0