Home > Software design >  How to change Webview of audio output from speaker to earphone
How to change Webview of audio output from speaker to earphone

Time:10-06

How can I change the audio output of WebView from speaker to earphone? I tried but it's not working

private fun setupAudio() {
        val am = getSystemService(AUDIO_SERVICE) as AudioManager
        am.mode = AudioManager.MODE_IN_COMMUNICATION
        am.stopBluetoothSco()
        am.isSpeakerphoneOn=false
        Log.e("Foo","Mode is ${am.mode}")
    }

Permission

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

CodePudding user response:

Check out this solution from other question here on StackOverflow looking same as your's Link to your solution

  • Related