@fishjam-cloud/react-native-client 0.1.1 → 0.2.1
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/README.md +416 -0
- package/android/build.gradle +8 -6
- package/app.plugin.js +1 -1
- package/build/RNFishjamClientModule.d.ts +7 -5
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/common/client.d.ts +8 -1
- package/build/common/client.d.ts.map +1 -1
- package/build/common/client.js +9 -2
- package/build/common/client.js.map +1 -1
- package/build/components/VideoPreviewView.d.ts +3 -3
- package/build/components/VideoPreviewView.d.ts.map +1 -1
- package/build/components/VideoPreviewView.js +1 -1
- package/build/components/VideoPreviewView.js.map +1 -1
- package/build/hooks/useAudioSettings.d.ts.map +1 -1
- package/build/hooks/useAudioSettings.js +4 -5
- package/build/hooks/useAudioSettings.js.map +1 -1
- package/build/hooks/useBandwidthEstimation.d.ts +0 -3
- package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
- package/build/hooks/useBandwidthEstimation.js +3 -6
- package/build/hooks/useBandwidthEstimation.js.map +1 -1
- package/build/hooks/useCamera.d.ts +12 -21
- package/build/hooks/useCamera.d.ts.map +1 -1
- package/build/hooks/useCamera.js +52 -52
- package/build/hooks/useCamera.js.map +1 -1
- package/build/{common/eventEmitter.d.ts → hooks/useFishjamEvent.d.ts} +2 -3
- package/build/hooks/useFishjamEvent.d.ts.map +1 -0
- package/build/{common/eventEmitter.js → hooks/useFishjamEvent.js} +11 -2
- package/build/hooks/useFishjamEvent.js.map +1 -0
- package/build/hooks/useMicrophone.d.ts.map +1 -1
- package/build/hooks/useMicrophone.js +3 -7
- package/build/hooks/useMicrophone.js.map +1 -1
- package/build/hooks/useParticipants.d.ts +0 -3
- package/build/hooks/useParticipants.d.ts.map +1 -1
- package/build/hooks/useParticipants.js +6 -6
- package/build/hooks/useParticipants.js.map +1 -1
- package/build/hooks/useReconnection.d.ts.map +1 -1
- package/build/hooks/useReconnection.js +8 -18
- package/build/hooks/useReconnection.js.map +1 -1
- package/build/hooks/useScreencast.d.ts.map +1 -1
- package/build/hooks/useScreencast.js +3 -7
- package/build/hooks/useScreencast.js.map +1 -1
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +25 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js +10 -1
- package/build/types.js.map +1 -1
- package/build/utils/foregroundService.d.ts +30 -0
- package/build/utils/foregroundService.d.ts.map +1 -0
- package/build/utils/foregroundService.js +41 -0
- package/build/utils/foregroundService.js.map +1 -0
- package/expo-module.config.json +3 -3
- package/ios/RNFishjamClient.swift +34 -29
- package/ios/RNFishjamClientModule.swift +12 -8
- package/package.json +23 -18
- package/.eslintignore +0 -7
- package/.eslintrc +0 -6
- package/.prettierrc +0 -9
- package/.watchmanconfig +0 -1
- package/android/.editorconfig +0 -9
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/org/membraneframework/reactnative/AudioDeviceKind.kt +0 -34
- package/android/src/main/java/org/membraneframework/reactnative/AudioSwitchManager.kt +0 -61
- package/android/src/main/java/org/membraneframework/reactnative/EmitableEvents.kt +0 -14
- package/android/src/main/java/org/membraneframework/reactnative/Errors.kt +0 -31
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClient.kt +0 -866
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClientModule.kt +0 -294
- package/android/src/main/java/org/membraneframework/reactnative/Utils.kt +0 -11
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewView.kt +0 -40
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewViewModule.kt +0 -17
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererView.kt +0 -58
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererViewModule.kt +0 -25
- package/android/src/main/java/org/membraneframework/reactnative/VideoView.kt +0 -77
- package/babel.config.js +0 -2
- package/build/common/eventEmitter.d.ts.map +0 -1
- package/build/common/eventEmitter.js.map +0 -1
- package/ios/swift-format-config.json +0 -56
- package/plugin/broadcastExtensionFiles/Info.plist +0 -27
- package/plugin/broadcastExtensionFiles/MembraneBroadcastSampleHandler.swift +0 -50
- package/plugin/broadcastExtensionFiles/MembraneScreenBroadcastExtension.entitlements +0 -10
- package/plugin/src/withMembrane.ts +0 -310
- package/plugin/tsconfig.json +0 -9
- package/scripts/lint.sh +0 -18
- package/scripts/lint_check.sh +0 -14
- package/src/RNFishjamClientModule.ts +0 -73
- package/src/__tests__/index.test.tsx +0 -199
- package/src/common/client.ts +0 -33
- package/src/common/eventEmitter.ts +0 -21
- package/src/common/metadata.ts +0 -12
- package/src/common/webRTC.ts +0 -31
- package/src/components/VideoPreviewView.tsx +0 -33
- package/src/components/VideoRendererView.tsx +0 -31
- package/src/hooks/useAudioSettings.ts +0 -115
- package/src/hooks/useBandwidthEstimation.ts +0 -24
- package/src/hooks/useCamera.ts +0 -270
- package/src/hooks/useMicrophone.ts +0 -38
- package/src/hooks/useParticipants.ts +0 -118
- package/src/hooks/useReconnection.ts +0 -41
- package/src/hooks/useScreencast.ts +0 -146
- package/src/index.tsx +0 -63
- package/src/protos/fishjam/peer_notifications.ts +0 -299
- package/src/stats/types.ts +0 -56
- package/src/stats/useRTCStatistics.ts +0 -97
- package/src/types.ts +0 -49
- package/tsconfig.json +0 -9
- package/typedoc.json +0 -5
|
@@ -1,294 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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/babel.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eventEmitter.js","sourceRoot":"","sources":["../../src/common/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;CAClB,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,CAC1C,qBAAqB,IAAI,kBAAkB,CAAC,eAAe,CAC5D,CAAC","sourcesContent":["import { NativeModulesProxy, EventEmitter } from 'expo-modules-core';\n\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\nexport const ReceivableEvents = {\n IsCameraOn: 'IsCameraOn',\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreencastOn: 'IsScreencastOn',\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n SendMediaEvent: 'SendMediaEvent',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n} as const;\n\nexport const eventEmitter = new EventEmitter(\n RNFishjamClientModule ?? NativeModulesProxy.RNFishjamClient,\n);\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"fileScopedDeclarationPrivacy": {
|
|
3
|
-
"accessLevel": "private"
|
|
4
|
-
},
|
|
5
|
-
"indentation": {
|
|
6
|
-
"spaces": 4
|
|
7
|
-
},
|
|
8
|
-
"indentConditionalCompilationBlocks": true,
|
|
9
|
-
"indentSwitchCaseLabels": false,
|
|
10
|
-
"lineBreakAroundMultilineExpressionChainComponents": false,
|
|
11
|
-
"lineBreakBeforeControlFlowKeywords": false,
|
|
12
|
-
"lineBreakBeforeEachArgument": false,
|
|
13
|
-
"lineBreakBeforeEachGenericRequirement": false,
|
|
14
|
-
"lineLength": 120,
|
|
15
|
-
"maximumBlankLines": 1,
|
|
16
|
-
"prioritizeKeepingFunctionOutputTogether": false,
|
|
17
|
-
"respectsExistingLineBreaks": true,
|
|
18
|
-
"rules": {
|
|
19
|
-
"AllPublicDeclarationsHaveDocumentation": false,
|
|
20
|
-
"AlwaysUseLowerCamelCase": false,
|
|
21
|
-
"AmbiguousTrailingClosureOverload": true,
|
|
22
|
-
"BeginDocumentationCommentWithOneLineSummary": false,
|
|
23
|
-
"DoNotUseSemicolons": true,
|
|
24
|
-
"DontRepeatTypeInStaticProperties": true,
|
|
25
|
-
"FileScopedDeclarationPrivacy": true,
|
|
26
|
-
"FullyIndirectEnum": true,
|
|
27
|
-
"GroupNumericLiterals": true,
|
|
28
|
-
"IdentifiersMustBeASCII": true,
|
|
29
|
-
"NeverForceUnwrap": false,
|
|
30
|
-
"NeverUseForceTry": false,
|
|
31
|
-
"NeverUseImplicitlyUnwrappedOptionals": false,
|
|
32
|
-
"NoAccessLevelOnExtensionDeclaration": true,
|
|
33
|
-
"NoBlockComments": false,
|
|
34
|
-
"NoCasesWithOnlyFallthrough": true,
|
|
35
|
-
"NoEmptyTrailingClosureParentheses": true,
|
|
36
|
-
"NoLabelsInCasePatterns": true,
|
|
37
|
-
"NoLeadingUnderscores": false,
|
|
38
|
-
"NoParensAroundConditions": true,
|
|
39
|
-
"NoVoidReturnOnFunctionSignature": true,
|
|
40
|
-
"OneCasePerLine": true,
|
|
41
|
-
"OneVariableDeclarationPerLine": true,
|
|
42
|
-
"OnlyOneTrailingClosureArgument": false,
|
|
43
|
-
"OrderedImports": true,
|
|
44
|
-
"ReturnVoidInsteadOfEmptyTuple": true,
|
|
45
|
-
"UseEarlyExits": false,
|
|
46
|
-
"UseLetInEveryBoundCaseVariable": true,
|
|
47
|
-
"UseShorthandTypeNames": true,
|
|
48
|
-
"UseSingleLinePropertyGetter": true,
|
|
49
|
-
"UseSynthesizedInitializer": true,
|
|
50
|
-
"UseTripleSlashForDocumentationComments": false,
|
|
51
|
-
"UseWhereClausesInForLoops": false,
|
|
52
|
-
"ValidateDocumentationComments": false
|
|
53
|
-
},
|
|
54
|
-
"tabWidth": 8,
|
|
55
|
-
"version": 1
|
|
56
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDisplayName</key>
|
|
6
|
-
<string>MembraneScreenBroadcast</string>
|
|
7
|
-
<key>CFBundleExecutable</key>
|
|
8
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
-
<key>CFBundleIdentifier</key>
|
|
10
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
-
<key>CFBundleName</key>
|
|
12
|
-
<string>$(PRODUCT_NAME)</string>
|
|
13
|
-
<key>CFBundlePackageType</key>
|
|
14
|
-
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
|
15
|
-
<key>CFBundleVersion</key>
|
|
16
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
17
|
-
<key>NSExtension</key>
|
|
18
|
-
<dict>
|
|
19
|
-
<key>NSExtensionPointIdentifier</key>
|
|
20
|
-
<string>com.apple.broadcast-services-upload</string>
|
|
21
|
-
<key>NSExtensionPrincipalClass</key>
|
|
22
|
-
<string>$(PRODUCT_MODULE_NAME).MembraneBroadcastSampleHandler</string>
|
|
23
|
-
<key>RPBroadcastProcessMode</key>
|
|
24
|
-
<string>RPBroadcastProcessModeSampleBuffer</string>
|
|
25
|
-
</dict>
|
|
26
|
-
</dict>
|
|
27
|
-
</plist>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import FishjamClient
|
|
2
|
-
import Foundation
|
|
3
|
-
import ReplayKit
|
|
4
|
-
import WebRTC
|
|
5
|
-
import os.log
|
|
6
|
-
|
|
7
|
-
/// App Group used by the extension to exchange buffers with the target application
|
|
8
|
-
let appGroup = "{{GROUP_IDENTIFIER}}"
|
|
9
|
-
|
|
10
|
-
let logger = OSLog(subsystem: "{{BUNDLE_IDENTIFIER}}.MembraneBroadcastSampleHandler", category: "Broadcaster")
|
|
11
|
-
|
|
12
|
-
/// An example `SampleHandler` utilizing `BroadcastSampleSource` from `MembraneRTC` sending broadcast samples and necessary notification enabling device's screencast.
|
|
13
|
-
class MembraneBroadcastSampleHandler: RPBroadcastSampleHandler {
|
|
14
|
-
let broadcastSource = BroadcastSampleSource(appGroup: appGroup)
|
|
15
|
-
var started: Bool = false
|
|
16
|
-
|
|
17
|
-
override func broadcastStarted(withSetupInfo _: [String: NSObject]?) {
|
|
18
|
-
started = broadcastSource.connect()
|
|
19
|
-
|
|
20
|
-
guard started else {
|
|
21
|
-
os_log("failed to connect with ipc server", log: logger, type: .debug)
|
|
22
|
-
|
|
23
|
-
super.finishBroadcastWithError(NSError(domain: "", code: 0, userInfo: nil))
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
broadcastSource.started()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override func broadcastPaused() {
|
|
32
|
-
broadcastSource.paused()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override func broadcastResumed() {
|
|
36
|
-
broadcastSource.resumed()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
override func broadcastFinished() {
|
|
40
|
-
broadcastSource.finished()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
|
|
44
|
-
guard started else {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
broadcastSource.processFrame(sampleBuffer: sampleBuffer, ofType: sampleBufferType)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>com.apple.security.application-groups</key>
|
|
6
|
-
<array>
|
|
7
|
-
<string>{{GROUP_IDENTIFIER}}</string>
|
|
8
|
-
</array>
|
|
9
|
-
</dict>
|
|
10
|
-
</plist>
|