aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transport.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-11 16:47:01 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-11 16:47:01 +0200
commite608b95bf1fe225915eaeafca2a933f687844733 (patch)
tree255b28a2d667af0729bb7829d6307324c0119fce /packages/meshbay-hub/src/meshbay_hub/static/transport.js
parentfc509ae281c8cd0aa69870f6123a11e3519fb390 (diff)
downloadmeshbay-e608b95bf1fe225915eaeafca2a933f687844733.tar.gz
feat: Phase 10c — MSE video streaming (real-time playback)
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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport.js22
1 files changed, 22 insertions, 0 deletions
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) {