@fishjam-cloud/react-native-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +7 -0
- package/.eslintrc +6 -0
- package/.prettierrc +9 -0
- package/.watchmanconfig +1 -0
- package/android/.editorconfig +9 -0
- package/android/build.gradle +89 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/org/membraneframework/reactnative/AudioDeviceKind.kt +34 -0
- package/android/src/main/java/org/membraneframework/reactnative/AudioSwitchManager.kt +61 -0
- package/android/src/main/java/org/membraneframework/reactnative/EmitableEvents.kt +14 -0
- package/android/src/main/java/org/membraneframework/reactnative/Errors.kt +31 -0
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClient.kt +866 -0
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClientModule.kt +294 -0
- package/android/src/main/java/org/membraneframework/reactnative/Utils.kt +11 -0
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewView.kt +40 -0
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewViewModule.kt +17 -0
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererView.kt +58 -0
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererViewModule.kt +25 -0
- package/android/src/main/java/org/membraneframework/reactnative/VideoView.kt +77 -0
- package/app.plugin.js +1 -0
- package/babel.config.js +2 -0
- package/build/RNFishjamClientModule.d.ts +47 -0
- package/build/RNFishjamClientModule.d.ts.map +1 -0
- package/build/RNFishjamClientModule.js +4 -0
- package/build/RNFishjamClientModule.js.map +1 -0
- package/build/common/client.d.ts +19 -0
- package/build/common/client.d.ts.map +1 -0
- package/build/common/client.js +8 -0
- package/build/common/client.js.map +1 -0
- package/build/common/eventEmitter.d.ts +16 -0
- package/build/common/eventEmitter.d.ts.map +1 -0
- package/build/common/eventEmitter.js +17 -0
- package/build/common/eventEmitter.js.map +1 -0
- package/build/common/metadata.d.ts +7 -0
- package/build/common/metadata.d.ts.map +1 -0
- package/build/common/metadata.js +9 -0
- package/build/common/metadata.js.map +1 -0
- package/build/common/webRTC.d.ts +19 -0
- package/build/common/webRTC.d.ts.map +1 -0
- package/build/common/webRTC.js +22 -0
- package/build/common/webRTC.js.map +1 -0
- package/build/components/VideoPreviewView.d.ts +21 -0
- package/build/components/VideoPreviewView.d.ts.map +1 -0
- package/build/components/VideoPreviewView.js +7 -0
- package/build/components/VideoPreviewView.js.map +1 -0
- package/build/components/VideoRendererView.d.ts +19 -0
- package/build/components/VideoRendererView.d.ts.map +1 -0
- package/build/components/VideoRendererView.js +7 -0
- package/build/components/VideoRendererView.js.map +1 -0
- package/build/hooks/useAudioSettings.d.ts +23 -0
- package/build/hooks/useAudioSettings.d.ts.map +1 -0
- package/build/hooks/useAudioSettings.js +72 -0
- package/build/hooks/useAudioSettings.js.map +1 -0
- package/build/hooks/useBandwidthEstimation.d.ts +12 -0
- package/build/hooks/useBandwidthEstimation.d.ts.map +1 -0
- package/build/hooks/useBandwidthEstimation.js +16 -0
- package/build/hooks/useBandwidthEstimation.js.map +1 -0
- package/build/hooks/useCamera.d.ts +80 -0
- package/build/hooks/useCamera.d.ts.map +1 -0
- package/build/hooks/useCamera.js +140 -0
- package/build/hooks/useCamera.js.map +1 -0
- package/build/hooks/useMicrophone.d.ts +8 -0
- package/build/hooks/useMicrophone.d.ts.map +1 -0
- package/build/hooks/useMicrophone.js +27 -0
- package/build/hooks/useMicrophone.js.map +1 -0
- package/build/hooks/useParticipants.d.ts +62 -0
- package/build/hooks/useParticipants.d.ts.map +1 -0
- package/build/hooks/useParticipants.js +32 -0
- package/build/hooks/useParticipants.js.map +1 -0
- package/build/hooks/useReconnection.d.ts +5 -0
- package/build/hooks/useReconnection.d.ts.map +1 -0
- package/build/hooks/useReconnection.js +23 -0
- package/build/hooks/useReconnection.js.map +1 -0
- package/build/hooks/useScreencast.d.ts +38 -0
- package/build/hooks/useScreencast.d.ts.map +1 -0
- package/build/hooks/useScreencast.js +81 -0
- package/build/hooks/useScreencast.js.map +1 -0
- package/build/index.d.ts +24 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +14 -0
- package/build/index.js.map +1 -0
- package/build/protos/fishjam/peer_notifications.d.ts +63 -0
- package/build/protos/fishjam/peer_notifications.d.ts.map +1 -0
- package/build/protos/fishjam/peer_notifications.js +235 -0
- package/build/protos/fishjam/peer_notifications.js.map +1 -0
- package/build/stats/types.d.ts +55 -0
- package/build/stats/types.d.ts.map +1 -0
- package/build/stats/types.js +2 -0
- package/build/stats/types.js.map +1 -0
- package/build/stats/useRTCStatistics.d.ts +8 -0
- package/build/stats/useRTCStatistics.d.ts.map +1 -0
- package/build/stats/useRTCStatistics.js +78 -0
- package/build/stats/useRTCStatistics.js.map +1 -0
- package/build/types.d.ts +43 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/expo-module.config.json +17 -0
- package/ios/Events.swift +13 -0
- package/ios/RNFishjamClient.podspec +30 -0
- package/ios/RNFishjamClient.swift +836 -0
- package/ios/RNFishjamClientModule.swift +220 -0
- package/ios/Utils.swift +43 -0
- package/ios/VideoPreviewView.swift +64 -0
- package/ios/VideoPreviewViewModule.swift +21 -0
- package/ios/VideoRendererView.swift +84 -0
- package/ios/VideoRendererViewModule.swift +17 -0
- package/ios/swift-format-config.json +56 -0
- package/package.json +89 -0
- package/plugin/broadcastExtensionFiles/Info.plist +27 -0
- package/plugin/broadcastExtensionFiles/MembraneBroadcastSampleHandler.swift +50 -0
- package/plugin/broadcastExtensionFiles/MembraneScreenBroadcastExtension.entitlements +10 -0
- package/plugin/src/withMembrane.ts +310 -0
- package/plugin/tsconfig.json +9 -0
- package/scripts/lint.sh +18 -0
- package/scripts/lint_check.sh +14 -0
- package/src/RNFishjamClientModule.ts +73 -0
- package/src/__tests__/index.test.tsx +199 -0
- package/src/common/client.ts +33 -0
- package/src/common/eventEmitter.ts +21 -0
- package/src/common/metadata.ts +12 -0
- package/src/common/webRTC.ts +31 -0
- package/src/components/VideoPreviewView.tsx +33 -0
- package/src/components/VideoRendererView.tsx +31 -0
- package/src/hooks/useAudioSettings.ts +115 -0
- package/src/hooks/useBandwidthEstimation.ts +24 -0
- package/src/hooks/useCamera.ts +270 -0
- package/src/hooks/useMicrophone.ts +38 -0
- package/src/hooks/useParticipants.ts +118 -0
- package/src/hooks/useReconnection.ts +41 -0
- package/src/hooks/useScreencast.ts +146 -0
- package/src/index.tsx +63 -0
- package/src/protos/fishjam/peer_notifications.ts +299 -0
- package/src/stats/types.ts +56 -0
- package/src/stats/useRTCStatistics.ts +97 -0
- package/src/types.ts +49 -0
- package/tsconfig.json +9 -0
- package/typedoc.json +5 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.Promise
|
|
4
|
+
import expo.modules.kotlin.functions.Coroutine
|
|
5
|
+
import expo.modules.kotlin.modules.Module
|
|
6
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
7
|
+
import expo.modules.kotlin.records.Field
|
|
8
|
+
import expo.modules.kotlin.records.Record
|
|
9
|
+
import kotlinx.coroutines.CoroutineScope
|
|
10
|
+
import kotlinx.coroutines.Dispatchers
|
|
11
|
+
import kotlinx.coroutines.launch
|
|
12
|
+
import kotlinx.coroutines.sync.Mutex
|
|
13
|
+
import kotlinx.coroutines.sync.withLock
|
|
14
|
+
import kotlinx.coroutines.withContext
|
|
15
|
+
|
|
16
|
+
class SimulcastConfig : Record {
|
|
17
|
+
@Field
|
|
18
|
+
val enabled: Boolean = false
|
|
19
|
+
|
|
20
|
+
@Field
|
|
21
|
+
val activeEncodings: List<String> = emptyList()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class CameraConfig : Record {
|
|
25
|
+
@Field
|
|
26
|
+
val quality: String = "VGA169"
|
|
27
|
+
|
|
28
|
+
@Field
|
|
29
|
+
val flipVideo: Boolean = false
|
|
30
|
+
|
|
31
|
+
@Field
|
|
32
|
+
val videoTrackMetadata: Map<String, Any> = emptyMap()
|
|
33
|
+
|
|
34
|
+
@Field
|
|
35
|
+
val simulcastConfig: SimulcastConfig = SimulcastConfig()
|
|
36
|
+
|
|
37
|
+
// expo-modules on Android don't support Either type
|
|
38
|
+
@Field
|
|
39
|
+
val maxBandwidthMap: Map<String, Int> = emptyMap()
|
|
40
|
+
|
|
41
|
+
@Field
|
|
42
|
+
val maxBandwidthInt: Int = 0
|
|
43
|
+
|
|
44
|
+
@Field
|
|
45
|
+
val cameraEnabled: Boolean = true
|
|
46
|
+
|
|
47
|
+
@Field
|
|
48
|
+
val captureDeviceId: String? = null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class ScreencastOptions : Record {
|
|
52
|
+
@Field
|
|
53
|
+
val quality: String = "HD15"
|
|
54
|
+
|
|
55
|
+
@Field
|
|
56
|
+
val screencastMetadata: Map<String, Any> = emptyMap()
|
|
57
|
+
|
|
58
|
+
@Field
|
|
59
|
+
val simulcastConfig: SimulcastConfig = SimulcastConfig()
|
|
60
|
+
|
|
61
|
+
@Field
|
|
62
|
+
val maxBandwidthMap: Map<String, Int> = emptyMap()
|
|
63
|
+
|
|
64
|
+
@Field
|
|
65
|
+
val maxBandwidthInt: Int = 0
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
class ReconnectConfig : Record {
|
|
69
|
+
@Field
|
|
70
|
+
val maxAttempts: Int = 5
|
|
71
|
+
|
|
72
|
+
@Field
|
|
73
|
+
val initialDelayMs: Long = 1000
|
|
74
|
+
|
|
75
|
+
@Field
|
|
76
|
+
val delayMs: Long = 1000
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class ConnectConfig : Record {
|
|
80
|
+
@Field
|
|
81
|
+
val reconnectConfig: ReconnectConfig = ReconnectConfig()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class RNFishjamClientModule : Module() {
|
|
85
|
+
override fun definition() =
|
|
86
|
+
ModuleDefinition {
|
|
87
|
+
Name("RNFishjamClient")
|
|
88
|
+
|
|
89
|
+
Events(
|
|
90
|
+
"IsCameraOn",
|
|
91
|
+
"IsMicrophoneOn",
|
|
92
|
+
"IsScreencastOn",
|
|
93
|
+
"SimulcastConfigUpdate",
|
|
94
|
+
"PeersUpdate",
|
|
95
|
+
"AudioDeviceUpdate",
|
|
96
|
+
"SendMediaEvent",
|
|
97
|
+
"BandwidthEstimation",
|
|
98
|
+
"ReconnectionRetriesLimitReached",
|
|
99
|
+
"ReconnectionStarted",
|
|
100
|
+
"Reconnected"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
val rnFishjamClient =
|
|
104
|
+
RNFishjamClient { name: String, data: Map<String, Any?> ->
|
|
105
|
+
sendEvent(name, data)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
val mutex = Mutex()
|
|
109
|
+
|
|
110
|
+
OnCreate {
|
|
111
|
+
rnFishjamClient.onModuleCreate(appContext)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
OnDestroy {
|
|
115
|
+
rnFishjamClient.onModuleDestroy()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
OnActivityDestroys {
|
|
119
|
+
rnFishjamClient.leaveRoom()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
OnActivityResult { _, result ->
|
|
123
|
+
rnFishjamClient.onActivityResult(result.requestCode, result.resultCode, result.data)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
AsyncFunction("connect") { url: String, peerToken: String, peerMetadata: Map<String, Any>, config: ConnectConfig, promise: Promise ->
|
|
127
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
128
|
+
rnFishjamClient.connect(url, peerToken, peerMetadata, config, promise)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
AsyncFunction("leaveRoom") Coroutine { ->
|
|
133
|
+
withContext(Dispatchers.Main) {
|
|
134
|
+
rnFishjamClient.leaveRoom()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
AsyncFunction("startCamera") Coroutine { config: CameraConfig ->
|
|
139
|
+
withContext(Dispatchers.Main) {
|
|
140
|
+
rnFishjamClient.startCamera(config)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Property("isMicrophoneOn") {
|
|
145
|
+
return@Property rnFishjamClient.isMicrophoneOn
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
AsyncFunction("toggleMicrophone") Coroutine { ->
|
|
149
|
+
withContext(Dispatchers.Main) {
|
|
150
|
+
rnFishjamClient.toggleMicrophone()
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Property("isCameraOn") {
|
|
155
|
+
return@Property rnFishjamClient.isCameraOn
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
AsyncFunction("toggleCamera") Coroutine { ->
|
|
159
|
+
withContext(Dispatchers.Main) {
|
|
160
|
+
rnFishjamClient.toggleCamera()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
AsyncFunction("flipCamera") Coroutine { ->
|
|
165
|
+
mutex.withLock {
|
|
166
|
+
withContext(Dispatchers.Main) {
|
|
167
|
+
rnFishjamClient.flipCamera()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
AsyncFunction("switchCamera") Coroutine { captureDeviceId: String ->
|
|
173
|
+
mutex.withLock {
|
|
174
|
+
withContext(Dispatchers.Main) {
|
|
175
|
+
rnFishjamClient.switchCamera(captureDeviceId)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
AsyncFunction("getCaptureDevices") Coroutine { ->
|
|
181
|
+
withContext(Dispatchers.Main) {
|
|
182
|
+
rnFishjamClient.getCaptureDevices()
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
AsyncFunction("handleScreencastPermission") { promise: Promise ->
|
|
187
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
188
|
+
rnFishjamClient.handleScreencastPermission(promise)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
AsyncFunction("toggleScreencast") Coroutine { screencastOptions: ScreencastOptions ->
|
|
193
|
+
withContext(Dispatchers.Main) {
|
|
194
|
+
rnFishjamClient.toggleScreencast(screencastOptions)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
Property("isScreencastOn") {
|
|
199
|
+
return@Property rnFishjamClient.isScreencastOn
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
AsyncFunction("getPeers") Coroutine { ->
|
|
203
|
+
withContext(Dispatchers.Main) {
|
|
204
|
+
rnFishjamClient.getPeers()
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
AsyncFunction("updatePeerMetadata") Coroutine { metadata: Map<String, Any> ->
|
|
209
|
+
withContext(Dispatchers.Main) {
|
|
210
|
+
rnFishjamClient.updatePeerMetadata(metadata)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
AsyncFunction("updateVideoTrackMetadata") Coroutine { metadata: Map<String, Any> ->
|
|
215
|
+
withContext(Dispatchers.Main) {
|
|
216
|
+
rnFishjamClient.updateLocalVideoTrackMetadata(metadata)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
AsyncFunction("updateAudioTrackMetadata") Coroutine { metadata: Map<String, Any> ->
|
|
221
|
+
withContext(Dispatchers.Main) {
|
|
222
|
+
rnFishjamClient.updateLocalAudioTrackMetadata(metadata)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
AsyncFunction("updateScreencastTrackMetadata") Coroutine { metadata: Map<String, Any> ->
|
|
227
|
+
withContext(Dispatchers.Main) {
|
|
228
|
+
rnFishjamClient.updateLocalScreencastTrackMetadata(metadata)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
AsyncFunction("setOutputAudioDevice") { audioDevice: String ->
|
|
233
|
+
rnFishjamClient.setOutputAudioDevice(audioDevice)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
AsyncFunction("startAudioSwitcher") {
|
|
237
|
+
rnFishjamClient.startAudioSwitcher()
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
AsyncFunction("stopAudioSwitcher") {
|
|
241
|
+
rnFishjamClient.stopAudioSwitcher()
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
AsyncFunction("toggleScreencastTrackEncoding") Coroutine { encoding: String ->
|
|
245
|
+
withContext(Dispatchers.Main) {
|
|
246
|
+
rnFishjamClient.toggleScreencastTrackEncoding(encoding)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
AsyncFunction("setScreencastTrackBandwidth") Coroutine { bandwidth: Int ->
|
|
251
|
+
withContext(Dispatchers.Main) {
|
|
252
|
+
rnFishjamClient.setScreencastTrackBandwidth(bandwidth)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
AsyncFunction("setScreencastTrackEncodingBandwidth") Coroutine { encoding: String, bandwidth: Int ->
|
|
257
|
+
withContext(Dispatchers.Main) {
|
|
258
|
+
rnFishjamClient.setScreencastTrackEncodingBandwidth(encoding, bandwidth)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
AsyncFunction("setTargetTrackEncoding") Coroutine { trackId: String, encoding: String ->
|
|
263
|
+
withContext(Dispatchers.Main) {
|
|
264
|
+
rnFishjamClient.setTargetTrackEncoding(trackId, encoding)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
AsyncFunction("toggleVideoTrackEncoding") Coroutine { encoding: String ->
|
|
269
|
+
withContext(Dispatchers.Main) {
|
|
270
|
+
rnFishjamClient.toggleVideoTrackEncoding(encoding)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
AsyncFunction("setVideoTrackEncodingBandwidth") Coroutine { encoding: String, bandwidth: Int ->
|
|
275
|
+
withContext(Dispatchers.Main) {
|
|
276
|
+
rnFishjamClient.setVideoTrackEncodingBandwidth(encoding, bandwidth)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
AsyncFunction("setVideoTrackBandwidth") Coroutine { bandwidth: Int ->
|
|
281
|
+
withContext(Dispatchers.Main) {
|
|
282
|
+
rnFishjamClient.setVideoTrackBandwidth(bandwidth)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
AsyncFunction("changeWebRTCLoggingSeverity") Coroutine { severity: String ->
|
|
287
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
288
|
+
rnFishjamClient.changeWebRTCLoggingSeverity(severity)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
AsyncFunction("getStatistics") { rnFishjamClient.getStatistics() }
|
|
293
|
+
}
|
|
294
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import com.fishjamcloud.client.models.TrackEncoding
|
|
4
|
+
|
|
5
|
+
internal fun String.toTrackEncoding(): TrackEncoding =
|
|
6
|
+
when (this) {
|
|
7
|
+
"l" -> TrackEncoding.L
|
|
8
|
+
"m" -> TrackEncoding.M
|
|
9
|
+
"h" -> TrackEncoding.H
|
|
10
|
+
else -> throw IllegalArgumentException("Invalid encoding specified: $this")
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.fishjamcloud.client.media.LocalVideoTrack
|
|
5
|
+
import com.fishjamcloud.client.media.VideoTrack
|
|
6
|
+
import expo.modules.kotlin.AppContext
|
|
7
|
+
|
|
8
|
+
class VideoPreviewView(
|
|
9
|
+
context: Context,
|
|
10
|
+
appContext: AppContext
|
|
11
|
+
) : VideoView(context, appContext) {
|
|
12
|
+
private var localVideoTrack: LocalVideoTrack? = null
|
|
13
|
+
|
|
14
|
+
private fun initialize() {
|
|
15
|
+
localVideoTrack =
|
|
16
|
+
RNFishjamClient.fishjamClient.getLocalEndpoint().tracks.values.firstOrNull { track ->
|
|
17
|
+
track is LocalVideoTrack
|
|
18
|
+
} as? LocalVideoTrack?
|
|
19
|
+
|
|
20
|
+
videoView.let { localVideoTrack?.addRenderer(it) }
|
|
21
|
+
super.setupTrack()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun dispose() {
|
|
25
|
+
videoView.let { localVideoTrack?.removeRenderer(it) }
|
|
26
|
+
super.dispose()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override fun onDetachedFromWindow() {
|
|
30
|
+
super.onDetachedFromWindow()
|
|
31
|
+
dispose()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun onAttachedToWindow() {
|
|
35
|
+
super.onAttachedToWindow()
|
|
36
|
+
initialize()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override fun getVideoTrack(): VideoTrack? = localVideoTrack
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.modules.Module
|
|
4
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
+
|
|
6
|
+
class VideoPreviewViewModule : Module() {
|
|
7
|
+
override fun definition() =
|
|
8
|
+
ModuleDefinition {
|
|
9
|
+
Name("VideoPreviewViewModule")
|
|
10
|
+
|
|
11
|
+
View(VideoPreviewView::class) {
|
|
12
|
+
Prop("videoLayout") { view: VideoPreviewView, videoLayout: String ->
|
|
13
|
+
view.setVideoLayout(videoLayout)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.fishjamcloud.client.media.VideoTrack
|
|
5
|
+
import expo.modules.kotlin.AppContext
|
|
6
|
+
import kotlinx.coroutines.CoroutineScope
|
|
7
|
+
import kotlinx.coroutines.Dispatchers
|
|
8
|
+
import kotlinx.coroutines.launch
|
|
9
|
+
|
|
10
|
+
class VideoRendererView(
|
|
11
|
+
context: Context,
|
|
12
|
+
appContext: AppContext
|
|
13
|
+
) : VideoView(context, appContext),
|
|
14
|
+
RNFishjamClient.OnTrackUpdateListener {
|
|
15
|
+
private var activeVideoTrack: VideoTrack? = null
|
|
16
|
+
private var trackId: String? = null
|
|
17
|
+
|
|
18
|
+
init {
|
|
19
|
+
RNFishjamClient.onTracksUpdateListeners.add(this)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private fun setupTrack(videoTrack: VideoTrack) {
|
|
23
|
+
if (activeVideoTrack == videoTrack) return
|
|
24
|
+
|
|
25
|
+
activeVideoTrack?.removeRenderer(videoView)
|
|
26
|
+
activeVideoTrack = videoTrack
|
|
27
|
+
|
|
28
|
+
videoTrack.addRenderer(videoView)
|
|
29
|
+
|
|
30
|
+
super.setupTrack()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private fun update() {
|
|
34
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
35
|
+
val peers = RNFishjamClient.getAllPeers()
|
|
36
|
+
val endpoint = peers.firstOrNull { it.tracks[trackId] != null } ?: return@launch
|
|
37
|
+
val videoTrack = endpoint.tracks[trackId] as? VideoTrack ?: return@launch
|
|
38
|
+
setupTrack(videoTrack)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
fun init(trackId: String) {
|
|
43
|
+
this.trackId = trackId
|
|
44
|
+
update()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun dispose() {
|
|
48
|
+
activeVideoTrack?.removeRenderer(videoView)
|
|
49
|
+
RNFishjamClient.onTracksUpdateListeners.remove(this)
|
|
50
|
+
super.dispose()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun onTracksUpdate() {
|
|
54
|
+
update()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun getVideoTrack(): VideoTrack? = activeVideoTrack
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import expo.modules.kotlin.modules.Module
|
|
4
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
+
|
|
6
|
+
class VideoRendererViewModule : Module() {
|
|
7
|
+
override fun definition() =
|
|
8
|
+
ModuleDefinition {
|
|
9
|
+
Name("VideoRendererViewModule")
|
|
10
|
+
|
|
11
|
+
View(VideoRendererView::class) {
|
|
12
|
+
OnViewDestroys { view: VideoRendererView ->
|
|
13
|
+
view.dispose()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Prop("trackId") { view: VideoRendererView, trackId: String ->
|
|
17
|
+
view.init(trackId)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Prop("videoLayout") { view: VideoRendererView, videoLayout: String ->
|
|
21
|
+
view.setVideoLayout(videoLayout)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
package org.membraneframework.reactnative
|
|
2
|
+
|
|
3
|
+
import android.animation.ValueAnimator
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.graphics.Color
|
|
6
|
+
import android.graphics.drawable.ColorDrawable
|
|
7
|
+
import android.view.animation.LinearInterpolator
|
|
8
|
+
import com.fishjamcloud.client.media.LocalVideoTrack
|
|
9
|
+
import com.fishjamcloud.client.media.VideoTrack
|
|
10
|
+
import expo.modules.kotlin.AppContext
|
|
11
|
+
import expo.modules.kotlin.views.ExpoView
|
|
12
|
+
import kotlinx.coroutines.CoroutineScope
|
|
13
|
+
import kotlinx.coroutines.Dispatchers
|
|
14
|
+
import kotlinx.coroutines.delay
|
|
15
|
+
import org.webrtc.RendererCommon
|
|
16
|
+
|
|
17
|
+
abstract class VideoView(
|
|
18
|
+
context: Context,
|
|
19
|
+
appContext: AppContext
|
|
20
|
+
) : ExpoView(context, appContext),
|
|
21
|
+
RNFishjamClient.OnLocalTrackSwitchListener {
|
|
22
|
+
protected val videoView =
|
|
23
|
+
RNFishjamClient.fishjamClient.createVideoViewRenderer().also {
|
|
24
|
+
addView(it)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private val fadeAnimation: ValueAnimator =
|
|
28
|
+
ValueAnimator.ofArgb(Color.TRANSPARENT, Color.BLACK).apply {
|
|
29
|
+
duration = 200
|
|
30
|
+
interpolator = LinearInterpolator()
|
|
31
|
+
addUpdateListener {
|
|
32
|
+
val colorValue = it.animatedValue as Int
|
|
33
|
+
foreground = ColorDrawable(colorValue)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
val coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.Main)
|
|
38
|
+
|
|
39
|
+
init {
|
|
40
|
+
RNFishjamClient.onLocalTrackSwitchListener.add(this)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fun setVideoLayout(videoLayout: String) {
|
|
44
|
+
val scalingType =
|
|
45
|
+
when (videoLayout) {
|
|
46
|
+
"FILL" -> RendererCommon.ScalingType.SCALE_ASPECT_FILL
|
|
47
|
+
"FIT" -> RendererCommon.ScalingType.SCALE_ASPECT_FIT
|
|
48
|
+
else -> RendererCommon.ScalingType.SCALE_ASPECT_FILL
|
|
49
|
+
}
|
|
50
|
+
videoView.setScalingType(scalingType)
|
|
51
|
+
videoView.setEnableHardwareScaler(true)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
open fun dispose() {
|
|
55
|
+
videoView.release()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected abstract fun getVideoTrack(): VideoTrack?
|
|
59
|
+
|
|
60
|
+
override suspend fun onLocalTrackWillSwitch() {
|
|
61
|
+
if (getVideoTrack() is LocalVideoTrack) {
|
|
62
|
+
fadeAnimation.start()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override suspend fun onLocalTrackSwitched() {
|
|
67
|
+
if (getVideoTrack() is LocalVideoTrack) {
|
|
68
|
+
videoView.setMirror((getVideoTrack() as? LocalVideoTrack)?.isFrontCamera() ?: false)
|
|
69
|
+
delay(500)
|
|
70
|
+
fadeAnimation.reverse()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fun setupTrack() {
|
|
75
|
+
videoView.setMirror((getVideoTrack() as? LocalVideoTrack)?.isFrontCamera() ?: false)
|
|
76
|
+
}
|
|
77
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build/withMembrane');
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { NativeModule } from 'react-native';
|
|
2
|
+
import type { RTCStats } from './stats/types';
|
|
3
|
+
import type { SimulcastConfig } from './types';
|
|
4
|
+
import type { CameraConfigInternal, CaptureDevice } from './hooks/useCamera';
|
|
5
|
+
import type { Participant } from './hooks/useParticipants';
|
|
6
|
+
import type { ScreencastOptionsInternal } from './hooks/useScreencast';
|
|
7
|
+
import type { ConnectionConfig } from './common/client';
|
|
8
|
+
type Metadata = {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
type RNFishjamClient = {
|
|
12
|
+
connect: (url: string, peerToken: string, peerMetadata: Metadata, config: ConnectionConfig) => Promise<void>;
|
|
13
|
+
leaveRoom: () => Promise<void>;
|
|
14
|
+
startCamera: (config: CameraConfigInternal) => Promise<void>;
|
|
15
|
+
isMicrophoneOn: boolean;
|
|
16
|
+
toggleMicrophone: () => Promise<boolean>;
|
|
17
|
+
isCameraOn: boolean;
|
|
18
|
+
toggleCamera: () => Promise<boolean>;
|
|
19
|
+
flipCamera: () => Promise<void>;
|
|
20
|
+
switchCamera: (captureDeviceId: string) => Promise<void>;
|
|
21
|
+
getCaptureDevices: () => Promise<CaptureDevice[]>;
|
|
22
|
+
handleScreencastPermission: () => Promise<'granted' | 'denied'>;
|
|
23
|
+
toggleScreencast: (screencastOptions: Partial<ScreencastOptionsInternal>) => Promise<void>;
|
|
24
|
+
isScreencastOn: boolean;
|
|
25
|
+
getPeers: <PeerMetadataType extends Metadata>() => Promise<Participant<PeerMetadataType>[]>;
|
|
26
|
+
updatePeerMetadata: <MetadataType extends Metadata>(metadata: MetadataType) => Promise<void>;
|
|
27
|
+
updateVideoTrackMetadata: <MetadataType extends Metadata>(metadata: MetadataType) => Promise<void>;
|
|
28
|
+
updateAudioTrackMetadata: <MetadataType extends Metadata>(metadata: MetadataType) => Promise<void>;
|
|
29
|
+
updateScreencastTrackMetadata: <MetadataType extends Metadata>(metadata: MetadataType) => Promise<void>;
|
|
30
|
+
setOutputAudioDevice: (audioDevice: string) => Promise<void>;
|
|
31
|
+
startAudioSwitcher: () => Promise<void>;
|
|
32
|
+
stopAudioSwitcher: () => Promise<void>;
|
|
33
|
+
selectAudioSessionMode: (sessionMode: string) => Promise<void>;
|
|
34
|
+
showAudioRoutePicker: () => Promise<void>;
|
|
35
|
+
toggleScreencastTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;
|
|
36
|
+
setScreencastTrackBandwidth: (bandwidth: number) => Promise<void>;
|
|
37
|
+
setScreencastTrackEncodingBandwidth: (encoding: string, bandwidth: number) => Promise<void>;
|
|
38
|
+
setTargetTrackEncoding: (trackId: string, encoding: string) => Promise<void>;
|
|
39
|
+
toggleVideoTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;
|
|
40
|
+
setVideoTrackEncodingBandwidth: (encoding: string, bandwidth: number) => Promise<void>;
|
|
41
|
+
setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;
|
|
42
|
+
changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;
|
|
43
|
+
getStatistics: () => Promise<RTCStats>;
|
|
44
|
+
};
|
|
45
|
+
declare const _default: RNFishjamClient & NativeModule;
|
|
46
|
+
export default _default;
|
|
47
|
+
//# sourceMappingURL=RNFishjamClientModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsExD,MAAM,YAAY,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAE5D,eAAe,YAA8C,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport { NativeModule } from 'react-native';\n\nimport type { RTCStats } from './stats/types';\nimport type { SimulcastConfig } from './types';\nimport type { CameraConfigInternal, CaptureDevice } from './hooks/useCamera';\nimport type { Participant } from './hooks/useParticipants';\nimport type { ScreencastOptionsInternal } from './hooks/useScreencast';\nimport type { ConnectionConfig } from './common/client';\n\ntype Metadata = { [key: string]: any };\n\ntype RNFishjamClient = {\n connect: (\n url: string,\n peerToken: string,\n peerMetadata: Metadata,\n config: ConnectionConfig,\n ) => Promise<void>;\n leaveRoom: () => Promise<void>;\n startCamera: (config: CameraConfigInternal) => Promise<void>;\n isMicrophoneOn: boolean;\n toggleMicrophone: () => Promise<boolean>;\n isCameraOn: boolean;\n toggleCamera: () => Promise<boolean>;\n flipCamera: () => Promise<void>;\n switchCamera: (captureDeviceId: string) => Promise<void>;\n getCaptureDevices: () => Promise<CaptureDevice[]>;\n handleScreencastPermission: () => Promise<'granted' | 'denied'>;\n toggleScreencast: (\n screencastOptions: Partial<ScreencastOptionsInternal>,\n ) => Promise<void>;\n isScreencastOn: boolean;\n getPeers: <PeerMetadataType extends Metadata>() => Promise<\n Participant<PeerMetadataType>[]\n >;\n updatePeerMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateVideoTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateAudioTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateScreencastTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n setOutputAudioDevice: (audioDevice: string) => Promise<void>;\n startAudioSwitcher: () => Promise<void>;\n stopAudioSwitcher: () => Promise<void>;\n selectAudioSessionMode: (sessionMode: string) => Promise<void>;\n showAudioRoutePicker: () => Promise<void>;\n toggleScreencastTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;\n setScreencastTrackBandwidth: (bandwidth: number) => Promise<void>;\n setScreencastTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setTargetTrackEncoding: (trackId: string, encoding: string) => Promise<void>;\n toggleVideoTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;\n setVideoTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;\n changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;\n getStatistics: () => Promise<RTCStats>;\n};\n\nconst nativeModule = requireNativeModule('RNFishjamClient');\n\nexport default nativeModule as RNFishjamClient & NativeModule;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GenericMetadata } from '../types';
|
|
2
|
+
export type ConnectionConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for automatic reconnection
|
|
5
|
+
* sdk uses a linear backoff algorithm, that is the formula
|
|
6
|
+
* for the delay of the nth attempt is
|
|
7
|
+
* n * delayMs + initialDelayMs
|
|
8
|
+
*
|
|
9
|
+
* Pass 0 for maxAttempts to disable automatic reconnection
|
|
10
|
+
*/
|
|
11
|
+
reconnectConfig?: {
|
|
12
|
+
maxAttempts?: number;
|
|
13
|
+
initialDelayMs?: number;
|
|
14
|
+
delayMs?: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function connect<ParticipantMetadata extends GenericMetadata = GenericMetadata>(url: string, peerToken: string, peerMetadata: ParticipantMetadata, config?: ConnectionConfig): Promise<void>;
|
|
18
|
+
export declare function leaveRoom(): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,wBAAsB,OAAO,CAC3B,mBAAmB,SAAS,eAAe,GAAG,eAAe,EAE7D,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,mBAAmB,EACjC,MAAM,GAAE,gBAAqB,iBAG9B;AAED,wBAAsB,SAAS,kBAE9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
2
|
+
export async function connect(url, peerToken, peerMetadata, config = {}) {
|
|
3
|
+
await RNFishjamClientModule.connect(url, peerToken, peerMetadata, config);
|
|
4
|
+
}
|
|
5
|
+
export async function leaveRoom() {
|
|
6
|
+
await RNFishjamClientModule.leaveRoom();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAkB7D,MAAM,CAAC,KAAK,UAAU,OAAO,CAG3B,GAAW,EACX,SAAiB,EACjB,YAAiC,EACjC,SAA2B,EAAE;IAE7B,MAAM,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,qBAAqB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { GenericMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\nexport type ConnectionConfig = {\n /**\n * Configuration for automatic reconnection\n * sdk uses a linear backoff algorithm, that is the formula\n * for the delay of the nth attempt is\n * n * delayMs + initialDelayMs\n *\n * Pass 0 for maxAttempts to disable automatic reconnection\n */\n reconnectConfig?: {\n maxAttempts?: number;\n initialDelayMs?: number;\n delayMs?: number;\n };\n};\n\nexport async function connect<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>(\n url: string,\n peerToken: string,\n peerMetadata: ParticipantMetadata,\n config: ConnectionConfig = {},\n) {\n await RNFishjamClientModule.connect(url, peerToken, peerMetadata, config);\n}\n\nexport async function leaveRoom() {\n await RNFishjamClientModule.leaveRoom();\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter } from 'expo-modules-core';
|
|
2
|
+
export declare const ReceivableEvents: {
|
|
3
|
+
readonly IsCameraOn: "IsCameraOn";
|
|
4
|
+
readonly IsMicrophoneOn: "IsMicrophoneOn";
|
|
5
|
+
readonly IsScreencastOn: "IsScreencastOn";
|
|
6
|
+
readonly SimulcastConfigUpdate: "SimulcastConfigUpdate";
|
|
7
|
+
readonly PeersUpdate: "PeersUpdate";
|
|
8
|
+
readonly AudioDeviceUpdate: "AudioDeviceUpdate";
|
|
9
|
+
readonly SendMediaEvent: "SendMediaEvent";
|
|
10
|
+
readonly BandwidthEstimation: "BandwidthEstimation";
|
|
11
|
+
readonly ReconnectionRetriesLimitReached: "ReconnectionRetriesLimitReached";
|
|
12
|
+
readonly ReconnectionStarted: "ReconnectionStarted";
|
|
13
|
+
readonly Reconnected: "Reconnected";
|
|
14
|
+
};
|
|
15
|
+
export declare const eventEmitter: EventEmitter;
|
|
16
|
+
//# sourceMappingURL=eventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../src/common/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIrE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;CAYnB,CAAC;AAEX,eAAO,MAAM,YAAY,cAExB,CAAC"}
|