Repository navigation
feat(listener): play the floor while an interpreter is off air - #1404
Draft
shashank03-dev wants to merge 26 commits into
Draft
shashank03-dev wants to merge 26 commits into
shashank03-dev wants to merge 26 commits into
Conversation
Listener booth:state gains on_air: the booth is unlocked, its interpreter reports a connected stream, and MediaMTX has a publisher on the booth path. Booth paths are alwaysAvailable, so an empty one stays ready and keeps counting inbound bytes; only its source shows a publisher (checked on MediaMTX 1.18.2). While listeners are connected the portal reads the path list once every 2 s, pushes a status when it changes, and logs an outage once. When MediaMTX can't be read, on_air falls back to the lock and the interpreter's report. Part 1 of fossasia#1397.
Rooms get auto_floor_enabled (on by default, migration 051), edited next to the listener delay. When the room has a floor source (managed meeting feed or meeting link, or program ingest with a valid credential or open sender session), each interpreter channel carries a floor_fallback and the floor is listed as its own channel with captions off too (fossasia#1082), labelled with the spoken language ("English (original)"). lang=<spoken code> opens it when no booth has that code. channel-source.js plays the floor after 3 s off air and switches back when on_air returns, make-before-break: the incoming stream warms up on a muted standby element and moves into the player once it has audio, or after 5 s. Organizer Stop keeps the listener's selections. Pause, volume, mute and the room delay carry over. Channels without a fallback behave as before. Part 1 of fossasia#1397.
…nt runs Guided setup saves a meeting link for every room, and the link alone never puts audio on the floor path. With the link counted, every such room listed an original channel that never played and sent listeners to a floor WHEP that kept returning 404. Now only an enabled meeting agent (or program ingest, unchanged) gives a room floor audio; floor captions still list the floor as before. The listener docs also say the embed player is unchanged.
… track A switch that times out before the incoming stream has its track moved nothing, so the paused choice was lost and the stream started playing when the track arrived.
With a room delay, moving the incoming stream to the player built a new, empty delay line, and the old stream stopped at once, so every switch went silent for the whole delay (3 s measured at audio_delay_ms=3000). The move now keeps the filled delay output, and the old stream plays on until the new one has had audio for the delay. The switch timeout grows by the delay.
The go-live broadcast used the path list from the last tick, read before the publisher arrived, so listeners heard on_air false for up to 2 s after the interpreter went live. When a booth would be on air but that list shows no publisher, the portal now reads that one path before telling listeners and updates the cache. One check per path in flight and at most one a second; a failed check is logged once and the status still goes out.
The embed plays the booth path at once, and an off-air alwaysAvailable path sends silence, so embedded interpreter channels went quiet whenever the booth was off air. The embed config now carries the same floor_fallback as the listener page (one shared helper), and the player uses the channel source. It opens the booth's caption socket with its embed token for the on_air status even with captions off, with the same back-off and 4001/4003 handling. Play, Pause, volume and the postMessage API act on the same player across switches. Embeds without a fallback behave as before.
The booth reports its stream connected as soon as the WHIP answer arrives, before ICE finishes, so the single path read often ran before MediaMTX showed the publisher (seen in the real run: on_air false for 4 s after a republish). The check now reads the path up to six times, 250 ms apart, in a background task, and resends the status once the publisher shows. The booth handler no longer waits on MediaMTX. Still one check per path in flight and at most one start a second.
The player has the autoplay attribute, so loading a stream starts it whatever playOnTrack says. This also fixes a paused listener whose stream reconnects, which already started playing again on dev.
A module script needs CORS, so an embed inside a sandbox="allow-scripts" iframe (opaque origin) never ran. channel-source.js now exposes one ChannelSource global like whep-listener.js, and embed-player.js stays a classic script as on dev.
The embed token lives 30 minutes and is never refreshed, so a later caption socket reconnect closes with 4001. That stopped every stream. Now the embed keeps the stream in its player, stops switching and reconnecting, and shows the expired state. 4003 still stops it.
A path list read that was already in flight when the go-live check found the publisher could land later and mark the booth off air again until the next tick. Each list read now keeps paths found live after it started.
A check still reading MediaMTX at shutdown was never cancelled and could open a new HTTP client after the shared one closed. The checks are kept in a set and cancelled before the client closes.
…test Running the real lifespan left the membership checker installed, so later booth socket tests were closed with "Membership removed".
RTMPS floors carry AAC, which MediaMTX can't serve over WebRTC, so a Thai listener was switched to a floor that never played and kept retrying it. Only WHIP program ingest counts now.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 26, 2026
This was referenced Nov 28, 2026
Merged
Member
|
This stack starts at Alembic Reviewed with GPT-6.2 Sol in Codex, run from T3 Code. |
Member
Author
|
sure, if another 050 lands first I'll renumber the whole stack in order and make sure it ends on one head |
Dev added its own 050, so this one now follows it.
Dev now goes up to 053, so this one follows it.
The on-air check reads one page of 1000 paths. A live booth on a later page would read as off air and send its listeners to the floor, so a list with more pages now falls back to the interpreter's own report.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1397 (1 of 3).
A listener on an interpreter channel heard silence until that booth went live, and the room's spoken language had no channel of its own. Now the channel plays the original audio while its interpreter is off air and switches back by itself when the interpreter goes live, and the spoken language is listed as "English (original)". It is on by default with a room setting to turn it off, and the embed player does the same.
The server decides on air: the booth is unlocked, its stream is connected and MediaMTX has a publisher on the path. So a stream that died while the booth still says connected (#1357) counts as off air. A 3 s guard keeps a handover from bouncing listeners to the floor.
Listing the floor when captions are off is #1082, which @krishpatel2-prog's #1083 also fixes and has had open since Oct 31. This feature needs it, so I kept a small copy here. If #1083 lands first I'll merge dev and drop mine. #1358 is separate and merges cleanly with this.
Tests: server on_air, listener and embed switching tests, all failing on dev, plus a browser run on MediaMTX 1.21.4.
Before (
dev): Thai listeners hear silence while the interpreter is off air, there is no English channel, and Stop resets the page.1397-part1-before.mp4
After: English (original) is listed, Thai plays the floor while off air, switches to the interpreter on Go live, and back to the floor on Stop with the off-air badge and the selection kept.
1397-part1-after.mp4