|
@@ -29,6 +29,17 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
29
|
29
|
import com.facebook.react.common.LifecycleState;
|
30
|
30
|
import com.facebook.react.devsupport.DevInternalSettings;
|
31
|
31
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
32
|
+import com.facebook.react.uimanager.ViewManager;
|
|
33
|
+import com.oney.WebRTCModule.RTCVideoViewManager;
|
|
34
|
+import com.oney.WebRTCModule.WebRTCModule;
|
|
35
|
+
|
|
36
|
+import org.webrtc.SoftwareVideoDecoderFactory;
|
|
37
|
+import org.webrtc.SoftwareVideoEncoderFactory;
|
|
38
|
+import org.webrtc.VideoDecoderFactory;
|
|
39
|
+import org.webrtc.VideoEncoderFactory;
|
|
40
|
+import org.webrtc.audio.AudioDeviceModule;
|
|
41
|
+import org.webrtc.audio.JavaAudioDeviceModule;
|
|
42
|
+import org.webrtc.voiceengine.WebRtcAudioManager;
|
32
|
43
|
|
33
|
44
|
import java.lang.reflect.Constructor;
|
34
|
45
|
import java.util.ArrayList;
|
|
@@ -47,8 +58,7 @@ class ReactInstanceManagerHolder {
|
47
|
58
|
*/
|
48
|
59
|
private static ReactInstanceManager reactInstanceManager;
|
49
|
60
|
|
50
|
|
- private static List<NativeModule> createNativeModules(
|
51
|
|
- ReactApplicationContext reactContext) {
|
|
61
|
+ private static List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
52
|
62
|
List<NativeModule> nativeModules
|
53
|
63
|
= new ArrayList<>(Arrays.<NativeModule>asList(
|
54
|
64
|
new AndroidSettingsModule(reactContext),
|
|
@@ -66,6 +76,21 @@ class ReactInstanceManagerHolder {
|
66
|
76
|
nativeModules.add(new RNConnectionService(reactContext));
|
67
|
77
|
}
|
68
|
78
|
|
|
79
|
+ // Initialize the WebRTC module by hand, since we want to override some
|
|
80
|
+ // initialization options.
|
|
81
|
+ WebRTCModule.Options options = new WebRTCModule.Options();
|
|
82
|
+
|
|
83
|
+ AudioDeviceModule adm = JavaAudioDeviceModule.builder(reactContext)
|
|
84
|
+ .createAudioDeviceModule();
|
|
85
|
+ VideoDecoderFactory videoDecoderFactory = new SoftwareVideoDecoderFactory();
|
|
86
|
+ VideoEncoderFactory videoEncoderFactory = new SoftwareVideoEncoderFactory();
|
|
87
|
+
|
|
88
|
+ options.setAudioDeviceModule(adm);
|
|
89
|
+ options.setVideoDecoderFactory(videoDecoderFactory);
|
|
90
|
+ options.setVideoEncoderFactory(videoEncoderFactory);
|
|
91
|
+
|
|
92
|
+ nativeModules.add(new WebRTCModule(reactContext, options));
|
|
93
|
+
|
69
|
94
|
try {
|
70
|
95
|
Class<?> amplitudeModuleClass = Class.forName("org.jitsi.meet.sdk.AmplitudeModule");
|
71
|
96
|
Constructor constructor = amplitudeModuleClass.getConstructor(ReactApplicationContext.class);
|
|
@@ -77,6 +102,13 @@ class ReactInstanceManagerHolder {
|
77
|
102
|
return nativeModules;
|
78
|
103
|
}
|
79
|
104
|
|
|
105
|
+ private static List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
106
|
+ return Arrays.<ViewManager>asList(
|
|
107
|
+ // WebRTC, see createNativeModules for details.
|
|
108
|
+ new RTCVideoViewManager()
|
|
109
|
+ );
|
|
110
|
+ }
|
|
111
|
+
|
80
|
112
|
/**
|
81
|
113
|
* Helper function to send an event to JavaScript.
|
82
|
114
|
*
|
|
@@ -158,7 +190,6 @@ class ReactInstanceManagerHolder {
|
158
|
190
|
new com.facebook.react.shell.MainReactPackage(),
|
159
|
191
|
new com.oblador.vectoricons.VectorIconsPackage(),
|
160
|
192
|
new com.ocetnik.timer.BackgroundTimerPackage(),
|
161
|
|
- new com.oney.WebRTCModule.WebRTCModulePackage(),
|
162
|
193
|
new com.reactnativecommunity.asyncstorage.AsyncStoragePackage(),
|
163
|
194
|
new com.reactnativecommunity.webview.RNCWebViewPackage(),
|
164
|
195
|
new com.rnimmersive.RNImmersivePackage(),
|
|
@@ -168,6 +199,10 @@ class ReactInstanceManagerHolder {
|
168
|
199
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
169
|
200
|
return ReactInstanceManagerHolder.createNativeModules(reactContext);
|
170
|
201
|
}
|
|
202
|
+ @Override
|
|
203
|
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
204
|
+ return ReactInstanceManagerHolder.createViewManagers(reactContext);
|
|
205
|
+ }
|
171
|
206
|
}));
|
172
|
207
|
|
173
|
208
|
try {
|