@instructure/studio-player 1.2.1 → 1.2.2

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.
@@ -0,0 +1,298 @@
1
+ var G = Object.defineProperty;
2
+ var z = (a) => {
3
+ throw TypeError(a);
4
+ };
5
+ var H = (a, o, e) => o in a ? G(a, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[o] = e;
6
+ var b = (a, o, e) => H(a, typeof o != "symbol" ? o + "" : o, e), E = (a, o, e) => o.has(a) || z("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) ? z("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 Q, d as W, x as X, p as Z, y as ee, a as te, J as se, z as ie, Y as w, K as ae, M as _, T as j, O as ne } from "./vidstack-DPuv2JRL.js";
9
+ const oe = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, C = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
10
+ function B(a) {
11
+ var o;
12
+ return (o = a.match(oe)) == null ? void 0 : o[1];
13
+ }
14
+ async function re(a, o) {
15
+ if (C.has(a)) return C.get(a);
16
+ if (R.has(a)) return R.get(a);
17
+ const e = new Promise(async (t) => {
18
+ const u = ["maxresdefault", "sddefault", "hqdefault"];
19
+ for (const h of u)
20
+ for (const d of [!0, !1]) {
21
+ const c = ue(a, h, d);
22
+ if ((await fetch(c, {
23
+ mode: "no-cors",
24
+ signal: o.signal
25
+ })).status < 400) {
26
+ C.set(a, c), t(c);
27
+ return;
28
+ }
29
+ }
30
+ }).catch(() => "").finally(() => R.delete(a));
31
+ return R.set(a, e), e;
32
+ }
33
+ function ue(a, o, e) {
34
+ return `https://i.ytimg.com/${e ? "vi_webp" : "vi"}/${a}/${o}.${e ? "webp" : "jpg"}`;
35
+ }
36
+ const ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
+ __proto__: null,
38
+ findYouTubePoster: re,
39
+ resolveYouTubeVideoId: B
40
+ }, Symbol.toStringTag, { value: "Module" }));
41
+ var n, k, P, S, T, g, y, M, i, he, ce, F, U, m, K, L, I, Y, V, J, N, D, $, q;
42
+ class de extends Q {
43
+ constructor(e, t) {
44
+ super(e);
45
+ p(this, i);
46
+ b(this, "$$PROVIDER_TYPE", "YOUTUBE");
47
+ b(this, "scope", W());
48
+ p(this, n);
49
+ p(this, k, X(""));
50
+ p(this, P, -1);
51
+ p(this, S, null);
52
+ p(this, T, -1);
53
+ p(this, g, !1);
54
+ p(this, y, /* @__PURE__ */ new Map());
55
+ /**
56
+ * Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
57
+ * language code or a fully specified locale. For example, fr and fr-ca are both valid values.
58
+ * Other language input codes, such as IETF language tags (BCP 47) might also be handled properly.
59
+ *
60
+ * The interface language is used for tooltips in the player and also affects the default caption
61
+ * track. Note that YouTube might select a different caption track language for a particular
62
+ * user based on the user's individual language preferences and the availability of caption tracks.
63
+ *
64
+ * @defaultValue 'en'
65
+ */
66
+ b(this, "language", "en");
67
+ b(this, "color", "red");
68
+ /**
69
+ * Whether cookies should be enabled on the embed. This is turned off by default to be
70
+ * GDPR-compliant.
71
+ *
72
+ * @defaultValue `false`
73
+ */
74
+ b(this, "cookies", !1);
75
+ /**
76
+ * Whether the embed should use YouTube Education. This is turned off by default.
77
+ *
78
+ * @defaultValue `false`
79
+ */
80
+ b(this, "education", !1);
81
+ /**
82
+ * An API key to use for the embed. This is mandatory for YouTube Education
83
+ * to work as expected.
84
+ *
85
+ * @defaultValue `undefined`
86
+ */
87
+ p(this, M);
88
+ l(this, n, t);
89
+ }
90
+ /**
91
+ * Set an API key to use for the embed. This is mandatory for YouTube Education
92
+ * to work as expected.
93
+ *
94
+ * @defaultValue `undefined`
95
+ */
96
+ set apiKey(e) {
97
+ l(this, M, e);
98
+ }
99
+ get currentSrc() {
100
+ return s(this, S);
101
+ }
102
+ get type() {
103
+ return "youtube";
104
+ }
105
+ get videoId() {
106
+ return s(this, k).call(this);
107
+ }
108
+ preconnect() {
109
+ Z(this.getOrigin());
110
+ }
111
+ setup() {
112
+ super.setup(), ee(r(this, i, F).bind(this)), s(this, n).notify("provider-setup", this);
113
+ }
114
+ destroy() {
115
+ r(this, i, D).call(this);
116
+ const e = "provider destroyed";
117
+ for (const t of s(this, y).values())
118
+ for (const { reject: u } of t) u(e);
119
+ s(this, y).clear();
120
+ }
121
+ async play() {
122
+ return r(this, i, m).call(this, "playVideo");
123
+ }
124
+ async pause() {
125
+ return r(this, i, m).call(this, "pauseVideo");
126
+ }
127
+ setMuted(e) {
128
+ e ? r(this, i, m).call(this, "mute") : r(this, i, m).call(this, "unMute");
129
+ }
130
+ setCurrentTime(e) {
131
+ r(this, i, m).call(this, "seekTo", e), s(this, n).notify("seeking", e);
132
+ }
133
+ setVolume(e) {
134
+ r(this, i, m).call(this, "setVolume", e * 100);
135
+ }
136
+ setPlaybackRate(e) {
137
+ r(this, i, m).call(this, "setPlaybackRate", e);
138
+ }
139
+ async loadSource(e) {
140
+ if (!te(e.src)) {
141
+ l(this, S, null), s(this, k).set("");
142
+ return;
143
+ }
144
+ const t = B(e.src);
145
+ s(this, k).set(t ?? ""), l(this, S, e);
146
+ }
147
+ getOrigin() {
148
+ switch (!0) {
149
+ case this.education:
150
+ return "https://www.youtubeeducation.com";
151
+ case this.cookies:
152
+ return "https://www.youtube.com";
153
+ default:
154
+ return "https://www.youtube-nocookie.com";
155
+ }
156
+ }
157
+ buildParams() {
158
+ const { keyDisabled: e } = s(this, n).$props, { muted: t, playsInline: u, nativeControls: h } = s(this, n).$state, d = h();
159
+ return {
160
+ rel: 0,
161
+ autoplay: 0,
162
+ cc_lang_pref: this.language,
163
+ cc_load_policy: d ? 1 : void 0,
164
+ color: this.color,
165
+ controls: d ? 1 : 0,
166
+ disablekb: !d || e() ? 1 : 0,
167
+ enablejsapi: 1,
168
+ fs: 1,
169
+ hl: this.language,
170
+ iv_load_policy: d ? 1 : 3,
171
+ mute: t() ? 1 : 0,
172
+ playsinline: u() ? 1 : 0,
173
+ embed_config: r(this, i, U).call(this)
174
+ };
175
+ }
176
+ onLoad() {
177
+ window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
178
+ }
179
+ onMessage({ info: e }, t) {
180
+ var c;
181
+ if (!e) return;
182
+ const { title: u, intrinsicDuration: h, playbackRate: d } = s(this, n).$state;
183
+ if (ae(e.videoData) && e.videoData.title !== u() && s(this, n).notify("title-change", e.videoData.title, t), _(e.duration) && e.duration !== h()) {
184
+ if (_(e.videoLoadedFraction)) {
185
+ const f = ((c = e.progressState) == null ? void 0 : c.loaded) ?? e.videoLoadedFraction * e.duration, v = new j(0, e.duration);
186
+ r(this, i, Y).call(this, f, v, t);
187
+ }
188
+ s(this, n).notify("duration-change", e.duration, t);
189
+ }
190
+ if (_(e.playbackRate) && e.playbackRate !== d() && s(this, n).notify("rate-change", e.playbackRate, t), e.progressState) {
191
+ const { current: f, seekableStart: v, seekableEnd: O, loaded: A, duration: x } = e.progressState;
192
+ r(this, i, I).call(this, f, t), r(this, i, Y).call(this, A, new j(v, O), t), x !== h() && s(this, n).notify("duration-change", x, t);
193
+ }
194
+ if (_(e.volume) && ne(e.muted) && !s(this, g)) {
195
+ const f = {
196
+ muted: e.muted,
197
+ volume: e.volume / 100
198
+ };
199
+ s(this, n).notify("volume-change", f, t);
200
+ }
201
+ _(e.playerState) && e.playerState !== s(this, P) && r(this, i, N).call(this, e.playerState, t);
202
+ }
203
+ }
204
+ n = new WeakMap(), k = new WeakMap(), P = new WeakMap(), S = new WeakMap(), T = new WeakMap(), g = new WeakMap(), y = new WeakMap(), M = new WeakMap(), i = new WeakSet(), he = function(e) {
205
+ var t;
206
+ (t = r(this, i, $).call(this, "playVideo")) == null || t.reject(e);
207
+ }, ce = function(e) {
208
+ var t;
209
+ (t = r(this, i, $).call(this, "pauseVideo")) == null || t.reject(e);
210
+ }, F = function() {
211
+ r(this, i, D).call(this);
212
+ const e = s(this, k).call(this);
213
+ if (!e) {
214
+ this.src.set("");
215
+ return;
216
+ }
217
+ this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, n).notify("load-start");
218
+ }, U = function() {
219
+ const e = s(this, M);
220
+ if (!se(e))
221
+ return JSON.stringify({ apiKey: e });
222
+ }, m = function(e, t) {
223
+ let u = ie(), h = s(this, y).get(e);
224
+ return h || s(this, y).set(e, h = []), h.push(u), this.postMessage({
225
+ event: "command",
226
+ func: e,
227
+ args: t ? [t] : void 0
228
+ }), u.promise;
229
+ }, K = function(e) {
230
+ s(this, n).notify("loaded-metadata"), s(this, n).notify("loaded-data"), s(this, n).delegate.ready(void 0, e);
231
+ }, L = function(e) {
232
+ var t;
233
+ (t = r(this, i, $).call(this, "pauseVideo")) == null || t.resolve(), s(this, n).notify("pause", void 0, e);
234
+ }, I = function(e, t) {
235
+ const { duration: u, realCurrentTime: h } = s(this, n).$state, d = s(this, P) === w.Ended, c = d ? u() : e;
236
+ s(this, n).notify("time-change", c, t), !d && Math.abs(c - h()) > 1 && s(this, n).notify("seeking", c, t);
237
+ }, Y = function(e, t, u) {
238
+ const h = {
239
+ buffered: new j(0, e),
240
+ seekable: t
241
+ };
242
+ s(this, n).notify("progress", h, u);
243
+ const { seeking: d, realCurrentTime: c } = s(this, n).$state;
244
+ d() && e > c() && r(this, i, V).call(this, u);
245
+ }, V = function(e) {
246
+ const { paused: t, realCurrentTime: u } = s(this, n).$state;
247
+ window.clearTimeout(s(this, T)), l(this, T, window.setTimeout(
248
+ () => {
249
+ s(this, n).notify("seeked", u(), e), l(this, T, -1);
250
+ },
251
+ t() ? 100 : 0
252
+ ));
253
+ }, J = function(e) {
254
+ const { seeking: t } = s(this, n).$state;
255
+ t() && r(this, i, V).call(this, e), s(this, n).notify("pause", void 0, e), s(this, n).notify("end", void 0, e);
256
+ }, N = function(e, t) {
257
+ var O;
258
+ const { paused: u, seeking: h } = s(this, n).$state, d = e === w.Playing, c = e === w.Buffering, f = r(this, i, q).call(this, "playVideo"), v = u() && (c || d);
259
+ if (c && s(this, n).notify("waiting", void 0, t), h() && d && r(this, i, V).call(this, t), s(this, g) && d) {
260
+ this.pause(), l(this, g, !1), this.setMuted(s(this, n).$state.muted());
261
+ return;
262
+ }
263
+ if (!f && v) {
264
+ l(this, g, !0), this.setMuted(!0);
265
+ return;
266
+ }
267
+ switch (v && ((O = r(this, i, $).call(this, "playVideo")) == null || O.resolve(), s(this, n).notify("play", void 0, t)), e) {
268
+ case w.Cued:
269
+ r(this, i, K).call(this, t);
270
+ break;
271
+ case w.Playing:
272
+ s(this, n).notify("playing", void 0, t);
273
+ break;
274
+ case w.Paused:
275
+ r(this, i, L).call(this, t);
276
+ break;
277
+ case w.Ended:
278
+ r(this, i, J).call(this, t);
279
+ break;
280
+ }
281
+ l(this, P, e);
282
+ }, D = function() {
283
+ l(this, P, -1), l(this, T, -1), l(this, g, !1);
284
+ }, $ = function(e) {
285
+ var t;
286
+ return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
287
+ }, q = function(e) {
288
+ var t;
289
+ return !!((t = s(this, y).get(e)) != null && t.length);
290
+ };
291
+ const fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
292
+ __proto__: null,
293
+ YouTubeProvider: de
294
+ }, Symbol.toStringTag, { value: "Module" }));
295
+ export {
296
+ fe as p,
297
+ ye as u
298
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/studio-player",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "private": false,
5
5
  "description": "Next generation media player for Instructure",
6
6
  "module": "./dist/studio-player.es.js",
@@ -1,264 +0,0 @@
1
- var N = Object.defineProperty;
2
- var x = (a) => {
3
- throw TypeError(a);
4
- };
5
- var A = (a, n, e) => n in a ? N(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
6
- var v = (a, n, e) => A(a, typeof n != "symbol" ? n + "" : n, e), E = (a, n, e) => n.has(a) || x("Cannot " + e);
7
- var s = (a, n, e) => (E(a, n, "read from private field"), e ? e.call(a) : n.get(a)), p = (a, n, e) => n.has(a) ? x("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, e), c = (a, n, e, t) => (E(a, n, "write to private field"), t ? t.call(a, e) : n.set(a, e), e), r = (a, n, e) => (E(a, n, "access private method"), e);
8
- import { E as G, d as H, x as Q, p as W, y as X, a as Z, z as ee, Y as b, J as te, K as $, T as j, M as se } from "./vidstack-CjqtyAQk.js";
9
- const ie = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, O = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
10
- function z(a) {
11
- var n;
12
- return (n = a.match(ie)) == null ? void 0 : n[1];
13
- }
14
- async function ae(a, n) {
15
- if (O.has(a)) return O.get(a);
16
- if (R.has(a)) return R.get(a);
17
- const e = new Promise(async (t) => {
18
- const u = ["maxresdefault", "sddefault", "hqdefault"];
19
- for (const h of u)
20
- for (const d of [!0, !1]) {
21
- const l = oe(a, h, d);
22
- if ((await fetch(l, {
23
- mode: "no-cors",
24
- signal: n.signal
25
- })).status < 400) {
26
- O.set(a, l), t(l);
27
- return;
28
- }
29
- }
30
- }).catch(() => "").finally(() => R.delete(a));
31
- return R.set(a, e), e;
32
- }
33
- function oe(a, n, e) {
34
- return `https://i.ytimg.com/${e ? "vi_webp" : "vi"}/${a}/${n}.${e ? "webp" : "jpg"}`;
35
- }
36
- const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
- __proto__: null,
38
- findYouTubePoster: ae,
39
- resolveYouTubeVideoId: z
40
- }, Symbol.toStringTag, { value: "Module" }));
41
- var o, w, k, S, P, g, y, i, re, ue, B, m, F, L, U, C, V, I, q, Y, _, J;
42
- class ne extends G {
43
- constructor(e, t) {
44
- super(e);
45
- p(this, i);
46
- v(this, "$$PROVIDER_TYPE", "YOUTUBE");
47
- v(this, "scope", H());
48
- p(this, o);
49
- p(this, w, Q(""));
50
- p(this, k, -1);
51
- p(this, S, null);
52
- p(this, P, -1);
53
- p(this, g, !1);
54
- p(this, y, /* @__PURE__ */ new Map());
55
- /**
56
- * Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
57
- * language code or a fully specified locale. For example, fr and fr-ca are both valid values.
58
- * Other language input codes, such as IETF language tags (BCP 47) might also be handled properly.
59
- *
60
- * The interface language is used for tooltips in the player and also affects the default caption
61
- * track. Note that YouTube might select a different caption track language for a particular
62
- * user based on the user's individual language preferences and the availability of caption tracks.
63
- *
64
- * @defaultValue 'en'
65
- */
66
- v(this, "language", "en");
67
- v(this, "color", "red");
68
- /**
69
- * Whether cookies should be enabled on the embed. This is turned off by default to be
70
- * GDPR-compliant.
71
- *
72
- * @defaultValue `false`
73
- */
74
- v(this, "cookies", !1);
75
- c(this, o, t);
76
- }
77
- get currentSrc() {
78
- return s(this, S);
79
- }
80
- get type() {
81
- return "youtube";
82
- }
83
- get videoId() {
84
- return s(this, w).call(this);
85
- }
86
- preconnect() {
87
- W(this.getOrigin());
88
- }
89
- setup() {
90
- super.setup(), X(r(this, i, B).bind(this)), s(this, o).notify("provider-setup", this);
91
- }
92
- destroy() {
93
- r(this, i, Y).call(this);
94
- const e = "provider destroyed";
95
- for (const t of s(this, y).values())
96
- for (const { reject: u } of t) u(e);
97
- s(this, y).clear();
98
- }
99
- async play() {
100
- return r(this, i, m).call(this, "playVideo");
101
- }
102
- async pause() {
103
- return r(this, i, m).call(this, "pauseVideo");
104
- }
105
- setMuted(e) {
106
- e ? r(this, i, m).call(this, "mute") : r(this, i, m).call(this, "unMute");
107
- }
108
- setCurrentTime(e) {
109
- r(this, i, m).call(this, "seekTo", e), s(this, o).notify("seeking", e);
110
- }
111
- setVolume(e) {
112
- r(this, i, m).call(this, "setVolume", e * 100);
113
- }
114
- setPlaybackRate(e) {
115
- r(this, i, m).call(this, "setPlaybackRate", e);
116
- }
117
- async loadSource(e) {
118
- if (!Z(e.src)) {
119
- c(this, S, null), s(this, w).set("");
120
- return;
121
- }
122
- const t = z(e.src);
123
- s(this, w).set(t ?? ""), c(this, S, e);
124
- }
125
- getOrigin() {
126
- return this.cookies ? "https://www.youtube.com" : "https://www.youtube-nocookie.com";
127
- }
128
- buildParams() {
129
- const { keyDisabled: e } = s(this, o).$props, { muted: t, playsInline: u, nativeControls: h } = s(this, o).$state, d = h();
130
- return {
131
- rel: 0,
132
- autoplay: 0,
133
- cc_lang_pref: this.language,
134
- cc_load_policy: d ? 1 : void 0,
135
- color: this.color,
136
- controls: d ? 1 : 0,
137
- disablekb: !d || e() ? 1 : 0,
138
- enablejsapi: 1,
139
- fs: 1,
140
- hl: this.language,
141
- iv_load_policy: d ? 1 : 3,
142
- mute: t() ? 1 : 0,
143
- playsinline: u() ? 1 : 0
144
- };
145
- }
146
- onLoad() {
147
- window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
148
- }
149
- onMessage({ info: e }, t) {
150
- var l;
151
- if (!e) return;
152
- const { title: u, intrinsicDuration: h, playbackRate: d } = s(this, o).$state;
153
- if (te(e.videoData) && e.videoData.title !== u() && s(this, o).notify("title-change", e.videoData.title, t), $(e.duration) && e.duration !== h()) {
154
- if ($(e.videoLoadedFraction)) {
155
- const f = ((l = e.progressState) == null ? void 0 : l.loaded) ?? e.videoLoadedFraction * e.duration, T = new j(0, e.duration);
156
- r(this, i, C).call(this, f, T, t);
157
- }
158
- s(this, o).notify("duration-change", e.duration, t);
159
- }
160
- if ($(e.playbackRate) && e.playbackRate !== d() && s(this, o).notify("rate-change", e.playbackRate, t), e.progressState) {
161
- const { current: f, seekableStart: T, seekableEnd: M, loaded: K, duration: D } = e.progressState;
162
- r(this, i, U).call(this, f, t), r(this, i, C).call(this, K, new j(T, M), t), D !== h() && s(this, o).notify("duration-change", D, t);
163
- }
164
- if ($(e.volume) && se(e.muted) && !s(this, g)) {
165
- const f = {
166
- muted: e.muted,
167
- volume: e.volume / 100
168
- };
169
- s(this, o).notify("volume-change", f, t);
170
- }
171
- $(e.playerState) && e.playerState !== s(this, k) && r(this, i, q).call(this, e.playerState, t);
172
- }
173
- }
174
- o = new WeakMap(), w = new WeakMap(), k = new WeakMap(), S = new WeakMap(), P = new WeakMap(), g = new WeakMap(), y = new WeakMap(), i = new WeakSet(), re = function(e) {
175
- var t;
176
- (t = r(this, i, _).call(this, "playVideo")) == null || t.reject(e);
177
- }, ue = function(e) {
178
- var t;
179
- (t = r(this, i, _).call(this, "pauseVideo")) == null || t.reject(e);
180
- }, B = function() {
181
- r(this, i, Y).call(this);
182
- const e = s(this, w).call(this);
183
- if (!e) {
184
- this.src.set("");
185
- return;
186
- }
187
- this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, o).notify("load-start");
188
- }, m = function(e, t) {
189
- let u = ee(), h = s(this, y).get(e);
190
- return h || s(this, y).set(e, h = []), h.push(u), this.postMessage({
191
- event: "command",
192
- func: e,
193
- args: t ? [t] : void 0
194
- }), u.promise;
195
- }, F = function(e) {
196
- s(this, o).notify("loaded-metadata"), s(this, o).notify("loaded-data"), s(this, o).delegate.ready(void 0, e);
197
- }, L = function(e) {
198
- var t;
199
- (t = r(this, i, _).call(this, "pauseVideo")) == null || t.resolve(), s(this, o).notify("pause", void 0, e);
200
- }, U = function(e, t) {
201
- const { duration: u, realCurrentTime: h } = s(this, o).$state, d = s(this, k) === b.Ended, l = d ? u() : e;
202
- s(this, o).notify("time-change", l, t), !d && Math.abs(l - h()) > 1 && s(this, o).notify("seeking", l, t);
203
- }, C = function(e, t, u) {
204
- const h = {
205
- buffered: new j(0, e),
206
- seekable: t
207
- };
208
- s(this, o).notify("progress", h, u);
209
- const { seeking: d, realCurrentTime: l } = s(this, o).$state;
210
- d() && e > l() && r(this, i, V).call(this, u);
211
- }, V = function(e) {
212
- const { paused: t, realCurrentTime: u } = s(this, o).$state;
213
- window.clearTimeout(s(this, P)), c(this, P, window.setTimeout(
214
- () => {
215
- s(this, o).notify("seeked", u(), e), c(this, P, -1);
216
- },
217
- t() ? 100 : 0
218
- ));
219
- }, I = function(e) {
220
- const { seeking: t } = s(this, o).$state;
221
- t() && r(this, i, V).call(this, e), s(this, o).notify("pause", void 0, e), s(this, o).notify("end", void 0, e);
222
- }, q = function(e, t) {
223
- var M;
224
- const { paused: u, seeking: h } = s(this, o).$state, d = e === b.Playing, l = e === b.Buffering, f = r(this, i, J).call(this, "playVideo"), T = u() && (l || d);
225
- if (l && s(this, o).notify("waiting", void 0, t), h() && d && r(this, i, V).call(this, t), s(this, g) && d) {
226
- this.pause(), c(this, g, !1), this.setMuted(s(this, o).$state.muted());
227
- return;
228
- }
229
- if (!f && T) {
230
- c(this, g, !0), this.setMuted(!0);
231
- return;
232
- }
233
- switch (T && ((M = r(this, i, _).call(this, "playVideo")) == null || M.resolve(), s(this, o).notify("play", void 0, t)), e) {
234
- case b.Cued:
235
- r(this, i, F).call(this, t);
236
- break;
237
- case b.Playing:
238
- s(this, o).notify("playing", void 0, t);
239
- break;
240
- case b.Paused:
241
- r(this, i, L).call(this, t);
242
- break;
243
- case b.Ended:
244
- r(this, i, I).call(this, t);
245
- break;
246
- }
247
- c(this, k, e);
248
- }, Y = function() {
249
- c(this, k, -1), c(this, P, -1), c(this, g, !1);
250
- }, _ = function(e) {
251
- var t;
252
- return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
253
- }, J = function(e) {
254
- var t;
255
- return !!((t = s(this, y).get(e)) != null && t.length);
256
- };
257
- const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
258
- __proto__: null,
259
- YouTubeProvider: ne
260
- }, Symbol.toStringTag, { value: "Module" }));
261
- export {
262
- ce as p,
263
- le as u
264
- };