@banou/media-player 0.10.43 → 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);
@@ -1912,7 +1912,7 @@ ${Nt}
1912
1912
  }
1913
1913
  }
1914
1914
  }
1915
- `, Lt = (e, t) => new Date(e).toLocaleTimeString(t), Rt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : _t(Math.max(0, e)), zt = (e) => e.reduce((e, t) => e + t.count, 0), Bt = (e) => e.map((e, t) => {
1915
+ `, Lt = (e, t) => new Date(e).toLocaleTimeString(t ?? "en"), Rt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : _t(Math.max(0, e)), zt = (e) => e.reduce((e, t) => e + t.count, 0), Bt = (e) => e.map((e, t) => {
1916
1916
  let n = Rt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1917
1917
  return [
1918
1918
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
@@ -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 waits for its data
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banou/media-player",
3
- "version": "0.10.43",
3
+ "version": "0.10.45",
4
4
  "description": "A video player for containers and codecs the browser cannot play natively, remuxed on the fly",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -103,7 +103,8 @@ ${popoverStyle}
103
103
  }
104
104
  `
105
105
 
106
- const clock = (at: number, locale: string | undefined) => new Date(at).toLocaleTimeString(locale)
106
+ // English when the player was given no language, as its numbers are, never the browser's own digits
107
+ const clock = (at: number, locale: string | undefined) => new Date(at).toLocaleTimeString(locale ?? 'en')
107
108
 
108
109
  // the chrome's own formatter, so a position in the log reads exactly like the one on the seekbar
109
110
  const mediaTime = (seconds: number | undefined) =>
@@ -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 waits for its data
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))