Skip to content

feat(audio-captions): alert possible wrong microphone when webspeech - #25342

Merged
prlanzarin merged 1 commit into
bigbluebutton:v4.0.x-developfrom
Arthurk12:bbb/40/issue/24637
Jul 7, 2026
Merged

prlanzarin merged 1 commit into
bigbluebutton:v4.0.x-developfrom
Arthurk12:bbb/40/issue/24637

Conversation

@Arthurk12

Copy link
Copy Markdown
Member

What does this PR do?

The microphone used by the webspeech API and the one use to in-meeting communication might differ if the default microphone in the OS is not the one used in the meeting. In this scenario, a user would speak, the talking indicator would confirm the microphone is correct, but webspeech would not generate any transcription for the person, because the internally selected microphone in the browser is not correct.

Add a new mechanism that raises a toast notification alert when a user speaks(has floor) for a specific
time(audioCaptions.microphoneAlert.speakingThreshold) with no transcription generated. The alert consists of a message pointing to a wrong microphone selection in the browser/OS level - with the possibility to show a link to a "learn
more"(audioCaptions.microphoneAlert.helpLink) page with directions of how to fix/change that - OR that the user microphone is correct but has too much background noise. The other configurations under audioCaptions.microphoneAlert follow roughly the same semantics of the muted alert.

Recording 2026-06-29 at 13 03 58

Closes Issue(s)

Closes #24637

How to test

  1. Select the different/muted default mic in the OS before opening the browser
  2. Enable audio captions, set provider as webspeech and enable microphoneAlert in settings.yml
  3. Create and join meeting
  4. Change the in-meeting microphone to the correct one using the microphone chevron
  5. Enable transcription in the transcription panel
  6. Unmute microphone and speak for a couple of seconds
  7. See microphone alert toast

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f1918099-d505-4632-bf34-ddc3ef7688b5

📥 Commits

Reviewing files that changed from the base of the PR and between ed664f3 and d0aeb48.

📒 Files selected for processing (5)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-html5/public/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • bigbluebutton-html5/public/locales/en.json
  • bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx

Walkthrough

A microphone alert is added to the WebSpeech audio captions flow. A new MicrophoneAlert type is introduced and wired into AudioCaptions, with default and configured values added in settings and initial client values. The speech captions component now receives the input stream, tracks transcription timing, starts hark on the microphone stream, and shows a localized warning toast when speaking is detected without transcription.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Related issue: #24637
Suggested reviewers: antobinary

Sequence Diagram(s)

