Repository navigation
feat(audio): add deafenAudioUntilExplicitJoin setting to restore pre-3.0 close-modal behavior - #25393
Conversation
WalkthroughAdds configurable deafening until explicit audio joining. Audio joining tracks explicit user opt-in, automatic joining waits for user settings readiness, and audio controls, modal confirmation, echo-test approval, and modal closure apply the new behavior. Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant AudioModal
participant AudioManager
participant UserSettings
User->>AudioModal: Explicitly join audio
AudioModal->>AudioManager: requestAudioJoin()
AudioManager->>UserSettings: Read deafening setting
AudioManager->>AudioManager: Process audio join
AudioManager-->>User: Audio enabled or deafened
Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
hello @imdt-claudiop if we analyze this broadly, the popup now is understood as a microphone selection popup, and when you close this means "no microphone", and so, it joins in listen mode the requested feature is that when a certain configuration flag is defined, we understand the modal close as "I don't want to join audio" said that, instead of feel free to propose something different, if you find a better solution while analyzing - take your time |
|
Good point - the current name describes the mechanism we want to disable, not the intent. I'll rename across all 4 files, invert the gate logic ( |
Skipping the audio modal is not sufficient. Joining audio is not optional at the client level, it will be done regardless of whatever artifice is used at the modal/join level. |
|
Thanks @prlanzarin - that is a relevant technical point. Two things to untangle here:
I want to validate your claim that "joining audio is not optional at the client level" against the current code before choosing the path. @TiagoJacobs - since you filed the original request, can you weigh in on which behavior is actually desired: (a) no audio connection at all, or (b) joined but deafened? And do you agree with the Meanwhile I will trace the AudioManager / audioJoin callback to confirm whether a forced join happens regardless of the modal gate. |
4e94814 to
988b847
Compare
|
Updated per @TiagoJacobs feedback: renamed Re-validated with Playwright: default ( The |
988b847 to
c0823e9
Compare
c0823e9 to
cb6d963
Compare
|
@prlanzarin Reworked the PR based on your suggestion - the user now joins deafened at join time instead of being deafened only on modal close. The deafen is applied in I validated the join-time behavior with per-peer-connection WebRTC stats. With Two open questions remain (noted in the PR body):
I would appreciate your review when you have time. |
|
hello @imdt-claudiop The name About your question - good catch:
It's important for this column to be filled in correctly, but this looks like a pre-existing inconsistency rather than something introduced by this PR - is that right? If so, could you open a follow-up issue describing the discrepancy? We can address it in the near future.
please make the audio join happen only after the settings were loaded - this will prevent bug reports |
|
Thanks for the review. Three actions:
Will update the PR once all three are in and re-validated. |
…3.0 close-modal behavior Add a client setting, deafenAudioUntilExplicitJoin (default false), that restores the pre-3.0 ability to end up with no audio unless the user explicitly opts into hearing it. With LiveKit and transparent listen-only, the user is connected to the audio bridge on entry, before the modal is even closed, so the connection cannot be avoided at the client level. Instead of joining and then hearing audio, the user is deafened at join time: AudioManager.onAudioJoin honors the flag and starts the user deafened (receiving no audio) unless they explicitly opt in. Deafening at join time, rather than on modal close, closes the window where the user would briefly hear other participants while the modal is still open. The name describes what the setting does (deafen until an explicit join) rather than the moment it used to hook into. An explicit "Join audio" action undeafens the user: the audio controls button, the audio settings confirmation and the echo test all call AudioManager.requestAudioJoin, which overrides the deafen-at-join-time behavior and reuses the existing bridge connection. Closing the modal is a no-op when the flag is on (the user is already deafened); when the flag is false the current 3.0 behavior is preserved (closing forces a muted join). Gate the automatic audio join on user settings being loaded. getFromUserSettings falls back to defaults until the per-user settings finish loading from GraphQL, so an auto join that fires before then could read a stale default and leave the user undeafened. CustomUsersSettings now exposes a userSettingsReady signal, set once the settings resolve, and the audio modal defers its automatic join until it is true. The behavior is scoped to LiveKit. The setting can be enabled server-wide via bbb-html5.yml or per-user via the bbb_deafen_audio_until_explicit_join userdata parameter.
cb6d963 to
2912287
Compare
|
Updated per the review:
A/B re-validated with WebRTC stats. PR description updated with the new name and the settings-gate note. |
|
hello @imdt-claudiop - this PR looks good to me let's check if @prlanzarin have any additional concerns or comments, otherwise, we can merge it soon |
|
Thanks @TiagoJacobs. Waiting on @prlanzarin for any final concerns before merging. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx (1)
423-438: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUndeafen the already-connected LiveKit case
requestAudioJoin()only takes effect on the next join. IfdeafenAudioUntilExplicitJoinhas already connected the user in a deafened state, this branch just closes the modal and leaves them silent; mirroraudio-graphql/audio-controls/component.tsxhere by clearingAudioManager.isDeafenedwhenisConnected && AudioManager.isDeafened.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx` around lines 423 - 438, The connected branch of handleAudioSettingsConfirmation must explicitly undeafen users already connected by LiveKit: when isConnected and AudioManager.isDeafened are true, clear AudioManager.isDeafened before closing the modal. Keep the existing join flow for disconnected users and closeModal behavior for connected users.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bigbluebutton-html5/imports/ui/services/audio-manager/index.js`:
- Around line 778-802: The explicit undeafen path must execute the post-join
work currently skipped after a deafened entry. Update the flow around
onAudioJoin and the explicit join handling, such as requestAudioJoin, so
setDeafened(false) re-enters onAudioJoin or invokes the equivalent
changeOutputDevice, storeAudioInputDeviceId, microphone/listen-only selection,
monitor, and started audio event steps exactly once.
---
Outside diff comments:
In `@bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx`:
- Around line 423-438: The connected branch of handleAudioSettingsConfirmation
must explicitly undeafen users already connected by LiveKit: when isConnected
and AudioManager.isDeafened are true, clear AudioManager.isDeafened before
closing the modal. Keep the existing join flow for disconnected users and
closeModal behavior for connected users.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 22815cec-3438-43e3-b2cf-cdb6e7414aa7
📒 Files selected for processing (9)
bigbluebutton-html5/imports/ui/Types/meetingClientSettings.tsbigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-controls/component.tsxbigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsxbigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsxbigbluebutton-html5/imports/ui/components/join-handler/custom-users-settings/component.tsxbigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.tsbigbluebutton-html5/imports/ui/core/local-states/useUserSettings.tsbigbluebutton-html5/imports/ui/services/audio-manager/index.jsbigbluebutton-html5/private/config/settings.yml
|
I'll do a thorough review, not just a final concerns skim over this ;). FWIW, on next similar approaches to issues, I'd prefer we planned/discussed the implementation BEFOREHAND in the issue before implementing it. |
With deafenAudioUntilExplicitJoin enabled, clicking "Join audio" on a
deafened entry only flipped the isDeafened flag. The initial deafened
join returns early from onAudioJoin, so the post-join side effects
(output/input device selection, storeAudioInputDeviceId,
setUserSelectedMicrophone/setUserSelectedListenOnly, monitor and the
"started" audio event) were never run once the user opted in.
Re-enter onAudioJoin({ deafened: false }) from the explicit-join handler
so those steps run exactly once, reusing the existing bridge connection.
This matches onAudioJoin's documented contract of being called again when
the user is undeafened. The now-unused setDeafened helper is removed.
|
✅ Automated tests have passed! |
|
Hello @prlanzarin - just checking in, no rush. When you last commented you mentioned you'd do a thorough review of this PR. I wanted to gently follow up to see whether you've had a chance to look further, or if there's anything specific you'd like me to address in the meantime. Happy to incorporate any feedback you have. |
prlanzarin
left a comment
There was a problem hiding this comment.
Overall this works. Partial review with inline suggestions and patches.
I still will look over https://github.com/imdt-claudiop/bigbluebutton/blob/8952de4a4ab5cccebe71b59fb185df9ed71c5ec5/bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-controls/component.tsx#L96-L110 specifically, as the short-circuit there looks like it's a no op. The assumption that transparent listen only auto joins anything on entry is not correct on its own - it doesn't, not on modal closure with this flag on. I need to poke at it to see if there's any edge case I'm not seeing for that short-circuit to be necessary.
| // consumers whose behavior depends on a setting being resolved (e.g. the audio | ||
| // auto-join deafen decision) should wait for it before acting on that setting. | ||
| const [useUserSettingsReady, setUserSettingsReady] = createUseLocalState<boolean>(false); | ||
|
|
There was a problem hiding this comment.
The client entrypoint already wraps the whole app in CustomUsersSettings, which only renders children components when user settings have been fetched. i.e: I don't think AudioModal can ever be mounted while settings haven't been fetched.
I suggest removing this (alongside audio-modal/component.jsx:678, custom-users-settings/component.tsx:2,74-77, container.jsx:64,195) as it's basically dead code.
| const deafenAudioUntilExplicitJoin = getFromUserSettings( | ||
| 'bbb_deafen_audio_until_explicit_join', | ||
| window.meetingClientSettings.public.app.deafenAudioUntilExplicitJoin, | ||
| ); |
There was a problem hiding this comment.
Duplicate deafen predicate fetch (audio-modal/container.jsx:63 and services/audio-manager/index.js:785-788). Better if it's centralized as it deals with hardcoded userdata and settings attribute names. Suggestion:
0002-refactor-audio-read-deafenAudioUntilExplicitJoin-via.patch
| // With deafenAudioUntilExplicitJoin the user may already be connected to the | ||
| // audio bridge but deafened (transparent listen-only connects on entry, and | ||
| // we deafen at join time). In that case joining audio just means undeafening | ||
| // - the connection already exists, so we reuse it instead of reopening the | ||
| // modal. We re-enter onAudioJoin (deafened: false) rather than only flipping | ||
| // the deafened flag: the initial deafened join returns early and skips the | ||
| // post-join steps (device selection, monitor, "started" event), so those must | ||
| // run now that the user opted in. onAudioJoin is idempotent for this path - | ||
| // the skipped steps run exactly once. |
There was a problem hiding this comment.
Not high priority, but still: the inline comments in this PR are verbose, duplicate the same rationale in multiple places and are, sometimes, incorrect or incomplete (e.g: conflating LiveKit's logic of audio being opt-out with transparent listen only, which doesn't have much to do with it).
Inline comments are good, but it'd be better if they were as succint as possible. State the why and how in a way that cannot be further summarized, else we risk littering the codebase with comments folks will likely not read or parse adequately.
Suggestion:
0003-docs-audio-trim-deafenAudioUntilExplicitJoin-comment.patch
prlanzarin
left a comment
There was a problem hiding this comment.
Finalizing my partial review.
See my first comment: #25393 (comment). It meant that, server-side, the audio join state transition always happens - regardless of any skip done here.
One alternative suggested in that comment was to use the onAudioJoin callback
to enforce the deafened state server-side when skipping the audio modal - mainly due to the fact that the client side enforcement of deafened state depends on voice records being present in the server to work. That suggestion was extrapolated in subsequent commits here to apply to every join path in the client, which is not correct.
The main issue: with the bbb-webrtc-sfu bridge, audio join is only ignored when the join action itself is ignored by the user (i.e.: closing the modal) or autoJoin=false. This PR makes skipCheck flags also honor the deafen-on-join flag, meaning skipCheck=true + deafenAudio=true would leave the user out of audio. This is a deviation of the original semantics of skipCheck in bbb-webrtc-sfu bridges (and the LK bridge itself).
A better strategy is to rollback to a simpler solution and follow the suggestion above: enforce deafened state E2E when applicable (skipping audio modal, autoJoin=false). A cleaner approach to what I initially suggested is to just fix the userSetDeafened mutation effect to also track for the voice record presence before enforcing it.
See PR #25491 which supersedes this one. Feel free to either pick the commits there into this branch (and then close #25941), or migrate this discussion there. It also includes a table of the expected interaction of audio join flags to make things clearer.



Summary
Restores the pre-3.0 (2.7) behavior where the user does not join audio unless they explicitly choose to. Adds a new setting
deafenAudioUntilExplicitJoin(boolean, defaultfalse).When
deafenAudioUntilExplicitJoin: true, the user joins the LiveKit bridge deafened at join time - they never hear audio until they explicitly click "Join audio" in the toolbar.Closes #25346
Problem
In BBB 2.7, dismissing the initial audio modal let users stay in the session without any audio connection. In 3.0+ with LiveKit, the user is auto-connected to the bridge (muted) on entry (transparent listen-only), so closing the modal could not prevent the connection.
Thanks to @prlanzarin for the key insight that joining is not optional at the client level with LiveKit, and to @TiagoJacobs for the suggestion to deafen at join time and to rename the setting to reflect what it actually does.
Implementation
The user joins the LiveKit bridge deafened at join time when
deafenAudioUntilExplicitJoin: true. The deafen is applied inAudioManager.onAudioJoin, the single chokepoint whereisDeafenedflips tofalse. An explicit "Join audio" action callsAudioManager.onAudioJoin({ deafened: false })to re-enter the join flow, which runs all post-join steps (device setup, monitor, started event) exactly once and undeafens, reusing the existing bridge connection.The auto-join that triggers the deafen decision is gated on a
userSettingsReadysignal, so it cannot fire on a stale default during the async graphql user-settings load window.Changes
9 files, +120/-11:
private/config/settings.yml- newpublic.app.deafenAudioUntilExplicitJoin: falseimports/ui/Types/meetingClientSettings.ts-deafenAudioUntilExplicitJoin: booleanimports/ui/core/initial-values/meetingClientSettings.ts- defaultfalseimports/ui/services/audio-manager/index.js-onAudioJoinappliesdeafenedbased on the setting (unlessrequestAudioJoinwas set);requestAudioJoin()method and flagimports/ui/components/audio/audio-modal/container.jsx- readsuseUserSettingsReady, threads to componentimports/ui/components/audio/audio-modal/component.jsx- auto-join useEffect early-returns untiluserSettingsReady; explicit join paths setrequestAudioJoinimports/ui/components/audio/audio-graphql/audio-controls/component.tsx- toolbar "Join audio" on a connected-but-deafened user callsonAudioJoin({ deafened: false })(re-enters join flow, runs post-join steps)imports/ui/components/custom-users-settings/component.tsx- setsuserSettingsReadyafter applying GraphQL userdataimports/ui/core/local-states/useUserSettings.ts- newuserSettingsReadyreactive signalValidation
Validated on a BBB 3.0 from-source dev environment (LiveKit, media confirmed working) with Playwright. The authoritative signal is per-peer-connection WebRTC inbound-rtp stats (conference tracks) + AudioManager state instrumentation (spies on post-join methods):
deafenAudioUntilExplicitJoin=true=false(default)Build:
bbb-html5/deploy.shrc=0, served bundle carriesdeafenAudioUntilExplicitJoin+requestAudioJoin+onAudioJoin.Known limitations
user_voice.deafenedstaysfalsein the DB for LiveKit users (pre-existing inconsistency - client-side deafen only for LiveKit). Tracked in follow-up issue user_voice.deafened DB mirror stays false for LiveKit users (client-side deafen only) #25406.audio/container.jsxare not gated onuserSettingsReady(settings are long-loaded by then).audio-manager/index.js(identical count before this change; zero added).Backward compatibility
Default is
false- existing deployments see no behavior change. The default-path logic is byte-for-byte unchanged. Settingtrueis opt-in.