@hanifhan1f/vidstack-react 1.12.30 → 1.12.31

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.
Files changed (61) hide show
  1. package/dev/chunks/vidstack-3rdEWplD.js +189 -0
  2. package/dev/chunks/vidstack-BRTBRJ_I.js +288 -0
  3. package/dev/chunks/vidstack-C56TjAKZ.js +61 -0
  4. package/dev/chunks/vidstack-C5tZAkKo.js +11694 -0
  5. package/dev/chunks/vidstack-CXjRKTos.js +401 -0
  6. package/dev/chunks/vidstack-C_xw7iZ2.js +34 -0
  7. package/dev/chunks/vidstack-CaaASbOf.js +476 -0
  8. package/dev/chunks/vidstack-D2Bi2Td9.js +1537 -0
  9. package/dev/chunks/vidstack-D95QIbAo.js +551 -0
  10. package/dev/chunks/vidstack-DnmOVAbr.js +643 -0
  11. package/dev/chunks/vidstack-Dnoefs4z.js +180 -0
  12. package/dev/chunks/vidstack-S_S6XDnL.js +375 -0
  13. package/dev/chunks/vidstack-oOGofWSl.js +668 -0
  14. package/dev/chunks/vidstack-vh0BKYWJ.js +84 -0
  15. package/dev/player/vidstack-default-components.js +8 -9
  16. package/dev/player/vidstack-default-icons.js +1 -1
  17. package/dev/player/vidstack-default-layout.js +8 -9
  18. package/dev/player/vidstack-plyr-layout.js +63 -77
  19. package/dev/player/vidstack-remotion.js +6 -6
  20. package/dev/vidstack.js +133 -22
  21. package/package.json +1 -1
  22. package/prod/chunks/vidstack-B0SSIHIv.js +1537 -0
  23. package/prod/chunks/vidstack-B3E9kXKq.js +34 -0
  24. package/prod/chunks/vidstack-BLWRqo3I.js +470 -0
  25. package/prod/chunks/vidstack-BXAOpsiW.js +61 -0
  26. package/prod/chunks/vidstack-BzPma_p3.js +288 -0
  27. package/prod/chunks/vidstack-C48MQkXV.js +11199 -0
  28. package/prod/chunks/vidstack-CKBLQMZi.js +159 -0
  29. package/prod/chunks/vidstack-CwlfLr4v.js +504 -0
  30. package/prod/chunks/vidstack-DVMwXUgY.js +189 -0
  31. package/prod/chunks/vidstack-D_Sd7838.js +663 -0
  32. package/prod/chunks/vidstack-DgsBXr1J.js +84 -0
  33. package/prod/chunks/vidstack-DhSvljmQ.js +375 -0
  34. package/prod/chunks/vidstack-DlPpeEXU.js +545 -0
  35. package/prod/chunks/vidstack-xwdT591E.js +386 -0
  36. package/prod/player/vidstack-default-components.js +8 -9
  37. package/prod/player/vidstack-default-icons.js +1 -1
  38. package/prod/player/vidstack-default-layout.js +8 -9
  39. package/prod/player/vidstack-plyr-layout.js +63 -77
  40. package/prod/player/vidstack-remotion.js +6 -6
  41. package/prod/vidstack.js +204 -22
  42. package/server/chunks/vidstack--ufi23Q6.js +1537 -0
  43. package/server/chunks/vidstack-3hd9uS5U.js +386 -0
  44. package/server/chunks/vidstack-B_l_DXPI.js +61 -0
  45. package/server/chunks/vidstack-Bb44UuL8.js +470 -0
  46. package/server/chunks/vidstack-Bu9QXEz1.js +159 -0
  47. package/server/chunks/vidstack-Cb_tNfNU.js +11199 -0
  48. package/server/chunks/vidstack-D9vUNwri.js +288 -0
  49. package/server/chunks/vidstack-DM-5dPT-.js +663 -0
  50. package/server/chunks/vidstack-DWfS9vAY.js +84 -0
  51. package/server/chunks/vidstack-DY51lx0R.js +189 -0
  52. package/server/chunks/vidstack-VGPw_CQP.js +375 -0
  53. package/server/chunks/vidstack-dz2TmHzm.js +34 -0
  54. package/server/chunks/vidstack-e0ZPAI-d.js +504 -0
  55. package/server/chunks/vidstack-zzooMghu.js +545 -0
  56. package/server/player/vidstack-default-components.js +8 -9
  57. package/server/player/vidstack-default-icons.js +1 -1
  58. package/server/player/vidstack-default-layout.js +8 -9
  59. package/server/player/vidstack-plyr-layout.js +63 -77
  60. package/server/player/vidstack-remotion.js +6 -6
  61. package/server/vidstack.js +204 -22
