@mux/mux-player 2.9.0 → 2.9.1
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
|
@@ -1560,7 +1560,7 @@ svg, img, ::slotted(svg), ::slotted(img) {
|
|
|
1560
1560
|
<path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
|
|
1561
1561
|
</svg>`,gp=c.createElement("template");gp.innerHTML=`
|
|
1562
1562
|
<slot name="icon">${Fb}</slot>
|
|
1563
|
-
`;var xu=class extends P{static get observedAttributes(){return[...super.observedAttributes,s.MEDIA_AUDIO_TRACK_ENABLED,s.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:gp})}get mediaAudioTrackEnabled(){return I(this,s.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){k(this,s.MEDIA_AUDIO_TRACK_ENABLED,e)}};l.customElements.get("media-audio-track-button")||l.customElements.define("media-audio-track-button",xu);var bo=class extends De{static get observedAttributes(){return[...super.observedAttributes,s.MEDIA_AUDIO_TRACK_ENABLED,s.MEDIA_AUDIO_TRACK_UNAVAILABLE]}init(){let e=c.createElement("media-audio-track-button");e.part.add("button"),e.preventClick=!0;let t=c.createElement("media-audio-track-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let a=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");a.textContent="",r.textContent="",a.append(e),r.append(t)}};l.customElements.get("media-audio-track-selectmenu")||l.customElements.define("media-audio-track-selectmenu",bo);var E=yv(require("@mux/mux-video")),Q=require("@mux/playback-core");var wp=require("@mux/mux-video");var Vb="en",ki={code:Vb};var _p="en";function C(i,e=!0){var r,n;let t=e&&(n=(r=ki)==null?void 0:r[i])!=null?n:i,a=e?ki.code:_p;return new Du(t,a)}var Du=class{constructor(e,t=(a=>(a=ki.code)!=null?a:_p)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,a)=>{var r;return(r=e[a])!=null?r:""})}toString(){return this.message}};function Ap(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${Eo(t)}: ${a}; `)}),e?e.trim():void 0}function Eo(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function go(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Oe(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Ou(i){let e=Kb(i).toString();return e?"?"+e:""}function Kb(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function qt(i){let e=(i!=null?i:"").split(".")[1];if(!e)return{};let t=e.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Pu=(i,e)=>!i||!e?!1:i.contains(e)?!0:Pu(i,e.getRootNode().host);var _o=require("@mux/playback-core");var yp="mux.com",Yb=()=>{try{return"2.9.
|
|
1563
|
+
`;var xu=class extends P{static get observedAttributes(){return[...super.observedAttributes,s.MEDIA_AUDIO_TRACK_ENABLED,s.MEDIA_AUDIO_TRACK_UNAVAILABLE]}constructor(){super({slotTemplate:gp})}get mediaAudioTrackEnabled(){return I(this,s.MEDIA_AUDIO_TRACK_ENABLED)}set mediaAudioTrackEnabled(e){k(this,s.MEDIA_AUDIO_TRACK_ENABLED,e)}};l.customElements.get("media-audio-track-button")||l.customElements.define("media-audio-track-button",xu);var bo=class extends De{static get observedAttributes(){return[...super.observedAttributes,s.MEDIA_AUDIO_TRACK_ENABLED,s.MEDIA_AUDIO_TRACK_UNAVAILABLE]}init(){let e=c.createElement("media-audio-track-button");e.part.add("button"),e.preventClick=!0;let t=c.createElement("media-audio-track-listbox");t.part.add("listbox"),t.setAttribute("exportparts","option, option-selected, indicator");let a=this.shadowRoot.querySelector("slot[name=button]"),r=this.shadowRoot.querySelector("slot[name=listbox]");a.textContent="",r.textContent="",a.append(e),r.append(t)}};l.customElements.get("media-audio-track-selectmenu")||l.customElements.define("media-audio-track-selectmenu",bo);var E=yv(require("@mux/mux-video")),Q=require("@mux/playback-core");var wp=require("@mux/mux-video");var Vb="en",ki={code:Vb};var _p="en";function C(i,e=!0){var r,n;let t=e&&(n=(r=ki)==null?void 0:r[i])!=null?n:i,a=e?ki.code:_p;return new Du(t,a)}var Du=class{constructor(e,t=(a=>(a=ki.code)!=null?a:_p)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,a)=>{var r;return(r=e[a])!=null?r:""})}toString(){return this.message}};function Ap(i){let e="";return Object.entries(i).forEach(([t,a])=>{a!=null&&(e+=`${Eo(t)}: ${a}; `)}),e?e.trim():void 0}function Eo(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function go(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Oe(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Ou(i){let e=Kb(i).toString();return e?"?"+e:""}function Kb(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}function qt(i){let e=(i!=null?i:"").split(".")[1];if(!e)return{};let t=e.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Pu=(i,e)=>!i||!e?!1:i.contains(e)?!0:Pu(i,e.getRootNode().host);var _o=require("@mux/playback-core");var yp="mux.com",Yb=()=>{try{return"2.9.1"}catch{}return"UNKNOWN"},Gb=Yb(),yo=()=>Gb,Tp=(i,{token:e,customDomain:t=yp,thumbnailTime:a,programTime:r}={})=>{let n=e==null?a:void 0,{aud:o}=qt(e);if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Ou({token:e,time:n,program_time:r})}`},kp=(i,{token:e,customDomain:t=yp,programStartTime:a,programEndTime:r}={})=>{let{aud:n}=qt(e);if(!(e&&n!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Ou({token:e,format:"webp",program_start_time:a,program_end_time:r})}`},Sr=i=>{if(i){if([_o.StreamTypes.LIVE,_o.StreamTypes.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return _o.StreamTypes.LIVE}};var qb={crossorigin:"crossOrigin",playsinline:"playsInline"};function Sp(i){var e;return(e=qb[i])!=null?e:go(i)}var Si,Ii,pe,Ao=class{constructor(e,t){z(this,Si,void 0);z(this,Ii,void 0);z(this,pe,[]);Ce(this,Si,e),Ce(this,Ii,t)}[Symbol.iterator](){return L(this,pe).values()}get length(){return L(this,pe).length}get value(){var e;return(e=L(this,pe).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Ce(this,pe,[]),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return L(this,pe)[e]}values(){return L(this,pe).values()}keys(){return L(this,pe).keys()}forEach(e){L(this,pe).forEach(e)}add(...e){var t,a;e.forEach(r=>{this.contains(r)||L(this,pe).push(r)}),!(this.value===""&&!((t=L(this,Si))!=null&&t.hasAttribute(`${L(this,Ii)}`)))&&((a=L(this,Si))==null||a.setAttribute(`${L(this,Ii)}`,`${this.value}`))}remove(...e){var t;e.forEach(a=>{L(this,pe).splice(L(this,pe).indexOf(a),1)}),(t=L(this,Si))==null||t.setAttribute(`${L(this,Ii)}`,`${this.value}`)}contains(e){return L(this,pe).includes(e)}toggle(e,t){return typeof t!="undefined"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};Si=new WeakMap,Ii=new WeakMap,pe=new WeakMap;var Ip=`[mux-player ${yo()}]`;function Zt(...i){console.warn(Ip,...i)}function Ie(...i){console.error(Ip,...i)}function Nu(i){var t;let e=(t=i.message)!=null?t:"";if(i.context&&(e+=` ${i.context}`),i.file){let a="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${C("Read more: ")}
|
|
1564
1564
|
${a}${i.file}`}Zt(e)}var he={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Ci={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Mp=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Zb=wp.VideoEvents.filter(i=>i!=="error"),Qb=Object.values(he).filter(i=>![he.PLAYSINLINE].includes(i)),zb=Object.values(Ci),ha,Uu=class extends q.HTMLElement{constructor(){super();z(this,ha,new WeakMap);let t=r=>{for(let n of r)n.type==="childList"&&(n.removedNodes.forEach(o=>{var d;(d=L(this,ha).get(o))==null||d.remove()}),n.addedNodes.forEach(o=>{var u;let d=o;d!=null&&d.slot||(u=this.media)==null||u.append(Lp(L(this,ha),o))}))};new MutationObserver(t).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return[...Qb,...zb]}init(){this.querySelectorAll(":scope > :not([slot])").forEach(t=>{var a;(a=this.media)==null||a.append(Lp(L(this,ha),t))}),Zb.forEach(t=>{var a;(a=this.media)==null||a.addEventListener(t,r=>{this.dispatchEvent(new Event(r.type))})})}attributeChangedCallback(t,a,r){var n,o;switch(t){case Ci.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case Ci.VOLUME:{let d=(n=Oe(r))!=null?n:1;this.media&&(this.media.volume=d);return}case Ci.PLAYBACKRATE:{let d=(o=Oe(r))!=null?o:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var t,a;return(a=(t=this.media)==null?void 0:t.play())!=null?a:Promise.reject()}pause(){var t;(t=this.media)==null||t.pause()}load(){var t;(t=this.media)==null||t.load()}requestCast(t){var a;return(a=this.media)==null?void 0:a.requestCast(t)}get media(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var t,a;return(a=(t=this.media)==null?void 0:t.paused)!=null?a:!0}get duration(){var t,a;return(a=(t=this.media)==null?void 0:t.duration)!=null?a:NaN}get ended(){var t,a;return(a=(t=this.media)==null?void 0:t.ended)!=null?a:!1}get buffered(){var t,a;return(a=(t=this.media)==null?void 0:t.buffered)!=null?a:Mp}get seekable(){var t,a;return(a=(t=this.media)==null?void 0:t.seekable)!=null?a:Mp}get readyState(){var t,a;return(a=(t=this.media)==null?void 0:t.readyState)!=null?a:0}get videoWidth(){var t,a;return(a=(t=this.media)==null?void 0:t.videoWidth)!=null?a:0}get videoHeight(){var t,a;return(a=(t=this.media)==null?void 0:t.videoHeight)!=null?a:0}get currentSrc(){var t,a;return(a=(t=this.media)==null?void 0:t.currentSrc)!=null?a:""}get currentTime(){var t,a;return(a=(t=this.media)==null?void 0:t.currentTime)!=null?a:0}set currentTime(t){this.media&&(this.media.currentTime=Number(t))}get volume(){var t,a;return(a=(t=this.media)==null?void 0:t.volume)!=null?a:1}set volume(t){this.media&&(this.media.volume=Number(t))}get playbackRate(){var t,a;return(a=(t=this.media)==null?void 0:t.playbackRate)!=null?a:1}set playbackRate(t){this.media&&(this.media.playbackRate=Number(t))}get defaultPlaybackRate(){var t;return(t=Oe(this.getAttribute(Ci.PLAYBACKRATE)))!=null?t:1}set defaultPlaybackRate(t){t!=null?this.setAttribute(Ci.PLAYBACKRATE,`${t}`):this.removeAttribute(Ci.PLAYBACKRATE)}get crossOrigin(){return Ir(this,he.CROSSORIGIN)}set crossOrigin(t){this.setAttribute(he.CROSSORIGIN,`${t}`)}get autoplay(){return Ir(this,he.AUTOPLAY)!=null}set autoplay(t){t?this.setAttribute(he.AUTOPLAY,typeof t=="string"?t:""):this.removeAttribute(he.AUTOPLAY)}get loop(){return Ir(this,he.LOOP)!=null}set loop(t){t?this.setAttribute(he.LOOP,""):this.removeAttribute(he.LOOP)}get muted(){var t,a;return(a=(t=this.media)==null?void 0:t.muted)!=null?a:!1}set muted(t){this.media&&(this.media.muted=!!t)}get defaultMuted(){return Ir(this,he.MUTED)!=null}set defaultMuted(t){t?this.setAttribute(he.MUTED,""):this.removeAttribute(he.MUTED)}get playsInline(){return Ir(this,he.PLAYSINLINE)!=null}set playsInline(t){Ie("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(t){["","none","metadata","auto"].includes(t)?this.setAttribute(he.PRELOAD,t):this.removeAttribute(he.PRELOAD)}};ha=new WeakMap;function Ir(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}function Lp(i,e){let t=i.get(e);return t||(t=e.cloneNode(),i.set(e,t)),t}var Bu=Uu;var Xb=Object.defineProperty,Jb=(i,e,t)=>e in i?Xb(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,jb=(i,e,t)=>(Jb(i,typeof e!="symbol"?e+"":e,t),t),Pp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},S=(i,e,t)=>(Pp(i,e,"read from private field"),t?t.call(i):e.get(i)),Et=(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)},Mt=(i,e,t,a)=>(Pp(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),pa,To,Mi,Cr,Qt,zt,Xt,Li,va,ko,Qe,Rp=1,xp=0,e0=1,t0={processCallback(i,e,t){if(t){for(let[a,r]of e)if(a in t){let n=t[a];typeof n=="boolean"&&r instanceof ve&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof ve?r.element[r.attributeName]=n:r.value=n}}}},Lt=class extends l.DocumentFragment{constructor(e,t,a=t0){var r;super(),Et(this,pa,void 0),Et(this,To,void 0),this.append(e.content.cloneNode(!0)),Mt(this,pa,Np(this)),Mt(this,To,a),(r=a.createCallback)==null||r.call(a,this,S(this,pa),t),a.processCallback(this,S(this,pa),t)}update(e){S(this,To).processCallback(this,S(this,pa),e)}};pa=new WeakMap;To=new WeakMap;var Np=(i,e=[])=>{let t,a;for(let r of i.attributes||[])if(r.value.includes("{{")){let n=new Wu;for([t,a]of Op(r.value))if(!t)n.append(a);else{let o=new ve(i,r.name,r.namespaceURI);n.append(o),e.push([a,o])}r.value=n.toString()}for(let r of i.childNodes)if(r.nodeType===Rp&&!(r instanceof HTMLTemplateElement))Np(r,e);else if(r.nodeType===Rp||r.data.includes("{{")){let n=[];if(r.data)for([t,a]of Op(r.data))if(!t)n.push(new Text(a));else{let o=new wt(i);n.push(o),e.push([a,o])}else if(r instanceof HTMLTemplateElement){let o=new Mr(i,r);n.push(o),e.push([o.expression,o])}r.replaceWith(...n.flatMap(o=>o.replacementNodes||[o]))}return e},Dp={},Op=i=>{let e="",t=0,a=Dp[i],r=0,n;if(a)return a;for(a=[];n=i[r];r++)n==="{"&&i[r+1]==="{"&&i[r-1]!=="\\"&&i[r+2]&&++t==1?(e&&a.push([xp,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(a.push([e0,e.trim()]),e="",r++):e+=n||"";return e&&a.push([xp,(t>0?"{{":"")+e]),Dp[i]=a},i0=11,So=class{get value(){return""}set value(e){}toString(){return this.value}},Up=new WeakMap,Wu=class{constructor(){Et(this,Mi,[])}[Symbol.iterator](){return S(this,Mi).values()}get length(){return S(this,Mi).length}item(e){return S(this,Mi)[e]}append(...e){for(let t of e)t instanceof ve&&Up.set(t,this),S(this,Mi).push(t)}toString(){return S(this,Mi).join("")}};Mi=new WeakMap;var ve=class extends So{constructor(e,t,a){super(),Et(this,Li),Et(this,Cr,""),Et(this,Qt,void 0),Et(this,zt,void 0),Et(this,Xt,void 0),Mt(this,Qt,e),Mt(this,zt,t),Mt(this,Xt,a)}get attributeName(){return S(this,zt)}get attributeNamespace(){return S(this,Xt)}get element(){return S(this,Qt)}get value(){return S(this,Cr)}set value(e){S(this,Cr)!==e&&(Mt(this,Cr,e),!S(this,Li,va)||S(this,Li,va).length===1?e==null?S(this,Qt).removeAttributeNS(S(this,Xt),S(this,zt)):S(this,Qt).setAttributeNS(S(this,Xt),S(this,zt),e):S(this,Qt).setAttributeNS(S(this,Xt),S(this,zt),S(this,Li,va)))}get booleanValue(){return S(this,Qt).hasAttributeNS(S(this,Xt),S(this,zt))}set booleanValue(e){if(!S(this,Li,va)||S(this,Li,va).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};Cr=new WeakMap;Qt=new WeakMap;zt=new WeakMap;Xt=new WeakMap;Li=new WeakSet;va=function(){return Up.get(this)};var wt=class extends So{constructor(e,t){super(),Et(this,ko,void 0),Et(this,Qe,void 0),Mt(this,ko,e),Mt(this,Qe,t?[...t]:[new Text])}get replacementNodes(){return S(this,Qe)}get parentNode(){return S(this,ko)}get nextSibling(){return S(this,Qe)[S(this,Qe).length-1].nextSibling}get previousSibling(){return S(this,Qe)[0].previousSibling}get value(){return S(this,Qe).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){let t=e.flat().flatMap(a=>a==null?[new Text]:a.forEach?[...a]:a.nodeType===i0?[...a.childNodes]:a.nodeType?[a]:[new Text(a)]);t.length||t.push(new Text),Mt(this,Qe,a0(S(this,Qe)[0].parentNode,S(this,Qe),t,this.nextSibling))}};ko=new WeakMap;Qe=new WeakMap;var Mr=class extends wt{constructor(e,t){let a=t.getAttribute("directive")||t.getAttribute("type"),r=t.getAttribute("expression")||t.getAttribute(a)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),jb(this,"directive"),this.expression=r,this.template=t,this.directive=a}};function a0(i,e,t,a=null){let r=0,n,o,d,u=t.length,m=e.length;for(;r<u&&r<m&&e[r]==t[r];)r++;for(;r<u&&r<m&&t[u-1]==e[m-1];)a=t[--m,--u];if(r==m)for(;r<u;)i.insertBefore(t[r++],a);if(r==u)for(;r<m;)i.removeChild(e[r++]);else{for(n=e[r];r<u;)d=t[r++],o=n?n.nextSibling:a,n==d?n=o:r<u&&t[r]==o?(i.replaceChild(d,n),n=o):i.insertBefore(d,n);for(;n!=a;)o=n.nextSibling,i.removeChild(n),n=o}return t}var Bp={string:i=>String(i)},Co=class{constructor(e){this.template=e,this.state=void 0}},wi=new WeakMap,Ri=new WeakMap,Hu={partial:(i,e)=>{e[i.expression]=new Co(i.template)},if:(i,e)=>{var t;if(Hp(i.expression,e))if(wi.get(i)!==i.template){wi.set(i,i.template);let a=new Lt(i.template,e,Mo);i.replace(a),Ri.set(i,a)}else(t=Ri.get(i))==null||t.update(e);else i.replace(""),wi.delete(i),Ri.delete(i)}},r0=Object.keys(Hu),Mo={processCallback(i,e,t){var a,r;if(t)for(let[n,o]of e){if(o instanceof Mr){if(!o.directive){let u=r0.find(m=>o.template.hasAttribute(m));u&&(o.directive=u,o.expression=o.template.getAttribute(u))}(a=Hu[o.directive])==null||a.call(Hu,o,t);continue}let d=Hp(n,t);if(d instanceof Co){wi.get(o)!==d.template?(wi.set(o,d.template),d=new Lt(d.template,d.state,Mo),o.value=d,Ri.set(o,d)):(r=Ri.get(o))==null||r.update(d.state);continue}d?(o instanceof ve&&o.attributeName.startsWith("aria-")&&(d=String(d)),o instanceof ve?typeof d=="boolean"?o.booleanValue=d:typeof d=="function"?o.element[o.attributeName]=d:o.value=d:(o.value=d,wi.delete(o),Ri.delete(o))):o instanceof ve?o.value=void 0:(o.value=void 0,wi.delete(o),Ri.delete(o))}}},Wp={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e,"??":(i,e)=>i!=null?i:e,"|":(i,e)=>{var t;return(t=Bp[e])==null?void 0:t.call(Bp,i)}};function n0(i){return s0(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function Hp(i,e={}){var t,a,r,n,o,d,u;let m=n0(i);if(m.length===0||m.some(({type:f})=>!f))return Lr(i);if(((t=m[0])==null?void 0:t.token)===">"){let f=e[(a=m[1])==null?void 0:a.token];if(!f)return Lr(i);let g={...e};f.state=g;let v=m.slice(2);for(let b=0;b<v.length;b+=3){let R=(r=v[b])==null?void 0:r.token,A=(n=v[b+1])==null?void 0:n.token,T=(o=v[b+2])==null?void 0:o.token;R&&A==="="&&(g[R]=wr(T,e))}return f}if(m.length===1)return Io(m[0])?wr(m[0].token,e):Lr(i);if(m.length===2){let f=(d=m[0])==null?void 0:d.token,g=Wp[f];if(!g||!Io(m[1]))return Lr(i);let v=wr(m[1].token,e);return g(v)}if(m.length===3){let f=(u=m[1])==null?void 0:u.token,g=Wp[f];if(!g||!Io(m[0])||!Io(m[2]))return Lr(i);let v=wr(m[0].token,e);if(f==="|")return g(v,m[2].token);let b=wr(m[2].token,e);return g(v,b)}}function Lr(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function Io({type:i}){return["number","boolean","string","param"].includes(i)}function wr(i,e){let t=i[0],a=i.slice(-1);return i==="true"||i==="false"?i==="true":t===a&&["'",'"'].includes(t)?i.slice(1,-1):Gr(i)?parseFloat(i):e[i]}function s0(i,e){let t,a,r,n=[];for(;i;){r=null,t=i.length;for(let o in e)a=e[o].exec(i),a&&a.index<t&&(r={token:a[0],type:o,matches:a.slice(1)},t=a.index);t&&n.push({token:i.substr(0,t),type:void 0}),r&&n.push(r),i=i.substr(t+(r?r.token.length:0))}return n}var o0=Object.defineProperty,l0=(i,e,t)=>e in i?o0(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,xr=(i,e,t)=>(l0(i,typeof e!="symbol"?e+"":e,t),t),Gu=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Vu=(i,e,t)=>(Gu(i,e,"read from private field"),t?t.call(i):e.get(i)),Rr=(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)},xi=(i,e,t,a)=>(Gu(i,e,"write to private field"),a?a.call(i,t):e.set(i,t),t),$u=(i,e,t)=>(Gu(i,e,"access private method"),t),fa,Lo,ba,Ku,$p,wo,Yu,Fu={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Fp=c.createElement("template");Fp.innerHTML=`
|
|
1565
1565
|
<style>
|
|
1566
1566
|
:host {
|
|
@@ -2242,7 +2242,10 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
2242
2242
|
[breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])
|
|
2243
2243
|
.center-controls.pre-playback
|
|
2244
2244
|
media-play-button {
|
|
2245
|
-
animation
|
|
2245
|
+
/* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */
|
|
2246
|
+
animation: 0.3s linear pre-play-hide;
|
|
2247
|
+
opacity: 0;
|
|
2248
|
+
pointer-events: none;
|
|
2246
2249
|
}
|
|
2247
2250
|
|
|
2248
2251
|
.autoplay-unmute {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xe=(t,i,e)=>{if(!i.has(t))throw TypeError("Cannot "+e)};var u=(t,i,e)=>(xe(t,i,"read from private field"),e?e.call(t):i.get(t)),p=(t,i,e)=>{if(i.has(t))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(t):i.set(t,e)},x=(t,i,e,a)=>(xe(t,i,"write to private field"),a?a.call(t,e):i.set(t,e),e);var b=(t,i,e)=>(xe(t,i,"access private method"),e);var G=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class t extends G{}globalThis.DocumentFragment=t}var X=class extends G{},Le=class extends G{},Ft={get(t){},define(t,i,e){},upgrade(t){},whenDefined(t){return Promise.resolve(X)}},J,Re=class{constructor(i,e={}){p(this,J,void 0);x(this,J,e==null?void 0:e.detail)}get detail(){return u(this,J)}initCustomEvent(){}};J=new WeakMap;function Yt(t,i){return new X}var dt={document:{createElement:Yt},DocumentFragment,customElements:Ft,CustomEvent:Re,EventTarget:G,HTMLElement:X,HTMLVideoElement:Le},lt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=lt?dt:globalThis,T=lt?dt.document:globalThis.document;import{MediaController as Ea}from"media-chrome";import{Attributes as Be}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Nt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ka,{MediaError as ye,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ve,addTextTrack as Ta,removeTextTrack as Aa,CmcdTypeValues as It}from"@mux/playback-core";import{VideoEvents as zt}from"@mux/mux-video";var Wt="en",U={code:Wt};var mt="en";function m(t,i=!0){var r,o;let e=i&&(o=(r=U)==null?void 0:r[t])!=null?o:t,a=i?U.code:mt;return new we(e,a)}var we=class{constructor(i,e=(a=>(a=U.code)!=null?a:mt)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var r;return(r=i[a])!=null?r:""})}toString(){return this.message}};function ut(t){let i="";return Object.entries(t).forEach(([e,a])=>{a!=null&&(i+=`${de(e)}: ${a}; `)}),i?i.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function le(t){return t.replace(/[-_]([a-z])/g,(i,e)=>e.toUpperCase())}function L(t){if(t==null)return;let i=+t;return Number.isNaN(i)?void 0:i}function Oe(t){let i=Zt(t).toString();return i?"?"+i:""}function Zt(t){let i={};for(let e in t)t[e]!=null&&(i[e]=t[e]);return new URLSearchParams(i)}function N(t){let i=(t!=null?t:"").split(".")[1];if(!i)return{};let e=i.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Se=(t,i)=>!t||!i?!1:t.contains(i)?!0:Se(t,i.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var ct="mux.com",Gt=()=>{try{return"2.9.
|
|
1
|
+
var xe=(t,i,e)=>{if(!i.has(t))throw TypeError("Cannot "+e)};var u=(t,i,e)=>(xe(t,i,"read from private field"),e?e.call(t):i.get(t)),p=(t,i,e)=>{if(i.has(t))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(t):i.set(t,e)},x=(t,i,e,a)=>(xe(t,i,"write to private field"),a?a.call(t,e):i.set(t,e),e);var b=(t,i,e)=>(xe(t,i,"access private method"),e);var G=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment=="undefined"){class t extends G{}globalThis.DocumentFragment=t}var X=class extends G{},Le=class extends G{},Ft={get(t){},define(t,i,e){},upgrade(t){},whenDefined(t){return Promise.resolve(X)}},J,Re=class{constructor(i,e={}){p(this,J,void 0);x(this,J,e==null?void 0:e.detail)}get detail(){return u(this,J)}initCustomEvent(){}};J=new WeakMap;function Yt(t,i){return new X}var dt={document:{createElement:Yt},DocumentFragment,customElements:Ft,CustomEvent:Re,EventTarget:G,HTMLElement:X,HTMLVideoElement:Le},lt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",c=lt?dt:globalThis,T=lt?dt.document:globalThis.document;import{MediaController as Ea}from"media-chrome";import{Attributes as Be}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Nt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ka,{MediaError as ye,Attributes as d}from"@mux/mux-video";import{StreamTypes as w,PlaybackTypes as ve,addTextTrack as Ta,removeTextTrack as Aa,CmcdTypeValues as It}from"@mux/playback-core";import{VideoEvents as zt}from"@mux/mux-video";var Wt="en",U={code:Wt};var mt="en";function m(t,i=!0){var r,o;let e=i&&(o=(r=U)==null?void 0:r[t])!=null?o:t,a=i?U.code:mt;return new we(e,a)}var we=class{constructor(i,e=(a=>(a=U.code)!=null?a:mt)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,a)=>{var r;return(r=i[a])!=null?r:""})}toString(){return this.message}};function ut(t){let i="";return Object.entries(t).forEach(([e,a])=>{a!=null&&(i+=`${de(e)}: ${a}; `)}),i?i.trim():void 0}function de(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function le(t){return t.replace(/[-_]([a-z])/g,(i,e)=>e.toUpperCase())}function L(t){if(t==null)return;let i=+t;return Number.isNaN(i)?void 0:i}function Oe(t){let i=Zt(t).toString();return i?"?"+i:""}function Zt(t){let i={};for(let e in t)t[e]!=null&&(i[e]=t[e]);return new URLSearchParams(i)}function N(t){let i=(t!=null?t:"").split(".")[1];if(!i)return{};let e=i.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}var Se=(t,i)=>!t||!i?!1:t.contains(i)?!0:Se(t,i.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var ct="mux.com",Gt=()=>{try{return"2.9.1"}catch{}return"UNKNOWN"},jt=Gt(),ue=()=>jt,pt=(t,{token:i,customDomain:e=ct,thumbnailTime:a,programTime:r}={})=>{let o=i==null?a:void 0,{aud:s}=N(i);if(!(i&&s!=="t"))return`https://image.${e}/${t}/thumbnail.webp${Oe({token:i,time:o,program_time:r})}`},bt=(t,{token:i,customDomain:e=ct,programStartTime:a,programEndTime:r}={})=>{let{aud:o}=N(i);if(!(i&&o!=="s"))return`https://image.${e}/${t}/storyboard.vtt${Oe({token:i,format:"webp",program_start_time:a,program_end_time:r})}`},Q=t=>{if(t){if([Me.LIVE,Me.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Me.LIVE}};var qt={crossorigin:"crossOrigin",playsinline:"playsInline"};function ht(t){var i;return(i=qt[t])!=null?i:le(t)}var K,$,E,me=class{constructor(i,e){p(this,K,void 0);p(this,$,void 0);p(this,E,[]);x(this,K,i),x(this,$,e)}[Symbol.iterator](){return u(this,E).values()}get length(){return u(this,E).length}get value(){var i;return(i=u(this,E).join(" "))!=null?i:""}set value(i){var e;i!==this.value&&(x(this,E,[]),this.add(...(e=i==null?void 0:i.split(" "))!=null?e:[]))}toString(){return this.value}item(i){return u(this,E)[i]}values(){return u(this,E).values()}keys(){return u(this,E).keys()}forEach(i){u(this,E).forEach(i)}add(...i){var e,a;i.forEach(r=>{this.contains(r)||u(this,E).push(r)}),!(this.value===""&&!((e=u(this,K))!=null&&e.hasAttribute(`${u(this,$)}`)))&&((a=u(this,K))==null||a.setAttribute(`${u(this,$)}`,`${this.value}`))}remove(...i){var e;i.forEach(a=>{u(this,E).splice(u(this,E).indexOf(a),1)}),(e=u(this,K))==null||e.setAttribute(`${u(this,$)}`,`${this.value}`)}contains(i){return u(this,E).includes(i)}toggle(i,e){return typeof e!="undefined"?e?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,e){this.remove(i),this.add(e)}};K=new WeakMap,$=new WeakMap,E=new WeakMap;var gt=`[mux-player ${ue()}]`;function I(...t){console.warn(gt,...t)}function A(...t){console.error(gt,...t)}function _e(t){var e;let i=(e=t.message)!=null?e:"";if(t.context&&(i+=` ${t.context}`),t.file){let a="https://github.com/muxinc/elements/blob/main/errors/";i+=` ${m("Read more: ")}
|
|
2
2
|
${a}${t.file}`}I(i)}var y={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},F={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},yt=Object.freeze({length:0,start(t){let i=t>>>0;if(i>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${i}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let i=t>>>0;if(i>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${i}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Xt=zt.filter(t=>t!=="error"),Jt=Object.values(y).filter(t=>![y.PLAYSINLINE].includes(t)),Qt=Object.values(F),j,Pe=class extends c.HTMLElement{constructor(){super();p(this,j,new WeakMap);let e=r=>{for(let o of r)o.type==="childList"&&(o.removedNodes.forEach(s=>{var l;(l=u(this,j).get(s))==null||l.remove()}),o.addedNodes.forEach(s=>{var h;let l=s;l!=null&&l.slot||(h=this.media)==null||h.append(vt(u(this,j),s))}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0})}static get observedAttributes(){return[...Jt,...Qt]}init(){this.querySelectorAll(":scope > :not([slot])").forEach(e=>{var a;(a=this.media)==null||a.append(vt(u(this,j),e))}),Xt.forEach(e=>{var a;(a=this.media)==null||a.addEventListener(e,r=>{this.dispatchEvent(new Event(r.type))})})}attributeChangedCallback(e,a,r){var o,s;switch(e){case F.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case F.VOLUME:{let l=(o=L(r))!=null?o:1;this.media&&(this.media.volume=l);return}case F.PLAYBACKRATE:{let l=(s=L(r))!=null?s:1;this.media&&(this.media.playbackRate=l,this.media.defaultPlaybackRate=l);return}}}play(){var e,a;return(a=(e=this.media)==null?void 0:e.play())!=null?a:Promise.reject()}pause(){var e;(e=this.media)==null||e.pause()}load(){var e;(e=this.media)==null||e.load()}requestCast(e){var a;return(a=this.media)==null?void 0:a.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var e,a;return(a=(e=this.media)==null?void 0:e.paused)!=null?a:!0}get duration(){var e,a;return(a=(e=this.media)==null?void 0:e.duration)!=null?a:NaN}get ended(){var e,a;return(a=(e=this.media)==null?void 0:e.ended)!=null?a:!1}get buffered(){var e,a;return(a=(e=this.media)==null?void 0:e.buffered)!=null?a:yt}get seekable(){var e,a;return(a=(e=this.media)==null?void 0:e.seekable)!=null?a:yt}get readyState(){var e,a;return(a=(e=this.media)==null?void 0:e.readyState)!=null?a:0}get videoWidth(){var e,a;return(a=(e=this.media)==null?void 0:e.videoWidth)!=null?a:0}get videoHeight(){var e,a;return(a=(e=this.media)==null?void 0:e.videoHeight)!=null?a:0}get currentSrc(){var e,a;return(a=(e=this.media)==null?void 0:e.currentSrc)!=null?a:""}get currentTime(){var e,a;return(a=(e=this.media)==null?void 0:e.currentTime)!=null?a:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,a;return(a=(e=this.media)==null?void 0:e.volume)!=null?a:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,a;return(a=(e=this.media)==null?void 0:e.playbackRate)!=null?a:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return(e=L(this.getAttribute(F.PLAYBACKRATE)))!=null?e:1}set defaultPlaybackRate(e){e!=null?this.setAttribute(F.PLAYBACKRATE,`${e}`):this.removeAttribute(F.PLAYBACKRATE)}get crossOrigin(){return ee(this,y.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(y.CROSSORIGIN,`${e}`)}get autoplay(){return ee(this,y.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(y.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(y.AUTOPLAY)}get loop(){return ee(this,y.LOOP)!=null}set loop(e){e?this.setAttribute(y.LOOP,""):this.removeAttribute(y.LOOP)}get muted(){var e,a;return(a=(e=this.media)==null?void 0:e.muted)!=null?a:!1}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return ee(this,y.MUTED)!=null}set defaultMuted(e){e?this.setAttribute(y.MUTED,""):this.removeAttribute(y.MUTED)}get playsInline(){return ee(this,y.PLAYSINLINE)!=null}set playsInline(e){A("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(e){["","none","metadata","auto"].includes(e)?this.setAttribute(y.PRELOAD,e):this.removeAttribute(y.PRELOAD)}};j=new WeakMap;function ee(t,i){return t.media?t.media.getAttribute(i):t.getAttribute(i)}function vt(t,i){let e=t.get(i);return e||(e=i.cloneNode(),t.set(i,e)),e}var Ne=Pe;import"media-chrome/dist/media-theme-element.js";var Et=`:host {
|
|
3
3
|
--media-control-display: var(--controls);
|
|
4
4
|
--media-loading-indicator-display: var(--loading-indicator);
|
|
@@ -656,7 +656,10 @@ media-poster-image:not([src]):not([placeholdersrc]) {
|
|
|
656
656
|
[breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])
|
|
657
657
|
.center-controls.pre-playback
|
|
658
658
|
media-play-button {
|
|
659
|
-
animation
|
|
659
|
+
/* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */
|
|
660
|
+
animation: 0.3s linear pre-play-hide;
|
|
661
|
+
opacity: 0;
|
|
662
|
+
pointer-events: none;
|
|
660
663
|
}
|
|
661
664
|
|
|
662
665
|
.autoplay-unmute {
|