From baa39896f134f974ba35995fac2066a7886f2ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 26 Nov 2020 15:50:05 +0100 Subject: [PATCH] fix(android) set stream type hardware buttons should control Ref: https://developer.android.com/reference/android/app/Activity#setVolumeControlStream(int) --- .../main/java/org/jitsi/meet/sdk/AudioModeModule.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java index 9cd59cfab..2c131f6c1 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java @@ -16,6 +16,7 @@ package org.jitsi.meet.sdk; +import android.app.Activity; import android.content.Context; import android.media.AudioManager; import android.os.Build; @@ -276,6 +277,15 @@ class AudioModeModule extends ReactContextBaseJavaModule { return; } + Activity currentActivity = getCurrentActivity(); + if (currentActivity != null) { + if (mode == DEFAULT) { + currentActivity.setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE); + } else { + currentActivity.setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); + } + } + runInAudioThread(new Runnable() { @Override public void run() {