Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

android: fix initializing audio device handler modules too early

Saúl Ibarra Corretgé6b716f8f56d1
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 88146cef75..b579d86d8e 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
@@ -136,8 +136,6 @@ class AudioModeModule extends ReactContextBaseJavaModule {
*/
public AudioModeModule(ReactApplicationContext reactContext) {
super(reactContext);
-
- setAudioDeviceHandler();
}
/**
@@ -193,6 +191,16 @@ class AudioModeModule extends ReactContextBaseJavaModule {
return NAME;
}
+ /**
+ * Initializes the audio device handler module. This function is called *after* all Catalyst
+ * modules have been created, and that's why we use it, because {@link AudioDeviceHandlerConnectionService}
+ * needs access to another Catalyst module, so doing this in the constructor would be too early.
+ */
+ @Override
+ public void initialize() {
+ setAudioDeviceHandler();
+ }
+
private void setAudioDeviceHandler() {
if (audioDeviceHandler != null) {
audioDeviceHandler.stop();