Hi, I just wrote a simple extension that helps to do what you described.
It helps you to switch headphone/speaker mode to decide where the audio is played.
Using the AudioTrackX, you can request the system to alter between speaker and earphones/headphones mode.
I've attached the project below, when the checkbox is ticked, the audio is played through speaker, else by default it choose the connected external audio device.
Moreover, additionally the extension also offers a way to query available Audio Devices using the QueryAudioDevices block.
AudioTestX.aia (49.9 KB)
xyz.kumaraswamy.audiotrackx.aix (7.3 KB)
I hope this helps in your project! Please let me know the result.
Thanks you, ![]()
Kumaraswamy
