@fishjam-cloud/react-native-client 0.2.4 → 0.4.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.
Files changed (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +9 -8
  3. package/android/build.gradle +4 -4
  4. package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +25 -12
  5. package/android/src/main/java/io/fishjam/reactnative/Errors.kt +1 -2
  6. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +94 -52
  7. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +42 -90
  8. package/android/src/main/java/io/fishjam/reactnative/VideoPreviewView.kt +14 -3
  9. package/android/src/main/java/io/fishjam/reactnative/VideoPreviewViewModule.kt +5 -0
  10. package/android/src/main/java/io/fishjam/reactnative/VideoRendererView.kt +4 -3
  11. package/android/src/main/java/io/fishjam/reactnative/VideoRendererViewModule.kt +2 -0
  12. package/android/src/main/java/io/fishjam/reactnative/VideoView.kt +3 -2
  13. package/android/src/main/java/io/fishjam/reactnative/{FishjamForegroundService.kt → foregroundService/FishjamForegroundService.kt} +7 -2
  14. package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceManager.kt +147 -0
  15. package/android/src/main/java/io/fishjam/reactnative/managers/LocalCameraTracksChangedListenersManager.kt +21 -0
  16. package/android/src/main/java/io/fishjam/reactnative/managers/LocalTracksSwitchListenersManager.kt +27 -0
  17. package/android/src/main/java/io/fishjam/reactnative/managers/TracksUpdateListenersManager.kt +21 -0
  18. package/android/src/main/java/io/fishjam/reactnative/utils/PermissionUtils.kt +45 -0
  19. package/build/RNFishjamClientModule.d.ts +16 -10
  20. package/build/RNFishjamClientModule.d.ts.map +1 -1
  21. package/build/RNFishjamClientModule.js.map +1 -1
  22. package/build/common/client.d.ts +3 -3
  23. package/build/common/client.d.ts.map +1 -1
  24. package/build/common/client.js +4 -4
  25. package/build/common/client.js.map +1 -1
  26. package/build/common/metadata.d.ts +3 -3
  27. package/build/common/metadata.d.ts.map +1 -1
  28. package/build/common/metadata.js +4 -4
  29. package/build/common/metadata.js.map +1 -1
  30. package/build/common/webRTC.d.ts +0 -8
  31. package/build/common/webRTC.d.ts.map +1 -1
  32. package/build/common/webRTC.js +0 -9
  33. package/build/common/webRTC.js.map +1 -1
  34. package/build/components/VideoRendererView.d.ts +1 -1
  35. package/build/components/VideoRendererView.js +1 -1
  36. package/build/components/VideoRendererView.js.map +1 -1
  37. package/build/debug/common/webRTC.d.ts +9 -0
  38. package/build/debug/common/webRTC.d.ts.map +1 -0
  39. package/build/debug/common/webRTC.js +11 -0
  40. package/build/debug/common/webRTC.js.map +1 -0
  41. package/build/debug/index.d.ts +4 -0
  42. package/build/debug/index.d.ts.map +1 -0
  43. package/build/debug/index.js +3 -0
  44. package/build/debug/index.js.map +1 -0
  45. package/build/debug/stats/types.d.ts.map +1 -0
  46. package/build/debug/stats/types.js.map +1 -0
  47. package/build/debug/stats/useRTCStatistics.d.ts.map +1 -0
  48. package/build/{stats → debug/stats}/useRTCStatistics.js +1 -1
  49. package/build/debug/stats/useRTCStatistics.js.map +1 -0
  50. package/build/hooks/useAppScreenShare.d.ts +11 -0
  51. package/build/hooks/useAppScreenShare.d.ts.map +1 -0
  52. package/build/hooks/useAppScreenShare.js +54 -0
  53. package/build/hooks/useAppScreenShare.js.map +1 -0
  54. package/build/hooks/useFishjamEvent.d.ts +2 -0
  55. package/build/hooks/useFishjamEvent.d.ts.map +1 -1
  56. package/build/hooks/useFishjamEvent.js +2 -0
  57. package/build/hooks/useFishjamEvent.js.map +1 -1
  58. package/build/hooks/useForegroundService.d.ts +44 -0
  59. package/build/hooks/useForegroundService.d.ts.map +1 -0
  60. package/build/hooks/useForegroundService.js +57 -0
  61. package/build/hooks/useForegroundService.js.map +1 -0
  62. package/build/hooks/useMicrophone.d.ts +1 -1
  63. package/build/hooks/useMicrophone.js +1 -1
  64. package/build/hooks/useMicrophone.js.map +1 -1
  65. package/build/hooks/usePeerStatus.d.ts +19 -0
  66. package/build/hooks/usePeerStatus.d.ts.map +1 -0
  67. package/build/hooks/usePeerStatus.js +18 -0
  68. package/build/hooks/usePeerStatus.js.map +1 -0
  69. package/build/hooks/{useParticipants.d.ts → usePeers.d.ts} +11 -11
  70. package/build/hooks/usePeers.d.ts.map +1 -0
  71. package/build/hooks/usePeers.js +34 -0
  72. package/build/hooks/usePeers.js.map +1 -0
  73. package/build/hooks/useScreenShare.d.ts +1 -0
  74. package/build/hooks/useScreenShare.d.ts.map +1 -1
  75. package/build/hooks/useScreenShare.js +20 -13
  76. package/build/hooks/useScreenShare.js.map +1 -1
  77. package/build/index.d.ts +8 -7
  78. package/build/index.d.ts.map +1 -1
  79. package/build/index.js +5 -5
  80. package/build/index.js.map +1 -1
  81. package/build/types.d.ts +0 -25
  82. package/build/types.d.ts.map +1 -1
  83. package/build/types.js +1 -10
  84. package/build/types.js.map +1 -1
  85. package/debug/package.json +4 -0
  86. package/ios/Events.swift +30 -13
  87. package/ios/RNFishjamClient.podspec +1 -1
  88. package/ios/RNFishjamClient.swift +196 -106
  89. package/ios/RNFishjamClientModule.swift +34 -34
  90. package/ios/VideoPreviewView.swift +26 -12
  91. package/ios/VideoRendererView.swift +5 -14
  92. package/package.json +7 -6
  93. package/plugin/build/withFishjamAndroid.js +1 -1
  94. package/plugin/build/withFishjamIos.js +2 -2
  95. package/build/hooks/useParticipants.d.ts.map +0 -1
  96. package/build/hooks/useParticipants.js +0 -34
  97. package/build/hooks/useParticipants.js.map +0 -1
  98. package/build/stats/types.d.ts.map +0 -1
  99. package/build/stats/types.js.map +0 -1
  100. package/build/stats/useRTCStatistics.d.ts.map +0 -1
  101. package/build/stats/useRTCStatistics.js.map +0 -1
  102. package/build/utils/foregroundService.d.ts +0 -32
  103. package/build/utils/foregroundService.d.ts.map +0 -1
  104. package/build/utils/foregroundService.js +0 -43
  105. package/build/utils/foregroundService.js.map +0 -1
  106. /package/build/{stats → debug/stats}/types.d.ts +0 -0
  107. /package/build/{stats → debug/stats}/types.js +0 -0
  108. /package/build/{stats → debug/stats}/useRTCStatistics.d.ts +0 -0
@@ -73,22 +73,6 @@ typealias RNTrackBandwidthLimit = Either<Int, [String: Int]>
73
73
 
74
74
  public class RNFishjamClientModule: Module {
75
75
  public func definition() -> ModuleDefinition {
76
- Name("RNFishjamClient")
77
-
78
- Events(
79
- "IsCameraOn",
80
- "IsMicrophoneOn",
81
- "IsScreenShareOn",
82
- "SimulcastConfigUpdate",
83
- "PeersUpdate",
84
- "AudioDeviceUpdate",
85
- "SendMediaEvent",
86
- "BandwidthEstimation",
87
- "ReconnectionRetriesLimitReached",
88
- "ReconnectionStarted",
89
- "Reconnected",
90
- "Warning")
91
-
92
76
  let rnFishjamClient: RNFishjamClient = {
93
77
  let client = RNFishjamClient {
94
78
  (eventName: String, data: [String: Any]) in
@@ -98,13 +82,41 @@ public class RNFishjamClientModule: Module {
98
82
  return client
99
83
  }()
100
84
 
85
+ Name("RNFishjamClient")
86
+
87
+ Events(EmitableEvents.allEvents)
88
+
89
+ Property("peerStatus") {
90
+ return rnFishjamClient.peerStatus.rawValue
91
+ }
92
+
93
+ Property("isMicrophoneOn") {
94
+ return rnFishjamClient.isMicrophoneOn
95
+ }
96
+
97
+ Property("isCameraOn") {
98
+ return rnFishjamClient.isCameraOn
99
+ }
100
+
101
+ Property("cameras") {
102
+ return rnFishjamClient.getCaptureDevices()
103
+ }
104
+
105
+ Property("isScreenShareOn") {
106
+ return rnFishjamClient.isScreenShareOn
107
+ }
108
+
109
+ Property("isAppScreenShareOn") {
110
+ return rnFishjamClient.isAppScreenShareOn
111
+ }
112
+
101
113
  AsyncFunction("joinRoom") {
102
114
  (
103
- url: String, participantToken: String, participantMetadata: [String: Any], config: ConnectConfig,
115
+ url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
104
116
  promise: Promise
105
117
  ) in
106
118
  rnFishjamClient.joinRoom(
107
- url: url, participantToken: participantToken, participantMetadata: participantMetadata, config: config,
119
+ url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
108
120
  promise: promise)
109
121
  }
110
122
 
@@ -113,19 +125,11 @@ public class RNFishjamClientModule: Module {
113
125
  }
114
126
 
115
127
  AsyncFunction("startCamera") { (config: CameraConfig) in
116
- try rnFishjamClient.startCamera(config: config)
117
- }
118
-
119
- Property("isMicrophoneOn") {
120
- return rnFishjamClient.isMicrophoneOn
128
+ try await rnFishjamClient.startCamera(config: config)
121
129
  }
122
130
 
123
131
  AsyncFunction("toggleMicrophone") {
124
- try rnFishjamClient.toggleMicrophone()
125
- }
126
-
127
- Property("isCameraOn") {
128
- return rnFishjamClient.isCameraOn
132
+ try await rnFishjamClient.toggleMicrophone()
129
133
  }
130
134
 
131
135
  AsyncFunction("toggleCamera") {
@@ -140,16 +144,12 @@ public class RNFishjamClientModule: Module {
140
144
  try rnFishjamClient.switchCamera(cameraId: cameraId)
141
145
  }
142
146
 
143
- Property("cameras") {
144
- rnFishjamClient.getCaptureDevices()
145
- }
146
-
147
147
  AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
148
148
  try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
149
149
  }
150
150
 
151
- Property("isScreenShareOn") {
152
- return rnFishjamClient.isScreenShareOn
151
+ AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
152
+ try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
153
153
  }
154
154
 
155
155
  AsyncFunction("getPeers") {
@@ -1,9 +1,9 @@
1
1
  import ExpoModulesCore
2
2
  import FishjamCloudClient
3
3
 
4
- class VideoPreviewView: ExpoView {
4
+ class VideoPreviewView: ExpoView, LocalCameraTrackChangedListener {
5
5
  var videoView: VideoView? = nil
6
- private var localVideoTrack: LocalVideoTrack? = nil
6
+ private var localVideoTrack: LocalCameraTrack? = nil
7
7
 
8
8
  required init(appContext: AppContext? = nil) {
9
9
  super.init(appContext: appContext)
@@ -13,11 +13,9 @@ class VideoPreviewView: ExpoView {
13
13
  addSubview(videoView!)
14
14
  }
15
15
 
16
- override func willMove(toSuperview newSuperview: UIView?) {
17
- super.willMove(toSuperview: newSuperview)
18
- if newSuperview == nil {
19
- localVideoTrack?.stop()
20
- } else {
16
+ private func trySetLocalCameraTrack() {
17
+ DispatchQueue.main.async { [weak self] in
18
+ guard let self else { return }
21
19
  guard let tracks = RNFishjamClient.fishjamClient?.getLocalEndpoint().tracks else {
22
20
  os_log(
23
21
  "Error moving VideoPreviewView: %{public}s", log: log, type: .error,
@@ -26,12 +24,23 @@ class VideoPreviewView: ExpoView {
26
24
  return
27
25
  }
28
26
 
29
- localVideoTrack =
27
+ self.localVideoTrack =
30
28
  tracks.first(where: { (key, track) in
31
- track is LocalVideoTrack
32
- })?.value as? LocalVideoTrack
33
- localVideoTrack?.start()
34
- videoView?.track = localVideoTrack
29
+ track is LocalCameraTrack
30
+ })?.value as? LocalCameraTrack
31
+ self.localVideoTrack?.start()
32
+ self.videoView?.track = self.localVideoTrack
33
+ }
34
+ }
35
+
36
+ override func willMove(toSuperview newSuperview: UIView?) {
37
+ super.willMove(toSuperview: newSuperview)
38
+ if newSuperview == nil {
39
+ RNFishjamClient.localCameraTracksChangedListenersManager.remove(self)
40
+ localVideoTrack?.stop()
41
+ } else {
42
+ RNFishjamClient.localCameraTracksChangedListenersManager.add(self)
43
+ trySetLocalCameraTrack()
35
44
  }
36
45
  }
37
46
 
@@ -61,4 +70,9 @@ class VideoPreviewView: ExpoView {
61
70
  }
62
71
  }
63
72
  }
73
+
74
+ func onLocalCameraTrackChanged() {
75
+ guard localVideoTrack == nil else { return }
76
+ trySetLocalCameraTrack()
77
+ }
64
78
  }
@@ -2,17 +2,13 @@ import Combine
2
2
  import ExpoModulesCore
3
3
  import FishjamCloudClient
4
4
 
5
- protocol OnTrackUpdateListener {
6
- func onTrackUpdate()
7
- }
8
-
9
- class VideoRendererView: ExpoView, OnTrackUpdateListener {
5
+ class VideoRendererView: ExpoView, TrackUpdateListener {
10
6
  var videoView: VideoView? = nil
11
7
  var cancellableEndpoints: Cancellable? = nil
12
8
 
13
9
  required init(appContext: AppContext? = nil) {
14
10
  super.init(appContext: appContext)
15
- RNFishjamClient.onTracksUpdateListeners.append(self)
11
+ RNFishjamClient.tracksUpdateListenersManager.add(self)
16
12
  videoView = VideoView()
17
13
  videoView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
18
14
  videoView?.clipsToBounds = true
@@ -20,12 +16,7 @@ class VideoRendererView: ExpoView, OnTrackUpdateListener {
20
16
  }
21
17
 
22
18
  deinit {
23
- RNFishjamClient.onTracksUpdateListeners.removeAll(where: {
24
- if let view = $0 as? VideoRendererView {
25
- return view === self
26
- }
27
- return false
28
- })
19
+ RNFishjamClient.tracksUpdateListenersManager.remove(self)
29
20
  }
30
21
 
31
22
  override func willMove(toSuperview newSuperview: UIView?) {
@@ -41,7 +32,7 @@ class VideoRendererView: ExpoView, OnTrackUpdateListener {
41
32
  if self.superview != nil {
42
33
  for endpoint in RNFishjamClient.getLocalAndRemoteEndpoints() {
43
34
  if let track = endpoint.tracks[self.trackId] as? VideoTrack {
44
- if let track = track as? LocalVideoTrack {
35
+ if let track = track as? LocalCameraTrack {
45
36
  self.mirrorVideo = track.isFrontCamera
46
37
  }
47
38
  self.videoView?.track = track
@@ -52,7 +43,7 @@ class VideoRendererView: ExpoView, OnTrackUpdateListener {
52
43
  }
53
44
  }
54
45
 
55
- func onTrackUpdate() {
46
+ func onTracksUpdate() {
56
47
  updateVideoTrack()
57
48
  }
58
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/react-native-client",
3
- "version": "0.2.4",
3
+ "version": "0.4.0",
4
4
  "description": "A React Native client for Fishjam Cloud",
5
5
  "author": "Fishjam Cloud Team",
6
6
  "license": "Apache-2.0",
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@testing-library/react": "^15.0.7",
48
- "@types/lodash": "^4.17.7",
48
+ "@types/lodash": "^4.17.10",
49
49
  "@types/phoenix": "^1.6.5",
50
50
  "@types/promise-fs": "^2.1.2",
51
- "@types/react": "^18.3.7",
51
+ "@types/react": "^18.3.11",
52
52
  "expo": "^51.0.32",
53
53
  "expo-module-scripts": "^3.5.2",
54
54
  "expo-modules-core": "^1.12.24",
@@ -61,10 +61,10 @@
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.3.1",
63
63
  "react-native": "^0.75.2",
64
- "ts-proto": "^2.1.0",
65
- "typedoc": "^0.26.6",
64
+ "ts-proto": "^2.2.3",
65
+ "typedoc": "^0.26.8",
66
66
  "typedoc-plugin-mark-react-functional-components": "^0.2.2",
67
- "typescript": "^5.5.4"
67
+ "typescript": "^5.6.3"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "expo": "*",
@@ -81,6 +81,7 @@
81
81
  },
82
82
  "files": [
83
83
  "build/**",
84
+ "debug",
84
85
  "android/build.gradle",
85
86
  "android/src/**",
86
87
  "ios/*.swift",
@@ -9,7 +9,7 @@ const withFishjamForegroundService = (config) => {
9
9
  mainApplication.service = mainApplication.service || [];
10
10
  const newService = {
11
11
  $: {
12
- 'android:name': 'io.fishjam.reactnative.FishjamForegroundService',
12
+ 'android:name': 'io.fishjam.reactnative.foregroundService.FishjamForegroundService',
13
13
  'android:foregroundServiceType': 'camera|microphone|mediaProjection',
14
14
  },
15
15
  };
@@ -106,7 +106,7 @@ const withInfoPlistConstants = (config) => {
106
106
  };
107
107
  /**
108
108
  * Updates and copies required extension files.
109
- * Our extension needs to be properly setup inside the XCode project. In order to do that we need to copy the files and update the pbxproj.
109
+ * Our extension needs to be properly setup inside the Xcode project. In order to do that we need to copy the files and update the pbxproj.
110
110
  */
111
111
  const withFishjamSBE = (config, options) => {
112
112
  return (0, config_plugins_1.withXcodeProject)(config, async (props) => {
@@ -128,7 +128,7 @@ const withFishjamSBE = (config, options) => {
128
128
  console.error(`Error parsing iOS project: ${JSON.stringify(err)}`);
129
129
  return;
130
130
  }
131
- if (xcodeProject.pbxTargetByName(`"${SBE_TARGET_NAME}"`)) {
131
+ if (xcodeProject.pbxTargetByName(SBE_TARGET_NAME)) {
132
132
  console.log(`${SBE_TARGET_NAME} already exists in project. Skipping...`);
133
133
  return;
134
134
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"useParticipants.d.ts","sourceRoot":"","sources":["../../src/hooks/useParticipants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAiB,MAAM,UAAU,CAAC;AAIzE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAE/B,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAC5C;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,mBAAmB,GAAG,eAAe,CAAC;AAE7E,MAAM,MAAM,WAAW,CACrB,mBAAmB,SAAS,eAAe,GAAG,eAAe,IAC3D;IACF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;OAEG;IACH,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAgBF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,mBAAmB,SAAS,eAAe,GAAG,eAAe;;EA0B9D"}
@@ -1,34 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import RNFishjamClientModule from '../RNFishjamClientModule';
3
- import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
4
- function addIsActiveToTracks(participants) {
5
- return participants.map((participant) => ({
6
- ...participant,
7
- tracks: participant.tracks.map((track) => ({
8
- ...track,
9
- isActive: track?.metadata?.active ?? true,
10
- })),
11
- }));
12
- }
13
- /**
14
- * This hook provides live updates of room participants.
15
- * @returns An array of room participants.
16
- * @category Connection
17
- * @group Hooks
18
- */
19
- export function useParticipants() {
20
- const [participants, setParticipants] = useState([]);
21
- const updateActiveParticipants = useCallback((participants) => {
22
- setParticipants(addIsActiveToTracks(participants));
23
- }, []);
24
- useFishjamEvent(ReceivableEvents.PeersUpdate, updateActiveParticipants);
25
- useEffect(() => {
26
- async function updateParticipants() {
27
- const participants = await RNFishjamClientModule.getPeers();
28
- setParticipants(addIsActiveToTracks(participants));
29
- }
30
- updateParticipants();
31
- }, []);
32
- return { participants };
33
- }
34
- //# sourceMappingURL=useParticipants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useParticipants.js","sourceRoot":"","sources":["../../src/hooks/useParticipants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzD,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8DtE,SAAS,mBAAmB,CAG1B,YAA6D;IAE7D,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,WAAW;QACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACzC,GAAG,KAAK;YACR,QAAQ,EACL,KAAsC,EAAE,QAAQ,EAAE,MAAM,IAAI,IAAI;SACpE,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAG7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAE9C,EAAE,CAAC,CAAC;IAEN,MAAM,wBAAwB,GAAG,WAAW,CAC1C,CAAC,YAAgD,EAAE,EAAE;QACnD,eAAe,CAAC,mBAAmB,CAAsB,YAAY,CAAC,CAAC,CAAC;IAC1E,CAAC,EACD,EAAE,CACH,CAAC;IAEF,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,kBAAkB;YAC/B,MAAM,YAAY,GAChB,MAAM,qBAAqB,CAAC,QAAQ,EAAuB,CAAC;YAC9D,eAAe,CAAC,mBAAmB,CAAsB,YAAY,CAAC,CAAC,CAAC;QAC1E,CAAC;QAED,kBAAkB,EAAE,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport { GenericMetadata, TrackEncoding, TrackMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport type TrackType = 'Audio' | 'Video';\n\n/**\n * Type describing Voice Activity Detection statuses.\n *\n * speech - voice activity has been detected\n * silence - lack of voice activity has been detected\n */\nexport type VadStatus = 'silence' | 'speech';\n\ntype TrackBase = {\n id: string;\n type: TrackType;\n isActive: boolean;\n};\n\nexport type AudioTrack = TrackBase & {\n type: 'Audio';\n vadStatus: VadStatus | undefined;\n};\n\nexport type VideoTrack = TrackBase & {\n type: 'Video';\n // Encoding that is currently received. Only present for remote tracks.\n encoding: TrackEncoding | null;\n // The reason of currently selected encoding. Only present for remote tracks.\n encodingReason: EncodingReason | null;\n};\n\nexport type Track = VideoTrack | AudioTrack;\n/**\n * Type describing possible reasons of currently selected encoding.\n *\n * - other - the exact reason couldn't be determined\n * - encoding_inactive - previously selected encoding became inactive\n * - low_bandwidth - there is no longer enough bandwidth to maintain previously selected encoding\n */\nexport type EncodingReason = 'other' | 'encoding_inactive' | 'low_bandwidth';\n\nexport type Participant<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n> = {\n /**\n * id used to identify a participant\n */\n id: string;\n /**\n * whether the participant is local or remote\n */\n isLocal: boolean;\n /**\n * a map indexed by strings, containing participant metadata from the server\n */\n metadata: ParticipantMetadata;\n /**\n * a list of participants's video and audio tracks\n */\n tracks: Track[];\n};\n\nfunction addIsActiveToTracks<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>(\n participants: ReadonlyArray<Participant<ParticipantMetadata>>,\n): Participant<ParticipantMetadata>[] {\n return participants.map((participant) => ({\n ...participant,\n tracks: participant.tracks.map((track) => ({\n ...track,\n isActive:\n (track as { metadata?: TrackMetadata })?.metadata?.active ?? true,\n })),\n }));\n}\n/**\n * This hook provides live updates of room participants.\n * @returns An array of room participants.\n * @category Connection\n * @group Hooks\n */\nexport function useParticipants<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>() {\n const [participants, setParticipants] = useState<\n Participant<ParticipantMetadata>[]\n >([]);\n\n const updateActiveParticipants = useCallback(\n (participants: Participant<ParticipantMetadata>[]) => {\n setParticipants(addIsActiveToTracks<ParticipantMetadata>(participants));\n },\n [],\n );\n\n useFishjamEvent(ReceivableEvents.PeersUpdate, updateActiveParticipants);\n\n useEffect(() => {\n async function updateParticipants() {\n const participants =\n await RNFishjamClientModule.getPeers<ParticipantMetadata>();\n setParticipants(addIsActiveToTracks<ParticipantMetadata>(participants));\n }\n\n updateParticipants();\n }, []);\n\n return { participants };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stats/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,EAAE,0BAA0B,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/stats/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A record of the total time, in seconds,\n * that this stream has spent in each quality limitation state.\n * none: The resolution and/or framerate is not limited.\n * bandwidth: The resolution and/or framerate is primarily limited due to\n * congestion cues during bandwidth estimation.\n * Typical, congestion control algorithms use inter-arrival time,\n * round-trip time, packet or other congestion cues to perform bandwidth estimation.\n * cpu: The resolution and/or framerate is primarily limited due to CPU load.\n * other: The resolution and/or framerate is primarily limited\n * for a reason other than the above.\n */\nexport type QualityLimitationDurations = {\n bandwidth: number;\n cpu: number;\n none: number;\n other: number;\n};\n\nexport type RTCOutboundStats = {\n 'kind': string;\n 'rid': string;\n 'bytesSent': number;\n 'targetBitrate': number;\n 'packetsSent': number;\n 'framesEncoded': number;\n 'framesPerSecond': number;\n 'frameWidth': number;\n 'frameHeight': number;\n 'qualityLimitationDurations': QualityLimitationDurations;\n 'bytesSent/s': number;\n 'packetsSent/s': number;\n 'framesEncoded/s': number;\n};\n\nexport type RTCInboundStats = {\n 'kind': number;\n 'jitter': number;\n 'packetsLost': number;\n 'packetsReceived': number;\n 'bytesReceived': number;\n 'framesReceived': number;\n 'frameWidth': number;\n 'frameHeight': number;\n 'framesPerSecond': number;\n 'framesDropped': number;\n 'packetsLost/s': number;\n 'packetsReceived/s': number;\n 'bytesReceived/s': number;\n 'framesReceived/s': number;\n 'framesDropped/s': number;\n};\n\nexport type RTCTrackStats = RTCOutboundStats | RTCInboundStats;\n\nexport type RTCStats = { [key: string]: RTCTrackStats };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRTCStatistics.d.ts","sourceRoot":"","sources":["../../src/stats/useRTCStatistics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqC,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG3E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM;;EAuFvD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRTCStatistics.js","sourceRoot":"","sources":["../../src/stats/useRTCStatistics.ts"],"names":[],"mappings":"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","sourcesContent":["import { takeRight } from 'lodash';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { RTCInboundStats, RTCOutboundStats, RTCStats } from './types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\n/**\n * This hook provides access to current rtc statistics data.\n * @category Debugging\n */\nexport function useRTCStatistics(refreshInterval: number) {\n const MAX_SIZE = 120;\n const [statistics, setStatistics] = useState<RTCStats[]>([]);\n\n // Calculates diff between pervious and current stats,\n // providing end users with a per second metric.\n const processIncomingStats = useCallback(\n (statistics: ReadonlyArray<RTCStats>, stats: Readonly<RTCStats>) => {\n Object.keys(stats).forEach((obj) => {\n if (obj.includes('Inbound')) {\n const rtcStats = stats[obj] as RTCInboundStats;\n\n if (\n statistics.length > 0 &&\n Object.keys(statistics[statistics.length - 1]).includes(obj)\n ) {\n const prevRtcStats = statistics[statistics.length - 1][\n obj\n ] as RTCInboundStats;\n\n rtcStats['packetsLost/s'] =\n rtcStats['packetsLost'] - prevRtcStats['packetsLost'];\n rtcStats['packetsReceived/s'] =\n rtcStats['packetsReceived'] - prevRtcStats['packetsReceived'];\n rtcStats['bytesReceived/s'] =\n rtcStats['bytesReceived'] - prevRtcStats['bytesReceived'];\n rtcStats['framesReceived/s'] =\n rtcStats['framesReceived'] - prevRtcStats['framesReceived'];\n rtcStats['framesDropped/s'] =\n rtcStats['framesDropped'] - prevRtcStats['framesDropped'];\n } else {\n rtcStats['packetsLost/s'] = 0;\n rtcStats['packetsReceived/s'] = 0;\n rtcStats['bytesReceived/s'] = 0;\n rtcStats['framesReceived/s'] = 0;\n rtcStats['framesDropped/s'] = 0;\n }\n return stats;\n }\n // Outbound\n const rtcStats = stats[obj] as RTCOutboundStats;\n\n if (\n statistics.length > 0 &&\n Object.keys(statistics[statistics.length - 1]).includes(obj)\n ) {\n const prevRtcStats = statistics[statistics.length - 1][\n obj\n ] as RTCOutboundStats;\n\n rtcStats['bytesSent/s'] =\n rtcStats['bytesSent'] - prevRtcStats['bytesSent'];\n rtcStats['packetsSent/s'] =\n rtcStats['packetsSent'] - prevRtcStats['packetsSent'];\n rtcStats['framesEncoded/s'] =\n rtcStats['framesEncoded'] - prevRtcStats['framesEncoded'];\n } else {\n rtcStats['bytesSent/s'] = 0;\n rtcStats['packetsSent/s'] = 0;\n rtcStats['framesEncoded/s'] = 0;\n }\n return stats;\n });\n return stats;\n },\n [],\n );\n\n // Gets stats from the native libraries.\n const getStatistics = useCallback(async () => {\n const stats = await RNFishjamClientModule.getStatistics();\n setStatistics((prev) => {\n const newStats = [...prev, processIncomingStats(prev, stats)];\n takeRight(newStats, MAX_SIZE);\n return newStats;\n });\n }, [processIncomingStats]);\n\n useEffect(() => {\n const intervalId = setInterval(getStatistics, refreshInterval);\n return () => {\n clearInterval(intervalId);\n setStatistics([]);\n };\n }, [getStatistics, refreshInterval]);\n\n return { statistics };\n}\n"]}
@@ -1,32 +0,0 @@
1
- import { ForegroundServiceOptions } from '../types';
2
- /**
3
- * Launches a foreground service on Android.
4
- * Does nothing on other platforms.
5
- *
6
- * @remarks
7
- * You must have have the following permissions enabled before calling this function:
8
- * @example
9
- ```
10
- "android.permission.FOREGROUND_SERVICE"
11
- "android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
12
- "android.permission.FOREGROUND_SERVICE_CAMERA"
13
- "android.permission.FOREGROUND_SERVICE_MICROPHONE"
14
- "android.permission.POST_NOTIFICATIONS"
15
- *```
16
- * as well as FishjamForegroundService in your AndroidManifest:
17
- * @example
18
- ```
19
- <service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
20
- ```
21
- * @category Screenshare
22
- */
23
- export declare const startForegroundService: (options: ForegroundServiceOptions) => void;
24
- /**
25
- * Stops previously launched Android foreground service.
26
- * @see {@link startForegroundService} for further information.
27
- *
28
- * Does nothing on other platforms.
29
- * @category Screenshare
30
- */
31
- export declare const stopForegroundService: () => void;
32
- //# sourceMappingURL=foregroundService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"foregroundService.d.ts","sourceRoot":"","sources":["../../src/utils/foregroundService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;MAoBM;AACN,eAAO,MAAM,sBAAsB,YAAa,wBAAwB,SAKvE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,YAKjC,CAAC"}
@@ -1,43 +0,0 @@
1
- import { Platform } from 'react-native';
2
- import RNFishjamClientModule from '../RNFishjamClientModule';
3
- /**
4
- * Launches a foreground service on Android.
5
- * Does nothing on other platforms.
6
- *
7
- * @remarks
8
- * You must have have the following permissions enabled before calling this function:
9
- * @example
10
- ```
11
- "android.permission.FOREGROUND_SERVICE"
12
- "android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
13
- "android.permission.FOREGROUND_SERVICE_CAMERA"
14
- "android.permission.FOREGROUND_SERVICE_MICROPHONE"
15
- "android.permission.POST_NOTIFICATIONS"
16
- *```
17
- * as well as FishjamForegroundService in your AndroidManifest:
18
- * @example
19
- ```
20
- <service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
21
- ```
22
- * @category Screenshare
23
- */
24
- export const startForegroundService = (options) => {
25
- if (Platform.OS !== 'android') {
26
- return;
27
- }
28
- RNFishjamClientModule.startForegroundService(options);
29
- };
30
- /**
31
- * Stops previously launched Android foreground service.
32
- * @see {@link startForegroundService} for further information.
33
- *
34
- * Does nothing on other platforms.
35
- * @category Screenshare
36
- */
37
- export const stopForegroundService = () => {
38
- if (Platform.OS !== 'android') {
39
- return;
40
- }
41
- RNFishjamClientModule.stopForegroundService();
42
- };
43
- //# sourceMappingURL=foregroundService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"foregroundService.js","sourceRoot":"","sources":["../../src/utils/foregroundService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;MAoBM;AACN,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAiC,EAAE,EAAE;IAC1E,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,qBAAqB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,qBAAqB,CAAC,qBAAqB,EAAE,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Platform } from 'react-native';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ForegroundServiceOptions } from '../types';\n\n/**\n * Launches a foreground service on Android.\n * Does nothing on other platforms.\n * \n * @remarks\n * You must have have the following permissions enabled before calling this function:\n * @example\n ```\n \"android.permission.FOREGROUND_SERVICE\"\n \"android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION\"\n \"android.permission.FOREGROUND_SERVICE_CAMERA\"\n \"android.permission.FOREGROUND_SERVICE_MICROPHONE\"\n \"android.permission.POST_NOTIFICATIONS\"\n *```\n * as well as FishjamForegroundService in your AndroidManifest:\n * @example\n ```\n <service android:name=\"io.fishjam.reactnative.FishjamForegroundService\" android:foregroundServiceType=\"camera|microphone|mediaProjection\"/>\n ```\n * @category Screenshare\n */\nexport const startForegroundService = (options: ForegroundServiceOptions) => {\n if (Platform.OS !== 'android') {\n return;\n }\n RNFishjamClientModule.startForegroundService(options);\n};\n\n/**\n * Stops previously launched Android foreground service.\n * @see {@link startForegroundService} for further information.\n *\n * Does nothing on other platforms.\n * @category Screenshare\n */\nexport const stopForegroundService = () => {\n if (Platform.OS !== 'android') {\n return;\n }\n RNFishjamClientModule.stopForegroundService();\n};\n"]}
File without changes
File without changes