@banou/media-player 0.4.1 → 0.4.3
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/build/index.js +67 -65
- package/package.json +2 -2
- package/src/components/overlay.tsx +10 -1
- package/src/components/progress-bar.tsx +4 -8
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ce from "react";
|
|
2
2
|
import fr, { forwardRef as mr, useContext as Ie, createContext as pr, useState as Z, useEffect as z, useCallback as nt, useRef as Ne, useMemo as pe } from "react";
|
|
3
|
-
import { css as
|
|
3
|
+
import { css as Q } from "@emotion/react";
|
|
4
4
|
import { createActorContext as hr } from "@xstate/react";
|
|
5
5
|
import { fromCallback as Gt, setup as vr, enqueueActions as Er, assign as Y, sendTo as X } from "xstate";
|
|
6
6
|
import qt from "p-queue";
|
|
@@ -68,7 +68,7 @@ function Or() {
|
|
|
68
68
|
return "Profiler";
|
|
69
69
|
case _:
|
|
70
70
|
return "StrictMode";
|
|
71
|
-
case
|
|
71
|
+
case ee:
|
|
72
72
|
return "Suspense";
|
|
73
73
|
case ue:
|
|
74
74
|
return "SuspenseList";
|
|
@@ -275,7 +275,7 @@ function Or() {
|
|
|
275
275
|
}
|
|
276
276
|
if (typeof i == "string") return s(i);
|
|
277
277
|
switch (i) {
|
|
278
|
-
case
|
|
278
|
+
case ee:
|
|
279
279
|
return s("Suspense");
|
|
280
280
|
case ue:
|
|
281
281
|
return s("SuspenseList");
|
|
@@ -347,7 +347,7 @@ function Or() {
|
|
|
347
347
|
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
348
348
|
}
|
|
349
349
|
function p(i, S, T, O, B, U) {
|
|
350
|
-
if (typeof i == "string" || typeof i == "function" || i === A || i === W || i === _ || i ===
|
|
350
|
+
if (typeof i == "string" || typeof i == "function" || i === A || i === W || i === _ || i === ee || i === ue || i === lt || typeof i == "object" && i !== null && (i.$$typeof === we || i.$$typeof === Te || i.$$typeof === H || i.$$typeof === D || i.$$typeof === F || i.$$typeof === dt || i.getModuleId !== void 0)) {
|
|
351
351
|
var P = S.children;
|
|
352
352
|
if (P !== void 0)
|
|
353
353
|
if (O)
|
|
@@ -435,7 +435,7 @@ Check the render method of \`` + T + "`."), S || (i = e(i)) && (S = `
|
|
|
435
435
|
|
|
436
436
|
Check the top-level render call using <` + i + ">."), S;
|
|
437
437
|
}
|
|
438
|
-
var R = fr, C = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), W = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), H = Symbol.for("react.context"), F = Symbol.for("react.forward_ref"),
|
|
438
|
+
var R = fr, C = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), W = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), H = Symbol.for("react.context"), F = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), ue = Symbol.for("react.suspense_list"), Te = Symbol.for("react.memo"), we = Symbol.for("react.lazy"), lt = Symbol.for("react.offscreen"), je = Symbol.iterator, Ye = Symbol.for("react.client.reference"), oe = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Re = Object.prototype.hasOwnProperty, ie = Object.assign, dt = Symbol.for("react.client.reference"), Ae = Array.isArray, fe = 0, ze, Fe, Ve, We, Be, Ge, qe;
|
|
439
439
|
r.__reactDisabledLog = !0;
|
|
440
440
|
var w, he, le = !1, ve = new (typeof WeakMap == "function" ? WeakMap : Map)(), dr = Symbol.for("react.client.reference"), Tt, wt = {}, Rt = {}, At = {};
|
|
441
441
|
Pe.Fragment = A, Pe.jsx = function(i, S, T, O, B) {
|
|
@@ -1192,7 +1192,7 @@ function ln() {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
|
-
var m = l, A = b, _ = u, W = s, D = t, H = d, F = r,
|
|
1195
|
+
var m = l, A = b, _ = u, W = s, D = t, H = d, F = r, ee = p, ue = y, Te = n, we = a, lt = o, je = g, Ye = !1;
|
|
1196
1196
|
function oe(w) {
|
|
1197
1197
|
return Ye || (Ye = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), Re(w) || C(w) === l;
|
|
1198
1198
|
}
|
|
@@ -1232,7 +1232,7 @@ function ln() {
|
|
|
1232
1232
|
function qe(w) {
|
|
1233
1233
|
return C(w) === g;
|
|
1234
1234
|
}
|
|
1235
|
-
L.AsyncMode = m, L.ConcurrentMode = A, L.ContextConsumer = _, L.ContextProvider = W, L.Element = D, L.ForwardRef = H, L.Fragment = F, L.Lazy =
|
|
1235
|
+
L.AsyncMode = m, L.ConcurrentMode = A, L.ContextConsumer = _, L.ContextProvider = W, L.Element = D, L.ForwardRef = H, L.Fragment = F, L.Lazy = ee, L.Memo = ue, L.Portal = Te, L.Profiler = we, L.StrictMode = lt, L.Suspense = je, L.isAsyncMode = oe, L.isConcurrentMode = Re, L.isContextConsumer = ie, L.isContextProvider = dt, L.isElement = Ae, L.isForwardRef = fe, L.isFragment = ze, L.isLazy = Fe, L.isMemo = Ve, L.isPortal = We, L.isProfiler = Be, L.isStrictMode = Ge, L.isSuspense = qe, L.isValidElementType = R, L.typeOf = C;
|
|
1236
1236
|
}()), L;
|
|
1237
1237
|
}
|
|
1238
1238
|
var $t;
|
|
@@ -1633,8 +1633,8 @@ const Pn = Gt(({ sendBack: e, receive: t, input: n }) => {
|
|
|
1633
1633
|
let H = !1;
|
|
1634
1634
|
t((F) => {
|
|
1635
1635
|
if (!H && F.type === "METADATA") {
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1636
|
+
const ee = d.addSourceBuffer(`video/mp4; codecs="${F.info.input.videoMimeType},${F.info.input.audioMimeType}"`);
|
|
1637
|
+
ee.mode = "segments", d.duration = F.info.input.duration, f = F.data, H = !0, D(ee);
|
|
1638
1638
|
}
|
|
1639
1639
|
});
|
|
1640
1640
|
},
|
|
@@ -1648,9 +1648,9 @@ const Pn = Gt(({ sendBack: e, receive: t, input: n }) => {
|
|
|
1648
1648
|
});
|
|
1649
1649
|
const C = async () => {
|
|
1650
1650
|
const D = x(), H = y(), F = Yt(c);
|
|
1651
|
-
for (const { start:
|
|
1652
|
-
|
|
1653
|
-
|
|
1651
|
+
for (const { start: ee, end: ue } of F)
|
|
1652
|
+
ee < D && await E(
|
|
1653
|
+
ee,
|
|
1654
1654
|
D
|
|
1655
1655
|
), ue > H && await E(
|
|
1656
1656
|
H,
|
|
@@ -2104,7 +2104,13 @@ ${l}`),
|
|
|
2104
2104
|
if (!e) throw new Error("Media actor not found");
|
|
2105
2105
|
if (!n) throw new Error("Duration not found");
|
|
2106
2106
|
n === r ? (e.send({ type: "SET_TIME", value: 0 }), e.send({ type: "PLAY" })) : t ? e.send({ type: "PLAY" }) : e.send({ type: "PAUSE" });
|
|
2107
|
-
}, Fn =
|
|
2107
|
+
}, Fn = Q`
|
|
2108
|
+
top: unset !important;
|
|
2109
|
+
left: unset !important;
|
|
2110
|
+
width: 100%;
|
|
2111
|
+
height: 100%;
|
|
2112
|
+
margin: auto;
|
|
2113
|
+
`, Vn = () => {
|
|
2108
2114
|
const e = $.useActorRef(), [t, n] = Z(), r = nt((o) => {
|
|
2109
2115
|
n(o);
|
|
2110
2116
|
}, []);
|
|
@@ -2113,7 +2119,7 @@ ${l}`),
|
|
|
2113
2119
|
type: "SET_CANVAS_ELEMENT",
|
|
2114
2120
|
canvasElement: t
|
|
2115
2121
|
});
|
|
2116
|
-
}, [t]), /* @__PURE__ */ h(sr, { children: /* @__PURE__ */ h("canvas", { ref: r }) });
|
|
2122
|
+
}, [t]), /* @__PURE__ */ h(sr, { children: /* @__PURE__ */ h("canvas", { ref: r, css: Fn }) });
|
|
2117
2123
|
}, xe = {
|
|
2118
2124
|
bMedium: {
|
|
2119
2125
|
bold: `
|
|
@@ -2146,7 +2152,7 @@ ${l}`),
|
|
|
2146
2152
|
}
|
|
2147
2153
|
`
|
|
2148
2154
|
}
|
|
2149
|
-
},
|
|
2155
|
+
}, Wn = (e) => Q`
|
|
2150
2156
|
display: flex;
|
|
2151
2157
|
justify-content: flex-end;
|
|
2152
2158
|
|
|
@@ -2159,13 +2165,13 @@ ${l}`),
|
|
|
2159
2165
|
${xe.bSmall.regular}
|
|
2160
2166
|
}
|
|
2161
2167
|
|
|
2162
|
-
${e === "sm" &&
|
|
2168
|
+
${e === "sm" && Q`
|
|
2163
2169
|
padding: 0.4rem!important;
|
|
2164
2170
|
`}
|
|
2165
|
-
${e === "md" &&
|
|
2171
|
+
${e === "md" && Q`
|
|
2166
2172
|
padding: 0.6rem!important;
|
|
2167
2173
|
`}
|
|
2168
|
-
${e === "lg" &&
|
|
2174
|
+
${e === "lg" && Q`
|
|
2169
2175
|
padding: 1.2rem!important;
|
|
2170
2176
|
`}
|
|
2171
2177
|
`, ge = ({
|
|
@@ -2195,13 +2201,13 @@ ${l}`),
|
|
|
2195
2201
|
!u && /* @__PURE__ */ h(
|
|
2196
2202
|
Cr,
|
|
2197
2203
|
{
|
|
2198
|
-
css:
|
|
2204
|
+
css: Wn(l),
|
|
2199
2205
|
id: e,
|
|
2200
2206
|
noArrow: !0,
|
|
2201
2207
|
children: t
|
|
2202
2208
|
}
|
|
2203
2209
|
)
|
|
2204
|
-
] }),
|
|
2210
|
+
] }), Bn = ({ ref: e, defaultValue: t }) => {
|
|
2205
2211
|
const [n, r] = Z(t), [o, a] = Z(!1), s = (u) => {
|
|
2206
2212
|
if (a(!0), !e.current) return;
|
|
2207
2213
|
const { clientX: l } = u, { left: b, right: d } = e.current.getBoundingClientRect();
|
|
@@ -2223,7 +2229,7 @@ ${l}`),
|
|
|
2223
2229
|
scrub: s,
|
|
2224
2230
|
setValue: r
|
|
2225
2231
|
};
|
|
2226
|
-
},
|
|
2232
|
+
}, Gn = Q`
|
|
2227
2233
|
position: relative;
|
|
2228
2234
|
height: .4rem;
|
|
2229
2235
|
|
|
@@ -2280,10 +2286,12 @@ ${l}`),
|
|
|
2280
2286
|
bottom: 0;
|
|
2281
2287
|
height: .4rem;
|
|
2282
2288
|
width: 100%;
|
|
2283
|
-
|
|
2284
|
-
width: 100%;
|
|
2289
|
+
.loaded-part {
|
|
2285
2290
|
transform-origin: 0 0;
|
|
2291
|
+
bottom: 0;
|
|
2286
2292
|
height: .4rem;
|
|
2293
|
+
width: 100%;
|
|
2294
|
+
position: absolute;
|
|
2287
2295
|
background-color: hsla(0, 100%, 100%, .4);
|
|
2288
2296
|
}
|
|
2289
2297
|
}
|
|
@@ -2332,14 +2340,8 @@ ${l}`),
|
|
|
2332
2340
|
object-fit: cover;
|
|
2333
2341
|
}
|
|
2334
2342
|
}
|
|
2335
|
-
|
|
2336
|
-
.
|
|
2337
|
-
transform-origin: 0 0;
|
|
2338
|
-
position: absolute;
|
|
2339
|
-
background-color: hsla(0, 100%, 100%, .4);
|
|
2340
|
-
}
|
|
2341
|
-
`, Gn = () => {
|
|
2342
|
-
const e = $.useActorRef(), t = $.useSelector((c) => c.context.media.currentTime), n = $.useSelector((c) => c.context.media.duration), r = $.useSelector((c) => c.context.thumbnails), o = Ie(De), a = Ne(null), { scrub: s, value: u } = Wn({ ref: a }), [l, b] = Z(void 0), d = (c) => {
|
|
2343
|
+
`, qn = () => {
|
|
2344
|
+
const e = $.useActorRef(), t = $.useSelector((c) => c.context.media.currentTime), n = $.useSelector((c) => c.context.media.duration), r = $.useSelector((c) => c.context.thumbnails), o = Ie(De), a = Ne(null), { scrub: s, value: u } = Bn({ ref: a }), [l, b] = Z(void 0), d = (c) => {
|
|
2343
2345
|
const E = c.nativeEvent.offsetX / c.currentTarget.offsetWidth * (n ?? 0);
|
|
2344
2346
|
b(E);
|
|
2345
2347
|
}, g = () => {
|
|
@@ -2372,7 +2374,7 @@ ${l}`),
|
|
|
2372
2374
|
return /* @__PURE__ */ I(
|
|
2373
2375
|
"div",
|
|
2374
2376
|
{
|
|
2375
|
-
css:
|
|
2377
|
+
css: Gn,
|
|
2376
2378
|
ref: a,
|
|
2377
2379
|
className: "progress-bar",
|
|
2378
2380
|
onMouseMove: d,
|
|
@@ -2409,7 +2411,7 @@ ${l}`),
|
|
|
2409
2411
|
if (e === void 0) return "0:00";
|
|
2410
2412
|
const t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
2411
2413
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
2412
|
-
},
|
|
2414
|
+
}, Xn = (e, t) => `${Bt(e)} / ${Bt(t)}`, Kn = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", Hn = Q`
|
|
2413
2415
|
position: relative;
|
|
2414
2416
|
|
|
2415
2417
|
.popover {
|
|
@@ -2470,7 +2472,7 @@ position: relative;
|
|
|
2470
2472
|
}
|
|
2471
2473
|
}
|
|
2472
2474
|
}
|
|
2473
|
-
`,
|
|
2475
|
+
`, Jn = () => {
|
|
2474
2476
|
const e = $.useActorRef(), t = $.useSelector((p) => p.context.media.playbackRate), n = $.useSelector((p) => p.context.subtitleStreams), r = $.useSelector((p) => p.context.selectedSubtitleStreamIndex), [o, a] = Z(!1), [s, u] = Z(
|
|
2475
2477
|
0
|
|
2476
2478
|
/* Default */
|
|
@@ -2499,7 +2501,7 @@ position: relative;
|
|
|
2499
2501
|
}, y = (p) => () => {
|
|
2500
2502
|
u(p);
|
|
2501
2503
|
};
|
|
2502
|
-
return /* @__PURE__ */ I("div", { css:
|
|
2504
|
+
return /* @__PURE__ */ I("div", { css: Hn, ref: l, children: [
|
|
2503
2505
|
/* @__PURE__ */ h(
|
|
2504
2506
|
ge,
|
|
2505
2507
|
{
|
|
@@ -2631,7 +2633,7 @@ position: relative;
|
|
|
2631
2633
|
] })
|
|
2632
2634
|
] })
|
|
2633
2635
|
] });
|
|
2634
|
-
},
|
|
2636
|
+
}, Zn = {
|
|
2635
2637
|
hover: "rgba(255, 255, 255, 0.13)"
|
|
2636
2638
|
}, cr = 1e-4, bt = 1, ur = 2, lr = (e) => {
|
|
2637
2639
|
const t = Math.max(cr, Math.min(bt, e));
|
|
@@ -2639,7 +2641,7 @@ position: relative;
|
|
|
2639
2641
|
}, St = (e) => {
|
|
2640
2642
|
const t = Math.max(cr, Math.min(bt, e));
|
|
2641
2643
|
return Math.pow(t, bt / ur);
|
|
2642
|
-
},
|
|
2644
|
+
}, Qn = Q`
|
|
2643
2645
|
display: flex;
|
|
2644
2646
|
align-items: center;
|
|
2645
2647
|
|
|
@@ -2670,7 +2672,7 @@ position: relative;
|
|
|
2670
2672
|
width: 10px;
|
|
2671
2673
|
height: 10px;
|
|
2672
2674
|
}
|
|
2673
|
-
`,
|
|
2675
|
+
`, eo = ({ value: e, onChange: t }) => {
|
|
2674
2676
|
const n = $.useSelector((c) => c.context.media.volume), r = $.useSelector((c) => c.context.media.muted), o = Ne(null), [a, s] = Z(!1), u = (c) => {
|
|
2675
2677
|
if (!o.current) return e;
|
|
2676
2678
|
const v = o.current.getBoundingClientRect(), E = c - v.left;
|
|
@@ -2711,7 +2713,7 @@ position: relative;
|
|
|
2711
2713
|
"div",
|
|
2712
2714
|
{
|
|
2713
2715
|
ref: o,
|
|
2714
|
-
css:
|
|
2716
|
+
css: Qn,
|
|
2715
2717
|
onMouseDown: l,
|
|
2716
2718
|
children: /* @__PURE__ */ h(
|
|
2717
2719
|
"div",
|
|
@@ -2741,7 +2743,7 @@ position: relative;
|
|
|
2741
2743
|
] })
|
|
2742
2744
|
}
|
|
2743
2745
|
);
|
|
2744
|
-
},
|
|
2746
|
+
}, to = Q`
|
|
2745
2747
|
position: relative;
|
|
2746
2748
|
display: flex;
|
|
2747
2749
|
align-items: center;
|
|
@@ -2780,13 +2782,13 @@ position: relative;
|
|
|
2780
2782
|
|
|
2781
2783
|
pointer-events: auto;
|
|
2782
2784
|
}
|
|
2783
|
-
`,
|
|
2785
|
+
`, ro = ({ ref: e }) => {
|
|
2784
2786
|
const t = $.useActorRef(), n = $.useSelector((s) => s.context.media.volume), r = $.useSelector((s) => s.context.media.muted), o = pe(() => St(n), [n]), a = (s, u) => t.send({
|
|
2785
2787
|
type: "SET_VOLUME",
|
|
2786
2788
|
muted: u,
|
|
2787
2789
|
volume: lr(s)
|
|
2788
2790
|
});
|
|
2789
|
-
return /* @__PURE__ */ I("div", { css:
|
|
2791
|
+
return /* @__PURE__ */ I("div", { css: to, children: [
|
|
2790
2792
|
/* @__PURE__ */ h(
|
|
2791
2793
|
ge,
|
|
2792
2794
|
{
|
|
@@ -2805,14 +2807,14 @@ position: relative;
|
|
|
2805
2807
|
}
|
|
2806
2808
|
),
|
|
2807
2809
|
/* @__PURE__ */ h("div", { className: "volume-slider-container", children: /* @__PURE__ */ h("div", { className: "volume-slider-background", children: /* @__PURE__ */ h(
|
|
2808
|
-
|
|
2810
|
+
eo,
|
|
2809
2811
|
{
|
|
2810
2812
|
value: r ? 0 : o,
|
|
2811
2813
|
onChange: (s) => a(s, !1)
|
|
2812
2814
|
}
|
|
2813
2815
|
) }) })
|
|
2814
2816
|
] });
|
|
2815
|
-
},
|
|
2817
|
+
}, no = Q`
|
|
2816
2818
|
position: absolute;
|
|
2817
2819
|
bottom: 0;
|
|
2818
2820
|
width: 100%;
|
|
@@ -2896,7 +2898,7 @@ position: relative;
|
|
|
2896
2898
|
cursor: pointer;
|
|
2897
2899
|
|
|
2898
2900
|
:hover {
|
|
2899
|
-
background-color: ${
|
|
2901
|
+
background-color: ${Zn.hover};
|
|
2900
2902
|
}
|
|
2901
2903
|
}
|
|
2902
2904
|
}
|
|
@@ -2924,7 +2926,7 @@ position: relative;
|
|
|
2924
2926
|
}
|
|
2925
2927
|
}
|
|
2926
2928
|
}
|
|
2927
|
-
`,
|
|
2929
|
+
`, oo = ({
|
|
2928
2930
|
containerRef: e
|
|
2929
2931
|
}) => {
|
|
2930
2932
|
const t = $.useActorRef(), n = Ie(De), r = $.useSelector((f) => f.context.media.paused), o = $.useSelector((f) => f.context.media.volume), a = $.useSelector((f) => f.context.media.muted), s = $.useSelector((f) => f.context.media.currentTime), u = $.useSelector((f) => f.context.media.duration), [l, b] = Z(), [d, g] = Z(!1);
|
|
@@ -2973,8 +2975,8 @@ position: relative;
|
|
|
2973
2975
|
return z(() => {
|
|
2974
2976
|
if (l)
|
|
2975
2977
|
return l.addEventListener("wheel", p, { passive: !1 }), () => l.removeEventListener("wheel", p);
|
|
2976
|
-
}, [l, y]), /* @__PURE__ */ I("div", { css:
|
|
2977
|
-
/* @__PURE__ */ h(
|
|
2978
|
+
}, [l, y]), /* @__PURE__ */ I("div", { css: no, style: { ...n.hideUI ? { opacity: "0", pointerEvents: "none" } : {} }, children: [
|
|
2979
|
+
/* @__PURE__ */ h(qn, {}),
|
|
2978
2980
|
/* @__PURE__ */ I("div", { className: "actions", children: [
|
|
2979
2981
|
/* @__PURE__ */ I("div", { className: "left", children: [
|
|
2980
2982
|
/* @__PURE__ */ h(
|
|
@@ -2994,11 +2996,11 @@ position: relative;
|
|
|
2994
2996
|
toolTipText: /* @__PURE__ */ h("span", { children: u === s ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2995
2997
|
}
|
|
2996
2998
|
),
|
|
2997
|
-
/* @__PURE__ */ h(
|
|
2998
|
-
/* @__PURE__ */ h("div", { className: "time", children:
|
|
2999
|
+
/* @__PURE__ */ h(ro, { ref: b }),
|
|
3000
|
+
/* @__PURE__ */ h("div", { className: "time", children: Xn(s, u) })
|
|
2999
3001
|
] }),
|
|
3000
3002
|
/* @__PURE__ */ I("div", { className: "right", children: [
|
|
3001
|
-
/* @__PURE__ */ h(
|
|
3003
|
+
/* @__PURE__ */ h(Jn, {}),
|
|
3002
3004
|
/* @__PURE__ */ h(
|
|
3003
3005
|
ge,
|
|
3004
3006
|
{
|
|
@@ -3008,7 +3010,7 @@ position: relative;
|
|
|
3008
3010
|
{
|
|
3009
3011
|
className: "picture-in-picture",
|
|
3010
3012
|
type: "button",
|
|
3011
|
-
children: /* @__PURE__ */ h("img", { src:
|
|
3013
|
+
children: /* @__PURE__ */ h("img", { src: Kn })
|
|
3012
3014
|
}
|
|
3013
3015
|
),
|
|
3014
3016
|
toolTipText: /* @__PURE__ */ h("span", { children: "Picture in picture" })
|
|
@@ -3034,7 +3036,7 @@ position: relative;
|
|
|
3034
3036
|
] })
|
|
3035
3037
|
] })
|
|
3036
3038
|
] });
|
|
3037
|
-
},
|
|
3039
|
+
}, io = Q`
|
|
3038
3040
|
position: relative;
|
|
3039
3041
|
background-color: black;
|
|
3040
3042
|
display: flex;
|
|
@@ -3063,12 +3065,12 @@ position: relative;
|
|
|
3063
3065
|
&.hide {
|
|
3064
3066
|
cursor: none;
|
|
3065
3067
|
}
|
|
3066
|
-
`,
|
|
3068
|
+
`, ao = ({ children: e }) => {
|
|
3067
3069
|
const t = $.useActorRef(), n = Ie(De), r = $.useSelector((d) => d.context.media.paused), o = $.useSelector((d) => d.context.media.currentTime), a = $.useSelector((d) => d.context.media.duration), s = Ne(), u = Ne(null);
|
|
3068
3070
|
return /* @__PURE__ */ I(
|
|
3069
3071
|
"div",
|
|
3070
3072
|
{
|
|
3071
|
-
css:
|
|
3073
|
+
css: io,
|
|
3072
3074
|
ref: u,
|
|
3073
3075
|
onMouseMove: (d) => {
|
|
3074
3076
|
n.update({ ...n, hideUI: !1 }), s.current && clearInterval(s.current);
|
|
@@ -3082,8 +3084,8 @@ position: relative;
|
|
|
3082
3084
|
},
|
|
3083
3085
|
className: n.hideUI ? "hide" : "",
|
|
3084
3086
|
children: [
|
|
3085
|
-
/* @__PURE__ */ h(
|
|
3086
|
-
/* @__PURE__ */ h(
|
|
3087
|
+
/* @__PURE__ */ h(Vn, {}),
|
|
3088
|
+
/* @__PURE__ */ h(oo, { containerRef: u }),
|
|
3087
3089
|
/* @__PURE__ */ h(
|
|
3088
3090
|
"div",
|
|
3089
3091
|
{
|
|
@@ -3095,13 +3097,13 @@ position: relative;
|
|
|
3095
3097
|
]
|
|
3096
3098
|
}
|
|
3097
3099
|
);
|
|
3098
|
-
},
|
|
3100
|
+
}, so = 25e5, co = Q`
|
|
3099
3101
|
display: flex;
|
|
3100
3102
|
justify-content: center;
|
|
3101
3103
|
background-color: #111;
|
|
3102
3104
|
height: 100%;
|
|
3103
3105
|
overflow: hidden;
|
|
3104
|
-
`,
|
|
3106
|
+
`, uo = ({ options: e, videoElement: t, children: n }) => {
|
|
3105
3107
|
const r = Ie(De), o = $.useActorRef(), a = $.useSelector((f) => f.value), s = $.useSelector((f) => f.context.media.volume), u = $.useSelector((f) => f.context.media.muted), l = $.useSelector((f) => f.context.isReady), [b, d] = Wt("mediaVolume", "1"), [g, x] = Wt("mediaMute", "false"), [y, p] = Z(!0);
|
|
3106
3108
|
return z(
|
|
3107
3109
|
() => o.send({
|
|
@@ -3128,7 +3130,7 @@ position: relative;
|
|
|
3128
3130
|
remuxerOptions: {
|
|
3129
3131
|
publicPath: v,
|
|
3130
3132
|
workerUrl: E,
|
|
3131
|
-
bufferSize: e.bufferSize ??
|
|
3133
|
+
bufferSize: e.bufferSize ?? so,
|
|
3132
3134
|
length: f,
|
|
3133
3135
|
read: c
|
|
3134
3136
|
}
|
|
@@ -3159,8 +3161,8 @@ position: relative;
|
|
|
3159
3161
|
return () => {
|
|
3160
3162
|
o.send({ type: "DESTROY" });
|
|
3161
3163
|
};
|
|
3162
|
-
}, [a]), /* @__PURE__ */ h("div", { css:
|
|
3163
|
-
},
|
|
3164
|
+
}, [a]), /* @__PURE__ */ h("div", { css: co, children: /* @__PURE__ */ h(ao, { children: n }) });
|
|
3165
|
+
}, xo = ({ ref: e, ...t }) => {
|
|
3164
3166
|
const n = (l) => o({ ...l, update: n }), [r, o] = Z({ update: n }), [a, s] = Z(), u = nt((l) => {
|
|
3165
3167
|
typeof e == "function" ? e(l) : e && "current" in e && (e.current = l), s(l ?? void 0);
|
|
3166
3168
|
}, []);
|
|
@@ -3172,9 +3174,9 @@ position: relative;
|
|
|
3172
3174
|
size: t?.size,
|
|
3173
3175
|
downloadedRanges: t?.downloadedRanges
|
|
3174
3176
|
}));
|
|
3175
|
-
}, [a, t?.title, t?.size, t?.downloadedRanges]), /* @__PURE__ */ h(De.Provider, { value: r, children: /* @__PURE__ */ h($.Provider, { children: /* @__PURE__ */ h(
|
|
3177
|
+
}, [a, t?.title, t?.size, t?.downloadedRanges]), /* @__PURE__ */ h(De.Provider, { value: r, children: /* @__PURE__ */ h($.Provider, { children: /* @__PURE__ */ h(uo, { options: t, videoElement: a, children: /* @__PURE__ */ h("video", { ref: u, controls: !1 }) }) }) });
|
|
3176
3178
|
};
|
|
3177
3179
|
export {
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
+
uo as FKNVideoRoot,
|
|
3181
|
+
xo as default
|
|
3180
3182
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@banou/media-player",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@xstate/react": "^5.0.1",
|
|
40
40
|
"ass-compiler": "^0.1.15",
|
|
41
41
|
"jassub": "^1.7.18",
|
|
42
|
-
"libav-wasm": "^0.5.
|
|
42
|
+
"libav-wasm": "^0.5.5",
|
|
43
43
|
"osra": "^0.1.2",
|
|
44
44
|
"p-queue": "^7.3.4",
|
|
45
45
|
"react": "^19.0.0",
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/// <reference types="@emotion/react/types/css-prop" />
|
|
2
2
|
|
|
3
3
|
import { ClassAttributes, useCallback, useEffect, useState } from 'react'
|
|
4
|
+
import { css } from '@emotion/react'
|
|
4
5
|
|
|
5
6
|
import { MediaMachineContext } from '../state-machines'
|
|
6
7
|
|
|
8
|
+
const style = css`
|
|
9
|
+
top: unset !important;
|
|
10
|
+
left: unset !important;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
margin: auto;
|
|
14
|
+
`
|
|
15
|
+
|
|
7
16
|
export const Overlay = () => {
|
|
8
17
|
const mediaActor = MediaMachineContext.useActorRef()
|
|
9
18
|
|
|
@@ -22,7 +31,7 @@ export const Overlay = () => {
|
|
|
22
31
|
|
|
23
32
|
return (
|
|
24
33
|
<>
|
|
25
|
-
<canvas ref={refFunction}/>
|
|
34
|
+
<canvas ref={refFunction} css={style}/>
|
|
26
35
|
</>
|
|
27
36
|
)
|
|
28
37
|
}
|
|
@@ -63,10 +63,12 @@ const style = css`
|
|
|
63
63
|
bottom: 0;
|
|
64
64
|
height: .4rem;
|
|
65
65
|
width: 100%;
|
|
66
|
-
|
|
67
|
-
width: 100%;
|
|
66
|
+
.loaded-part {
|
|
68
67
|
transform-origin: 0 0;
|
|
68
|
+
bottom: 0;
|
|
69
69
|
height: .4rem;
|
|
70
|
+
width: 100%;
|
|
71
|
+
position: absolute;
|
|
70
72
|
background-color: hsla(0, 100%, 100%, .4);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -115,12 +117,6 @@ const style = css`
|
|
|
115
117
|
object-fit: cover;
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
|
|
119
|
-
.loaded-part {
|
|
120
|
-
transform-origin: 0 0;
|
|
121
|
-
position: absolute;
|
|
122
|
-
background-color: hsla(0, 100%, 100%, .4);
|
|
123
|
-
}
|
|
124
120
|
`
|
|
125
121
|
|
|
126
122
|
export const ProgressBar = () => {
|