Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Automatic audio context resumption causes errors in Firefox #1445

@maexn

Description

@maexn

Describe the bug

Version v2.9.6 introduced Automatically attempt to resume suspended audio contexts on click, which causes a DOMException in Firefox after disabling a microphone.

Expected behavior

Calling setMicrophoneEnabled(false) to disable a microphone should not trigger any errors.

Actual behavior

After calling setMicrophoneEnabled(false), a DOMException occurs in the browser console.

Reproduction

  1. Open the demo app in Firefox
  2. Enable and then disable the microphone / audio
  3. Observe the uncaught DOMException in the browser console

This issue does not require any modifications to the demo app.

Logs

Uncaught (in promise) DOMException: Can't resume if the control thread state is "closed"
    handleResume utils.ts:144
    getNewAudioContext utils.ts:148
    detectSilence utils.ts:109
    checkForSilence LocalAudioTrack.ts:244
    LocalAudioTrack LocalAudioTrack.ts:45
    mediaTrackToLocalTrack publishUtils.ts:33
    createTracks LocalParticipant.ts:650
    createTracks LocalParticipant.ts:643
    setTrackEnabled LocalParticipant.ts:501
    setMicrophoneEnabled LocalParticipant.ts:410
    toggleAudio demo.ts:454
    onclick (index):1
utils.ts:144:8

System Info

System:
    OS: macOS 15.3.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 213.39 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.0 - ~/.local/state/fnm_multishells/38820_1741967168891/bin/node
    npm: 10.5.0 - ~/.local/state/fnm_multishells/38820_1741967168891/bin/npm
    pnpm: 9.15.7 - ~/.local/state/fnm_multishells/38820_1741967168891/bin/pnpm
  Browsers:
    Safari: 18.3
  npmPackages:
    @livekit/changesets-changelog-github: ^0.0.4 => 0.0.4

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions