@banou/media-player 0.10.22 → 0.10.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/engine/index.js +1 -1
- package/dist/{engine-Cr_7OImR.js → engine-BdouHadr.js} +6 -6
- package/dist/index.js +305 -235
- package/dist/react/hooks/use-frame-step.d.ts +16 -0
- package/dist/react/player.d.ts +1 -0
- package/dist/react/source-feature.d.ts +10 -0
- package/dist/react/video-player.d.ts +9 -0
- package/dist/volume-normalizer-worklet.js +9 -5
- package/package.json +3 -3
- package/src/lib/audio/volume-normalizer-worklet.js +9 -5
- package/src/lib/engine/playback.ts +16 -7
- package/src/lib/engine/subtitles.ts +11 -7
- package/src/lib/react/components/control-bar.tsx +6 -1
- package/src/lib/react/hooks/use-frame-step.ts +139 -0
- package/src/lib/react/source-feature.ts +6 -0
- package/src/lib/react/video-player.tsx +11 -0
package/README.md
CHANGED
|
@@ -162,8 +162,11 @@ an offer to skip an opening or ending, volume on a log curve, mute, playback spe
|
|
|
162
162
|
selection, subtitle track selection, picture in picture, fullscreen, and keyboard shortcuts. Nothing
|
|
163
163
|
is persisted: volume, speed and track choices start at their defaults every load.
|
|
164
164
|
|
|
165
|
-
The shortcuts (Space or `k`, `f`, `m`, the arrow keys
|
|
166
|
-
|
|
165
|
+
The shortcuts (Space or `k`, `f`, `m`, the arrow keys, and `<` and `>` to pause and step one frame back or forward)
|
|
166
|
+
listen on the whole page, and leave Ctrl, Cmd and Alt combinations to the browser. The frame steps need a media
|
|
167
|
+
with `requestVideoFrameCallback`, which a `media` playing in another document does not have; its host can pass
|
|
168
|
+
`stepFrame` to make the step inside that document instead. Pass `shortcuts="player"`
|
|
169
|
+
for a player among other content: a key then acts only from inside the player (a click on the picture puts the focus
|
|
167
170
|
there) or while it is fullscreen, and Space and the arrows keep scrolling the page everywhere else.
|
|
168
171
|
|
|
169
172
|
### Chapters
|
package/dist/engine/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../engine-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../engine-BdouHadr.js";
|
|
2
2
|
export { i as DEFAULT_BUFFER_SIZE, e as MediaElementError, a as SUBTITLES_OFF, u as createPictureInPicture, d as createSubtitleRenderer, c as createThumbnailGenerator, n as getTimeRanges, s as isMediaElementError, o as pictureInPictureMode, l as startPlayback, t as terminateRemuxer, r as updateSourceBuffer };
|
|
@@ -50,7 +50,6 @@ var i = (e) => Array(e.buffered.length).fill(void 0).map((t, n) => ({
|
|
|
50
50
|
return {
|
|
51
51
|
type: "dialogue",
|
|
52
52
|
streamIndex: t.streamIndex,
|
|
53
|
-
index: a,
|
|
54
53
|
assEvent: {
|
|
55
54
|
Name: s.Name ?? "",
|
|
56
55
|
Effect: s.Effect?.name ?? "",
|
|
@@ -136,9 +135,10 @@ var i = (e) => Array(e.buffered.length).fill(void 0).map((t, n) => ({
|
|
|
136
135
|
if (!e) continue;
|
|
137
136
|
let r = h.get(n.streamIndex);
|
|
138
137
|
r || (r = /* @__PURE__ */ new Map(), h.set(n.streamIndex, r));
|
|
139
|
-
let i =
|
|
140
|
-
if (r.has(i
|
|
141
|
-
|
|
138
|
+
let i = `${n.start},${n.end},${n.content.slice(n.content.indexOf(",") + 1)}`;
|
|
139
|
+
if (r.has(i)) continue;
|
|
140
|
+
let a = m(e, n);
|
|
141
|
+
r.set(i, a), g === n.streamIndex && t.push(a.assEvent);
|
|
142
142
|
}
|
|
143
143
|
t.length && (b((e) => Promise.all(t.map((t) => e.createEvent(t)))), S());
|
|
144
144
|
},
|
|
@@ -320,12 +320,12 @@ var i = (e) => Array(e.buffered.length).fill(void 0).map((t, n) => ({
|
|
|
320
320
|
} finally {
|
|
321
321
|
e === V && (I = !1);
|
|
322
322
|
}
|
|
323
|
-
}, Ce = (e) => e
|
|
323
|
+
}, Ce = (e) => i(A).some((t) => t.start <= e && e < t.end && t.end >= pe) && Te(e), we = (e) => i(A).some((t) => t.start <= e && e < t.end), X = (e) => {
|
|
324
324
|
let t = ge(e);
|
|
325
325
|
return t ? t.end - e : 0;
|
|
326
326
|
}, Te = (e) => X(e) >= E || be() && ve(e), Ee = async (e) => {
|
|
327
327
|
if (!P && !(we(e) && Te(e))) {
|
|
328
|
-
B = !1, R++, z = e;
|
|
328
|
+
$ && clearTimeout($), $ = void 0, B = !1, R++, z = e;
|
|
329
329
|
try {
|
|
330
330
|
await Y(e);
|
|
331
331
|
let t = H;
|