@fishjam-cloud/react-native-client 0.24.0 → 0.25.0-rc.2

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 (260) hide show
  1. package/README.md +56 -15
  2. package/dist/index.d.ts +13 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +19 -0
  5. package/dist/overrides/RTCPeerConnection.d.ts +8 -0
  6. package/dist/overrides/RTCPeerConnection.d.ts.map +1 -0
  7. package/dist/overrides/RTCPeerConnection.js +16 -0
  8. package/dist/overrides/RTCView.d.ts +11 -0
  9. package/dist/overrides/RTCView.d.ts.map +1 -0
  10. package/dist/overrides/RTCView.js +21 -0
  11. package/dist/polyfills/local-storage.d.ts +10 -0
  12. package/dist/polyfills/local-storage.d.ts.map +1 -0
  13. package/dist/polyfills/local-storage.js +24 -0
  14. package/{build/hooks → dist}/useForegroundService.d.ts +10 -10
  15. package/dist/useForegroundService.d.ts.map +1 -0
  16. package/dist/useForegroundService.js +10 -0
  17. package/dist/webrtc-polyfill.d.ts +2 -0
  18. package/dist/webrtc-polyfill.d.ts.map +1 -0
  19. package/dist/webrtc-polyfill.js +14 -0
  20. package/package.json +45 -92
  21. package/plugin/broadcastExtensionFiles/Atomic.swift +37 -0
  22. package/plugin/broadcastExtensionFiles/DarwinNotificationCenter.swift +29 -0
  23. package/plugin/broadcastExtensionFiles/Info.plist +1 -1
  24. package/plugin/broadcastExtensionFiles/SampleHandler.swift +104 -0
  25. package/plugin/broadcastExtensionFiles/SampleUploader.swift +146 -0
  26. package/plugin/broadcastExtensionFiles/SocketConnection.swift +198 -0
  27. package/plugin/build/types.d.ts +5 -4
  28. package/plugin/build/withFishjam.d.ts +31 -2
  29. package/plugin/build/withFishjam.js +31 -5
  30. package/plugin/build/withFishjamAndroid.d.ts +2 -2
  31. package/plugin/build/withFishjamAndroid.js +48 -40
  32. package/plugin/build/withFishjamIos.d.ts +3 -8
  33. package/plugin/build/withFishjamIos.js +52 -72
  34. package/LICENSE.txt +0 -201
  35. package/android/build.gradle +0 -95
  36. package/android/src/main/AndroidManifest.xml +0 -2
  37. package/android/src/main/java/io/fishjam/reactnative/AudioDeviceKind.kt +0 -34
  38. package/android/src/main/java/io/fishjam/reactnative/AudioSwitchManager.kt +0 -61
  39. package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +0 -126
  40. package/android/src/main/java/io/fishjam/reactnative/Errors.kt +0 -31
  41. package/android/src/main/java/io/fishjam/reactnative/PipContainerView.kt +0 -282
  42. package/android/src/main/java/io/fishjam/reactnative/PipContainerViewModule.kt +0 -41
  43. package/android/src/main/java/io/fishjam/reactnative/PipTrackSelector.kt +0 -98
  44. package/android/src/main/java/io/fishjam/reactnative/PipViewFactory.kt +0 -186
  45. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +0 -1001
  46. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +0 -358
  47. package/android/src/main/java/io/fishjam/reactnative/Utils.kt +0 -11
  48. package/android/src/main/java/io/fishjam/reactnative/VideoPreviewView.kt +0 -40
  49. package/android/src/main/java/io/fishjam/reactnative/VideoPreviewViewModule.kt +0 -22
  50. package/android/src/main/java/io/fishjam/reactnative/VideoRendererView.kt +0 -76
  51. package/android/src/main/java/io/fishjam/reactnative/VideoRendererViewModule.kt +0 -33
  52. package/android/src/main/java/io/fishjam/reactnative/VideoView.kt +0 -257
  53. package/android/src/main/java/io/fishjam/reactnative/extensions/CaptureDevice.kt +0 -17
  54. package/android/src/main/java/io/fishjam/reactnative/foregroundService/FishjamForegroundService.kt +0 -101
  55. package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceManager.kt +0 -118
  56. package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceState.kt +0 -46
  57. package/android/src/main/java/io/fishjam/reactnative/helpers/PictureInPictureHelperFragment.kt +0 -20
  58. package/android/src/main/java/io/fishjam/reactnative/managers/ListenerManager.kt +0 -24
  59. package/android/src/main/java/io/fishjam/reactnative/managers/LocalCameraTracksChangedListenersManager.kt +0 -8
  60. package/android/src/main/java/io/fishjam/reactnative/managers/LocalTracksSwitchListenersManager.kt +0 -17
  61. package/android/src/main/java/io/fishjam/reactnative/managers/TracksUpdateListenersManager.kt +0 -7
  62. package/android/src/main/java/io/fishjam/reactnative/utils/PermissionUtils.kt +0 -45
  63. package/build/RNFishjamClientModule.d.ts +0 -106
  64. package/build/RNFishjamClientModule.d.ts.map +0 -1
  65. package/build/RNFishjamClientModule.js +0 -21
  66. package/build/RNFishjamClientModule.js.map +0 -1
  67. package/build/common/metadata.d.ts +0 -9
  68. package/build/common/metadata.d.ts.map +0 -1
  69. package/build/common/metadata.js +0 -11
  70. package/build/common/metadata.js.map +0 -1
  71. package/build/components/FishjamRoom/GridTrackItem.d.ts +0 -12
  72. package/build/components/FishjamRoom/GridTrackItem.d.ts.map +0 -1
  73. package/build/components/FishjamRoom/GridTrackItem.js +0 -56
  74. package/build/components/FishjamRoom/GridTrackItem.js.map +0 -1
  75. package/build/components/FishjamRoom/VideosGrid.d.ts +0 -3
  76. package/build/components/FishjamRoom/VideosGrid.d.ts.map +0 -1
  77. package/build/components/FishjamRoom/VideosGrid.js +0 -20
  78. package/build/components/FishjamRoom/VideosGrid.js.map +0 -1
  79. package/build/components/FishjamRoom/index.d.ts +0 -33
  80. package/build/components/FishjamRoom/index.d.ts.map +0 -1
  81. package/build/components/FishjamRoom/index.js +0 -52
  82. package/build/components/FishjamRoom/index.js.map +0 -1
  83. package/build/components/FishjamRoom/parsePeersToTracks.d.ts +0 -4
  84. package/build/components/FishjamRoom/parsePeersToTracks.d.ts.map +0 -1
  85. package/build/components/FishjamRoom/parsePeersToTracks.js +0 -37
  86. package/build/components/FishjamRoom/parsePeersToTracks.js.map +0 -1
  87. package/build/components/PipContainerView.d.ts +0 -48
  88. package/build/components/PipContainerView.d.ts.map +0 -1
  89. package/build/components/PipContainerView.js +0 -34
  90. package/build/components/PipContainerView.js.map +0 -1
  91. package/build/components/VideoPreviewView.d.ts +0 -28
  92. package/build/components/VideoPreviewView.d.ts.map +0 -1
  93. package/build/components/VideoPreviewView.js +0 -17
  94. package/build/components/VideoPreviewView.js.map +0 -1
  95. package/build/components/VideoRendererView.d.ts +0 -39
  96. package/build/components/VideoRendererView.d.ts.map +0 -1
  97. package/build/components/VideoRendererView.js +0 -25
  98. package/build/components/VideoRendererView.js.map +0 -1
  99. package/build/consts/index.d.ts +0 -5
  100. package/build/consts/index.d.ts.map +0 -1
  101. package/build/consts/index.js +0 -8
  102. package/build/consts/index.js.map +0 -1
  103. package/build/debug/common/webRTC.d.ts +0 -9
  104. package/build/debug/common/webRTC.d.ts.map +0 -1
  105. package/build/debug/common/webRTC.js +0 -11
  106. package/build/debug/common/webRTC.js.map +0 -1
  107. package/build/debug/index.d.ts +0 -4
  108. package/build/debug/index.d.ts.map +0 -1
  109. package/build/debug/index.js +0 -3
  110. package/build/debug/index.js.map +0 -1
  111. package/build/debug/stats/types.d.ts +0 -55
  112. package/build/debug/stats/types.d.ts.map +0 -1
  113. package/build/debug/stats/types.js +0 -2
  114. package/build/debug/stats/types.js.map +0 -1
  115. package/build/debug/stats/useRTCStatistics.d.ts +0 -9
  116. package/build/debug/stats/useRTCStatistics.d.ts.map +0 -1
  117. package/build/debug/stats/useRTCStatistics.js +0 -79
  118. package/build/debug/stats/useRTCStatistics.js.map +0 -1
  119. package/build/hooks/internal/useFishjamEvent.d.ts +0 -4
  120. package/build/hooks/internal/useFishjamEvent.d.ts.map +0 -1
  121. package/build/hooks/internal/useFishjamEvent.js +0 -38
  122. package/build/hooks/internal/useFishjamEvent.js.map +0 -1
  123. package/build/hooks/internal/useFishjamEventState.d.ts +0 -3
  124. package/build/hooks/internal/useFishjamEventState.d.ts.map +0 -1
  125. package/build/hooks/internal/useFishjamEventState.js +0 -18
  126. package/build/hooks/internal/useFishjamEventState.js.map +0 -1
  127. package/build/hooks/useAppScreenShare.d.ts +0 -18
  128. package/build/hooks/useAppScreenShare.d.ts.map +0 -1
  129. package/build/hooks/useAppScreenShare.js +0 -46
  130. package/build/hooks/useAppScreenShare.js.map +0 -1
  131. package/build/hooks/useAudioSettings.d.ts +0 -49
  132. package/build/hooks/useAudioSettings.d.ts.map +0 -1
  133. package/build/hooks/useAudioSettings.js +0 -70
  134. package/build/hooks/useAudioSettings.js.map +0 -1
  135. package/build/hooks/useBandwidthEstimation.d.ts +0 -14
  136. package/build/hooks/useBandwidthEstimation.d.ts.map +0 -1
  137. package/build/hooks/useBandwidthEstimation.js +0 -19
  138. package/build/hooks/useBandwidthEstimation.js.map +0 -1
  139. package/build/hooks/useCallKit.d.ts +0 -121
  140. package/build/hooks/useCallKit.d.ts.map +0 -1
  141. package/build/hooks/useCallKit.js +0 -142
  142. package/build/hooks/useCallKit.js.map +0 -1
  143. package/build/hooks/useCamera.d.ts +0 -113
  144. package/build/hooks/useCamera.d.ts.map +0 -1
  145. package/build/hooks/useCamera.js +0 -93
  146. package/build/hooks/useCamera.js.map +0 -1
  147. package/build/hooks/useConnection.d.ts +0 -73
  148. package/build/hooks/useConnection.d.ts.map +0 -1
  149. package/build/hooks/useConnection.js +0 -46
  150. package/build/hooks/useConnection.js.map +0 -1
  151. package/build/hooks/useForegroundService.d.ts.map +0 -1
  152. package/build/hooks/useForegroundService.js +0 -66
  153. package/build/hooks/useForegroundService.js.map +0 -1
  154. package/build/hooks/useMicrophone.d.ts +0 -16
  155. package/build/hooks/useMicrophone.d.ts.map +0 -1
  156. package/build/hooks/useMicrophone.js +0 -31
  157. package/build/hooks/useMicrophone.js.map +0 -1
  158. package/build/hooks/usePeerStatus.d.ts +0 -10
  159. package/build/hooks/usePeerStatus.d.ts.map +0 -1
  160. package/build/hooks/usePeerStatus.js +0 -13
  161. package/build/hooks/usePeerStatus.js.map +0 -1
  162. package/build/hooks/usePeers.d.ts +0 -98
  163. package/build/hooks/usePeers.d.ts.map +0 -1
  164. package/build/hooks/usePeers.js +0 -81
  165. package/build/hooks/usePeers.js.map +0 -1
  166. package/build/hooks/usePermissions.d.ts +0 -24
  167. package/build/hooks/usePermissions.d.ts.map +0 -1
  168. package/build/hooks/usePermissions.js +0 -61
  169. package/build/hooks/usePermissions.js.map +0 -1
  170. package/build/hooks/useReconnection.d.ts +0 -11
  171. package/build/hooks/useReconnection.d.ts.map +0 -1
  172. package/build/hooks/useReconnection.js +0 -14
  173. package/build/hooks/useReconnection.js.map +0 -1
  174. package/build/hooks/useSandbox.d.ts +0 -20
  175. package/build/hooks/useSandbox.d.ts.map +0 -1
  176. package/build/hooks/useSandbox.js +0 -54
  177. package/build/hooks/useSandbox.js.map +0 -1
  178. package/build/hooks/useScreenShare.d.ts +0 -36
  179. package/build/hooks/useScreenShare.d.ts.map +0 -1
  180. package/build/hooks/useScreenShare.js +0 -45
  181. package/build/hooks/useScreenShare.js.map +0 -1
  182. package/build/hooks/useUpdatePeerMetadata.d.ts +0 -15
  183. package/build/hooks/useUpdatePeerMetadata.d.ts.map +0 -1
  184. package/build/hooks/useUpdatePeerMetadata.js +0 -21
  185. package/build/hooks/useUpdatePeerMetadata.js.map +0 -1
  186. package/build/index.d.ts +0 -36
  187. package/build/index.d.ts.map +0 -1
  188. package/build/index.js +0 -30
  189. package/build/index.js.map +0 -1
  190. package/build/livestream/components/LivestreamStreamer.d.ts +0 -24
  191. package/build/livestream/components/LivestreamStreamer.d.ts.map +0 -1
  192. package/build/livestream/components/LivestreamStreamer.js +0 -12
  193. package/build/livestream/components/LivestreamStreamer.js.map +0 -1
  194. package/build/livestream/components/LivestreamViewer.d.ts +0 -46
  195. package/build/livestream/components/LivestreamViewer.d.ts.map +0 -1
  196. package/build/livestream/components/LivestreamViewer.js +0 -10
  197. package/build/livestream/components/LivestreamViewer.js.map +0 -1
  198. package/build/livestream/hooks/useLivestreamScreenSharingStreamer.d.ts +0 -49
  199. package/build/livestream/hooks/useLivestreamScreenSharingStreamer.d.ts.map +0 -1
  200. package/build/livestream/hooks/useLivestreamScreenSharingStreamer.js +0 -58
  201. package/build/livestream/hooks/useLivestreamScreenSharingStreamer.js.map +0 -1
  202. package/build/livestream/hooks/useLivestreamStreamer.d.ts +0 -65
  203. package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +0 -1
  204. package/build/livestream/hooks/useLivestreamStreamer.js +0 -71
  205. package/build/livestream/hooks/useLivestreamStreamer.js.map +0 -1
  206. package/build/livestream/hooks/useLivestreamViewer.d.ts +0 -36
  207. package/build/livestream/hooks/useLivestreamViewer.d.ts.map +0 -1
  208. package/build/livestream/hooks/useLivestreamViewer.js +0 -73
  209. package/build/livestream/hooks/useLivestreamViewer.js.map +0 -1
  210. package/build/livestream/index.d.ts +0 -12
  211. package/build/livestream/index.d.ts.map +0 -1
  212. package/build/livestream/index.js +0 -7
  213. package/build/livestream/index.js.map +0 -1
  214. package/build/protos/fishjam/peer_notifications.d.ts +0 -63
  215. package/build/protos/fishjam/peer_notifications.d.ts.map +0 -1
  216. package/build/protos/fishjam/peer_notifications.js +0 -235
  217. package/build/protos/fishjam/peer_notifications.js.map +0 -1
  218. package/build/types.d.ts +0 -34
  219. package/build/types.d.ts.map +0 -1
  220. package/build/types.js +0 -2
  221. package/build/types.js.map +0 -1
  222. package/build/utils/config.d.ts +0 -6
  223. package/build/utils/config.d.ts.map +0 -1
  224. package/build/utils/config.js +0 -10
  225. package/build/utils/config.js.map +0 -1
  226. package/build/utils/errorListener.d.ts +0 -2
  227. package/build/utils/errorListener.d.ts.map +0 -1
  228. package/build/utils/errorListener.js +0 -15
  229. package/build/utils/errorListener.js.map +0 -1
  230. package/build/utils/eventPayloadValidator.d.ts +0 -3
  231. package/build/utils/eventPayloadValidator.d.ts.map +0 -1
  232. package/build/utils/eventPayloadValidator.js +0 -86
  233. package/build/utils/eventPayloadValidator.js.map +0 -1
  234. package/build/utils/getFishjamUrl.d.ts +0 -2
  235. package/build/utils/getFishjamUrl.d.ts.map +0 -1
  236. package/build/utils/getFishjamUrl.js +0 -10
  237. package/build/utils/getFishjamUrl.js.map +0 -1
  238. package/debug/package.json +0 -4
  239. package/expo-module.config.json +0 -19
  240. package/ios/CameraPermissionsRequester.swift +0 -117
  241. package/ios/Events.swift +0 -152
  242. package/ios/PictureInPictureManager.swift +0 -215
  243. package/ios/PipContainerView.swift +0 -56
  244. package/ios/PipContainerViewModule.swift +0 -48
  245. package/ios/RNFishjamClient.podspec +0 -30
  246. package/ios/RNFishjamClient.swift +0 -995
  247. package/ios/RNFishjamClientModule.swift +0 -289
  248. package/ios/RNFishjamProxy.swift +0 -12
  249. package/ios/Utils/PermissionUtils.swift +0 -16
  250. package/ios/Utils.swift +0 -23
  251. package/ios/VideoPreviewView.swift +0 -54
  252. package/ios/VideoPreviewViewModule.swift +0 -21
  253. package/ios/VideoRendererView.swift +0 -98
  254. package/ios/VideoRendererViewModule.swift +0 -23
  255. package/ios/extensions/AVCaptureDevice.swift +0 -20
  256. package/ios/managers/LocalCameraTracksChangedListenersManager.swift +0 -23
  257. package/ios/managers/TracksUpdateListenersManager.swift +0 -21
  258. package/livestream/package.json +0 -4
  259. package/plugin/broadcastExtensionFiles/FishjamBroadcastSampleHandler.swift +0 -50
  260. /package/plugin/broadcastExtensionFiles/{FishjamScreenBroadcastExtension.entitlements → ScreenBroadcastExtension.entitlements} +0 -0
