@banou/media-player 0.8.18 → 0.8.20

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.js CHANGED
@@ -4,10 +4,10 @@ import { css as h, keyframes as g } from "@emotion/react";
4
4
  import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
5
5
  import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
6
6
  import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
7
- import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as F, Volume1 as I, Volume2 as ee, VolumeX as te } from "react-feather";
8
- import { Tooltip as ne } from "react-tooltip";
7
+ import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as F, Volume1 as I, Volume2 as L, VolumeX as R } from "react-feather";
8
+ import { Tooltip as z } from "react-tooltip";
9
9
  //#region src/lib/react/source-feature.ts
10
- var re = {
10
+ var ee = {
11
11
  indexes: [],
12
12
  thumbnails: [],
13
13
  subtitleTracks: [],
@@ -25,19 +25,19 @@ var re = {
25
25
  playbackErrors: [],
26
26
  ready: !1,
27
27
  setSourceState: () => {}
28
- }, ie = b({
28
+ }, te = b({
29
29
  name: "source",
30
- state: () => ({ ...re }),
30
+ state: () => ({ ...ee }),
31
31
  attach({ set: e }) {
32
32
  e({
33
33
  setSourceState: (t) => e(t),
34
34
  setHideUI: (t) => e({ hideUI: t })
35
35
  });
36
36
  }
37
- }), L = _({
38
- features: [...x, ie],
37
+ }), B = _({
38
+ features: [...x, te],
39
39
  displayName: "MediaPlayer"
40
- }), R = L.usePlayer, ae = (e) => {
40
+ }), V = B.usePlayer, ne = (e) => {
41
41
  if (!(!e || e === "und")) try {
42
42
  return new Intl.DisplayNames([navigator.language || "en"], {
43
43
  type: "language",
@@ -46,39 +46,39 @@ var re = {
46
46
  } catch {
47
47
  return;
48
48
  }
49
- }, oe = (e) => e?.replace(/_/g, " ").trim() || void 0, se = (e) => {
50
- let t = e.map((e) => ae(e.language) ?? oe(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
49
+ }, re = (e) => e?.replace(/_/g, " ").trim() || void 0, ie = (e) => {
50
+ let t = e.map((e) => ne(e.language) ?? re(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
51
51
  ...e,
52
52
  [t]: (e[t] ?? 0) + 1
53
53
  }), {});
54
54
  return e.map((e, r) => {
55
- let i = t[r], a = oe(e.title);
55
+ let i = t[r], a = re(e.title);
56
56
  return {
57
57
  track: e,
58
58
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
59
59
  };
60
60
  });
61
- }, ce = (e) => se(e).map(({ track: e, label: t }) => ({
61
+ }, ae = (e) => ie(e).map(({ track: e, label: t }) => ({
62
62
  id: e.streamIndex,
63
63
  label: t
64
- })), le = [
64
+ })), oe = [
65
65
  0,
66
66
  250,
67
67
  1e3,
68
68
  3e3,
69
69
  1e4
70
- ], ue = 6e4, de = 500, fe = (e) => e instanceof Error ? e.message : String(e), pe = (e) => {
70
+ ], se = 6e4, ce = 500, le = (e) => e instanceof Error ? e.message : String(e), ue = (e) => {
71
71
  let t = [], n = e?.cause;
72
72
  for (let e = 0; n != null && e < 8; e++) {
73
73
  if (typeof MediaError < "u" && n instanceof MediaError) {
74
74
  t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
75
75
  break;
76
76
  }
77
- t.push(fe(n)), n = n?.cause;
77
+ t.push(le(n)), n = n?.cause;
78
78
  }
79
79
  return t.length ? t.join("\n") : void 0;
80
- }, me = (e, t, r) => {
81
- let a = R(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, seekPrepareBudgetMs: b = de } = r ?? {}, [x, S] = m(void 0), [C, w] = m(0), T = p({
80
+ }, de = (e, t, r) => {
81
+ let a = V(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, seekPrepareBudgetMs: b = ce } = r ?? {}, [x, S] = m(void 0), [C, w] = m(0), T = p({
82
82
  count: 0,
83
83
  at: 0
84
84
  }), E = p(void 0);
@@ -117,7 +117,7 @@ var re = {
117
117
  });
118
118
  }, [a, b]), F = u((e) => {
119
119
  typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), S(e));
120
- }, [a]), I = R((e) => e.setSourceState);
120
+ }, [a]), I = V((e) => e.setSourceState);
121
121
  d(() => {
122
122
  I({
123
123
  selectSubtitleTrack: N,
@@ -137,7 +137,7 @@ var re = {
137
137
  ready: !1
138
138
  });
139
139
  let u = (t, n) => {
140
- let r = Date.now(), i = fe(t), o = pe(t), s = a.playbackErrors, c = s[s.length - 1];
140
+ let r = Date.now(), i = le(t), o = ue(t), s = a.playbackErrors, c = s[s.length - 1];
141
141
  if (c && c.message === i && c.detail === o && c.recovered === n) {
142
142
  let e = {
143
143
  ...c,
@@ -162,11 +162,11 @@ var re = {
162
162
  let t = n(e);
163
163
  if (u(e, t), t) {
164
164
  let t = performance.now();
165
- t - T.current.at > ue && (T.current = {
165
+ t - T.current.at > se && (T.current = {
166
166
  count: 0,
167
167
  at: t
168
168
  });
169
- let n = le[Math.min(T.current.count, le.length - 1)];
169
+ let n = oe[Math.min(T.current.count, oe.length - 1)];
170
170
  T.current = {
171
171
  count: T.current.count + 1,
172
172
  at: t
@@ -203,13 +203,13 @@ var re = {
203
203
  onSeek: (e) => j.current?.(e),
204
204
  onSubtitleStreams: (e) => {
205
205
  r || a.setSourceState({
206
- subtitleTracks: ce(e),
206
+ subtitleTracks: ae(e),
207
207
  ...k.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
208
208
  });
209
209
  },
210
210
  onAudioStreams: (e, t) => {
211
211
  r || a.setSourceState({
212
- audioTracks: ce(e),
212
+ audioTracks: ae(e),
213
213
  selectedAudioTrack: t
214
214
  });
215
215
  }
@@ -246,13 +246,13 @@ var re = {
246
246
  y,
247
247
  C
248
248
  ]);
249
- }, he = 5e3, ge = 6e4, _e = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
249
+ }, fe = 5e3, pe = 6e4, me = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
250
250
  let [o, s] = m([]), c = p(null), l = p(i);
251
251
  l.current = i;
252
252
  let u = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), h = p(u);
253
253
  return h.current = u, d(() => {
254
254
  if (!n || !i || !e || !t) return;
255
- let a = !1, o = null, u, d = he, f = () => {
255
+ let a = !1, o = null, u, d = fe, f = () => {
256
256
  r({
257
257
  publicPath: e,
258
258
  workerUrl: t,
@@ -268,7 +268,7 @@ var re = {
268
268
  }
269
269
  o = e, c.current = e, e.update(h.current);
270
270
  }, () => {
271
- a || (u = setTimeout(f, d), d = Math.min(d * 2, ge));
271
+ a || (u = setTimeout(f, d), d = Math.min(d * 2, pe));
272
272
  });
273
273
  };
274
274
  return f(), () => {
@@ -281,7 +281,7 @@ var re = {
281
281
  ]), d(() => {
282
282
  c.current?.update(u);
283
283
  }, [u]), o;
284
- }, z = (e, n) => {
284
+ }, he = (e, n) => {
285
285
  let r = p(null), [i, o] = m(!1), [s] = m(() => t());
286
286
  d(() => {
287
287
  if (!e || !n || !s) return;
@@ -309,7 +309,7 @@ var re = {
309
309
  mode: s,
310
310
  burnedIn: i
311
311
  };
312
- }, B = {
312
+ }, H = {
313
313
  headings: {
314
314
  large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
315
315
  medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
@@ -336,14 +336,14 @@ var re = {
336
336
  medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
337
337
  regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
338
338
  }
339
- }, ve = h`
339
+ }, ge = h`
340
340
  top: unset !important;
341
341
  left: unset !important;
342
342
  width: 100%;
343
343
  height: 100%;
344
344
  margin: auto;
345
345
  pointer-events: none;
346
- `, ye = h`
346
+ `, _e = h`
347
347
  position: absolute;
348
348
  top: 0;
349
349
  left: 0;
@@ -351,7 +351,7 @@ var re = {
351
351
  padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
352
352
  /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
353
353
  padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
354
- ${B.headings.small}
354
+ ${H.headings.small}
355
355
  color: white;
356
356
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
357
357
  z-index: 2;
@@ -372,7 +372,7 @@ var re = {
372
372
 
373
373
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
374
374
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
375
- `, be = h`
375
+ `, ve = h`
376
376
  position: absolute;
377
377
  inset: 0;
378
378
  z-index: 2;
@@ -392,39 +392,39 @@ var re = {
392
392
  to { transform: rotate(360deg); }
393
393
  `} 0.8s linear infinite;
394
394
  }
395
- `, xe = h`
395
+ `, ye = h`
396
396
  position: absolute;
397
397
  inset: auto 0 20%;
398
398
  z-index: 3;
399
399
  padding: 0 calc(2 * var(--mp-unit));
400
400
  text-align: center;
401
401
  color: #fff;
402
- ${B.bLarge.regular}
402
+ ${H.bLarge.regular}
403
403
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
404
404
  pointer-events: none;
405
- `, Se = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ce = ({ onCanvasRef: e }) => {
406
- let t = R((e) => e.title), n = R((e) => e.hideUI), r = R((e) => e.playbackError), i = R((e) => e.ready), a = R((e) => e.size), o = R((e) => e.waiting);
405
+ `, be = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", xe = ({ onCanvasRef: e }) => {
406
+ let t = V((e) => e.title), n = V((e) => e.hideUI), r = V((e) => e.playbackError), i = V((e) => e.ready), a = V((e) => e.size), o = V((e) => e.waiting);
407
407
  return /* @__PURE__ */ w(S, { children: [
408
408
  t ? /* @__PURE__ */ C("div", {
409
409
  className: "title",
410
- css: ye,
410
+ css: _e,
411
411
  style: { ...n ? {
412
412
  opacity: "0",
413
413
  pointerEvents: "none"
414
414
  } : {} },
415
415
  children: t
416
416
  }) : void 0,
417
- (a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: be }) : void 0,
417
+ (a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: ve }) : void 0,
418
418
  r ? /* @__PURE__ */ C("div", {
419
- css: xe,
420
- children: Se(r)
419
+ css: ye,
420
+ children: be(r)
421
421
  }) : void 0,
422
422
  /* @__PURE__ */ C("canvas", {
423
423
  ref: e,
424
- css: ve
424
+ css: ge
425
425
  })
426
426
  ] });
427
- }, V = 1e-4, H = 1, U = (e) => Math.max(V, Math.min(H, e)) ** 2, W = (e) => Math.max(V, Math.min(H, e)) ** (H / 2), G = (e) => {
427
+ }, Se = 1e-4, U = 1, Ce = (e) => Math.max(Se, Math.min(U, e)) ** 2, W = (e) => Math.max(Se, Math.min(U, e)) ** (U / 2), G = (e) => {
428
428
  if (e === void 0) return "0:00";
429
429
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
430
430
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
@@ -460,7 +460,7 @@ var re = {
460
460
  z-index: 3;
461
461
 
462
462
  * {
463
- ${B.bMedium.regular}
463
+ ${H.bMedium.regular}
464
464
  }
465
465
 
466
466
  ${e === "sm" && h`
@@ -506,7 +506,7 @@ var re = {
506
506
  "data-tooltip-delay-hide": i,
507
507
  "data-tooltip-place": o,
508
508
  children: n
509
- }), !s && /* @__PURE__ */ C(ne, {
509
+ }), !s && /* @__PURE__ */ C(z, {
510
510
  ref: u,
511
511
  css: Te(c),
512
512
  id: e,
@@ -606,7 +606,7 @@ var re = {
606
606
  box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
607
607
 
608
608
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
609
- ${B.bMedium.bold}
609
+ ${H.bMedium.bold}
610
610
 
611
611
  position: absolute;
612
612
  /* Anchored on its bottom edge rather than its top: now that it has a background its height
@@ -724,7 +724,7 @@ var re = {
724
724
  --thumbnail-half: calc(9 * var(--mp-unit));
725
725
  }
726
726
  `, ke = 4, Ae = () => {
727
- let e = R(), t = R((e) => e.currentTime), n = R((e) => e.requestSeek), r = R((e) => e.duration), i = R((e) => e.size), a = R((e) => e.downloadedRanges), o = R((e) => e.indexes), s = R((e) => e.thumbnails), c = R((e) => e.thumbnailAt), l = p(null), [u, h] = m(void 0), [g, _] = m(void 0), v = p(void 0), y = p(0), b = p(void 0), x = p(void 0), S = p(!1), { dragging: T, handlers: E } = J({
727
+ let e = V(), t = V((e) => e.currentTime), n = V((e) => e.requestSeek), r = V((e) => e.duration), i = V((e) => e.size), a = V((e) => e.downloadedRanges), o = V((e) => e.indexes), s = V((e) => e.thumbnails), c = V((e) => e.thumbnailAt), l = p(null), [u, h] = m(void 0), [g, _] = m(void 0), v = p(void 0), y = p(0), b = p(void 0), x = p(void 0), S = p(!1), { dragging: T, handlers: E } = J({
728
728
  ref: l,
729
729
  onChange: (e) => {
730
730
  if (y.current += 1, b.current = e, x.current === void 0) x.current = e;
@@ -943,7 +943,7 @@ var re = {
943
943
 
944
944
  border-radius: 8px;
945
945
  background-color: rgba(28,28,28,0.95);
946
- ${B.bMedium.regular}
946
+ ${H.bMedium.regular}
947
947
 
948
948
  z-index: 4;
949
949
 
@@ -986,7 +986,7 @@ var re = {
986
986
 
987
987
  .secondary {
988
988
  color: #eee;
989
- ${B.bSmall.regular}
989
+ ${H.bSmall.regular}
990
990
  }
991
991
  }
992
992
  }
@@ -1028,7 +1028,7 @@ var re = {
1028
1028
  .failed {
1029
1029
  border-bottom: 1px solid #4D4D4E;
1030
1030
  color: #f66;
1031
- ${B.bSmall.regular}
1031
+ ${H.bSmall.regular}
1032
1032
  }
1033
1033
  }
1034
1034
  `, Ie = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
@@ -1143,7 +1143,7 @@ ${X}
1143
1143
 
1144
1144
  color: #fff;
1145
1145
  cursor: pointer;
1146
- ${B.bSmall.regular}
1146
+ ${H.bSmall.regular}
1147
1147
 
1148
1148
  &:hover {
1149
1149
  background-color: rgba(255,255,255,.1);
@@ -1164,7 +1164,7 @@ ${X}
1164
1164
 
1165
1165
  .when {
1166
1166
  color: #bbb;
1167
- ${B.bSmall.regular}
1167
+ ${H.bSmall.regular}
1168
1168
 
1169
1169
  /* the one part of the line worth scanning for, so it is the one part at full brightness */
1170
1170
  .count {
@@ -1183,7 +1183,7 @@ ${X}
1183
1183
  color: #ddd;
1184
1184
  overflow-wrap: anywhere;
1185
1185
  white-space: pre-wrap;
1186
- ${B.bSmall.regular}
1186
+ ${H.bSmall.regular}
1187
1187
  }
1188
1188
  }
1189
1189
  }
@@ -1195,7 +1195,7 @@ ${X}
1195
1195
  e.detail
1196
1196
  ].filter(Boolean).join("\n");
1197
1197
  }).join("\n\n"), Ve = () => {
1198
- let e = R((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
1198
+ let e = V((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Z(), [i, a] = m(!1);
1199
1199
  if (e.length === 0) return null;
1200
1200
  let o = () => {
1201
1201
  navigator.clipboard?.writeText(Be(e)).then(() => {
@@ -1310,7 +1310,7 @@ width: 100%;
1310
1310
  }
1311
1311
  }
1312
1312
  `, Ue = () => {
1313
- let e = R(), t = R((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = J({
1313
+ let e = V(), t = V((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = J({
1314
1314
  ref: r,
1315
1315
  onChange: (t) => e.setPlaybackRate(l(t))
1316
1316
  }), f = (t) => {
@@ -1404,7 +1404,7 @@ ${X}
1404
1404
  }
1405
1405
 
1406
1406
  `, Ge = () => {
1407
- let e = R(), t = R((e) => e.playbackRate), n = R((e) => e.audioTracks), r = R((e) => e.selectedAudioTrack), i = R((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Z({ onReset: () => o(0) }), p = (t) => {
1407
+ let e = V(), t = V((e) => e.playbackRate), n = V((e) => e.audioTracks), r = V((e) => e.selectedAudioTrack), i = V((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = Z({ onReset: () => o(0) }), p = (t) => {
1408
1408
  e.setPlaybackRate(t), o(0);
1409
1409
  }, h = (e) => {
1410
1410
  e !== void 0 && f(e, () => i(e));
@@ -1505,7 +1505,7 @@ position: static;
1505
1505
 
1506
1506
  ${X}
1507
1507
  `, qe = () => {
1508
- let e = R((e) => e.subtitleTracks), t = R((e) => e.selectedSubtitleTrack), n = R((e) => e.selectSubtitleTrack), r = R((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
1508
+ let e = V((e) => e.subtitleTracks), t = V((e) => e.selectedSubtitleTrack), n = V((e) => e.selectSubtitleTrack), r = V((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Z();
1509
1509
  if (e.length === 0) return null;
1510
1510
  let u = t !== void 0;
1511
1511
  return /* @__PURE__ */ w("div", {
@@ -1584,7 +1584,7 @@ ${X}
1584
1584
  height: 10px;
1585
1585
  }
1586
1586
  `, Xe = ({ value: e, onChange: t }) => {
1587
- let n = R((e) => e.volume), r = R((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
1587
+ let n = V((e) => e.volume), r = V((e) => e.muted), i = p(null), a = p(null), { handlers: o } = J({
1588
1588
  ref: a,
1589
1589
  onChange: t
1590
1590
  }), s = (n) => {
@@ -1647,7 +1647,7 @@ ${X}
1647
1647
  border-radius: 4px;
1648
1648
 
1649
1649
  .volume-value {
1650
- ${B.bMedium.regular};
1650
+ ${H.bMedium.regular};
1651
1651
  color: #ffffff;
1652
1652
  }
1653
1653
  }
@@ -1686,7 +1686,7 @@ ${X}
1686
1686
  }
1687
1687
 
1688
1688
  `, Qe = ({ ref: e }) => {
1689
- let t = R(), n = R((e) => e.volume), r = R((e) => e.muted), i = f(() => W(n), [n]);
1689
+ let t = V(), n = V((e) => e.volume), r = V((e) => e.muted), i = f(() => W(n), [n]);
1690
1690
  return /* @__PURE__ */ w("div", {
1691
1691
  css: Ze,
1692
1692
  children: [/* @__PURE__ */ C(q, {
@@ -1698,7 +1698,7 @@ ${X}
1698
1698
  ref: e,
1699
1699
  "aria-label": "Mute",
1700
1700
  "aria-pressed": r || n === 0,
1701
- children: C(r || n === 0 ? te : n <= .5 ? I : ee, {
1701
+ children: C(r || n === 0 ? R : n <= .5 ? I : L, {
1702
1702
  size: 18,
1703
1703
  color: "#fff"
1704
1704
  })
@@ -1711,7 +1711,7 @@ ${X}
1711
1711
  children: /* @__PURE__ */ C(Xe, {
1712
1712
  value: r ? 0 : i,
1713
1713
  onChange: (e) => {
1714
- t.setVolume(U(e));
1714
+ t.setVolume(Ce(e));
1715
1715
  }
1716
1716
  })
1717
1717
  })
@@ -1833,7 +1833,7 @@ ${X}
1833
1833
 
1834
1834
  .left {
1835
1835
  .time {
1836
- ${B.bMedium.regular}
1836
+ ${H.bMedium.regular}
1837
1837
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
1838
1838
  }
1839
1839
  }
@@ -1855,9 +1855,9 @@ ${X}
1855
1855
  }
1856
1856
  }
1857
1857
  `, nt = () => {
1858
- let e = R(), t = R((e) => e.paused), n = R((e) => e.currentTime), r = R((e) => e.duration), i = R((e) => e.fullscreen), a = R((e) => e.hideUI), o = R((e) => e.togglePictureInPicture), s = R((e) => e.pictureInPictureMode), c = R((e) => e.burnedInSubtitles), l = R((e) => e.subtitleTracks), f = R((e) => e.requestSeek), [p, h] = m(null), g = s === "burn-in", _ = l.length > 0, v = r > 0 && n === r, y = u(({ direction: t, stepSize: n }) => {
1858
+ let e = V(), t = V((e) => e.paused), n = V((e) => e.currentTime), r = V((e) => e.duration), i = V((e) => e.fullscreen), a = V((e) => e.hideUI), o = V((e) => e.togglePictureInPicture), s = V((e) => e.pictureInPictureMode), c = V((e) => e.burnedInSubtitles), l = V((e) => e.subtitleTracks), f = V((e) => e.requestSeek), [p, h] = m(null), g = s === "burn-in", _ = l.length > 0, v = r > 0 && n === r, y = u(({ direction: t, stepSize: n }) => {
1859
1859
  let r = W(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
1860
- e.setVolume(U(a)), o && !e.muted && e.toggleMuted();
1860
+ e.setVolume(Ce(a)), o && !e.muted && e.toggleMuted();
1861
1861
  }, [e]);
1862
1862
  d(() => {
1863
1863
  let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
@@ -2015,12 +2015,12 @@ ${X}
2015
2015
  }
2016
2016
 
2017
2017
  .title {
2018
- ${B.bMedium.bold}
2018
+ ${H.bMedium.bold}
2019
2019
  color: #fff;
2020
2020
  }
2021
2021
 
2022
2022
  .body {
2023
- ${B.bSmall.regular}
2023
+ ${H.bSmall.regular}
2024
2024
  color: rgba(255, 255, 255, 0.75);
2025
2025
  }
2026
2026
 
@@ -2032,7 +2032,7 @@ ${X}
2032
2032
  color: #fff;
2033
2033
  }
2034
2034
  `, at = () => {
2035
- let e = R((e) => e.burnedInSubtitles), t = R((e) => e.pictureInPictureMode), [n, r] = m(!1);
2035
+ let e = V((e) => e.burnedInSubtitles), t = V((e) => e.pictureInPictureMode), [n, r] = m(!1);
2036
2036
  return d(() => {
2037
2037
  if (t !== "burn-in" || !e) {
2038
2038
  r(!1);
@@ -2113,16 +2113,36 @@ ${X}
2113
2113
  item: e
2114
2114
  }];
2115
2115
  }), ut = ({ ref: e, onVideoRef: t, onCanvasRef: n, overlay: r, controls: i, children: a }) => {
2116
- let o = R(), s = R((e) => e.hideUI), c = R((e) => e.setHideUI), l = p(void 0), u = p("mouse");
2116
+ let o = V(), s = V((e) => e.hideUI), c = V((e) => e.setHideUI), l = p(void 0), u = p("mouse"), f = p({
2117
+ x: -1,
2118
+ y: -1
2119
+ }), m = p(null);
2117
2120
  d(() => () => clearTimeout(l.current), []);
2118
- let f = () => {
2119
- c(!1), clearTimeout(l.current), l.current = setTimeout(() => c(!0), ot);
2121
+ let h = (t) => {
2122
+ m.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2123
+ }, g = () => {
2124
+ if (u.current !== "mouse") return !1;
2125
+ let { x: e, y: t } = f.current;
2126
+ if (!m.current || e < 0) return !1;
2127
+ let n = document.elementFromPoint(e, t);
2128
+ return !!n && m.current.contains(n) && !n.closest(".video");
2129
+ }, _ = () => {
2130
+ if (g()) {
2131
+ l.current = setTimeout(_, ot);
2132
+ return;
2133
+ }
2134
+ c(!0);
2135
+ }, v = () => {
2136
+ c(!1), clearTimeout(l.current), l.current = setTimeout(_, ot);
2120
2137
  };
2121
2138
  return /* @__PURE__ */ w("div", {
2122
2139
  css: ct,
2123
- ref: e,
2140
+ ref: h,
2124
2141
  onPointerMove: (e) => {
2125
- u.current = e.pointerType, e.pointerType === "mouse" && f();
2142
+ u.current = e.pointerType, e.pointerType === "mouse" && (f.current = {
2143
+ x: e.clientX,
2144
+ y: e.clientY
2145
+ }, v());
2126
2146
  },
2127
2147
  onPointerDown: (e) => {
2128
2148
  u.current = e.pointerType;
@@ -2135,7 +2155,7 @@ ${X}
2135
2155
  },
2136
2156
  className: s ? "hide" : "",
2137
2157
  children: [
2138
- /* @__PURE__ */ C(Ce, { onCanvasRef: n }),
2158
+ /* @__PURE__ */ C(xe, { onCanvasRef: n }),
2139
2159
  lt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2140
2160
  css: st,
2141
2161
  style: { ...s ? {
@@ -2154,7 +2174,7 @@ ${X}
2154
2174
  o.togglePaused();
2155
2175
  return;
2156
2176
  }
2157
- s ? f() : (clearTimeout(l.current), c(!0));
2177
+ s ? v() : (clearTimeout(l.current), c(!0));
2158
2178
  },
2159
2179
  children: [t ? /* @__PURE__ */ C("video", {
2160
2180
  ref: t,
@@ -2164,70 +2184,88 @@ ${X}
2164
2184
  ]
2165
2185
  });
2166
2186
  }, dt = ({ options: e, children: t }) => {
2167
- let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead: u, thumbnailsEnabled: f } = r ?? {}, p = y(), h = v(), [g, _] = m(null), [b, x] = m(null), S = n?.media ?? g;
2168
- d(() => (p?.(S), () => p?.(null)), [S, p]), me(g, b, r);
2169
- let w = _e({
2187
+ let n = "media" in e ? e : null, r = n ? null : e, { title: i } = e, { size: a, downloadedRanges: o, publicPath: s, libavWorkerUrl: c, read: l, thumbnailRead: u, thumbnailsEnabled: f } = r ?? {}, h = y(), g = v(), [_, b] = m(null), [x, S] = m(null), w = n?.media ?? _;
2188
+ d(() => (h?.(w), () => h?.(null)), [w, h]);
2189
+ let { expose: T } = e, E = T === !0 ? {} : T || void 0, D = p(E);
2190
+ D.current = E;
2191
+ let O = E ? E.id : void 0, k = E ? E.origin : void 0, A = E ? E.channel : void 0;
2192
+ d(() => {
2193
+ if (!T || !w) return;
2194
+ let e, t = !1;
2195
+ return import("./remote/index.js").then(({ exposePlayer: n }) => {
2196
+ t || (e = n(w, D.current ?? {}));
2197
+ }).catch(() => {}), () => {
2198
+ t = !0, e?.();
2199
+ };
2200
+ }, [
2201
+ w,
2202
+ !!T,
2203
+ O,
2204
+ k,
2205
+ A
2206
+ ]), de(_, x, r);
2207
+ let j = me({
2170
2208
  publicPath: s,
2171
2209
  workerUrl: c,
2172
2210
  length: f === !1 ? void 0 : a,
2173
2211
  read: u ?? l,
2174
2212
  downloadedRanges: o
2175
- }), T = n?.thumbnails?.all ?? w, { toggle: E, mode: D, burnedIn: O } = z(g, b), k = R((e) => e.setSourceState);
2213
+ }), M = n?.thumbnails?.all ?? j, { toggle: N, mode: P, burnedIn: F } = he(_, x), I = V((e) => e.setSourceState);
2176
2214
  d(() => {
2177
- k({
2215
+ I({
2178
2216
  title: i,
2179
2217
  size: a,
2180
2218
  downloadedRanges: o
2181
2219
  });
2182
2220
  }, [
2183
- k,
2221
+ I,
2184
2222
  i,
2185
2223
  a,
2186
2224
  o
2187
2225
  ]);
2188
- let A = n?.thumbnails?.at;
2226
+ let L = n?.thumbnails?.at;
2189
2227
  d(() => {
2190
- k({
2191
- thumbnails: T,
2192
- thumbnailAt: A,
2193
- togglePictureInPicture: E,
2194
- pictureInPictureMode: D,
2195
- burnedInSubtitles: O
2228
+ I({
2229
+ thumbnails: M,
2230
+ thumbnailAt: L,
2231
+ togglePictureInPicture: N,
2232
+ pictureInPictureMode: P,
2233
+ burnedInSubtitles: F
2196
2234
  });
2197
2235
  }, [
2198
- k,
2199
- T,
2200
- A,
2201
- E,
2202
- D,
2203
- O
2236
+ I,
2237
+ M,
2238
+ L,
2239
+ N,
2240
+ P,
2241
+ F
2204
2242
  ]);
2205
- let j = n?.subtitles?.selection, M = n?.audioTracks?.selection;
2243
+ let R = n?.subtitles?.selection, z = n?.audioTracks?.selection;
2206
2244
  return d(() => {
2207
- j && k({
2208
- subtitleTracks: j.options.map(({ id: e, label: t, disabled: n }) => ({
2245
+ R && I({
2246
+ subtitleTracks: R.options.map(({ id: e, label: t, disabled: n }) => ({
2209
2247
  id: e,
2210
2248
  label: t,
2211
2249
  disabled: n
2212
2250
  })),
2213
- selectedSubtitleTrack: j.selectedId ?? void 0,
2214
- selectSubtitleTrack: (e) => j.select(e == null ? null : String(e)),
2215
- subtitleOffLabel: j.offLabel
2251
+ selectedSubtitleTrack: R.selectedId ?? void 0,
2252
+ selectSubtitleTrack: (e) => R.select(e == null ? null : String(e)),
2253
+ subtitleOffLabel: R.offLabel
2216
2254
  });
2217
- }, [k, j]), d(() => {
2218
- M && k({
2219
- audioTracks: M.options.map(({ id: e, label: t, disabled: n }) => ({
2255
+ }, [I, R]), d(() => {
2256
+ z && I({
2257
+ audioTracks: z.options.map(({ id: e, label: t, disabled: n }) => ({
2220
2258
  id: e,
2221
2259
  label: t,
2222
2260
  disabled: n
2223
2261
  })),
2224
- selectedAudioTrack: M.selectedId ?? void 0,
2225
- selectAudioTrack: (e) => M.select(String(e))
2262
+ selectedAudioTrack: z.selectedId ?? void 0,
2263
+ selectAudioTrack: (e) => z.select(String(e))
2226
2264
  });
2227
- }, [k, M]), /* @__PURE__ */ C(ut, {
2228
- ref: h,
2229
- onVideoRef: n ? void 0 : _,
2230
- onCanvasRef: x,
2265
+ }, [I, z]), /* @__PURE__ */ C(ut, {
2266
+ ref: g,
2267
+ onVideoRef: n ? void 0 : b,
2268
+ onCanvasRef: S,
2231
2269
  overlay: e.overlay,
2232
2270
  controls: e.controls,
2233
2271
  children: t
@@ -2304,7 +2342,7 @@ ${X}
2304
2342
  overflow: hidden;
2305
2343
  `, pt = (e) => /* @__PURE__ */ C("div", {
2306
2344
  css: ft,
2307
- children: /* @__PURE__ */ C(L.Provider, { children: /* @__PURE__ */ C(dt, {
2345
+ children: /* @__PURE__ */ C(B.Provider, { children: /* @__PURE__ */ C(dt, {
2308
2346
  options: e,
2309
2347
  children: e.children
2310
2348
  }) })
@@ -2347,4 +2385,4 @@ ${X}
2347
2385
  throw Error(`Unknown source type: ${e}`);
2348
2386
  };
2349
2387
  //#endregion
2350
- export { pt as MediaPlayer, pt as default, L as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, yt as inputToRemuxerInput, ht as isDelegatedTracks, mt as isExternalThumbnails, ie as sourceFeature, i as startPlayback, z as usePictureInPicture, R as usePlayer, _e as useSeekThumbnails };
2388
+ export { pt as MediaPlayer, pt as default, B as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, yt as inputToRemuxerInput, ht as isDelegatedTracks, mt as isExternalThumbnails, te as sourceFeature, i as startPlayback, he as usePictureInPicture, V as usePlayer, me as useSeekThumbnails };