From e608b95bf1fe225915eaeafca2a933f687844733 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Tue, 11 Aug 2026 16:47:01 +0200 Subject: feat: Phase 10c — MSE video streaming (real-time playback) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace download-then-play VideoPlayer with MSE (MediaSource Extensions) streaming. Node remuxes to fMP4 via ffmpeg, probes codecs with ffprobe, and sends encrypted segments over DataChannel. Browser decrypts and appends to SourceBuffer — playback starts within seconds. Co-Authored-By: Claude Opus 4.6 --- .../src/meshbay_hub/static/transport.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js index 011c33e..1dc1ded 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js @@ -27,11 +27,17 @@ class MeshBayTransport { this._recvBuf = new Uint8Array(0); this._connected = false; this._onChat = null; + this._onStreamInit = null; + this._onStreamData = null; + this._onStreamEnd = null; } get connected() { return this._connected; } set onChat(fn) { this._onChat = fn; } + set onStreamInit(fn) { this._onStreamInit = fn; } + set onStreamData(fn) { this._onStreamData = fn; } + set onStreamEnd(fn) { this._onStreamEnd = fn; } async connect(nodeId, jwtToken, groupId) { this._pc = new RTCPeerConnection({ @@ -186,6 +192,10 @@ class MeshBayTransport { return msg; } + requestStream(fileId) { + this._send({ type: 'stream_req', v: '0.1', file_id: fileId }); + } + async uploadChunk(filename, chunkIndex, totalChunks, data) { const msg = await this._sendAndWait({ type: 'file_upload', @@ -259,6 +269,18 @@ class MeshBayTransport { this._onChat(msg); return; } + if (msg.type === 'stream_init' && this._onStreamInit) { + this._onStreamInit(msg); + return; + } + if (msg.type === 'stream_data' && this._onStreamData) { + this._onStreamData(msg); + return; + } + if (msg.type === 'stream_end' && this._onStreamEnd) { + this._onStreamEnd(msg); + return; + } const oldest = this._pending.entries().next(); if (!oldest.done) { -- cgit v1.2.3