@@ -0,0 +1,386 @@
1
+ "use client"
2
+
3
+ import { peek, listenEvent, effect, DOMEvent, isString, camelToKebabCase, isUndefined, isFunction } from './vidstack-CZgUA94N.js';
4
+ import { QualitySymbol, RAFLoop, TextTrack, TextTrackSymbol, ListSymbol, IS_CHROME, coerceToError, loadScript, VideoProvider, isHLSSupported, preconnect } from './vidstack-C48MQkXV.js';
5
+ import 'react';
6
+ import '@floating-ui/dom';
7
+
8
+ const toDOMEventType = (type) => camelToKebabCase(type);
9
+ class HLSController {
10
+ #video;
11
+ #ctx;
12
+ #instance = null;
13
+ #stopLiveSync = null;
14
+ config = {};
15
+ #callbacks = /* @__PURE__ */ new Set();
16
+ get instance() {
17
+ return this.#instance;
18
+ }
19
+ constructor(video, ctx) {
20
+ this.#video = video;
21
+ this.#ctx = ctx;
22
+ }
23
+ setup(ctor) {
24
+ const { streamType } = this.#ctx.$state;
25
+ const isLive = peek(streamType).includes("live"), isLiveLowLatency = peek(streamType).includes("ll-");
26
+ this.#instance = new ctor({
27
+ lowLatencyMode: isLiveLowLatency,
28
+ backBufferLength: isLiveLowLatency ? 4 : isLive ? 8 : void 0,
29
+ renderTextTracksNatively: false,
30
+ ...this.config
31
+ });
32
+ const dispatcher = this.#dispatchHLSEvent.bind(this);
33
+ for (const event of Object.values(ctor.Events)) this.#instance.on(event, dispatcher);
34
+ this.#instance.on(ctor.Events.ERROR, this.#onError.bind(this));
35
+ for (const callback of this.#callbacks) callback(this.#instance);
36
+ this.#ctx.player.dispatch("hls-instance", {
37
+ detail: this.#instance
38
+ });
39
+ this.#instance.attachMedia(this.#video);
40
+ this.#instance.on(ctor.Events.AUDIO_TRACK_SWITCHED, this.#onAudioSwitch.bind(this));
41
+ this.#instance.on(ctor.Events.LEVEL_SWITCHED, this.#onLevelSwitched.bind(this));
42
+ this.#instance.on(ctor.Events.LEVEL_LOADED, this.#onLevelLoaded.bind(this));
43
+ this.#instance.on(ctor.Events.LEVEL_UPDATED, this.#onLevelUpdated.bind(this));
44
+ this.#instance.on(ctor.Events.NON_NATIVE_TEXT_TRACKS_FOUND, this.#onTracksFound.bind(this));
45
+ this.#instance.on(ctor.Events.CUES_PARSED, this.#onCuesParsed.bind(this));
46
+ this.#ctx.qualities[QualitySymbol.enableAuto] = this.#enableAutoQuality.bind(this);
47
+ listenEvent(this.#ctx.qualities, "change", this.#onUserQualityChange.bind(this));
48
+ listenEvent(this.#ctx.audioTracks, "change", this.#onUserAudioChange.bind(this));
49
+ this.#stopLiveSync = effect(this.#liveSync.bind(this));
50
+ }
51
+ #createDOMEvent(type, data) {
52
+ return new DOMEvent(toDOMEventType(type), { detail: data });
53
+ }
54
+ #liveSync() {
55
+ if (!this.#ctx.$state.live()) return;
56
+ const raf = new RAFLoop(this.#liveSyncPosition.bind(this));
57
+ raf.start();
58
+ return raf.stop.bind(raf);
59
+ }
60
+ #liveSyncPosition() {
61
+ this.#ctx.$state.liveSyncPosition.set(this.#instance?.liveSyncPosition ?? Infinity);
62
+ }
63
+ #dispatchHLSEvent(type, data) {
64
+ this.#ctx.player?.dispatch(this.#createDOMEvent(type, data));
65
+ }
66
+ #onTracksFound(eventType, data) {
67
+ const event = this.#createDOMEvent(eventType, data);
68
+ let currentTrack = -1;
69
+ for (let i = 0; i < data.tracks.length; i++) {
70
+ const nonNativeTrack = data.tracks[i], init = nonNativeTrack.subtitleTrack ?? nonNativeTrack.closedCaptions, track = new TextTrack({
71
+ id: `hls-${nonNativeTrack.kind}-${i}`,
72
+ src: init?.url,
73
+ label: nonNativeTrack.label,
74
+ language: init?.lang,
75
+ kind: nonNativeTrack.kind,
76
+ default: nonNativeTrack.default
77
+ });
78
+ track[TextTrackSymbol.readyState] = 2;
79
+ track[TextTrackSymbol.onModeChange] = () => {
80
+ if (track.mode === "showing") {
81
+ this.#instance.subtitleTrack = i;
82
+ currentTrack = i;
83
+ } else if (currentTrack === i) {
84
+ this.#instance.subtitleTrack = -1;
85
+ currentTrack = -1;
86
+ }
87
+ };
88
+ this.#ctx.textTracks.add(track, event);
89
+ }
90
+ }
91
+ #onCuesParsed(eventType, data) {
92
+ const index = this.#instance?.subtitleTrack, track = this.#ctx.textTracks.getById(`hls-${data.type}-${index}`);
93
+ if (!track) return;
94
+ const event = this.#createDOMEvent(eventType, data);
95
+ for (const cue of data.cues) {
96
+ cue.positionAlign = "auto";
97
+ track.addCue(cue, event);
98
+ }
99
+ }
100
+ #onAudioSwitch(eventType, data) {
101
+ const track = this.#ctx.audioTracks[data.id];
102
+ if (track) {
103
+ const trigger = this.#createDOMEvent(eventType, data);
104
+ this.#ctx.audioTracks[ListSymbol.select](track, true, trigger);
105
+ }
106
+ }
107
+ #onLevelSwitched(eventType, data) {
108
+ const quality = this.#ctx.qualities[data.level];
109
+ if (quality) {
110
+ const trigger = this.#createDOMEvent(eventType, data);
111
+ this.#ctx.qualities[ListSymbol.select](quality, true, trigger);
112
+ }
113
+ }
114
+ #onLevelUpdated(eventType, data) {
115
+ if (data.details.totalduration > 0) {
116
+ this.#ctx.$state.inferredLiveDVRWindow.set(data.details.totalduration);
117
+ }
118
+ }
119
+ #onLevelLoaded(eventType, data) {
120
+ if (this.#ctx.$state.canPlay()) return;
121
+ const { type, live, totalduration: duration, targetduration } = data.details, trigger = this.#createDOMEvent(eventType, data);
122
+ this.#ctx.notify(
123
+ "stream-type-change",
124
+ live ? type === "EVENT" && Number.isFinite(duration) && targetduration >= 10 ? "live:dvr" : "live" : "on-demand",
125
+ trigger
126
+ );
127
+ this.#ctx.notify("duration-change", duration, trigger);
128
+ const media = this.#instance.media;
129
+ if (this.#instance.currentLevel === -1) {
130
+ this.#ctx.qualities[QualitySymbol.setAuto](true, trigger);
131
+ }
132
+ for (const remoteTrack of this.#instance.audioTracks) {
133
+ const localTrack = {
134
+ id: remoteTrack.id.toString(),
135
+ label: remoteTrack.name,
136
+ language: remoteTrack.lang || "",
137
+ kind: "main"
138
+ };
139
+ this.#ctx.audioTracks[ListSymbol.add](localTrack, trigger);
140
+ }
141
+ for (const level of this.#instance.levels) {
142
+ const videoQuality = {
143
+ id: level.id?.toString() ?? level.height + "p",
144
+ width: level.width,
145
+ height: level.height,
146
+ codec: level.codecSet,
147
+ bitrate: level.bitrate
148
+ };
149
+ this.#ctx.qualities[ListSymbol.add](videoQuality, trigger);
150
+ }
151
+ media.dispatchEvent(new DOMEvent("canplay", { trigger }));
152
+ }
153
+ #onError(eventType, data) {
154
+ if (data.fatal) {
155
+ switch (data.type) {
156
+ case "mediaError":
157
+ this.#instance?.recoverMediaError();
158
+ break;
159
+ default:
160
+ this.#onFatalError(data.error);
161
+ break;
162
+ }
163
+ }
164
+ }
165
+ #onFatalError(error) {
166
+ this.#ctx.notify("error", {
167
+ message: error.message,
168
+ code: 1,
169
+ error
170
+ });
171
+ }
172
+ #enableAutoQuality() {
173
+ if (this.#instance) this.#instance.currentLevel = -1;
174
+ }
175
+ #onUserQualityChange() {
176
+ const { qualities } = this.#ctx;
177
+ if (!this.#instance || qualities.auto) return;
178
+ this.#instance[qualities.switch + "Level"] = qualities.selectedIndex;
179
+ if (IS_CHROME) {
180
+ this.#video.currentTime = this.#video.currentTime;
181
+ }
182
+ }
183
+ #onUserAudioChange() {
184
+ const { audioTracks } = this.#ctx;
185
+ if (this.#instance && this.#instance.audioTrack !== audioTracks.selectedIndex) {
186
+ this.#instance.audioTrack = audioTracks.selectedIndex;
187
+ }
188
+ }
189
+ onInstance(callback) {
190
+ this.#callbacks.add(callback);
191
+ return () => this.#callbacks.delete(callback);
192
+ }
193
+ loadSource(src) {
194
+ if (!isString(src.src)) return;
195
+ this.#instance?.loadSource(src.src);
196
+ }
197
+ destroy() {
198
+ this.#instance?.destroy();
199
+ this.#instance = null;
200
+ this.#stopLiveSync?.();
201
+ this.#stopLiveSync = null;
202
+ }
203
+ }
204
+
205
+ class HLSLibLoader {
206
+ #lib;
207
+ #ctx;
208
+ #callback;
209
+ constructor(lib, ctx, callback) {
210
+ this.#lib = lib;
211
+ this.#ctx = ctx;
212
+ this.#callback = callback;
213
+ this.#startLoading();
214
+ }
215
+ async #startLoading() {
216
+ const callbacks = {
217
+ onLoadStart: this.#onLoadStart.bind(this),
218
+ onLoaded: this.#onLoaded.bind(this),
219
+ onLoadError: this.#onLoadError.bind(this)
220
+ };
221
+ let ctor = await loadHLSScript(this.#lib, callbacks);
222
+ if (isUndefined(ctor) && !isString(this.#lib)) ctor = await importHLS(this.#lib, callbacks);
223
+ if (!ctor) return null;
224
+ if (!ctor.isSupported()) {
225
+ const message = "[vidstack] `hls.js` is not supported in this environment";
226
+ this.#ctx.player.dispatch(new DOMEvent("hls-unsupported"));
227
+ this.#ctx.notify("error", { message, code: 4 });
228
+ return null;
229
+ }
230
+ return ctor;
231
+ }
232
+ #onLoadStart() {
233
+ this.#ctx.player.dispatch(new DOMEvent("hls-lib-load-start"));
234
+ }
235
+ #onLoaded(ctor) {
236
+ this.#ctx.player.dispatch(
237
+ new DOMEvent("hls-lib-loaded", {
238
+ detail: ctor
239
+ })
240
+ );
241
+ this.#callback(ctor);
242
+ }
243
+ #onLoadError(e) {
244
+ const error = coerceToError(e);
245
+ this.#ctx.player.dispatch(
246
+ new DOMEvent("hls-lib-load-error", {
247
+ detail: error
248
+ })
249
+ );
250
+ this.#ctx.notify("error", {
251
+ message: error.message,
252
+ code: 4,
253
+ error
254
+ });
255
+ }
256
+ }
257
+ async function importHLS(loader, callbacks = {}) {
258
+ if (isUndefined(loader)) return void 0;
259
+ callbacks.onLoadStart?.();
260
+ if (loader.prototype && loader.prototype !== Function) {
261
+ callbacks.onLoaded?.(loader);
262
+ return loader;
263
+ }
264
+ try {
265
+ const ctor = (await loader())?.default;
266
+ if (ctor && !!ctor.isSupported) {
267
+ callbacks.onLoaded?.(ctor);
268
+ } else {
269
+ throw Error(
270
+ false ? "[vidstack] failed importing `hls.js`. Dynamic import returned invalid constructor." : ""
271
+ );
272
+ }
273
+ return ctor;
274
+ } catch (err) {
275
+ callbacks.onLoadError?.(err);
276
+ }
277
+ return void 0;
278
+ }
279
+ async function loadHLSScript(src, callbacks = {}) {
280
+ if (!isString(src)) return void 0;
281
+ callbacks.onLoadStart?.();
282
+ try {
283
+ await loadScript(src);
284
+ if (!isFunction(window.Hls)) {
285
+ throw Error(
286
+ false ? "[vidstack] failed loading `hls.js`. Could not find a valid `Hls` constructor on window" : ""
287
+ );
288
+ }
289
+ const ctor = window.Hls;
290
+ callbacks.onLoaded?.(ctor);
291
+ return ctor;
292
+ } catch (err) {
293
+ callbacks.onLoadError?.(err);
294
+ }
295
+ return void 0;
296
+ }
297
+
298
+ const JS_DELIVR_CDN = "https://cdn.jsdelivr.net";
299
+ class HLSProvider extends VideoProvider {
300
+ $$PROVIDER_TYPE = "HLS";
301
+ #ctor = null;
302
+ #controller = new HLSController(this.video, this.ctx);
303
+ /**
304
+ * The `hls.js` constructor.
305
+ */
306
+ get ctor() {
307
+ return this.#ctor;
308
+ }
309
+ /**
310
+ * The current `hls.js` instance.
311
+ */
312
+ get instance() {
313
+ return this.#controller.instance;
314
+ }
315
+ /**
316
+ * Whether `hls.js` is supported in this environment.
317
+ */
318
+ static supported = isHLSSupported();
319
+ get type() {
320
+ return "hls";
321
+ }
322
+ get canLiveSync() {
323
+ return true;
324
+ }
325
+ #library = `${JS_DELIVR_CDN}/npm/hls.js@^1.5.0/dist/hls${".min.js"}`;
326
+ /**
327
+ * The `hls.js` configuration object.
328
+ *
329
+ * @see {@link https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning}
330
+ */
331
+ get config() {
332
+ return this.#controller.config;
333
+ }
334
+ set config(config) {
335
+ this.#controller.config = config;
336
+ }
337
+ /**
338
+ * The `hls.js` constructor (supports dynamic imports) or a URL of where it can be found.
339
+ *
340
+ * @defaultValue `https://cdn.jsdelivr.net/npm/hls.js@^1.0.0/dist/hls.min.js`
341
+ */
342
+ get library() {
343
+ return this.#library;
344
+ }
345
+ set library(library) {
346
+ this.#library = library;
347
+ }
348
+ preconnect() {
349
+ if (!isString(this.#library)) return;
350
+ preconnect(this.#library);
351
+ }
352
+ setup() {
353
+ super.setup();
354
+ new HLSLibLoader(this.#library, this.ctx, (ctor) => {
355
+ this.#ctor = ctor;
356
+ this.#controller.setup(ctor);
357
+ this.ctx.notify("provider-setup", this);
358
+ const src = peek(this.ctx.$state.source);
359
+ if (src) this.loadSource(src);
360
+ });
361
+ }
362
+ async loadSource(src, preload) {
363
+ if (!isString(src.src)) {
364
+ this.removeSource();
365
+ return;
366
+ }
367
+ this.media.preload = preload || "";
368
+ this.appendSource(src, "application/x-mpegurl");
369
+ this.#controller.loadSource(src);
370
+ this.currentSrc = src;
371
+ }
372
+ /**
373
+ * The given callback is invoked when a new `hls.js` instance is created and right before it's
374
+ * attached to media.
375
+ */
376
+ onInstance(callback) {
377
+ const instance = this.#controller.instance;
378
+ if (instance) callback(instance);
379
+ return this.#controller.onInstance(callback);
380
+ }
381
+ destroy() {
382
+ this.#controller.destroy();
383
+ }
384
+ }
385
+
386
+ export { HLSProvider };
@@ -1,15 +1,14 @@
1
1
  "use client"
2
2
 
3
- export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions } from '../chunks/vidstack-DXSNXDnS.js';
3
+ export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions } from '../chunks/vidstack-B0SSIHIv.js';
4
4
  export { defaultLayoutIcons } from './vidstack-default-icons.js';
