@instructure/studio-player 0.1.1
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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/StudioPlayer/StudioPlayer.d.ts +10 -0
- package/dist/StudioPlayer/StudioPlayerContext.d.ts +11 -0
- package/dist/StudioPlayer/components/BufferingIndicator/BufferingIndicator.d.ts +1 -0
- package/dist/StudioPlayer/components/CaptionsButton/CaptionsButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CaptionsOverlay/CaptionsOverlay.d.ts +5 -0
- package/dist/StudioPlayer/components/ControlsLayout/ControlsLayout.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/CustomSettingsMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/CustomSettingsMenuContext.d.ts +8 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsFontSizeMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsLanguageMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/CaptionsMenu/CaptionsMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/MainMenu/MainMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/QualityMenu/QualityMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/SpeedMenu/SpeedMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/BaseButton.d.ts +8 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsFontSizeButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/CaptionsLanguageButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/QualityButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/menus/buttons/SpeedButton.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/useCallbackOnEsc.d.ts +1 -0
- package/dist/StudioPlayer/components/CustomSettingsMenu/useCustomSettingsMenu.d.ts +18 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackIcon.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackMessage.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/FeedbackOverlay.d.ts +1 -0
- package/dist/StudioPlayer/components/FeedbackOverlay/createFeedbackComponent.d.ts +1 -0
- package/dist/StudioPlayer/components/FullscreenButton/FullscreenButton.d.ts +1 -0
- package/dist/StudioPlayer/components/GesturesContainer/GesturesContainer.d.ts +1 -0
- package/dist/StudioPlayer/components/PlayPauseButton/PlayPauseButton.d.ts +1 -0
- package/dist/StudioPlayer/components/PosterContainer/PosterContainer.d.ts +4 -0
- package/dist/StudioPlayer/components/SmallLayoutOverlay/SmallLayoutOverlay.d.ts +1 -0
- package/dist/StudioPlayer/components/TimeIndicator/TimeIndicator.d.ts +1 -0
- package/dist/StudioPlayer/components/TimeLine/TimeLine.d.ts +4 -0
- package/dist/StudioPlayer/components/VolumeMenu/VolumeMenu.d.ts +1 -0
- package/dist/StudioPlayer/components/index.d.ts +14 -0
- package/dist/StudioPlayer/shortcuts.d.ts +2 -0
- package/dist/constants.d.ts +5 -0
- package/dist/errors-DCJKAXTz.js +70 -0
- package/dist/index-BM9a_WKH.js +33480 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/prod-DTLJXtPo.js +994 -0
- package/dist/srt-parser-CWqahKwO.js +27 -0
- package/dist/ssa-parser-BqjjKy4M.js +209 -0
- package/dist/studio-player.es.js +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/vidstack-B-YW57m0-DZMwUKSQ.js +140 -0
- package/dist/vidstack-BFbyAy5g-DqVWIlTG.js +378 -0
- package/dist/vidstack-BGEqnOoX-BiZsT73r.js +434 -0
- package/dist/vidstack-CC0Rsbn0-Cf76Gp3K.js +32 -0
- package/dist/vidstack-CbSFenOv-DX2VhxT6.js +60 -0
- package/dist/vidstack-D2cUZes0-BnrvKkrf.js +237 -0
- package/dist/vidstack-Xu8hy52p-DHV2kI-e.js +323 -0
- package/dist/vidstack-Zc3I7oOd-DDsBgkhs.js +31 -0
- package/dist/vidstack-krOAtKMi-B4IZWKdc.js +29 -0
- package/package.json +78 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
var At = Object.defineProperty;
|
|
2
|
+
var Z = (d) => {
|
|
3
|
+
throw TypeError(d);
|
|
4
|
+
};
|
|
5
|
+
var St = (d, t, s) => t in d ? At(d, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : d[t] = s;
|
|
6
|
+
var G = (d, t, s) => St(d, typeof t != "symbol" ? t + "" : t, s), O = (d, t, s) => t.has(d) || Z("Cannot " + s);
|
|
7
|
+
var e = (d, t, s) => (O(d, t, "read from private field"), s ? s.call(d) : t.get(d)), T = (d, t, s) => t.has(d) ? Z("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, s), l = (d, t, s, i) => (O(d, t, "write to private field"), i ? i.call(d, s) : t.set(d, s), s), r = (d, t, s) => (O(d, t, "access private method"), s);
|
|
8
|
+
import { m as It, o as L, R as Rt, A as tt, B as bt, D as et, c as V, l as st, e as Mt, C as wt, L as _t } from "./index-BM9a_WKH.js";
|
|
9
|
+
import { getCastContext as Dt, getCastSession as Pt, getCastSessionMedia as rt, hasActiveCastSession as it, listenCastContextEvent as Nt, getCastErrorMessage as xt } from "./vidstack-B-YW57m0-DZMwUKSQ.js";
|
|
10
|
+
import "react";
|
|
11
|
+
var g, N, nt;
|
|
12
|
+
class Gt {
|
|
13
|
+
constructor(t) {
|
|
14
|
+
T(this, N);
|
|
15
|
+
T(this, g);
|
|
16
|
+
l(this, g, new chrome.cast.media.MediaInfo(t.src, t.type));
|
|
17
|
+
}
|
|
18
|
+
build() {
|
|
19
|
+
return e(this, g);
|
|
20
|
+
}
|
|
21
|
+
setStreamType(t) {
|
|
22
|
+
return t.includes("live") ? e(this, g).streamType = chrome.cast.media.StreamType.LIVE : e(this, g).streamType = chrome.cast.media.StreamType.BUFFERED, this;
|
|
23
|
+
}
|
|
24
|
+
setTracks(t) {
|
|
25
|
+
return e(this, g).tracks = t.map(r(this, N, nt)), this;
|
|
26
|
+
}
|
|
27
|
+
setMetadata(t, s) {
|
|
28
|
+
return e(this, g).metadata = new chrome.cast.media.GenericMediaMetadata(), e(this, g).metadata.title = t, e(this, g).metadata.images = [{ url: s }], this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
g = new WeakMap(), N = new WeakSet(), nt = function(t, s) {
|
|
32
|
+
const i = new chrome.cast.media.Track(s, chrome.cast.media.TrackType.TEXT);
|
|
33
|
+
return i.name = t.label, i.trackContentId = t.src, i.trackContentType = "text/vtt", i.language = t.language, i.subtype = t.kind.toUpperCase(), i;
|
|
34
|
+
};
|
|
35
|
+
const $ = chrome.cast.media.TrackType.TEXT, at = chrome.cast.media.TrackType.AUDIO;
|
|
36
|
+
var p, k, w, c, H, S, ot, ht, ct, U, P, F;
|
|
37
|
+
class Ot {
|
|
38
|
+
constructor(t, s, i) {
|
|
39
|
+
T(this, c);
|
|
40
|
+
T(this, p);
|
|
41
|
+
T(this, k);
|
|
42
|
+
T(this, w);
|
|
43
|
+
l(this, p, t), l(this, k, s), l(this, w, i);
|
|
44
|
+
}
|
|
45
|
+
setup() {
|
|
46
|
+
const t = this.syncRemoteActiveIds.bind(this);
|
|
47
|
+
st(e(this, k).audioTracks, "change", t), st(e(this, k).textTracks, "mode-change", t), Mt(r(this, c, ht).bind(this));
|
|
48
|
+
}
|
|
49
|
+
getLocalTextTracks() {
|
|
50
|
+
return e(this, k).$state.textTracks().filter((t) => t.src && t.type === "vtt");
|
|
51
|
+
}
|
|
52
|
+
syncRemoteTracks(t) {
|
|
53
|
+
if (!e(this, p).isMediaLoaded) return;
|
|
54
|
+
const s = r(this, c, H).call(this), i = this.getLocalTextTracks(), n = r(this, c, S).call(this, at), m = r(this, c, S).call(this, $);
|
|
55
|
+
for (const u of n) {
|
|
56
|
+
if (r(this, c, U).call(this, s, u)) continue;
|
|
57
|
+
const M = {
|
|
58
|
+
id: u.trackId.toString(),
|
|
59
|
+
label: u.name,
|
|
60
|
+
language: u.language,
|
|
61
|
+
kind: u.subtype ?? "main",
|
|
62
|
+
selected: !1
|
|
63
|
+
};
|
|
64
|
+
e(this, k).audioTracks[_t.add](M, t);
|
|
65
|
+
}
|
|
66
|
+
for (const u of m) {
|
|
67
|
+
if (r(this, c, U).call(this, i, u)) continue;
|
|
68
|
+
const M = {
|
|
69
|
+
id: u.trackId.toString(),
|
|
70
|
+
src: u.trackContentId,
|
|
71
|
+
label: u.name,
|
|
72
|
+
language: u.language,
|
|
73
|
+
kind: u.subtype.toLowerCase()
|
|
74
|
+
};
|
|
75
|
+
e(this, k).textTracks.add(M, t);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
syncRemoteActiveIds(t) {
|
|
79
|
+
if (!e(this, p).isMediaLoaded) return;
|
|
80
|
+
const s = r(this, c, ot).call(this), i = new chrome.cast.media.EditTracksInfoRequest(s);
|
|
81
|
+
r(this, c, ct).call(this, i).catch((n) => {
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
p = new WeakMap(), k = new WeakMap(), w = new WeakMap(), c = new WeakSet(), H = function() {
|
|
86
|
+
return e(this, k).$state.audioTracks();
|
|
87
|
+
}, S = function(t) {
|
|
88
|
+
var i;
|
|
89
|
+
const s = ((i = e(this, p).mediaInfo) == null ? void 0 : i.tracks) ?? [];
|
|
90
|
+
return t ? s.filter((n) => n.type === t) : s;
|
|
91
|
+
}, ot = function() {
|
|
92
|
+
const t = [], s = r(this, c, H).call(this).find((n) => n.selected), i = this.getLocalTextTracks().filter((n) => n.mode === "showing");
|
|
93
|
+
if (s) {
|
|
94
|
+
const n = r(this, c, S).call(this, at), m = r(this, c, P).call(this, n, s);
|
|
95
|
+
m && t.push(m.trackId);
|
|
96
|
+
}
|
|
97
|
+
if (i != null && i.length) {
|
|
98
|
+
const n = r(this, c, S).call(this, $);
|
|
99
|
+
if (n.length)
|
|
100
|
+
for (const m of i) {
|
|
101
|
+
const u = r(this, c, P).call(this, n, m);
|
|
102
|
+
u && t.push(u.trackId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}, ht = function() {
|
|
107
|
+
const t = this.getLocalTextTracks();
|
|
108
|
+
if (!e(this, p).isMediaLoaded) return;
|
|
109
|
+
const s = r(this, c, S).call(this, $);
|
|
110
|
+
for (const i of t)
|
|
111
|
+
if (!r(this, c, P).call(this, s, i)) {
|
|
112
|
+
wt(() => {
|
|
113
|
+
var m;
|
|
114
|
+
return (m = e(this, w)) == null ? void 0 : m.call(this);
|
|
115
|
+
});
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}, ct = function(t) {
|
|
119
|
+
const s = rt();
|
|
120
|
+
return new Promise((i, n) => s == null ? void 0 : s.editTracksInfo(t, i, n));
|
|
121
|
+
}, U = function(t, s) {
|
|
122
|
+
return t.find((i) => r(this, c, F).call(this, i, s));
|
|
123
|
+
}, P = function(t, s) {
|
|
124
|
+
return t.find((i) => r(this, c, F).call(this, s, i));
|
|
125
|
+
}, // Note: we can't rely on id matching because they will differ between local/remote. A local
|
|
126
|
+
// track id might not even exist.
|
|
127
|
+
F = function(t, s) {
|
|
128
|
+
return s.name === t.label && s.language === t.language && s.subtype.toLowerCase() === t.kind.toLowerCase();
|
|
129
|
+
};
|
|
130
|
+
var o, h, C, E, _, I, v, A, R, D, f, b, a, dt, ut, q, lt, B, mt, Tt, ft, Y, K, X, j, gt, kt, yt, z, pt, J, Ct, Q, y, Et, Lt, W, vt;
|
|
131
|
+
class Ft {
|
|
132
|
+
constructor(t, s) {
|
|
133
|
+
T(this, a);
|
|
134
|
+
G(this, "$$PROVIDER_TYPE", "GOOGLE_CAST");
|
|
135
|
+
G(this, "scope", It());
|
|
136
|
+
T(this, o);
|
|
137
|
+
T(this, h);
|
|
138
|
+
T(this, C);
|
|
139
|
+
T(this, E, null);
|
|
140
|
+
T(this, _, "disconnected");
|
|
141
|
+
T(this, I, 0);
|
|
142
|
+
T(this, v, 0);
|
|
143
|
+
T(this, A, new L(0, 0));
|
|
144
|
+
T(this, R, new Rt(r(this, a, Tt).bind(this)));
|
|
145
|
+
T(this, D);
|
|
146
|
+
T(this, f, null);
|
|
147
|
+
T(this, b, !1);
|
|
148
|
+
l(this, o, t), l(this, h, s), l(this, C, new Ot(t, s, r(this, a, vt).bind(this)));
|
|
149
|
+
}
|
|
150
|
+
get type() {
|
|
151
|
+
return "google-cast";
|
|
152
|
+
}
|
|
153
|
+
get currentSrc() {
|
|
154
|
+
return e(this, E);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The Google Cast remote player.
|
|
158
|
+
*
|
|
159
|
+
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.RemotePlayer}
|
|
160
|
+
*/
|
|
161
|
+
get player() {
|
|
162
|
+
return e(this, o);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
|
|
166
|
+
*/
|
|
167
|
+
get cast() {
|
|
168
|
+
return Dt();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastSession}
|
|
172
|
+
*/
|
|
173
|
+
get session() {
|
|
174
|
+
return Pt();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.Media}
|
|
178
|
+
*/
|
|
179
|
+
get media() {
|
|
180
|
+
return rt();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Whether the current Google Cast session belongs to this provider.
|
|
184
|
+
*/
|
|
185
|
+
get hasActiveSession() {
|
|
186
|
+
return it(e(this, E));
|
|
187
|
+
}
|
|
188
|
+
setup() {
|
|
189
|
+
r(this, a, dt).call(this), r(this, a, ut).call(this), e(this, C).setup(), e(this, h).notify("provider-setup", this);
|
|
190
|
+
}
|
|
191
|
+
async play() {
|
|
192
|
+
var t;
|
|
193
|
+
if (!(!e(this, o).isPaused && !e(this, b))) {
|
|
194
|
+
if (e(this, b)) {
|
|
195
|
+
await r(this, a, W).call(this, !1, 0);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
(t = e(this, o).controller) == null || t.playOrPause();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async pause() {
|
|
202
|
+
var t;
|
|
203
|
+
e(this, o).isPaused || (t = e(this, o).controller) == null || t.playOrPause();
|
|
204
|
+
}
|
|
205
|
+
getMediaStatus(t) {
|
|
206
|
+
return new Promise((s, i) => {
|
|
207
|
+
var n;
|
|
208
|
+
(n = this.media) == null || n.getStatus(t, s, i);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
setMuted(t) {
|
|
212
|
+
var i;
|
|
213
|
+
(t && !e(this, o).isMuted || !t && e(this, o).isMuted) && ((i = e(this, o).controller) == null || i.muteOrUnmute());
|
|
214
|
+
}
|
|
215
|
+
setCurrentTime(t) {
|
|
216
|
+
var s;
|
|
217
|
+
e(this, o).currentTime = t, e(this, h).notify("seeking", t), (s = e(this, o).controller) == null || s.seek();
|
|
218
|
+
}
|
|
219
|
+
setVolume(t) {
|
|
220
|
+
var s;
|
|
221
|
+
e(this, o).volumeLevel = t, (s = e(this, o).controller) == null || s.setVolumeLevel();
|
|
222
|
+
}
|
|
223
|
+
async loadSource(t) {
|
|
224
|
+
var n;
|
|
225
|
+
if (((n = e(this, f)) == null ? void 0 : n.src) !== t && l(this, f, null), it(t)) {
|
|
226
|
+
r(this, a, lt).call(this), l(this, E, t);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
e(this, h).notify("load-start");
|
|
230
|
+
const s = r(this, a, Lt).call(this, t), i = await this.session.loadMedia(s);
|
|
231
|
+
if (i) {
|
|
232
|
+
l(this, E, null), e(this, h).notify("error", Error(xt(i)));
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
l(this, E, t);
|
|
236
|
+
}
|
|
237
|
+
destroy() {
|
|
238
|
+
r(this, a, q).call(this), r(this, a, B).call(this);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
o = new WeakMap(), h = new WeakMap(), C = new WeakMap(), E = new WeakMap(), _ = new WeakMap(), I = new WeakMap(), v = new WeakMap(), A = new WeakMap(), R = new WeakMap(), D = new WeakMap(), f = new WeakMap(), b = new WeakMap(), a = new WeakSet(), dt = function() {
|
|
242
|
+
Nt(
|
|
243
|
+
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
|
|
244
|
+
r(this, a, Y).bind(this)
|
|
245
|
+
);
|
|
246
|
+
}, ut = function() {
|
|
247
|
+
const t = cast.framework.RemotePlayerEventType, s = {
|
|
248
|
+
[t.IS_CONNECTED_CHANGED]: r(this, a, Y),
|
|
249
|
+
[t.IS_MEDIA_LOADED_CHANGED]: r(this, a, K),
|
|
250
|
+
[t.CAN_CONTROL_VOLUME_CHANGED]: r(this, a, X),
|
|
251
|
+
[t.CAN_SEEK_CHANGED]: r(this, a, j),
|
|
252
|
+
[t.DURATION_CHANGED]: r(this, a, yt),
|
|
253
|
+
[t.IS_MUTED_CHANGED]: r(this, a, z),
|
|
254
|
+
[t.VOLUME_LEVEL_CHANGED]: r(this, a, z),
|
|
255
|
+
[t.IS_PAUSED_CHANGED]: r(this, a, pt),
|
|
256
|
+
[t.LIVE_SEEKABLE_RANGE_CHANGED]: r(this, a, J),
|
|
257
|
+
[t.PLAYER_STATE_CHANGED]: r(this, a, Ct)
|
|
258
|
+
};
|
|
259
|
+
l(this, D, s);
|
|
260
|
+
const i = r(this, a, ft).bind(this);
|
|
261
|
+
for (const n of tt(s))
|
|
262
|
+
e(this, o).controller.addEventListener(n, i);
|
|
263
|
+
bt(() => {
|
|
264
|
+
for (const n of tt(s))
|
|
265
|
+
e(this, o).controller.removeEventListener(n, i);
|
|
266
|
+
});
|
|
267
|
+
}, q = function() {
|
|
268
|
+
e(this, f) || (l(this, v, 0), l(this, A, new L(0, 0))), e(this, R).stop(), l(this, I, 0), l(this, f, null);
|
|
269
|
+
}, lt = function() {
|
|
270
|
+
const t = new et("resume-session", { detail: this.session });
|
|
271
|
+
r(this, a, K).call(this, t);
|
|
272
|
+
const { muted: s, volume: i, savedState: n } = e(this, h).$state, m = n();
|
|
273
|
+
this.setCurrentTime(Math.max(e(this, o).currentTime, (m == null ? void 0 : m.currentTime) ?? 0)), this.setMuted(s()), this.setVolume(i()), (m == null ? void 0 : m.paused) === !1 && this.play();
|
|
274
|
+
}, B = function() {
|
|
275
|
+
this.cast.endCurrentSession(!0);
|
|
276
|
+
const { remotePlaybackLoader: t } = e(this, h).$state;
|
|
277
|
+
t.set(null);
|
|
278
|
+
}, mt = function() {
|
|
279
|
+
const { savedState: t } = e(this, h).$state;
|
|
280
|
+
t.set({
|
|
281
|
+
paused: e(this, o).isPaused,
|
|
282
|
+
currentTime: e(this, o).currentTime
|
|
283
|
+
}), r(this, a, B).call(this);
|
|
284
|
+
}, Tt = function() {
|
|
285
|
+
r(this, a, kt).call(this);
|
|
286
|
+
}, ft = function(t) {
|
|
287
|
+
e(this, D)[t.type].call(this, t);
|
|
288
|
+
}, Y = function(t) {
|
|
289
|
+
const s = this.cast.getCastState(), i = s === cast.framework.CastState.CONNECTED ? "connected" : s === cast.framework.CastState.CONNECTING ? "connecting" : "disconnected";
|
|
290
|
+
if (e(this, _) === i) return;
|
|
291
|
+
const n = { type: "google-cast", state: i }, m = r(this, a, y).call(this, t);
|
|
292
|
+
l(this, _, i), e(this, h).notify("remote-playback-change", n, m), i === "disconnected" && r(this, a, mt).call(this);
|
|
293
|
+
}, K = function(t) {
|
|
294
|
+
if (!!!e(this, o).isMediaLoaded) return;
|
|
295
|
+
const i = V(e(this, h).$state.source);
|
|
296
|
+
Promise.resolve().then(() => {
|
|
297
|
+
if (i !== V(e(this, h).$state.source) || !e(this, o).isMediaLoaded) return;
|
|
298
|
+
r(this, a, q).call(this);
|
|
299
|
+
const n = e(this, o).duration;
|
|
300
|
+
l(this, A, new L(0, n));
|
|
301
|
+
const m = {
|
|
302
|
+
provider: this,
|
|
303
|
+
duration: n,
|
|
304
|
+
buffered: new L(0, 0),
|
|
305
|
+
seekable: r(this, a, Q).call(this)
|
|
306
|
+
}, u = r(this, a, y).call(this, t);
|
|
307
|
+
e(this, h).notify("loaded-metadata", void 0, u), e(this, h).notify("loaded-data", void 0, u), e(this, h).notify("can-play", m, u), r(this, a, X).call(this), r(this, a, j).call(this, t);
|
|
308
|
+
const { volume: x, muted: M } = e(this, h).$state;
|
|
309
|
+
this.setVolume(x()), this.setMuted(M()), e(this, R).start(), e(this, C).syncRemoteTracks(u), e(this, C).syncRemoteActiveIds(u);
|
|
310
|
+
});
|
|
311
|
+
}, X = function() {
|
|
312
|
+
e(this, h).$state.canSetVolume.set(e(this, o).canControlVolume);
|
|
313
|
+
}, j = function(t) {
|
|
314
|
+
const s = r(this, a, y).call(this, t);
|
|
315
|
+
e(this, h).notify("stream-type-change", r(this, a, gt).call(this), s);
|
|
316
|
+
}, gt = function() {
|
|
317
|
+
var s;
|
|
318
|
+
return ((s = e(this, o).mediaInfo) == null ? void 0 : s.streamType) === chrome.cast.media.StreamType.LIVE ? e(this, o).canSeek ? "live:dvr" : "live" : "on-demand";
|
|
319
|
+
}, kt = function() {
|
|
320
|
+
if (e(this, f)) return;
|
|
321
|
+
const t = e(this, o).currentTime;
|
|
322
|
+
t !== e(this, I) && (e(this, h).notify("time-change", t), t > e(this, v) && (l(this, v, t), r(this, a, J).call(this)), e(this, h).$state.seeking() && e(this, h).notify("seeked", t), l(this, I, t));
|
|
323
|
+
}, yt = function(t) {
|
|
324
|
+
if (!e(this, o).isMediaLoaded || e(this, f)) return;
|
|
325
|
+
const s = e(this, o).duration, i = r(this, a, y).call(this, t);
|
|
326
|
+
l(this, A, new L(0, s)), e(this, h).notify("duration-change", s, i);
|
|
327
|
+
}, z = function(t) {
|
|
328
|
+
if (!e(this, o).isMediaLoaded) return;
|
|
329
|
+
const s = {
|
|
330
|
+
muted: e(this, o).isMuted,
|
|
331
|
+
volume: e(this, o).volumeLevel
|
|
332
|
+
}, i = r(this, a, y).call(this, t);
|
|
333
|
+
e(this, h).notify("volume-change", s, i);
|
|
334
|
+
}, pt = function(t) {
|
|
335
|
+
const s = r(this, a, y).call(this, t);
|
|
336
|
+
e(this, o).isPaused ? e(this, h).notify("pause", void 0, s) : e(this, h).notify("play", void 0, s);
|
|
337
|
+
}, J = function(t) {
|
|
338
|
+
const s = {
|
|
339
|
+
seekable: r(this, a, Q).call(this),
|
|
340
|
+
buffered: new L(0, e(this, v))
|
|
341
|
+
}, i = t ? r(this, a, y).call(this, t) : void 0;
|
|
342
|
+
e(this, h).notify("progress", s, i);
|
|
343
|
+
}, Ct = function(t) {
|
|
344
|
+
const s = e(this, o).playerState, i = chrome.cast.media.PlayerState;
|
|
345
|
+
if (l(this, b, s === i.IDLE), s === i.PAUSED) return;
|
|
346
|
+
const n = r(this, a, y).call(this, t);
|
|
347
|
+
switch (s) {
|
|
348
|
+
case i.PLAYING:
|
|
349
|
+
e(this, h).notify("playing", void 0, n);
|
|
350
|
+
break;
|
|
351
|
+
case i.BUFFERING:
|
|
352
|
+
e(this, h).notify("waiting", void 0, n);
|
|
353
|
+
break;
|
|
354
|
+
case i.IDLE:
|
|
355
|
+
e(this, R).stop(), e(this, h).notify("pause"), e(this, h).notify("end");
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}, Q = function() {
|
|
359
|
+
return e(this, o).liveSeekableRange ? new L(e(this, o).liveSeekableRange.start, e(this, o).liveSeekableRange.end) : e(this, A);
|
|
360
|
+
}, y = function(t) {
|
|
361
|
+
return t instanceof Event ? t : new et(t.type, { detail: t });
|
|
362
|
+
}, Et = function(t) {
|
|
363
|
+
const { streamType: s, title: i, poster: n } = e(this, h).$state;
|
|
364
|
+
return new Gt(t).setMetadata(i(), n()).setStreamType(s()).setTracks(e(this, C).getLocalTextTracks()).build();
|
|
365
|
+
}, Lt = function(t) {
|
|
366
|
+
var m, u;
|
|
367
|
+
const s = r(this, a, Et).call(this, t), i = new chrome.cast.media.LoadRequest(s), n = e(this, h).$state.savedState();
|
|
368
|
+
return i.autoplay = (((m = e(this, f)) == null ? void 0 : m.paused) ?? (n == null ? void 0 : n.paused)) === !1, i.currentTime = ((u = e(this, f)) == null ? void 0 : u.time) ?? (n == null ? void 0 : n.currentTime) ?? 0, i;
|
|
369
|
+
}, W = async function(t, s) {
|
|
370
|
+
const i = V(e(this, h).$state.source);
|
|
371
|
+
l(this, f, { src: i, paused: t, time: s }), await this.loadSource(i);
|
|
372
|
+
}, vt = function() {
|
|
373
|
+
r(this, a, W).call(this, e(this, o).isPaused, e(this, o).currentTime).catch((t) => {
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
export {
|
|
377
|
+
Ft as GoogleCastProvider
|
|
378
|
+
};
|