@hanifhan1f/vidstack 1.12.24 → 1.12.26
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/cdn/chunks/vidstack-8JHLDxl5.js +1 -0
- package/cdn/chunks/vidstack-BBMfnVvt.js +1 -0
- package/cdn/chunks/vidstack-BkxGdzTJ.js +16 -0
- package/cdn/chunks/vidstack-Bzk6lVKb.js +1 -0
- package/cdn/chunks/vidstack-C0nMUcD9.js +1 -0
- package/cdn/chunks/vidstack-C51SKMUl.js +1 -0
- package/cdn/chunks/vidstack-CL95Hezv.js +1 -0
- package/cdn/chunks/vidstack-CkaxOIJb.js +1 -0
- package/cdn/chunks/vidstack-CnWKPIKT.js +16 -0
- package/cdn/chunks/vidstack-Cu8FqSS9.js +1 -0
- package/cdn/chunks/vidstack-DIPX97sJ.js +3 -0
- package/cdn/chunks/vidstack-DdAmWWBJ.js +1 -0
- package/cdn/chunks/vidstack-DhXI_0ND.js +1 -0
- package/cdn/chunks/vidstack-DiXE5sG8.js +1 -0
- package/cdn/chunks/vidstack-pFwe7gvT.js +3 -0
- package/cdn/providers/vidstack-audio-BAfEe7CJ.js +1 -0
- package/cdn/providers/vidstack-dash-CGZUJqdT.js +1 -0
- package/cdn/providers/vidstack-google-cast-Drb5Ncs5.js +1 -0
- package/cdn/providers/vidstack-hls-CVpa4usG.js +1 -0
- package/cdn/providers/vidstack-html-Bag27bH6.js +1 -0
- package/cdn/providers/vidstack-video-DXUiSn4B.js +1 -0
- package/cdn/providers/vidstack-vimeo-DD6HUOtJ.js +1 -0
- package/cdn/providers/vidstack-youtube-BVNE075s.js +1 -0
- package/cdn/vidstack.js +1 -1
- package/cdn/with-layouts/chunks/vidstack-2Rlth5Cf.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BP3ybDy9.js +912 -0
- package/cdn/with-layouts/chunks/vidstack-BaNApRCP.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BlWKO1g1.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BxJPOhv7.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BxdAdQ0H.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CROJF16Z.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CaW6KGwN.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CwzW7rJU.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DJyGEdCH.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Dd3L-eQj.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DeLOZ-hK.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-Dp3Ib32P.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Dy1Hfo7P.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-T2rZVigk.js +912 -0
- package/cdn/with-layouts/providers/vidstack-audio-cxaZF4jF.js +1 -0
- package/cdn/with-layouts/providers/vidstack-dash-DX1VjdTW.js +1 -0
- package/cdn/with-layouts/providers/vidstack-google-cast-DYJgNlvD.js +1 -0
- package/cdn/with-layouts/providers/vidstack-hls-2d6-2JAG.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-C9nnuK3r.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-EWE67g5i.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-DqFeS0-d.js +1 -0
- package/cdn/with-layouts/providers/vidstack-youtube-eivIFfMV.js +1 -0
- package/cdn/with-layouts/vidstack.js +1 -1
- package/dev/chunks/vidstack-44ILR0Cb.js +1521 -0
- package/dev/chunks/vidstack-B4XOm7dP.js +104 -0
- package/dev/chunks/vidstack-CEjYxSqZ.js +297 -0
- package/dev/chunks/vidstack-CQdFhXSo.js +204 -0
- package/dev/chunks/vidstack-CSryZFvY.js +1521 -0
- package/dev/chunks/vidstack-Cky9ors4.js +297 -0
- package/dev/chunks/vidstack-DLXCqdYV.js +3010 -0
- package/dev/chunks/vidstack-DS7nRfge.js +204 -0
- package/dev/chunks/vidstack-DWtK42Sh.js +1483 -0
- package/dev/chunks/vidstack-el2dbO0m.js +5181 -0
- package/dev/chunks/vidstack-rvhuswgi.js +2986 -0
- package/dev/define/plyr-layout.js +2 -2
- package/dev/define/templates/vidstack-audio-layout.js +1 -1
- package/dev/define/templates/vidstack-video-layout.js +1 -1
- package/dev/define/vidstack-player-default-layout.js +1 -1
- package/dev/define/vidstack-player-layouts.js +1 -1
- package/dev/define/vidstack-player-ui.js +4 -4
- package/dev/define/vidstack-player.js +2 -2
- package/dev/global/plyr.js +4 -4
- package/dev/global/vidstack-player.js +2 -2
- package/dev/vidstack-elements.js +7 -7
- package/dev/vidstack.js +4 -4
- package/package.json +1 -1
- package/prod/chunks/vidstack-C-yd_bAJ.js +4771 -0
- package/prod/chunks/vidstack-CFXAYpuh.js +1521 -0
- package/prod/chunks/vidstack-CIvL96_j.js +297 -0
- package/prod/chunks/vidstack-CYVCrFjx.js +201 -0
- package/prod/chunks/vidstack-Cs0fH84E.js +1521 -0
- package/prod/chunks/vidstack-DDePVDjt.js +2976 -0
- package/prod/chunks/vidstack-DXfGRhxZ.js +201 -0
- package/prod/chunks/vidstack-D_atbNqH.js +3000 -0
- package/prod/chunks/vidstack-DnRxQoqP.js +104 -0
- package/prod/chunks/vidstack-Ko2EJadT.js +1483 -0
- package/prod/chunks/vidstack-XA3zT5W9.js +297 -0
- package/prod/define/plyr-layout.js +2 -2
- package/prod/define/templates/vidstack-audio-layout.js +1 -1
- package/prod/define/templates/vidstack-video-layout.js +1 -1
- package/prod/define/vidstack-player-default-layout.js +1 -1
- package/prod/define/vidstack-player-layouts.js +1 -1
- package/prod/define/vidstack-player-ui.js +4 -4
- package/prod/define/vidstack-player.js +2 -2
- package/prod/global/plyr.js +4 -4
- package/prod/global/vidstack-player.js +2 -2
- package/prod/vidstack-elements.js +7 -7
- package/prod/vidstack.js +4 -4
- package/server/chunks/vidstack-B8P1aUCK.js +1503 -0
- package/server/chunks/vidstack-B8_v1VQn.js +3059 -0
- package/server/chunks/vidstack-BO8FLks6.js +295 -0
- package/server/chunks/vidstack-BosyhF3p.js +207 -0
- package/server/chunks/vidstack-C8F1EUBn.js +104 -0
- package/server/chunks/vidstack-CWho6PlG.js +141 -0
- package/server/chunks/vidstack-Db22EuE_.js +207 -0
- package/server/chunks/vidstack-DhF59-Up.js +4635 -0
- package/server/chunks/vidstack-DoHmOxNm.js +295 -0
- package/server/chunks/vidstack-DzWvfg1d.js +1503 -0
- package/server/chunks/vidstack-PnFpou7g.js +3035 -0
- package/server/chunks/vidstack-gEJMQpTE.js +2001 -0
- package/server/define/plyr-layout.js +2 -2
- package/server/define/vidstack-player-default-layout.js +1 -1
- package/server/define/vidstack-player-layouts.js +1 -1
- package/server/define/vidstack-player-ui.js +4 -4
- package/server/define/vidstack-player.js +2 -2
- package/server/global/plyr.js +4 -4
- package/server/global/vidstack-player.js +2 -2
- package/server/vidstack-elements.js +8 -8
- package/server/vidstack.js +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as t}from"../chunks/vidstack-Dy1Hfo7P.js";import{HTMLMediaProvider as e}from"./vidstack-html-C9nnuK3r.js";import{H as o}from"../chunks/vidstack-BlWKO1g1.js";import"../chunks/vidstack-CwzW7rJU.js";import"../chunks/vidstack-BaNApRCP.js";import"../chunks/vidstack-Bxv1Qnxe.js";import"../chunks/vidstack-C_AxqLKV.js";class s extends e{$$PROVIDER_TYPE="AUDIO";get type(){return"audio"}airPlay;constructor(r,i){super(r,i),t(()=>{this.airPlay=new o(this.media,i)},this.scope)}setup(){super.setup(),this.type==="audio"&&this.ctx.notify("provider-setup",this)}get audio(){return this.media}}export{s as AudioProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as x,p as k}from"../chunks/vidstack-CROJF16Z.js";import{h as M,f as C,a as N,j as R}from"../chunks/vidstack-CwzW7rJU.js";import{VideoProvider as F}from"./vidstack-video-EWE67g5i.js";import{l as S,e as I,D as l,K as P,i as u,Q as _,H as v,j as $,p as q}from"../chunks/vidstack-Dy1Hfo7P.js";import{Q as b}from"../chunks/vidstack-DRH_1tFW.js";import{T as m,a as H}from"../chunks/vidstack-DeLOZ-hK.js";import{L as p}from"../chunks/vidstack-C_AxqLKV.js";import{R as j}from"../chunks/vidstack-BaNApRCP.js";import{c as Q}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-C9nnuK3r.js";import"../chunks/vidstack-Bxv1Qnxe.js";import"../chunks/vidstack-BlWKO1g1.js";function w(n){try{return new Intl.DisplayNames(navigator.languages,{type:"language"}).of(n)??null}catch{return null}}const O=n=>`dash-${_(n)}`;class G{#e;#i;#t=null;#a=new Set;#r=null;config={};get instance(){return this.#t}constructor(t,i){this.#e=t,this.#i=i}setup(t){this.#t=t().create();const i=this.#m.bind(this);for(const s of Object.values(t.events))this.#t.on(s,i);this.#t.on(t.events.ERROR,this.#b.bind(this));for(const s of this.#a)s(this.#t);this.#i.player.dispatch("dash-instance",{detail:this.#t}),this.#t.initialize(this.#e,void 0,!1),this.#t.updateSettings({streaming:{text:{defaultEnabled:!1,dispatchForManualRendering:!0},buffer:{fastSwitchEnabled:!0}},...this.config}),this.#t.on(t.events.FRAGMENT_LOADING_STARTED,this.#w.bind(this)),this.#t.on(t.events.FRAGMENT_LOADING_COMPLETED,this.#E.bind(this)),this.#t.on(t.events.MANIFEST_LOADED,this.#v.bind(this)),this.#t.on(t.events.QUALITY_CHANGE_RENDERED,this.#S.bind(this)),this.#t.on(t.events.TEXT_TRACKS_ADDED,this.#y.bind(this)),this.#t.on(t.events.TRACK_CHANGE_RENDERED,this.#T.bind(this)),this.#i.qualities[b.enableAuto]=this.#A.bind(this),S(this.#i.qualities,"change",this.#D.bind(this)),S(this.#i.audioTracks,"change",this.#x.bind(this)),this.#r=I(this.#d.bind(this))}#s(t){return new l(O(t.type),{detail:t})}#d(){if(!this.#i.$state.live())return;const t=new j(this.#f.bind(this));return t.start(),t.stop.bind(t)}#f(){if(!this.#t)return;const t=this.#t.duration()-this.#t.time();this.#i.$state.liveSyncPosition.set(isNaN(t)?1/0:t)}#m(t){this.#i.player?.dispatch(this.#s(t))}#n=null;#h={};#g(t){const i=this.#n?.[m.native],s=(i?.track).cues;if(!i||!s)return;const r=this.#n.id,a=this.#h[r]??0,o=this.#s(t);for(let c=a;c<s.length;c++){const h=s[c];h.positionAlign||(h.positionAlign="auto"),this.#n.addCue(h,o)}this.#h[r]=s.length}#y(t){if(!this.#t)return;const i=t.tracks,s=[...this.#e.textTracks].filter(a=>"manualMode"in a),r=this.#s(t);for(let a=0;a<s.length;a++){const o=i[a],c=s[a],h=`dash-${o.kind}-${a}`,d=new H({id:h,label:o?.label??o.labels.find(g=>g.text)?.text??(o?.lang&&w(o.lang))??o?.lang??void 0,language:o.lang??void 0,kind:o.kind,default:o.defaultTrack});d[m.native]={managed:!0,track:c},d[m.readyState]=2,d[m.onModeChange]=()=>{this.#t&&(d.mode==="showing"?(this.#t.setTextTrack(a),this.#n=d):(this.#t.setTextTrack(-1),this.#n=null))},this.#i.textTracks.add(d,r)}}#T(t){const{mediaType:i,newMediaInfo:s}=t;if(i==="audio"){const r=this.#i.audioTracks.getById(`dash-audio-${s.index}`);if(r){const a=this.#s(t);this.#i.audioTracks[p.select](r,!0,a)}}}#S(t){if(t.mediaType!=="video")return;const i=this.#i.qualities[t.newQuality];if(i){const s=this.#s(t);this.#i.qualities[p.select](i,!0,s)}}#v(t){if(this.#i.$state.canPlay()||!this.#t)return;const{type:i,mediaPresentationDuration:s}=t.data,r=this.#s(t);this.#i.notify("stream-type-change",i!=="static"?"live":"on-demand",r),this.#i.notify("duration-change",s,r),this.#i.qualities[b.setAuto](!0,r);const a=this.#t.getVideoElement(),o=this.#t.getTracksForTypeFromManifest("video",t.data),c=[...new Set(o.map(e=>e.mimeType))].find(e=>e&&M(a,e)),h=o.filter(e=>c===e.mimeType)[0];let d=this.#t.getTracksForTypeFromManifest("audio",t.data);const g=[...new Set(d.map(e=>e.mimeType))].find(e=>e&&C(a,e));if(d=d.filter(e=>g===e.mimeType),h.bitrateList.forEach((e,f)=>{const y={id:e.id?.toString()??`dash-bitrate-${f}`,width:e.width??0,height:e.height??0,bitrate:e.bandwidth??0,codec:h.codec,index:f};this.#i.qualities[p.add](y,r)}),P(h.index)){const e=this.#i.qualities[h.index];e&&this.#i.qualities[p.select](e,!0,r)}d.forEach((e,f)=>{const L=e.labels.find(T=>navigator.languages.some(D=>T.lang&&D.toLowerCase().startsWith(T.lang.toLowerCase())))||e.labels[0],A={id:`dash-audio-${e?.index}`,label:L?.text??(e.lang&&w(e.lang))??e.lang??"",language:e.lang??"",kind:"main",mimeType:e.mimeType,codec:e.codec,index:f};this.#i.audioTracks[p.add](A,r)}),a.dispatchEvent(new l("canplay",{trigger:r}))}#b(t){const{type:i,error:s}=t;switch(s.code){case 27:this.#L(s);break;default:this.#l(s);break}}#w(){this.#o>=0&&this.#c()}#E(t){t.mediaType==="text"&&requestAnimationFrame(this.#g.bind(this,t))}#o=-1;#L(t){this.#c(),this.#t?.play(),this.#o=window.setTimeout(()=>{this.#o=-1,this.#l(t)},5e3)}#c(){clearTimeout(this.#o),this.#o=-1}#l(t){this.#i.notify("error",{message:t.message??"",code:1,error:t})}#A(){this.#u("video",!0);const{qualities:t}=this.#i;this.#t?.setQualityFor("video",t.selectedIndex,!0)}#u(t,i){this.#t?.updateSettings({streaming:{abr:{autoSwitchBitrate:{[t]:i}}}})}#D(){const{qualities:t}=this.#i;!this.#t||t.auto||!t.selected||(this.#u("video",!1),this.#t.setQualityFor("video",t.selectedIndex,t.switch==="current"),N&&(this.#e.currentTime=this.#e.currentTime))}#x(){if(!this.#t)return;const{audioTracks:t}=this.#i,i=this.#t.getTracksFor("audio").find(s=>t.selected&&t.selected.id===`dash-audio-${s.index}`);i&&this.#t.setCurrentTrack(i)}#p(){this.#c(),this.#n=null,this.#h={}}onInstance(t){return this.#a.add(t),()=>this.#a.delete(t)}loadSource(t){this.#p(),u(t.src)&&this.#t?.attachSource(t.src)}destroy(){this.#p(),this.#t?.destroy(),this.#t=null,this.#r?.(),this.#r=null}}class V{#e;#i;#t;constructor(t,i,s){this.#e=t,this.#i=i,this.#t=s,this.#a()}async#a(){const t={onLoadStart:this.#r.bind(this),onLoaded:this.#s.bind(this),onLoadError:this.#d.bind(this)};let i=await U(this.#e,t);if(v(i)&&!u(this.#e)&&(i=await K(this.#e,t)),!i)return null;if(!window.dashjs.supportsMediaSource()){const s="[vidstack] `dash.js` is not supported in this environment";return this.#i.player.dispatch(new l("dash-unsupported")),this.#i.notify("error",{message:s,code:4}),null}return i}#r(){this.#i.player.dispatch(new l("dash-lib-load-start"))}#s(t){this.#i.player.dispatch(new l("dash-lib-loaded",{detail:t})),this.#t(t)}#d(t){const i=Q(t);this.#i.player.dispatch(new l("dash-lib-load-error",{detail:i})),this.#i.notify("error",{message:i.message,code:4,error:i})}}async function K(n,t={}){if(!v(n)){if(t.onLoadStart?.(),B(n))return t.onLoaded?.(n),n;if(E(n)){const i=n.MediaPlayer;return t.onLoaded?.(i),i}try{const i=(await n())?.default;if(E(i))return t.onLoaded?.(i.MediaPlayer),i.MediaPlayer;if(i)t.onLoaded?.(i);else throw Error("");return i}catch(i){t.onLoadError?.(i)}}}async function U(n,t={}){if(u(n)){t.onLoadStart?.();try{if(await x(n),!$(window.dashjs.MediaPlayer))throw Error("");const i=window.dashjs.MediaPlayer;return t.onLoaded?.(i),i}catch(i){t.onLoadError?.(i)}}}function B(n){return n&&n.prototype&&n.prototype!==Function}function E(n){return n&&"MediaPlayer"in n}const Y="https://cdn.jsdelivr.net";class z extends F{$$PROVIDER_TYPE="DASH";#e=null;#i=new G(this.video,this.ctx);get ctor(){return this.#e}get instance(){return this.#i.instance}static supported=R();get type(){return"dash"}get canLiveSync(){return!0}#t=`${Y}/npm/dashjs@4.7.4/dist/dash.all.min.js`;get config(){return this.#i.config}set config(t){this.#i.config=t}get library(){return this.#t}set library(t){this.#t=t}preconnect(){u(this.#t)&&k(this.#t)}setup(){super.setup(),new V(this.#t,this.ctx,t=>{this.#e=t,this.#i.setup(t),this.ctx.notify("provider-setup",this);const i=q(this.ctx.$state.source);i&&this.loadSource(i)})}async loadSource(t,i){if(!u(t.src)){this.removeSource();return}this.media.preload=i||"",this.appendSource(t,"application/x-mpegurl"),this.#i.loadSource(t),this.currentSrc=t}onInstance(t){const i=this.#i.instance;return i&&t(i),this.#i.onInstance(t)}destroy(){this.#i.destroy()}}export{z as DASHProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l,e as g,g as k,ak as y,a5 as u,o as p,D as m,p as h}from"../chunks/vidstack-Dy1Hfo7P.js";import{T as o}from"../chunks/vidstack-CaW6KGwN.js";import{R as C}from"../chunks/vidstack-BaNApRCP.js";import{L as E}from"../chunks/vidstack-C_AxqLKV.js";import{g as T,a as v,b as L,h as f,l as S,c as A}from"../chunks/vidstack-BxdAdQ0H.js";class I{#t;constructor(t){this.#t=new chrome.cast.media.MediaInfo(t.src,t.type)}build(){return this.#t}setStreamType(t){return t.includes("live")?this.#t.streamType=chrome.cast.media.StreamType.LIVE:this.#t.streamType=chrome.cast.media.StreamType.BUFFERED,this}setTracks(t){return this.#t.tracks=t.map(this.#e),this}setMetadata(t,e){return this.#t.metadata=new chrome.cast.media.GenericMediaMetadata,this.#t.metadata.title=t,this.#t.metadata.images=[{url:e}],this}#e(t,e){const s=new chrome.cast.media.Track(e,chrome.cast.media.TrackType.TEXT);return s.name=t.label,s.trackContentId=t.src,s.trackContentType="text/vtt",s.language=t.language,s.subtype=t.kind.toUpperCase(),s}}class b{#t;#e;#i;constructor(t,e,s){this.#t=t,this.#e=e,this.#i=s}setup(){const t=this.syncRemoteActiveIds.bind(this);l(this.#e.audioTracks,"change",t),l(this.#e.textTracks,"mode-change",t),g(this.#n.bind(this))}getLocalTextTracks(){return this.#e.$state.textTracks().filter(t=>t.src&&t.type==="vtt")}#a(){return this.#e.$state.audioTracks()}#r(t){const e=this.#t.mediaInfo?.tracks??[];return t?e.filter(s=>s.type===t):e}#l(){const t=[],e=this.#a().find(i=>i.selected),s=this.getLocalTextTracks().filter(i=>i.mode==="showing");if(e){const i=this.#r(chrome.cast.media.TrackType.AUDIO),r=this.#d(i,e);r&&t.push(r.trackId)}if(s?.length){const i=this.#r(chrome.cast.media.TrackType.TEXT);if(i.length)for(const r of s){const a=this.#d(i,r);a&&t.push(a.trackId)}}return t}#n(){const t=this.getLocalTextTracks();if(!this.#t.isMediaLoaded)return;const e=this.#r(chrome.cast.media.TrackType.TEXT);for(const s of t)if(!this.#d(e,s)){k(()=>this.#i?.());break}}syncRemoteTracks(t){if(!this.#t.isMediaLoaded)return;const e=this.#a(),s=this.getLocalTextTracks(),i=this.#r(chrome.cast.media.TrackType.AUDIO),r=this.#r(chrome.cast.media.TrackType.TEXT);for(const a of i){if(this.#h(e,a))continue;const n={id:a.trackId.toString(),label:a.name,language:a.language,kind:a.subtype??"main",selected:!1};this.#e.audioTracks[E.add](n,t)}for(const a of r){if(this.#h(s,a))continue;const n={id:a.trackId.toString(),src:a.trackContentId,label:a.name,language:a.language,kind:a.subtype.toLowerCase()};this.#e.textTracks.add(n,t)}}syncRemoteActiveIds(t){if(!this.#t.isMediaLoaded)return;const e=this.#l(),s=new chrome.cast.media.EditTracksInfoRequest(e);this.#c(s).catch(i=>{})}#c(t){const e=T();return new Promise((s,i)=>e?.editTracksInfo(t,s,i))}#h(t,e){return t.find(s=>this.#s(s,e))}#d(t,e){return t.find(s=>this.#s(e,s))}#s(t,e){return e.name===t.label&&e.language===t.language&&e.subtype.toLowerCase()===t.kind.toLowerCase()}}class R{$$PROVIDER_TYPE="GOOGLE_CAST";scope=y();#t;#e;#i;#a=null;#r="disconnected";#l=0;#n=0;#c=new o(0,0);#h=new C(this.#b.bind(this));#d;#s=null;#u=!1;constructor(t,e){this.#t=t,this.#e=e,this.#i=new b(t,e,this.#G.bind(this))}get type(){return"google-cast"}get currentSrc(){return this.#a}get player(){return this.#t}get cast(){return v()}get session(){return L()}get media(){return T()}get hasActiveSession(){return f(this.#a)}setup(){this.#L(),this.#S(),this.#i.setup(),this.#e.notify("provider-setup",this)}#L(){S(cast.framework.CastContextEventType.CAST_STATE_CHANGED,this.#f.bind(this))}#S(){const t=cast.framework.RemotePlayerEventType,e={[t.IS_CONNECTED_CHANGED]:this.#f,[t.IS_MEDIA_LOADED_CHANGED]:this.#g,[t.CAN_CONTROL_VOLUME_CHANGED]:this.#k,[t.CAN_SEEK_CHANGED]:this.#y,[t.DURATION_CHANGED]:this.#D,[t.IS_MUTED_CHANGED]:this.#p,[t.VOLUME_LEVEL_CHANGED]:this.#p,[t.IS_PAUSED_CHANGED]:this.#N,[t.LIVE_SEEKABLE_RANGE_CHANGED]:this.#C,[t.PLAYER_STATE_CHANGED]:this.#P};this.#d=e;const s=this.#R.bind(this);for(const i of u(e))this.#t.controller.addEventListener(i,s);p(()=>{for(const i of u(e))this.#t.controller.removeEventListener(i,s)})}async play(){if(!(!this.#t.isPaused&&!this.#u)){if(this.#u){await this.#v(!1,0);return}this.#t.controller?.playOrPause()}}async pause(){this.#t.isPaused||this.#t.controller?.playOrPause()}getMediaStatus(t){return new Promise((e,s)=>{this.media?.getStatus(t,e,s)})}setMuted(t){(t&&!this.#t.isMuted||!t&&this.#t.isMuted)&&this.#t.controller?.muteOrUnmute()}setCurrentTime(t){this.#t.currentTime=t,this.#e.notify("seeking",t),this.#t.controller?.seek()}setVolume(t){this.#t.volumeLevel=t,this.#t.controller?.setVolumeLevel()}async loadSource(t){if(this.#s?.src!==t&&(this.#s=null),f(t)){this.#A(),this.#a=t;return}this.#e.notify("load-start");const e=this.#x(t),s=await this.session.loadMedia(e);if(s){this.#a=null,this.#e.notify("error",Error(A(s)));return}this.#a=t}destroy(){this.#m(),this.#T()}#m(){this.#s||(this.#n=0,this.#c=new o(0,0)),this.#h.stop(),this.#l=0,this.#s=null}#A(){const t=new m("resume-session",{detail:this.session});this.#g(t);const{muted:e,volume:s,savedState:i}=this.#e.$state,r=i();this.setCurrentTime(Math.max(this.#t.currentTime,r?.currentTime??0)),this.setMuted(e()),this.setVolume(s()),r?.paused===!1&&this.play()}#T(){this.cast.endCurrentSession(!0);const{remotePlaybackLoader:t}=this.#e.$state;t.set(null)}#I(){const{savedState:t}=this.#e.$state;t.set({paused:this.#t.isPaused,currentTime:this.#t.currentTime}),this.#T()}#b(){this.#M()}#R(t){this.#d[t.type].call(this,t)}#f(t){const e=this.cast.getCastState(),s=e===cast.framework.CastState.CONNECTED?"connected":e===cast.framework.CastState.CONNECTING?"connecting":"disconnected";if(this.#r===s)return;const i={type:"google-cast",state:s},r=this.#o(t);this.#r=s,this.#e.notify("remote-playback-change",i,r),s==="disconnected"&&this.#I()}#g(t){if(!!!this.#t.isMediaLoaded)return;const s=h(this.#e.$state.source);Promise.resolve().then(()=>{if(s!==h(this.#e.$state.source)||!this.#t.isMediaLoaded)return;this.#m();const i=this.#t.duration;this.#c=new o(0,i);const r={provider:this,duration:i,buffered:new o(0,0),seekable:this.#E()},a=this.#o(t);this.#e.notify("loaded-metadata",void 0,a),this.#e.notify("loaded-data",void 0,a),this.#e.notify("can-play",r,a),this.#k(),this.#y(t);const{volume:c,muted:n}=this.#e.$state;this.setVolume(c()),this.setMuted(n()),this.#h.start(),this.#i.syncRemoteTracks(a),this.#i.syncRemoteActiveIds(a)})}#k(){this.#e.$state.canSetVolume.set(this.#t.canControlVolume)}#y(t){const e=this.#o(t);this.#e.notify("stream-type-change",this.#w(),e)}#w(){return this.#t.mediaInfo?.streamType===chrome.cast.media.StreamType.LIVE?this.#t.canSeek?"live:dvr":"live":"on-demand"}#M(){if(this.#s)return;const t=this.#t.currentTime;t!==this.#l&&(this.#e.notify("time-change",t),t>this.#n&&(this.#n=t,this.#C()),this.#e.$state.seeking()&&this.#e.notify("seeked",t),this.#l=t)}#D(t){if(!this.#t.isMediaLoaded||this.#s)return;const e=this.#t.duration,s=this.#o(t);this.#c=new o(0,e),this.#e.notify("duration-change",e,s)}#p(t){if(!this.#t.isMediaLoaded)return;const e={muted:this.#t.isMuted,volume:this.#t.volumeLevel},s=this.#o(t);this.#e.notify("volume-change",e,s)}#N(t){const e=this.#o(t);this.#t.isPaused?this.#e.notify("pause",void 0,e):this.#e.notify("play",void 0,e)}#C(t){const e={seekable:this.#E(),buffered:new o(0,this.#n)},s=t?this.#o(t):void 0;this.#e.notify("progress",e,s)}#P(t){const e=this.#t.playerState,s=chrome.cast.media.PlayerState;if(this.#u=e===s.IDLE,e===s.PAUSED)return;const i=this.#o(t);switch(e){case s.PLAYING:this.#e.notify("playing",void 0,i);break;case s.BUFFERING:this.#e.notify("waiting",void 0,i);break;case s.IDLE:this.#h.stop(),this.#e.notify("pause"),this.#e.notify("end");break}}#E(){return this.#t.liveSeekableRange?new o(this.#t.liveSeekableRange.start,this.#t.liveSeekableRange.end):this.#c}#o(t){return t instanceof Event?t:new m(t.type,{detail:t})}#_(t){const{streamType:e,title:s,poster:i}=this.#e.$state;return new I(t).setMetadata(s(),i()).setStreamType(e()).setTracks(this.#i.getLocalTextTracks()).build()}#x(t){const e=this.#_(t),s=new chrome.cast.media.LoadRequest(e),i=this.#e.$state.savedState();return s.autoplay=(this.#s?.paused??i?.paused)===!1,s.currentTime=this.#s?.time??i?.currentTime??0,s}async#v(t,e){const s=h(this.#e.$state.source);this.#s={src:s,paused:t,time:e},await this.loadSource(s)}#G(){this.#v(this.#t.isPaused,this.#t.currentTime).catch(t=>{})}}export{R as GoogleCastProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as L,p as S}from"../chunks/vidstack-CROJF16Z.js";import{a as E,l as T}from"../chunks/vidstack-CwzW7rJU.js";import{VideoProvider as b}from"./vidstack-video-EWE67g5i.js";import{p as f,l as v,e as k,D as d,i as l,Q as w,H as y,j as x}from"../chunks/vidstack-Dy1Hfo7P.js";import{Q as g}from"../chunks/vidstack-DRH_1tFW.js";import{a as D,T as m}from"../chunks/vidstack-DeLOZ-hK.js";import{L as u}from"../chunks/vidstack-C_AxqLKV.js";import{R as C}from"../chunks/vidstack-BaNApRCP.js";import{c as H}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-C9nnuK3r.js";import"../chunks/vidstack-Bxv1Qnxe.js";import"../chunks/vidstack-BlWKO1g1.js";const I=r=>w(r);class A{#e;#t;#i=null;#n=null;config={};#r=new Set;get instance(){return this.#i}constructor(t,i){this.#e=t,this.#t=i}setup(t){const{streamType:i}=this.#t.$state,e=f(i).includes("live"),s=f(i).includes("ll-");this.#i=new t({lowLatencyMode:s,backBufferLength:s?4:e?8:void 0,renderTextTracksNatively:!1,...this.config});const o=this.#h.bind(this);for(const n of Object.values(t.Events))this.#i.on(n,o);this.#i.on(t.Events.ERROR,this.#v.bind(this));for(const n of this.#r)n(this.#i);this.#t.player.dispatch("hls-instance",{detail:this.#i}),this.#i.attachMedia(this.#e),this.#i.on(t.Events.AUDIO_TRACK_SWITCHED,this.#l.bind(this)),this.#i.on(t.Events.LEVEL_SWITCHED,this.#u.bind(this)),this.#i.on(t.Events.LEVEL_LOADED,this.#f.bind(this)),this.#i.on(t.Events.LEVEL_UPDATED,this.#p.bind(this)),this.#i.on(t.Events.NON_NATIVE_TEXT_TRACKS_FOUND,this.#c.bind(this)),this.#i.on(t.Events.CUES_PARSED,this.#d.bind(this)),this.#t.qualities[g.enableAuto]=this.#g.bind(this),v(this.#t.qualities,"change",this.#m.bind(this)),v(this.#t.audioTracks,"change",this.#L.bind(this)),this.#n=k(this.#o.bind(this))}#s(t,i){return new d(I(t),{detail:i})}#o(){if(!this.#t.$state.live())return;const t=new C(this.#a.bind(this));return t.start(),t.stop.bind(t)}#a(){this.#t.$state.liveSyncPosition.set(this.#i?.liveSyncPosition??1/0)}#h(t,i){this.#t.player?.dispatch(this.#s(t,i))}#c(t,i){const e=this.#s(t,i);let s=-1;for(let o=0;o<i.tracks.length;o++){const n=i.tracks[o],h=n.subtitleTrack??n.closedCaptions,c=new D({id:`hls-${n.kind}-${o}`,src:h?.url,label:n.label,language:h?.lang,kind:n.kind,default:n.default});c[m.readyState]=2,c[m.onModeChange]=()=>{c.mode==="showing"?(this.#i.subtitleTrack=o,s=o):s===o&&(this.#i.subtitleTrack=-1,s=-1)},this.#t.textTracks.add(c,e)}}#d(t,i){const e=this.#i?.subtitleTrack,s=this.#t.textTracks.getById(`hls-${i.type}-${e}`);if(!s)return;const o=this.#s(t,i);for(const n of i.cues)n.positionAlign="auto",s.addCue(n,o)}#l(t,i){const e=this.#t.audioTracks[i.id];if(e){const s=this.#s(t,i);this.#t.audioTracks[u.select](e,!0,s)}}#u(t,i){const e=this.#t.qualities[i.level];if(e){const s=this.#s(t,i);this.#t.qualities[u.select](e,!0,s)}}#p(t,i){i.details.totalduration>0&&this.#t.$state.inferredLiveDVRWindow.set(i.details.totalduration)}#f(t,i){if(this.#t.$state.canPlay())return;const{type:e,live:s,totalduration:o,targetduration:n}=i.details,h=this.#s(t,i);this.#t.notify("stream-type-change",s?e==="EVENT"&&Number.isFinite(o)&&n>=10?"live:dvr":"live":"on-demand",h),this.#t.notify("duration-change",o,h);const c=this.#i.media;this.#i.currentLevel===-1&&this.#t.qualities[g.setAuto](!0,h);for(const a of this.#i.audioTracks){const p={id:a.id.toString(),label:a.name,language:a.lang||"",kind:"main"};this.#t.audioTracks[u.add](p,h)}for(const a of this.#i.levels){const p={id:a.id?.toString()??a.height+"p",width:a.width,height:a.height,codec:a.codecSet,bitrate:a.bitrate};this.#t.qualities[u.add](p,h)}c.dispatchEvent(new d("canplay",{trigger:h}))}#v(t,i){if(i.fatal)switch(i.type){case"mediaError":this.#i?.recoverMediaError();break;default:this.#y(i.error);break}}#y(t){this.#t.notify("error",{message:t.message,code:1,error:t})}#g(){this.#i&&(this.#i.currentLevel=-1)}#m(){const{qualities:t}=this.#t;!this.#i||t.auto||(this.#i[t.switch+"Level"]=t.selectedIndex,E&&(this.#e.currentTime=this.#e.currentTime))}#L(){const{audioTracks:t}=this.#t;this.#i&&this.#i.audioTrack!==t.selectedIndex&&(this.#i.audioTrack=t.selectedIndex)}onInstance(t){return this.#r.add(t),()=>this.#r.delete(t)}loadSource(t){l(t.src)&&this.#i?.loadSource(t.src)}destroy(){this.#i?.destroy(),this.#i=null,this.#n?.(),this.#n=null}}class _{#e;#t;#i;constructor(t,i,e){this.#e=t,this.#t=i,this.#i=e,this.#n()}async#n(){const t={onLoadStart:this.#r.bind(this),onLoaded:this.#s.bind(this),onLoadError:this.#o.bind(this)};let i=await R(this.#e,t);if(y(i)&&!l(this.#e)&&(i=await $(this.#e,t)),!i)return null;if(!i.isSupported()){const e="[vidstack] `hls.js` is not supported in this environment";return this.#t.player.dispatch(new d("hls-unsupported")),this.#t.notify("error",{message:e,code:4}),null}return i}#r(){this.#t.player.dispatch(new d("hls-lib-load-start"))}#s(t){this.#t.player.dispatch(new d("hls-lib-loaded",{detail:t})),this.#i(t)}#o(t){const i=H(t);this.#t.player.dispatch(new d("hls-lib-load-error",{detail:i})),this.#t.notify("error",{message:i.message,code:4,error:i})}}async function $(r,t={}){if(!y(r)){if(t.onLoadStart?.(),r.prototype&&r.prototype!==Function)return t.onLoaded?.(r),r;try{const i=(await r())?.default;if(i&&i.isSupported)t.onLoaded?.(i);else throw Error("");return i}catch(i){t.onLoadError?.(i)}}}async function R(r,t={}){if(l(r)){t.onLoadStart?.();try{if(await L(r),!x(window.Hls))throw Error("");const i=window.Hls;return t.onLoaded?.(i),i}catch(i){t.onLoadError?.(i)}}}const O="https://cdn.jsdelivr.net";class P extends b{$$PROVIDER_TYPE="HLS";#e=null;#t=new A(this.video,this.ctx);get ctor(){return this.#e}get instance(){return this.#t.instance}static supported=T();get type(){return"hls"}get canLiveSync(){return!0}#i=`${O}/npm/hls.js@^1.5.0/dist/hls.min.js`;get config(){return this.#t.config}set config(t){this.#t.config=t}get library(){return this.#i}set library(t){this.#i=t}preconnect(){l(this.#i)&&S(this.#i)}setup(){super.setup(),new _(this.#i,this.ctx,t=>{this.#e=t,this.#t.setup(t),this.ctx.notify("provider-setup",this);const i=f(this.ctx.$state.source);i&&this.loadSource(i)})}async loadSource(t,i){if(!l(t.src)){this.removeSource();return}this.media.preload=i||"",this.appendSource(t,"application/x-mpegurl"),this.#t.loadSource(t),this.currentSrc=t}onInstance(t){const i=this.#t.instance;return i&&t(i),this.#t.onInstance(t)}destroy(){this.#t.destroy()}}export{P as HLSProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as r,b as T,m as S,r as k}from"../chunks/vidstack-CwzW7rJU.js";import{s as f,E as m,e as C,o as y,p as E,a2 as w,l as p,D as P,ak as A,k as h,i as L}from"../chunks/vidstack-Dy1Hfo7P.js";import{R as x}from"../chunks/vidstack-BaNApRCP.js";import{g}from"../chunks/vidstack-Bxv1Qnxe.js";import{L as c}from"../chunks/vidstack-C_AxqLKV.js";let o=null,d=[],u=[];function l(){return o??=new AudioContext}function $(){const s=l(),t=s.createGain();return t.connect(s.destination),d.push(t),t}function G(s,t){const i=l(),e=i.createMediaElementSource(s);return t&&e.connect(t),u.push(e),e}function N(s){const t=d.indexOf(s);t!==-1&&(d.splice(t,1),s.disconnect(),v())}function M(s){const t=u.indexOf(s);t!==-1&&(u.splice(t,1),s.disconnect(),v())}function v(){o&&d.length===0&&u.length===0&&o.close().then(()=>{o=null})}class R{#n;#t;#e=null;#a=null;get currentGain(){return this.#e?.gain?.value??null}get supported(){return!0}constructor(t,i){this.#n=t,this.#t=i}setGain(t){const i=this.currentGain;if(t!==this.currentGain){if(t===1&&i!==1){this.removeGain();return}this.#e||(this.#e=$(),this.#a&&this.#a.connect(this.#e)),this.#a||(this.#a=G(this.#n,this.#e)),this.#e.gain.value=t,this.#t(t)}}removeGain(){this.#e&&(this.#a&&this.#a.connect(l().destination),this.#r(),this.#t(null))}destroy(){this.#h(),this.#r()}#h(){if(this.#a)try{M(this.#a)}catch{}finally{this.#a=null}}#r(){if(this.#e)try{N(this.#e)}catch{}finally{this.#e=null}}}const D=["focus","blur","visibilitychange","pageshow","pagehide"];class O{#n=f(b());#t=f(document.visibilityState);#e;connect(){const t=new m(window),i=this.#a.bind(this);for(const e of D)t.add(e,i);r&&t.add("beforeunload",e=>{this.#e=setTimeout(()=>{e.defaultPrevented||e.returnValue.length>0||(this.#n.set("hidden"),this.#t.set("hidden"))},0)})}get pageState(){return this.#n()}get visibility(){return this.#t()}#a(t){r&&window.clearTimeout(this.#e),(t.type!=="blur"||this.#n()==="active")&&(this.#n.set(b(t)),this.#t.set(document.visibilityState=="hidden"?"hidden":"visible"))}}function b(s){return s?.type==="blur"||document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}class I{#n;#t;#e=!1;#a=!1;#h=!1;#r=new x(this.#p.bind(this));#d=new O;#u;get#i(){return this.#n.media}constructor(t,i){this.#n=t,this.#t=i,this.#u=new m(t.media),this.#g(),this.#d.connect(),C(this.#M.bind(this)),y(this.#y.bind(this))}#y(){this.#a=!1,this.#h=!1,this.#r.stop(),this.#u.abort(),this.#T?.clear()}#c=0;#l=-1;#p(){const t=this.#i.currentTime;!(r&&t-this.#l<.35)&&this.#c!==t&&(this.#o(t),this.#c=t)}#g(){this.#s("loadstart",this.#S),this.#s("abort",this.#m),this.#s("emptied",this.#k),this.#s("error",this.#H),this.#s("volumechange",this.#O)}#v(){this.#a||(this.#s("loadeddata",this.#C),this.#s("loadedmetadata",this.#E),this.#s("canplay",this.#A),this.#s("canplaythrough",this.#L),this.#s("durationchange",this.#D),this.#s("play",this.#w),this.#s("progress",this.#U),this.#s("stalled",this.#$),this.#s("suspend",this.#V),this.#s("ratechange",this.#q),this.#a=!0)}#b(){this.#h||(this.#s("pause",this.#P),this.#s("playing",this.#x),this.#s("seeked",this.#I),this.#s("seeking",this.#F),this.#s("ended",this.#N),this.#s("waiting",this.#G),this.#h=!0)}#T=void 0;#j=void 0;#s(t,i){this.#u.add(t,i.bind(this))}#B(t){}#o(t,i){const e=Math.min(t,this.#t.$state.seekableEnd());this.#t.notify("time-change",e,i)}#S(t){if(this.#i.networkState===3){this.#m(t);return}this.#v(),this.#t.notify("load-start",void 0,t)}#m(t){this.#t.notify("abort",void 0,t)}#k(){this.#t.notify("emptied",void 0,event)}#C(t){this.#t.notify("loaded-data",void 0,t)}#E(t){this.#c=0,this.#l=-1,this.#b(),this.#t.notify("loaded-metadata",void 0,t),(T||r&&S(this.#t.$state.source()))&&this.#t.delegate.ready(this.#f(),t)}#f(){return{provider:E(this.#t.$provider),duration:this.#i.duration,buffered:this.#i.buffered,seekable:this.#i.seekable}}#w(t){this.#t.$state.canPlay&&this.#t.notify("play",void 0,t)}#P(t){this.#i.readyState===1&&!this.#e||(this.#e=!1,this.#r.stop(),this.#t.notify("pause",void 0,t))}#A(t){this.#t.delegate.ready(this.#f(),t)}#L(t){this.#t.$state.started()||this.#t.notify("can-play-through",this.#f(),t)}#x(t){this.#i.paused||(this.#e=!1,this.#t.notify("playing",void 0,t),this.#r.start())}#$(t){this.#t.notify("stalled",void 0,t),this.#i.readyState<3&&(this.#e=!0,this.#t.notify("waiting",void 0,t))}#G(t){this.#i.readyState<3&&(this.#e=!0,this.#t.notify("waiting",void 0,t))}#N(t){this.#r.stop(),this.#o(this.#i.duration,t),this.#t.notify("end",void 0,t),this.#t.$state.loop()&&w(this.#i.controls)&&(this.#i.controls=!1)}#M(){const t=this.#t.$state.paused(),i=this.#d.visibility==="hidden";(t||i)&&p(this.#i,"timeupdate",this.#R.bind(this))}#R(t){this.#o(this.#i.currentTime,t)}#D(t){this.#t.$state.ended()&&this.#o(this.#i.duration,t),this.#t.notify("duration-change",this.#i.duration,t)}#O(t){const i={volume:this.#i.volume,muted:this.#i.muted};this.#t.notify("volume-change",i,t)}#I(t){this.#l=this.#i.currentTime,this.#o(this.#i.currentTime,t),this.#t.notify("seeked",this.#i.currentTime,t),Math.trunc(this.#i.currentTime)===Math.trunc(this.#i.duration)&&g(this.#i.duration)>g(this.#i.currentTime)&&(this.#o(this.#i.duration,t),this.#i.ended||this.#t.player.dispatch(new P("media-play-request",{trigger:t})))}#F(t){this.#t.notify("seeking",this.#i.currentTime,t)}#U(t){const i={buffered:this.#i.buffered,seekable:this.#i.seekable};this.#t.notify("progress",i,t)}#V(t){this.#t.notify("suspend",void 0,t)}#q(t){this.#t.notify("rate-change",this.#i.playbackRate,t)}#H(t){const i=this.#i.error;if(!i)return;const e={message:i.message,code:i.code,mediaError:i};this.#t.notify("error",e,t)}}class F{#n;#t;get#e(){return this.#n.media.audioTracks}constructor(t,i){this.#n=t,this.#t=i,this.#e.onaddtrack=this.#a.bind(this),this.#e.onremovetrack=this.#h.bind(this),this.#e.onchange=this.#r.bind(this),p(this.#t.audioTracks,"change",this.#u.bind(this))}#a(t){const i=t.track;if(i.label==="")return;const e=i.id.toString()||`native-audio-${this.#t.audioTracks.length}`,a={id:e,label:i.label,language:i.language,kind:i.kind,selected:!1};this.#t.audioTracks[c.add](a,t),i.enabled&&(a.selected=!0)}#h(t){const i=this.#t.audioTracks.getById(t.track.id);i&&this.#t.audioTracks[c.remove](i,t)}#r(t){let i=this.#d();if(!i)return;const e=this.#t.audioTracks.getById(i.id);e&&this.#t.audioTracks[c.select](e,!0,t)}#d(){return Array.from(this.#e).find(t=>t.enabled)}#u(t){const{current:i}=t.detail;if(!i)return;const e=this.#e.getTrackById(i.id);if(e){const a=this.#d();a&&(a.enabled=!1),e.enabled=!0}}}class U{constructor(t,i){this.media=t,this.ctx=i,this.audioGain=new R(t,e=>{this.ctx.notify("audio-gain-change",e)})}scope=A();currentSrc=null;audioGain;setup(){new I(this,this.ctx),"audioTracks"in this.media&&new F(this,this.ctx),y(()=>{this.audioGain.destroy(),this.media.srcObject=null,this.media.removeAttribute("src");for(const t of this.media.querySelectorAll("source"))t.remove();this.media.load()})}get type(){return""}setPlaybackRate(t){this.media.playbackRate=t}async play(){return this.media.play()}async pause(){return this.media.pause()}setMuted(t){this.media.muted=t}setVolume(t){this.media.volume=t}setCurrentTime(t){this.media.currentTime=t}setPlaysInline(t){h(this.media,"playsinline",t)}async loadSource({src:t,type:i},e){this.media.preload=e||"",k(t)?(this.removeSource(),this.media.srcObject=t):(this.media.srcObject=null,L(t)?i!=="?"?this.appendSource({src:t,type:i}):(this.removeSource(),this.media.src=this.#n(t)):(this.removeSource(),this.media.src=window.URL.createObjectURL(t))),this.media.load(),this.currentSrc={src:t,type:i}}appendSource(t,i){const e=this.media.querySelector("source[data-vds]"),a=e??document.createElement("source");h(a,"src",this.#n(t.src)),h(a,"type",t.type!=="?"?t.type:i),h(a,"data-vds",""),e||this.media.append(a)}removeSource(){this.media.querySelector("source[data-vds]")?.remove()}#n(t){const{clipStartTime:i,clipEndTime:e}=this.ctx.$state,a=i(),n=e();return a>0&&n>0?`${t}#t=${a},${n}`:a>0?`${t}#t=${a}`:n>0?`${t}#t=0,${n}`:t}}export{U as HTMLMediaProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o,E as p,l,D as P,n as f}from"../chunks/vidstack-Dy1Hfo7P.js";import{n as u,o as h,p as m}from"../chunks/vidstack-CwzW7rJU.js";import{HTMLMediaProvider as g}from"./vidstack-html-C9nnuK3r.js";import{H as k}from"../chunks/vidstack-BlWKO1g1.js";import{a as x,T as n}from"../chunks/vidstack-DeLOZ-hK.js";import"../chunks/vidstack-BaNApRCP.js";import"../chunks/vidstack-Bxv1Qnxe.js";import"../chunks/vidstack-C_AxqLKV.js";import"../chunks/vidstack-CROJF16Z.js";class T{#t;#i;constructor(t,e){this.#t=t,this.#i=e,t.textTracks.onaddtrack=this.#e.bind(this),o(this.#r.bind(this))}#e(t){const e=t.track;if(!e||y(this.#t,e))return;const i=new x({id:e.id,kind:e.kind,label:e.label??"",language:e.language,type:"vtt"});i[n.native]={track:e},i[n.readyState]=2,i[n.nativeHLS]=!0;let a=0;const c=d=>{if(e.cues)for(let s=a;s<e.cues.length;s++)i.addCue(e.cues[s],d),a++};c(t),e.oncuechange=c,this.#i.textTracks.add(i,t),i.setMode(e.mode,t)}#r(){this.#t.textTracks.onaddtrack=null;for(const t of this.#i.textTracks){const e=t[n.native]?.track;e?.oncuechange&&(e.oncuechange=null)}}}function y(r,t){return Array.from(r.children).find(e=>e.track===t)}class v{#t;#i;constructor(t,e){this.#t=t,this.#i=e,new p(t).add("enterpictureinpicture",this.#e.bind(this)).add("leavepictureinpicture",this.#r.bind(this))}get active(){return document.pictureInPictureElement===this.#t}get supported(){return u(this.#t)}async enter(){return this.#t.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}#e(t){this.#n(!0,t)}#r(t){this.#n(!1,t)}#n=(t,e)=>{this.#i.notify("picture-in-picture-change",t,e)}}class M{#t;#i;#e="inline";get mode(){return this.#e}constructor(t,e){this.#t=t,this.#i=e,l(t,"webkitpresentationmodechanged",this.#r.bind(this))}get supported(){return h(this.#t)}async setPresentationMode(t){this.#e!==t&&this.#t.webkitSetPresentationMode(t)}#r(t){const e=this.#e;this.#e=this.#t.webkitPresentationMode,this.#i.player?.dispatch(new P("video-presentation-change",{detail:this.#e,trigger:t})),["fullscreen","picture-in-picture"].forEach(i=>{(this.#e===i||e===i)&&this.#i.notify(`${i}-change`,this.#e===i,t)})}}class w{#t;get active(){return this.#t.mode==="fullscreen"}get supported(){return this.#t.supported}constructor(t){this.#t=t}async enter(){this.#t.setPresentationMode("fullscreen")}async exit(){this.#t.setPresentationMode("inline")}}class E{#t;get active(){return this.#t.mode==="picture-in-picture"}get supported(){return this.#t.supported}constructor(t){this.#t=t}async enter(){this.#t.setPresentationMode("picture-in-picture")}async exit(){this.#t.setPresentationMode("inline")}}class I extends g{$$PROVIDER_TYPE="VIDEO";get type(){return"video"}airPlay;fullscreen;pictureInPicture;constructor(t,e){super(t,e),f(()=>{if(this.airPlay=new k(t,e),h(t)){const i=new M(t,e);this.fullscreen=new w(i),this.pictureInPicture=new E(i)}else u(t)&&(this.pictureInPicture=new v(t,e))},this.scope)}setup(){super.setup(),m(this.video)&&new T(this.video,this.ctx),this.ctx.textRenderers.attachVideo(this.video),o(()=>{this.ctx.textRenderers.attachVideo(null)}),this.type==="video"&&this.ctx.notify("provider-setup",this)}get video(){return this.media}}export{I as VideoProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ak as y,s as l,e as c,p as u,i as b,h as d,l as k,a as m}from"../chunks/vidstack-Dy1Hfo7P.js";import{Q as f}from"../chunks/vidstack-DRH_1tFW.js";import{T as o}from"../chunks/vidstack-CaW6KGwN.js";import{a as v}from"../chunks/vidstack-DeLOZ-hK.js";import{L as r}from"../chunks/vidstack-C_AxqLKV.js";import{R as w}from"../chunks/vidstack-BaNApRCP.js";import{p as P}from"../chunks/vidstack-CROJF16Z.js";import{E as T}from"../chunks/vidstack-2Rlth5Cf.js";import{resolveVimeoVideoId as g,getVimeoVideoInfo as C}from"../chunks/vidstack-2f5gzOW6.js";import"../chunks/vidstack-CwzW7rJU.js";const $=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"];class E extends T{$$PROVIDER_TYPE="VIMEO";scope=y();fullscreen;#e;#s=l("");#i=l(!1);#o=null;#c=null;#d=!1;#n=new o(0,0);#u=new w(this.#C.bind(this));#w=null;#r=null;#a=new Map;#l=null;constructor(e,t){super(e),this.#e=t;const s=this;this.fullscreen={get active(){return s.#d},supported:!0,enter:()=>this.#t("requestFullscreen"),exit:()=>this.#t("exitFullscreen")}}cookies=!1;title=!0;byline=!0;portrait=!0;color="00ADEF";get type(){return"vimeo"}get currentSrc(){return this.#c}get videoId(){return this.#s()}get hash(){return this.#o}get isPro(){return this.#i()}preconnect(){P(this.getOrigin())}setup(){super.setup(),c(this.#P.bind(this)),c(this.#T.bind(this)),c(this.#g.bind(this)),this.#e.notify("provider-setup",this)}destroy(){this.#m(),this.fullscreen=void 0;const e="provider destroyed";for(const t of this.#a.values())for(const{reject:s}of t)s(e);this.#a.clear(),this.#t("destroy")}async play(){return this.#t("play")}async pause(){return this.#t("pause")}setMuted(e){this.#t("setMuted",e)}setCurrentTime(e){this.#t("seekTo",e),this.#e.notify("seeking",e)}setVolume(e){this.#t("setVolume",e),this.#t("setMuted",u(this.#e.$state.muted))}setPlaybackRate(e){this.#t("setPlaybackRate",e)}async loadSource(e){if(!b(e.src)){this.#c=null,this.#o=null,this.#s.set("");return}const{videoId:t,hash:s}=g(e.src);this.#s.set(t??""),this.#o=s??null,this.#c=e}#P(){this.#m();const e=this.#s();if(!e){this.src.set("");return}this.src.set(`${this.getOrigin()}/video/${e}`),this.#e.notify("load-start")}#T(){const e=this.#s();if(!e)return;const t=d(),s=new AbortController;return this.#l=t,C(e,s,this.#o).then(i=>{t.resolve(i)}).catch(i=>{t.reject()}),()=>{t.reject(),s.abort()}}#g(){const e=this.#i(),{$state:t,qualities:s}=this.#e;if(t.canSetPlaybackRate.set(e),s[r.setReadonly](!e),e)return k(s,"change",()=>{if(s.auto)return;const i=s.selected?.id;i&&this.#t("setQuality",i)})}getOrigin(){return"https://player.vimeo.com"}buildParams(){const{keyDisabled:e}=this.#e.$props,{playsInline:t,nativeControls:s}=this.#e.$state,i=s();return{title:this.title,byline:this.byline,color:this.color,portrait:this.portrait,controls:i,h:this.hash,keyboard:i&&!e(),transparent:!0,playsinline:t(),dnt:!this.cookies}}#C(){this.#t("getCurrentTime")}#h=!1;#$(e,t){if(this.#h&&e===0)return;const{realCurrentTime:s,paused:i,bufferedEnd:n,seekableEnd:a,live:h}=this.#e.$state;if(s()===e)return;const p=s();this.#e.notify("time-change",e,t),Math.abs(p-e)>1.5&&(this.#e.notify("seeking",e,t),!i()&&n()<e&&this.#e.notify("waiting",void 0,t)),!h()&&a()-e<.01&&(this.#e.notify("end",void 0,t),this.#h=!0,setTimeout(()=>{this.#h=!1},500))}#E(e,t){this.#e.notify("seeked",e,t)}#V(e){const t=this.#s();this.#l?.promise.then(s=>{if(!s)return;const{title:i,poster:n,duration:a,pro:h}=s;this.#i.set(h),this.#e.notify("title-change",i,e),this.#e.notify("poster-change",n,e),this.#e.notify("duration-change",a,e),this.#f(a,e)}).catch(()=>{t===this.#s()&&(this.#t("getVideoTitle"),this.#t("getDuration"))})}#f(e,t){const{nativeControls:s}=this.#e.$state,i=s();this.#n=new o(0,e);const n={buffered:new o(0,0),seekable:this.#n,duration:e};this.#e.delegate.ready(n,t),i||this.#t("_hideOverlay"),this.#t("getQualities"),this.#t("getChapters")}#I(e,t,s){switch(e){case"getVideoTitle":const i=t;this.#e.notify("title-change",i,s);break;case"getDuration":const n=t;this.#e.$state.canPlay()?this.#e.notify("duration-change",n,s):this.#f(n,s);break;case"getCurrentTime":this.#$(t,s);break;case"getBuffered":m(t)&&t.length&&this.#p(t[t.length-1][1],s);break;case"setMuted":case"getMuted":this.#y(u(this.#e.$state.volume),t,s);break;case"getChapters":this.#L(t);break;case"getQualities":this.#F(t,s);break}this.#v(e)?.resolve()}#R(){for(const e of $)this.#t("addEventListener",e)}#M(e){this.#u.stop(),this.#e.notify("pause",void 0,e)}async#A(e){this.#u.start(),await this.#t("getMuted"),this.#e.notify("play",void 0,e)}#S(e){const{paused:t}=this.#e.$state;!t()&&!this.#h&&this.#e.notify("playing",void 0,e)}#p(e,t){const s={buffered:new o(0,e),seekable:this.#n};this.#e.notify("progress",s,t)}#q(e){this.#e.notify("waiting",void 0,e)}#x(e){const{paused:t}=this.#e.$state;t()||this.#e.notify("playing",void 0,e)}async#Q(e){const{paused:t}=this.#e.$state;t()&&(await this.#t("getMuted"),this.#e.notify("play",void 0,e)),this.#e.notify("waiting",void 0,e)}#y(e,t,s){const i={volume:e,muted:t};this.#e.notify("volume-change",i,s)}#L(e){if(this.#b(),!e.length)return;const t=new v({kind:"chapters",default:!0}),{seekableEnd:s}=this.#e.$state;for(let i=0;i<e.length;i++){const n=e[i],a=e[i+1];t.addCue(new window.VTTCue(n.startTime,a?.startTime??s(),n.title))}this.#r=t,this.#e.textTracks.add(t)}#b(){this.#r&&(this.#e.textTracks.remove(this.#r),this.#r=null)}#F(e,t){this.#e.qualities[f.enableAuto]=e.some(s=>s.id==="auto")?()=>this.#t("setQuality","auto"):void 0;for(const s of e){if(s.id==="auto")continue;const i=+s.id.slice(0,-1);isNaN(i)||this.#e.qualities[r.add]({id:s.id,width:i*(16/9),height:i,codec:"avc1,h.264",bitrate:-1},t)}this.#k(e.find(s=>s.active),t)}#k({id:e}={},t){if(!e)return;const s=e==="auto",i=this.#e.qualities.getById(e);s?(this.#e.qualities[f.setAuto](s,t),this.#e.qualities[r.select](void 0,!0,t)):this.#e.qualities[r.select](i??void 0,!0,t)}#O(e,t,s){switch(e){case"ready":this.#R();break;case"loaded":this.#V(s);break;case"play":this.#A(s);break;case"playProgress":this.#S(s);break;case"pause":this.#M(s);break;case"loadProgress":this.#p(t.seconds,s);break;case"waiting":this.#Q(s);break;case"bufferstart":this.#q(s);break;case"bufferend":this.#x(s);break;case"volumechange":this.#y(t.volume,u(this.#e.$state.muted),s);break;case"durationchange":this.#n=new o(0,t.duration),this.#e.notify("duration-change",t.duration,s);break;case"playbackratechange":this.#e.notify("rate-change",t.playbackRate,s);break;case"qualitychange":this.#k(t,s);break;case"fullscreenchange":this.#d=t.fullscreen,this.#e.notify("fullscreen-change",t.fullscreen,s);break;case"enterpictureinpicture":this.#e.notify("picture-in-picture-change",!0,s);break;case"leavepictureinpicture":this.#e.notify("picture-in-picture-change",!1,s);break;case"ended":this.#e.notify("end",void 0,s);break;case"error":this.#D(t,s);break;case"seek":case"seeked":this.#E(t.seconds,s);break}}#D(e,t){const{message:s,method:i}=e;i==="setPlaybackRate"&&this.#i.set(!1),i&&this.#v(i)?.reject(s)}onMessage(e,t){e.event?this.#O(e.event,e.data,t):e.method&&this.#I(e.method,e.value,t)}onLoad(){}async#t(e,t){let s=d(),i=this.#a.get(e);return i||this.#a.set(e,i=[]),i.push(s),this.postMessage({method:e,value:t}),s.promise}#m(){this.#u.stop(),this.#n=new o(0,0),this.#l=null,this.#w=null,this.#i.set(!1),this.#b()}#v(e){return this.#a.get(e)?.shift()}}export{E as VimeoProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ak as p,s as y,e as m,i as f,h as g,al as b,K as d,W as k}from"../chunks/vidstack-Dy1Hfo7P.js";import{T as u}from"../chunks/vidstack-CaW6KGwN.js";import{p as v}from"../chunks/vidstack-CROJF16Z.js";import{E as P}from"../chunks/vidstack-2Rlth5Cf.js";import{resolveYouTubeVideoId as w}from"../chunks/vidstack-DiNS2Vx5.js";import"../chunks/vidstack-CwzW7rJU.js";const r={Ended:0,Playing:1,Paused:2,Buffering:3,Cued:5};class T extends P{$$PROVIDER_TYPE="YOUTUBE";scope=p();#e;#a=y("");#o=-1;#d=null;#r=-1;#i=!1;#s=new Map;constructor(e,t){super(e),this.#e=t}language="en";color="red";cookies=!1;get currentSrc(){return this.#d}get type(){return"youtube"}get videoId(){return this.#a()}preconnect(){v(this.getOrigin())}setup(){super.setup(),m(this.#c.bind(this)),this.#e.notify("provider-setup",this)}destroy(){this.#l();const e="provider destroyed";for(const t of this.#s.values())for(const{reject:s}of t)s(e);this.#s.clear()}async play(){return this.#t("playVideo")}#k(e){this.#n("playVideo")?.reject(e)}async pause(){return this.#t("pauseVideo")}#v(e){this.#n("pauseVideo")?.reject(e)}setMuted(e){e?this.#t("mute"):this.#t("unMute")}setCurrentTime(e){this.#t("seekTo",[e,!0]),this.#e.notify("seeking",e)}setVolume(e){this.#t("setVolume",e*100)}setPlaybackRate(e){this.#t("setPlaybackRate",e)}async loadSource(e){if(!f(e.src)){this.#d=null,this.#a.set("");return}const t=w(e.src);this.#a.set(t??""),this.#d=e}getOrigin(){return this.cookies?"https://www.youtube.com":"https://www.youtube-nocookie.com"}#c(){this.#l();const e=this.#a();if(!e){this.src.set("");return}this.src.set(`${this.getOrigin()}/embed/${e}`),this.#e.notify("load-start")}buildParams(){const{keyDisabled:e}=this.#e.$props,{muted:t,playsInline:s,nativeControls:a}=this.#e.$state,i=a();return{rel:0,autoplay:0,cc_lang_pref:this.language,cc_load_policy:i?1:void 0,color:this.color,controls:i?1:0,disablekb:!i||e()?1:0,enablejsapi:1,fs:1,hl:this.language,iv_load_policy:i?1:3,mute:t()?1:0,playsinline:s()?1:0}}#t(e,t){let s=g(),a=this.#s.get(e);a||this.#s.set(e,a=[]),a.push(s);const i=Array.isArray(t)?t:t?[t]:void 0;return this.postMessage({event:"command",func:e,args:i}),s.promise}onLoad(){window.setTimeout(()=>this.postMessage({event:"listening"}),100)}#p(e){this.#e.notify("loaded-metadata"),this.#e.notify("loaded-data"),this.#e.delegate.ready(void 0,e)}#y(e){this.#n("pauseVideo")?.resolve(),this.#e.notify("pause",void 0,e)}#m(e,t){const{duration:s,realCurrentTime:a}=this.#e.$state,i=this.#o===r.Ended,o=i?s():e;this.#e.notify("time-change",o,t),!i&&Math.abs(o-a())>1&&this.#e.notify("seeking",o,t)}#u(e,t,s){const a={buffered:new u(0,e),seekable:t};this.#e.notify("progress",a,s);const{seeking:i,realCurrentTime:o}=this.#e.$state;i()&&e>o()&&this.#h(s)}#h(e){const{paused:t,realCurrentTime:s}=this.#e.$state;window.clearTimeout(this.#r),this.#r=window.setTimeout(()=>{this.#e.notify("seeked",s(),e),this.#r=-1},t()?100:0)}#f(e){const{seeking:t}=this.#e.$state;t()&&this.#h(e),this.#e.notify("pause",void 0,e),this.#e.notify("end",void 0,e)}#g(e,t){const{paused:s,seeking:a}=this.#e.$state,i=e===r.Playing,o=e===r.Buffering,n=this.#b("playVideo"),h=s()&&(o||i);if(o&&this.#e.notify("waiting",void 0,t),a()&&i&&this.#h(t),this.#i&&i){this.pause(),this.#i=!1,this.setMuted(this.#e.$state.muted());return}if(!n&&h){this.#i=!0,this.setMuted(!0);return}switch(h&&(this.#n("playVideo")?.resolve(),this.#e.notify("play",void 0,t)),e){case r.Cued:this.#p(t);break;case r.Playing:this.#e.notify("playing",void 0,t);break;case r.Paused:this.#y(t);break;case r.Ended:this.#f(t);break}this.#o=e}onMessage({info:e},t){if(!e)return;const{title:s,intrinsicDuration:a,playbackRate:i}=this.#e.$state;if(b(e.videoData)&&e.videoData.title!==s()&&this.#e.notify("title-change",e.videoData.title,t),d(e.duration)&&e.duration!==a()){if(d(e.videoLoadedFraction)){const o=e.progressState?.loaded??e.videoLoadedFraction*e.duration,n=new u(0,e.duration);this.#u(o,n,t)}this.#e.notify("duration-change",e.duration,t)}if(d(e.playbackRate)&&e.playbackRate!==i()&&this.#e.notify("rate-change",e.playbackRate,t),e.progressState){const{current:o,seekableStart:n,seekableEnd:h,loaded:c,duration:l}=e.progressState;this.#m(o,t),this.#u(c,new u(n,h),t),l!==a()&&this.#e.notify("duration-change",l,t)}if(d(e.volume)&&k(e.muted)&&!this.#i){const o={muted:e.muted,volume:e.volume/100};this.#e.notify("volume-change",o,t)}d(e.playerState)&&e.playerState!==this.#o&&this.#g(e.playerState,t)}#l(){this.#o=-1,this.#r=-1,this.#i=!1}#n(e){return this.#s.get(e)?.shift()}#b(e){return!!this.#s.get(e)?.length}}export{T as YouTubeProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunks/vidstack-
|
|
1
|
+
import"./chunks/vidstack-T2rZVigk.js";import"https://cdn.vidstack.io/icons";import"./chunks/vidstack-Dy1Hfo7P.js";import"./chunks/vidstack-CwzW7rJU.js";import"./chunks/vidstack-CaW6KGwN.js";import"./chunks/vidstack-DeLOZ-hK.js";import"./chunks/vidstack-CROJF16Z.js";import"./chunks/vidstack-C_AxqLKV.js";import"./chunks/vidstack-DRH_1tFW.js";import"./chunks/vidstack-BfBBPhXV.js";import"./chunks/vidstack-Bxv1Qnxe.js";
|