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