aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-17 14:42:51 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-17 14:42:51 +0200
commitc3d41d1b4f042d09a637b375ce930190b7ea0d8c (patch)
treec06008b39b82bfa8a17eb3e2b4ed965167b50385 /packages/meshbay-hub
parent28be8579995aef6df3e87b0f293a4fdd4aa4b072 (diff)
downloadmeshbay-c3d41d1b4f042d09a637b375ce930190b7ea0d8c.tar.gz
fix(spa): a reconnection's resume calls the landing, not a number
A constant in startStream hid resumeAt, so a reconnection with read-ahead left the player waiting and the film froze at the end of its buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/video-player.js7
-rw-r--r--packages/meshbay-hub/tests/test_video_reconnect.py15
2 files changed, 19 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
index 5ea14ef1..770d2c33 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
@@ -1383,9 +1383,10 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload, onCopyL
// does not know about, which is the whole window's worth of overshoot on
// the very first breath of the stream.
outstandingRef.current = STREAM_WINDOW;
- const resumeAt = readResumePosition(entry.id);
- if (resumeAt) setResumedFrom(resumeAt);
- transport.requestStream(entry.id, STREAM_WINDOW, resumeAt, audioTrackRef.current);
+ // Not `resumeAt`: that is the landing `onStreamInit` above calls by name.
+ const leftAt = readResumePosition(entry.id);
+ if (leftAt) setResumedFrom(leftAt);
+ transport.requestStream(entry.id, STREAM_WINDOW, leftAt, audioTrackRef.current);
};
// Closing the tab, or backgrounding it on a phone, never runs a React
diff --git a/packages/meshbay-hub/tests/test_video_reconnect.py b/packages/meshbay-hub/tests/test_video_reconnect.py
index 91aa87b0..f888ec16 100644
--- a/packages/meshbay-hub/tests/test_video_reconnect.py
+++ b/packages/meshbay-hub/tests/test_video_reconnect.py
@@ -250,3 +250,18 @@ def test_a_new_stream_and_a_seek_both_clear_the_resume_flag(app):
assert "resumingRef.current = false" in seek, (
"a seek after an unlanded resume takes the resume branch and keeps the "
"buffer it was supposed to discard")
+
+
+def test_the_landings_are_the_functions_and_nothing_hides_them(app):
+ # `onStreamInit` picks its landing by name, inside `startStream`, and
+ # `startStream` once declared its own `resumeAt`: the position the film was
+ # left at, a number. That one was in scope, so a reconnection's landing
+ # called a number, threw where nothing reported it, and left the player
+ # waiting for a landing that never came: the read-ahead played out and the
+ # film froze at its end, every time (measured on a phone moving between
+ # mobile data and Wi-Fi, 2026-10-17).
+ player = _player(app)
+ for name in ("resumeAt", "reinitAt"):
+ found = re.findall(rf"\b(?:const|let|var|function)\s+{name}\b", player)
+ assert len(found) == 1, f"{name} is declared {len(found)} times in the player"
+ assert f"const {name} = async" in player