5
5
  import 'react';
6
- import '../chunks/vidstack-CYK75vJF.js';
7
- import '../chunks/vidstack-CKapDFwB.js';
8
- import '../chunks/vidstack-D91K36KQ.js';
9
- import 'vidstack';
10
- import '../chunks/vidstack-BCBskRpc.js';
6
+ import '../chunks/vidstack-CZgUA94N.js';
7
+ import '../chunks/vidstack-DhSvljmQ.js';
8
+ import '../chunks/vidstack-C48MQkXV.js';
9
+ import '@floating-ui/dom';
10
+ import '../chunks/vidstack-D_Sd7838.js';
11
11
  import 'react-dom';
12
- import '../chunks/vidstack-CtxjO6HG.js';
13
- import '../chunks/vidstack-BZVrgeRF.js';
14
- import 'vidstack/exports/font.ts';
12
+ import '../chunks/vidstack-DgsBXr1J.js';
13
+ import '../chunks/vidstack-vqp2QaHR.js';
15
14
  import '../chunks/vidstack-CBF7iUqu.js';
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from 'react';
4
- import { Icon$34, Icon$35, Icon$27, Icon$26, Icon$60, Icon$61, Icon$39, Icon$40, Icon$105, Icon$104, Icon$54, Icon$59, Icon$62, Icon$19, Icon$56, Icon$33, Icon$8, Icon$13, Icon$88, Icon$63, Icon$16, Icon$53, Icon$22, Icon$11, Icon$0, Icon$31, Icon$81, Icon$77, Icon$74, Icon$24, Icon$5 } from '../chunks/vidstack-CYK75vJF.js';
4
+ import { Icon$34, Icon$35, Icon$27, Icon$26, Icon$60, Icon$61, Icon$39, Icon$40, Icon$105, Icon$104, Icon$54, Icon$59, Icon$62, Icon$19, Icon$56, Icon$33, Icon$8, Icon$13, Icon$88, Icon$63, Icon$16, Icon$53, Icon$22, Icon$11, Icon$0, Icon$31, Icon$81, Icon$77, Icon$74, Icon$24, Icon$5 } from '../chunks/vidstack-CZgUA94N.js';
5
5
  import { Icon } from '../chunks/vidstack-CBF7iUqu.js';
