react-native-webrtc / react-native-webrtc/react-native-incall-manager

Disconnecting Bluetooth device (airpods), fallback to "small speaker" instead of the "loud speaker"

Open
#191 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
597
Forks
201
Avg merge
2h 42m
Merged PRs (30d)
1

Description

Hello,

I encounter a problem when I'm testing my app. When I'm starting a audio + video conversation with the Airpods, the sound is correctly broadcast in my ears but if I disconnect my airpods, the audio is redirected to the "small speaker" (the speaker used when you're in a phone call) instead of the "loud speaker" (the big one usually used in video calls)

First test (Working):

  • Starting video conversation WITHOUT airpods -> audio broadcast through the loud speaker ✅
  • Connecting the airpods -> audio is redirected to the airpods ✅
  • Disconnecting the airpods -> audio is redirect to the loud speaker ✅

Failing test:

  • Starting video conversation WITH airpods -> audio broadcast through the airpods ✅
  • Disconnecting the airpods -> audio is redirect to the "small speaker" ❌ The audio should be redirected to the "loud speaker"

My code which manage InCallManager:

private async initIncallManager() {
        await InCallManager.checkRecordPermission()
        InCallManager.start({ media: 'video' })
        InCallManager.setKeepScreenOn(true)

        if (Platform.OS === 'ios') {
            InCallManager.setForceSpeakerphoneOn(!InCallManager.getIsWiredHeadsetPluggedIn())
        }

        DeviceEventEmitter.addListener('WiredHeadset', ({ isPlugged, hasMic }: WiredHeadsetEventData) => {
            if (isPlugged && hasMic) {
                InCallManager.setForceSpeakerphoneOn(false)
            } else if (Platform.OS === 'ios') {
                InCallManager.setForceSpeakerphoneOn(!isPlugged) // Afin de forcer l'utilisation du speaker si on déconnecte des Airpods
            } else if (Platform.OS === 'android') {
                InCallManager.setSpeakerphoneOn(!isPlugged) // Afin de forcer l'utilisation du speaker si on déconnecte des Airpods
            }
        })
    }

The audio is not redirected correctly. I don't think my code changes anything to the audio redirection behavior. Is there a fix, workaround or any information about this case ?

Thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the initIncallManager entry point and its WiredHeadset listener, then trace the setForceSpeakerphoneOn and setSpeakerphoneOn calls for AirPods disconnection on iOS and Android. Done means reproducing the failing sequence and confirming that audio returns to the loud speaker rather than the small speaker; no file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.