@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.
Files changed (109) hide show
  1. package/README.md +416 -0
  2. package/android/build.gradle +8 -6
  3. package/app.plugin.js +1 -1
  4. package/build/RNFishjamClientModule.d.ts +7 -5
  5. package/build/RNFishjamClientModule.d.ts.map +1 -1
  6. package/build/RNFishjamClientModule.js.map +1 -1
  7. package/build/common/client.d.ts +8 -1
  8. package/build/common/client.d.ts.map +1 -1
  9. package/build/common/client.js +9 -2
  10. package/build/common/client.js.map +1 -1
  11. package/build/components/VideoPreviewView.d.ts +3 -3
  12. package/build/components/VideoPreviewView.d.ts.map +1 -1
  13. package/build/components/VideoPreviewView.js +1 -1
  14. package/build/components/VideoPreviewView.js.map +1 -1
  15. package/build/hooks/useAudioSettings.d.ts.map +1 -1
  16. package/build/hooks/useAudioSettings.js +4 -5
  17. package/build/hooks/useAudioSettings.js.map +1 -1
  18. package/build/hooks/useBandwidthEstimation.d.ts +0 -3
  19. package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
  20. package/build/hooks/useBandwidthEstimation.js +3 -6
  21. package/build/hooks/useBandwidthEstimation.js.map +1 -1
  22. package/build/hooks/useCamera.d.ts +12 -21
  23. package/build/hooks/useCamera.d.ts.map +1 -1
  24. package/build/hooks/useCamera.js +52 -52
  25. package/build/hooks/useCamera.js.map +1 -1
  26. package/build/{common/eventEmitter.d.ts → hooks/useFishjamEvent.d.ts} +2 -3
  27. package/build/hooks/useFishjamEvent.d.ts.map +1 -0
  28. package/build/{common/eventEmitter.js → hooks/useFishjamEvent.js} +11 -2
  29. package/build/hooks/useFishjamEvent.js.map +1 -0
  30. package/build/hooks/useMicrophone.d.ts.map +1 -1
  31. package/build/hooks/useMicrophone.js +3 -7
  32. package/build/hooks/useMicrophone.js.map +1 -1
  33. package/build/hooks/useParticipants.d.ts +0 -3
  34. package/build/hooks/useParticipants.d.ts.map +1 -1
  35. package/build/hooks/useParticipants.js +6 -6
  36. package/build/hooks/useParticipants.js.map +1 -1
  37. package/build/hooks/useReconnection.d.ts.map +1 -1
  38. package/build/hooks/useReconnection.js +8 -18
  39. package/build/hooks/useReconnection.js.map +1 -1
  40. package/build/hooks/useScreencast.d.ts.map +1 -1
  41. package/build/hooks/useScreencast.js +3 -7
  42. package/build/hooks/useScreencast.js.map +1 -1
  43. package/build/index.d.ts +4 -3
  44. package/build/index.d.ts.map +1 -1
  45. package/build/index.js +3 -1
  46. package/build/index.js.map +1 -1
  47. package/build/types.d.ts +25 -0
  48. package/build/types.d.ts.map +1 -1
  49. package/build/types.js +10 -1
  50. package/build/types.js.map +1 -1
  51. package/build/utils/foregroundService.d.ts +30 -0
  52. package/build/utils/foregroundService.d.ts.map +1 -0
  53. package/build/utils/foregroundService.js +41 -0
  54. package/build/utils/foregroundService.js.map +1 -0
  55. package/expo-module.config.json +3 -3
  56. package/ios/RNFishjamClient.swift +34 -29
  57. package/ios/RNFishjamClientModule.swift +12 -8
  58. package/package.json +23 -18
  59. package/.eslintignore +0 -7
  60. package/.eslintrc +0 -6
  61. package/.prettierrc +0 -9
  62. package/.watchmanconfig +0 -1
  63. package/android/.editorconfig +0 -9
  64. package/android/src/main/AndroidManifest.xml +0 -2
  65. package/android/src/main/java/org/membraneframework/reactnative/AudioDeviceKind.kt +0 -34
  66. package/android/src/main/java/org/membraneframework/reactnative/AudioSwitchManager.kt +0 -61
  67. package/android/src/main/java/org/membraneframework/reactnative/EmitableEvents.kt +0 -14
  68. package/android/src/main/java/org/membraneframework/reactnative/Errors.kt +0 -31
  69. package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClient.kt +0 -866
  70. package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClientModule.kt +0 -294
  71. package/android/src/main/java/org/membraneframework/reactnative/Utils.kt +0 -11
  72. package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewView.kt +0 -40
  73. package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewViewModule.kt +0 -17
  74. package/android/src/main/java/org/membraneframework/reactnative/VideoRendererView.kt +0 -58
  75. package/android/src/main/java/org/membraneframework/reactnative/VideoRendererViewModule.kt +0 -25
  76. package/android/src/main/java/org/membraneframework/reactnative/VideoView.kt +0 -77
  77. package/babel.config.js +0 -2
  78. package/build/common/eventEmitter.d.ts.map +0 -1
  79. package/build/common/eventEmitter.js.map +0 -1
  80. package/ios/swift-format-config.json +0 -56
  81. package/plugin/broadcastExtensionFiles/Info.plist +0 -27
  82. package/plugin/broadcastExtensionFiles/MembraneBroadcastSampleHandler.swift +0 -50
  83. package/plugin/broadcastExtensionFiles/MembraneScreenBroadcastExtension.entitlements +0 -10
  84. package/plugin/src/withMembrane.ts +0 -310
  85. package/plugin/tsconfig.json +0 -9
  86. package/scripts/lint.sh +0 -18
  87. package/scripts/lint_check.sh +0 -14
  88. package/src/RNFishjamClientModule.ts +0 -73
  89. package/src/__tests__/index.test.tsx +0 -199
  90. package/src/common/client.ts +0 -33
  91. package/src/common/eventEmitter.ts +0 -21
  92. package/src/common/metadata.ts +0 -12
  93. package/src/common/webRTC.ts +0 -31
  94. package/src/components/VideoPreviewView.tsx +0 -33
  95. package/src/components/VideoRendererView.tsx +0 -31
  96. package/src/hooks/useAudioSettings.ts +0 -115
  97. package/src/hooks/useBandwidthEstimation.ts +0 -24
  98. package/src/hooks/useCamera.ts +0 -270
  99. package/src/hooks/useMicrophone.ts +0 -38
  100. package/src/hooks/useParticipants.ts +0 -118
  101. package/src/hooks/useReconnection.ts +0 -41
  102. package/src/hooks/useScreencast.ts +0 -146
  103. package/src/index.tsx +0 -63
  104. package/src/protos/fishjam/peer_notifications.ts +0 -299
  105. package/src/stats/types.ts +0 -56
  106. package/src/stats/useRTCStatistics.ts +0 -97
  107. package/src/types.ts +0 -49
  108. package/tsconfig.json +0 -9
  109. package/typedoc.json +0 -5