@@ -1,289 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- struct RNSimulcastConfig: Record {
4
- @Field
5
- var enabled: Bool = false
6
- }
7
-
8
- struct CameraConfig: Record {
9
- @Field
10
- var quality: String = "VGA169"
11
-
12
- @Field
13
- var flipDimensions: Bool = false
14
-
15
- @Field
16
- var videoTrackMetadata: [String: Any] = [:]
17
-
18
- @Field
19
- var simulcastConfig: RNSimulcastConfig = RNSimulcastConfig()
20
-
21
- @Field
22
- var cameraEnabled: Bool = true
23
-
24
- @Field
25
- var cameraId: String? = nil
26
- }
27
-
28
- struct MicrophoneConfig: Record {
29
- @Field
30
- var audioTrackMetadata: [String: Any] = [:]
31
-
32
- @Field
33
- var microphoneEnabled: Bool = true
34
- }
35
-
36
- struct ScreenShareOptions: Record {
37
- @Field
38
- var quality: String = "HD15"
39
-
40
- @Field
41
- var screenShareMetadata: [String: Any] = [:]
42
-
43
- @Field
44
- var simulcastConfig: RNSimulcastConfig = RNSimulcastConfig()
45
- }
46
-
47
- struct ReconnectConfig: Record {
48
- @Field
49
- var maxAttempts: Int = 5
50
-
51
- @Field
52
- var initialDelayMs: Int = 1000
53
-
54
- @Field
55
- var delayMs: Int = 1000
56
- }
57
-
58
- struct ConnectConfig: Record {
59
- @Field
60
- var reconnectConfig: ReconnectConfig = ReconnectConfig()
61
- }
62
-
63
- typealias RNTrackBandwidthLimit = Either<Int, [String: Int]>
64
-
65
- public class RNFishjamClientModule: Module {
66
- public func definition() -> ModuleDefinition {
67
- let rnFishjamClient: RNFishjamClient = {
68
- let client = RNFishjamClient(sendEvent)
69
- client.create()
70
- return client
71
- }()
72
-
73
- Name("RNFishjamClient")
74
-
75
- Events(EmitableEvent.allEvents)
76
-
77
- OnCreate {
78
- let permissionsManager = self.appContext?.permissions
79
- EXPermissionsMethodsDelegate.register(
80
- [
81
- CameraOnlyPermissionRequester(),
82
- CameraMicrophonePermissionRequester()
83
- ],
84
- withPermissionsManager: permissionsManager
85
- )
86
- }
87
-
88
- Property("peerStatus") {
89
- return rnFishjamClient.peerStatus.rawValue
90
- }
91
-
92
- Property("reconnectionStatus") {
93
- return rnFishjamClient.reconnectionStatus.rawValue
94
- }
95
-
96
- Property("isMicrophoneOn") {
97
- return rnFishjamClient.isMicrophoneOn
98
- }
99
-
100
- Property("isCameraOn") {
101
- return rnFishjamClient.isCameraOn
102
- }
103
-
104
- Property("cameras") {
105
- return rnFishjamClient.getCaptureDevices()
106
- }
107
-
108
- Property("currentCamera") {
109
- return rnFishjamClient.currentCamera
110
- }
111
-
112
- Property("isScreenShareOn") {
113
- return rnFishjamClient.isScreenShareOn
114
- }
115
-
116
- Property("isAppScreenShareOn") {
117
- return rnFishjamClient.isAppScreenShareOn
118
- }
119
-
120
- Property("isCameraInitialized") {
121
- return rnFishjamClient.isCameraInitialized
122
- }
123
-
124
- Property("hasActiveCallKitSession") {
125
- return rnFishjamClient.hasActiveCallKitSession
126
- }
127
-
128
- Function("getPeers") {
129
- return rnFishjamClient.getPeers()
130
- }
131
-
132
- AsyncFunction("joinRoom") {
133
- (
134
- url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
135
- promise: Promise
136
- ) in
137
- rnFishjamClient.joinRoom(
138
- url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
139
- promise: promise)
140
- }
141
-
142
- AsyncFunction("leaveRoom") {
143
- rnFishjamClient.leaveRoom()
144
- }
145
-
146
- AsyncFunction("startCamera") { (config: CameraConfig) in
147
- try await rnFishjamClient.startCamera(config: config)
148
- }
149
-
150
- AsyncFunction("toggleMicrophone") {
151
- try await rnFishjamClient.toggleMicrophone()
152
- }
153
-
154
- AsyncFunction("startMicrophone") {
155
- try await rnFishjamClient.startMicrophone()
156
- }
157
-
158
- AsyncFunction("stopMicrophone") {
159
- try rnFishjamClient.stopMicrophone()
160
- }
161
-
162
- AsyncFunction("toggleCamera") {
163
- try rnFishjamClient.toggleCamera()
164
- }
165
-
166
- AsyncFunction("flipCamera") {
167
- try rnFishjamClient.flipCamera()
168
- }
169
-
170
- AsyncFunction("switchCamera") { (cameraId: String) in
171
- try rnFishjamClient.switchCamera(cameraId: cameraId)
172
- }
173
-
174
- AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
175
- try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
176
- }
177
-
178
- AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
179
- try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
180
- }
181
-
182
- AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
183
- try rnFishjamClient.updatePeerMetadata(metadata: metadata)
184
- }
185
-
186
- AsyncFunction("updateVideoTrackMetadata") { (metadata: [String: Any]) in
187
- try rnFishjamClient.updateLocalVideoTrackMetadata(metadata: metadata)
188
- }
189
-
190
- AsyncFunction("updateScreenShareTrackMetadata") { (metadata: [String: Any]) in
191
- try rnFishjamClient.updateLocalScreenShareTrackMetadata(metadata: metadata)
192
- }
193
-
194
- AsyncFunction("toggleScreenShareTrackEncoding") { (encoding: String) in
195
- try rnFishjamClient.toggleScreenShareTrackEncoding(encoding: encoding)
196
- }
197
-
198
- AsyncFunction("setScreenShareTrackBandwidth") { (bandwidth: Int) in
199
- try rnFishjamClient.setScreenShareTrackBandwidth(bandwidth: bandwidth)
200
- }
201
-
202
- AsyncFunction("setScreenShareTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
203
- try rnFishjamClient.setScreenShareTrackEncodingBandwidth(
204
- encoding: encoding, bandwidth: bandwidth)
205
- }
206
-
207
- AsyncFunction("setTargetTrackEncoding") { (trackId: String, encoding: String) in
208
- try rnFishjamClient.setTargetTrackEncoding(trackId: trackId, encoding: encoding)
209
- }
210
-
211
- AsyncFunction("toggleVideoTrackEncoding") { (encoding: String) in
212
- try rnFishjamClient.toggleVideoTrackEncoding(encoding: encoding)
213
- }
214
-
215
- AsyncFunction("setVideoTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
216
- try rnFishjamClient.setVideoTrackEncodingBandwidth(
217
- encoding: encoding, bandwidth: bandwidth)
218
- }
219
-
220
- AsyncFunction("setVideoTrackBandwidth") { (bandwidth: Int) in
221
- try rnFishjamClient.setVideoTrackBandwidth(bandwidth: bandwidth)
222
- }
223
-
224
- AsyncFunction("changeWebRTCLoggingSeverity") { (severity: String) in
225
- try rnFishjamClient.changeWebRTCLoggingSeverity(severity: severity)
226
- }
227
-
228
- AsyncFunction("getStatistics") {
229
- try await rnFishjamClient.getStatistics()
230
- }
231
-
232
- AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
233
- try rnFishjamClient.selectAudioSessionMode(sessionMode: sessionMode)
234
- }
235
-
236
- AsyncFunction("showAudioRoutePicker") {
237
- rnFishjamClient.showAudioRoutePicker()
238
- }
239
-
240
- AsyncFunction("startAudioSwitcher") {
241
- rnFishjamClient.startAudioSwitcher()
242
- }
243
-
244
- AsyncFunction("getCameraPermissionsAsync") { (promise: Promise) in
245
- EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
246
- self.appContext?.permissions,
247
- withRequester: CameraOnlyPermissionRequester.self,
248
- resolve: promise.resolver,
249
- reject: promise.legacyRejecter
250
- )
251
- }
252
-
253
- AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
254
- EXPermissionsMethodsDelegate.askForPermission(
255
- withPermissionsManager: self.appContext?.permissions,
256
- withRequester: CameraOnlyPermissionRequester.self,
257
- resolve: promise.resolver,
258
- reject: promise.legacyRejecter
259
- )
260
- }
261
-
262
- AsyncFunction("getMicrophonePermissionsAsync") { (promise: Promise) in
263
- EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
264
- self.appContext?.permissions,
265
- withRequester: CameraMicrophonePermissionRequester.self,
266
- resolve: promise.resolver,
267
- reject: promise.legacyRejecter
268
- )
269
- }
270
-
271
- AsyncFunction("requestMicrophonePermissionsAsync") { (promise: Promise) in
272
- EXPermissionsMethodsDelegate.askForPermission(
273
- withPermissionsManager: self.appContext?.permissions,
274
- withRequester: CameraMicrophonePermissionRequester.self,
275
- resolve: promise.resolver,
276
- reject: promise.legacyRejecter
277
- )
278
- }
279
-
280
- AsyncFunction("startCallKitSession") { (displayName: String, isVideo: Bool? ) in
281
- try rnFishjamClient.startCallKitSessionWith(displayName: displayName, isVideo: isVideo ?? true)
282
- }
283
-
284
- AsyncFunction("endCallKitSession") {
285
- rnFishjamClient.endCallKitSession()
286
- }
287
-
288
- }
289
- }
@@ -1,12 +0,0 @@
1
- import FishjamCloudClient
2
- import Foundation
3
-
4
- public class RNFishjamProxy {
5
- static public func add(customSource: CustomSource) async throws {
6
- try await RNFishjamClient.add(customSource: customSource)
7
- }
8
-
9
- static public func remove(customSource: CustomSource) {
10
- RNFishjamClient.remove(customSource: customSource)
11
- }
12
- }
@@ -1,16 +0,0 @@
1
- import AVFoundation
2
-
3
- class PermissionUtils {
4
- static func requestCameraPermission() async -> Bool { await requestAccessIfNeeded(for: .video) }
5
- static func requestMicrophonePermission() async -> Bool { await requestAccessIfNeeded(for: .audio) }
6
-
7
- private static func requestAccessIfNeeded(for mediaType: AVMediaType) async -> Bool {
8
- let status = AVCaptureDevice.authorizationStatus(for: mediaType)
9
-
10
- return if status == .notDetermined {
11
- await AVCaptureDevice.requestAccess(for: mediaType)
12
- } else {
13
- status == .authorized
14
- }
15
- }
16
- }
package/ios/Utils.swift DELETED
@@ -1,23 +0,0 @@
1
- import FishjamCloudClient
2
- import ReplayKit
3
- import os.log
4
-
5
- let log = OSLog(subsystem: "com.fishjamcloud.react-native-client", category: "ErrorHandling")
6
-
7
- #if os(iOS)
8
- @available(iOS 12, *)
9
- extension RPSystemBroadcastPickerView {
10
- public static func show(
11
- for preferredExtension: String? = nil, showsMicrophoneButton: Bool = false
12
- ) {
13
- let view = RPSystemBroadcastPickerView()
14
- view.preferredExtension = preferredExtension
15
- view.showsMicrophoneButton = showsMicrophoneButton
16
-
17
- let selector = NSSelectorFromString("buttonPressed:")
18
- if view.responds(to: selector) {
19
- view.perform(selector, with: nil)
20
- }
21
- }
22
- }
23
- #endif
@@ -1,54 +0,0 @@
1
- import ExpoModulesCore
2
- import FishjamCloudClient
3
- import os.log
4
-
5
- class VideoPreviewView: VideoRendererView, LocalCameraTrackChangedListener {
6
- private var localVideoTrack: LocalCameraTrack?
7
-
8
- private func trySetLocalCameraTrack() {
9
- DispatchQueue.main.async { [weak self] in
10
- guard let self else { return }
11
- guard let tracks = RNFishjamClient.fishjamClient?.getLocalEndpoint().tracks else {
12
- os_log(
13
- "Error moving VideoPreviewView: %{public}s", log: log, type: .error,
14
- String(describing: "No tracks available")
15
- )
16
- return
17
- }
18
-
19
- guard
20
- let localVideoTrack = tracks.first(where: { (key, track) in
21
- track is LocalCameraTrack
22
- })?.value as? LocalCameraTrack, localVideoTrack.id != trackId
23
- else { return }
24
-
25
- self.localVideoTrack = localVideoTrack
26
- trackId = localVideoTrack.id
27
- localVideoTrack.start()
28
- }
29
- }
30
-
31
- override func willMove(toSuperview newSuperview: UIView?) {
32
- if newSuperview == nil {
33
- RNFishjamClient.localCameraTracksChangedListenersManager.remove(self)
34
- localVideoTrack?.stop()
35
- } else {
36
- RNFishjamClient.localCameraTracksChangedListenersManager.add(self)
37
- trySetLocalCameraTrack()
38
- }
39
-
40
- super.willMove(toSuperview: newSuperview)
41
- }
42
-
43
- var captureDeviceId: String? = nil {
44
- didSet {
45
- guard let captureDeviceId else { return }
46
- localVideoTrack?.switchCamera(deviceId: captureDeviceId)
47
- }
48
- }
49
-
50
- func onLocalCameraTrackChanged() {
51
- guard localVideoTrack == nil else { return }
52
- trySetLocalCameraTrack()
53
- }
54
- }
@@ -1,21 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- public class VideoPreviewViewModule: Module {
4
- public func definition() -> ModuleDefinition {
5
- Name("VideoPreviewViewModule")
6
-
7
- View(VideoPreviewView.self) {
8
- Prop("captureDeviceId") { (view: VideoPreviewView, prop: String) in
9
- view.captureDeviceId = prop
10
- }
11
-
12
- Prop("mirrorVideo") { (view: VideoPreviewView, prop: Bool) in
13
- view.mirrorVideo = prop
14
- }
15
-
16
- Prop("videoLayout") { (view: VideoPreviewView, prop: String) in
17
- view.videoLayout = prop
18
- }
19
- }
20
- }
21
- }
@@ -1,98 +0,0 @@
1
- import Combine
2
- import ExpoModulesCore
3
- import FishjamCloudClient
4
-
5
- class VideoRendererView: ExpoView, TrackUpdateListener, VideoViewDelegate {
6
- let videoView: VideoView
7
-
8
- required init(appContext: AppContext? = nil) {
9
- videoView = VideoView()
10
- videoView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
11
- videoView.clipsToBounds = true
12
-
13
- super.init(appContext: appContext)
14
-
15
- videoView.delegate = self
16
- }
17
-
18
- override func willMove(toSuperview newSuperview: UIView?) {
19
- super.willMove(toSuperview: newSuperview)
20
-
21
- if newSuperview == nil {
22
- videoView.removeFromSuperview()
23
- RNFishjamClient.tracksUpdateListenersManager.remove(self)
24
- } else {
25
- addSubview(videoView)
26
- RNFishjamClient.tracksUpdateListenersManager.add(self)
27
- updateVideoTrack()
28
- }
29
- }
30
-
31
- override func layoutSubviews() {
32
- super.layoutSubviews()
33
- videoView.frame = bounds
34
- }
35
-
36
- func updateVideoTrack() {
37
- DispatchQueue.main.async { [weak self] in
38
- guard let self, self.superview != nil else { return }
39
- for endpoint in RNFishjamClient.getLocalAndRemoteEndpoints() {
40
- guard let track = endpoint.tracks[self.trackId] as? VideoTrack else { continue }
41
- if let track = track as? LocalCameraTrack {
42
- self.mirrorVideo = track.isFrontCamera
43
- }
44
- self.videoView.track = track
45
- return
46
- }
47
- }
48
- }
49
-
50
- func onTracksUpdate() {
51
- updateVideoTrack()
52
- }
53
-
54
- var trackId: String = "" {
55
- didSet {
56
- updateVideoTrack()
57
- }
58
- }
59
-
60
- var videoLayout: String = "FILL" {
61
- didSet {
62
- switch videoLayout {
63
- case "FIT":
64
- videoView.layout = .fit
65
- case "FILL":
66
- videoView.layout = .fill
67
- default:
68
- videoView.layout = .fill
69
- }
70
-
71
- }
72
- }
73
-
74
- var mirrorVideo: Bool = false {
75
- didSet {
76
- videoView.mirror = mirrorVideo
77
- }
78
- }
79
-
80
- var checkVisibilityTimeInterval: TimeInterval? {
81
- didSet {
82
- videoView.checkVisibilityTimeInterval = checkVisibilityTimeInterval
83
- }
84
- }
85
-
86
- func didChange(dimensions newDimensions: FishjamCloudClient.Dimensions) {
87
- DispatchQueue.main.async { [weak self] in
88
- guard let self else { return }
89
-
90
- let event = EmitableEvent.trackAspectRatioUpdated(
91
- trackId: trackId,
92
- aspectRatio: newDimensions.aspectRatio
93
- )
94
-
95
- RNFishjamClient.sendEvent?(event)
96
- }
97
- }
98
- }
@@ -1,23 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- public class VideoRendererViewModule: Module {
4
- public func definition() -> ModuleDefinition {
5
- Name("VideoRendererViewModule")
6
-
7
- View(VideoRendererView.self) {
8
- Events("onDimensionsChanged")
9
-
10
- Prop("trackId") { (view, trackId) in
11
- view.trackId = trackId
12
- }
13
-
14
- Prop("videoLayout") { (view, videoLayout) in
15
- view.videoLayout = videoLayout
16
- }
17
-
18
- Prop("skipRenderOutsideVisibleArea") { (view, skipRenderOutsideVisibleArea) in
19
- view.checkVisibilityTimeInterval = skipRenderOutsideVisibleArea ? 1 : nil
20
- }
21
- }
22
- }
23
- }
@@ -1,20 +0,0 @@
1
- import AVKit
2
- import FishjamCloudClient
3
-
4
- public typealias LocalCamera = [String: Any]
5
-
6
- extension AVCaptureDevice {
7
- func toLocalCamera() -> LocalCamera {
8
- let facingDirection =
9
- switch position {
10
- case .front: "front"
11
- case .back: "back"
12
- default: "unspecified"
13
- }
14
- return [
15
- "id": uniqueID,
16
- "name": localizedName,
17
- "facingDirection": facingDirection,
18
- ]
19
- }
20
- }
@@ -1,23 +0,0 @@
1
- import Foundation
2
-
3
- protocol LocalCameraTrackChangedListener: AnyObject {
4
- func onLocalCameraTrackChanged()
5
- }
6
-
7
- class LocalCameraTracksChangedListenersManager {
8
- private var listeners: [LocalCameraTrackChangedListener] = []
9
-
10
- func add(_ listener: LocalCameraTrackChangedListener) {
11
- listeners.append(listener)
12
- }
13
-
14
- func remove(_ listener: LocalCameraTrackChangedListener) {
15
- listeners.removeAll { $0 === listener }
16
- }
17
-
18
- func notifyListeners() {
19
- for listener in listeners {
20
- listener.onLocalCameraTrackChanged()
21
- }
22
- }
23
- }
@@ -1,21 +0,0 @@
1
- protocol TrackUpdateListener: AnyObject {
2
- func onTracksUpdate()
3
- }
4
-
5
- class TracksUpdateListenersManager {
6
- private var listeners: [TrackUpdateListener] = []
7
-
8
- func add(_ listener: TrackUpdateListener) {
9
- listeners.append(listener)
10
- }
11
-
12
- func remove(_ listener: TrackUpdateListener) {
13
- listeners.removeAll { $0 === listener }
14
- }
15
-
16
- func notifyListeners() {
17
- for listener in listeners {
18
- listener.onTracksUpdate()
19
- }
20
- }
21
- }
@@ -1,4 +0,0 @@
1
- {
2
- "main": "../build/livestream/index.js",
3
- "types": "../build/livestream/index.d.ts"
4
- }
@@ -1,50 +0,0 @@
1
- import FishjamCloudBroadcastClient
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}}.FishjamBroadcastSampleHandler", category: "Broadcaster")
11
-
12
- /// An example `SampleHandler` utilizing `BroadcastSampleSource` from `MembraneRTC` sending broadcast samples and necessary notification enabling device's screen share.
13
- class FishjamBroadcastSampleHandler: 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
- }