@instructure/studio-player 1.2.3 → 1.3.0
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/README.md +18 -0
- package/dist/StudioPlayer/layouts/controls/ControlsLayout.d.ts +2 -2
- package/dist/StudioPlayer/store/StudioPlayerMediaStorage.d.ts +6 -2
- package/dist/StudioPlayer/useStudioPlayer.d.ts +1 -1
- package/dist/StudioPlayer/utils/youtube/caption.d.ts +3 -0
- package/dist/StudioPlayer/utils/youtube/postMessage.d.ts +3 -0
- package/dist/{index-CFsTCjSJ.css → index-iive6GG7.css} +1 -1
- package/dist/studio-player.es.js +7913 -7864
- package/dist/types.d.ts +3 -1
- package/dist/{vidstack-VlpmInuO.js → vidstack-B8iikcPv.js} +12 -14
- package/dist/{vidstack-audio-DrAqFIY8.js → vidstack-audio-Bq1pJf-F.js} +2 -2
- package/dist/{vidstack-dash-kRwnnSOY.js → vidstack-dash-Bi8vMZlt.js} +2 -2
- package/dist/{vidstack-google-cast-DkNpqlWe.js → vidstack-google-cast-D3ys_R-E.js} +1 -1
- package/dist/{vidstack-hls-C8R0nR7X.js → vidstack-hls-BytcbBHn.js} +2 -2
- package/dist/{vidstack-html-8X1ahFwj.js → vidstack-html-BpBnqulz.js} +1 -1
- package/dist/{vidstack-video-DLP1iFR6.js → vidstack-video-CqIaj_35.js} +2 -2
- package/dist/{vidstack-vimeo-BQZL281S.js → vidstack-vimeo-B9SDrle5.js} +56 -56
- package/dist/{vidstack-youtube-y0agPfx8.js → vidstack-youtube-Dgmpq-MT.js} +104 -104
- package/package.json +3 -1
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var B = (a) => {
|
|
3
3
|
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var w = (a, o, e) =>
|
|
7
|
-
var s = (a, o, e) => (E(a, o, "read from private field"), e ? e.call(a) : o.get(a)), p = (a, o, e) => o.has(a) ?
|
|
8
|
-
import { E as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
5
|
+
var W = (a, o, e) => o in a ? Q(a, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[o] = e;
|
|
6
|
+
var w = (a, o, e) => W(a, typeof o != "symbol" ? o + "" : o, e), E = (a, o, e) => o.has(a) || B("Cannot " + e);
|
|
7
|
+
var s = (a, o, e) => (E(a, o, "read from private field"), e ? e.call(a) : o.get(a)), p = (a, o, e) => o.has(a) ? B("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(a) : o.set(a, e), l = (a, o, e, t) => (E(a, o, "write to private field"), t ? t.call(a, e) : o.set(a, e), e), r = (a, o, e) => (E(a, o, "access private method"), e);
|
|
8
|
+
import { E as X, d as Z, x as ee, p as te, y as se, a as ie, J as ae, z as ne, Y as k, K as oe, M as _, T as j, O as re } from "./vidstack-B8iikcPv.js";
|
|
9
|
+
const ue = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, Y = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map();
|
|
10
|
+
function F(a) {
|
|
11
11
|
var o;
|
|
12
|
-
return (o = a.match(
|
|
12
|
+
return (o = a.match(ue)) == null ? void 0 : o[1];
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
14
|
+
async function de(a, o) {
|
|
15
|
+
if (Y.has(a)) return Y.get(a);
|
|
16
|
+
if (V.has(a)) return V.get(a);
|
|
17
17
|
const e = new Promise(async (t) => {
|
|
18
18
|
const u = ["maxresdefault", "sddefault", "hqdefault"];
|
|
19
|
-
for (const
|
|
20
|
-
for (const
|
|
21
|
-
const c =
|
|
19
|
+
for (const d of u)
|
|
20
|
+
for (const h of [!0, !1]) {
|
|
21
|
+
const c = he(a, d, h);
|
|
22
22
|
if ((await fetch(c, {
|
|
23
23
|
mode: "no-cors",
|
|
24
24
|
signal: o.signal
|
|
25
25
|
})).status < 400) {
|
|
26
|
-
|
|
26
|
+
Y.set(a, c), t(c);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
}).catch(() => "").finally(() =>
|
|
31
|
-
return
|
|
30
|
+
}).catch(() => "").finally(() => V.delete(a));
|
|
31
|
+
return V.set(a, e), e;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function he(a, o, e) {
|
|
34
34
|
return `https://i.ytimg.com/${e ? "vi_webp" : "vi"}/${a}/${o}.${e ? "webp" : "jpg"}`;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
37
37
|
__proto__: null,
|
|
38
|
-
findYouTubePoster:
|
|
39
|
-
resolveYouTubeVideoId:
|
|
38
|
+
findYouTubePoster: de,
|
|
39
|
+
resolveYouTubeVideoId: F
|
|
40
40
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
41
|
-
var n,
|
|
42
|
-
class
|
|
41
|
+
var n, b, P, S, O, T, g, y, R, i, le, pe, U, L, m, I, J, N, D, C, q, K, x, M, A;
|
|
42
|
+
class ce extends X {
|
|
43
43
|
constructor(e, t) {
|
|
44
44
|
super(e);
|
|
45
45
|
p(this, i);
|
|
46
46
|
w(this, "$$PROVIDER_TYPE", "YOUTUBE");
|
|
47
|
-
w(this, "scope",
|
|
47
|
+
w(this, "scope", Z());
|
|
48
48
|
p(this, n);
|
|
49
|
-
p(this,
|
|
49
|
+
p(this, b, ee(""));
|
|
50
50
|
p(this, P, -1);
|
|
51
51
|
p(this, S, null);
|
|
52
|
-
p(this,
|
|
53
|
-
p(this,
|
|
52
|
+
p(this, O, null);
|
|
53
|
+
p(this, T, -1);
|
|
54
|
+
p(this, g, !1);
|
|
54
55
|
p(this, y, /* @__PURE__ */ new Map());
|
|
55
56
|
/**
|
|
56
57
|
* Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
|
|
@@ -84,7 +85,7 @@ class de extends Q {
|
|
|
84
85
|
*
|
|
85
86
|
* @defaultValue `undefined`
|
|
86
87
|
*/
|
|
87
|
-
p(this,
|
|
88
|
+
p(this, R);
|
|
88
89
|
l(this, n, t);
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
@@ -94,7 +95,7 @@ class de extends Q {
|
|
|
94
95
|
* @defaultValue `undefined`
|
|
95
96
|
*/
|
|
96
97
|
set encryptedPayload(e) {
|
|
97
|
-
l(this,
|
|
98
|
+
l(this, R, e);
|
|
98
99
|
}
|
|
99
100
|
get currentSrc() {
|
|
100
101
|
return s(this, S);
|
|
@@ -103,16 +104,16 @@ class de extends Q {
|
|
|
103
104
|
return "youtube";
|
|
104
105
|
}
|
|
105
106
|
get videoId() {
|
|
106
|
-
return s(this,
|
|
107
|
+
return s(this, b).call(this);
|
|
107
108
|
}
|
|
108
109
|
preconnect() {
|
|
109
|
-
|
|
110
|
+
te(this.getOrigin());
|
|
110
111
|
}
|
|
111
112
|
setup() {
|
|
112
|
-
super.setup(),
|
|
113
|
+
super.setup(), se(r(this, i, U).bind(this)), s(this, n).notify("provider-setup", this);
|
|
113
114
|
}
|
|
114
115
|
destroy() {
|
|
115
|
-
r(this, i,
|
|
116
|
+
r(this, i, x).call(this);
|
|
116
117
|
const e = "provider destroyed";
|
|
117
118
|
for (const t of s(this, y).values())
|
|
118
119
|
for (const { reject: u } of t) u(e);
|
|
@@ -137,12 +138,12 @@ class de extends Q {
|
|
|
137
138
|
r(this, i, m).call(this, "setPlaybackRate", e);
|
|
138
139
|
}
|
|
139
140
|
async loadSource(e) {
|
|
140
|
-
if (!
|
|
141
|
-
l(this, S, null), s(this,
|
|
141
|
+
if (!ie(e.src)) {
|
|
142
|
+
l(this, S, null), s(this, b).set("");
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
|
-
const t =
|
|
145
|
-
s(this,
|
|
145
|
+
const t = F(e.src);
|
|
146
|
+
s(this, b).set(t ?? ""), l(this, S, e);
|
|
146
147
|
}
|
|
147
148
|
getOrigin() {
|
|
148
149
|
switch (!0) {
|
|
@@ -155,145 +156,144 @@ class de extends Q {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
buildParams() {
|
|
158
|
-
const { keyDisabled: e } = s(this, n).$props, { muted: t, playsInline: u, nativeControls:
|
|
159
|
+
const { keyDisabled: e } = s(this, n).$props, { muted: t, playsInline: u, nativeControls: d } = s(this, n).$state, h = d();
|
|
159
160
|
return {
|
|
160
161
|
rel: 0,
|
|
161
162
|
autoplay: 0,
|
|
162
|
-
cc_lang_pref: this.language,
|
|
163
|
-
cc_load_policy: d ? 1 : void 0,
|
|
164
163
|
color: this.color,
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
cc_load_policy: 1,
|
|
165
|
+
controls: h ? 1 : 0,
|
|
166
|
+
disablekb: !h || e() ? 1 : 0,
|
|
167
167
|
enablejsapi: 1,
|
|
168
168
|
fs: 1,
|
|
169
169
|
hl: this.language,
|
|
170
|
-
iv_load_policy:
|
|
170
|
+
iv_load_policy: h ? 1 : 3,
|
|
171
171
|
mute: t() ? 1 : 0,
|
|
172
172
|
playsinline: u() ? 1 : 0,
|
|
173
|
-
videoId: s(this,
|
|
174
|
-
embed_config: r(this, i,
|
|
173
|
+
videoId: s(this, b).call(this),
|
|
174
|
+
embed_config: r(this, i, L).call(this)
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
onLoad() {
|
|
178
178
|
window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
|
|
179
179
|
}
|
|
180
180
|
onMessage({ info: e }, t) {
|
|
181
|
-
var c
|
|
181
|
+
var c, $;
|
|
182
182
|
if (!e) return;
|
|
183
|
-
const { title: u, intrinsicDuration:
|
|
184
|
-
if (
|
|
183
|
+
const { title: u, intrinsicDuration: d, playbackRate: h } = s(this, n).$state;
|
|
184
|
+
if (oe(e.videoData) && e.videoData.title !== u() && s(this, n).notify("title-change", e.videoData.title, t), (c = e.namespaces) != null && c.includes("captions") && e.captions && s(this, O) === null && (l(this, O, e.captions.tracklist), s(this, n).notify("loaded-metadata")), _(e.duration) && e.duration !== d()) {
|
|
185
185
|
if (_(e.videoLoadedFraction)) {
|
|
186
|
-
const f = ((
|
|
187
|
-
r(this, i,
|
|
186
|
+
const f = (($ = e.progressState) == null ? void 0 : $.loaded) ?? e.videoLoadedFraction * e.duration, v = new j(0, e.duration);
|
|
187
|
+
r(this, i, D).call(this, f, v, t);
|
|
188
188
|
}
|
|
189
189
|
s(this, n).notify("duration-change", e.duration, t);
|
|
190
190
|
}
|
|
191
|
-
if (_(e.playbackRate) && e.playbackRate !==
|
|
192
|
-
const { current: f, seekableStart:
|
|
193
|
-
r(this, i,
|
|
191
|
+
if (_(e.playbackRate) && e.playbackRate !== h() && s(this, n).notify("rate-change", e.playbackRate, t), e.progressState) {
|
|
192
|
+
const { current: f, seekableStart: v, seekableEnd: G, loaded: H, duration: z } = e.progressState;
|
|
193
|
+
r(this, i, N).call(this, f, t), r(this, i, D).call(this, H, new j(v, G), t), z !== d() && s(this, n).notify("duration-change", z, t);
|
|
194
194
|
}
|
|
195
|
-
if (_(e.volume) &&
|
|
195
|
+
if (_(e.volume) && re(e.muted) && !s(this, g)) {
|
|
196
196
|
const f = {
|
|
197
197
|
muted: e.muted,
|
|
198
198
|
volume: e.volume / 100
|
|
199
199
|
};
|
|
200
200
|
s(this, n).notify("volume-change", f, t);
|
|
201
201
|
}
|
|
202
|
-
_(e.playerState) && e.playerState !== s(this, P) && r(this, i,
|
|
202
|
+
_(e.playerState) && e.playerState !== s(this, P) && r(this, i, K).call(this, e.playerState, t);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
n = new WeakMap(),
|
|
205
|
+
n = new WeakMap(), b = new WeakMap(), P = new WeakMap(), S = new WeakMap(), O = new WeakMap(), T = new WeakMap(), g = new WeakMap(), y = new WeakMap(), R = new WeakMap(), i = new WeakSet(), le = function(e) {
|
|
206
206
|
var t;
|
|
207
|
-
(t = r(this, i,
|
|
208
|
-
},
|
|
207
|
+
(t = r(this, i, M).call(this, "playVideo")) == null || t.reject(e);
|
|
208
|
+
}, pe = function(e) {
|
|
209
209
|
var t;
|
|
210
|
-
(t = r(this, i,
|
|
211
|
-
},
|
|
212
|
-
r(this, i,
|
|
213
|
-
const e = s(this,
|
|
210
|
+
(t = r(this, i, M).call(this, "pauseVideo")) == null || t.reject(e);
|
|
211
|
+
}, U = function() {
|
|
212
|
+
r(this, i, x).call(this);
|
|
213
|
+
const e = s(this, b).call(this);
|
|
214
214
|
if (!e) {
|
|
215
215
|
this.src.set("");
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, n).notify("load-start");
|
|
219
|
-
},
|
|
220
|
-
const e = s(this,
|
|
221
|
-
if (!
|
|
222
|
-
return JSON.stringify({ enc: e });
|
|
219
|
+
}, L = function() {
|
|
220
|
+
const e = s(this, R);
|
|
221
|
+
if (!ae(e))
|
|
222
|
+
return JSON.stringify({ enc: e, hideTitle: !0 });
|
|
223
223
|
}, m = function(e, t) {
|
|
224
|
-
let u =
|
|
225
|
-
return
|
|
224
|
+
let u = ne(), d = s(this, y).get(e);
|
|
225
|
+
return d || s(this, y).set(e, d = []), d.push(u), this.postMessage({
|
|
226
226
|
event: "command",
|
|
227
227
|
func: e,
|
|
228
228
|
args: t ? [t] : void 0
|
|
229
229
|
}), u.promise;
|
|
230
|
-
}, L = function(e) {
|
|
231
|
-
s(this, n).notify("loaded-metadata"), s(this, n).notify("loaded-data"), s(this, n).delegate.ready(void 0, e);
|
|
232
230
|
}, I = function(e) {
|
|
231
|
+
s(this, n).notify("loaded-data"), s(this, n).delegate.ready(void 0, e);
|
|
232
|
+
}, J = function(e) {
|
|
233
233
|
var t;
|
|
234
|
-
(t = r(this, i,
|
|
235
|
-
},
|
|
236
|
-
const { duration: u, realCurrentTime:
|
|
237
|
-
s(this, n).notify("time-change", c, t), !
|
|
238
|
-
},
|
|
239
|
-
const
|
|
234
|
+
(t = r(this, i, M).call(this, "pauseVideo")) == null || t.resolve(), s(this, n).notify("pause", void 0, e);
|
|
235
|
+
}, N = function(e, t) {
|
|
236
|
+
const { duration: u, realCurrentTime: d } = s(this, n).$state, h = s(this, P) === k.Ended, c = h ? u() : e;
|
|
237
|
+
s(this, n).notify("time-change", c, t), !h && Math.abs(c - d()) > 1 && s(this, n).notify("seeking", c, t);
|
|
238
|
+
}, D = function(e, t, u) {
|
|
239
|
+
const d = {
|
|
240
240
|
buffered: new j(0, e),
|
|
241
241
|
seekable: t
|
|
242
242
|
};
|
|
243
|
-
s(this, n).notify("progress",
|
|
244
|
-
const { seeking:
|
|
245
|
-
|
|
246
|
-
},
|
|
243
|
+
s(this, n).notify("progress", d, u);
|
|
244
|
+
const { seeking: h, realCurrentTime: c } = s(this, n).$state;
|
|
245
|
+
h() && e > c() && r(this, i, C).call(this, u);
|
|
246
|
+
}, C = function(e) {
|
|
247
247
|
const { paused: t, realCurrentTime: u } = s(this, n).$state;
|
|
248
|
-
window.clearTimeout(s(this,
|
|
248
|
+
window.clearTimeout(s(this, T)), l(this, T, window.setTimeout(
|
|
249
249
|
() => {
|
|
250
|
-
s(this, n).notify("seeked", u(), e), l(this,
|
|
250
|
+
s(this, n).notify("seeked", u(), e), l(this, T, -1);
|
|
251
251
|
},
|
|
252
252
|
t() ? 100 : 0
|
|
253
253
|
));
|
|
254
|
-
},
|
|
254
|
+
}, q = function(e) {
|
|
255
255
|
const { seeking: t } = s(this, n).$state;
|
|
256
|
-
t() && r(this, i,
|
|
257
|
-
},
|
|
258
|
-
var
|
|
259
|
-
const { paused: u, seeking:
|
|
260
|
-
if (c && s(this, n).notify("waiting", void 0, t),
|
|
261
|
-
this.pause(), l(this,
|
|
256
|
+
t() && r(this, i, C).call(this, e), s(this, n).notify("pause", void 0, e), s(this, n).notify("end", void 0, e);
|
|
257
|
+
}, K = function(e, t) {
|
|
258
|
+
var v;
|
|
259
|
+
const { paused: u, seeking: d } = s(this, n).$state, h = e === k.Playing, c = e === k.Buffering, $ = r(this, i, A).call(this, "playVideo"), f = u() && (c || h);
|
|
260
|
+
if (c && s(this, n).notify("waiting", void 0, t), d() && h && r(this, i, C).call(this, t), s(this, g) && h) {
|
|
261
|
+
this.pause(), l(this, g, !1), this.setMuted(s(this, n).$state.muted());
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
if (
|
|
265
|
-
l(this,
|
|
264
|
+
if (!$ && f) {
|
|
265
|
+
l(this, g, !0), this.setMuted(!0);
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
switch (
|
|
268
|
+
switch (f && ((v = r(this, i, M).call(this, "playVideo")) == null || v.resolve(), s(this, n).notify("play", void 0, t)), e) {
|
|
269
269
|
case k.Cued:
|
|
270
|
-
r(this, i,
|
|
270
|
+
r(this, i, I).call(this, t);
|
|
271
271
|
break;
|
|
272
272
|
case k.Playing:
|
|
273
273
|
s(this, n).notify("playing", void 0, t);
|
|
274
274
|
break;
|
|
275
275
|
case k.Paused:
|
|
276
|
-
r(this, i,
|
|
276
|
+
r(this, i, J).call(this, t);
|
|
277
277
|
break;
|
|
278
278
|
case k.Ended:
|
|
279
|
-
r(this, i,
|
|
279
|
+
r(this, i, q).call(this, t);
|
|
280
280
|
break;
|
|
281
281
|
}
|
|
282
282
|
l(this, P, e);
|
|
283
|
-
},
|
|
284
|
-
l(this, P, -1), l(this,
|
|
285
|
-
},
|
|
283
|
+
}, x = function() {
|
|
284
|
+
l(this, P, -1), l(this, T, -1), l(this, g, !1);
|
|
285
|
+
}, M = function(e) {
|
|
286
286
|
var t;
|
|
287
287
|
return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
|
|
288
|
-
},
|
|
288
|
+
}, A = function(e) {
|
|
289
289
|
var t;
|
|
290
290
|
return !!((t = s(this, y).get(e)) != null && t.length);
|
|
291
291
|
};
|
|
292
|
-
const
|
|
292
|
+
const be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
293
293
|
__proto__: null,
|
|
294
|
-
YouTubeProvider:
|
|
294
|
+
YouTubeProvider: ce
|
|
295
295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
296
296
|
export {
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
be as p,
|
|
298
|
+
me as u
|
|
299
299
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/studio-player",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Next generation media player for Instructure",
|
|
6
6
|
"module": "./dist/studio-player.es.js",
|
|
@@ -66,10 +66,12 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@floating-ui/react": "^0.27.3",
|
|
69
|
+
"@nanostores/react": "^1.0.0",
|
|
69
70
|
"clsx": "^2.1.1",
|
|
70
71
|
"dashjs": "4.7.4",
|
|
71
72
|
"i18next": "^24.2.1",
|
|
72
73
|
"i18next-resources-to-backend": "^1.2.1",
|
|
74
|
+
"nanostores": "^1.0.1",
|
|
73
75
|
"react": "^18.3.1",
|
|
74
76
|
"react-dom": "^18.3.1",
|
|
75
77
|
"react-i18next": "^15.4.0"
|