@banou/media-player 0.10.44 → 0.10.45
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
|
@@ -457,7 +457,7 @@ var se = {
|
|
|
457
457
|
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
458
458
|
}, h = !0, g = Ne(async (e) => {
|
|
459
459
|
if (!h || t.readyState === HTMLMediaElement.HAVE_NOTHING || !t.paused && (t.pause(), await Me(t, 100), !h)) return;
|
|
460
|
-
let r = m(), i = n.state.seekingTo, a = i === void 0 ? o ? o.mediaTime + (e > 0 ? 1.5 : -.5) * r : t.currentTime + e * r : i + e * r, s = Math.max(0, Math.min(a, t.duration || a)), c = new Promise((e) => {
|
|
460
|
+
let r = m(), i = n.state.seekingTo, a = i === void 0 ? o && !t.seeking ? o.mediaTime + (e > 0 ? 1.5 : -.5) * r : t.currentTime + e * r : i + e * r, s = Math.max(0, Math.min(a, t.duration || a)), c = new Promise((e) => {
|
|
461
461
|
let n = () => {
|
|
462
462
|
clearTimeout(r), t.removeEventListener("seeked", n), e();
|
|
463
463
|
}, r = setTimeout(n, 15e3);
|
|
@@ -8,8 +8,8 @@ import type { PlayerMedia } from '../media';
|
|
|
8
8
|
* seek presented is never read for its time: Firefox reports the seek's target as its `mediaTime`.
|
|
9
9
|
*
|
|
10
10
|
* The frame's length is learned from the shortest gaps between frames presented one after another while playing at up
|
|
11
|
-
* to 1x: faster, a 60 Hz display presents every other frame of a 60 fps file. A step while a seek
|
|
12
|
-
* starts from that seek's target.
|
|
11
|
+
* to 1x: faster, a 60 Hz display presents every other frame of a 60 fps file. A step while a seek is on its way, or
|
|
12
|
+
* waits for its data, starts from that seek's target.
|
|
13
13
|
*
|
|
14
14
|
* A media without `requestVideoFrameCallback` is stepped by `hostStep`, when its host can step it.
|
|
15
15
|
*/
|
package/package.json
CHANGED
|
@@ -41,8 +41,8 @@ const oneAtATime = (step: (direction: 1 | -1) => Promise<void>) => {
|
|
|
41
41
|
* seek presented is never read for its time: Firefox reports the seek's target as its `mediaTime`.
|
|
42
42
|
*
|
|
43
43
|
* The frame's length is learned from the shortest gaps between frames presented one after another while playing at up
|
|
44
|
-
* to 1x: faster, a 60 Hz display presents every other frame of a 60 fps file. A step while a seek
|
|
45
|
-
* starts from that seek's target.
|
|
44
|
+
* to 1x: faster, a 60 Hz display presents every other frame of a 60 fps file. A step while a seek is on its way, or
|
|
45
|
+
* waits for its data, starts from that seek's target.
|
|
46
46
|
*
|
|
47
47
|
* A media without `requestVideoFrameCallback` is stepped by `hostStep`, when its host can step it.
|
|
48
48
|
*/
|
|
@@ -125,9 +125,11 @@ export const useFrameStep = (media: PlayerMedia | null, hostStep?: (direction: 1
|
|
|
125
125
|
const length = frameLength()
|
|
126
126
|
// off `state`: the store has a getter only for the fields it was created with
|
|
127
127
|
const pending = player.state.seekingTo
|
|
128
|
+
// `seeking` turns true as `currentTime` is set, but the event that clears `played` is queued, so a key handled
|
|
129
|
+
// before it would step from the last frame played (Chrome 156 and Firefox 153, 2026-11-21)
|
|
128
130
|
const target = pending !== undefined
|
|
129
131
|
? pending + direction * length
|
|
130
|
-
: played
|
|
132
|
+
: played && !video.seeking
|
|
131
133
|
? played.mediaTime + (direction > 0 ? 1.5 : -0.5) * length
|
|
132
134
|
: video.currentTime + direction * length
|
|
133
135
|
const time = Math.max(0, Math.min(target, video.duration || target))
|