aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
diff options
context:
space:
mode:
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.js19
1 files changed, 19 insertions, 0 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 82e1116..78760d8 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
@@ -529,6 +529,24 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
setPhase('error');
};
+ // The old stream died with the connection (the node retires it the
+ // moment its session goes away — see webrtc_server.py's
+ // on_state_change), so there is nothing to resume on the wire, only a
+ // reason to ask again. requestSeek already knows how to land a new
+ // stream_init on the live SourceBuffer without resetting playback —
+ // 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 = () => {
+ if (cancelled) return;
+ const v = videoRef.current;
+ const seek = requestSeekRef.current;
+ if (!v || !seek) return;
+ console.log('[MeshBay] transport reconnected — resuming stream at',
+ v.currentTime.toFixed(1));
+ seek(v.currentTime);
+ };
+
transport.onStreamInit = (msg) => {
if (cancelled) return;
if (msg.file_id && msg.file_id !== entry.id) return;
@@ -849,6 +867,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
transport.onStreamData = null;
transport.onStreamEnd = null;
transport.onStreamError = null;
+ transport.onReconnected = null;
}
// The queue can hold several megabytes of decrypted video.
queueRef.current = [];