@hanifhan1f/vidstack 1.12.19 → 1.12.25
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-BBMfnVvt.js +1 -0
- package/cdn/chunks/vidstack-BF7lZRtq.js +3 -0
- package/cdn/chunks/vidstack-BYpysj84.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-C1FlyyzK.js +1 -0
- package/cdn/chunks/vidstack-C51SKMUl.js +1 -0
- package/cdn/chunks/vidstack-CL95Hezv.js +1 -0
- package/cdn/chunks/vidstack-Cj0I-Rec.js +1 -0
- package/cdn/chunks/vidstack-CkaxOIJb.js +1 -0
- package/cdn/chunks/vidstack-Cu8FqSS9.js +1 -0
- package/cdn/chunks/vidstack-D84Fzc__.js +16 -0
- package/cdn/chunks/vidstack-DIPX97sJ.js +3 -0
- package/cdn/chunks/vidstack-DQvyz7Mm.js +1 -0
- package/cdn/chunks/vidstack-Dd9fqVv6.js +1 -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/chunks/vidstack-uMxrPflF.js +1 -0
- package/cdn/chunks/vidstack-zemsqC5d.js +1 -0
- package/cdn/providers/vidstack-audio-BAfEe7CJ.js +1 -0
- package/cdn/providers/vidstack-audio-BOGYlExy.js +1 -0
- package/cdn/providers/vidstack-dash-CGZUJqdT.js +1 -0
- package/cdn/providers/vidstack-dash-D4ZARr66.js +1 -0
- package/cdn/providers/vidstack-google-cast-Drb5Ncs5.js +1 -0
- package/cdn/providers/vidstack-hls-8-552IuX.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-html-BvVaN2VT.js +1 -0
- package/cdn/providers/vidstack-video-BnwQZKER.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-vimeo-gJmBqtLK.js +1 -0
- package/cdn/providers/vidstack-youtube-BVNE075s.js +1 -0
- package/cdn/providers/vidstack-youtube-Chl_dTAz.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-4liSokT6.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-B97B8XDc.js +3 -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-BbFHhcVG.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-CXEcXyBI.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CaW6KGwN.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Ciq-n5rg.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CmuGllcj.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CwzW7rJU.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CyNByJUW.js +912 -0
- package/cdn/with-layouts/chunks/vidstack-DJyGEdCH.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DeLOZ-hK.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-DhNpv7SU.js +1 -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/providers/vidstack-audio-CwoQJvl2.js +1 -0
- package/cdn/with-layouts/providers/vidstack-audio-cxaZF4jF.js +1 -0
- package/cdn/with-layouts/providers/vidstack-dash-CJsKJfLI.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-hls-ji26kFdQ.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-BvHMxtoe.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-C9nnuK3r.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-1Uj5cNP2.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-EWE67g5i.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-DACTbJaQ.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-DqFeS0-d.js +1 -0
- package/cdn/with-layouts/providers/vidstack-youtube-RoLp-I6u.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-0XhA3AD_.js +5181 -0
- package/dev/chunks/vidstack-44ILR0Cb.js +1521 -0
- package/dev/chunks/vidstack-5oWWZmVl.js +58 -0
- package/dev/chunks/vidstack-B4XOm7dP.js +104 -0
- package/dev/chunks/vidstack-BnBLcaA5.js +115 -0
- package/dev/chunks/vidstack-Bo8BNFJ2.js +2986 -0
- package/dev/chunks/vidstack-C3N4zIuV.js +254 -0
- package/dev/chunks/vidstack-CAL4iu_K.js +1482 -0
- package/dev/chunks/vidstack-CEjYxSqZ.js +297 -0
- package/dev/chunks/vidstack-CGyAjz8G.js +58 -0
- package/dev/chunks/vidstack-CJCnHmKE.js +104 -0
- package/dev/chunks/vidstack-CQdFhXSo.js +204 -0
- package/dev/chunks/vidstack-CzCQJ29U.js +107 -0
- package/dev/chunks/vidstack-DD_3HszA.js +1520 -0
- package/dev/chunks/vidstack-DV4g4XvL.js +33 -0
- package/dev/chunks/vidstack-DWtK42Sh.js +1483 -0
- package/dev/chunks/vidstack-D_LvMxPr.js +204 -0
- package/dev/chunks/vidstack-DdTXMZro.js +66 -0
- package/dev/chunks/vidstack-DrczgsqN.js +297 -0
- package/dev/chunks/vidstack-el2dbO0m.js +5181 -0
- package/dev/chunks/vidstack-gF_qqvCK.js +109 -0
- package/dev/chunks/vidstack-rvhuswgi.js +2986 -0
- package/dev/define/plyr-layout.js +7 -7
- package/dev/define/templates/plyr-layout.js +2 -2
- package/dev/define/templates/vidstack-audio-layout.js +3 -3
- package/dev/define/templates/vidstack-video-layout.js +7 -9
- package/dev/define/vidstack-player-default-layout.js +3 -3
- package/dev/define/vidstack-player-layouts.js +3 -3
- package/dev/define/vidstack-player-ui.js +9 -9
- package/dev/define/vidstack-player.js +5 -5
- package/dev/global/plyr.js +9 -9
- package/dev/global/vidstack-player.js +6 -6
- package/dev/providers/vidstack-audio.js +2 -2
- package/dev/providers/vidstack-dash.js +4 -4
- package/dev/providers/vidstack-hls.js +4 -4
- package/dev/providers/vidstack-html.js +1 -1
- package/dev/providers/vidstack-video.js +4 -4
- package/dev/providers/vidstack-vimeo.js +4 -4
- package/dev/providers/vidstack-youtube.js +3 -3
- package/dev/vidstack-elements.js +12 -12
- package/dev/vidstack.js +9 -9
- package/package.json +1 -1
- package/player/styles/default/layouts/video.css +113 -79
- package/prod/chunks/vidstack-BAqdCFIm.js +4771 -0
- package/prod/chunks/vidstack-BRnfTkxi.js +297 -0
- package/prod/chunks/vidstack-BexQYZop.js +2976 -0
- package/prod/chunks/vidstack-Bf1Q6kqO.js +109 -0
- package/prod/chunks/vidstack-Bn9yLryd.js +58 -0
- package/prod/chunks/vidstack-C-yd_bAJ.js +4771 -0
- package/prod/chunks/vidstack-C4PTiuot.js +107 -0
- package/prod/chunks/vidstack-Cs0fH84E.js +1521 -0
- package/prod/chunks/vidstack-DDePVDjt.js +2976 -0
- package/prod/chunks/vidstack-DMDDSV3t.js +104 -0
- package/prod/chunks/vidstack-DXfGRhxZ.js +201 -0
- package/prod/chunks/vidstack-Dg71uhRc.js +58 -0
- package/prod/chunks/vidstack-DlLwMLBL.js +33 -0
- package/prod/chunks/vidstack-DnRxQoqP.js +104 -0
- package/prod/chunks/vidstack-KShKSmYu.js +66 -0
- package/prod/chunks/vidstack-Ko2EJadT.js +1483 -0
- package/prod/chunks/vidstack-ShUhyBfI.js +201 -0
- package/prod/chunks/vidstack-V9U6gsde.js +1482 -0
- package/prod/chunks/vidstack-XA3zT5W9.js +297 -0
- package/prod/chunks/vidstack-kdaDngIm.js +1520 -0
- package/prod/chunks/vidstack-oNEzlviH.js +246 -0
- package/prod/chunks/vidstack-wTTCvdqe.js +115 -0
- package/prod/define/plyr-layout.js +7 -7
- package/prod/define/templates/plyr-layout.js +2 -2
- package/prod/define/templates/vidstack-audio-layout.js +3 -3
- package/prod/define/templates/vidstack-video-layout.js +7 -9
- package/prod/define/vidstack-player-default-layout.js +3 -3
- package/prod/define/vidstack-player-layouts.js +3 -3
- package/prod/define/vidstack-player-ui.js +9 -9
- package/prod/define/vidstack-player.js +5 -5
- package/prod/global/plyr.js +9 -9
- package/prod/global/vidstack-player.js +6 -6
- package/prod/providers/vidstack-audio.js +2 -2
- package/prod/providers/vidstack-dash.js +4 -4
- package/prod/providers/vidstack-hls.js +4 -4
- package/prod/providers/vidstack-html.js +1 -1
- package/prod/providers/vidstack-video.js +4 -4
- package/prod/providers/vidstack-vimeo.js +4 -4
- package/prod/providers/vidstack-youtube.js +3 -3
- package/prod/vidstack-elements.js +12 -12
- package/prod/vidstack.js +9 -9
- package/server/chunks/vidstack-B2Bc9g7_.js +2000 -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-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{U as s,i,h as c}from"./vidstack-D40FSa5B.js";import"./vidstack-DQvyz7Mm.js";function u(e,r){const n=new URL(e);for(const t of Object.keys(r))n.searchParams.set(t,r[t]+"");return n.toString()}function a(e,r="preconnect"){const n=document.querySelector(`link[href="${e}"]`);if(!s(n))return!0;const t=document.createElement("link");return t.rel=r,t.href=e,t.crossOrigin="true",document.head.append(t),!0}const o={};function d(e){if(o[e])return o[e].promise;const r=c(),n=document.querySelector(`script[src="${e}"]`);if(!s(n))return r.resolve(),r.promise;o[e]=r;const t=document.createElement("script");return t.src=e,t.onload=()=>{r.resolve(),delete o[e]},t.onerror=()=>{r.reject(),delete o[e]},setTimeout(()=>document.head.append(t),0),r.promise}function l(e){return e==="use-credentials"?"include":i(e)?"same-origin":void 0}export{u as a,l as g,d as l,a as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as a,e as o,l as n,E as h}from"./vidstack-D40FSa5B.js";import"./vidstack-DQvyz7Mm.js";class c{#t;#s;#i;#e=a(!1);get supported(){return this.#e()}constructor(e,t){this.#t=e,this.#s=t,this.#r()}#r(){!this.#t?.remote||!this.canPrompt||(this.#t.remote.watchAvailability(e=>{this.#e.set(e)}).catch(()=>{this.#e.set(!1)}),o(this.#a.bind(this)))}#a(){if(!this.#e())return;const e=["connecting","connect","disconnect"],t=this.#o.bind(this);t(),n(this.#t,"playing",t);const s=new h(this.#t.remote);for(const r of e)s.add(r,t)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return this.type==="airplay"&&this.#t.webkitShowPlaybackTargetPicker?this.#t.webkitShowPlaybackTargetPicker():this.#t.remote.prompt()}#o(e){const t=this.#t.remote.state;if(t===this.#i)return;const s={type:this.type,state:t};this.#s.notify("remote-playback-change",s,e),this.#i=t}}class p extends c{type="airplay";get canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}}export{p as H};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as t}from"../chunks/vidstack-pFwe7gvT.js";import{HTMLMediaProvider as e}from"./vidstack-html-Bag27bH6.js";import{H as o}from"../chunks/vidstack-DdAmWWBJ.js";import"../chunks/vidstack-CL95Hezv.js";import"../chunks/vidstack-Cu8FqSS9.js";import"../chunks/vidstack-DiXE5sG8.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{n as t}from"../chunks/vidstack-D40FSa5B.js";import{HTMLMediaProvider as e}from"./vidstack-html-BvVaN2VT.js";import{H as o}from"../chunks/vidstack-zemsqC5d.js";import"../chunks/vidstack-BYpysj84.js";import"../chunks/vidstack-DQvyz7Mm.js";import"../chunks/vidstack-DfDZuHNP.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-C51SKMUl.js";import{f as M,e as C,a as N,i as R}from"../chunks/vidstack-Cu8FqSS9.js";import{VideoProvider as F}from"./vidstack-video-DXUiSn4B.js";import{l as S,e as I,D as l,H as P,i as u,O as _,C as v,j as $,p as q}from"../chunks/vidstack-pFwe7gvT.js";import{Q as b}from"../chunks/vidstack-DRH_1tFW.js";import{T as m,a as H}from"../chunks/vidstack-DIPX97sJ.js";import{L as p}from"../chunks/vidstack-C_AxqLKV.js";import{R as j}from"../chunks/vidstack-DiXE5sG8.js";import{c as O}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-Bag27bH6.js";import"../chunks/vidstack-CL95Hezv.js";import"../chunks/vidstack-DdAmWWBJ.js";function w(n){try{return new Intl.DisplayNames(navigator.languages,{type:"language"}).of(n)??null}catch{return null}}const Q=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(Q(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 B(this.#e,t);if(v(i)&&!u(this.#e)&&(i=await U(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=O(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 U(n,t={}){if(!v(n)){if(t.onLoadStart?.(),K(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 B(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 K(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 as x,p as k}from"../chunks/vidstack-uMxrPflF.js";import{f as M,e as C,a as N,i as F}from"../chunks/vidstack-DQvyz7Mm.js";import{VideoProvider as R}from"./vidstack-video-BnwQZKER.js";import{l as S,e as I,D as l,F as P,i as u,O as _,C as v,j as $,p as q}from"../chunks/vidstack-D40FSa5B.js";import{Q as b}from"../chunks/vidstack-DRH_1tFW.js";import{T as m,a as H}from"../chunks/vidstack-BF7lZRtq.js";import{L as p}from"../chunks/vidstack-C_AxqLKV.js";import{R as j}from"../chunks/vidstack-DfDZuHNP.js";import{c as O}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-BvVaN2VT.js";import"../chunks/vidstack-BYpysj84.js";import"../chunks/vidstack-zemsqC5d.js";function w(n){try{return new Intl.DisplayNames(navigator.languages,{type:"language"}).of(n)??null}catch{return null}}const Q=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(Q(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 B(this.#e,t);if(v(i)&&!u(this.#e)&&(i=await U(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=O(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 U(n,t={}){if(!v(n)){if(t.onLoadStart?.(),K(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 B(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 K(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 R{$$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=F();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,a4 as y,ab as u,o as p,D as m,p as h}from"../chunks/vidstack-pFwe7gvT.js";import{T as o}from"../chunks/vidstack-C0nMUcD9.js";import{R as C}from"../chunks/vidstack-DiXE5sG8.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-DhXI_0ND.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-uMxrPflF.js";import{a as E,g as T}from"../chunks/vidstack-DQvyz7Mm.js";import{VideoProvider as b}from"./vidstack-video-BnwQZKER.js";import{p as f,l as v,e as k,D as d,i as l,O as w,C as y,j as x}from"../chunks/vidstack-D40FSa5B.js";import{Q as g}from"../chunks/vidstack-DRH_1tFW.js";import{a as D,T as m}from"../chunks/vidstack-BF7lZRtq.js";import{L as u}from"../chunks/vidstack-C_AxqLKV.js";import{R as C}from"../chunks/vidstack-DfDZuHNP.js";import{c as I}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-BvVaN2VT.js";import"../chunks/vidstack-BYpysj84.js";import"../chunks/vidstack-zemsqC5d.js";const A=r=>w(r);class H{#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(A(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=I(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 H(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{l as L,p as S}from"../chunks/vidstack-C51SKMUl.js";import{a as E,g as T}from"../chunks/vidstack-Cu8FqSS9.js";import{VideoProvider as b}from"./vidstack-video-DXUiSn4B.js";import{p as f,l as v,e as k,D as d,i as l,O as w,C as y,j as x}from"../chunks/vidstack-pFwe7gvT.js";import{Q as g}from"../chunks/vidstack-DRH_1tFW.js";import{a as D,T as m}from"../chunks/vidstack-DIPX97sJ.js";import{L as u}from"../chunks/vidstack-C_AxqLKV.js";import{R as C}from"../chunks/vidstack-DiXE5sG8.js";import{c as I}from"../chunks/vidstack-BfBBPhXV.js";import"./vidstack-html-Bag27bH6.js";import"../chunks/vidstack-CL95Hezv.js";import"../chunks/vidstack-DdAmWWBJ.js";const A=r=>w(r);class H{#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(A(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=I(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 H(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{e as T,g as f,f as S}from"../chunks/vidstack-CL95Hezv.js";import{s as m,E as y,e as k,o as p,p as C,a9 as E,l as g,D as w,a4 as P,k as r,i as A}from"../chunks/vidstack-pFwe7gvT.js";import{l as h,b as L}from"../chunks/vidstack-Cu8FqSS9.js";import{R as x}from"../chunks/vidstack-DiXE5sG8.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=m(b());#t=m(document.visibilityState);#e;connect(){const t=new y(window),i=this.#a.bind(this);for(const e of D)t.add(e,i);h&&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){h&&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 y(t.media),this.#g(),this.#d.connect(),k(this.#M.bind(this)),p(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;!(h&&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.#j),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.#H),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;#q=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),(L||h&&T(this.#t.$state.source()))&&this.#t.delegate.ready(this.#f(),t)}#f(){return{provider:C(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()&&E(this.#i.controls)&&(this.#i.controls=!1)}#M(){const t=this.#t.$state.paused(),i=this.#d.visibility==="hidden";(t||i)&&g(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)&&f(this.#i.duration)>f(this.#i.currentTime)&&(this.#o(this.#i.duration,t),this.#i.ended||this.#t.player.dispatch(new w("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)}#H(t){this.#t.notify("rate-change",this.#i.playbackRate,t)}#j(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),g(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=P();currentSrc=null;audioGain;setup(){new I(this,this.ctx),"audioTracks"in this.media&&new F(this,this.ctx),p(()=>{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){r(this.media,"playsinline",t)}async loadSource({src:t,type:i},e){this.media.preload=e||"",S(t)?(this.removeSource(),this.media.srcObject=t):(this.media.srcObject=null,A(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");r(a,"src",this.#n(t.src)),r(a,"type",t.type!=="?"?t.type:i),r(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{e as T,g as f,f as S}from"../chunks/vidstack-BYpysj84.js";import{s as m,E as y,e as k,o as p,p as C,a9 as E,l as g,D as w,a4 as P,k as r,i as A}from"../chunks/vidstack-D40FSa5B.js";import{l as h,b as L}from"../chunks/vidstack-DQvyz7Mm.js";import{R as x}from"../chunks/vidstack-DfDZuHNP.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=m(b());#t=m(document.visibilityState);#e;connect(){const t=new y(window),i=this.#a.bind(this);for(const e of D)t.add(e,i);h&&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){h&&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 y(t.media),this.#g(),this.#d.connect(),k(this.#M.bind(this)),p(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;!(h&&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.#j),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.#H),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;#q=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),(L||h&&T(this.#t.$state.source()))&&this.#t.delegate.ready(this.#f(),t)}#f(){return{provider:C(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()&&E(this.#i.controls)&&(this.#i.controls=!1)}#M(){const t=this.#t.$state.paused(),i=this.#d.visibility==="hidden";(t||i)&&g(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)&&f(this.#i.duration)>f(this.#i.currentTime)&&(this.#o(this.#i.duration,t),this.#i.ended||this.#t.player.dispatch(new w("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)}#H(t){this.#t.notify("rate-change",this.#i.playbackRate,t)}#j(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),g(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=P();currentSrc=null;audioGain;setup(){new I(this,this.ctx),"audioTracks"in this.media&&new F(this,this.ctx),p(()=>{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){r(this.media,"playsinline",t)}async loadSource({src:t,type:i},e){this.media.preload=e||"",S(t)?(this.removeSource(),this.media.srcObject=t):(this.media.srcObject=null,A(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");r(a,"src",this.#n(t.src)),r(a,"type",t.type!=="?"?t.type:i),r(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-D40FSa5B.js";import{h as u,j as h,k as m}from"../chunks/vidstack-DQvyz7Mm.js";import{HTMLMediaProvider as g}from"./vidstack-html-BvVaN2VT.js";import{H as k}from"../chunks/vidstack-zemsqC5d.js";import{a as x,T as s}from"../chunks/vidstack-BF7lZRtq.js";import"../chunks/vidstack-BYpysj84.js";import"../chunks/vidstack-DfDZuHNP.js";import"../chunks/vidstack-C_AxqLKV.js";import"../chunks/vidstack-uMxrPflF.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[s.native]={track:e},i[s.readyState]=2,i[s.nativeHLS]=!0;let a=0;const c=d=>{if(e.cues)for(let n=a;n<e.cues.length;n++)i.addCue(e.cues[n],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[s.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.#s(!0,t)}#r(t){this.#s(!1,t)}#s=(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{o,E as p,l,D as P,n as f}from"../chunks/vidstack-pFwe7gvT.js";import{h as u,j as h,k as m}from"../chunks/vidstack-Cu8FqSS9.js";import{HTMLMediaProvider as g}from"./vidstack-html-Bag27bH6.js";import{H as k}from"../chunks/vidstack-DdAmWWBJ.js";import{a as x,T as s}from"../chunks/vidstack-DIPX97sJ.js";import"../chunks/vidstack-CL95Hezv.js";import"../chunks/vidstack-DiXE5sG8.js";import"../chunks/vidstack-C_AxqLKV.js";import"../chunks/vidstack-C51SKMUl.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[s.native]={track:e},i[s.readyState]=2,i[s.nativeHLS]=!0;let a=0;const c=d=>{if(e.cues)for(let n=a;n<e.cues.length;n++)i.addCue(e.cues[n],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[s.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.#s(!0,t)}#r(t){this.#s(!1,t)}#s=(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{a4 as y,s as l,e as c,p as u,i as b,h as d,l as m,a as k}from"../chunks/vidstack-pFwe7gvT.js";import{Q as f}from"../chunks/vidstack-DRH_1tFW.js";import{T as o}from"../chunks/vidstack-C0nMUcD9.js";import{a as v}from"../chunks/vidstack-DIPX97sJ.js";import{L as r}from"../chunks/vidstack-C_AxqLKV.js";import{R as w}from"../chunks/vidstack-DiXE5sG8.js";import{p as P}from"../chunks/vidstack-C51SKMUl.js";import{E as T}from"../chunks/vidstack-BBMfnVvt.js";import{resolveVimeoVideoId as g,getVimeoVideoInfo as C}from"../chunks/vidstack-2f5gzOW6.js";import"../chunks/vidstack-Cu8FqSS9.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.#k(),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.#k();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 m(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":k(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.#m(e.find(s=>s.active),t)}#m({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.#m(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}#k(){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{a4 as y,s as l,e as c,p as u,i as b,h as d,l as m,a as k}from"../chunks/vidstack-D40FSa5B.js";import{Q as f}from"../chunks/vidstack-DRH_1tFW.js";import{T as o}from"../chunks/vidstack-CioT3Yw2.js";import{a as v}from"../chunks/vidstack-BF7lZRtq.js";import{L as r}from"../chunks/vidstack-C_AxqLKV.js";import{R as w}from"../chunks/vidstack-DfDZuHNP.js";import{p as P}from"../chunks/vidstack-uMxrPflF.js";import{E as T}from"../chunks/vidstack-C1FlyyzK.js";import{resolveVimeoVideoId as g,getVimeoVideoInfo as C}from"../chunks/vidstack-2f5gzOW6.js";import"../chunks/vidstack-DQvyz7Mm.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.#k(),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.#k();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 m(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":k(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.#m(e.find(s=>s.active),t)}#m({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.#m(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}#k(){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{a4 as p,s as y,e as m,i as f,h as g,a5 as b,H as d,$ as k}from"../chunks/vidstack-pFwe7gvT.js";import{T as u}from"../chunks/vidstack-C0nMUcD9.js";import{p as v}from"../chunks/vidstack-C51SKMUl.js";import{E as P}from"../chunks/vidstack-BBMfnVvt.js";import{resolveYouTubeVideoId as w}from"../chunks/vidstack-DiNS2Vx5.js";import"../chunks/vidstack-Cu8FqSS9.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a4 as p,s as y,e as m,i as f,h as g,a5 as b,F as d,$ as k}from"../chunks/vidstack-D40FSa5B.js";import{T as u}from"../chunks/vidstack-CioT3Yw2.js";import{p as v}from"../chunks/vidstack-uMxrPflF.js";import{E as P}from"../chunks/vidstack-C1FlyyzK.js";import{resolveYouTubeVideoId as w}from"../chunks/vidstack-DiNS2Vx5.js";import"../chunks/vidstack-DQvyz7Mm.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};
|
package/cdn/vidstack.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunks/vidstack-
|
|
1
|
+
import"./chunks/vidstack-BkxGdzTJ.js";import"https://cdn.vidstack.io/icons";import"./chunks/vidstack-pFwe7gvT.js";import"./chunks/vidstack-Cu8FqSS9.js";import"./chunks/vidstack-C0nMUcD9.js";import"./chunks/vidstack-DIPX97sJ.js";import"./chunks/vidstack-C51SKMUl.js";import"./chunks/vidstack-C_AxqLKV.js";import"./chunks/vidstack-DRH_1tFW.js";import"./chunks/vidstack-BfBBPhXV.js";import"./chunks/vidstack-CL95Hezv.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,l as r,e as a,p as o,i as n}from"./vidstack-Dy1Hfo7P.js";import{b as c}from"./vidstack-CROJF16Z.js";class h{#t;src=e("");referrerPolicy=null;get iframe(){return this.#t}constructor(t){this.#t=t,t.setAttribute("frameBorder","0"),t.setAttribute("aria-hidden","true"),t.setAttribute("allow","autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"),this.referrerPolicy!==null&&t.setAttribute("referrerpolicy",this.referrerPolicy)}setup(){r(window,"message",this.#i.bind(this)),r(this.#t,"load",this.onLoad.bind(this)),a(this.#s.bind(this))}#s(){const t=this.src();if(!t.length){this.#t.setAttribute("src","");return}const s=o(()=>this.buildParams());this.#t.setAttribute("src",c(t,s))}postMessage(t,s){this.#t.contentWindow?.postMessage(JSON.stringify(t),s??"*")}#i(t){const s=this.getOrigin();if((t.source===null||t.source===this.#t?.contentWindow)&&(!n(s)||s===t.origin)){try{const i=JSON.parse(t.data);i&&this.onMessage(i,t);return}catch{}t.data&&this.onMessage(t.data,t)}}}export{h as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n,b as l,d as c}from"./vidstack-DhNpv7SU.js";import{l as p}from"./vidstack-BbFHhcVG.js";import{a as g,b as d,i,d as h,e as m,f as y,c as C,j as f}from"./vidstack-C5AP9wid.js";import{p as w}from"./vidstack-DLVdcWrK.js";class E{name="google-cast";target;#e;get cast(){return g()}mediaType(){return"video"}canPlay(e){return n&&!l&&c(e)}async prompt(e){let t,a,r;try{t=await this.#r(e),this.#e||(this.#e=new cast.framework.RemotePlayer,new cast.framework.RemotePlayerController(this.#e)),a=e.player.createEvent("google-cast-prompt-open",{trigger:t}),e.player.dispatchEvent(a),this.#t(e,"connecting",a),await this.#o(w(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:d()?.getCastDevice().friendlyName}),i()&&this.#t(e,"connected",a)}catch(o){const s=o instanceof Error?o:this.#a((o+"").toUpperCase(),"Prompt failed.");throw r=e.player.createEvent("google-cast-prompt-error",{detail:s,trigger:a??t,cancelable:!0}),e.player.dispatch(r),this.#t(e,i()?"connected":"disconnected",r),s}finally{e.player.dispatch("google-cast-prompt-close",{trigger:r??a??t})}}async load(e){if(!this.#e)throw Error("[vidstack] google cast player was not initialized");return new(await import("../providers/vidstack-google-cast-BSYJYn-o.js")).GoogleCastProvider(this.#e,e)}async#r(e){if(h())return;const t=e.player.createEvent("google-cast-load-start");e.player.dispatch(t),await p(m()),await customElements.whenDefined("google-cast-launcher");const a=e.player.createEvent("google-cast-loaded",{trigger:t});if(e.player.dispatch(a),!y())throw this.#a("CAST_NOT_AVAILABLE","Google Cast not available on this platform.");return a}async#o(e){this.#s(e);const t=await this.cast.requestSession();if(t)throw this.#a(t.toUpperCase(),C(t))}#s(e){this.cast?.setOptions({...f(),...e})}#t(e,t,a){const r={type:"google-cast",state:t};e.notify("remote-playback-change",r,a)}#a(e,t){const a=Error(t);return a.code=e,a}}export{E as GoogleCastLoader};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{l,n as m,i as u,q as C,d as S,D as c,a as p,I as g}from"./vidstack-DLVdcWrK.js";import{g as T}from"./vidstack-BbFHhcVG.js";const b=Symbol(0),E=Symbol(0),A=Symbol(0),w=Symbol(0),O=Symbol(0),x=Symbol(0),N=Symbol(0),a={crossOrigin:b,readyState:E,updateActiveCues:A,canLoad:w,onModeChange:O,native:x,nativeHLS:N};function f(h,t){return t>=h.startTime&&t<h.endTime}function v(h,t,s){let e=null,i=C();function n(){const r=u(t)?[t]:t,o=h.toArray().find(d=>r.includes(d.kind)&&d.mode==="showing");if(o!==e){if(!o){s(null),e=null;return}o.readyState==2?s(o):(s(null),m(()=>{const d=l(o,"load",()=>{s(o),d()},{once:!0})},i)),e=o}}return n(),l(h,"mode-change",n)}function k(h,t,s){v(h,t,e=>{if(!e){s("");return}const i=()=>{const n=e?.activeCues[0];s(n?.text||"")};i(),l(e,"cue-change",i)})}class I extends S{static createId(t){return`vds-${t.type}-${t.kind}-${t.src??t.label??"?"}`}src;content;type;encoding;id="";label="";language="";kind;default=!1;#h=!1;#e=0;#i="disabled";#o={};#n=[];#t=[];#s=[];#r=new Set;[a.readyState]=0;[a.crossOrigin];[a.onModeChange]=null;[a.native]=null;get metadata(){return this.#o}get regions(){return this.#n}get cues(){return this.#t}get activeCues(){return this.#s}get readyState(){return this[a.readyState]}get mode(){return this.#i}set mode(t){this.setMode(t)}constructor(t){super();for(const s of Object.keys(t))this[s]=t[s];this.type||(this.type="vtt"),t.content?this.#f(t):t.src||(this[a.readyState]=2)}addCue(t,s){if(t.id){if(this.#r.has(t.id))return;this.#r.add(t.id)}let e=0,i=this.#t.length;for(e=0;e<i&&!(t.endTime<=this.#t[e].startTime);e++);e===i?this.#t.push(t):this.#t.splice(e,0,t),t instanceof TextTrackCue||this[a.native]?.track.addCue(t),this.dispatchEvent(new c("add-cue",{detail:t,trigger:s})),f(t,this.#e)&&this[a.updateActiveCues](this.#e,s)}removeCue(t,s){const e=this.#t.indexOf(t);if(e>=0){const i=this.#s.includes(t);t.id&&this.#r.delete(t.id),this.#t.splice(e,1),this[a.native]?.track.removeCue(t),this.dispatchEvent(new c("remove-cue",{detail:t,trigger:s})),i&&this[a.updateActiveCues](this.#e,s)}}setMode(t,s){this.#i!==t&&(this.#i=t,t==="disabled"?(this.#s=[],this.#u()):this.readyState===2?this[a.updateActiveCues](this.#e,s):this.#c(),this.dispatchEvent(new c("mode-change",{detail:this,trigger:s})),this[a.onModeChange]?.())}[a.updateActiveCues](t,s){if(this.#e=t,this.mode==="disabled"||!this.#t.length)return;const e=[];for(let n=0,r=this.#t.length;n<r;n++){const o=this.#t[n];f(o,t)&&e.push(o)}let i=e.length!==this.#s.length;if(!i){for(let n=0;n<e.length;n++)if(!this.#s.includes(e[n])){i=!0;break}}this.#s=e,i&&this.#u(s)}[a.canLoad](){this.#h=!0,this.#i!=="disabled"&&this.#c()}#f(t){import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(({parseText:s,VTTCue:e,VTTRegion:i})=>{if(!u(t.content)||t.type==="json")this.#l(t.content,e,i),this.readyState!==3&&this.#a();else{const n=t.content.split(`
|
|
2
|
+
`).map(r=>r.trim()).join(`
|
|
3
|
+
`).trim();s(n,{type:t.type}).then(({cues:r,regions:o})=>{this.#t=r,this.#n=o,this.#a()})}})}async#c(){if(!(!this.#h||this[a.readyState]>0)){if(this[a.readyState]=1,this.dispatchEvent(new c("load-start")),!this.src){this.#a();return}try{const{parseResponse:t,VTTCue:s,VTTRegion:e}=await import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js"),i=this[a.crossOrigin]?.(),n=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:T(i)});if(this.type==="json")this.#l(await(await n).text(),s,e);else{const{errors:r,metadata:o,regions:d,cues:y}=await t(n,{type:this.type,encoding:this.encoding});if(r[0]?.code===0)throw r[0];this.#o=o,this.#n=d,this.#t=y}this.#a()}catch(t){this.#d(t)}}}#a(){if(this[a.readyState]=2,!this.src||this.type!=="vtt"){const s=this[a.native];if(s&&!s.managed)for(const e of this.#t)s.track.addCue(e)}const t=new c("load");this[a.updateActiveCues](this.#e,t),this.dispatchEvent(t)}#d(t){this[a.readyState]=3,this.dispatchEvent(new c("error",{detail:t}))}#l(t,s,e){try{const{regions:i,cues:n}=j(t,s,e);this.#n=i,this.#t=n}catch(i){this.#d(i)}}#u(t){this.dispatchEvent(new c("cue-change",{trigger:t}))}}const M=/captions|subtitles/;function _(h){return M.test(h.kind)}function j(h,t,s){const e=u(h)?JSON.parse(h):h;let i=[],n=[];return e.regions&&s&&(i=e.regions.map(r=>Object.assign(new s,r))),(e.cues||p(e))&&(n=(p(e)?e:e.cues).filter(r=>g(r.startTime)&&g(r.endTime)).map(r=>Object.assign(new t(0,0,""),r))),{regions:i,cues:n}}export{a as T,I as a,k as b,f as c,_ as i,v as w};
|