@aigamo/nostalgic-diva 1.13.0 → 1.14.0-rc.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/README.md +46 -2
- package/dist/{AudioPlayer-222df83f.js → AudioPlayer-1a8caac7.js} +8 -7
- package/dist/{AudioPlayer-222df83f.js.map → AudioPlayer-1a8caac7.js.map} +1 -1
- package/dist/AudioPlayer-6edeb287.cjs +2 -0
- package/dist/{AudioPlayer-8bce83c7.cjs.map → AudioPlayer-6edeb287.cjs.map} +1 -1
- package/dist/DailymotionPlayer-252803e0.cjs +2 -0
- package/dist/{DailymotionPlayer-0bc7e413.cjs.map → DailymotionPlayer-252803e0.cjs.map} +1 -1
- package/dist/{DailymotionPlayer-21fcfcaf.js → DailymotionPlayer-6b3cc7ce.js} +24 -23
- package/dist/{DailymotionPlayer-21fcfcaf.js.map → DailymotionPlayer-6b3cc7ce.js.map} +1 -1
- package/dist/NiconicoPlayer-6d765b0c.cjs +2 -0
- package/dist/{NiconicoPlayer-050cfbdb.cjs.map → NiconicoPlayer-6d765b0c.cjs.map} +1 -1
- package/dist/{NiconicoPlayer-6539b5fb.js → NiconicoPlayer-d834668f.js} +6 -5
- package/dist/{NiconicoPlayer-6539b5fb.js.map → NiconicoPlayer-d834668f.js.map} +1 -1
- package/dist/{PlayerContainer-044b2fa8.cjs → PlayerContainer-01e0a6d8.cjs} +2 -2
- package/dist/{PlayerContainer-044b2fa8.cjs.map → PlayerContainer-01e0a6d8.cjs.map} +1 -1
- package/dist/{PlayerContainer-b732b1fd.js → PlayerContainer-12c7a566.js} +2 -2
- package/dist/{PlayerContainer-b732b1fd.js.map → PlayerContainer-12c7a566.js.map} +1 -1
- package/dist/{SoundCloudPlayer-bb16551c.js → SoundCloudPlayer-11f15866.js} +13 -12
- package/dist/{SoundCloudPlayer-bb16551c.js.map → SoundCloudPlayer-11f15866.js.map} +1 -1
- package/dist/SoundCloudPlayer-3fe771ac.cjs +2 -0
- package/dist/{SoundCloudPlayer-1127dad4.cjs.map → SoundCloudPlayer-3fe771ac.cjs.map} +1 -1
- package/dist/{TwitchPlayer-34ae3ffa.js → TwitchPlayer-191956ee.js} +12 -11
- package/dist/{TwitchPlayer-34ae3ffa.js.map → TwitchPlayer-191956ee.js.map} +1 -1
- package/dist/TwitchPlayer-b2941d58.cjs +2 -0
- package/dist/{TwitchPlayer-20593545.cjs.map → TwitchPlayer-b2941d58.cjs.map} +1 -1
- package/dist/VimeoPlayer-a9a3f2c8.cjs +2 -0
- package/dist/{VimeoPlayer-187fa81e.cjs.map → VimeoPlayer-a9a3f2c8.cjs.map} +1 -1
- package/dist/{VimeoPlayer-3e821355.js → VimeoPlayer-f8182608.js} +7 -6
- package/dist/{VimeoPlayer-3e821355.js.map → VimeoPlayer-f8182608.js.map} +1 -1
- package/dist/{YouTubePlayer-cb4b9913.js → YouTubePlayer-6a5d2c5d.js} +7 -6
- package/dist/{YouTubePlayer-cb4b9913.js.map → YouTubePlayer-6a5d2c5d.js.map} +1 -1
- package/dist/YouTubePlayer-7d9d4215.cjs +2 -0
- package/dist/{YouTubePlayer-383475e4.cjs.map → YouTubePlayer-7d9d4215.cjs.map} +1 -1
- package/dist/components/defineNostalgicDiva.d.ts +25 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/{ensureScriptLoaded-b5e2176c.cjs → ensureScriptLoaded-1f39c376.cjs} +2 -2
- package/dist/{ensureScriptLoaded-b5e2176c.cjs.map → ensureScriptLoaded-1f39c376.cjs.map} +1 -1
- package/dist/{ensureScriptLoaded-76011cc9.js → ensureScriptLoaded-75980318.js} +2 -2
- package/dist/{ensureScriptLoaded-76011cc9.js.map → ensureScriptLoaded-75980318.js.map} +1 -1
- package/dist/index-0ef85555.js +1132 -0
- package/dist/index-0ef85555.js.map +1 -0
- package/dist/index-fb8a7911.cjs +2 -0
- package/dist/index-fb8a7911.cjs.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +17 -14
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/AudioPlayer-8bce83c7.cjs +0 -2
- package/dist/DailymotionPlayer-0bc7e413.cjs +0 -2
- package/dist/NiconicoPlayer-050cfbdb.cjs +0 -2
- package/dist/SoundCloudPlayer-1127dad4.cjs +0 -2
- package/dist/TwitchPlayer-20593545.cjs +0 -2
- package/dist/VimeoPlayer-187fa81e.cjs +0 -2
- package/dist/YouTubePlayer-383475e4.cjs +0 -2
- package/dist/index-eccfe7b9.js +0 -1023
- package/dist/index-eccfe7b9.js.map +0 -1
- package/dist/index-ed095ac8.cjs +0 -2
- package/dist/index-ed095ac8.cjs.map +0 -1
package/dist/index-eccfe7b9.js
DELETED
|
@@ -1,1023 +0,0 @@
|
|
|
1
|
-
var _ = Object.defineProperty;
|
|
2
|
-
var L = (s, e, t) => e in s ? _(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var y = (s, e, t) => (L(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import l from "react";
|
|
5
|
-
var v = /* @__PURE__ */ ((s) => (s[s.Trace = 0] = "Trace", s[s.Debug = 1] = "Debug", s[s.Information = 2] = "Information", s[s.Warning = 3] = "Warning", s[s.Error = 4] = "Error", s[s.Critical = 5] = "Critical", s[s.None = 6] = "None", s))(v || {});
|
|
6
|
-
class W {
|
|
7
|
-
constructor() {
|
|
8
|
-
y(this, "title", "nostalgic-diva");
|
|
9
|
-
}
|
|
10
|
-
createMessage(e) {
|
|
11
|
-
return `[${this.title}] ${e}`;
|
|
12
|
-
}
|
|
13
|
-
debug(e, ...t) {
|
|
14
|
-
console.debug(this.createMessage(e), ...t);
|
|
15
|
-
}
|
|
16
|
-
error(e, ...t) {
|
|
17
|
-
console.error(this.createMessage(e), ...t);
|
|
18
|
-
}
|
|
19
|
-
warn(e, ...t) {
|
|
20
|
-
console.warn(this.createMessage(e), ...t);
|
|
21
|
-
}
|
|
22
|
-
isEnabled() {
|
|
23
|
-
return !0;
|
|
24
|
-
}
|
|
25
|
-
log(e, t, ...a) {
|
|
26
|
-
switch (e) {
|
|
27
|
-
case 1:
|
|
28
|
-
this.debug(t, ...a);
|
|
29
|
-
break;
|
|
30
|
-
case 3:
|
|
31
|
-
this.warn(t, ...a);
|
|
32
|
-
break;
|
|
33
|
-
case 4:
|
|
34
|
-
this.error(t, ...a);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
var T = /* @__PURE__ */ ((s) => (s.Audio = "Audio", s.Dailymotion = "Dailymotion", s.Niconico = "Niconico", s.SoundCloud = "SoundCloud", s.Twitch = "Twitch", s.Vimeo = "Vimeo", s.YouTube = "YouTube", s))(T || {});
|
|
40
|
-
function ie(s) {
|
|
41
|
-
return T[s] !== void 0;
|
|
42
|
-
}
|
|
43
|
-
const k = class k {
|
|
44
|
-
constructor(e, t, a, n, c) {
|
|
45
|
-
y(this, "id");
|
|
46
|
-
y(this, "impl");
|
|
47
|
-
this.logger = e, this.type = t, this.player = a, this.options = n, this.controllerFactory = c, this.id = k.nextId++;
|
|
48
|
-
}
|
|
49
|
-
createMessage(e) {
|
|
50
|
-
return `${this.type}#${this.id} ${e}`;
|
|
51
|
-
}
|
|
52
|
-
debug(e, ...t) {
|
|
53
|
-
this.logger.log(
|
|
54
|
-
v.Debug,
|
|
55
|
-
this.createMessage(e),
|
|
56
|
-
...t
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
error(e, ...t) {
|
|
60
|
-
this.logger.log(
|
|
61
|
-
v.Error,
|
|
62
|
-
this.createMessage(e),
|
|
63
|
-
...t
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
async attach(e) {
|
|
67
|
-
if (this.debug("attach", e), this.impl) {
|
|
68
|
-
this.debug("player is already attached");
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
this.debug("Attaching player..."), this.impl = new this.controllerFactory(
|
|
72
|
-
this.logger,
|
|
73
|
-
this.player,
|
|
74
|
-
this.options
|
|
75
|
-
), await this.impl.attach(e), this.debug("player attached");
|
|
76
|
-
}
|
|
77
|
-
createPlayerNotAttachedError() {
|
|
78
|
-
return new Error("player is not attached");
|
|
79
|
-
}
|
|
80
|
-
async detach() {
|
|
81
|
-
if (this.debug("detach"), this.impl === void 0)
|
|
82
|
-
throw this.createPlayerNotAttachedError();
|
|
83
|
-
await this.impl.detach(), this.impl = void 0;
|
|
84
|
-
}
|
|
85
|
-
async loadVideo(e) {
|
|
86
|
-
if (this.debug("loadVideo", e), this.impl === void 0)
|
|
87
|
-
throw this.createPlayerNotAttachedError();
|
|
88
|
-
this.debug("Loading video..."), await this.impl.loadVideo(e), this.debug("video loaded", e);
|
|
89
|
-
}
|
|
90
|
-
play() {
|
|
91
|
-
if (this.debug("play"), this.impl === void 0)
|
|
92
|
-
throw this.createPlayerNotAttachedError();
|
|
93
|
-
return this.impl.play();
|
|
94
|
-
}
|
|
95
|
-
pause() {
|
|
96
|
-
if (this.debug("pause"), this.impl === void 0)
|
|
97
|
-
throw this.createPlayerNotAttachedError();
|
|
98
|
-
return this.impl.pause();
|
|
99
|
-
}
|
|
100
|
-
setCurrentTime(e) {
|
|
101
|
-
if (this.debug("setCurrentTime", e), this.impl === void 0)
|
|
102
|
-
throw this.createPlayerNotAttachedError();
|
|
103
|
-
return this.impl.setCurrentTime(e);
|
|
104
|
-
}
|
|
105
|
-
setVolume(e) {
|
|
106
|
-
if (this.debug("setVolume", e), this.impl === void 0)
|
|
107
|
-
throw this.createPlayerNotAttachedError();
|
|
108
|
-
return this.impl.setVolume(e);
|
|
109
|
-
}
|
|
110
|
-
setMuted(e) {
|
|
111
|
-
if (this.debug("setMuted", e), this.impl === void 0)
|
|
112
|
-
throw this.createPlayerNotAttachedError();
|
|
113
|
-
return this.impl.setMuted(e);
|
|
114
|
-
}
|
|
115
|
-
setPlaybackRate(e) {
|
|
116
|
-
if (this.debug("setPlaybackRate", e), this.impl === void 0)
|
|
117
|
-
throw this.createPlayerNotAttachedError();
|
|
118
|
-
return this.impl.setPlaybackRate(e);
|
|
119
|
-
}
|
|
120
|
-
getDuration() {
|
|
121
|
-
if (this.debug("getDuration"), this.impl === void 0)
|
|
122
|
-
throw this.createPlayerNotAttachedError();
|
|
123
|
-
return this.impl.getDuration();
|
|
124
|
-
}
|
|
125
|
-
getCurrentTime() {
|
|
126
|
-
if (this.debug("getCurrentTime"), this.impl === void 0)
|
|
127
|
-
throw this.createPlayerNotAttachedError();
|
|
128
|
-
return this.impl.getCurrentTime();
|
|
129
|
-
}
|
|
130
|
-
getVolume() {
|
|
131
|
-
if (this.debug("getVolume"), this.impl === void 0)
|
|
132
|
-
throw this.createPlayerNotAttachedError();
|
|
133
|
-
return this.impl.getVolume();
|
|
134
|
-
}
|
|
135
|
-
getPlaybackRate() {
|
|
136
|
-
if (this.debug("getPlaybackRate"), this.impl === void 0)
|
|
137
|
-
throw this.createPlayerNotAttachedError();
|
|
138
|
-
return this.impl.getPlaybackRate();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
y(k, "nextId", 1);
|
|
142
|
-
let D = k;
|
|
143
|
-
class E {
|
|
144
|
-
constructor(e) {
|
|
145
|
-
this.type = e;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const $ = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i, j = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
|
|
149
|
-
class H extends E {
|
|
150
|
-
constructor() {
|
|
151
|
-
super(T.Audio);
|
|
152
|
-
}
|
|
153
|
-
canPlay(e) {
|
|
154
|
-
return $.test(e) || j.test(e);
|
|
155
|
-
}
|
|
156
|
-
extractVideoId(e) {
|
|
157
|
-
return e;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const R = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/;
|
|
161
|
-
class z extends E {
|
|
162
|
-
constructor() {
|
|
163
|
-
super(T.Dailymotion);
|
|
164
|
-
}
|
|
165
|
-
canPlay(e) {
|
|
166
|
-
return R.test(e);
|
|
167
|
-
}
|
|
168
|
-
extractVideoId(e) {
|
|
169
|
-
const t = R.exec(e);
|
|
170
|
-
return t == null ? void 0 : t[1];
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const f = /(?:www\.|)?nicovideo\.jp\/watch\/(\w+)$/;
|
|
174
|
-
class F extends E {
|
|
175
|
-
constructor() {
|
|
176
|
-
super(T.Niconico);
|
|
177
|
-
}
|
|
178
|
-
canPlay(e) {
|
|
179
|
-
return f.test(e);
|
|
180
|
-
}
|
|
181
|
-
extractVideoId(e) {
|
|
182
|
-
const t = f.exec(e);
|
|
183
|
-
return t == null ? void 0 : t[1];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const G = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;
|
|
187
|
-
class B extends E {
|
|
188
|
-
constructor() {
|
|
189
|
-
super(T.SoundCloud);
|
|
190
|
-
}
|
|
191
|
-
canPlay(e) {
|
|
192
|
-
return G.test(e);
|
|
193
|
-
}
|
|
194
|
-
extractVideoId(e) {
|
|
195
|
-
return e;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const A = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/;
|
|
199
|
-
class X extends E {
|
|
200
|
-
constructor() {
|
|
201
|
-
super(T.Twitch);
|
|
202
|
-
}
|
|
203
|
-
canPlay(e) {
|
|
204
|
-
return A.test(e);
|
|
205
|
-
}
|
|
206
|
-
extractVideoId(e) {
|
|
207
|
-
const t = A.exec(e);
|
|
208
|
-
return t == null ? void 0 : t[1];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const N = /vimeo\.com\/(\d+)$/;
|
|
212
|
-
class K extends E {
|
|
213
|
-
constructor() {
|
|
214
|
-
super(T.Vimeo);
|
|
215
|
-
}
|
|
216
|
-
canPlay(e) {
|
|
217
|
-
return N.test(e);
|
|
218
|
-
}
|
|
219
|
-
extractVideoId(e) {
|
|
220
|
-
var t;
|
|
221
|
-
return (t = N.exec(e)) == null ? void 0 : t[1];
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const U = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
|
|
225
|
-
class Z extends E {
|
|
226
|
-
constructor() {
|
|
227
|
-
super(T.YouTube);
|
|
228
|
-
}
|
|
229
|
-
canPlay(e) {
|
|
230
|
-
return U.test(e);
|
|
231
|
-
}
|
|
232
|
-
extractVideoId(e) {
|
|
233
|
-
const t = U.exec(e);
|
|
234
|
-
return t == null ? void 0 : t[1];
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
const q = [
|
|
238
|
-
new H(),
|
|
239
|
-
new z(),
|
|
240
|
-
new F(),
|
|
241
|
-
new B(),
|
|
242
|
-
new X(),
|
|
243
|
-
new K(),
|
|
244
|
-
new Z()
|
|
245
|
-
];
|
|
246
|
-
function J(s) {
|
|
247
|
-
return q.find((e) => e.canPlay(s));
|
|
248
|
-
}
|
|
249
|
-
const x = l.createContext(
|
|
250
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
251
|
-
void 0
|
|
252
|
-
), ne = ({
|
|
253
|
-
children: s
|
|
254
|
-
}) => {
|
|
255
|
-
const e = l.useRef(), t = l.useCallback(
|
|
256
|
-
(o) => {
|
|
257
|
-
e.current = o;
|
|
258
|
-
},
|
|
259
|
-
[]
|
|
260
|
-
), a = l.useCallback(async (o) => {
|
|
261
|
-
var u;
|
|
262
|
-
await ((u = e.current) == null ? void 0 : u.loadVideo(o));
|
|
263
|
-
}, []), n = l.useCallback(async () => {
|
|
264
|
-
var o;
|
|
265
|
-
await ((o = e.current) == null ? void 0 : o.play());
|
|
266
|
-
}, []), c = l.useCallback(async () => {
|
|
267
|
-
var o;
|
|
268
|
-
await ((o = e.current) == null ? void 0 : o.pause());
|
|
269
|
-
}, []), r = l.useCallback(async (o) => {
|
|
270
|
-
const u = e.current;
|
|
271
|
-
u && (await u.setCurrentTime(o), await u.play());
|
|
272
|
-
}, []), i = l.useCallback(async (o) => {
|
|
273
|
-
var u;
|
|
274
|
-
await ((u = e.current) == null ? void 0 : u.setVolume(o));
|
|
275
|
-
}, []), d = l.useCallback(async (o) => {
|
|
276
|
-
var u;
|
|
277
|
-
await ((u = e.current) == null ? void 0 : u.setMuted(o));
|
|
278
|
-
}, []), h = l.useCallback(async (o) => {
|
|
279
|
-
var u;
|
|
280
|
-
await ((u = e.current) == null ? void 0 : u.setPlaybackRate(o));
|
|
281
|
-
}, []), p = l.useCallback(async () => {
|
|
282
|
-
var o;
|
|
283
|
-
return await ((o = e.current) == null ? void 0 : o.getDuration());
|
|
284
|
-
}, []), m = l.useCallback(async () => {
|
|
285
|
-
var o;
|
|
286
|
-
return await ((o = e.current) == null ? void 0 : o.getCurrentTime());
|
|
287
|
-
}, []), g = l.useCallback(async () => {
|
|
288
|
-
var o;
|
|
289
|
-
return await ((o = e.current) == null ? void 0 : o.getVolume());
|
|
290
|
-
}, []), b = l.useCallback(async () => {
|
|
291
|
-
var o;
|
|
292
|
-
return await ((o = e.current) == null ? void 0 : o.getPlaybackRate());
|
|
293
|
-
}, []), w = l.useMemo(
|
|
294
|
-
() => ({
|
|
295
|
-
handleControllerChange: t,
|
|
296
|
-
loadVideo: a,
|
|
297
|
-
play: n,
|
|
298
|
-
pause: c,
|
|
299
|
-
setCurrentTime: r,
|
|
300
|
-
setVolume: i,
|
|
301
|
-
setMuted: d,
|
|
302
|
-
setPlaybackRate: h,
|
|
303
|
-
getDuration: p,
|
|
304
|
-
getCurrentTime: m,
|
|
305
|
-
getVolume: g,
|
|
306
|
-
getPlaybackRate: b
|
|
307
|
-
}),
|
|
308
|
-
[
|
|
309
|
-
t,
|
|
310
|
-
a,
|
|
311
|
-
n,
|
|
312
|
-
c,
|
|
313
|
-
r,
|
|
314
|
-
i,
|
|
315
|
-
d,
|
|
316
|
-
h,
|
|
317
|
-
p,
|
|
318
|
-
m,
|
|
319
|
-
g,
|
|
320
|
-
b
|
|
321
|
-
]
|
|
322
|
-
);
|
|
323
|
-
return /* @__PURE__ */ l.createElement(x.Provider, { value: w }, s);
|
|
324
|
-
}, Q = () => l.useContext(x), ee = {
|
|
325
|
-
Audio: l.lazy(() => import("./AudioPlayer-222df83f.js")),
|
|
326
|
-
Dailymotion: l.lazy(() => import("./DailymotionPlayer-21fcfcaf.js")),
|
|
327
|
-
Niconico: l.lazy(() => import("./NiconicoPlayer-6539b5fb.js")),
|
|
328
|
-
SoundCloud: l.lazy(() => import("./SoundCloudPlayer-bb16551c.js")),
|
|
329
|
-
Twitch: l.lazy(() => import("./TwitchPlayer-34ae3ffa.js")),
|
|
330
|
-
Vimeo: l.lazy(() => import("./VimeoPlayer-3e821355.js")),
|
|
331
|
-
YouTube: l.lazy(() => import("./YouTubePlayer-cb4b9913.js"))
|
|
332
|
-
}, te = new W();
|
|
333
|
-
function ae(s) {
|
|
334
|
-
const e = J(s);
|
|
335
|
-
if (e === void 0)
|
|
336
|
-
return;
|
|
337
|
-
const { type: t, extractVideoId: a } = e, n = a(s);
|
|
338
|
-
if (n !== void 0)
|
|
339
|
-
return { type: t, videoId: n };
|
|
340
|
-
}
|
|
341
|
-
const oe = l.memo(
|
|
342
|
-
({
|
|
343
|
-
src: s,
|
|
344
|
-
options: e,
|
|
345
|
-
logger: t = te,
|
|
346
|
-
onControllerChange: a
|
|
347
|
-
}) => {
|
|
348
|
-
const n = Q(), c = l.useCallback(
|
|
349
|
-
(p) => {
|
|
350
|
-
var m;
|
|
351
|
-
return (m = a ?? (n == null ? void 0 : n.handleControllerChange)) == null ? void 0 : m(p);
|
|
352
|
-
},
|
|
353
|
-
[n == null ? void 0 : n.handleControllerChange, a]
|
|
354
|
-
);
|
|
355
|
-
t.log(v.Debug, "NostalgicDiva");
|
|
356
|
-
const r = ae(s);
|
|
357
|
-
if (r === void 0)
|
|
358
|
-
return /* @__PURE__ */ l.createElement("div", { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ l.createElement(
|
|
359
|
-
"iframe",
|
|
360
|
-
{
|
|
361
|
-
src: "about:blank",
|
|
362
|
-
title: "about:blank",
|
|
363
|
-
style: {
|
|
364
|
-
width: "100%",
|
|
365
|
-
height: "100%",
|
|
366
|
-
border: 0
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
));
|
|
370
|
-
const { type: i, videoId: d } = r, h = ee[i];
|
|
371
|
-
return /* @__PURE__ */ l.createElement(l.Suspense, { fallback: null }, /* @__PURE__ */ l.createElement(
|
|
372
|
-
h,
|
|
373
|
-
{
|
|
374
|
-
logger: t,
|
|
375
|
-
type: i,
|
|
376
|
-
onControllerChange: c,
|
|
377
|
-
videoId: d,
|
|
378
|
-
options: e
|
|
379
|
-
}
|
|
380
|
-
));
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
class C {
|
|
384
|
-
constructor(e, t, a) {
|
|
385
|
-
this.logger = e, this.player = t, this.options = a, this.logger.log(v.Debug, "ctor");
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
class le extends C {
|
|
389
|
-
async attach() {
|
|
390
|
-
this.player.onerror = (e) => {
|
|
391
|
-
var t, a;
|
|
392
|
-
return (a = (t = this.options) == null ? void 0 : t.onError) == null ? void 0 : a.call(t, e);
|
|
393
|
-
}, this.player.onloadeddata = () => {
|
|
394
|
-
var e, t;
|
|
395
|
-
return (t = (e = this.options) == null ? void 0 : e.onLoaded) == null ? void 0 : t.call(e, { id: this.player.src });
|
|
396
|
-
}, this.player.onplay = () => {
|
|
397
|
-
var e, t;
|
|
398
|
-
return (t = (e = this.options) == null ? void 0 : e.onPlay) == null ? void 0 : t.call(e);
|
|
399
|
-
}, this.player.onpause = () => {
|
|
400
|
-
var e, t;
|
|
401
|
-
return (t = (e = this.options) == null ? void 0 : e.onPause) == null ? void 0 : t.call(e);
|
|
402
|
-
}, this.player.onended = () => {
|
|
403
|
-
var e, t;
|
|
404
|
-
return (t = (e = this.options) == null ? void 0 : e.onEnded) == null ? void 0 : t.call(e);
|
|
405
|
-
}, this.player.ontimeupdate = () => {
|
|
406
|
-
var e, t;
|
|
407
|
-
(t = (e = this.options) == null ? void 0 : e.onTimeUpdate) == null || t.call(e, {
|
|
408
|
-
duration: this.player.duration,
|
|
409
|
-
percent: this.player.currentTime / this.player.duration,
|
|
410
|
-
seconds: this.player.currentTime
|
|
411
|
-
});
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
async detach() {
|
|
415
|
-
this.player.onerror = null, this.player.onloadeddata = null, this.player.onplay = null, this.player.onpause = null, this.player.onended = null, this.player.ontimeupdate = null;
|
|
416
|
-
}
|
|
417
|
-
async loadVideo(e) {
|
|
418
|
-
this.player.src = e;
|
|
419
|
-
}
|
|
420
|
-
async play() {
|
|
421
|
-
this.player.play();
|
|
422
|
-
}
|
|
423
|
-
async pause() {
|
|
424
|
-
this.player.pause();
|
|
425
|
-
}
|
|
426
|
-
async setCurrentTime(e) {
|
|
427
|
-
this.player.currentTime = e;
|
|
428
|
-
}
|
|
429
|
-
async setVolume(e) {
|
|
430
|
-
this.player.volume = e;
|
|
431
|
-
}
|
|
432
|
-
async setMuted(e) {
|
|
433
|
-
this.player.muted = e;
|
|
434
|
-
}
|
|
435
|
-
async setPlaybackRate(e) {
|
|
436
|
-
this.player.playbackRate = e;
|
|
437
|
-
}
|
|
438
|
-
async getDuration() {
|
|
439
|
-
return this.player.duration;
|
|
440
|
-
}
|
|
441
|
-
async getCurrentTime() {
|
|
442
|
-
return this.player.currentTime;
|
|
443
|
-
}
|
|
444
|
-
async getVolume() {
|
|
445
|
-
return this.player.volume;
|
|
446
|
-
}
|
|
447
|
-
async getPlaybackRate() {
|
|
448
|
-
return this.player.playbackRate;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
const S = [
|
|
452
|
-
"apiready",
|
|
453
|
-
"seeked",
|
|
454
|
-
"video_end",
|
|
455
|
-
"durationchange",
|
|
456
|
-
"pause",
|
|
457
|
-
"playing",
|
|
458
|
-
"error"
|
|
459
|
-
];
|
|
460
|
-
class ce extends C {
|
|
461
|
-
constructor() {
|
|
462
|
-
super(...arguments);
|
|
463
|
-
y(this, "handlePlayerEvents", (t) => {
|
|
464
|
-
var a, n, c, r, i, d, h, p, m, g, b, w;
|
|
465
|
-
switch (t.type) {
|
|
466
|
-
case "apiready":
|
|
467
|
-
(n = (a = this.options) == null ? void 0 : a.onLoaded) == null || n.call(a, { id: this.player.video.videoId });
|
|
468
|
-
break;
|
|
469
|
-
case "seeked":
|
|
470
|
-
(r = (c = this.options) == null ? void 0 : c.onTimeUpdate) == null || r.call(c, {
|
|
471
|
-
duration: this.player.duration,
|
|
472
|
-
percent: this.player.currentTime / this.player.duration,
|
|
473
|
-
seconds: this.player.currentTime
|
|
474
|
-
});
|
|
475
|
-
break;
|
|
476
|
-
case "video_end":
|
|
477
|
-
(d = (i = this.options) == null ? void 0 : i.onEnded) == null || d.call(i);
|
|
478
|
-
break;
|
|
479
|
-
case "durationchange":
|
|
480
|
-
break;
|
|
481
|
-
case "pause":
|
|
482
|
-
(p = (h = this.options) == null ? void 0 : h.onPause) == null || p.call(h);
|
|
483
|
-
break;
|
|
484
|
-
case "playing":
|
|
485
|
-
(g = (m = this.options) == null ? void 0 : m.onPlay) == null || g.call(m);
|
|
486
|
-
break;
|
|
487
|
-
case "error":
|
|
488
|
-
(w = (b = this.options) == null ? void 0 : b.onError) == null || w.call(b, t);
|
|
489
|
-
break;
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
async attach(t) {
|
|
494
|
-
for (const a of S)
|
|
495
|
-
this.player.addEventListener(a, this.handlePlayerEvents);
|
|
496
|
-
}
|
|
497
|
-
async detach() {
|
|
498
|
-
for (const t of S)
|
|
499
|
-
this.player.removeEventListener(t, this.handlePlayerEvents);
|
|
500
|
-
}
|
|
501
|
-
async loadVideo(t) {
|
|
502
|
-
this.player.load(t);
|
|
503
|
-
}
|
|
504
|
-
async play() {
|
|
505
|
-
this.player.play();
|
|
506
|
-
}
|
|
507
|
-
async pause() {
|
|
508
|
-
this.player.pause();
|
|
509
|
-
}
|
|
510
|
-
async setCurrentTime(t) {
|
|
511
|
-
this.player.seek(t);
|
|
512
|
-
}
|
|
513
|
-
async setVolume(t) {
|
|
514
|
-
this.player.setVolume(t);
|
|
515
|
-
}
|
|
516
|
-
async setMuted(t) {
|
|
517
|
-
this.player.setMuted(t);
|
|
518
|
-
}
|
|
519
|
-
async setPlaybackRate(t) {
|
|
520
|
-
}
|
|
521
|
-
async getDuration() {
|
|
522
|
-
return this.player.duration;
|
|
523
|
-
}
|
|
524
|
-
async getCurrentTime() {
|
|
525
|
-
return this.player.currentTime;
|
|
526
|
-
}
|
|
527
|
-
async getVolume() {
|
|
528
|
-
return this.player.volume;
|
|
529
|
-
}
|
|
530
|
-
async getPlaybackRate() {
|
|
531
|
-
return 1;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
var V = /* @__PURE__ */ ((s) => (s[s.Play = 2] = "Play", s[s.Pause = 3] = "Pause", s[s.End = 4] = "End", s))(V || {});
|
|
535
|
-
const P = class P extends C {
|
|
536
|
-
constructor() {
|
|
537
|
-
super(...arguments);
|
|
538
|
-
y(this, "duration");
|
|
539
|
-
y(this, "currentTime");
|
|
540
|
-
y(this, "volume");
|
|
541
|
-
y(this, "handleMessage", (t) => {
|
|
542
|
-
var n, c, r, i, d, h, p, m, g, b, w, o, u, I;
|
|
543
|
-
if (t.origin !== P.origin)
|
|
544
|
-
return;
|
|
545
|
-
const a = t.data;
|
|
546
|
-
switch (a.eventName) {
|
|
547
|
-
case "playerStatusChange":
|
|
548
|
-
this.logger.log(
|
|
549
|
-
v.Debug,
|
|
550
|
-
`player status changed: ${V[a.data.playerStatus] ?? a.data.playerStatus}`
|
|
551
|
-
);
|
|
552
|
-
break;
|
|
553
|
-
case "statusChange":
|
|
554
|
-
switch (this.logger.log(
|
|
555
|
-
v.Debug,
|
|
556
|
-
`status changed: ${V[a.data.playerStatus] ?? a.data.playerStatus}`
|
|
557
|
-
), a.data.playerStatus) {
|
|
558
|
-
case 2:
|
|
559
|
-
(c = (n = this.options) == null ? void 0 : n.onPlay) == null || c.call(n);
|
|
560
|
-
break;
|
|
561
|
-
case 3:
|
|
562
|
-
(i = (r = this.options) == null ? void 0 : r.onPause) == null || i.call(r);
|
|
563
|
-
break;
|
|
564
|
-
case 4:
|
|
565
|
-
(h = (d = this.options) == null ? void 0 : d.onEnded) == null || h.call(d);
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
568
|
-
break;
|
|
569
|
-
case "playerMetadataChange":
|
|
570
|
-
a.data.duration !== void 0 && (this.duration = a.data.duration / 1e3), this.currentTime = a.data.currentTime === void 0 ? void 0 : a.data.currentTime / 1e3, this.volume = a.data.volume, (m = (p = this.options) == null ? void 0 : p.onTimeUpdate) == null || m.call(p, {
|
|
571
|
-
duration: this.duration,
|
|
572
|
-
percent: this.currentTime !== void 0 && this.duration !== void 0 ? this.currentTime / this.duration : void 0,
|
|
573
|
-
seconds: this.currentTime
|
|
574
|
-
});
|
|
575
|
-
break;
|
|
576
|
-
case "loadComplete":
|
|
577
|
-
this.logger.log(v.Debug, "load completed"), this.duration = a.data.videoInfo.lengthInSeconds, (b = (g = this.options) == null ? void 0 : g.onLoaded) == null || b.call(g, { id: a.data.videoInfo.watchId });
|
|
578
|
-
break;
|
|
579
|
-
case "error":
|
|
580
|
-
(o = (w = this.options) == null ? void 0 : w.onError) == null || o.call(w, a);
|
|
581
|
-
break;
|
|
582
|
-
case "player-error:video:play":
|
|
583
|
-
case "player-error:video:seek":
|
|
584
|
-
(I = (u = this.options) == null ? void 0 : u.onError) == null || I.call(u, a);
|
|
585
|
-
break;
|
|
586
|
-
default:
|
|
587
|
-
this.logger.log(
|
|
588
|
-
v.Debug,
|
|
589
|
-
"message",
|
|
590
|
-
a.eventName,
|
|
591
|
-
a.data
|
|
592
|
-
);
|
|
593
|
-
break;
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
async attach() {
|
|
598
|
-
window.addEventListener("message", this.handleMessage);
|
|
599
|
-
}
|
|
600
|
-
async detach() {
|
|
601
|
-
window.removeEventListener("message", this.handleMessage);
|
|
602
|
-
}
|
|
603
|
-
async loadVideo(t) {
|
|
604
|
-
return new Promise((a, n) => {
|
|
605
|
-
this.duration = void 0, this.currentTime = void 0, this.player.onload = () => {
|
|
606
|
-
this.player.onload = null, a();
|
|
607
|
-
}, this.player.src = `https://embed.nicovideo.jp/watch/${t}?jsapi=1&playerId=1`;
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
// https://blog.hayu.io/web/create/nicovideo-embed-player-api/.
|
|
611
|
-
postMessage(t) {
|
|
612
|
-
var a;
|
|
613
|
-
(a = this.player.contentWindow) == null || a.postMessage(
|
|
614
|
-
{
|
|
615
|
-
...t,
|
|
616
|
-
playerId: "1",
|
|
617
|
-
sourceConnectorType: 1
|
|
618
|
-
},
|
|
619
|
-
P.origin
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
async play() {
|
|
623
|
-
this.postMessage({ eventName: "play" });
|
|
624
|
-
}
|
|
625
|
-
async pause() {
|
|
626
|
-
this.postMessage({ eventName: "pause" });
|
|
627
|
-
}
|
|
628
|
-
async setCurrentTime(t) {
|
|
629
|
-
this.postMessage({ eventName: "seek", data: { time: t * 1e3 } });
|
|
630
|
-
}
|
|
631
|
-
async setVolume(t) {
|
|
632
|
-
this.postMessage({
|
|
633
|
-
eventName: "volumeChange",
|
|
634
|
-
data: { volume: t }
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
async setMuted(t) {
|
|
638
|
-
this.postMessage({
|
|
639
|
-
eventName: "mute",
|
|
640
|
-
data: { mute: t }
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
async setPlaybackRate(t) {
|
|
644
|
-
}
|
|
645
|
-
async getDuration() {
|
|
646
|
-
return this.duration;
|
|
647
|
-
}
|
|
648
|
-
async getCurrentTime() {
|
|
649
|
-
return this.currentTime;
|
|
650
|
-
}
|
|
651
|
-
async getVolume() {
|
|
652
|
-
return this.volume;
|
|
653
|
-
}
|
|
654
|
-
async getPlaybackRate() {
|
|
655
|
-
return 1;
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
y(P, "origin", "https://embed.nicovideo.jp");
|
|
659
|
-
let M = P;
|
|
660
|
-
class Y extends C {
|
|
661
|
-
getDurationCore() {
|
|
662
|
-
return new Promise((e, t) => {
|
|
663
|
-
this.player.getDuration(e);
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
attach(e) {
|
|
667
|
-
return new Promise((t, a) => {
|
|
668
|
-
this.player.bind(SC.Widget.Events.READY, () => {
|
|
669
|
-
var n, c;
|
|
670
|
-
this.player.bind(
|
|
671
|
-
SC.Widget.Events.PLAY_PROGRESS,
|
|
672
|
-
async (r) => {
|
|
673
|
-
var d, h;
|
|
674
|
-
const i = await this.getDurationCore();
|
|
675
|
-
(h = (d = this.options) == null ? void 0 : d.onTimeUpdate) == null || h.call(d, {
|
|
676
|
-
duration: i / 1e3,
|
|
677
|
-
percent: r.currentPosition / i,
|
|
678
|
-
seconds: r.currentPosition / 1e3
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
), this.player.bind(
|
|
682
|
-
SC.Widget.Events.ERROR,
|
|
683
|
-
(r) => {
|
|
684
|
-
var i, d;
|
|
685
|
-
return (d = (i = this.options) == null ? void 0 : i.onError) == null ? void 0 : d.call(i, r);
|
|
686
|
-
}
|
|
687
|
-
), this.player.bind(
|
|
688
|
-
SC.Widget.Events.PLAY,
|
|
689
|
-
() => {
|
|
690
|
-
var r, i;
|
|
691
|
-
return (i = (r = this.options) == null ? void 0 : r.onPlay) == null ? void 0 : i.call(r);
|
|
692
|
-
}
|
|
693
|
-
), this.player.bind(
|
|
694
|
-
SC.Widget.Events.PAUSE,
|
|
695
|
-
() => {
|
|
696
|
-
var r, i;
|
|
697
|
-
return (i = (r = this.options) == null ? void 0 : r.onPause) == null ? void 0 : i.call(r);
|
|
698
|
-
}
|
|
699
|
-
), this.player.bind(
|
|
700
|
-
SC.Widget.Events.FINISH,
|
|
701
|
-
() => {
|
|
702
|
-
var r, i;
|
|
703
|
-
return (i = (r = this.options) == null ? void 0 : r.onEnded) == null ? void 0 : i.call(r);
|
|
704
|
-
}
|
|
705
|
-
), (c = (n = this.options) == null ? void 0 : n.onLoaded) == null || c.call(n, { id: e }), t();
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
async detach() {
|
|
710
|
-
this.player.unbind(SC.Widget.Events.READY), this.player.unbind(SC.Widget.Events.PLAY_PROGRESS), this.player.unbind(SC.Widget.Events.ERROR), this.player.unbind(SC.Widget.Events.PLAY), this.player.unbind(SC.Widget.Events.PAUSE), this.player.unbind(SC.Widget.Events.FINISH);
|
|
711
|
-
}
|
|
712
|
-
static playerLoadAsync(e, t, a) {
|
|
713
|
-
return new Promise((n, c) => {
|
|
714
|
-
e.load(t, { ...a, callback: n });
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
async loadVideo(e) {
|
|
718
|
-
var t, a;
|
|
719
|
-
await Y.playerLoadAsync(this.player, e, {
|
|
720
|
-
auto_play: !0
|
|
721
|
-
}), (a = (t = this.options) == null ? void 0 : t.onLoaded) == null || a.call(t, { id: e });
|
|
722
|
-
}
|
|
723
|
-
async play() {
|
|
724
|
-
this.player.play();
|
|
725
|
-
}
|
|
726
|
-
async pause() {
|
|
727
|
-
this.player.pause();
|
|
728
|
-
}
|
|
729
|
-
async setCurrentTime(e) {
|
|
730
|
-
this.player.seekTo(e * 1e3);
|
|
731
|
-
}
|
|
732
|
-
async setVolume(e) {
|
|
733
|
-
this.player.setVolume(e * 100);
|
|
734
|
-
}
|
|
735
|
-
async setMuted(e) {
|
|
736
|
-
this.setVolume(
|
|
737
|
-
e ? 0 : 1
|
|
738
|
-
/* TODO */
|
|
739
|
-
);
|
|
740
|
-
}
|
|
741
|
-
async setPlaybackRate(e) {
|
|
742
|
-
}
|
|
743
|
-
async getDuration() {
|
|
744
|
-
return await this.getDurationCore() / 1e3;
|
|
745
|
-
}
|
|
746
|
-
getCurrentTimeCore() {
|
|
747
|
-
return new Promise((e, t) => {
|
|
748
|
-
this.player.getPosition(e);
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
async getCurrentTime() {
|
|
752
|
-
return await this.getCurrentTimeCore() / 1e3;
|
|
753
|
-
}
|
|
754
|
-
getVolumeCore() {
|
|
755
|
-
return new Promise((e, t) => {
|
|
756
|
-
this.player.getVolume(e);
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
async getVolume() {
|
|
760
|
-
return await this.getVolumeCore() / 100;
|
|
761
|
-
}
|
|
762
|
-
async getPlaybackRate() {
|
|
763
|
-
return 1;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
class de extends C {
|
|
767
|
-
constructor() {
|
|
768
|
-
super(...arguments);
|
|
769
|
-
y(this, "handleReady", () => {
|
|
770
|
-
var t, a;
|
|
771
|
-
(a = (t = this.options) == null ? void 0 : t.onLoaded) == null || a.call(t, { id: this.player.getVideo() });
|
|
772
|
-
});
|
|
773
|
-
y(this, "handlePlay", () => {
|
|
774
|
-
var t, a;
|
|
775
|
-
(a = (t = this.options) == null ? void 0 : t.onPlay) == null || a.call(t);
|
|
776
|
-
});
|
|
777
|
-
y(this, "handlePause", () => {
|
|
778
|
-
var t, a;
|
|
779
|
-
(a = (t = this.options) == null ? void 0 : t.onPause) == null || a.call(t);
|
|
780
|
-
});
|
|
781
|
-
y(this, "handleEnded", () => {
|
|
782
|
-
var t, a;
|
|
783
|
-
(a = (t = this.options) == null ? void 0 : t.onEnded) == null || a.call(t);
|
|
784
|
-
});
|
|
785
|
-
y(this, "handleSeek", () => {
|
|
786
|
-
var t, a;
|
|
787
|
-
(a = (t = this.options) == null ? void 0 : t.onTimeUpdate) == null || a.call(t, {
|
|
788
|
-
duration: 0,
|
|
789
|
-
percent: 0,
|
|
790
|
-
seconds: 0
|
|
791
|
-
});
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
async attach(t) {
|
|
795
|
-
this.player.addEventListener(Twitch.Player.READY, this.handleReady), this.player.addEventListener(Twitch.Player.PLAYING, this.handlePlay), this.player.addEventListener(Twitch.Player.PAUSE, this.handlePause), this.player.addEventListener(Twitch.Player.ENDED, this.handleEnded), this.player.addEventListener(Twitch.Player.SEEK, this.handleSeek);
|
|
796
|
-
}
|
|
797
|
-
async detach() {
|
|
798
|
-
}
|
|
799
|
-
async loadVideo(t) {
|
|
800
|
-
this.player.setVideo(t, 0);
|
|
801
|
-
}
|
|
802
|
-
async play() {
|
|
803
|
-
this.player.play();
|
|
804
|
-
}
|
|
805
|
-
async pause() {
|
|
806
|
-
this.player.pause();
|
|
807
|
-
}
|
|
808
|
-
async setCurrentTime(t) {
|
|
809
|
-
this.player.seek(t);
|
|
810
|
-
}
|
|
811
|
-
async setVolume(t) {
|
|
812
|
-
this.player.setVolume(t);
|
|
813
|
-
}
|
|
814
|
-
async setMuted(t) {
|
|
815
|
-
this.player.setMuted(t);
|
|
816
|
-
}
|
|
817
|
-
async setPlaybackRate(t) {
|
|
818
|
-
}
|
|
819
|
-
async getDuration() {
|
|
820
|
-
return this.player.getDuration();
|
|
821
|
-
}
|
|
822
|
-
async getCurrentTime() {
|
|
823
|
-
return this.player.getCurrentTime();
|
|
824
|
-
}
|
|
825
|
-
async getVolume() {
|
|
826
|
-
return this.player.getVolume();
|
|
827
|
-
}
|
|
828
|
-
async getPlaybackRate() {
|
|
829
|
-
return 1;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
class ue extends C {
|
|
833
|
-
async attach() {
|
|
834
|
-
await this.player.ready(), this.player.on("error", (e) => {
|
|
835
|
-
var t, a;
|
|
836
|
-
return (a = (t = this.options) == null ? void 0 : t.onError) == null ? void 0 : a.call(t, e);
|
|
837
|
-
}), this.player.on(
|
|
838
|
-
"loaded",
|
|
839
|
-
(e) => {
|
|
840
|
-
var t, a;
|
|
841
|
-
return (a = (t = this.options) == null ? void 0 : t.onLoaded) == null ? void 0 : a.call(t, { id: e.id.toString() });
|
|
842
|
-
}
|
|
843
|
-
), this.player.on("play", () => {
|
|
844
|
-
var e, t;
|
|
845
|
-
return (t = (e = this.options) == null ? void 0 : e.onPlay) == null ? void 0 : t.call(e);
|
|
846
|
-
}), this.player.on("pause", () => {
|
|
847
|
-
var e, t;
|
|
848
|
-
return (t = (e = this.options) == null ? void 0 : e.onPause) == null ? void 0 : t.call(e);
|
|
849
|
-
}), this.player.on("ended", () => {
|
|
850
|
-
var e, t;
|
|
851
|
-
return (t = (e = this.options) == null ? void 0 : e.onEnded) == null ? void 0 : t.call(e);
|
|
852
|
-
}), this.player.on("timeupdate", (e) => {
|
|
853
|
-
var t, a;
|
|
854
|
-
(a = (t = this.options) == null ? void 0 : t.onTimeUpdate) == null || a.call(t, {
|
|
855
|
-
duration: e.duration,
|
|
856
|
-
percent: e.percent,
|
|
857
|
-
seconds: e.seconds
|
|
858
|
-
});
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
async detach() {
|
|
862
|
-
this.player.off("error"), this.player.off("loaded"), this.player.off("play"), this.player.off("pause"), this.player.off("ended"), this.player.off("timeupdate");
|
|
863
|
-
}
|
|
864
|
-
async loadVideo(e) {
|
|
865
|
-
await this.player.loadVideo(e);
|
|
866
|
-
}
|
|
867
|
-
async play() {
|
|
868
|
-
await this.player.play();
|
|
869
|
-
}
|
|
870
|
-
async pause() {
|
|
871
|
-
await this.player.pause();
|
|
872
|
-
}
|
|
873
|
-
async setCurrentTime(e) {
|
|
874
|
-
await this.player.setCurrentTime(e);
|
|
875
|
-
}
|
|
876
|
-
async setVolume(e) {
|
|
877
|
-
await this.player.setVolume(e);
|
|
878
|
-
}
|
|
879
|
-
async setMuted(e) {
|
|
880
|
-
await this.player.setMuted(e);
|
|
881
|
-
}
|
|
882
|
-
async setPlaybackRate(e) {
|
|
883
|
-
await this.player.setPlaybackRate(e);
|
|
884
|
-
}
|
|
885
|
-
async getDuration() {
|
|
886
|
-
return this.player.getDuration();
|
|
887
|
-
}
|
|
888
|
-
async getCurrentTime() {
|
|
889
|
-
return this.player.getCurrentTime();
|
|
890
|
-
}
|
|
891
|
-
async getVolume() {
|
|
892
|
-
return this.player.getVolume();
|
|
893
|
-
}
|
|
894
|
-
async getPlaybackRate() {
|
|
895
|
-
return this.player.getPlaybackRate();
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
var O = /* @__PURE__ */ ((s) => (s[s.UNSTARTED = -1] = "UNSTARTED", s[s.ENDED = 0] = "ENDED", s[s.PLAYING = 1] = "PLAYING", s[s.PAUSED = 2] = "PAUSED", s[s.BUFFERING = 3] = "BUFFERING", s[s.CUED = 5] = "CUED", s))(O || {});
|
|
899
|
-
class he extends C {
|
|
900
|
-
constructor() {
|
|
901
|
-
super(...arguments);
|
|
902
|
-
y(this, "previousTime");
|
|
903
|
-
y(this, "timeUpdateIntervalId");
|
|
904
|
-
}
|
|
905
|
-
clearTimeUpdateInterval() {
|
|
906
|
-
this.logger.log(
|
|
907
|
-
v.Debug,
|
|
908
|
-
"clearTimeUpdateInterval",
|
|
909
|
-
this.timeUpdateIntervalId
|
|
910
|
-
), window.clearInterval(this.timeUpdateIntervalId), this.timeUpdateIntervalId = void 0;
|
|
911
|
-
}
|
|
912
|
-
invokeTimeUpdate(t) {
|
|
913
|
-
var c, r;
|
|
914
|
-
const a = t.getCurrentTime();
|
|
915
|
-
if (a === this.previousTime)
|
|
916
|
-
return;
|
|
917
|
-
const n = t.getDuration();
|
|
918
|
-
(r = (c = this.options) == null ? void 0 : c.onTimeUpdate) == null || r.call(c, {
|
|
919
|
-
duration: n,
|
|
920
|
-
percent: a / n,
|
|
921
|
-
seconds: a
|
|
922
|
-
}), this.previousTime = a;
|
|
923
|
-
}
|
|
924
|
-
setTimeUpdateInterval() {
|
|
925
|
-
this.logger.log(v.Debug, "setTimeUpdateInterval"), this.clearTimeUpdateInterval(), this.timeUpdateIntervalId = window.setInterval(
|
|
926
|
-
() => this.invokeTimeUpdate(this.player),
|
|
927
|
-
250
|
|
928
|
-
), this.logger.log(
|
|
929
|
-
v.Debug,
|
|
930
|
-
"timeUpdateIntervalId",
|
|
931
|
-
this.timeUpdateIntervalId
|
|
932
|
-
), this.invokeTimeUpdate(this.player);
|
|
933
|
-
}
|
|
934
|
-
attach(t) {
|
|
935
|
-
return new Promise((a, n) => {
|
|
936
|
-
this.player.addEventListener("onReady", async () => {
|
|
937
|
-
this.player.addEventListener(
|
|
938
|
-
"onError",
|
|
939
|
-
(c) => {
|
|
940
|
-
var r, i;
|
|
941
|
-
return (i = (r = this.options) == null ? void 0 : r.onError) == null ? void 0 : i.call(r, c.data);
|
|
942
|
-
}
|
|
943
|
-
), this.player.addEventListener(
|
|
944
|
-
"onStateChange",
|
|
945
|
-
(c) => {
|
|
946
|
-
var r, i, d, h, p, m, g, b;
|
|
947
|
-
switch (this.logger.log(
|
|
948
|
-
v.Debug,
|
|
949
|
-
`state changed: ${O[c.data]}`
|
|
950
|
-
), c.data) {
|
|
951
|
-
case YT.PlayerState.CUED:
|
|
952
|
-
(i = (r = this.options) == null ? void 0 : r.onLoaded) == null || i.call(r, { id: t });
|
|
953
|
-
break;
|
|
954
|
-
case YT.PlayerState.PLAYING:
|
|
955
|
-
(h = (d = this.options) == null ? void 0 : d.onPlay) == null || h.call(d), this.setTimeUpdateInterval();
|
|
956
|
-
break;
|
|
957
|
-
case YT.PlayerState.PAUSED:
|
|
958
|
-
(m = (p = this.options) == null ? void 0 : p.onPause) == null || m.call(p), this.clearTimeUpdateInterval();
|
|
959
|
-
break;
|
|
960
|
-
case YT.PlayerState.ENDED:
|
|
961
|
-
(b = (g = this.options) == null ? void 0 : g.onEnded) == null || b.call(g), this.clearTimeUpdateInterval();
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
), await this.loadVideo(t), a();
|
|
966
|
-
});
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
async detach() {
|
|
970
|
-
this.clearTimeUpdateInterval();
|
|
971
|
-
}
|
|
972
|
-
async loadVideo(t) {
|
|
973
|
-
this.previousTime = void 0, this.player.cueVideoById(t);
|
|
974
|
-
}
|
|
975
|
-
async play() {
|
|
976
|
-
this.player.playVideo();
|
|
977
|
-
}
|
|
978
|
-
async pause() {
|
|
979
|
-
this.player.pauseVideo();
|
|
980
|
-
}
|
|
981
|
-
async setCurrentTime(t) {
|
|
982
|
-
this.player.seekTo(t), this.invokeTimeUpdate(this.player);
|
|
983
|
-
}
|
|
984
|
-
async setVolume(t) {
|
|
985
|
-
this.player.setVolume(t * 100);
|
|
986
|
-
}
|
|
987
|
-
async setMuted(t) {
|
|
988
|
-
t ? this.player.mute() : this.player.unMute();
|
|
989
|
-
}
|
|
990
|
-
async setPlaybackRate(t) {
|
|
991
|
-
this.player.setPlaybackRate(t);
|
|
992
|
-
}
|
|
993
|
-
async getDuration() {
|
|
994
|
-
return this.player.getDuration();
|
|
995
|
-
}
|
|
996
|
-
async getCurrentTime() {
|
|
997
|
-
return this.player.getCurrentTime();
|
|
998
|
-
}
|
|
999
|
-
async getVolume() {
|
|
1000
|
-
return this.player.getVolume() / 100;
|
|
1001
|
-
}
|
|
1002
|
-
async getPlaybackRate() {
|
|
1003
|
-
return this.player.getPlaybackRate();
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
export {
|
|
1007
|
-
le as A,
|
|
1008
|
-
ce as D,
|
|
1009
|
-
v as L,
|
|
1010
|
-
M as N,
|
|
1011
|
-
D as P,
|
|
1012
|
-
Y as S,
|
|
1013
|
-
de as T,
|
|
1014
|
-
ue as V,
|
|
1015
|
-
he as Y,
|
|
1016
|
-
oe as a,
|
|
1017
|
-
ne as b,
|
|
1018
|
-
T as c,
|
|
1019
|
-
J as f,
|
|
1020
|
-
Q as u,
|
|
1021
|
-
ie as v
|
|
1022
|
-
};
|
|
1023
|
-
//# sourceMappingURL=index-eccfe7b9.js.map
|