瀏覽代碼

android: fix initializing audio device handler modules too early

When ConnectionService is used (the default) we were attaching the handlers too
early, and since attaching them requires that the RNConnectionService module is
loaded, it silently failed. Instead, use the initialize() method, which gets
called after all the Catalyst (aka native) modules have been loaded.
j8
Saúl Ibarra Corretgé 5 年之前
父節點
當前提交
6b716f8f56
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10
    2
      android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java

+ 10
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java 查看文件

@@ -136,8 +136,6 @@ class AudioModeModule extends ReactContextBaseJavaModule {
136 136
      */
137 137
     public AudioModeModule(ReactApplicationContext reactContext) {
138 138
         super(reactContext);
139
-
140
-        setAudioDeviceHandler();
141 139
     }
142 140
 
143 141
     /**
@@ -193,6 +191,16 @@ class AudioModeModule extends ReactContextBaseJavaModule {
193 191
         return NAME;
194 192
     }
195 193
 
194
+    /**
195
+     * Initializes the audio device handler module. This function is called *after* all Catalyst
196
+     * modules have been created, and that's why we use it, because {@link AudioDeviceHandlerConnectionService}
197
+     * needs access to another Catalyst module, so doing this in the constructor would be too early.
198
+     */
199
+    @Override
200
+    public void initialize() {
201
+        setAudioDeviceHandler();
202
+    }
203
+
196 204
     private void setAudioDeviceHandler() {
197 205
         if (audioDeviceHandler != null) {
198 206
             audioDeviceHandler.stop();

Loading…
取消
儲存