Skip to content Skip to sidebar Skip to footer

Webview Change Audio Output Device

How can I change the audio output of WebView from loudspeaker to earpiece? I tried this code, but it is not working private fun setupAudio() { val am = getSystemService

Solution 1:

Stop send and received in BT, turn off BT and then turn off speakerphone. This is to turn on earpiece.

        am.setMode(AudioManager.MODE_IN_COMMUNICATION); //
        am.stopBluetoothSco(); // stop send and receive
        am.setBluetoothScoOn(false); // turn off bluetooth
        am.setSpeakerphoneOn(false); // true to turn on speakerphone; false to turn it off

To turn on internal speaker -

   am.setMode(AudioManager.MODE_NORMAL);
   am.stopBluetoothSco();
   am.setBluetoothScoOn(false);
   am.setSpeakerphoneOn(true);

Solution 2:

Post a Comment for "Webview Change Audio Output Device"