twilio/audioswitch

Selected audio device is speakerphone but sound always out from earpiece.(OPPO R15 Pro)

AminHong opened this issue · 18 comments

Describe the bug
Selected audio device is speakerphone but sound always out from earpiece when used OPPO R15 Pro.

Application Logs
截圖 2021-06-01 上午11 53 45

AudioSwitch Version

  • Version: 1.1.1

Android Device (please complete the following information):

  • Device: OPPO R15 Pro (Android 10) ColorOS v7.1

Additional context
When i tried set audio manager mode to Mode_In_Call still invalid.

Thanks for reaching out @AminHong ! We'll try to take a further look into this issue soon.

For me, selected mode shows wired headset but voice is coming from speaker. Works fine if i change it to wired headset using select and activate methods. Not sure how to reproduce. Occuring sometimes.

@AminHong we have problems reproducing this issue with the same device. Is this still a problem on your side? Would it be possible for you to add logs with logginEnabled when you encounter this issue? Thanks

I've same issue :)) , by code does not changing to speaker phone , only working with UI , means user must select speaker phone to change audio output.

@misteloo What do you mean by "only working with UI"? Can you maybe add steps or code samples how you run in to the issue.

Getting the same issue on a few different devices, but only sometimes. I haven't recorded how often it happens, but from personal experience I would guess it happens about 25-50% of the time, where the audio comes through the earpiece after confirming that the speakerphone device was selected and activated.

It doesn't seem like the device matters, but here's the list of devices I've been able to reproduce on:

  • Pixel 4
  • Pixel 8 Pro
  • Samsung Galaxy S10

@AlanMTuring Does it happen initially when activating AudioSwitch, i.e. audio output is from different AudioDevice than selected, or when switching devices? Is there a specific scenario where this happens more often than not?

We've only encountered the problem when switching devices, not on initial start.

As far as I can tell, there isn't a specific scenario when this happens. It can be on inbound and outbound calls, wifi or cellular. When it does happen, it's always for the duration of the call. So if it fails to switch at the beginning of the call, switching back to earpiece and waiting, then trying again always doesn't work. But if it works at the beginning of a call, we seem to be able to toggle successfully for the rest of the call.

When the audio switch gets started, I've put some logs in the AudioDeviceChangeListener and I've confirmed that after selectDevice and activate on the speaker get called, the new selectedAudioDevice is the speaker, but audio still comes quietly from the earpiece.

@AlanMTuring I am struggling to reproduce the issue. Does this happen on your own app; can you reproduce the same issue on voice or video quickstarts? Also, is it possible for you to add some logs with AudioSwitch.loggingEnabled where you encounter the problem?

This happens on my app, looking into the voice quickstart.

I enabled AudioSwitch's logging and got this from a simple inbound call. Logs show no user selected device (defaults to earpiece) then I select the speakerphone. After the speakerphone is selected and the logs show it's the selected device, sound still comes from the earpiece.

AS/AudioSwitch          ---    D  Available AudioDevice list updated: [Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [BluetoothHeadset(name=Google Pixel Watch 01PE), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [BluetoothHeadset(name=Google Pixel Watch 01PE), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [BluetoothHeadset(name=Google Pixel Watch 01PE), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = null
AS/AudioSwitch          ---    D  Selected AudioDevice = Speakerphone(name=Speakerphone)
AS/AudioSwitch          ---    D  Available AudioDevice list updated: [BluetoothHeadset(name=Google Pixel Watch 01PE), Earpiece(name=Earpiece), Speakerphone(name=Speakerphone)]
AS/AudioSwitch          ---    D  Current user selected AudioDevice = Speakerphone(name=Speakerphone)

There doesn't seem to be anything out of ordinary with the logs provided. @AlanMTuring Let me know if you were able to reproduce the issue with quickstart.

This happens to me as well. Using latest Audio com.twilio:audioswitch:1.1.8 and com.twilio:voice-android:6.4.0
Any resolution / work around?

@softsan does this happen with the normal quickstart or with the ConnecitonService flavor?

I have the same issue with Galaxy S10

@chanphiromsok Thank you for reporting, did you have this issue with the QuickStart using ConnectionService?

@softsan does this happen with the normal quickstart or with the ConnecitonService flavor?

With quickstart and with connectionService as well

@chanphiromsok Thank you for reporting, did you have this issue with the QuickStart using ConnectionService?

I used this lib I don't know much about native it might hard to you https://github.com/jellyfish-dev/react-native-membrane-webrtc/tree/master
whereas this fork repo from twilio is work fine on my device he commit and fixed audio switch https://github.com/davidliu/audioswitch

I have the same issue here...
My device is a Samsung S21 FE