diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-17 10:12:31 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-17 10:12:31 +0200 |
| commit | a98445ce246509b0d2600df14907f72b448a6d10 (patch) | |
| tree | 023e1c09d8fa42f67f5da8ff32a22f271359d843 /packages/meshbay-hub/src/meshbay_hub/static/transport.js | |
| parent | f4fd6db8faa15bf02f38a14b652cc46936f8d6bf (diff) | |
| download | meshbay-a98445ce246509b0d2600df14907f72b448a6d10.tar.gz | |
feat: let the viewer pick the audio track
The streaming path mapped 0:a:0 unconditionally, so a dubbed film played in
whichever language was muxed first and the others were unreachable. The node
now enumerates the tracks in stream_init and honours audio_track in
stream_req; switching is the seek path, since one ffmpeg carries one track.
MNP 3.2, additive: the player draws its selector from the node's own list and
never from a version number, so an older node is never asked for a track it
would ignore. MNP_MIN_SUPPORTED does not move.
Co-Authored-By: Claude Opus 5 <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.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js index a6b3f52..262b00e 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js @@ -2264,12 +2264,24 @@ class MeshBayTransport { * MediaSource consumes a segment at a time — which is fine for a clip and * fatal for anything worth streaming. */ - requestStream(fileId, credits = STREAM_CREDITS, start = 0) { + requestStream(fileId, credits = STREAM_CREDITS, start = 0, audioTrack = null) { // `start` is a seek: the node retires whatever this session was streaming // and spawns ffmpeg again from there. Omitted or zero is the film's // beginning, which is what an 0.1 node understands. - console.log('[stream] sending stream_req start:', start, 'credits:', credits); - this._send({ type: 'stream_req', v: '0.1', file_id: fileId, credits, start }); + // + // `audioTrack` is omitted entirely unless the caller has one, and the + // caller only has one because a `stream_init` listed the tracks. A node + // too old to enumerate them is therefore never sent a field it would + // ignore — which matters more here than it looks: ignoring it would not + // degrade the stream, it would serve a different language without saying + // so. + const req = { type: 'stream_req', v: '0.1', file_id: fileId, credits, start }; + if (Number.isInteger(audioTrack) && audioTrack >= 0) { + req.audio_track = audioTrack; + } + console.log('[stream] sending stream_req start:', start, 'credits:', credits, + 'audio_track:', req.audio_track ?? '-'); + this._send(req); } /** Room for `n` more segments. */ |