aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-19 17:13:17 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-19 17:13:17 +0200
commit2eaf6887295614509f8d0bc24a9b77ccd915ef88 (patch)
treec713fec411770da9250a44f9b1e08c4165c8d439 /packages/meshbay-hub/src/meshbay_hub/static/video-player.js
parentd2495a2c4b89fbbfc18cefec83ae96cabdd745e2 (diff)
downloadmeshbay-2eaf6887295614509f8d0bc24a9b77ccd915ef88.tar.gz
fix(hub): a reconnect re-reads the index, not just the handshake
_reconnectLoop re-did the handshake and nothing else, so a page kept whatever it last saw until someone reloaded it. That is invisible until the node restarts: it rebuilds its index from index_cache.db, which holds no enrichment, and Music is the one app whose enrichment is persisted nowhere — for the length of the re-read pass it serves tracks with no artist, and the album grid drew nothing. onReconnected was one slot the video player took on open and cleared on close; it is a listener set now, and carries the fresh ack. docs/MESHBAY_DESIGN.md §15.3 records the two defects found alongside and not fixed here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/video-player.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/video-player.js9
1 files changed, 6 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 a07558e..66099de 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
@@ -521,6 +521,9 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
useEffect(() => {
let cancelled = false;
+ // Held so the teardown below can drop *this* listener and no one else's
+ // (transport.js's addReconnectListener).
+ let offReconnect = null;
// Reset here, not in the teardown of the run before: switching video while
// an append was in flight left `appendingRef` true, and flushQueue bails
// out on it. The new SourceBuffer then never appended anything, so no
@@ -730,7 +733,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
// exactly what dragging the scrubber does — so reusing it here means a
// screen-lock reconnect looks like a seek to where the film already
// was, not a reload.
- transport.onReconnected = () => {
+ offReconnect = transport.addReconnectListener(() => {
if (cancelled) return;
const v = videoRef.current;
const seek = requestSeekRef.current;
@@ -738,7 +741,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
console.log('[MeshBay] transport reconnected — resuming stream at',
v.currentTime.toFixed(1));
seek(v.currentTime);
- };
+ });
transport.onStreamInit = (msg) => {
if (cancelled) return;
@@ -1121,8 +1124,8 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
transport.onStreamData = null;
transport.onStreamEnd = null;
transport.onStreamError = null;
- transport.onReconnected = null;
}
+ if (offReconnect) { offReconnect(); offReconnect = null; }
// The queue can hold several megabytes of decrypted video.
queueRef.current = [];
const ms = msRef.current;