I have built a musical webapp with Cordova (7.1.0) and I use the web audio API to manage sounds. My question is:
How can I check which audio source the player has been choose? Built-in audio VS bluetooth audio.
For example on the iPhone, during playing a game I can select to play sounds directly via my devices speakers (built-in speakers) or I can switch to my bluetooth speakers. How could I check via JavaScript when the user is switching from one mode to the other one?
I found a Cordova plugin about listening the headset state (plugged or not). This works well for wired headphones, but it doesn't work to detect when built-in speaker are switched to bluetooth speaker.
I found a Cordova plugin about listening the bluetooth state (connected or not). But this doesn't tell me when the user is switching mode...
Any ideas would be welcome!