@mux/mux-player 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +180 -180
- package/dist/index.mjs +1 -1
- package/dist/mux-player.js +166 -166
- package/dist/mux-player.mjs +166 -166
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,r)=>(et(e,a,"write to private field"),r?r.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ie=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ie{}globalThis.DocumentFragment=e}var ge=class extends ie{},tt=class extends ie{},li={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(ge)}},fe,at=class{constructor(a,t={}){h(this,fe,void 0);A(this,fe,t==null?void 0:t.detail)}get detail(){return d(this,fe)}initCustomEvent(){}};fe=new WeakMap;function di(e,a){return new ge}var Bt={document:{createElement:di},DocumentFragment,customElements:li,CustomEvent:at,EventTarget:ie,HTMLElement:ge,HTMLVideoElement:tt},Kt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Kt?Bt:globalThis,S=Kt?Bt.document:globalThis.document;import{MediaController as hr}from"media-chrome";import br,{MediaError as gt,Attributes as u}from"@mux/mux-video";import{StreamTypes as B,PlaybackTypes as Ye,addTextTrack as pr,removeTextTrack as gr}from"@mux/playback-core";import{VideoEvents as vi}from"@mux/mux-video";var mi="en",W={code:mi};var Ut="en";function c(e,a=!0){var i,n;let t=a&&(n=(i=W)==null?void 0:i[e])!=null?n:e,r=a?W.code:Ut;return new it(t,r)}var it=class{constructor(a,t=(r=>(r=W.code)!=null?r:Ut)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,r)=>{var i;return(i=a[r])!=null?i:""})}toString(){return this.message}};function Ft(e){let a="";return Object.entries(e).forEach(([t,r])=>{r!=null&&(a+=`${ci(t)}: ${r}; `)}),a?a.trim():void 0}function ci(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function z(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Ce(e){let a=ui(e).toString();return a?"?"+a:""}function ui(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function ve(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",hi=()=>{try{return"1.1.
|
|
1
|
+
var et=(e,a,t)=>{if(!a.has(e))throw TypeError("Cannot "+t)};var d=(e,a,t)=>(et(e,a,"read from private field"),t?t.call(e):a.get(e)),h=(e,a,t)=>{if(a.has(e))throw TypeError("Cannot add the same private member more than once");a instanceof WeakSet?a.add(e):a.set(e,t)},A=(e,a,t,r)=>(et(e,a,"write to private field"),r?r.call(e,t):a.set(e,t),t);var p=(e,a,t)=>(et(e,a,"access private method"),t);var ie=class{addEventListener(){}removeEventListener(){}dispatchEvent(a){return!0}};if(typeof DocumentFragment=="undefined"){class e extends ie{}globalThis.DocumentFragment=e}var ge=class extends ie{},tt=class extends ie{},li={get(e){},define(e,a,t){},upgrade(e){},whenDefined(e){return Promise.resolve(ge)}},fe,at=class{constructor(a,t={}){h(this,fe,void 0);A(this,fe,t==null?void 0:t.detail)}get detail(){return d(this,fe)}initCustomEvent(){}};fe=new WeakMap;function di(e,a){return new ge}var Bt={document:{createElement:di},DocumentFragment,customElements:li,CustomEvent:at,EventTarget:ie,HTMLElement:ge,HTMLVideoElement:tt},Kt=typeof window=="undefined"||typeof globalThis.customElements=="undefined",g=Kt?Bt:globalThis,S=Kt?Bt.document:globalThis.document;import{MediaController as hr}from"media-chrome";import br,{MediaError as gt,Attributes as u}from"@mux/mux-video";import{StreamTypes as B,PlaybackTypes as Ye,addTextTrack as pr,removeTextTrack as gr}from"@mux/playback-core";import{VideoEvents as vi}from"@mux/mux-video";var mi="en",W={code:mi};var Ut="en";function c(e,a=!0){var i,n;let t=a&&(n=(i=W)==null?void 0:i[e])!=null?n:e,r=a?W.code:Ut;return new it(t,r)}var it=class{constructor(a,t=(r=>(r=W.code)!=null?r:Ut)()){this.message=a,this.locale=t}format(a){return this.message.replace(/\{(\w+)\}/g,(t,r)=>{var i;return(i=a[r])!=null?i:""})}toString(){return this.message}};function Ft(e){let a="";return Object.entries(e).forEach(([t,r])=>{r!=null&&(a+=`${ci(t)}: ${r}; `)}),a?a.trim():void 0}function ci(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Yt(e){return e.replace(/[-_]([a-z])/g,(a,t)=>t.toUpperCase())}function z(e){if(e==null)return;let a=+e;return Number.isNaN(a)?void 0:a}function Ce(e){let a=ui(e).toString();return a?"?"+a:""}function ui(e){let a={};for(let t in e)e[t]!=null&&(a[t]=e[t]);return new URLSearchParams(a)}function ve(e){let a=(e!=null?e:"").split(".")[1];if(!a)return{};let t=a.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}var rt=(e,a)=>!e||!a?!1:e.contains(a)?!0:rt(e,a.getRootNode().host);import{StreamTypes as Me}from"@mux/playback-core";var nt="mux.com",hi=()=>{try{return"1.1.2"}catch{}return"UNKNOWN"},bi=hi(),Re=()=>bi,ot=(e,{token:a,domain:t=nt}={})=>`https://stream.${t}/${e}.m3u8${Ce(!!a?{token:a}:{redundant_streams:!0})}`,zt=(e,{token:a,thumbnailTime:t,domain:r=nt}={})=>{let i=a==null?t:void 0;return`https://image.${r}/${e}/thumbnail.jpg${Ce({token:a,time:i})}`},qt=(e,{token:a,domain:t=nt}={})=>`https://image.${t}/${e}/storyboard.vtt${Ce({token:a})}`;function st(e){if(e&&/^media-theme-[\w-]+$/.test(e))return e}var pi={crossorigin:"crossOrigin",playsinline:"playsInline"};function jt(e){var a;return(a=pi[e])!=null?a:Yt(e)}var Gt=e=>{var t,r;let{media:a}=e;return(r=(t=a==null?void 0:a._hls)==null?void 0:t.liveSyncPosition)!=null?r:a!=null&&a.seekable.length?a==null?void 0:a.seekable.end(a.seekable.length-1):void 0},lt=e=>{let a=Gt(e);if(a==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}e.currentTime=a},gi=1,fi=5,Zt=3,Wt=.5,Xt=e=>{var n;let{streamType:a}=e,t=Gt(e),r=(n=e.media)==null?void 0:n.currentTime;if(t==null||r==null)return!1;let i=t-r;return a===Me.LL_LIVE||a===Me.LL_DVR?i<=gi*(Zt+Wt):a===Me.LIVE||a===Me.DVR?i<=fi*(Zt+Wt):!1},q,j,x,Pe=class{constructor(a,t){h(this,q,void 0);h(this,j,void 0);h(this,x,[]);A(this,q,a),A(this,j,t)}[Symbol.iterator](){return d(this,x).values()}get length(){return d(this,x).length}get value(){var a;return(a=d(this,x).join(" "))!=null?a:""}set value(a){var t;a!==this.value&&(A(this,x,[]),this.add(...(t=a==null?void 0:a.split(" "))!=null?t:[]))}toString(){return this.value}item(a){return d(this,x)[a]}values(){return d(this,x).values()}keys(){return d(this,x).keys()}forEach(a){d(this,x).forEach(a)}add(...a){var t,r;a.forEach(i=>{this.contains(i)||d(this,x).push(i)}),!(this.value===""&&!((t=d(this,q))!=null&&t.hasAttribute(`${d(this,j)}`)))&&((r=d(this,q))==null||r.setAttribute(`${d(this,j)}`,`${this.value}`))}remove(...a){var t;a.forEach(r=>{d(this,x).splice(d(this,x).indexOf(r),1)}),(t=d(this,q))==null||t.setAttribute(`${d(this,j)}`,`${this.value}`)}contains(a){return d(this,x).includes(a)}toggle(a,t){return typeof t!="undefined"?t?(this.add(a),!0):(this.remove(a),!1):this.contains(a)?(this.remove(a),!1):(this.add(a),!0)}replace(a,t){this.remove(a),this.add(t)}};q=new WeakMap,j=new WeakMap,x=new WeakMap;var Jt=`[mux-player ${Re()}]`;function G(...e){console.warn(Jt,...e)}function O(...e){console.error(Jt,...e)}function Ie(e){var t;let a=(t=e.message)!=null?t:"";if(e.file){let r="https://github.com/muxinc/elements/blob/main/errors/";a+=` ${c("Read more: ")}
|
|
2
2
|
${r}${e.file}`}G(a)}var T={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},X={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},yi=Object.freeze({length:0,start(e){let a=e>>>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(e){let a=e>>>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}}),ki=vi.filter(e=>e!=="error"),Ei=Object.values(T).filter(e=>![T.PLAYSINLINE].includes(e)),Ti=Object.values(X);function ea(e){e.querySelectorAll(":scope > track").forEach(a=>{var t;(t=e.media)==null||t.append(a.cloneNode())}),ki.forEach(a=>{var t;(t=e.media)==null||t.addEventListener(a,r=>{e.dispatchEvent(new Event(r.type))})})}var dt=class extends g.HTMLElement{static get observedAttributes(){return[...Ei,...Ti]}constructor(){super(),this.querySelectorAll(":scope > track").forEach(r=>{var i;(i=this.media)==null||i.append(r.cloneNode())});let a=r=>{for(let i of r)i.type==="childList"&&(i.removedNodes.forEach(n=>{var m,b;let o=(m=this.media)==null?void 0:m.querySelector(`track[src="${n.src}"]`);o&&((b=this.media)==null||b.removeChild(o))}),i.addedNodes.forEach(n=>{var o;(o=this.media)==null||o.append(n.cloneNode())}))};new MutationObserver(a).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(a,t,r){switch(a){case X.MUTED:{this.media&&(this.media.muted=r!=null,this.media.defaultMuted=r!=null);return}case X.VOLUME:{let i=+r;this.media&&!Number.isNaN(i)&&(this.media.volume=i);return}case X.PLAYBACKRATE:{let i=+r;this.media&&!Number.isNaN(i)&&(this.media.playbackRate=i,this.media.defaultPlaybackRate=i);return}}}play(){var a,t;return(t=(a=this.media)==null?void 0:a.play())!=null?t:Promise.reject()}pause(){var a;(a=this.media)==null||a.pause()}requestCast(a){var t;return(t=this.media)==null?void 0:t.requestCast(a)}get media(){var a;return(a=this.shadowRoot)==null?void 0:a.querySelector("mux-video")}get paused(){var a,t;return(t=(a=this.media)==null?void 0:a.paused)!=null?t:!0}get duration(){var a,t;return(t=(a=this.media)==null?void 0:a.duration)!=null?t:NaN}get ended(){var a,t;return(t=(a=this.media)==null?void 0:a.ended)!=null?t:!1}get buffered(){var a,t;return(t=(a=this.media)==null?void 0:a.buffered)!=null?t:yi}get readyState(){var a,t;return(t=(a=this.media)==null?void 0:a.readyState)!=null?t:0}get videoWidth(){var a,t;return(t=(a=this.media)==null?void 0:a.videoWidth)!=null?t:0}get videoHeight(){var a,t;return(t=(a=this.media)==null?void 0:a.videoHeight)!=null?t:0}get currentTime(){var a,t;return(t=(a=this.media)==null?void 0:a.currentTime)!=null?t:0}set currentTime(a){this.media&&(this.media.currentTime=Number(a))}get volume(){var a,t;return(t=(a=this.media)==null?void 0:a.volume)!=null?t:1}set volume(a){this.media&&(this.media.volume=Number(a))}get playbackRate(){var a,t;return(t=(a=this.media)==null?void 0:a.playbackRate)!=null?t:1}set playbackRate(a){this.media&&(this.media.playbackRate=Number(a))}get defaultPlaybackRate(){var a;return(a=z(this.getAttribute(X.PLAYBACKRATE)))!=null?a:1}set defaultPlaybackRate(a){a!=null?this.setAttribute(X.PLAYBACKRATE,`${a}`):this.removeAttribute(X.PLAYBACKRATE)}get crossOrigin(){return ye(this,T.CROSSORIGIN)}set crossOrigin(a){this.setAttribute(T.CROSSORIGIN,`${a}`)}get autoplay(){return ye(this,T.AUTOPLAY)!=null}set autoplay(a){a?this.setAttribute(T.AUTOPLAY,typeof a=="string"?a:""):this.removeAttribute(T.AUTOPLAY)}get loop(){return ye(this,T.LOOP)!=null}set loop(a){a?this.setAttribute(T.LOOP,""):this.removeAttribute(T.LOOP)}get muted(){var a,t;return(t=(a=this.media)==null?void 0:a.muted)!=null?t:!1}set muted(a){this.media&&(this.media.muted=Boolean(a))}get defaultMuted(){return ye(this,T.MUTED)!=null}set defaultMuted(a){a?this.setAttribute(T.MUTED,""):this.removeAttribute(T.MUTED)}get playsInline(){return ye(this,T.PLAYSINLINE)!=null}set playsInline(a){O("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(T.PRELOAD,a):this.removeAttribute(T.PRELOAD)}};function ye(e,a){return e.media?e.media.getAttribute(a):e.getAttribute(a)}var mt=dt;import{MediaTheme as Xi}from"media-chrome";import{TemplateInstance as ra,NodeTemplatePart as De,createProcessor as Ai,AttributeTemplatePart as ut}from"@github/template-parts";var ke=new WeakMap,Ee=class{constructor(a,t){this.element=a;this.type=t;this.element.addEventListener(this.type,this);let r=ke.get(this.element);r&&r.set(this.type,this)}set(a){if(typeof a=="function")this.handleEvent=a.bind(this.element);else if(typeof a=="object"&&typeof a.handleEvent=="function")this.handleEvent=a.handleEvent.bind(a);else{this.element.removeEventListener(this.type,this);let t=ke.get(this.element);t&&t.delete(this.type)}}static for(a){ke.has(a.element)||ke.set(a.element,new Map);let t=a.attributeName.slice(2),r=ke.get(a.element);return r&&r.has(t)?r.get(t):new Ee(a.element,t)}};function xi(e,a){return e instanceof ut&&e.attributeName.startsWith("on")?(Ee.for(e).set(a),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),!0):!1}function wi(e,a){return a instanceof Te&&e instanceof De?(a.renderInto(e),!0):!1}function Li(e,a){return a instanceof DocumentFragment&&e instanceof De?(a.childNodes.length&&e.replace(...a.childNodes),!0):!1}function $i(e,a){if(e instanceof ut){let t=e.attributeNamespace,r=e.element.getAttributeNS(t,e.attributeName);return String(a)!==r&&(e.value=String(a)),!0}return e.value=String(a),!0}function Si(e,a){if(typeof a=="boolean"&&e instanceof ut){let t=e.attributeNamespace,r=e.element.hasAttributeNS(t,e.attributeName);return a!==r&&(e.booleanValue=a),!0}return!1}function Oi(e,a){return a===!1&&e instanceof De?(e.replace(""),!0):!1}function Ci(e,a){Si(e,a)||xi(e,a)||Oi(e,a)||wi(e,a)||Li(e,a)||$i(e,a)}var ct=new WeakMap,ta=new WeakMap,aa=new WeakMap,Te=class{constructor(a,t,r){this.strings=a;this.values=t;this.processor=r}get template(){if(ct.has(this.strings))return ct.get(this.strings);{let a=document.createElement("template"),t=this.strings.length-1;return a.innerHTML=this.strings.reduce((r,i,n)=>r+i+(n<t?`{{ ${n} }}`:""),""),ct.set(this.strings,a),a}}renderInto(a){let t=this.template;if(ta.get(a)!==t){ta.set(a,t);let i=new ra(t,this.values,this.processor);aa.set(a,i),a instanceof De?a.replace(...i.children):a.appendChild(i);return}let r=aa.get(a);r&&r.update(this.values)}},ia=new Map,Mi=Ai(Ci);function l(e,...a){let t=[""],r=[],i,n=!1,o=(m,b=[])=>{t[t.length-1]=t[t.length-1]+m[0],b.forEach((f,v)=>{(i=f==null?void 0:f.$static$)!==void 0?(i.forEach($=>{o($.strings,$.values)}),t[t.length-1]=t[t.length-1]+m[v+1],n=!0):(r.push(f),t.push(m[v+1]))})};if(o(e,a),n){let m=t.join("$$html$$");e=ia.get(m),e===void 0&&(t.raw=t,ia.set(m,e=t)),a=r}return new Te(e,a,Mi)}function _e(e,a){e.renderInto(a)}function y(e,a){let t=document.createElement("template");return t.innerHTML=e,new ra(t,a)}var ht=(...e)=>({$static$:e.map(a=>a instanceof Te?a:/\w-/.test(a)?{strings:[a]}:{strings:[]})});var oa=`
|
|
3
3
|
:host {
|
|
4
4
|
cursor: pointer;
|