Просмотр исходного кода

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.
master
Saúl Ibarra Corretgé 6 лет назад
Родитель
Сommit
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();

Загрузка…
Отмена
Сохранить