6
6
 
7
7
  function createIcon(paths) {
@@ -1,15 +1,14 @@
1
1
  "use client"
2
2
 
3
- export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultLayoutContext, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions, i18n, useDefaultLayoutContext, useDefaultLayoutWord } from '../chunks/vidstack-DXSNXDnS.js';
3
+ export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultLayoutContext, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions, i18n, useDefaultLayoutContext, useDefaultLayoutWord } from '../chunks/vidstack-B0SSIHIv.js';
4
4
  export { defaultLayoutIcons } from './vidstack-default-icons.js';
5
5
  import 'react';
6
- import '../chunks/vidstack-CYK75vJF.js';
7
- import '../chunks/vidstack-CKapDFwB.js';
8
- import '../chunks/vidstack-D91K36KQ.js';
9
- import 'vidstack';
10
- import '../chunks/vidstack-BCBskRpc.js';
6
+ import '../chunks/vidstack-CZgUA94N.js';
7
+ import '../chunks/vidstack-DhSvljmQ.js';
8
+ import '../chunks/vidstack-C48MQkXV.js';
9
+ import '@floating-ui/dom';
10
+ import '../chunks/vidstack-D_Sd7838.js';
11
11
  import 'react-dom';
12
- import '../chunks/vidstack-CtxjO6HG.js';
13
- import '../chunks/vidstack-BZVrgeRF.js';
14
- import 'vidstack/exports/font.ts';
12
+ import '../chunks/vidstack-DgsBXr1J.js';
13
+ import '../chunks/vidstack-vqp2QaHR.js';
15
14
  import '../chunks/vidstack-CBF7iUqu.js';