package/README.md ADDED
@@ -0,0 +1,416 @@
1
+ # Fishjam Cloud React Native client
2
+
3
+ `@fishjam-cloud/react-native-client` is a React Native wrapper for
4
+ [android-client](https://github.com/fishjam-dev/android-client-sdk) and
5
+ [ios-client](https://github.com/fishjam-dev/ios-client-sdk). It allows you to
6
+ quickly and easily create a mobile client app in React Native for a
7
+ [Fishjam](https://github.com/fishjam-dev/fishjam) server.
8
+
9
+ # Documentation
10
+
11
+ API documentation is available
12
+ [here](https://fishjam-cloud.github.io/mobile-client-sdk/modules/_fishjam_cloud_react_native_client.html)
13
+
14
+ # Installation
15
+
16
+ Firstly install `react-native-client` with `yarn` or `npm`
17
+
18
+ ```
19
+ yarn add @fishjam-cloud/react-native-client
20
+ ```
21
+
22
+ or
23
+
24
+ ```
25
+ npm install @fishjam-cloud/react-native-client
26
+ ```
27
+
28
+ ### Expo plugin
29
+
30
+ If you're using development builds with `eas build` or bare workflow you can try
31
+ using expo plugin to do the configuration below for you. Simply run:
32
+
33
+ ```
34
+ expo install @fishjam-cloud/react-native-client
35
+ ```
36
+
37
+ Add plugin to your `app.json` if it's not already added:
38
+
39
+ ```json
40
+ {
41
+ "expo": {
42
+ "name": "example",
43
+ ...
44
+ "plugins": [
45
+ "@fishjam-cloud/react-native-client"
46
+ ]
47
+ }
48
+ }
49
+ ```
50
+
51
+ If you want to use screensharing feature, enable the following flags:
52
+
53
+ ```json
54
+ {
55
+ "expo": {
56
+ "name": "example",
57
+ ...
58
+ "plugins": [
59
+ [
60
+ "@fishjam-cloud/react-native-client",
61
+ {
62
+ "android": {
63
+ "enableForegroundService": true
64
+ },
65
+ "ios": {
66
+ "enableScreensharing": true
67
+ }
68
+ }
69
+ ]
70
+ ]
71
+ }
72
+ }
73
+ ```
74
+
75
+ On bare workflow run `expo prebuild` to configure the app, then run
76
+ `pod install`. On development build `eas build` should take care of it.
77
+
78
+ ### Android
79
+
80
+ 1. Add camera and microphone permissions to your `AndroidManifest.xml` or you app.json permissions.
81
+ 2. Rebuild the app. That's it!
82
+
83
+ ### iOS
84
+
85
+ > [!NOTE]
86
+ > If you're using our plugin with `enableScreensharing` set to `true`. Not further steps are required.
87
+
88
+ On iOS installation is a bit more complicated, because you need to setup a
89
+ screen broadcast app extension for screensharing.
90
+
91
+ 1. Add camera and microphone permissions to your main `Info.plist`.
92
+ ```xml
93
+ <key>NSCameraUsageDescription</key>
94
+ <string>Allow $(PRODUCT_NAME) to use the camera</string>
95
+ <key>NSMicrophoneUsageDescription</key>
96
+ <string>Allow $(PRODUCT_NAME) to use the microphone</string>
97
+ ```
98
+ 2. We recommend adding `audio` background mode in `Info.plist` so that the app
99
+ doesn't disconnect when it's in background:
100
+
101
+ ```xml
102
+ <key>UIBackgroundModes</key>
103
+ <array>
104
+ <string>audio</string>
105
+ </array>
106
+ ```
107
+
108
+ 2. Open your `<your-project>.xcworkspace` in Xcode
109
+ 3. Create new Broadcast Upload Extension. Select File → New → Target... →
110
+ Broadcast Upload Extension → Next. Choose the name for the new target, select
111
+ Swift language and deselect "Include UI Extension".
112
+
113
+ ![New target config](https://github.com/fishjam-cloud/mobile-client-sdk/blob/main/.github/images/xcode1.png)
114
+
115
+ Press Finish. In the next alert xcode will ask you if you want to activate
116
+ the new scheme - press Cancel.
117
+
118
+ 4. Configure app group. Go to "Signing & Capabilities" tab, click "+ Capability"
119
+ button in upper left corner and select "App Groups".
120
+
121
+ ![App groups config](https://github.com/fishjam-cloud/mobile-client-sdk/blob/main/.github/images/xcode2.png)
122
+
123
+ Then in the "App Groups" add a new group or select existing. Usually group
124
+ name has format `group.<your-bundle-identifier>`. Verify that both app and
125
+ extension targets have app group and dev team set correctly.
126
+
127
+ 5. A new folder with app extension should appear on the left with contents like
128
+ this:
129
+
130
+ ![App extension files](https://github.com/fishjam-cloud/mobile-client-sdk/blob/main/.github/images/xcode3.png)
131
+
132
+ Replace `SampleHandler.swift` with `MembraneBroadcastSampleHandler.swift` and
133
+ this code:
134
+
135
+ ```swift
136
+ import Foundation
137
+ import MembraneRTC
138
+ import os.log
139
+ import ReplayKit
140
+ import WebRTC
141
+
142
+
143
+ /// App Group used by the extension to exchange buffers with the target application
144
+ let appGroup = "{{GROUP_IDENTIFIER}}"
145
+
146
+ let logger = OSLog(subsystem: "{{BUNDLE_IDENTIFIER}}.MembraneBroadcastSampleHandler", category: "Broadcaster")
147
+
148
+ /// An example `SampleHandler` utilizing `BroadcastSampleSource` from `MembraneRTC` sending broadcast samples and necessary notification enabling device's screencast.
149
+ class MembraneBroadcastSampleHandler: RPBroadcastSampleHandler {
150
+ let broadcastSource = BroadcastSampleSource(appGroup: appGroup)
151
+ var started: Bool = false
152
+
153
+
154
+ override func broadcastStarted(withSetupInfo _: [String: NSObject]?) {
155
+ started = broadcastSource.connect()
156
+
157
+ guard started else {
158
+ os_log("failed to connect with ipc server", log: logger, type: .debug)
159
+
160
+ super.finishBroadcastWithError(NSError(domain: "", code: 0, userInfo: nil))
161
+
162
+ return
163
+ }
164
+
165
+ broadcastSource.started()
166
+ }
167
+
168
+ override func broadcastPaused() {
169
+ broadcastSource.paused()
170
+ }
171
+
172
+ override func broadcastResumed() {
173
+ broadcastSource.resumed()
174
+ }
175
+
176
+ override func broadcastFinished() {
177
+ broadcastSource.finished()
178
+ }
179
+
180
+ override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
181
+ guard started else {
182
+ return
183
+ }
184
+
185
+ broadcastSource.processFrame(sampleBuffer: sampleBuffer, ofType: sampleBufferType)
186
+ }
187
+ }
188
+ ```
189
+
190
+ Replace `{{GROUP_IDENTIFIER}}` and `{{BUNDLE_IDENTIFIER}}` with your group
191
+ identifier and bundle identifier respectively.
192
+
193
+ 6. In project's Podfile add the following code:
194
+ ```rb
195
+ target 'MembraneScreenBroadcastExtension' do
196
+ pod 'MembraneRTC/Broadcast'
197
+ end
198
+ ```
199
+ > This new dependency should be added outside of your application target.
200
+ > Example
201
+ >
202
+ > ```rb
203
+ > target 'ReactNativeMembraneExample' do
204
+ > ...
205
+ > end
206
+ >
207
+ > target 'MembraneScreenBroadcastExtension' do
208
+ > pod 'MembraneRTC/Broadcast'
209
+ > end
210
+ > ```
211
+ 7. Run `pod install` in your `ios/` directory
212
+ 8. Add the following constants in your Info.plist:
213
+ ```xml
214
+ <key>AppGroupName</key>
215
+ <string>{{GROUP_IDENTIFIER}}</string>
216
+ <key>ScreencastExtensionBundleId</key>
217
+ <string>{{BUNDLE_IDENTIFIER}}.MembraneBroadcastSampleHandler</string>
218
+ ```
219
+ Replace `{{GROUP_IDENTIFIER}}` and `{{BUNDLE_IDENTIFIER}}` with your group
220
+ identifier and bundle identifier respectively.
221
+ 9. Rebuild the app and enjoy!
222
+
223
+ # Example
224
+
225
+ We strongly recommend checking out our example app that implements a basic video
226
+ room client. To run the app:
227
+
228
+ 1. Go to Membrane's server demo repo: https://fishjam.io/app/login Follow
229
+ instructions there to setup and run demo server.
230
+ 2. Clone the repo
231
+ 3. ```
232
+ yarn
233
+ yarn build
234
+ cd `examples/fishjam-chat`
235
+ npx expo prebuild --clean
236
+ ```
237
+ 4. Copy `.env.template` and create `.env` with proper secrets.
238
+ 5. `yarn run android` or `yarn run ios` or run project from Android Studio /
239
+ Xcode just like every RN project. Note that simulators won't work, you have
240
+ to test on real device for camera and screensharing to run.
241
+
242
+ # Usage
243
+
244
+ > [!CAUTION]
245
+ > This part of documentation is out of date. It will be updated soon.
246
+
247
+ Connect to the server and join the room using the `connect` function. Use user
248
+ metadata to pass things like usernames etc. to the server.
249
+
250
+ ```ts
251
+ const startServerConnection = () => {
252
+ try {
253
+ await connect('http://server_address:5002', 'peer_token', {
254
+ displayName: 'Annie',
255
+ });
256
+ } catch (e) {
257
+ console.log('error!');
258
+ }
259
+ };
260
+ ```
261
+
262
+ Remember to gracefully disconnect from the server using the `leaveRoom()`
263
+ function:
264
+
265
+ ```ts
266
+ const stopServerConnection = () => {
267
+ await leaveRoom();
268
+ };
269
+ ```
270
+
271
+ Start the device's camera and microphone using `useCamera()` and
272
+ `useMicrophone()` hooks. Use `videoTrackMetadata` and `audioTrackMetadata`
273
+ options to send metadata about the tracks (for example whether it's a camera or
274
+ screencast track).
275
+
276
+ ```ts
277
+ const { startCamera } = useCamera();
278
+ const { startMicrophone } = useMicrophone();
279
+
280
+ await startCamera({
281
+ quality: VideoQuality.HD_169,
282
+ videoTrackMetadata: { active: true, type: 'camera' },
283
+ });
284
+ await startMicrophone({ audioTrackMetadata: { active: true, type: 'audio' } });
285
+ ```
286
+
287
+ For more options and functions to control the camera and microphone see the API
288
+ documentation.
289
+
290
+ If you have the connection set up, then use `useParticipants()` hook to track
291
+ the other participants in the room. One of the participants will be a local
292
+ participant (the one who's using the device). When participants is added or
293
+ removed because an user joins or leaves the room, the participants will be
294
+ updated automatically. Simply call the hook like this:
295
+
296
+ ```ts
297
+ const participants = useParticipants();
298
+ ```
299
+
300
+ When you have the participants all that's left is to render their video tracks.
301
+ Use `<VideoRendererView />` component like this:
302
+
303
+ ```ts
304
+ {
305
+ endpoint.videoTracks.map((track) => (
306
+ <VideoRendererView trackId={track.id} />
307
+ ));
308
+ }
309
+ ```
310
+
311
+ You can style the views to lay out them however you'd like, basic animations
312
+ should work too.
313
+
314
+ There are also some simple hooks for toggling camera, microphone and
315
+ screensharing. Use them like this:
316
+
317
+ ```ts
318
+ const { isCameraOn, toggleCamera } = useCameraState();
319
+ const { isMicrophoneOn, toggleMicrophone } = useMicrophoneState();
320
+ ```
321
+
322
+ For screencasting use `useScreencast()` hook. The local endpoint will have a new
323
+ video track which you can render just like an ordinary video track with
324
+ <VideoRendererView />:
325
+
326
+ ```ts
327
+ const { isScreencastOn, toggleScreencast } = useScreencast();
328
+ ...
329
+ toggleScreencast({screencastMetadata: { displayName: "Annie's desktop" }});
330
+ ```
331
+
332
+ Use track metadata to differentiate between video and screencast tracks.
333
+
334
+ ### Android foreground service
335
+
336
+ > [!NOTE]
337
+ > If you're using our plugin with `enableForegroundService` set to `true`. Not further steps are required.
338
+
339
+ In order for the call to continue running when app is in background, you need to
340
+ set up and start a foreground service. You can use a 3rd party library for this,
341
+ for example [notifee](https://notifee.app/).
342
+
343
+ In `AndroidManifest.xml` specify necessary permissions:
344
+
345
+ ```xml
346
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
347
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
348
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
349
+ ```
350
+
351
+ And add foreground service:
352
+
353
+ ```xml
354
+ <application
355
+ ...
356
+ >
357
+ ...
358
+ <service
359
+ android:name="app.notifee.core.ForegroundService"
360
+ android:foregroundServiceType="mediaProjection|camera|microphone" />
361
+ </application>
362
+ ```
363
+
364
+ Then to start the foreground service:
365
+
366
+ ```ts
367
+ import notifee, { AndroidImportance } from '@notifee/react-native';
368
+
369
+ const startForegroundService = async () => {
370
+ if (Platform.OS === 'android') {
371
+ const channelId = await notifee.createChannel({
372
+ id: 'video_call',
373
+ name: 'Video call',
374
+ lights: false,
375
+ vibration: false,
376
+ importance: AndroidImportance.DEFAULT,
377
+ });
378
+
379
+ await notifee.displayNotification({
380
+ title: 'Your video call is ongoing',
381
+ body: 'Tap to return to the call.',
382
+ android: {
383
+ channelId,
384
+ asForegroundService: true,
385
+ ongoing: true,
386
+ pressAction: {
387
+ id: 'default',
388
+ },
389
+ },
390
+ });
391
+ }
392
+ };
393
+ ```
394
+
395
+ Don't forget to also stop the service when the call has ended:
396
+
397
+ ```ts
398
+ notifee.stopForegroundService();
399
+ ```
400
+
401
+ Also add this code in your `index.js` to register the service:
402
+
403
+ ```js
404
+ notifee.registerForegroundService((notification) => {
405
+ return new Promise(() => {});
406
+ });
407
+ ```
408
+
409
+ ## Copyright and License
410
+
411
+ Copyright 2024,
412
+ [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=react-client)
413
+
414
+ [![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=react-client)](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=react-client)
415
+
416
+ Licensed under the [Apache License, Version 2.0](LICENSE)
@@ -2,8 +2,10 @@ apply plugin: 'com.android.library'
2
2
  apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
- group = 'org.membraneframework.reactnative'
6
- version = '0.1.1'
5
+ def packageVersion = '2.1'
6
+
7
+ group = 'io.fishjam.reactnative'
8
+ version = "${packageVersion}"
7
9
 
8
10
  buildscript {
9
11
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -52,14 +54,14 @@ afterEvaluate {
52
54
  }
53
55
 
54
56
  android {
55
- namespace = "org.membraneframework.reactnative"
57
+ namespace = "io.fishjam.reactnative"
56
58
  compileSdk(31)
57
59
 
58
60
  defaultConfig {
59
61
  minSdkVersion safeExtGet("minSdkVersion", 21)
60
62
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
61
63
  versionCode 1
62
- versionName "0.1.1"
64
+ versionName "${packageVersion}"
63
65
  }
64
66
  lintOptions {
65
67
  abortOnError false
@@ -81,8 +83,8 @@ dependencies {
81
83
  if (findProject(':fishjam-cloud-android-client')) {
82
84
  implementation project(':fishjam-cloud-android-client')
83
85
  } else {
84
- // todo when released, changed repo name etc then update
85
- implementation 'com.github.fishjam-cloud:mobile-client-sdk:0.1.1'
86
+ // update version number when releasing
87
+ implementation "com.github.fishjam-cloud:mobile-client-sdk:${packageVersion}"
86
88
  }
87
89
  api 'com.github.davidliu:audioswitch:8edf84ee46cdbc84c2b7725aa8f8d66363e19876'
88
90
  implementation 'androidx.appcompat:appcompat:1.6.1'
package/app.plugin.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./plugin/build/withMembrane');
1
+ module.exports = require('./plugin/build/withFishjam');
@@ -1,7 +1,7 @@
1
1
  import { NativeModule } from 'react-native';
2
2
  import type { RTCStats } from './stats/types';
3
- import type { SimulcastConfig } from './types';
4
- import type { CameraConfigInternal, CaptureDevice } from './hooks/useCamera';
3
+ import type { ForegroundServiceOptions, SimulcastConfig } from './types';
4
+ import type { CameraConfigInternal, Camera } from './hooks/useCamera';
5
5
  import type { Participant } from './hooks/useParticipants';
6
6
  import type { ScreencastOptionsInternal } from './hooks/useScreencast';
7
7
  import type { ConnectionConfig } from './common/client';
@@ -9,7 +9,7 @@ type Metadata = {
9
9
  [key: string]: any;
10
10
  };
11
11
  type RNFishjamClient = {
12
- connect: (url: string, peerToken: string, peerMetadata: Metadata, config: ConnectionConfig) => Promise<void>;
12
+ joinRoom: (url: string, participantToken: string, participantMetadata: Metadata, config: ConnectionConfig) => Promise<void>;
13
13
  leaveRoom: () => Promise<void>;
14
14
  startCamera: (config: CameraConfigInternal) => Promise<void>;
15
15
  isMicrophoneOn: boolean;
@@ -17,8 +17,8 @@ type RNFishjamClient = {
17
17
  isCameraOn: boolean;
18
18
  toggleCamera: () => Promise<boolean>;
19
19
  flipCamera: () => Promise<void>;
20
- switchCamera: (captureDeviceId: string) => Promise<void>;
21
- getCaptureDevices: () => Promise<CaptureDevice[]>;
20
+ switchCamera: (cameraId: string) => Promise<void>;
21
+ cameras: ReadonlyArray<Camera>;
22
22
  handleScreencastPermission: () => Promise<'granted' | 'denied'>;
23
23
  toggleScreencast: (screencastOptions: Partial<ScreencastOptionsInternal>) => Promise<void>;
24
24
  isScreencastOn: boolean;
@@ -41,6 +41,8 @@ type RNFishjamClient = {
41
41
  setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;
42
42
  changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;
43
43
  getStatistics: () => Promise<RTCStats>;
44
+ startForegroundService: (options: ForegroundServiceOptions) => void;
45
+ stopForegroundService: () => void;
44
46
  };
45
47
  declare const _default: RNFishjamClient & NativeModule;
46
48
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C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ACvC,sBAAsB,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACpE,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;wBAI6B,eAAe,GAAG,YAAY;AAA7D,wBAA8D"}
@@ -1 +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"]}
1
+ {"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAwExD,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 { ForegroundServiceOptions, SimulcastConfig } from './types';\nimport type { CameraConfigInternal, Camera } 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 joinRoom: (\n url: string,\n participantToken: string,\n participantMetadata: 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: (cameraId: string) => Promise<void>;\n cameras: ReadonlyArray<Camera>;\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 startForegroundService: (options: ForegroundServiceOptions) => void;\n stopForegroundService: () => void;\n};\n\nconst nativeModule = requireNativeModule('RNFishjamClient');\n\nexport default nativeModule as RNFishjamClient & NativeModule;\n"]}
@@ -14,6 +14,13 @@ export type ConnectionConfig = {
14
14
  delayMs?: number;
15
15
  };
16
16
  };
17
- export declare function connect<ParticipantMetadata extends GenericMetadata = GenericMetadata>(url: string, peerToken: string, peerMetadata: ParticipantMetadata, config?: ConnectionConfig): Promise<void>;
17
+ /**
18
+ *
19
+ * @param url fishjam Url
20
+ * @param participantToken
21
+ * @param participantMetadata
22
+ * @param config
23
+ */
24
+ export declare function joinRoom<ParticipantMetadata extends GenericMetadata = GenericMetadata>(url: string, participantToken: string, participantMetadata: ParticipantMetadata, config?: ConnectionConfig): Promise<void>;
18
25
  export declare function leaveRoom(): Promise<void>;
19
26
  //# sourceMappingURL=client.d.ts.map
@@ -1 +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"}
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;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,mBAAmB,SAAS,eAAe,GAAG,eAAe,EAE7D,GAAG,EAAE,MAAM,EACX,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,GAAE,gBAAqB,iBAQ9B;AAED,wBAAsB,SAAS,kBAE9B"}
@@ -1,6 +1,13 @@
1
1
  import RNFishjamClientModule from '../RNFishjamClientModule';
2
- export async function connect(url, peerToken, peerMetadata, config = {}) {
3
- await RNFishjamClientModule.connect(url, peerToken, peerMetadata, config);
2
+ /**
3
+ *
4
+ * @param url fishjam Url
5
+ * @param participantToken
6
+ * @param participantMetadata
7
+ * @param config
8
+ */
9
+ export async function joinRoom(url, participantToken, participantMetadata, config = {}) {
10
+ await RNFishjamClientModule.joinRoom(url, participantToken, participantMetadata, config);
4
11
  }
5
12
  export async function leaveRoom() {
6
13
  await RNFishjamClientModule.leaveRoom();
@@ -1 +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"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAkB7D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,GAAW,EACX,gBAAwB,EACxB,mBAAwC,EACxC,SAA2B,EAAE;IAE7B,MAAM,qBAAqB,CAAC,QAAQ,CAClC,GAAG,EACH,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,CACP,CAAC;AACJ,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\n/**\n *\n * @param url fishjam Url\n * @param participantToken\n * @param participantMetadata\n * @param config\n */\nexport async function joinRoom<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>(\n url: string,\n participantToken: string,\n participantMetadata: ParticipantMetadata,\n config: ConnectionConfig = {},\n) {\n await RNFishjamClientModule.joinRoom(\n url,\n participantToken,\n participantMetadata,\n config,\n );\n}\n\nexport async function leaveRoom() {\n await RNFishjamClientModule.leaveRoom();\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ViewStyle } from 'react-native';
3
3
  import { VideoLayout } from '../types';
4
- import { CaptureDeviceId } from '../hooks/useCamera';
4
+ import { CameraId } from '../hooks/useCamera';
5
5
  export type VideoPreviewViewProps = {
6
6
  /**
7
7
  * `FILL` or `FIT` - it works just like RN Image component. `FILL` fills the whole view
@@ -12,10 +12,10 @@ export type VideoPreviewViewProps = {
12
12
  videoLayout?: VideoLayout;
13
13
  style?: ViewStyle;
14
14
  /**
15
- * Id of the camera used for preview. Get available cameras with `getCaptureDevices()` function.
15
+ * Id of the camera used for preview. Get available cameras with `cameras` property.
16
16
  * @default the first front camera
17
17
  */
18
- captureDeviceId?: CaptureDeviceId;
18
+ cameraId?: CameraId;
19
19
  };
20
20
  export declare const VideoPreviewView: React.ForwardRefExoticComponent<VideoPreviewViewProps & React.RefAttributes<React.ComponentType<VideoPreviewViewProps>>>;
21
21
  //# sourceMappingURL=VideoPreviewView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPreviewView.d.ts","sourceRoot":"","sources":["../../src/components/VideoPreviewView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAKF,eAAO,MAAM,gBAAgB,0HAM3B,CAAC"}
1
+ {"version":3,"file":"VideoPreviewView.d.ts","sourceRoot":"","sources":["../../src/components/VideoPreviewView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,gBAAgB,0HAM3B,CAAC"}
@@ -3,5 +3,5 @@ import * as React from 'react';
3
3
  const NativeView = requireNativeViewManager('VideoPreviewViewModule');
4
4
  export const VideoPreviewView = React.forwardRef((props, ref) => (
5
5
  // @ts-expect-error ref prop needs to be updated
6
- <NativeView {...props} ref={ref}/>));
6
+ <NativeView {...props} captureDeviceId={props.cameraId} ref={ref}/>));
7
7
  //# sourceMappingURL=VideoPreviewView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPreviewView.js","sourceRoot":"","sources":["../../src/components/VideoPreviewView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,UAAU,GACd,wBAAwB,CAAC,wBAAwB,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAG9C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;AAChB,gDAAgD;AAChD,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CACpC,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport { ViewStyle } from 'react-native';\n\nimport { VideoLayout } from '../types';\nimport { CaptureDeviceId } from '../hooks/useCamera';\n\nexport type VideoPreviewViewProps = {\n /**\n * `FILL` or `FIT` - it works just like RN Image component. `FILL` fills the whole view\n * with video and it may cut some parts of the video. `FIT` scales the video so the whole\n * video is visible, but it may leave some empty space in the view.\n * @default `FILL`\n */\n videoLayout?: VideoLayout;\n style?: ViewStyle;\n /**\n * Id of the camera used for preview. Get available cameras with `getCaptureDevices()` function.\n * @default the first front camera\n */\n captureDeviceId?: CaptureDeviceId;\n};\n\nconst NativeView: React.ComponentType<VideoPreviewViewProps> =\n requireNativeViewManager('VideoPreviewViewModule');\n\nexport const VideoPreviewView = React.forwardRef<\n React.ComponentType<VideoPreviewViewProps>,\n VideoPreviewViewProps\n>((props, ref) => (\n // @ts-expect-error ref prop needs to be updated\n <NativeView {...props} ref={ref} />\n));\n"]}
1
+ {"version":3,"file":"VideoPreviewView.js","sourceRoot":"","sources":["../../src/components/VideoPreviewView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,UAAU,GACd,wBAAwB,CAAC,wBAAwB,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAG9C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;AAChB,gDAAgD;AAChD,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CACrE,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport { ViewStyle } from 'react-native';\n\nimport { VideoLayout } from '../types';\nimport { CameraId } from '../hooks/useCamera';\n\nexport type VideoPreviewViewProps = {\n /**\n * `FILL` or `FIT` - it works just like RN Image component. `FILL` fills the whole view\n * with video and it may cut some parts of the video. `FIT` scales the video so the whole\n * video is visible, but it may leave some empty space in the view.\n * @default `FILL`\n */\n videoLayout?: VideoLayout;\n style?: ViewStyle;\n /**\n * Id of the camera used for preview. Get available cameras with `cameras` property.\n * @default the first front camera\n */\n cameraId?: CameraId;\n};\n\nconst NativeView: React.ComponentType<VideoPreviewViewProps> =\n requireNativeViewManager('VideoPreviewViewModule');\n\nexport const VideoPreviewView = React.forwardRef<\n React.ComponentType<VideoPreviewViewProps>,\n VideoPreviewViewProps\n>((props, ref) => (\n // @ts-expect-error ref prop needs to be updated\n <NativeView {...props} captureDeviceId={props.cameraId} ref={ref} />\n));\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useAudioSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioSettings.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AASF;;GAEG;AACH,wBAAgB,gBAAgB;IAyE5B;;OAEG;;IAEH;;OAEG;;sCAhDY,qBAAqB;+CAkBX,gBAAgB;;EAoC5C"}
1
+ {"version":3,"file":"useAudioSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioSettings.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF;;GAEG;AACH,wBAAgB,gBAAgB;IAsE5B;;OAEG;;IAEH;;OAEG;;sCAhDY,qBAAqB;+CAkBX,gBAAgB;;EAoC5C"}
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
2
  import { Platform } from 'react-native';
3
3
  import RNFishjamClientModule from '../RNFishjamClientModule';
4
- import { ReceivableEvents, eventEmitter } from '../common/eventEmitter';
4
+ import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
5
5
  /**
6
6
  * This hook manages audio settings.
7
7
  */
@@ -9,14 +9,13 @@ export function useAudioSettings() {
9
9
  const [selectedAudioOutputDevice, setSelectedAudioOutputDevice] = useState(null);
10
10
  const [availableDevices, setAvailableDevices] = useState([]);
11
11
  const onAudioDevice = useCallback((event) => {
12
- setSelectedAudioOutputDevice(event.AudioDeviceUpdate.selectedDevice);
13
- setAvailableDevices(event.AudioDeviceUpdate.availableDevices);
12
+ setSelectedAudioOutputDevice(event.selectedDevice);
13
+ setAvailableDevices(event.availableDevices);
14
14
  }, []);
15
+ useFishjamEvent(ReceivableEvents.AudioDeviceUpdate, onAudioDevice);
15
16
  useEffect(() => {
16
- const eventListener = eventEmitter.addListener(ReceivableEvents.AudioDeviceUpdate, onAudioDevice);
17
17
  RNFishjamClientModule.startAudioSwitcher();
18
18
  return () => {
19
- eventListener.remove();
20
19
  if (Platform.OS === 'android') {
21
20
  RNFishjamClientModule.stopAudioSwitcher();
22
21
  }