@aigamo/nostalgic-diva 1.4.0 → 1.5.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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +375 -350
- package/dist/index.es.js.map +1 -1
- package/dist/players/AudioPlayerApi.d.ts +1 -0
- package/dist/players/NiconicoPlayerApi.d.ts +2 -0
- package/dist/players/PlayerApi.d.ts +2 -0
- package/dist/players/PlayerApiImpl.d.ts +1 -0
- package/dist/players/SoundCloudPlayerApi.d.ts +4 -2
- package/dist/players/VimeoPlayerApi.d.ts +1 -0
- package/dist/players/YouTubePlayerApi.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var W = Object.defineProperty;
|
|
2
|
-
var Y = (
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
var
|
|
2
|
+
var Y = (r, a, e) => a in r ? W(r, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[a] = e;
|
|
3
|
+
var y = (r, a, e) => (Y(r, typeof a != "symbol" ? a + "" : a, e), e);
|
|
4
|
+
import s, { useRef as V } from "react";
|
|
5
|
+
var d = /* @__PURE__ */ ((r) => (r[r.Trace = 0] = "Trace", r[r.Debug = 1] = "Debug", r[r.Information = 2] = "Information", r[r.Warning = 3] = "Warning", r[r.Error = 4] = "Error", r[r.Critical = 5] = "Critical", r[r.None = 6] = "None", r))(d || {});
|
|
6
6
|
class E {
|
|
7
|
-
constructor(
|
|
8
|
-
this.logger =
|
|
7
|
+
constructor(a, e, t) {
|
|
8
|
+
this.logger = a, this.playerElementRef = e, this.options = t, this.logger.log(d.Debug, "ctor");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
class j extends E {
|
|
12
|
-
constructor(e, t,
|
|
13
|
-
super(e, t,
|
|
14
|
-
|
|
12
|
+
constructor(e, t, i) {
|
|
13
|
+
super(e, t, i);
|
|
14
|
+
y(this, "player");
|
|
15
15
|
this.player = t.current;
|
|
16
16
|
}
|
|
17
17
|
async attach() {
|
|
18
18
|
this.player.onerror = (e) => {
|
|
19
|
-
var t,
|
|
20
|
-
return (
|
|
19
|
+
var t, i;
|
|
20
|
+
return (i = (t = this.options) == null ? void 0 : t.onError) == null ? void 0 : i.call(t, e);
|
|
21
21
|
}, this.player.onloadeddata = () => {
|
|
22
22
|
var e, t;
|
|
23
23
|
return (t = (e = this.options) == null ? void 0 : e.onLoaded) == null ? void 0 : t.call(e, { id: this.player.src });
|
|
@@ -66,33 +66,36 @@ class j extends E {
|
|
|
66
66
|
async getCurrentTime() {
|
|
67
67
|
return this.player.currentTime;
|
|
68
68
|
}
|
|
69
|
+
async getVolume() {
|
|
70
|
+
return this.player.volume;
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
|
-
const
|
|
71
|
-
constructor(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.logger =
|
|
73
|
+
const S = class {
|
|
74
|
+
constructor(a, e, t, i, c, u) {
|
|
75
|
+
y(this, "id");
|
|
76
|
+
y(this, "impl");
|
|
77
|
+
this.logger = a, this.type = e, this.playerElementRef = t, this.options = i, this.loadScript = c, this.playerApiFactory = u, this.id = S.nextId++;
|
|
75
78
|
}
|
|
76
|
-
createMessage(
|
|
77
|
-
return `${this.type}#${this.id} ${
|
|
79
|
+
createMessage(a) {
|
|
80
|
+
return `${this.type}#${this.id} ${a}`;
|
|
78
81
|
}
|
|
79
|
-
debug(
|
|
82
|
+
debug(a, ...e) {
|
|
80
83
|
this.logger.log(
|
|
81
|
-
|
|
82
|
-
this.createMessage(
|
|
84
|
+
d.Debug,
|
|
85
|
+
this.createMessage(a),
|
|
83
86
|
...e
|
|
84
87
|
);
|
|
85
88
|
}
|
|
86
|
-
error(
|
|
89
|
+
error(a, ...e) {
|
|
87
90
|
this.logger.log(
|
|
88
|
-
|
|
89
|
-
this.createMessage(
|
|
91
|
+
d.Error,
|
|
92
|
+
this.createMessage(a),
|
|
90
93
|
...e
|
|
91
94
|
);
|
|
92
95
|
}
|
|
93
|
-
async attach(
|
|
96
|
+
async attach(a) {
|
|
94
97
|
var e;
|
|
95
|
-
if (this.debug("attach",
|
|
98
|
+
if (this.debug("attach", a), this.impl) {
|
|
96
99
|
this.debug("player is already attached");
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
@@ -100,7 +103,7 @@ const U = class {
|
|
|
100
103
|
this.logger,
|
|
101
104
|
this.playerElementRef,
|
|
102
105
|
this.options
|
|
103
|
-
), await this.impl.attach(
|
|
106
|
+
), await this.impl.attach(a), this.debug("player attached");
|
|
104
107
|
}
|
|
105
108
|
createPlayerNotAttachedError() {
|
|
106
109
|
return new Error("player is not attached");
|
|
@@ -110,10 +113,10 @@ const U = class {
|
|
|
110
113
|
throw this.createPlayerNotAttachedError();
|
|
111
114
|
await this.impl.detach(), this.impl = void 0;
|
|
112
115
|
}
|
|
113
|
-
async loadVideo(
|
|
114
|
-
if (this.debug("loadVideo",
|
|
116
|
+
async loadVideo(a) {
|
|
117
|
+
if (this.debug("loadVideo", a), this.impl === void 0)
|
|
115
118
|
throw this.createPlayerNotAttachedError();
|
|
116
|
-
this.debug("Loading video..."), await this.impl.loadVideo(
|
|
119
|
+
this.debug("Loading video..."), await this.impl.loadVideo(a), this.debug("video loaded", a);
|
|
117
120
|
}
|
|
118
121
|
play() {
|
|
119
122
|
if (this.debug("play"), this.impl === void 0)
|
|
@@ -125,20 +128,20 @@ const U = class {
|
|
|
125
128
|
throw this.createPlayerNotAttachedError();
|
|
126
129
|
return this.impl.pause();
|
|
127
130
|
}
|
|
128
|
-
setCurrentTime(
|
|
129
|
-
if (this.debug("setCurrentTime",
|
|
131
|
+
setCurrentTime(a) {
|
|
132
|
+
if (this.debug("setCurrentTime", a), this.impl === void 0)
|
|
130
133
|
throw this.createPlayerNotAttachedError();
|
|
131
|
-
return this.impl.setCurrentTime(
|
|
134
|
+
return this.impl.setCurrentTime(a);
|
|
132
135
|
}
|
|
133
|
-
setVolume(
|
|
134
|
-
if (this.debug("setVolume",
|
|
136
|
+
setVolume(a) {
|
|
137
|
+
if (this.debug("setVolume", a), this.impl === void 0)
|
|
135
138
|
throw this.createPlayerNotAttachedError();
|
|
136
|
-
return this.impl.setVolume(
|
|
139
|
+
return this.impl.setVolume(a);
|
|
137
140
|
}
|
|
138
|
-
setMuted(
|
|
139
|
-
if (this.debug("setMuted",
|
|
141
|
+
setMuted(a) {
|
|
142
|
+
if (this.debug("setMuted", a), this.impl === void 0)
|
|
140
143
|
throw this.createPlayerNotAttachedError();
|
|
141
|
-
return this.impl.setMuted(
|
|
144
|
+
return this.impl.setMuted(a);
|
|
142
145
|
}
|
|
143
146
|
getDuration() {
|
|
144
147
|
if (this.debug("getDuration"), this.impl === void 0)
|
|
@@ -150,60 +153,65 @@ const U = class {
|
|
|
150
153
|
throw this.createPlayerNotAttachedError();
|
|
151
154
|
return this.impl.getCurrentTime();
|
|
152
155
|
}
|
|
156
|
+
getVolume() {
|
|
157
|
+
if (this.debug("getVolume"), this.impl === void 0)
|
|
158
|
+
throw this.createPlayerNotAttachedError();
|
|
159
|
+
return this.impl.getVolume();
|
|
160
|
+
}
|
|
153
161
|
};
|
|
154
|
-
let
|
|
155
|
-
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
return
|
|
162
|
+
let f = S;
|
|
163
|
+
y(f, "nextId", 1);
|
|
164
|
+
function $() {
|
|
165
|
+
const r = V(!0);
|
|
166
|
+
return r.current ? (r.current = !1, !0) : r.current;
|
|
159
167
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
162
|
-
const e =
|
|
163
|
-
return
|
|
168
|
+
const x = (r, a) => r === a;
|
|
169
|
+
function G(r, a = x) {
|
|
170
|
+
const e = V(), t = V(r);
|
|
171
|
+
return !$() && !a(t.current, r) && (e.current = t.current, t.current = r), e.current;
|
|
164
172
|
}
|
|
165
173
|
const b = ({
|
|
166
|
-
logger:
|
|
167
|
-
type:
|
|
174
|
+
logger: r,
|
|
175
|
+
type: a,
|
|
168
176
|
playerApiRef: e,
|
|
169
177
|
videoId: t,
|
|
170
|
-
options:
|
|
178
|
+
options: i,
|
|
171
179
|
loadScript: c,
|
|
172
|
-
playerApiFactory:
|
|
173
|
-
children:
|
|
180
|
+
playerApiFactory: u,
|
|
181
|
+
children: o
|
|
174
182
|
}) => {
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
a,
|
|
183
|
+
r.log(d.Debug, "PlayerContainer");
|
|
184
|
+
const l = s.useRef(t), p = s.useRef(void 0), [h, w] = s.useState();
|
|
185
|
+
s.useEffect(() => {
|
|
186
|
+
const n = new f(
|
|
180
187
|
r,
|
|
181
|
-
|
|
182
|
-
|
|
188
|
+
a,
|
|
189
|
+
p,
|
|
190
|
+
i,
|
|
183
191
|
c,
|
|
184
|
-
|
|
192
|
+
u
|
|
185
193
|
);
|
|
186
|
-
return e && (e.current =
|
|
187
|
-
if (e &&
|
|
194
|
+
return e && (e.current = n), n.attach(l.current).then(() => w(n)), () => {
|
|
195
|
+
if (e && n !== e.current)
|
|
188
196
|
throw new Error("playerApi differs");
|
|
189
|
-
|
|
197
|
+
n.detach().then(() => w(void 0));
|
|
190
198
|
};
|
|
191
|
-
}, [
|
|
192
|
-
const
|
|
193
|
-
return
|
|
194
|
-
|
|
195
|
-
}, [
|
|
196
|
-
}, B =
|
|
197
|
-
({ ...
|
|
198
|
-
const { logger:
|
|
199
|
-
return
|
|
199
|
+
}, [r, a, i, c, u, e]);
|
|
200
|
+
const g = G(t);
|
|
201
|
+
return s.useEffect(() => {
|
|
202
|
+
g !== void 0 && (h == null || h.loadVideo(t));
|
|
203
|
+
}, [g, t, h]), /* @__PURE__ */ s.createElement(s.Fragment, null, o(p, l.current));
|
|
204
|
+
}, B = s.memo(
|
|
205
|
+
({ ...r }) => {
|
|
206
|
+
const { logger: a } = r;
|
|
207
|
+
return a.log(d.Debug, "AudioPlayer"), /* @__PURE__ */ s.createElement(
|
|
200
208
|
b,
|
|
201
209
|
{
|
|
202
|
-
...
|
|
210
|
+
...r,
|
|
203
211
|
loadScript: void 0,
|
|
204
212
|
playerApiFactory: j
|
|
205
213
|
},
|
|
206
|
-
(e, t) => /* @__PURE__ */
|
|
214
|
+
(e, t) => /* @__PURE__ */ s.createElement(
|
|
207
215
|
"audio",
|
|
208
216
|
{
|
|
209
217
|
ref: e,
|
|
@@ -217,70 +225,71 @@ const b = ({
|
|
|
217
225
|
);
|
|
218
226
|
}
|
|
219
227
|
);
|
|
220
|
-
var
|
|
221
|
-
const
|
|
222
|
-
constructor(e, t,
|
|
223
|
-
super(e, t,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
var I = /* @__PURE__ */ ((r) => (r[r.Play = 2] = "Play", r[r.Pause = 3] = "Pause", r[r.End = 4] = "End", r))(I || {});
|
|
229
|
+
const D = class extends E {
|
|
230
|
+
constructor(e, t, i) {
|
|
231
|
+
super(e, t, i);
|
|
232
|
+
y(this, "player");
|
|
233
|
+
y(this, "duration");
|
|
234
|
+
y(this, "currentTime");
|
|
235
|
+
y(this, "volume");
|
|
236
|
+
y(this, "handleMessage", (e) => {
|
|
237
|
+
var i, c, u, o, l, p, h, w, g, n, m, U, v, M;
|
|
238
|
+
if (e.origin !== D.origin)
|
|
239
|
+
return;
|
|
240
|
+
const t = e.data;
|
|
241
|
+
switch (t.eventName) {
|
|
242
|
+
case "playerStatusChange":
|
|
243
|
+
this.logger.log(
|
|
244
|
+
d.Debug,
|
|
245
|
+
`player status changed: ${I[t.data.playerStatus] ?? t.data.playerStatus}`
|
|
246
|
+
);
|
|
247
|
+
break;
|
|
248
|
+
case "statusChange":
|
|
249
|
+
switch (this.logger.log(
|
|
250
|
+
d.Debug,
|
|
251
|
+
`status changed: ${I[t.data.playerStatus] ?? t.data.playerStatus}`
|
|
252
|
+
), t.data.playerStatus) {
|
|
253
|
+
case 2:
|
|
254
|
+
(c = (i = this.options) == null ? void 0 : i.onPlay) == null || c.call(i);
|
|
255
|
+
break;
|
|
256
|
+
case 3:
|
|
257
|
+
(o = (u = this.options) == null ? void 0 : u.onPause) == null || o.call(u);
|
|
258
|
+
break;
|
|
259
|
+
case 4:
|
|
260
|
+
(p = (l = this.options) == null ? void 0 : l.onEnded) == null || p.call(l);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case "playerMetadataChange":
|
|
265
|
+
t.data.duration !== void 0 && (this.duration = t.data.duration / 1e3), this.currentTime = t.data.currentTime === void 0 ? void 0 : t.data.currentTime / 1e3, this.volume = t.data.volume, (w = (h = this.options) == null ? void 0 : h.onTimeUpdate) == null || w.call(h, {
|
|
266
|
+
duration: this.duration,
|
|
267
|
+
percent: this.currentTime !== void 0 && this.duration !== void 0 ? this.currentTime / this.duration : void 0,
|
|
268
|
+
seconds: this.currentTime
|
|
269
|
+
});
|
|
270
|
+
break;
|
|
271
|
+
case "loadComplete":
|
|
272
|
+
this.logger.log(d.Debug, "load completed"), this.duration = t.data.videoInfo.lengthInSeconds, (n = (g = this.options) == null ? void 0 : g.onLoaded) == null || n.call(g, { id: t.data.videoInfo.watchId });
|
|
273
|
+
break;
|
|
274
|
+
case "error":
|
|
275
|
+
(U = (m = this.options) == null ? void 0 : m.onError) == null || U.call(m, t);
|
|
276
|
+
break;
|
|
277
|
+
case "player-error:video:play":
|
|
278
|
+
case "player-error:video:seek":
|
|
279
|
+
(M = (v = this.options) == null ? void 0 : v.onError) == null || M.call(v, t);
|
|
280
|
+
break;
|
|
281
|
+
default:
|
|
282
|
+
this.logger.log(
|
|
283
|
+
d.Debug,
|
|
284
|
+
"message",
|
|
285
|
+
t.eventName,
|
|
286
|
+
t.data
|
|
287
|
+
);
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
227
291
|
this.player = t.current;
|
|
228
292
|
}
|
|
229
|
-
handleMessage(e) {
|
|
230
|
-
var s, c, d, n, o, y, p, g, l, h, v, V, f, M;
|
|
231
|
-
if (e.origin !== P.origin)
|
|
232
|
-
return;
|
|
233
|
-
const t = e.data;
|
|
234
|
-
switch (t.eventName) {
|
|
235
|
-
case "playerStatusChange":
|
|
236
|
-
this.logger.log(
|
|
237
|
-
u.Debug,
|
|
238
|
-
`player status changed: ${k[t.data.playerStatus] ?? t.data.playerStatus}`
|
|
239
|
-
);
|
|
240
|
-
break;
|
|
241
|
-
case "statusChange":
|
|
242
|
-
switch (this.logger.log(
|
|
243
|
-
u.Debug,
|
|
244
|
-
`status changed: ${k[t.data.playerStatus] ?? t.data.playerStatus}`
|
|
245
|
-
), t.data.playerStatus) {
|
|
246
|
-
case 2:
|
|
247
|
-
(c = (s = this.options) == null ? void 0 : s.onPlay) == null || c.call(s);
|
|
248
|
-
break;
|
|
249
|
-
case 3:
|
|
250
|
-
(n = (d = this.options) == null ? void 0 : d.onPause) == null || n.call(d);
|
|
251
|
-
break;
|
|
252
|
-
case 4:
|
|
253
|
-
(y = (o = this.options) == null ? void 0 : o.onEnded) == null || y.call(o);
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
break;
|
|
257
|
-
case "playerMetadataChange":
|
|
258
|
-
t.data.duration !== void 0 && (this.duration = t.data.duration / 1e3), this.currentTime = t.data.currentTime === void 0 ? void 0 : t.data.currentTime / 1e3, (g = (p = this.options) == null ? void 0 : p.onTimeUpdate) == null || g.call(p, {
|
|
259
|
-
duration: this.duration,
|
|
260
|
-
percent: this.currentTime !== void 0 && this.duration !== void 0 ? this.currentTime / this.duration : void 0,
|
|
261
|
-
seconds: this.currentTime
|
|
262
|
-
});
|
|
263
|
-
break;
|
|
264
|
-
case "loadComplete":
|
|
265
|
-
this.logger.log(u.Debug, "load completed"), this.duration = t.data.videoInfo.lengthInSeconds, (h = (l = this.options) == null ? void 0 : l.onLoaded) == null || h.call(l, { id: t.data.videoInfo.watchId });
|
|
266
|
-
break;
|
|
267
|
-
case "error":
|
|
268
|
-
(V = (v = this.options) == null ? void 0 : v.onError) == null || V.call(v, t);
|
|
269
|
-
break;
|
|
270
|
-
case "player-error:video:play":
|
|
271
|
-
case "player-error:video:seek":
|
|
272
|
-
(M = (f = this.options) == null ? void 0 : f.onError) == null || M.call(f, t);
|
|
273
|
-
break;
|
|
274
|
-
default:
|
|
275
|
-
this.logger.log(
|
|
276
|
-
u.Debug,
|
|
277
|
-
"message",
|
|
278
|
-
t.eventName,
|
|
279
|
-
t.data
|
|
280
|
-
);
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
293
|
async attach() {
|
|
285
294
|
window.addEventListener("message", this.handleMessage);
|
|
286
295
|
}
|
|
@@ -288,7 +297,7 @@ const P = class extends E {
|
|
|
288
297
|
window.removeEventListener("message", this.handleMessage);
|
|
289
298
|
}
|
|
290
299
|
async loadVideo(e) {
|
|
291
|
-
return new Promise((t,
|
|
300
|
+
return new Promise((t, i) => {
|
|
292
301
|
this.duration = void 0, this.currentTime = void 0, this.player.onload = () => {
|
|
293
302
|
this.player.onload = null, t();
|
|
294
303
|
}, this.player.src = `https://embed.nicovideo.jp/watch/${e}?jsapi=1&playerId=1`;
|
|
@@ -303,7 +312,7 @@ const P = class extends E {
|
|
|
303
312
|
playerId: "1",
|
|
304
313
|
sourceConnectorType: 1
|
|
305
314
|
},
|
|
306
|
-
|
|
315
|
+
D.origin
|
|
307
316
|
);
|
|
308
317
|
}
|
|
309
318
|
async play() {
|
|
@@ -333,20 +342,23 @@ const P = class extends E {
|
|
|
333
342
|
async getCurrentTime() {
|
|
334
343
|
return this.currentTime;
|
|
335
344
|
}
|
|
345
|
+
async getVolume() {
|
|
346
|
+
return this.volume;
|
|
347
|
+
}
|
|
336
348
|
};
|
|
337
|
-
let C =
|
|
338
|
-
|
|
339
|
-
const O =
|
|
340
|
-
({ ...
|
|
341
|
-
const { logger:
|
|
342
|
-
return
|
|
349
|
+
let C = D;
|
|
350
|
+
y(C, "origin", "https://embed.nicovideo.jp");
|
|
351
|
+
const O = s.memo(
|
|
352
|
+
({ ...r }) => {
|
|
353
|
+
const { logger: a } = r;
|
|
354
|
+
return a.log(d.Debug, "NiconicoPlayer"), /* @__PURE__ */ s.createElement(
|
|
343
355
|
b,
|
|
344
356
|
{
|
|
345
|
-
...
|
|
357
|
+
...r,
|
|
346
358
|
loadScript: void 0,
|
|
347
359
|
playerApiFactory: C
|
|
348
360
|
},
|
|
349
|
-
(e, t) => /* @__PURE__ */
|
|
361
|
+
(e, t) => /* @__PURE__ */ s.createElement("div", { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ s.createElement(
|
|
350
362
|
"iframe",
|
|
351
363
|
{
|
|
352
364
|
ref: e,
|
|
@@ -360,165 +372,168 @@ const O = i.memo(
|
|
|
360
372
|
))
|
|
361
373
|
);
|
|
362
374
|
}
|
|
363
|
-
), R =
|
|
375
|
+
), R = s.createContext(
|
|
364
376
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
365
377
|
void 0
|
|
366
378
|
), H = new class {
|
|
367
379
|
constructor() {
|
|
368
|
-
|
|
380
|
+
y(this, "title", "nostalgic-diva");
|
|
369
381
|
}
|
|
370
|
-
createMessage(
|
|
371
|
-
return `[${this.title}] ${
|
|
382
|
+
createMessage(r) {
|
|
383
|
+
return `[${this.title}] ${r}`;
|
|
372
384
|
}
|
|
373
|
-
debug(
|
|
374
|
-
console.debug(this.createMessage(
|
|
385
|
+
debug(r, ...a) {
|
|
386
|
+
console.debug(this.createMessage(r), ...a);
|
|
375
387
|
}
|
|
376
|
-
error(
|
|
377
|
-
console.error(this.createMessage(
|
|
388
|
+
error(r, ...a) {
|
|
389
|
+
console.error(this.createMessage(r), ...a);
|
|
378
390
|
}
|
|
379
|
-
warn(
|
|
380
|
-
console.warn(this.createMessage(
|
|
391
|
+
warn(r, ...a) {
|
|
392
|
+
console.warn(this.createMessage(r), ...a);
|
|
381
393
|
}
|
|
382
394
|
isEnabled() {
|
|
383
395
|
return !0;
|
|
384
396
|
}
|
|
385
|
-
log(
|
|
386
|
-
switch (
|
|
387
|
-
case
|
|
388
|
-
this.debug(
|
|
397
|
+
log(r, a, ...e) {
|
|
398
|
+
switch (r) {
|
|
399
|
+
case d.Debug:
|
|
400
|
+
this.debug(a, ...e);
|
|
389
401
|
break;
|
|
390
|
-
case
|
|
391
|
-
this.warn(
|
|
402
|
+
case d.Warning:
|
|
403
|
+
this.warn(a, ...e);
|
|
392
404
|
break;
|
|
393
|
-
case
|
|
394
|
-
this.error(
|
|
405
|
+
case d.Error:
|
|
406
|
+
this.error(a, ...e);
|
|
395
407
|
break;
|
|
396
408
|
}
|
|
397
409
|
}
|
|
398
410
|
}(), ee = ({
|
|
399
|
-
logger:
|
|
400
|
-
children:
|
|
411
|
+
logger: r = H,
|
|
412
|
+
children: a
|
|
401
413
|
}) => {
|
|
402
|
-
const e =
|
|
403
|
-
var
|
|
404
|
-
await ((
|
|
405
|
-
}, []),
|
|
406
|
-
var
|
|
407
|
-
await ((
|
|
408
|
-
}, []), c =
|
|
409
|
-
var
|
|
410
|
-
await ((
|
|
411
|
-
}, []),
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
}, []),
|
|
415
|
-
var
|
|
416
|
-
await ((
|
|
417
|
-
}, []),
|
|
418
|
-
var
|
|
419
|
-
await ((
|
|
420
|
-
}, []),
|
|
421
|
-
var
|
|
422
|
-
return await ((
|
|
423
|
-
}, []),
|
|
424
|
-
var
|
|
425
|
-
return await ((
|
|
426
|
-
}, []),
|
|
414
|
+
const e = s.useRef(), t = s.useCallback(async (n) => {
|
|
415
|
+
var m;
|
|
416
|
+
await ((m = e.current) == null ? void 0 : m.loadVideo(n));
|
|
417
|
+
}, []), i = s.useCallback(async () => {
|
|
418
|
+
var n;
|
|
419
|
+
await ((n = e.current) == null ? void 0 : n.play());
|
|
420
|
+
}, []), c = s.useCallback(async () => {
|
|
421
|
+
var n;
|
|
422
|
+
await ((n = e.current) == null ? void 0 : n.pause());
|
|
423
|
+
}, []), u = s.useCallback(async (n) => {
|
|
424
|
+
const m = e.current;
|
|
425
|
+
m && (await m.setCurrentTime(n), await m.play());
|
|
426
|
+
}, []), o = s.useCallback(async (n) => {
|
|
427
|
+
var m;
|
|
428
|
+
await ((m = e.current) == null ? void 0 : m.setVolume(n));
|
|
429
|
+
}, []), l = s.useCallback(async (n) => {
|
|
430
|
+
var m;
|
|
431
|
+
await ((m = e.current) == null ? void 0 : m.setMuted(n));
|
|
432
|
+
}, []), p = s.useCallback(async () => {
|
|
433
|
+
var n;
|
|
434
|
+
return await ((n = e.current) == null ? void 0 : n.getDuration());
|
|
435
|
+
}, []), h = s.useCallback(async () => {
|
|
436
|
+
var n;
|
|
437
|
+
return await ((n = e.current) == null ? void 0 : n.getCurrentTime());
|
|
438
|
+
}, []), w = s.useCallback(async () => {
|
|
439
|
+
var n;
|
|
440
|
+
return await ((n = e.current) == null ? void 0 : n.getVolume());
|
|
441
|
+
}, []), g = s.useMemo(
|
|
427
442
|
() => ({
|
|
428
|
-
logger:
|
|
443
|
+
logger: r,
|
|
429
444
|
playerApiRef: e,
|
|
430
445
|
loadVideo: t,
|
|
431
|
-
play:
|
|
446
|
+
play: i,
|
|
432
447
|
pause: c,
|
|
433
|
-
setCurrentTime:
|
|
434
|
-
setVolume:
|
|
435
|
-
setMuted:
|
|
436
|
-
getDuration:
|
|
437
|
-
getCurrentTime:
|
|
448
|
+
setCurrentTime: u,
|
|
449
|
+
setVolume: o,
|
|
450
|
+
setMuted: l,
|
|
451
|
+
getDuration: p,
|
|
452
|
+
getCurrentTime: h,
|
|
453
|
+
getVolume: w
|
|
438
454
|
}),
|
|
439
455
|
[
|
|
440
|
-
|
|
456
|
+
r,
|
|
441
457
|
t,
|
|
442
|
-
|
|
458
|
+
i,
|
|
443
459
|
c,
|
|
444
|
-
|
|
445
|
-
n,
|
|
460
|
+
u,
|
|
446
461
|
o,
|
|
447
|
-
|
|
448
|
-
p
|
|
462
|
+
l,
|
|
463
|
+
p,
|
|
464
|
+
h,
|
|
465
|
+
w
|
|
449
466
|
]
|
|
450
467
|
);
|
|
451
|
-
return /* @__PURE__ */
|
|
452
|
-
}, q = () =>
|
|
453
|
-
class
|
|
454
|
-
constructor(e, t,
|
|
455
|
-
super(e, t,
|
|
456
|
-
|
|
468
|
+
return /* @__PURE__ */ s.createElement(R.Provider, { value: g }, a);
|
|
469
|
+
}, q = () => s.useContext(R);
|
|
470
|
+
class A extends E {
|
|
471
|
+
constructor(e, t, i) {
|
|
472
|
+
super(e, t, i);
|
|
473
|
+
y(this, "player");
|
|
457
474
|
this.player = SC.Widget(this.playerElementRef.current);
|
|
458
475
|
}
|
|
459
|
-
|
|
460
|
-
return new Promise((
|
|
461
|
-
|
|
476
|
+
getDurationCore() {
|
|
477
|
+
return new Promise((e, t) => {
|
|
478
|
+
this.player.getDuration(e);
|
|
462
479
|
});
|
|
463
480
|
}
|
|
464
481
|
attach(e) {
|
|
465
|
-
return new Promise((t,
|
|
482
|
+
return new Promise((t, i) => {
|
|
466
483
|
this.player.bind(SC.Widget.Events.READY, () => {
|
|
467
|
-
var c,
|
|
484
|
+
var c, u;
|
|
468
485
|
this.player.bind(
|
|
469
486
|
SC.Widget.Events.PLAY_PROGRESS,
|
|
470
|
-
async (
|
|
471
|
-
var
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
percent: n.currentPosition / o,
|
|
478
|
-
seconds: n.currentPosition / 1e3
|
|
487
|
+
async (o) => {
|
|
488
|
+
var p, h;
|
|
489
|
+
const l = await this.getDurationCore();
|
|
490
|
+
(h = (p = this.options) == null ? void 0 : p.onTimeUpdate) == null || h.call(p, {
|
|
491
|
+
duration: l / 1e3,
|
|
492
|
+
percent: o.currentPosition / l,
|
|
493
|
+
seconds: o.currentPosition / 1e3
|
|
479
494
|
});
|
|
480
495
|
}
|
|
481
496
|
), this.player.bind(
|
|
482
497
|
SC.Widget.Events.ERROR,
|
|
483
|
-
(
|
|
484
|
-
var
|
|
485
|
-
return (
|
|
498
|
+
(o) => {
|
|
499
|
+
var l, p;
|
|
500
|
+
return (p = (l = this.options) == null ? void 0 : l.onError) == null ? void 0 : p.call(l, o);
|
|
486
501
|
}
|
|
487
502
|
), this.player.bind(
|
|
488
503
|
SC.Widget.Events.PLAY,
|
|
489
504
|
() => {
|
|
490
|
-
var
|
|
491
|
-
return (
|
|
505
|
+
var o, l;
|
|
506
|
+
return (l = (o = this.options) == null ? void 0 : o.onPlay) == null ? void 0 : l.call(o);
|
|
492
507
|
}
|
|
493
508
|
), this.player.bind(
|
|
494
509
|
SC.Widget.Events.PAUSE,
|
|
495
510
|
() => {
|
|
496
|
-
var
|
|
497
|
-
return (
|
|
511
|
+
var o, l;
|
|
512
|
+
return (l = (o = this.options) == null ? void 0 : o.onPause) == null ? void 0 : l.call(o);
|
|
498
513
|
}
|
|
499
514
|
), this.player.bind(
|
|
500
515
|
SC.Widget.Events.FINISH,
|
|
501
516
|
() => {
|
|
502
|
-
var
|
|
503
|
-
return (
|
|
517
|
+
var o, l;
|
|
518
|
+
return (l = (o = this.options) == null ? void 0 : o.onEnded) == null ? void 0 : l.call(o);
|
|
504
519
|
}
|
|
505
|
-
), (
|
|
520
|
+
), (u = (c = this.options) == null ? void 0 : c.onLoaded) == null || u.call(c, { id: e }), t();
|
|
506
521
|
});
|
|
507
522
|
});
|
|
508
523
|
}
|
|
509
524
|
async detach() {
|
|
510
525
|
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);
|
|
511
526
|
}
|
|
512
|
-
static playerLoadAsync(e, t,
|
|
513
|
-
return new Promise((c,
|
|
514
|
-
e.load(t, { ...
|
|
527
|
+
static playerLoadAsync(e, t, i) {
|
|
528
|
+
return new Promise((c, u) => {
|
|
529
|
+
e.load(t, { ...i, callback: c });
|
|
515
530
|
});
|
|
516
531
|
}
|
|
517
532
|
async loadVideo(e) {
|
|
518
|
-
var t,
|
|
519
|
-
await
|
|
533
|
+
var t, i;
|
|
534
|
+
await A.playerLoadAsync(this.player, e, {
|
|
520
535
|
auto_play: !0
|
|
521
|
-
}), (
|
|
536
|
+
}), (i = (t = this.options) == null ? void 0 : t.onLoaded) == null || i.call(t, { id: e });
|
|
522
537
|
}
|
|
523
538
|
async play() {
|
|
524
539
|
this.player.play();
|
|
@@ -539,64 +554,68 @@ class w extends E {
|
|
|
539
554
|
);
|
|
540
555
|
}
|
|
541
556
|
async getDuration() {
|
|
542
|
-
return await
|
|
543
|
-
this.player
|
|
544
|
-
) / 1e3;
|
|
557
|
+
return await this.getDurationCore() / 1e3;
|
|
545
558
|
}
|
|
546
|
-
|
|
547
|
-
return new Promise((
|
|
548
|
-
|
|
559
|
+
getCurrentTimeCore() {
|
|
560
|
+
return new Promise((e, t) => {
|
|
561
|
+
this.player.getPosition(e);
|
|
549
562
|
});
|
|
550
563
|
}
|
|
551
564
|
async getCurrentTime() {
|
|
552
|
-
return await
|
|
553
|
-
|
|
554
|
-
|
|
565
|
+
return await this.getCurrentTimeCore() / 1e3;
|
|
566
|
+
}
|
|
567
|
+
getVolumeCore() {
|
|
568
|
+
return new Promise((e, t) => {
|
|
569
|
+
this.player.getVolume(e);
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
async getVolume() {
|
|
573
|
+
return await this.getVolumeCore() / 100;
|
|
555
574
|
}
|
|
556
575
|
}
|
|
557
|
-
function z(
|
|
558
|
-
return new Promise((
|
|
576
|
+
function z(r) {
|
|
577
|
+
return new Promise((a, e) => {
|
|
559
578
|
const t = document.createElement("script");
|
|
560
|
-
t.src =
|
|
561
|
-
const
|
|
562
|
-
|
|
579
|
+
t.src = r, t.async = !0, t.onerror = e, t.onload = t.onreadystatechange = function() {
|
|
580
|
+
const i = this.readyState;
|
|
581
|
+
i && i !== "loaded" && i !== "complete" || (t.onload = t.onreadystatechange = null, a());
|
|
563
582
|
}, document.head.appendChild(t);
|
|
564
583
|
});
|
|
565
584
|
}
|
|
566
|
-
const
|
|
567
|
-
async function
|
|
568
|
-
if (
|
|
569
|
-
return
|
|
585
|
+
const P = [];
|
|
586
|
+
async function k(r, a) {
|
|
587
|
+
if (P.includes(r))
|
|
588
|
+
return a.log(d.Debug, r, "script is already loaded"), !1;
|
|
570
589
|
try {
|
|
571
|
-
return
|
|
590
|
+
return a.log(d.Debug, r, "Loading script..."), await z(r), P.includes(r) ? (a.log(d.Debug, r, "script is already loaded"), !1) : (P.push(r), a.log(d.Debug, r, "script loaded"), !0);
|
|
572
591
|
} catch (e) {
|
|
573
|
-
throw
|
|
592
|
+
throw a.log(d.Error, r, "Failed to load script"), e;
|
|
574
593
|
}
|
|
575
594
|
}
|
|
576
|
-
const J =
|
|
577
|
-
({ ...
|
|
578
|
-
const { logger:
|
|
579
|
-
|
|
580
|
-
const e =
|
|
581
|
-
await
|
|
595
|
+
const J = s.memo(
|
|
596
|
+
({ ...r }) => {
|
|
597
|
+
const { logger: a } = r;
|
|
598
|
+
a.log(d.Debug, "SoundCloudPlayer");
|
|
599
|
+
const e = s.useCallback(async () => {
|
|
600
|
+
await k(
|
|
582
601
|
"https://w.soundcloud.com/player/api.js",
|
|
583
|
-
|
|
602
|
+
a
|
|
584
603
|
);
|
|
585
|
-
}, [
|
|
586
|
-
return /* @__PURE__ */
|
|
604
|
+
}, [a]);
|
|
605
|
+
return /* @__PURE__ */ s.createElement(
|
|
587
606
|
b,
|
|
588
607
|
{
|
|
589
|
-
...
|
|
608
|
+
...r,
|
|
590
609
|
loadScript: e,
|
|
591
|
-
playerApiFactory:
|
|
610
|
+
playerApiFactory: A
|
|
592
611
|
},
|
|
593
|
-
(t,
|
|
612
|
+
(t, i) => (
|
|
594
613
|
// eslint-disable-next-line jsx-a11y/iframe-has-title
|
|
595
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ s.createElement(
|
|
596
615
|
"iframe",
|
|
597
616
|
{
|
|
598
617
|
ref: t,
|
|
599
|
-
src: `https://w.soundcloud.com/player/?url=${
|
|
618
|
+
src: `https://w.soundcloud.com/player/?url=${i}`,
|
|
600
619
|
frameBorder: 0,
|
|
601
620
|
allow: "autoplay",
|
|
602
621
|
style: { width: "100%", height: "100%" }
|
|
@@ -607,20 +626,20 @@ const J = i.memo(
|
|
|
607
626
|
}
|
|
608
627
|
);
|
|
609
628
|
class K extends E {
|
|
610
|
-
constructor(e, t,
|
|
611
|
-
super(e, t,
|
|
612
|
-
|
|
629
|
+
constructor(e, t, i) {
|
|
630
|
+
super(e, t, i);
|
|
631
|
+
y(this, "player");
|
|
613
632
|
this.player = new Vimeo.Player(this.playerElementRef.current);
|
|
614
633
|
}
|
|
615
634
|
async attach() {
|
|
616
635
|
await this.player.ready(), this.player.on("error", (e) => {
|
|
617
|
-
var t,
|
|
618
|
-
return (
|
|
636
|
+
var t, i;
|
|
637
|
+
return (i = (t = this.options) == null ? void 0 : t.onError) == null ? void 0 : i.call(t, e);
|
|
619
638
|
}), this.player.on(
|
|
620
639
|
"loaded",
|
|
621
640
|
(e) => {
|
|
622
|
-
var t,
|
|
623
|
-
return (
|
|
641
|
+
var t, i;
|
|
642
|
+
return (i = (t = this.options) == null ? void 0 : t.onLoaded) == null ? void 0 : i.call(t, { id: e.id.toString() });
|
|
624
643
|
}
|
|
625
644
|
), this.player.on("play", () => {
|
|
626
645
|
var e, t;
|
|
@@ -632,8 +651,8 @@ class K extends E {
|
|
|
632
651
|
var e, t;
|
|
633
652
|
return (t = (e = this.options) == null ? void 0 : e.onEnded) == null ? void 0 : t.call(e);
|
|
634
653
|
}), this.player.on("timeupdate", (e) => {
|
|
635
|
-
var t,
|
|
636
|
-
(
|
|
654
|
+
var t, i;
|
|
655
|
+
(i = (t = this.options) == null ? void 0 : t.onTimeUpdate) == null || i.call(t, {
|
|
637
656
|
duration: e.duration,
|
|
638
657
|
percent: e.percent,
|
|
639
658
|
seconds: e.seconds
|
|
@@ -662,36 +681,39 @@ class K extends E {
|
|
|
662
681
|
await this.player.setMuted(e);
|
|
663
682
|
}
|
|
664
683
|
async getDuration() {
|
|
665
|
-
return
|
|
684
|
+
return this.player.getDuration();
|
|
666
685
|
}
|
|
667
686
|
async getCurrentTime() {
|
|
668
687
|
return await this.player.getCurrentTime();
|
|
669
688
|
}
|
|
689
|
+
async getVolume() {
|
|
690
|
+
return await this.player.getVolume();
|
|
691
|
+
}
|
|
670
692
|
}
|
|
671
|
-
const Q =
|
|
672
|
-
({ ...
|
|
673
|
-
const { logger:
|
|
674
|
-
|
|
675
|
-
const e =
|
|
676
|
-
await
|
|
693
|
+
const Q = s.memo(
|
|
694
|
+
({ ...r }) => {
|
|
695
|
+
const { logger: a } = r;
|
|
696
|
+
a.log(d.Debug, "VimeoPlayer");
|
|
697
|
+
const e = s.useCallback(async () => {
|
|
698
|
+
await k(
|
|
677
699
|
"https://player.vimeo.com/api/player.js",
|
|
678
|
-
|
|
700
|
+
a
|
|
679
701
|
);
|
|
680
|
-
}, [
|
|
681
|
-
return /* @__PURE__ */
|
|
702
|
+
}, [a]);
|
|
703
|
+
return /* @__PURE__ */ s.createElement(
|
|
682
704
|
b,
|
|
683
705
|
{
|
|
684
|
-
...
|
|
706
|
+
...r,
|
|
685
707
|
loadScript: e,
|
|
686
708
|
playerApiFactory: K
|
|
687
709
|
},
|
|
688
|
-
(t,
|
|
710
|
+
(t, i) => (
|
|
689
711
|
// eslint-disable-next-line jsx-a11y/iframe-has-title
|
|
690
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ s.createElement(
|
|
691
713
|
"iframe",
|
|
692
714
|
{
|
|
693
715
|
ref: t,
|
|
694
|
-
src: `https://player.vimeo.com/video/${
|
|
716
|
+
src: `https://player.vimeo.com/video/${i}`,
|
|
695
717
|
frameBorder: 0,
|
|
696
718
|
allow: "autoplay",
|
|
697
719
|
style: { width: "100%", height: "100%" }
|
|
@@ -701,76 +723,76 @@ const Q = i.memo(
|
|
|
701
723
|
);
|
|
702
724
|
}
|
|
703
725
|
);
|
|
704
|
-
var F = /* @__PURE__ */ ((
|
|
705
|
-
const
|
|
706
|
-
constructor(e, t,
|
|
707
|
-
super(e, t,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
726
|
+
var F = /* @__PURE__ */ ((r) => (r[r.UNSTARTED = -1] = "UNSTARTED", r[r.ENDED = 0] = "ENDED", r[r.PLAYING = 1] = "PLAYING", r[r.PAUSED = 2] = "PAUSED", r[r.BUFFERING = 3] = "BUFFERING", r[r.CUED = 5] = "CUED", r))(F || {});
|
|
727
|
+
const N = class extends E {
|
|
728
|
+
constructor(e, t, i) {
|
|
729
|
+
super(e, t, i);
|
|
730
|
+
y(this, "player");
|
|
731
|
+
y(this, "previousTime");
|
|
732
|
+
y(this, "timeUpdateIntervalId");
|
|
711
733
|
this.player = new YT.Player(this.playerElementRef.current, {
|
|
712
|
-
host:
|
|
734
|
+
host: N.origin,
|
|
713
735
|
width: "100%",
|
|
714
736
|
height: "100%"
|
|
715
737
|
});
|
|
716
738
|
}
|
|
717
739
|
clearTimeUpdateInterval() {
|
|
718
740
|
this.logger.log(
|
|
719
|
-
|
|
741
|
+
d.Debug,
|
|
720
742
|
"clearTimeUpdateInterval",
|
|
721
743
|
this.timeUpdateIntervalId
|
|
722
744
|
), window.clearInterval(this.timeUpdateIntervalId), this.timeUpdateIntervalId = void 0;
|
|
723
745
|
}
|
|
724
746
|
invokeTimeUpdate(e) {
|
|
725
|
-
var c,
|
|
747
|
+
var c, u;
|
|
726
748
|
const t = e.getCurrentTime();
|
|
727
749
|
if (t === this.previousTime)
|
|
728
750
|
return;
|
|
729
|
-
const
|
|
730
|
-
(
|
|
731
|
-
duration:
|
|
732
|
-
percent: t /
|
|
751
|
+
const i = e.getDuration();
|
|
752
|
+
(u = (c = this.options) == null ? void 0 : c.onTimeUpdate) == null || u.call(c, {
|
|
753
|
+
duration: i,
|
|
754
|
+
percent: t / i,
|
|
733
755
|
seconds: t
|
|
734
756
|
}), this.previousTime = t;
|
|
735
757
|
}
|
|
736
758
|
setTimeUpdateInterval() {
|
|
737
|
-
this.logger.log(
|
|
759
|
+
this.logger.log(d.Debug, "setTimeUpdateInterval"), this.clearTimeUpdateInterval(), this.timeUpdateIntervalId = window.setInterval(
|
|
738
760
|
() => this.invokeTimeUpdate(this.player),
|
|
739
761
|
250
|
|
740
762
|
), this.logger.log(
|
|
741
|
-
|
|
763
|
+
d.Debug,
|
|
742
764
|
"timeUpdateIntervalId",
|
|
743
765
|
this.timeUpdateIntervalId
|
|
744
766
|
), this.invokeTimeUpdate(this.player);
|
|
745
767
|
}
|
|
746
768
|
attach(e) {
|
|
747
|
-
return new Promise((t,
|
|
769
|
+
return new Promise((t, i) => {
|
|
748
770
|
this.player.addEventListener("onReady", async () => {
|
|
749
771
|
this.player.addEventListener(
|
|
750
772
|
"onError",
|
|
751
773
|
(c) => {
|
|
752
|
-
var
|
|
753
|
-
return (
|
|
774
|
+
var u, o;
|
|
775
|
+
return (o = (u = this.options) == null ? void 0 : u.onError) == null ? void 0 : o.call(u, c.data);
|
|
754
776
|
}
|
|
755
777
|
), this.player.addEventListener(
|
|
756
778
|
"onStateChange",
|
|
757
779
|
(c) => {
|
|
758
|
-
var
|
|
780
|
+
var u, o, l, p, h, w, g, n;
|
|
759
781
|
switch (this.logger.log(
|
|
760
|
-
|
|
782
|
+
d.Debug,
|
|
761
783
|
`state changed: ${F[c.data]}`
|
|
762
784
|
), c.data) {
|
|
763
785
|
case YT.PlayerState.CUED:
|
|
764
|
-
(
|
|
786
|
+
(o = (u = this.options) == null ? void 0 : u.onLoaded) == null || o.call(u, { id: e });
|
|
765
787
|
break;
|
|
766
788
|
case YT.PlayerState.PLAYING:
|
|
767
|
-
(
|
|
789
|
+
(p = (l = this.options) == null ? void 0 : l.onPlay) == null || p.call(l), this.setTimeUpdateInterval();
|
|
768
790
|
break;
|
|
769
791
|
case YT.PlayerState.PAUSED:
|
|
770
|
-
(
|
|
792
|
+
(w = (h = this.options) == null ? void 0 : h.onPause) == null || w.call(h), this.clearTimeUpdateInterval();
|
|
771
793
|
break;
|
|
772
794
|
case YT.PlayerState.ENDED:
|
|
773
|
-
(
|
|
795
|
+
(n = (g = this.options) == null ? void 0 : g.onEnded) == null || n.call(g), this.clearTimeUpdateInterval();
|
|
774
796
|
break;
|
|
775
797
|
}
|
|
776
798
|
}
|
|
@@ -805,29 +827,32 @@ const S = class extends E {
|
|
|
805
827
|
async getCurrentTime() {
|
|
806
828
|
return this.player.getCurrentTime();
|
|
807
829
|
}
|
|
830
|
+
async getVolume() {
|
|
831
|
+
return this.player.getVolume();
|
|
832
|
+
}
|
|
808
833
|
};
|
|
809
|
-
let
|
|
810
|
-
|
|
811
|
-
const X =
|
|
812
|
-
({ ...
|
|
813
|
-
const { logger:
|
|
814
|
-
|
|
815
|
-
const e =
|
|
816
|
-
await
|
|
834
|
+
let T = N;
|
|
835
|
+
y(T, "origin", "https://www.youtube-nocookie.com");
|
|
836
|
+
const X = s.memo(
|
|
837
|
+
({ ...r }) => {
|
|
838
|
+
const { logger: a } = r;
|
|
839
|
+
a.log(d.Debug, "YouTubePlayer");
|
|
840
|
+
const e = s.useCallback(() => new Promise(async (t, i) => {
|
|
841
|
+
await k(
|
|
817
842
|
"https://www.youtube.com/iframe_api",
|
|
818
|
-
|
|
843
|
+
a
|
|
819
844
|
) ? window.onYouTubeIframeAPIReady = () => {
|
|
820
|
-
|
|
845
|
+
a.log(d.Debug, "YouTube iframe API ready"), t();
|
|
821
846
|
} : t();
|
|
822
|
-
}), [
|
|
823
|
-
return /* @__PURE__ */
|
|
847
|
+
}), [a]);
|
|
848
|
+
return /* @__PURE__ */ s.createElement(
|
|
824
849
|
b,
|
|
825
850
|
{
|
|
826
|
-
...
|
|
851
|
+
...r,
|
|
827
852
|
loadScript: e,
|
|
828
|
-
playerApiFactory:
|
|
853
|
+
playerApiFactory: T
|
|
829
854
|
},
|
|
830
|
-
(t) => /* @__PURE__ */
|
|
855
|
+
(t) => /* @__PURE__ */ s.createElement("div", { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ s.createElement("div", { ref: t }))
|
|
831
856
|
);
|
|
832
857
|
}
|
|
833
858
|
), Z = {
|
|
@@ -836,18 +861,18 @@ const X = i.memo(
|
|
|
836
861
|
SoundCloud: J,
|
|
837
862
|
Vimeo: Q,
|
|
838
863
|
YouTube: X
|
|
839
|
-
}, te =
|
|
840
|
-
({ type:
|
|
841
|
-
const { logger: t, playerApiRef:
|
|
842
|
-
t.log(
|
|
843
|
-
const c = Z[
|
|
844
|
-
return /* @__PURE__ */
|
|
864
|
+
}, te = s.memo(
|
|
865
|
+
({ type: r, videoId: a, options: e }) => {
|
|
866
|
+
const { logger: t, playerApiRef: i } = q();
|
|
867
|
+
t.log(d.Debug, "NostalgicDiva");
|
|
868
|
+
const c = Z[r];
|
|
869
|
+
return /* @__PURE__ */ s.createElement(
|
|
845
870
|
c,
|
|
846
871
|
{
|
|
847
872
|
logger: t,
|
|
848
|
-
type:
|
|
849
|
-
playerApiRef:
|
|
850
|
-
videoId:
|
|
873
|
+
type: r,
|
|
874
|
+
playerApiRef: i,
|
|
875
|
+
videoId: a,
|
|
851
876
|
options: e
|
|
852
877
|
}
|
|
853
878
|
);
|
|
@@ -860,13 +885,13 @@ export {
|
|
|
860
885
|
C as NiconicoPlayerApi,
|
|
861
886
|
te as NostalgicDiva,
|
|
862
887
|
ee as NostalgicDivaProvider,
|
|
863
|
-
|
|
888
|
+
f as PlayerApi,
|
|
864
889
|
J as SoundCloudPlayer,
|
|
865
|
-
|
|
890
|
+
A as SoundCloudPlayerApi,
|
|
866
891
|
Q as VimeoPlayer,
|
|
867
892
|
K as VimeoPlayerApi,
|
|
868
893
|
X as YouTubePlayer,
|
|
869
|
-
|
|
894
|
+
T as YouTubePlayerApi,
|
|
870
895
|
q as useNostalgicDiva
|
|
871
896
|
};
|
|
872
897
|
//# sourceMappingURL=index.es.js.map
|