浏览代码

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 年前
父节点
当前提交
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
      */
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();

正在加载...
取消
保存