twilio / audioswitch

An Android audio management library for real-time communication apps.
Apache License 2.0
163 stars 50 forks source link

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

Open AminHong opened 3 years ago

AminHong commented 3 years ago

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

Android Device (please complete the following information):

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

Alton09 commented 3 years ago

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

kevinpatel20 commented 3 years ago

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.

ocarevs commented 1 year ago

@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

misteloo commented 1 year ago

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.

ocarevs commented 11 months ago

@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.

AlanMTuring commented 10 months ago

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:

ocarevs commented 9 months ago

@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?

AlanMTuring commented 9 months ago

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.

ocarevs commented 9 months ago

@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?

AlanMTuring commented 9 months ago

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)
ocarevs commented 9 months ago

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.

softsan commented 9 months ago

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?

afalls-twilio commented 7 months ago

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

chanphiromsok commented 6 months ago

I have the same issue with Galaxy S10

afalls-twilio commented 6 months ago

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

softsan commented 6 months ago

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

With quickstart and with connectionService as well

chanphiromsok commented 6 months ago

@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

gustavobarbosab-aloware commented 1 month ago

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