twilio/audioswitch

Chromecast and audioswitch

elayes211 opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
The default audio routing behaviour of Android 11 and Android 12 makes me mad.
In reality the audio routing is not working properly.
I can change the audio output to the desired one but when I do that, after 1-2 seconds it switches back to default (AudioDeviceInfo.TYPE_REMOTE_SUBMIX in case of Chromecast).

Describe the solution you'd like
I would like a way to make system wide audio routing to finally work, while casting my screen to a Chromecast/TV, this way I will be able to route the sound to my USB headset and turn my PC into an Android computer.

Describe alternatives you've considered
I've tried using audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);, audioManager.setSpeakerphoneOn(true); and audioManager.setCommunicationDevice(setDevice);.
I've also tried, but not enough, to disable the chromecast audio device by using setWiredDeviceConnectionState and reflection of java. I cannot find the correct parameters to pass and I am getting system errors.
I've also tried MediaRecorder and routing of it's data directly to a device but Chromecast/TV Casting and MediaRecorder cannot work together, they stop each other.

Additional context
Untitled