You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: android/src/main/java/com/livekit/reactnative/LiveKitReactNative.kt
+16-18Lines changed: 16 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -24,30 +24,25 @@ object LiveKitReactNative {
24
24
25
25
val audioDeviceModule:JavaAudioDeviceModule
26
26
get() {
27
-
val adm =this.adm
27
+
returnthis.adm
28
28
?:throwIllegalStateException("Audio device module is not initialized! Did you remember to call LiveKitReactNative.setup in your Application.onCreate?")
val audioProcessingController:AudioProcessingController
35
34
get() {
36
-
if (!::_audioProcessingController.isInitialized) {
37
-
throwIllegalStateException("audioProcessingController is not initialized! Did you remember to call LiveKitReactNative.setup in your Application.onCreate?")
38
-
}
39
-
return_audioProcessingController
35
+
returnthis._audioProcessingController
36
+
?:throwIllegalStateException("audioProcessingController is not initialized! Did you remember to call LiveKitReactNative.setup in your Application.onCreate?")
val audioRecordSamplesDispatcher:AudioRecordSamplesDispatcher
46
43
get() {
47
-
if (!::_audioRecordSamplesDispatcher.isInitialized) {
44
+
returnthis._audioRecordSamplesDispatcher?:
48
45
throwIllegalStateException("audioRecordSamplesDispatcher is not initialized! Did you remember to call LiveKitReactNative.setup in your Application.onCreate?")
49
-
}
50
-
return_audioRecordSamplesDispatcher
51
46
}
52
47
53
48
@@ -73,6 +68,13 @@ object LiveKitReactNative {
73
68
74
69
setupAdm(context)
75
70
options.audioDeviceModule = adm
71
+
// CustomAudioProcessingController can't be instantiated before WebRTC is loaded.
72
+
options.audioProcessingFactoryFactory =Callable {
73
+
val apc =CustomAudioProcessingController()
74
+
_audioProcessingController= apc
75
+
return@Callable apc.externalAudioProcessor
76
+
}
77
+
76
78
}
77
79
78
80
privatefunsetupAdm(context:Context) {
@@ -94,15 +96,11 @@ object LiveKitReactNative {
94
96
adm?.release()
95
97
adm =null
96
98
99
+
_audioProcessingController=null
100
+
101
+
// adm needs to be re-setup with a new one each time.
97
102
setupAdm(context)
98
103
options.audioDeviceModule = adm
99
104
100
-
// CustomAudioProcessingController can't be instantiated before WebRTC is loaded.
0 commit comments