@mux/mux-player 3.3.2-canary.3 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var ze=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||ze("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),T=(t,a,e)=>a.has(t)?ze("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),k=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),b=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},ge=class extends ${},St={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,fe=class{constructor(a,e={}){T(this,j);k(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function wt(t,a){return new G}var Xe={document:{createElement:wt},DocumentFragment,customElements:St,CustomEvent:fe,EventTarget:$,HTMLElement:G,HTMLVideoElement:ge},qe=typeof window=="undefined"||typeof globalThis.customElements=="undefined",E=qe?Xe:globalThis,Y=qe?Xe.document:globalThis.document;import{MediaController as ma,MediaErrorDialog as Rt}from"media-chrome";import{Attributes as Oe}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Tt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ca,{MediaError as Q,Attributes as s}from"@mux/mux-video";import{StreamTypes as M,PlaybackTypes as be,addTextTrack as pa,removeTextTrack as ba,CmcdTypeValues as Et,i18n as U,parseJwt as Me,MuxJWTAud as Le,generatePlayerInitTime as ha}from"@mux/playback-core";import{VideoEvents as Kt}from"@mux/mux-video";import{i18n as Ut}from"@mux/playback-core";import{StreamTypes as Te,parseJwt as Qe}from"@mux/playback-core";function Je(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ne(e)}: ${i}; `)}),a?a.trim():void 0}function ne(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=Pt(t).toString();return a?"?"+a:""}function Pt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var ve=(t,a)=>!t||!a?!1:t.contains(a)?!0:ve(t,a.getRootNode().host);var et="mux.com",It=()=>{try{return"3.3.1"}catch{}return"UNKNOWN"},Dt=It(),le=()=>Dt,tt=(t,{token:a,customDomain:e=et,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=Qe(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},at=(t,{token:a,customDomain:e=et,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=Qe(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([Te.LIVE,Te.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Te.LIVE}};var Vt={crossorigin:"crossOrigin",playsinline:"playsInline"};function it(t){var a;return(a=Vt[t])!=null?a:se(t)}var P,I,v,de=class{constructor(a,e){T(this,P);T(this,I);T(this,v,[]);k(this,P,a),k(this,I,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,I)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,I)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,I)}`,`${this.value}`)}contains(a){return u(this,v).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};P=new WeakMap,I=new WeakMap,v=new WeakMap;var rt=`[mux-player ${le()}]`;function O(...t){console.warn(rt,...t)}function A(...t){console.error(rt,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Ut("Read more: ")}
1
+ var ze=t=>{throw TypeError(t)};var he=(t,a,e)=>a.has(t)||ze("Cannot "+e);var u=(t,a,e)=>(he(t,a,"read from private field"),e?e.call(t):a.get(t)),T=(t,a,e)=>a.has(t)?ze("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(t):a.set(t,e),k=(t,a,e,i)=>(he(t,a,"write to private field"),i?i.call(t,e):a.set(t,e),e),b=(t,a,e)=>(he(t,a,"access private method"),e);var $=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class t extends ${}globalThis.DocumentFragment=t}var G=class extends ${},ge=class extends ${},St={get(t){},define(t,a,e){},getName(t){return null},upgrade(t){},whenDefined(t){return Promise.resolve(G)}},j,fe=class{constructor(a,e={}){T(this,j);k(this,j,e==null?void 0:e.detail)}get detail(){return u(this,j)}initCustomEvent(){}};j=new WeakMap;function wt(t,a){return new G}var Xe={document:{createElement:wt},DocumentFragment,customElements:St,CustomEvent:fe,EventTarget:$,HTMLElement:G,HTMLVideoElement:ge},qe=typeof window=="undefined"||typeof globalThis.customElements=="undefined",E=qe?Xe:globalThis,Y=qe?Xe.document:globalThis.document;import{MediaController as ma,MediaErrorDialog as Rt}from"media-chrome";import{Attributes as Oe}from"media-chrome/dist/media-container.js";import{MediaUIAttributes as Tt}from"media-chrome/dist/constants.js";import"media-chrome/dist/experimental/index.js";import ca,{MediaError as Q,Attributes as s}from"@mux/mux-video";import{StreamTypes as M,PlaybackTypes as be,addTextTrack as pa,removeTextTrack as ba,CmcdTypeValues as Et,i18n as U,parseJwt as Me,MuxJWTAud as Le,generatePlayerInitTime as ha}from"@mux/playback-core";import{VideoEvents as Kt}from"@mux/mux-video";import{i18n as Ut}from"@mux/playback-core";import{StreamTypes as Te,parseJwt as Qe}from"@mux/playback-core";function Je(t){let a="";return Object.entries(t).forEach(([e,i])=>{i!=null&&(a+=`${ne(e)}: ${i}; `)}),a?a.trim():void 0}function ne(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(t){return t.replace(/[-_]([a-z])/g,(a,e)=>e.toUpperCase())}function y(t){if(t==null)return;let a=+t;return Number.isNaN(a)?void 0:a}function ye(t){let a=Pt(t).toString();return a?"?"+a:""}function Pt(t){let a={};for(let e in t)t[e]!=null&&(a[e]=t[e]);return new URLSearchParams(a)}var ve=(t,a)=>!t||!a?!1:t.contains(a)?!0:ve(t,a.getRootNode().host);var et="mux.com",It=()=>{try{return"3.3.2"}catch{}return"UNKNOWN"},Dt=It(),le=()=>Dt,tt=(t,{token:a,customDomain:e=et,thumbnailTime:i,programTime:r}={})=>{var l;let n=a==null?i:void 0,{aud:d}=(l=Qe(a))!=null?l:{};if(!(a&&d!=="t"))return`https://image.${e}/${t}/thumbnail.webp${ye({token:a,time:n,program_time:r})}`},at=(t,{token:a,customDomain:e=et,programStartTime:i,programEndTime:r}={})=>{var d;let{aud:n}=(d=Qe(a))!=null?d:{};if(!(a&&n!=="s"))return`https://image.${e}/${t}/storyboard.vtt${ye({token:a,format:"webp",program_start_time:i,program_end_time:r})}`},z=t=>{if(t){if([Te.LIVE,Te.ON_DEMAND].includes(t))return t;if(t!=null&&t.includes("live"))return Te.LIVE}};var Vt={crossorigin:"crossOrigin",playsinline:"playsInline"};function it(t){var a;return(a=Vt[t])!=null?a:se(t)}var P,I,v,de=class{constructor(a,e){T(this,P);T(this,I);T(this,v,[]);k(this,P,a),k(this,I,e)}[Symbol.iterator](){return u(this,v).values()}get length(){return u(this,v).length}get value(){var a;return(a=u(this,v).join(" "))!=null?a:""}set value(a){var e;a!==this.value&&(k(this,v,[]),this.add(...(e=a==null?void 0:a.split(" "))!=null?e:[]))}toString(){return this.value}item(a){return u(this,v)[a]}values(){return u(this,v).values()}keys(){return u(this,v).keys()}forEach(a){u(this,v).forEach(a)}add(...a){var e,i;a.forEach(r=>{this.contains(r)||u(this,v).push(r)}),!(this.value===""&&!((e=u(this,P))!=null&&e.hasAttribute(`${u(this,I)}`)))&&((i=u(this,P))==null||i.setAttribute(`${u(this,I)}`,`${this.value}`))}remove(...a){var e;a.forEach(i=>{u(this,v).splice(u(this,v).indexOf(i),1)}),(e=u(this,P))==null||e.setAttribute(`${u(this,I)}`,`${this.value}`)}contains(a){return u(this,v).includes(a)}toggle(a,e){return typeof e!="undefined"?e?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,e){this.remove(a),this.add(e)}};P=new WeakMap,I=new WeakMap,v=new WeakMap;var rt=`[mux-player ${le()}]`;function O(...t){console.warn(rt,...t)}function A(...t){console.error(rt,...t)}function Ee(t){var e;let a=(e=t.message)!=null?e:"";t.context&&(a+=` ${t.context}`),t.file&&(a+=` ${Ut("Read more: ")}
2
2
  https://github.com/muxinc/elements/blob/main/errors/${t.file}`),O(a)}var f={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},D={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},nt=Object.freeze({length:0,start(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(t){let a=t>>>0;if(a>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${a}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),Ht=Kt.filter(t=>t!=="error"),Bt=Object.values(f).filter(t=>![f.PLAYSINLINE].includes(t)),$t=Object.values(D),Ae=class extends E.HTMLElement{static get observedAttributes(){return[...Bt,...$t]}constructor(){super()}init(){Ht.forEach(a=>{var e;(e=this.media)==null||e.addEventListener(a,i=>{this.dispatchEvent(new Event(i.type))})})}attributeChangedCallback(a,e,i){var r,n;switch(a){case D.MUTED:{this.media&&(this.media.muted=i!=null,this.media.defaultMuted=i!=null);return}case D.VOLUME:{let d=(r=y(i))!=null?r:1;this.media&&(this.media.volume=d);return}case D.PLAYBACKRATE:{let d=(n=y(i))!=null?n:1;this.media&&(this.media.playbackRate=d,this.media.defaultPlaybackRate=d);return}}}play(){var a,e;return(e=(a=this.media)==null?void 0:a.play())!=null?e:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}load(){var a;(a=this.media)==null||a.load()}requestCast(a){var e;return(e=this.media)==null?void 0:e.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.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 a,e;return(e=(a=this.media)==null?void 0:a.paused)!=null?e:!0}get duration(){var a,e;return(e=(a=this.media)==null?void 0:a.duration)!=null?e:NaN}get ended(){var a,e;return(e=(a=this.media)==null?void 0:a.ended)!=null?e:!1}get buffered(){var a,e;return(e=(a=this.media)==null?void 0:a.buffered)!=null?e:nt}get seekable(){var a,e;return(e=(a=this.media)==null?void 0:a.seekable)!=null?e:nt}get readyState(){var a,e;return(e=(a=this.media)==null?void 0:a.readyState)!=null?e:0}get videoWidth(){var a,e;return(e=(a=this.media)==null?void 0:a.videoWidth)!=null?e:0}get videoHeight(){var a,e;return(e=(a=this.media)==null?void 0:a.videoHeight)!=null?e:0}get currentSrc(){var a,e;return(e=(a=this.media)==null?void 0:a.currentSrc)!=null?e:""}get currentTime(){var a,e;return(e=(a=this.media)==null?void 0:a.currentTime)!=null?e:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,e;return(e=(a=this.media)==null?void 0:a.volume)!=null?e:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,e;return(e=(a=this.media)==null?void 0:a.playbackRate)!=null?e:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=y(this.getAttribute(D.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(D.PLAYBACKRATE,`${a}`):this.removeAttribute(D.PLAYBACKRATE)}get crossOrigin(){return X(this,f.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(f.CROSSORIGIN,`${a}`)}get autoplay(){return X(this,f.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(f.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(f.AUTOPLAY)}get loop(){return X(this,f.LOOP)!=null}set loop(a){a?this.setAttribute(f.LOOP,""):this.removeAttribute(f.LOOP)}get muted(){var a,e;return(e=(a=this.media)==null?void 0:a.muted)!=null?e:!1}set muted(a){this.media&&(this.media.muted=!!a)}get defaultMuted(){return X(this,f.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(f.MUTED,""):this.removeAttribute(f.MUTED)}get playsInline(){return X(this,f.PLAYSINLINE)!=null}set playsInline(a){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(a){["","none","metadata","auto"].includes(a)?this.setAttribute(f.PRELOAD,a):this.removeAttribute(f.PRELOAD)}};function X(t,a){return t.media?t.media.getAttribute(a):t.getAttribute(a)}var Ce=Ae;import"media-chrome/dist/media-theme-element.js";var st=`:host {
3
3
  --media-control-display: var(--controls);
4
4
  --media-loading-indicator-display: var(--loading-indicator);