sequenceDiagram
  participant AudioManager
  participant AudioCaptionsSpeechContainer
  participant AudioCaptionsSpeech
  participant hark
  participant Toasts

  AudioManager->>AudioCaptionsSpeechContainer: _inputStream
  AudioCaptionsSpeechContainer->>AudioCaptionsSpeech: inputStream prop
  AudioCaptionsSpeech->>hark: init(inputStream, settings)
  hark->>AudioCaptionsSpeech: speaking event
  AudioCaptionsSpeech->>AudioCaptionsSpeech: start speaking timer
  hark->>AudioCaptionsSpeech: stopped_speaking event
  AudioCaptionsSpeech->>AudioCaptionsSpeech: clear timer
  AudioCaptionsSpeech->>Toasts: show microphoneAlert warning
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the new microphone alert for WebSpeech audio captions.
Description check ✅ Passed The description matches the changes and explains the WebSpeech microphone alert behavior and optional docs link.
Linked Issues check ✅ Passed The PR implements the requested toast when WebSpeech users speak with enough energy but no transcription appears [#24637].
Out of Scope Changes check ✅ Passed The changed files are all directly tied to the new microphone alert feature and its configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx (1)

380-388: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the new alert fully self-contained in audioCaptions.microphoneAlert.

This effect still pulls window.meetingClientSettings.public.app.mutedAlert.interval, so changing the muted-mic alert silently retunes this WebSpeech alert too. Please add interval to the new microphoneAlert config and read it from there instead. That keeps the new config surface aligned with the PR’s “similar semantics” goal.

🤖 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-graphql/audio-captions/speech/component.tsx`
around lines 380 - 388, The audioCaptions microphone alert effect is still
depending on the muted-mic alert interval from
window.meetingClientSettings.public.app.mutedAlert, which couples the two alert
configs. Add interval to MICROPHONE_ALERT_CONFIG (or the
audioCaptions.microphoneAlert config) and update the component in
speech/component.tsx to read interval from that config alongside threshold,
speakingThreshold, duration, and helpLink. Keep the harkInstanceRef.current
setup self-contained so changes to mutedAlert no longer affect the new alert.
🤖 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/components/audio/audio-graphql/audio-captions/speech/component.tsx`:
- Around line 390-406: The speaking timeout in the speech captions component is
only anchored once on the first `speaking` event, so the no-transcription
warning can be skipped during long continuous speech. Update the
`harkInstanceRef.current.on('speaking', ...)` flow in the speech component to
restart or re-arm `speakingTimerRef` after each transcription event, using
`lastTranscriptionAtRef` as the moving baseline instead of a one-time
`speakingStartedAt` capture. Make sure the alert logic still respects
`alertShownRef`, `helpLink`, and `notify`, but schedules a fresh window whenever
new transcription arrives.

---

Nitpick comments:
In
`@bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx`:
- Around line 380-388: The audioCaptions microphone alert effect is still
depending on the muted-mic alert interval from
window.meetingClientSettings.public.app.mutedAlert, which couples the two alert
configs. Add interval to MICROPHONE_ALERT_CONFIG (or the
audioCaptions.microphoneAlert config) and update the component in
speech/component.tsx to read interval from that config alongside threshold,
speakingThreshold, duration, and helpLink. Keep the harkInstanceRef.current
setup self-contained so changes to mutedAlert no longer affect the new alert.
🪄 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: ae54a9e1-1ddc-4433-992a-c6789eae4a42

📥 Commits

Reviewing files that changed from the base of the PR and between a3d63a7 and 2ebf454.

📒 Files selected for processing (5)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-html5/public/locales/en.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a WebSpeech-specific “microphone not transcribing” warning to help users diagnose cases where in-meeting audio uses a different mic than the browser’s WebSpeech input, resulting in speech activity but no captions.

Changes:

  • Introduces new audioCaptions.microphoneAlert configuration (enable flag, thresholds, duration, optional help link).
  • Adds English locale strings for the new toast message and optional “Learn more” label.
  • Implements microphone-alert detection in the WebSpeech captions component using hark on the current input MediaStream.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bigbluebutton-html5/public/locales/en.json Adds i18n strings for the microphone alert toast message and help label.
bigbluebutton-html5/private/config/settings.yml Adds audioCaptions.microphoneAlert settings (enabled, helpLink, thresholds, duration).
bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts Extends the client settings types to include microphoneAlert under audioCaptions.
bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts Provides initial/default values for the new microphoneAlert settings.
bigbluebutton-html5/imports/ui/components/audio/audio-graphql/audio-captions/speech/component.tsx Implements the alert logic (speaking detection + “no transcription for N ms” toast) and wires in the input stream.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Arthurk12
Arthurk12 force-pushed the bbb/40/issue/24637 branch from 2ebf454 to ed664f3 Compare June 29, 2026 20:25
@prlanzarin
prlanzarin self-requested a review July 1, 2026 17:10
The microphone used by the webspeech API and the one use to in-meeting
communication might differ if the default microphone in the OS is not
the one used in the meeting. In this scenario, a user would speak, the
talking indicator would confirm the microphone is correct, but webspeech
would not generate any transcription for the person, because the
internally selected microphone in the browser is not correct.

Add a new mechanism that raises a toast notification alert when a user
speaks(has floor) for a specific
time(`audioCaptions.microphoneAlert.speakingThreshold`) with no
transcription generated. The alert consists of a message pointing to a
wrong microphone selection in the browser/OS level - with the
possibility to show a link to a "learn
more"(`audioCaptions.microphoneAlert.helpLink`) page with directions of how
to fix/change that - OR that the user microphone is correct but has too
much background noise. The other configurations under
`audioCaptions.microphoneAlert` follow roughly the same semantics of
the muted alert.
@Arthurk12
Arthurk12 force-pushed the bbb/40/issue/24637 branch from ed664f3 to d0aeb48 Compare July 6, 2026 22:41
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

✅ Automated tests have passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants