Browse Source

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é 6 years ago
parent
commit
6b716f8f56
1 changed files with 10 additions and 2 deletions
  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 View File

136
      */
136
      */
137
     public AudioModeModule(ReactApplicationContext reactContext) {
137
     public AudioModeModule(ReactApplicationContext reactContext) {
138
         super(reactContext);
138
         super(reactContext);
139
-
140
-        setAudioDeviceHandler();
141
     }
139
     }
142
 
140
 
143
     /**
141
     /**
193
         return NAME;
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
     private void setAudioDeviceHandler() {
204
     private void setAudioDeviceHandler() {
197
         if (audioDeviceHandler != null) {
205
         if (audioDeviceHandler != null) {
198
             audioDeviceHandler.stop();
206
             audioDeviceHandler.stop();

Loading…
Cancel
Save