@hanifhan1f/vidstack-react 1.12.24 → 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/dev/chunks/vidstack-BNwnoM-l.js +84 -0
- package/dev/chunks/vidstack-BOPSNTgH.js +668 -0
- package/dev/chunks/vidstack-BSZY6sbC.js +180 -0
- package/dev/chunks/vidstack-BVVxkUlq.js +288 -0
- package/dev/chunks/vidstack-BXgKy_7V.js +11693 -0
- package/dev/chunks/vidstack-BrqDQG-r.js +643 -0
- package/dev/chunks/vidstack-C3QPOZNd.js +476 -0
- package/dev/chunks/vidstack-C7BwfK5c.js +1537 -0
- package/dev/chunks/vidstack-CEUjDh4x.js +34 -0
- package/dev/chunks/vidstack-CQSHFVu7.js +401 -0
- package/dev/chunks/vidstack-Csfg08VS.js +551 -0
- package/dev/chunks/vidstack-DTow20pt.js +189 -0
- package/dev/chunks/vidstack-L5mw2iPb.js +375 -0
- package/dev/chunks/vidstack-iRuTLfhk.js +61 -0
- package/dev/player/vidstack-default-components.js +5 -5
- package/dev/player/vidstack-default-layout.js +5 -5
- package/dev/player/vidstack-plyr-layout.js +4 -4
- package/dev/player/vidstack-remotion.js +3 -3
- package/dev/vidstack.js +7 -7
- package/package.json +1 -1
- package/prod/chunks/vidstack-58ZavMvv.js +159 -0
- package/prod/chunks/vidstack-BS445j5D.js +84 -0
- package/prod/chunks/vidstack-B_9VGrZQ.js +504 -0
- package/prod/chunks/vidstack-Bm2UemPE.js +470 -0
- package/prod/chunks/vidstack-Bp_hAwzI.js +61 -0
- package/prod/chunks/vidstack-CQll06Hv.js +34 -0
- package/prod/chunks/vidstack-D3cSYtez.js +663 -0
- package/prod/chunks/vidstack-D_ijTIbV.js +11198 -0
- package/prod/chunks/vidstack-DgGDsAKh.js +375 -0
- package/prod/chunks/vidstack-DrEorv9m.js +189 -0
- package/prod/chunks/vidstack-ehqxnvc9.js +1537 -0
- package/prod/chunks/vidstack-lc8NHly9.js +288 -0
- package/prod/chunks/vidstack-rKV98aQH.js +545 -0
- package/prod/chunks/vidstack-uA7h-Bsq.js +386 -0
- package/prod/player/vidstack-default-components.js +5 -5
- package/prod/player/vidstack-default-layout.js +5 -5
- package/prod/player/vidstack-plyr-layout.js +4 -4
- package/prod/player/vidstack-remotion.js +3 -3
- package/prod/vidstack.js +7 -7
- package/server/chunks/vidstack-B3AXUfgF.js +189 -0
- package/server/chunks/vidstack-BJCx78pm.js +386 -0
- package/server/chunks/vidstack-BtitkRvR.js +11198 -0
- package/server/chunks/vidstack-BweZhuNd.js +1537 -0
- package/server/chunks/vidstack-CSiPajWY.js +470 -0
- package/server/chunks/vidstack-CgXa6YO3.js +61 -0
- package/server/chunks/vidstack-DH6N0AoF.js +375 -0
- package/server/chunks/vidstack-DKr7br9D.js +34 -0
- package/server/chunks/vidstack-Dbs_rXUT.js +663 -0
- package/server/chunks/vidstack-E7eUOyFt.js +288 -0
- package/server/chunks/vidstack-JkJEYEQM.js +159 -0
- package/server/chunks/vidstack-KhtuR229.js +504 -0
- package/server/chunks/vidstack-X1Hex9PH.js +84 -0
- package/server/chunks/vidstack-yf18YVAb.js +545 -0
- package/server/player/vidstack-default-components.js +5 -5
- package/server/player/vidstack-default-layout.js +5 -5
- package/server/player/vidstack-plyr-layout.js +4 -4
- package/server/player/vidstack-remotion.js +3 -3
- package/server/vidstack.js +7 -7
|
@@ -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-D_ijTIbV.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,14 +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-
|
|
3
|
+
export { DefaultAudioLayout, DefaultBufferingIndicator, DefaultKeyboardDisplay, DefaultMenuButton, DefaultMenuCheckbox, DefaultMenuItem, DefaultMenuRadioGroup, DefaultMenuSection, DefaultMenuSliderItem, DefaultSliderParts, DefaultSliderSteps, DefaultTooltip, DefaultVideoGestures, DefaultVideoLargeLayout, DefaultVideoLayout, DefaultVideoSmallLayout, createRadioOptions } from '../chunks/vidstack-ehqxnvc9.js';
|
|
4
4
|
export { defaultLayoutIcons } from './vidstack-default-icons.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../chunks/vidstack-CZgUA94N.js';
|
|
7
|
-
import '../chunks/vidstack-
|
|
8
|
-
import '../chunks/vidstack-
|
|
7
|
+
import '../chunks/vidstack-DgGDsAKh.js';
|
|
8
|
+
import '../chunks/vidstack-D_ijTIbV.js';
|
|
9
9
|
import '@floating-ui/dom';
|
|
10
|
-
import '../chunks/vidstack-
|
|
10
|
+
import '../chunks/vidstack-D3cSYtez.js';
|
|
11
11
|
import 'react-dom';
|
|
12
|
-
import '../chunks/vidstack-
|
|
12
|
+
import '../chunks/vidstack-BS445j5D.js';
|
|
13
13
|
import '../chunks/vidstack-vqp2QaHR.js';
|
|
14
14
|
import '../chunks/vidstack-CBF7iUqu.js';
|
|
@@ -1,14 +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-
|
|
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-ehqxnvc9.js';
|
|
4
4
|
export { defaultLayoutIcons } from './vidstack-default-icons.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../chunks/vidstack-CZgUA94N.js';
|
|
7
|
-
import '../chunks/vidstack-
|
|
8
|
-
import '../chunks/vidstack-
|
|
7
|
+
import '../chunks/vidstack-DgGDsAKh.js';
|
|
8
|
+
import '../chunks/vidstack-D_ijTIbV.js';
|
|
9
9
|
import '@floating-ui/dom';
|
|
10
|
-
import '../chunks/vidstack-
|
|
10
|
+
import '../chunks/vidstack-D3cSYtez.js';
|
|
11
11
|
import 'react-dom';
|
|
12
|
-
import '../chunks/vidstack-
|
|
12
|
+
import '../chunks/vidstack-BS445j5D.js';
|
|
13
13
|
import '../chunks/vidstack-vqp2QaHR.js';
|
|
14
14
|
import '../chunks/vidstack-CBF7iUqu.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { useMediaState, Primitive, IS_SERVER, isRemotionSrc, getDownloadFile } from '../chunks/vidstack-
|
|
3
|
+
import { useMediaState, Primitive, IS_SERVER, isRemotionSrc, getDownloadFile } from '../chunks/vidstack-D_ijTIbV.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
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-
|
|
7
|
-
import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-
|
|
8
|
-
import { useLayoutName, useClassName } from '../chunks/vidstack-
|
|
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-D3cSYtez.js';
|
|
7
|
+
import { useMediaRemote, useVideoQualityOptions, usePlaybackRateOptions } from '../chunks/vidstack-DrEorv9m.js';
|
|
8
|
+
import { useLayoutName, useClassName } from '../chunks/vidstack-BS445j5D.js';
|
|
9
9
|
import { RemotionThumbnail, RemotionPoster, RemotionSliderThumbnail } from '../chunks/vidstack-vqp2QaHR.js';
|
|
10
10
|
export { plyrLayoutIcons } from './vidstack-plyr-icons.js';
|
|
11
11
|
import '@floating-ui/dom';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
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-
|
|
7
|
-
export { isRemotionProvider } from '../chunks/vidstack-
|
|
6
|
+
import { IS_SERVER, useMediaState, isRemotionSrc, Primitive, useSliderState } from '../chunks/vidstack-D_ijTIbV.js';
|
|
7
|
+
export { isRemotionProvider } from '../chunks/vidstack-D_ijTIbV.js';
|
|
8
8
|
import { RemotionThumbnail as RemotionThumbnail$1, RemotionSliderThumbnail as RemotionSliderThumbnail$1, RemotionPoster as RemotionPoster$1 } from '../chunks/vidstack-vqp2QaHR.js';
|
|
9
9
|
import '@floating-ui/dom';
|
|
10
10
|
|
|
@@ -328,7 +328,7 @@ class RemotionProviderLoader {
|
|
|
328
328
|
return "video";
|
|
329
329
|
}
|
|
330
330
|
async load(ctx) {
|
|
331
|
-
return new (await import('../chunks/vidstack-
|
|
331
|
+
return new (await import('../chunks/vidstack-B_9VGrZQ.js')).RemotionProvider(this.target, ctx);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
|
package/prod/vidstack.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { TextTrackSymbol, RadioGroupController, useMediaContext, menuContext, Primitive, MediaPlayerInstance, MediaProviderInstance, isRemotionProvider, mediaState, TextTrack, ToggleButtonInstance, PosterInstance, useMediaState, ThumbnailsLoader, updateSliderPreviewPlacement } from './chunks/vidstack-
|
|
4
|
-
export { ARIAKeyShortcuts, AUDIO_EXTENSIONS, AUDIO_TYPES, AirPlayButtonInstance, AudioGainSliderInstance, AudioProviderLoader, AudioTrackList, CaptionButtonInstance, CaptionsInstance, ControlsGroupInstance, ControlsInstance, DASHProviderLoader, DASH_VIDEO_EXTENSIONS, DASH_VIDEO_TYPES, FullscreenButtonInstance, FullscreenController, GestureInstance, GoogleCastButtonInstance, HLSProviderLoader, HLS_VIDEO_EXTENSIONS, HLS_VIDEO_TYPES, List, LiveButtonInstance, LocalMediaStorage, MEDIA_KEY_SHORTCUTS, MediaAnnouncerInstance, MediaControls, MediaRemoteControl, MenuButtonInstance, MenuInstance, MenuItemInstance, MenuItemsInstance, MenuPortalInstance, MuteButtonInstance, PIPButtonInstance, PlayButtonInstance, QualitySliderInstance, RadioGroupInstance, RadioInstance, ScreenOrientationController, SeekButtonInstance, SliderChaptersInstance, SliderInstance, SliderPreviewInstance, SliderThumbnailInstance, SliderValueInstance, SliderVideoInstance, SpeedSliderInstance, TextRenderers, TextTrackList, ThumbnailInstance, TimeInstance, TimeRange, TimeSliderInstance, TooltipContentInstance, TooltipInstance, TooltipTriggerInstance, VIDEO_EXTENSIONS, VIDEO_TYPES, VideoProviderLoader, VideoQualityList, VimeoProviderLoader, VolumeSliderInstance, YouTubeProviderLoader, boundTime, canChangeVolume, canFullscreen, canGoogleCastSrc, canOrientScreen, canPlayHLSNatively, canRotateScreen, canUsePictureInPicture, canUseVideoPresentation, findActiveCue, formatSpokenTime, formatTime, getDownloadFile, getTimeRangesEnd, getTimeRangesStart, isAudioProvider, isAudioSrc, isCueActive, isDASHProvider, isDASHSrc, isGoogleCastProvider, isHLSProvider, isHLSSrc, isHTMLAudioElement, isHTMLIFrameElement, isHTMLMediaElement, isHTMLVideoElement, isMediaStream, isTrackCaptionKind, isVideoProvider, isVideoQualitySrc, isVideoSrc, isVimeoProvider, isYouTubeProvider, mediaContext, normalizeTimeIntervals, parseJSONCaptionsFile, sliderState, softResetMediaState, sortVideoQualities, updateTimeIntervals, useMediaStore, useSliderState, useSliderStore, watchActiveTextTrack, watchCueTextChange } from './chunks/vidstack-
|
|
3
|
+
import { TextTrackSymbol, RadioGroupController, useMediaContext, menuContext, Primitive, MediaPlayerInstance, MediaProviderInstance, isRemotionProvider, mediaState, TextTrack, ToggleButtonInstance, PosterInstance, useMediaState, ThumbnailsLoader, updateSliderPreviewPlacement } from './chunks/vidstack-D_ijTIbV.js';
|
|
4
|
+
export { ARIAKeyShortcuts, AUDIO_EXTENSIONS, AUDIO_TYPES, AirPlayButtonInstance, AudioGainSliderInstance, AudioProviderLoader, AudioTrackList, CaptionButtonInstance, CaptionsInstance, ControlsGroupInstance, ControlsInstance, DASHProviderLoader, DASH_VIDEO_EXTENSIONS, DASH_VIDEO_TYPES, FullscreenButtonInstance, FullscreenController, GestureInstance, GoogleCastButtonInstance, HLSProviderLoader, HLS_VIDEO_EXTENSIONS, HLS_VIDEO_TYPES, List, LiveButtonInstance, LocalMediaStorage, MEDIA_KEY_SHORTCUTS, MediaAnnouncerInstance, MediaControls, MediaRemoteControl, MenuButtonInstance, MenuInstance, MenuItemInstance, MenuItemsInstance, MenuPortalInstance, MuteButtonInstance, PIPButtonInstance, PlayButtonInstance, QualitySliderInstance, RadioGroupInstance, RadioInstance, ScreenOrientationController, SeekButtonInstance, SliderChaptersInstance, SliderInstance, SliderPreviewInstance, SliderThumbnailInstance, SliderValueInstance, SliderVideoInstance, SpeedSliderInstance, TextRenderers, TextTrackList, ThumbnailInstance, TimeInstance, TimeRange, TimeSliderInstance, TooltipContentInstance, TooltipInstance, TooltipTriggerInstance, VIDEO_EXTENSIONS, VIDEO_TYPES, VideoProviderLoader, VideoQualityList, VimeoProviderLoader, VolumeSliderInstance, YouTubeProviderLoader, boundTime, canChangeVolume, canFullscreen, canGoogleCastSrc, canOrientScreen, canPlayHLSNatively, canRotateScreen, canUsePictureInPicture, canUseVideoPresentation, findActiveCue, formatSpokenTime, formatTime, getDownloadFile, getTimeRangesEnd, getTimeRangesStart, isAudioProvider, isAudioSrc, isCueActive, isDASHProvider, isDASHSrc, isGoogleCastProvider, isHLSProvider, isHLSSrc, isHTMLAudioElement, isHTMLIFrameElement, isHTMLMediaElement, isHTMLVideoElement, isMediaStream, isTrackCaptionKind, isVideoProvider, isVideoQualitySrc, isVideoSrc, isVimeoProvider, isYouTubeProvider, mediaContext, normalizeTimeIntervals, parseJSONCaptionsFile, sliderState, softResetMediaState, sortVideoQualities, updateTimeIntervals, useMediaStore, useSliderState, useSliderStore, watchActiveTextTrack, watchCueTextChange } from './chunks/vidstack-D_ijTIbV.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { DOMEvent, isString, EventsController, prop, method, Component, hasProvidedContext, useContext, effect, createReactComponent, useStateContext, useSignal, composeRefs, useSignalRecord, useReactScope, signal } from './chunks/vidstack-CZgUA94N.js';
|
|
7
7
|
export { appendTriggerEvent, findTriggerEvent, hasTriggerEvent, isKeyboardClick, isKeyboardEvent, isPointerEvent, walkTriggerEventChain } from './chunks/vidstack-CZgUA94N.js';
|
|
8
|
-
import { createSignal, useScoped } from './chunks/vidstack-
|
|
9
|
-
export { audioGainSlider as AudioGainSlider, Captions, ChapterTitle, controls as Controls, GoogleCastButton, MediaAnnouncer, qualitySlider as QualitySlider, speedSlider as SpeedSlider, spinner as Spinner, Title, tooltip as Tooltip, useActiveTextCues, useActiveTextTrack, useChapterOptions, useChapterTitle, useTextCues } from './chunks/vidstack-
|
|
10
|
-
import { useMediaContext as useMediaContext$1 } from './chunks/vidstack-
|
|
11
|
-
export { AirPlayButton, CaptionButton, FullscreenButton, Gesture, LiveButton, menu as Menu, MuteButton, PIPButton, PlayButton, radioGroup as RadioGroup, SeekButton, slider as Slider, thumbnail as Thumbnail, Time, timeSlider as TimeSlider, volumeSlider as VolumeSlider, useAudioOptions, useCaptionOptions, useMediaPlayer } from './chunks/vidstack-
|
|
8
|
+
import { createSignal, useScoped } from './chunks/vidstack-DgGDsAKh.js';
|
|
9
|
+
export { audioGainSlider as AudioGainSlider, Captions, ChapterTitle, controls as Controls, GoogleCastButton, MediaAnnouncer, qualitySlider as QualitySlider, speedSlider as SpeedSlider, spinner as Spinner, Title, tooltip as Tooltip, useActiveTextCues, useActiveTextTrack, useChapterOptions, useChapterTitle, useTextCues } from './chunks/vidstack-DgGDsAKh.js';
|
|
10
|
+
import { useMediaContext as useMediaContext$1 } from './chunks/vidstack-D3cSYtez.js';
|
|
11
|
+
export { AirPlayButton, CaptionButton, FullscreenButton, Gesture, LiveButton, menu as Menu, MuteButton, PIPButton, PlayButton, radioGroup as RadioGroup, SeekButton, slider as Slider, thumbnail as Thumbnail, Time, timeSlider as TimeSlider, volumeSlider as VolumeSlider, useAudioOptions, useCaptionOptions, useMediaPlayer } from './chunks/vidstack-D3cSYtez.js';
|
|
12
12
|
import { Icon } from './chunks/vidstack-CBF7iUqu.js';
|
|
13
|
-
export { DEFAULT_PLAYBACK_RATES, useMediaRemote, usePlaybackRateOptions, useVideoQualityOptions } from './chunks/vidstack-
|
|
13
|
+
export { DEFAULT_PLAYBACK_RATES, useMediaRemote, usePlaybackRateOptions, useVideoQualityOptions } from './chunks/vidstack-DrEorv9m.js';
|
|
14
14
|
import '@floating-ui/dom';
|
|
15
15
|
import 'react-dom';
|
|
16
16
|
|