@@ -1,89 +1,75 @@
1
1
  "use client"
2
2
 
3
- import { IS_SERVER, useMediaState, Primitive, isRemotionSrc } from '../chunks/vidstack-D91K36KQ.js';
3
+ import { useMediaState, Primitive, IS_SERVER, isRemotionSrc, getDownloadFile } from '../chunks/vidstack-C48MQkXV.js';
4
4
  import * as React from 'react';
5
- import { isString, isBoolean, uppercaseFirstChar, isUndefined, signal, composeRefs, useSignal, isNumber, listenEvent } from '../chunks/vidstack-CYK75vJF.js';
6
- import { usePlyrLayoutClasses, isKeyboardEvent, isKeyboardClick } from 'vidstack';
7
- import { useMediaContext, PlayButton, Root, Img, Gesture, AirPlayButton, CaptionButton, FullscreenButton, PIPButton, SeekButton, Root$1, Value, Preview, Thumbnail, LiveButton, Time, appendParamsToURL, Root$2, Button, Items, useAudioOptions, Root$3, Item, useCaptionOptions, MuteButton, Root$4 } from '../chunks/vidstack-BCBskRpc.js';
8
- import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-DJThTSEm.js';
9
- import { useLayoutName, useClassName } from '../chunks/vidstack-CtxjO6HG.js';
10
- import { RemotionThumbnail, RemotionPoster, RemotionSliderThumbnail } from '../chunks/vidstack-BZVrgeRF.js';
5
+ import { effect, createDisposalBin, uppercaseFirstChar, isUndefined, signal, composeRefs, useSignal, isNumber, listenEvent, isString, isKeyboardEvent, isKeyboardClick } from '../chunks/vidstack-CZgUA94N.js';
6
+ import { useMediaContext, PlayButton, Root, Img, Gesture, AirPlayButton, CaptionButton, FullscreenButton, PIPButton, SeekButton, Root$1, Value, Preview, Thumbnail, LiveButton, Time, appendParamsToURL, Root$2, Button, Items, useAudioOptions, Root$3, Item, useCaptionOptions, MuteButton, Root$4 } from '../chunks/vidstack-D_Sd7838.js';
7
+ import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-DVMwXUgY.js';
8
+ import { useLayoutName, useClassName } from '../chunks/vidstack-DgsBXr1J.js';
9
+ import { RemotionThumbnail, RemotionPoster, RemotionSliderThumbnail } from '../chunks/vidstack-vqp2QaHR.js';
11
10
  export { plyrLayoutIcons } from './vidstack-plyr-icons.js';
