@mux/mux-video
Advanced tools
Comparing version 0.7.1-canary.1-04bc498 to 0.7.1-canary.2-44a0045
@@ -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.7.1-canary.1-04bc498"}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 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.7.1-canary.2-44a0045"}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=` | ||
<style> | ||
@@ -3,0 +3,0 @@ :host { |
{ | ||
"name": "@mux/mux-video", | ||
"version": "0.7.1-canary.1-04bc498", | ||
"version": "0.7.1-canary.2-44a0045", | ||
"description": "A custom mux video element for the browser that Just Works™", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs.js", |
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