@mux/mux-video
Advanced tools
Comparing version 0.8.3-canary.8-ce66df5 to 0.8.3-canary.9-0563c30
@@ -1,2 +0,2 @@ | ||
var Dt=Object.create;var G=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Nt=(r,t,s)=>t in r?G(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var At=r=>G(r,"__esModule",{value:!0});var xt=(r,t)=>{At(r);for(var s in t)G(r,s,{get:t[s],enumerable:!0})},Ut=(r,t,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!Lt.call(r,n)&&n!=="default"&&G(r,n,{get:()=>t[n],enumerable:!(s=Rt(t,n))||s.enumerable});return r},Yt=r=>Ut(At(G(r!=null?Dt(wt(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var B=(r,t,s)=>(Nt(r,typeof t!="symbol"?t+"":t,s),s),rt=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var a=(r,t,s)=>(rt(r,t,"read from private field"),s?s.call(r):t.get(r)),c=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},E=(r,t,s,n)=>(rt(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var h=(r,t,s)=>(rt(r,t,"access private method"),s);xt(exports,{MediaError:()=>y.MediaError,VideoEvents:()=>ct,default:()=>Qt});var y=Yt(require("@mux/playback-core"));var Vt=()=>{try{return"0.8.3-canary.8-ce66df5"}catch{}return"UNKNOWN"},Ft=Vt(),gt=()=>Ft;var Gt=r=>{var t,s,n,d,m,Bt,P,at,g,_,L,it,N,nt,$,Ht,z,jt,x,bt,U,T,S,C,M,I,O,tt,J,Kt,Y,vt,X,qt,V,St,Z,Wt,F,_t;return t=class extends r{constructor(){super();c(this,O);c(this,J);c(this,Y);c(this,X);c(this,V);c(this,Z);c(this,F);B(this,"castEnabled",!1);c(this,U,{paused:!1});c(this,T,void 0);c(this,S,{});c(this,C,void 0);c(this,M,void 0);c(this,I,void 0);t.instances.add(this),h(this,V,St).call(this)}static get castElement(){return a(t,s)}static get castEnabled(){return a(t,n)}static get castState(){var e;return(e=a(t,g,_))==null?void 0:e.getCastState()}static async exitCast(){let e=!0;try{await a(t,g,_).endCurrentSession(e)}catch(i){console.error(i);return}}get castPlayer(){if(t.castElement===this)return a(this,T)}attributeChangedCallback(e){if(!!this.castPlayer)switch(e){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(e={}){var i;h(i=t,x,bt).call(i,e),E(t,s,this),Object.entries(a(this,S)).forEach(([u,p])=>{a(this,T).controller.addEventListener(u,p)});try{await a(t,g,_).requestSession()}catch{E(t,s,void 0);return}a(this,U).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(u){console.error(u)}}async load(){var v,D;if(!this.castPlayer)return super.load();let e=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),i=[...this.querySelectorAll("track")].filter(({kind:b,src:A})=>A&&(b==="subtitles"||b==="captions")),u=[],p=0;i.length&&(e.tracks=i.map(b=>{let A=++p;u.length===0&&b.track.mode==="showing"&&u.push(A);let R=new chrome.cast.media.Track(A,chrome.cast.media.TrackType.TEXT);return R.trackContentId=b.src,R.trackContentType="text/vtt",R.subtype=b.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,R.name=b.label,R.language=b.srclang,R})),this.castStreamType==="live"?e.streamType=chrome.cast.media.StreamType.LIVE:e.streamType=chrome.cast.media.StreamType.BUFFERED,e.metadata=new chrome.cast.media.GenericMediaMetadata,e.metadata.title=this.title,e.metadata.images=[{url:this.poster}];let f=new chrome.cast.media.LoadRequest(e);f.currentTime=(v=super.currentTime)!=null?v:0,f.autoplay=!a(this,U).paused,f.activeTrackIds=u,await((D=a(t,L,it))==null?void 0:D.loadMedia(f)),this.dispatchEvent(new Event("volumechange"))}play(){var e;if(this.castPlayer){this.castPlayer.isPaused&&((e=this.castPlayer.controller)==null||e.playOrPause());return}return super.play()}pause(){var e;if(this.castPlayer){this.castPlayer.isPaused||(e=this.castPlayer.controller)==null||e.playOrPause();return}super.pause()}get castSrc(){var e,i,u;return(u=(i=this.getAttribute("cast-src"))!=null?i:(e=this.querySelector("source"))==null?void 0:e.src)!=null?u:this.currentSrc}set castSrc(e){this.castSrc!=e&&this.setAttribute("cast-src",`${e}`)}get castContentType(){var e;return(e=this.getAttribute("cast-content-type"))!=null?e:void 0}set castContentType(e){this.setAttribute("cast-content-type",`${e}`)}get castStreamType(){var e;return(e=this.getAttribute("cast-stream-type"))!=null?e:void 0}set castStreamType(e){this.setAttribute("cast-stream-type",`${e}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var e;return this.castPlayer?(e=this.castPlayer)==null?void 0:e.isMuted:super.muted}set muted(e){var i;if(this.castPlayer){(e&&!this.castPlayer.isMuted||!e&&this.castPlayer.isMuted)&&((i=this.castPlayer.controller)==null||i.muteOrUnmute());return}super.muted=e}get volume(){var e,i;return this.castPlayer?(i=(e=this.castPlayer)==null?void 0:e.volumeLevel)!=null?i:1:super.volume}set volume(e){var i;if(this.castPlayer){this.castPlayer.volumeLevel=e,(i=this.castPlayer.controller)==null||i.setVolumeLevel();return}super.volume=e}get duration(){var e,i;return this.castPlayer&&a(this,O,tt)?(i=(e=this.castPlayer)==null?void 0:e.duration)!=null?i:NaN:super.duration}get currentTime(){var e,i;return this.castPlayer&&a(this,O,tt)?(i=(e=this.castPlayer)==null?void 0:e.currentTime)!=null?i:0:super.currentTime}set currentTime(e){var i;if(this.castPlayer){this.castPlayer.currentTime=e,(i=this.castPlayer.controller)==null||i.seek();return}super.currentTime=e}get onentercast(){return a(this,C)}set onentercast(e){a(this,C)&&(this.removeEventListener("entercast",a(this,C)),E(this,C,null)),typeof e=="function"&&(E(this,C,e),this.addEventListener("entercast",e))}get onleavecast(){return a(this,M)}set onleavecast(e){a(this,M)&&(this.removeEventListener("leavecast",a(this,M)),E(this,M,null)),typeof e=="function"&&(E(this,M,e),this.addEventListener("leavecast",e))}get oncastchange(){return a(this,I)}set oncastchange(e){a(this,I)&&(this.removeEventListener("castchange",a(this,I)),E(this,I,null)),typeof e=="function"&&(E(this,I,e),this.addEventListener("castchange",e))}},s=new WeakMap,n=new WeakMap,d=new WeakMap,m=new WeakSet,Bt=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},P=new WeakSet,at=function(){return typeof cast!="undefined"&&cast.framework},g=new WeakSet,_=function(){if(a(t,P,at))return cast.framework.CastContext.getInstance()},L=new WeakSet,it=function(){var e;return(e=a(t,g,_))==null?void 0:e.getCurrentSession()},N=new WeakSet,nt=function(){var e;return(e=a(t,L,it))==null?void 0:e.getSessionObj().media[0]},$=new WeakSet,Ht=function(e){return new Promise((i,u)=>{a(t,N,nt).editTracksInfo(e,i,u)})},z=new WeakSet,jt=function(e){return new Promise((i,u)=>{a(t,N,nt).getStatus(e,i,u)})},x=new WeakSet,bt=function(e){return a(t,g,_).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...e})},U=new WeakMap,T=new WeakMap,S=new WeakMap,C=new WeakMap,M=new WeakMap,I=new WeakMap,O=new WeakSet,tt=function(){var e;return(e=this.castPlayer)==null?void 0:e.isMediaLoaded},J=new WeakSet,Kt=function(){a(t,s)===this&&(Object.entries(a(this,S)).forEach(([e,i])=>{a(this,T).controller.removeEventListener(e,i)}),E(t,s,void 0),this.muted=a(this,T).isMuted,this.currentTime=a(this,T).savedPlayerState.currentTime,a(this,T).savedPlayerState.isPaused===!1&&this.play())},Y=new WeakSet,vt=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:a(t,g,_).getCastState()}))},X=new WeakSet,qt=async function(){var i,u;let{SESSION_RESUMED:e}=cast.framework.SessionState;if(a(t,g,_).getSessionState()===e&&this.castSrc===((i=a(t,N,nt))==null?void 0:i.media.contentId)){E(t,s,this),Object.entries(a(this,S)).forEach(([p,f])=>{a(this,T).controller.addEventListener(p,f)});try{await h(u=t,z,jt).call(u,new chrome.cast.media.GetStatusRequest)}catch(p){console.error(p)}a(this,S)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),a(this,S)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},V=new WeakSet,St=function(){var e;!a(t,P,at)||this.castEnabled||(this.castEnabled=!0,h(e=t,x,bt).call(e),this.textTracks.addEventListener("change",h(this,F,_t).bind(this)),h(this,Y,vt).call(this),E(this,T,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(a(this,T)),E(this,S,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:i})=>{i===!1&&h(this,J,Kt).call(this),this.dispatchEvent(new Event(i?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!a(this,O,tt)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var i,u;((i=this.castPlayer)==null?void 0:i.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(u=this.castPlayer)==null?void 0:u.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!a(this,O,tt)||(await Promise.resolve(),h(this,Z,Wt).call(this))}}))},Z=new WeakSet,Wt=function(){h(this,F,_t).call(this)},F=new WeakSet,_t=async function(){var lt,dt,ht,mt,Et,pt;if(!this.castPlayer)return;let i=((dt=(lt=a(this,T).mediaInfo)==null?void 0:lt.tracks)!=null?dt:[]).filter(({type:l})=>l===chrome.cast.media.TrackType.TEXT),u=[...this.textTracks].filter(({kind:l})=>l==="subtitles"||l==="captions"),p=i.map(({language:l,name:Q,trackId:st})=>{var yt;let{mode:ft}=(yt=u.find(Tt=>Tt.language===l&&Tt.label===Q))!=null?yt:{};return ft?{mode:ft,trackId:st}:!1}).filter(Boolean),v=p.filter(({mode:l})=>l!=="showing").map(({trackId:l})=>l),D=p.find(({mode:l})=>l==="showing"),b=(Et=(mt=(ht=a(t,L,it))==null?void 0:ht.getSessionObj().media[0])==null?void 0:mt.activeTrackIds)!=null?Et:[],A=b;if(b.length&&(A=A.filter(l=>!v.includes(l))),(D==null?void 0:D.trackId)&&(A=[...A,D.trackId]),A=[...new Set(A)],!((l,Q)=>l.length===Q.length&&l.every(st=>Q.includes(st)))(b,A))try{let l=new chrome.cast.media.EditTracksInfoRequest(A);await h(pt=t,$,Ht).call(pt,l)}catch(l){console.error(l)}},c(t,m),c(t,P),c(t,g),c(t,L),c(t,N),c(t,$),c(t,z),c(t,x),B(t,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),B(t,"instances",new Set),c(t,s,void 0),c(t,n,!1),B(t,"initCast",()=>{var e;a(t,m,Bt)?a(t,P,at)?a(e=t,d).call(e,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var i;return a(i=t,d).call(i,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var i;return a(i=t,d).call(i,chrome.cast.isAvailable)})}}),c(t,d,e=>{if(e){E(t,n,!0);let{CAST_STATE_CHANGED:i}=cast.framework.CastContextEventType;a(t,g,_).addEventListener(i,p=>{t.instances.forEach(f=>{var v;return h(v=f,Y,vt).call(v,p)})});let{SESSION_STATE_CHANGED:u}=cast.framework.CastContextEventType;a(t,g,_).addEventListener(u,p=>{t.instances.forEach(f=>{var v;return h(v=f,X,qt).call(v,p)})}),t.instances.forEach(p=>{var f;return h(f=p,V,St).call(f)})}}),t},ot=Gt(HTMLVideoElement);customElements.get("castable-video")||(customElements.define("castable-video",ot,{extends:"video"}),globalThis.CastableVideoElement=ot);ot.initCast();var ct=["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","castchange","entercast","leavecast"],Pt=document.createElement("template");Pt.innerHTML=` | ||
var Ot=Object.create;var B=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty;var Lt=(r,t,s)=>t in r?B(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var At=r=>B(r,"__esModule",{value:!0});var Nt=(r,t)=>{At(r);for(var s in t)B(r,s,{get:t[s],enumerable:!0})},xt=(r,t,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Rt(t))!wt.call(r,n)&&n!=="default"&&B(r,n,{get:()=>t[n],enumerable:!(s=Dt(t,n))||s.enumerable});return r},Ut=r=>xt(At(B(r!=null?Ot(kt(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var H=(r,t,s)=>(Lt(r,typeof t!="symbol"?t+"":t,s),s),st=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var a=(r,t,s)=>(st(r,t,"read from private field"),s?s.call(r):t.get(r)),c=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},p=(r,t,s,n)=>(st(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var d=(r,t,s)=>(st(r,t,"access private method"),s);Nt(exports,{MediaError:()=>y.MediaError,VideoEvents:()=>ot,default:()=>Zt});var y=Ut(require("@mux/playback-core"));var Yt=()=>{try{return"0.8.3-canary.9-0563c30"}catch{}return"UNKNOWN"},Vt=Yt(),gt=()=>Vt;var Ft=r=>{var t,s,n,h,m,Gt,P,rt,g,_,L,at,N,it,W,Bt,$,Ht,U,bt,Y,T,S,C,M,I,O,Q,z,jt,V,vt,J,Kt,F,St,X,qt,G,_t;return t=class extends r{constructor(){super();c(this,O);c(this,z);c(this,V);c(this,J);c(this,F);c(this,X);c(this,G);H(this,"castEnabled",!1);c(this,Y,{paused:!1});c(this,T,void 0);c(this,S,{});c(this,C,void 0);c(this,M,void 0);c(this,I,void 0);t.instances.add(this),d(this,F,St).call(this)}static get castElement(){return a(t,s)}static get castEnabled(){return a(t,n)}static get castState(){var e;return(e=a(t,g,_))==null?void 0:e.getCastState()}static async exitCast(){let e=!0;try{await a(t,g,_).endCurrentSession(e)}catch(i){console.error(i);return}}get castPlayer(){if(t.castElement===this)return a(this,T)}attributeChangedCallback(e){if(!!this.castPlayer)switch(e){case"cast-stream-type":case"cast-src":this.load();break}}async requestCast(e={}){var i;d(i=t,U,bt).call(i,e),p(t,s,this),Object.entries(a(this,S)).forEach(([u,E])=>{a(this,T).controller.addEventListener(u,E)});try{await a(t,g,_).requestSession()}catch{p(t,s,void 0);return}a(this,Y).paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(u){console.error(u)}}async load(){var v,D;if(!this.castPlayer)return super.load();let e=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType),i=[...this.querySelectorAll("track")].filter(({kind:b,src:A})=>A&&(b==="subtitles"||b==="captions")),u=[],E=0;i.length&&(e.tracks=i.map(b=>{let A=++E;u.length===0&&b.track.mode==="showing"&&u.push(A);let R=new chrome.cast.media.Track(A,chrome.cast.media.TrackType.TEXT);return R.trackContentId=b.src,R.trackContentType="text/vtt",R.subtype=b.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,R.name=b.label,R.language=b.srclang,R})),this.castStreamType==="live"?e.streamType=chrome.cast.media.StreamType.LIVE:e.streamType=chrome.cast.media.StreamType.BUFFERED,e.metadata=new chrome.cast.media.GenericMediaMetadata,e.metadata.title=this.title,e.metadata.images=[{url:this.poster}];let f=new chrome.cast.media.LoadRequest(e);f.currentTime=(v=super.currentTime)!=null?v:0,f.autoplay=!a(this,Y).paused,f.activeTrackIds=u,await((D=a(t,L,at))==null?void 0:D.loadMedia(f)),this.dispatchEvent(new Event("volumechange"))}play(){var e;if(this.castPlayer){this.castPlayer.isPaused&&((e=this.castPlayer.controller)==null||e.playOrPause());return}return super.play()}pause(){var e;if(this.castPlayer){this.castPlayer.isPaused||(e=this.castPlayer.controller)==null||e.playOrPause();return}super.pause()}get castSrc(){var e,i,u;return(u=(i=this.getAttribute("cast-src"))!=null?i:(e=this.querySelector("source"))==null?void 0:e.src)!=null?u:this.currentSrc}set castSrc(e){this.castSrc!=e&&this.setAttribute("cast-src",`${e}`)}get castContentType(){var e;return(e=this.getAttribute("cast-content-type"))!=null?e:void 0}set castContentType(e){this.setAttribute("cast-content-type",`${e}`)}get castStreamType(){var e;return(e=this.getAttribute("cast-stream-type"))!=null?e:void 0}set castStreamType(e){this.setAttribute("cast-stream-type",`${e}`)}get readyState(){if(this.castPlayer)switch(this.castPlayer.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.castPlayer?this.castPlayer.isPaused:super.paused}get muted(){var e;return this.castPlayer?(e=this.castPlayer)==null?void 0:e.isMuted:super.muted}set muted(e){var i;if(this.castPlayer){(e&&!this.castPlayer.isMuted||!e&&this.castPlayer.isMuted)&&((i=this.castPlayer.controller)==null||i.muteOrUnmute());return}super.muted=e}get volume(){var e,i;return this.castPlayer?(i=(e=this.castPlayer)==null?void 0:e.volumeLevel)!=null?i:1:super.volume}set volume(e){var i;if(this.castPlayer){this.castPlayer.volumeLevel=e,(i=this.castPlayer.controller)==null||i.setVolumeLevel();return}super.volume=e}get duration(){var e,i;return this.castPlayer&&a(this,O,Q)?(i=(e=this.castPlayer)==null?void 0:e.duration)!=null?i:NaN:super.duration}get currentTime(){var e,i;return this.castPlayer&&a(this,O,Q)?(i=(e=this.castPlayer)==null?void 0:e.currentTime)!=null?i:0:super.currentTime}set currentTime(e){var i;if(this.castPlayer){this.castPlayer.currentTime=e,(i=this.castPlayer.controller)==null||i.seek();return}super.currentTime=e}get onentercast(){return a(this,C)}set onentercast(e){a(this,C)&&(this.removeEventListener("entercast",a(this,C)),p(this,C,null)),typeof e=="function"&&(p(this,C,e),this.addEventListener("entercast",e))}get onleavecast(){return a(this,M)}set onleavecast(e){a(this,M)&&(this.removeEventListener("leavecast",a(this,M)),p(this,M,null)),typeof e=="function"&&(p(this,M,e),this.addEventListener("leavecast",e))}get oncastchange(){return a(this,I)}set oncastchange(e){a(this,I)&&(this.removeEventListener("castchange",a(this,I)),p(this,I,null)),typeof e=="function"&&(p(this,I,e),this.addEventListener("castchange",e))}},s=new WeakMap,n=new WeakMap,h=new WeakMap,m=new WeakSet,Gt=function(){return typeof chrome!="undefined"&&chrome.cast&&chrome.cast.isAvailable},P=new WeakSet,rt=function(){return typeof cast!="undefined"&&cast.framework},g=new WeakSet,_=function(){if(a(t,P,rt))return cast.framework.CastContext.getInstance()},L=new WeakSet,at=function(){var e;return(e=a(t,g,_))==null?void 0:e.getCurrentSession()},N=new WeakSet,it=function(){var e;return(e=a(t,L,at))==null?void 0:e.getSessionObj().media[0]},W=new WeakSet,Bt=function(e){return new Promise((i,u)=>{a(t,N,it).editTracksInfo(e,i,u)})},$=new WeakSet,Ht=function(e){return new Promise((i,u)=>{a(t,N,it).getStatus(e,i,u)})},U=new WeakSet,bt=function(e){return a(t,g,_).setOptions({receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0,...e})},Y=new WeakMap,T=new WeakMap,S=new WeakMap,C=new WeakMap,M=new WeakMap,I=new WeakMap,O=new WeakSet,Q=function(){var e;return(e=this.castPlayer)==null?void 0:e.isMediaLoaded},z=new WeakSet,jt=function(){a(t,s)===this&&(Object.entries(a(this,S)).forEach(([e,i])=>{a(this,T).controller.removeEventListener(e,i)}),p(t,s,void 0),this.muted=a(this,T).isMuted,this.currentTime=a(this,T).savedPlayerState.currentTime,a(this,T).savedPlayerState.isPaused===!1&&this.play())},V=new WeakSet,vt=function(){this.dispatchEvent(new CustomEvent("castchange",{detail:a(t,g,_).getCastState()}))},J=new WeakSet,Kt=async function(){var i,u;let{SESSION_RESUMED:e}=cast.framework.SessionState;if(a(t,g,_).getSessionState()===e&&this.castSrc===((i=a(t,N,it))==null?void 0:i.media.contentId)){p(t,s,this),Object.entries(a(this,S)).forEach(([E,f])=>{a(this,T).controller.addEventListener(E,f)});try{await d(u=t,$,Ht).call(u,new chrome.cast.media.GetStatusRequest)}catch(E){console.error(E)}a(this,S)[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED](),a(this,S)[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},F=new WeakSet,St=function(){var e;!a(t,P,rt)||this.castEnabled||(this.castEnabled=!0,d(e=t,U,bt).call(e),this.textTracks.addEventListener("change",d(this,G,_t).bind(this)),d(this,V,vt).call(this),p(this,T,new cast.framework.RemotePlayer),new cast.framework.RemotePlayerController(a(this,T)),p(this,S,{[cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:i})=>{i===!1&&d(this,z,jt).call(this),this.dispatchEvent(new Event(i?"entercast":"leavecast"))},[cast.framework.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.dispatchEvent(new Event("durationchange"))},[cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.dispatchEvent(new Event("volumechange"))},[cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{!a(this,O,Q)||this.dispatchEvent(new Event("timeupdate"))},[cast.framework.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.dispatchEvent(new Event("resize"))},[cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.dispatchEvent(new Event(this.paused?"pause":"play"))},[cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var i,u;((i=this.castPlayer)==null?void 0:i.playerState)!==chrome.cast.media.PlayerState.PAUSED&&this.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(u=this.castPlayer)==null?void 0:u.playerState]))},[cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{!a(this,O,Q)||(await Promise.resolve(),d(this,X,qt).call(this))}}))},X=new WeakSet,qt=function(){d(this,G,_t).call(this)},G=new WeakSet,_t=async function(){var lt,dt,ht,mt,Et,pt;if(!this.castPlayer)return;let i=((dt=(lt=a(this,T).mediaInfo)==null?void 0:lt.tracks)!=null?dt:[]).filter(({type:l})=>l===chrome.cast.media.TrackType.TEXT),u=[...this.textTracks].filter(({kind:l})=>l==="subtitles"||l==="captions"),E=i.map(({language:l,name:Z,trackId:et})=>{var yt;let{mode:ft}=(yt=u.find(Tt=>Tt.language===l&&Tt.label===Z))!=null?yt:{};return ft?{mode:ft,trackId:et}:!1}).filter(Boolean),v=E.filter(({mode:l})=>l!=="showing").map(({trackId:l})=>l),D=E.find(({mode:l})=>l==="showing"),b=(Et=(mt=(ht=a(t,L,at))==null?void 0:ht.getSessionObj().media[0])==null?void 0:mt.activeTrackIds)!=null?Et:[],A=b;if(b.length&&(A=A.filter(l=>!v.includes(l))),(D==null?void 0:D.trackId)&&(A=[...A,D.trackId]),A=[...new Set(A)],!((l,Z)=>l.length===Z.length&&l.every(et=>Z.includes(et)))(b,A))try{let l=new chrome.cast.media.EditTracksInfoRequest(A);await d(pt=t,W,Bt).call(pt,l)}catch(l){console.error(l)}},c(t,m),c(t,P),c(t,g),c(t,L),c(t,N),c(t,W),c(t,$),c(t,U),H(t,"observedAttributes",["cast-src","cast-content-type","cast-stream-type"]),H(t,"instances",new Set),c(t,s,void 0),c(t,n,!1),H(t,"initCast",()=>{var e;a(t,m,Gt)?a(t,P,rt)?a(e=t,h).call(e,chrome.cast.isAvailable):customElements.whenDefined("google-cast-button").then(()=>{var i;return a(i=t,h).call(i,chrome.cast.isAvailable)}):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(()=>{var i;return a(i=t,h).call(i,chrome.cast.isAvailable)})}}),c(t,h,e=>{if(e){p(t,n,!0);let{CAST_STATE_CHANGED:i}=cast.framework.CastContextEventType;a(t,g,_).addEventListener(i,E=>{t.instances.forEach(f=>{var v;return d(v=f,V,vt).call(v,E)})});let{SESSION_STATE_CHANGED:u}=cast.framework.CastContextEventType;a(t,g,_).addEventListener(u,E=>{t.instances.forEach(f=>{var v;return d(v=f,J,Kt).call(v,E)})}),t.instances.forEach(E=>{var f;return d(f=E,F,St).call(f)})}}),t},nt=Ft(HTMLVideoElement);customElements.get("castable-video")||(customElements.define("castable-video",nt,{extends:"video"}),globalThis.CastableVideoElement=nt);nt.initCast();var ot=["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","castchange","entercast","leavecast"],Pt=document.createElement("template");Pt.innerHTML=` | ||
<style> | ||
@@ -19,3 +19,3 @@ :host { | ||
<slot></slot> | ||
`;var H,j,K,Ct,q,Mt,k=class extends HTMLElement{constructor(){super();c(this,K);c(this,q);c(this,H,void 0);c(this,j,void 0);this.attachShadow({mode:"open"}),this.isConnected&&h(this,K,Ct).call(this)}static get observedAttributes(){let t=[],s=d=>d.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(d=>{let m=!1;try{typeof this.prototype[d]=="function"&&(m=!0)}catch{}!m&&d!==d.toUpperCase()&&t.push(d.toLowerCase(),s(d))});let n=Object.getPrototypeOf(this).observedAttributes;return n&&(t=t.concat(n)),t}attributeChangedCallback(t,s,n){!a(this,H)&&!this.isConnected&&(E(this,H,!0),h(this,K,Ct).call(this)),h(this,q,Mt).call(this,t,s,n)}connectedCallback(){}};H=new WeakMap,j=new WeakMap,K=new WeakSet,Ct=function(){if(a(this,j))return;E(this,j,!0),this.shadowRoot.append(Pt.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),ct.forEach(s=>{this.nativeEl.addEventListener(s,n=>{this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))})});let t=this.shadowRoot.querySelector("slot");t.addEventListener("slotchange",()=>{t.assignedElements().forEach(s=>{!["track","source"].includes(s.localName)||this.nativeEl.append(s)})}),Array.prototype.forEach.call(this.attributes,s=>{h(this,q,Mt).call(this,s.name,null,s.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},q=new WeakSet,Mt=function(t,s,n){let d=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),m=zt(d,t),w=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;m&&!w?typeof this[m]=="boolean"?n===null?this[m]=!1:this[m]=!0:this[m]=n:n===null?this.nativeEl.removeAttribute(t):["id","class"].indexOf(t)===-1&&this.nativeEl.setAttribute(t,n)};var It=[],Ot=document.createElement("video",{is:"castable-video"}),$t=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(Ot);r&&r!==HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{$t.indexOf(t)===-1&&It.push(t)});It.forEach(r=>{if(r in k.prototype)return;if(typeof Ot[r]=="function")k.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let s={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(s.set=function(n){this.nativeEl[r]=n}),Object.defineProperty(k.prototype,r,s)}});function zt(r,t){let s=null;return r.forEach(n=>{n.toLowerCase()==t.toLowerCase()&&(s=n)}),s}globalThis.customElements.get("custom-video")||(globalThis.customElements.define("custom-video",k),globalThis.CustomVideoElement=k);var ut=k;var o={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_MSE:"prefer-mse",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},Jt=Object.values(o),Xt=gt(),Zt="mux-video",et=class extends ut{constructor(){super();this.__metadata={};this.__playerInitTime=(0,y.generatePlayerInitTime)()}static get observedAttributes(){var t;return[...Jt,...(t=ut.observedAttributes)!=null?t:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var t;return(t=this.__playerSoftwareName)!=null?t:Zt}set playerSoftwareName(t){this.__playerSoftwareName=t}get playerSoftwareVersion(){var t;return(t=this.__playerSoftwareVersion)!=null?t:Xt}set playerSoftwareVersion(t){this.__playerSoftwareVersion=t}get hls(){return console.warn("<mux-video>.hls is deprecated, please use ._hls instead"),this._hls}get _hls(){return this.__hls}get mux(){return this.nativeEl.mux}get error(){var t;return(t=(0,y.getError)(this.nativeEl))!=null?t:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(t){this.__errorTranslator=t}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get type(){var t;return(t=this.getAttribute(o.TYPE))!=null?t:void 0}set type(t){t!==this.type&&(t?this.setAttribute(o.TYPE,t):this.removeAttribute(o.TYPE))}get autoplay(){let t=this.getAttribute("autoplay");return t===null?!1:t===""?!0:t}set autoplay(t){let s=this.autoplay;t!==s&&(t?this.setAttribute("autoplay",typeof t=="string"?t:""):this.removeAttribute("autoplay"))}get debug(){return this.getAttribute(o.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(o.DEBUG,""):this.removeAttribute(o.DEBUG))}get startTime(){let t=this.getAttribute(o.START_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(o.START_TIME):this.setAttribute(o.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(o.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(o.PLAYBACK_ID,t):this.removeAttribute(o.PLAYBACK_ID))}get customDomain(){var t;return(t=this.getAttribute(o.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(o.CUSTOM_DOMAIN,t):this.removeAttribute(o.CUSTOM_DOMAIN))}get envKey(){var t;return(t=this.getAttribute(o.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(o.ENV_KEY,t):this.removeAttribute(o.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(o.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(o.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(o.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(o.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(o.STREAM_TYPE,t):this.removeAttribute(o.STREAM_TYPE))}get preferMse(){return this.getAttribute(o.PREFER_MSE)!=null}set preferMse(t){t?this.setAttribute(o.PREFER_MSE,""):this.removeAttribute(o.PREFER_MSE)}get metadata(){let t=this.getAttribute(o.METADATA_VIDEO_ID),s=this.getAttribute(o.METADATA_VIDEO_TITLE),n=this.getAttribute(o.METADATA_VIEWER_USER_ID);return{...this.__metadata,...t!=null?{video_id:t}:{},...s!=null?{video_title:s}:{},...n!=null?{viewer_user_id:n}:{}}}set metadata(t){this.__metadata=t!=null?t:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){let t=(0,y.initialize)(this,this.nativeEl,this.__hls);this.__hls=t;let s=(0,y.setupAutoplay)(this.nativeEl,this.autoplay,t);this.__updateAutoplay=s}unload(){(0,y.teardown)(this.nativeEl,this.__hls),this.__hls=void 0}attributeChangedCallback(t,s,n){var d;switch(t){case o.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=n!=null?n:void 0;break;case o.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=n!=null?n:void 0;break;case"src":let m=!!s,w=!!n;!m&&w?this.load():m&&!w?this.unload():m&&w&&(this.unload(),this.load());break;case"autoplay":if(n===s)break;(d=this.__updateAutoplay)==null||d.call(this,this.autoplay);break;case o.PLAYBACK_ID:this.src=(0,y.toMuxVideoURL)(n!=null?n:void 0,{domain:this.customDomain});break;case o.DEBUG:let P=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=P);break;case o.METADATA_URL:n&&fetch(n).then(W=>W.json()).then(W=>this.metadata=W).catch(W=>console.error(`Unable to load or parse metadata JSON from metadata-url ${n}!`));break;default:break}super.attributeChangedCallback(t,s,n)}disconnectedCallback(){this.unload()}};globalThis.customElements.get("mux-video")||(globalThis.customElements.define("mux-video",et),globalThis.MuxVideoElement=et);var Qt=et; | ||
`;var j,x,ct,K,Ct,k=class extends HTMLElement{constructor(){super();c(this,x);c(this,K);c(this,j,void 0);this.attachShadow({mode:"open"}),this.isConnected&&d(this,x,ct).call(this)}static get observedAttributes(){let t=[],s=h=>h.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();Object.getOwnPropertyNames(this.prototype).forEach(h=>{let m=!1;try{typeof this.prototype[h]=="function"&&(m=!0)}catch{}!m&&h!==h.toUpperCase()&&t.push(h.toLowerCase(),s(h))});let n=Object.getPrototypeOf(this).observedAttributes;return n&&(t=t.concat(n)),t}attributeChangedCallback(t,s,n){d(this,x,ct).call(this),d(this,K,Ct).call(this,t,s,n)}connectedCallback(){d(this,x,ct).call(this)}};j=new WeakMap,x=new WeakSet,ct=function(){if(a(this,j))return;p(this,j,!0),this.shadowRoot.append(Pt.content.cloneNode(!0)),this.nativeEl=this.shadowRoot.querySelector("video"),ot.forEach(s=>{this.nativeEl.addEventListener(s,n=>{this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))})});let t=this.shadowRoot.querySelector("slot");t.addEventListener("slotchange",()=>{t.assignedElements().forEach(s=>{!["track","source"].includes(s.localName)||this.nativeEl.append(s)})}),Array.prototype.forEach.call(this.attributes,s=>{d(this,K,Ct).call(this,s.name,null,s.value)}),this.nativeEl.defaultMuted&&(this.nativeEl.muted=!0)},K=new WeakSet,Ct=function(t,s,n){let h=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),m=$t(h,t),w=Object.getPrototypeOf(this.constructor).toString().indexOf("function HTMLElement")===0;m&&!w?typeof this[m]=="boolean"?n===null?this[m]=!1:this[m]=!0:this[m]=n:n===null?this.nativeEl.removeAttribute(t):["id","class"].indexOf(t)===-1&&this.nativeEl.setAttribute(t,n)};var Mt=[],It=document.createElement("video",{is:"castable-video"}),Wt=["webkitDisplayingFullscreen","webkitSupportsFullscreen"];for(let r=Object.getPrototypeOf(It);r&&r!==HTMLElement.prototype;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(t=>{Wt.indexOf(t)===-1&&Mt.push(t)});Mt.forEach(r=>{if(r in k.prototype)return;if(typeof It[r]=="function")k.prototype[r]=function(){return this.nativeEl[r].apply(this.nativeEl,arguments)};else{let s={get(){return this.nativeEl[r]}};r!==r.toUpperCase()&&(s.set=function(n){this.nativeEl[r]=n}),Object.defineProperty(k.prototype,r,s)}});function $t(r,t){let s=null;return r.forEach(n=>{n.toLowerCase()==t.toLowerCase()&&(s=n)}),s}globalThis.customElements.get("custom-video")||(globalThis.customElements.define("custom-video",k),globalThis.CustomVideoElement=k);var ut=k;var o={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_MSE:"prefer-mse",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},zt=Object.values(o),Jt=gt(),Xt="mux-video",tt=class extends ut{constructor(){super();this.__metadata={};this.__playerInitTime=(0,y.generatePlayerInitTime)()}static get observedAttributes(){var t;return[...zt,...(t=ut.observedAttributes)!=null?t:[]]}get playerInitTime(){return this.__playerInitTime}get playerSoftwareName(){var t;return(t=this.__playerSoftwareName)!=null?t:Xt}set playerSoftwareName(t){this.__playerSoftwareName=t}get playerSoftwareVersion(){var t;return(t=this.__playerSoftwareVersion)!=null?t:Jt}set playerSoftwareVersion(t){this.__playerSoftwareVersion=t}get hls(){return console.warn("<mux-video>.hls is deprecated, please use ._hls instead"),this._hls}get _hls(){return this.__hls}get mux(){return this.nativeEl.mux}get error(){var t;return(t=(0,y.getError)(this.nativeEl))!=null?t:null}get errorTranslator(){return this.__errorTranslator}set errorTranslator(t){this.__errorTranslator=t}get src(){return this.getAttribute("src")}set src(t){t!==this.src&&(t==null?this.removeAttribute("src"):this.setAttribute("src",t))}get type(){var t;return(t=this.getAttribute(o.TYPE))!=null?t:void 0}set type(t){t!==this.type&&(t?this.setAttribute(o.TYPE,t):this.removeAttribute(o.TYPE))}get autoplay(){let t=this.getAttribute("autoplay");return t===null?!1:t===""?!0:t}set autoplay(t){let s=this.autoplay;t!==s&&(t?this.setAttribute("autoplay",typeof t=="string"?t:""):this.removeAttribute("autoplay"))}get debug(){return this.getAttribute(o.DEBUG)!=null}set debug(t){t!==this.debug&&(t?this.setAttribute(o.DEBUG,""):this.removeAttribute(o.DEBUG))}get startTime(){let t=this.getAttribute(o.START_TIME);if(t==null)return;let s=+t;return Number.isNaN(s)?void 0:s}set startTime(t){t!==this.startTime&&(t==null?this.removeAttribute(o.START_TIME):this.setAttribute(o.START_TIME,`${t}`))}get playbackId(){var t;return(t=this.getAttribute(o.PLAYBACK_ID))!=null?t:void 0}set playbackId(t){t!==this.playbackId&&(t?this.setAttribute(o.PLAYBACK_ID,t):this.removeAttribute(o.PLAYBACK_ID))}get customDomain(){var t;return(t=this.getAttribute(o.CUSTOM_DOMAIN))!=null?t:void 0}set customDomain(t){t!==this.customDomain&&(t?this.setAttribute(o.CUSTOM_DOMAIN,t):this.removeAttribute(o.CUSTOM_DOMAIN))}get envKey(){var t;return(t=this.getAttribute(o.ENV_KEY))!=null?t:void 0}set envKey(t){t!==this.envKey&&(t?this.setAttribute(o.ENV_KEY,t):this.removeAttribute(o.ENV_KEY))}get beaconCollectionDomain(){var t;return(t=this.getAttribute(o.BEACON_COLLECTION_DOMAIN))!=null?t:void 0}set beaconCollectionDomain(t){t!==this.beaconCollectionDomain&&(t?this.setAttribute(o.BEACON_COLLECTION_DOMAIN,t):this.removeAttribute(o.BEACON_COLLECTION_DOMAIN))}get streamType(){var t;return(t=this.getAttribute(o.STREAM_TYPE))!=null?t:void 0}set streamType(t){t!==this.streamType&&(t?this.setAttribute(o.STREAM_TYPE,t):this.removeAttribute(o.STREAM_TYPE))}get preferMse(){return this.getAttribute(o.PREFER_MSE)!=null}set preferMse(t){t?this.setAttribute(o.PREFER_MSE,""):this.removeAttribute(o.PREFER_MSE)}get metadata(){let t=this.getAttribute(o.METADATA_VIDEO_ID),s=this.getAttribute(o.METADATA_VIDEO_TITLE),n=this.getAttribute(o.METADATA_VIEWER_USER_ID);return{...this.__metadata,...t!=null?{video_id:t}:{},...s!=null?{video_title:s}:{},...n!=null?{viewer_user_id:n}:{}}}set metadata(t){this.__metadata=t!=null?t:{},this.mux&&this.mux.emit("hb",this.__metadata)}load(){let t=(0,y.initialize)(this,this.nativeEl,this.__hls);this.__hls=t;let s=(0,y.setupAutoplay)(this.nativeEl,this.autoplay,t);this.__updateAutoplay=s}unload(){(0,y.teardown)(this.nativeEl,this.__hls),this.__hls=void 0}attributeChangedCallback(t,s,n){var h;switch(super.attributeChangedCallback(t,s,n),t){case o.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=n!=null?n:void 0;break;case o.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=n!=null?n:void 0;break;case"src":let m=!!s,w=!!n;!m&&w?this.load():m&&!w?this.unload():m&&w&&(this.unload(),this.load());break;case"autoplay":if(n===s)break;(h=this.__updateAutoplay)==null||h.call(this,this.autoplay);break;case o.PLAYBACK_ID:this.src=(0,y.toMuxVideoURL)(n!=null?n:void 0,{domain:this.customDomain});break;case o.DEBUG:let P=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=P);break;case o.METADATA_URL:n&&fetch(n).then(q=>q.json()).then(q=>this.metadata=q).catch(q=>console.error(`Unable to load or parse metadata JSON from metadata-url ${n}!`));break;default:break}}disconnectedCallback(){this.unload()}};globalThis.customElements.get("mux-video")||(globalThis.customElements.define("mux-video",tt),globalThis.MuxVideoElement=tt);var Zt=tt; | ||
//# sourceMappingURL=index.cjs.js.map |
{ | ||
"name": "@mux/mux-video", | ||
"version": "0.8.3-canary.8-ce66df5", | ||
"version": "0.8.3-canary.9-0563c30", | ||
"description": "A custom mux video element for the browser that Just Works™", | ||
@@ -51,3 +51,3 @@ "main": "./dist/index.cjs.js", | ||
"dependencies": { | ||
"@mux/playback-core": "0.9.1-canary.8-ce66df5" | ||
"@mux/playback-core": "0.9.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "devDependencies": { |
@@ -69,3 +69,2 @@ import 'castable-video'; | ||
class CustomVideoElement extends HTMLElement { | ||
#hasAttrCallback; | ||
#isInit; | ||
@@ -169,7 +168,4 @@ | ||
attributeChangedCallback(attrName, oldValue, newValue) { | ||
// Initialize the attributes right after construction when they become available. | ||
if (!this.#hasAttrCallback && !this.isConnected) { | ||
this.#hasAttrCallback = true; | ||
this.#init(); | ||
} | ||
// Initialize right after construction when the attributes become available. | ||
this.#init(); | ||
@@ -220,3 +216,5 @@ this.#forwardAttribute(attrName, oldValue, newValue); | ||
connectedCallback() {} | ||
connectedCallback() { | ||
this.#init(); | ||
} | ||
} | ||
@@ -223,0 +221,0 @@ |
@@ -355,2 +355,4 @@ import { | ||
attributeChangedCallback(attrName: string, oldValue: string | null, newValue: string | null) { | ||
super.attributeChangedCallback(attrName, oldValue, newValue); | ||
switch (attrName) { | ||
@@ -410,4 +412,2 @@ case Attributes.PLAYER_SOFTWARE_NAME: | ||
} | ||
super.attributeChangedCallback(attrName, oldValue, newValue); | ||
} | ||
@@ -414,0 +414,0 @@ |
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
4330114
4982
+ Added@mux/playback-core@0.9.0(transitive)
- Removed@mux/playback-core@0.9.1-canary.8-ce66df5(transitive)
Updated@mux/playback-core@0.9.0