11
+ import '@floating-ui/dom';
12
12
  import 'react-dom';
13
13
  import '../chunks/vidstack-CBF7iUqu.js';
14
14
 
15
- IS_SERVER ? "" : navigator?.userAgent.toLowerCase() || "";
16
- function canPlayHLSNatively(video) {
17
- if (IS_SERVER) return false;
18
- if (!video) video = document.createElement("video");
19
- return video.canPlayType("application/vnd.apple.mpegurl").length > 0;
20
- }
21
-
22
- const AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i;
23
- const AUDIO_TYPES = /* @__PURE__ */ new Set([
24
- "audio/mpeg",
25
- "audio/ogg",
26
- "audio/3gp",
27
- "audio/mp3",
28
- "audio/webm",
29
- "audio/flac",
30
- "audio/m4a",
31
- "audio/m4b",
32
- "audio/mp4a",
33
- "audio/mp4"
34
- ]);
35
- const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
36
- const VIDEO_TYPES = /* @__PURE__ */ new Set([
37
- "video/mp4",
38
- "video/webm",
39
- "video/3gp",
40
- "video/ogg",
41
- "video/avi",
42
- "video/mpeg"
43
- ]);
44
- const HLS_VIDEO_EXTENSIONS = /\.(m3u8)($|\?)/i;
45
- const HLS_VIDEO_TYPES = /* @__PURE__ */ new Set([
46
- // Apple sanctioned
47
- "application/vnd.apple.mpegurl",
48
- // Apple sanctioned for backwards compatibility
49
- "audio/mpegurl",
50
- // Very common
51
- "audio/x-mpegurl",
52
- // Very common
53
- "application/x-mpegurl",
54
- // Included for completeness
55
- "video/x-mpegurl",
56
- "video/mpegurl",
57
- "application/mpegurl"
58
- ]);
59
- function isAudioSrc({ src, type }) {
60
- return isString(src) ? AUDIO_EXTENSIONS.test(src) || AUDIO_TYPES.has(type) || src.startsWith("blob:") && type === "audio/object" : type === "audio/object";
61
- }
62
- function isVideoSrc(src) {
63
- return isString(src.src) ? VIDEO_EXTENSIONS.test(src.src) || VIDEO_TYPES.has(src.type) || src.src.startsWith("blob:") && src.type === "video/object" || isHLSSrc(src) && (IS_SERVER || canPlayHLSNatively()) : src.type === "video/object";
64
- }
65
- function isHLSSrc({ src, type }) {
66
- return isString(src) && HLS_VIDEO_EXTENSIONS.test(src) || HLS_VIDEO_TYPES.has(type);
67
- }
68
-
69
- function getDownloadFile({
70
- title,
71
- src,
72
- download
73
- }) {
74
- const url = isBoolean(download) || download === "" ? src.src : isString(download) ? download : download?.url;
75
- if (!isValidFileDownload({ url, src, download })) return null;
76
- return {
77
- url,
78
- name: !isBoolean(download) && !isString(download) && download?.filename || title.toLowerCase() || "media"
15
+ function usePlyrLayoutClasses(el, media) {
16
+ const {
17
+ canAirPlay,
18
+ canFullscreen,
19
+ canPictureInPicture,
20
+ controlsHidden,
21
+ currentTime,
22
+ fullscreen,
23
+ hasCaptions,
24
+ isAirPlayConnected,
25
+ paused,
26
+ pictureInPicture,
27
+ playing,
28
+ pointer,
29
+ poster,
30
+ textTrack,
31
+ viewType,
32
+ waiting
33
+ } = media.$state;
34
+ el.classList.add("plyr");
35
+ el.classList.add("plyr--full-ui");
36
+ const classes = {
37
+ "plyr--airplay-active": isAirPlayConnected,
38
+ "plyr--airplay-supported": canAirPlay,
39
+ "plyr--fullscreen-active": fullscreen,
40
+ "plyr--fullscreen-enabled": canFullscreen,
41
+ "plyr--hide-controls": controlsHidden,
42
+ "plyr--is-touch": () => pointer() === "coarse",
43
+ "plyr--loading": waiting,
44
+ "plyr--paused": paused,
45
+ "plyr--pip-active": pictureInPicture,
46
+ "plyr--pip-enabled": canPictureInPicture,
47
+ "plyr--playing": playing,
48
+ "plyr__poster-enabled": poster,
49
+ "plyr--stopped": () => paused() && currentTime() === 0,
50
+ "plyr--captions-active": textTrack,
51
+ "plyr--captions-enabled": hasCaptions
79
52
  };
53
+ const disposal = createDisposalBin();
54
+ for (const token of Object.keys(classes)) {
55
+ disposal.add(effect(() => void el.classList.toggle(token, !!classes[token]())));
56
+ }
57
+ disposal.add(
58
+ effect(() => {
59
+ const token = `plyr--${viewType()}`;
60
+ el.classList.add(token);
61
+ return () => el.classList.remove(token);
62
+ }),
63
+ effect(() => {
64
+ const { $provider } = media, type = $provider()?.type, token = `plyr--${isHTMLProvider(type) ? "html5" : type}`;
65
+ el.classList.toggle(token, !!type);
66
+ return () => el.classList.remove(token);
67
+ })
68
+ );
69
+ return () => disposal.empty();
80
70
  }
81
- function isValidFileDownload({
82
- url,
83
- src,
84
- download
85
- }) {
86
- return isString(url) && (download && download !== true || isAudioSrc(src) || isVideoSrc(src));
71
+ function isHTMLProvider(type) {
72
+ return type === "audio" || type === "video";
87
73
  }
88
74
 
89
75
  const PlyrLayoutContext = React.createContext({});
@@ -1,12 +1,12 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from 'react';
4
- import { createDisposalBin, animationFrameThrottle, noop } from '../chunks/vidstack-CYK75vJF.js';
4
+ import { createDisposalBin, animationFrameThrottle, noop } from '../chunks/vidstack-CZgUA94N.js';
5
5
  import { Internals, random } from 'remotion';
6
- import { IS_SERVER, useMediaState, isRemotionSrc, Primitive, useSliderState } from '../chunks/vidstack-D91K36KQ.js';
7
- export { isRemotionProvider } from '../chunks/vidstack-D91K36KQ.js';
8
- import { RemotionThumbnail as RemotionThumbnail$1, RemotionSliderThumbnail as RemotionSliderThumbnail$1, RemotionPoster as RemotionPoster$1 } from '../chunks/vidstack-BZVrgeRF.js';
9
- import 'vidstack';
6
+ import { IS_SERVER, useMediaState, isRemotionSrc, Primitive, useSliderState } from '../chunks/vidstack-C48MQkXV.js';
7
+ export { isRemotionProvider } from '../chunks/vidstack-C48MQkXV.js';
8
+ import { RemotionThumbnail as RemotionThumbnail$1, RemotionSliderThumbnail as RemotionSliderThumbnail$1, RemotionPoster as RemotionPoster$1 } from '../chunks/vidstack-vqp2QaHR.js';
9
+ import '@floating-ui/dom';
10
10
 
11
11
  class RemotionLayoutEngine {
12
12
  #src = null;
@@ -328,7 +328,7 @@ class RemotionProviderLoader {
328
328
  return "video";
329
329
  }
330
330
  async load(ctx) {
331
- return new (await import('../chunks/vidstack-DdiGCJVp.js')).RemotionProvider(this.target, ctx);
331
+ return new (await import('../chunks/vidstack-CwlfLr4v.js')).RemotionProvider(this.target, ctx);
332
332
  }
333
333
  }
334
334