@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,215 +0,0 @@
1
- import AVKit
2
- import FishjamCloudClient
3
- import WebRTC
4
-
5
- @MainActor
6
- class PictureInPictureManager {
7
- private let sourceView: UIView
8
- private let eventEmitter: (EmitableEvent) -> Void
9
- private weak var fishjamClient: FishjamClient?
10
- private var lastActiveVadInfo: RemoteTrackInfo? = nil
11
-
12
- private var controller: PictureInPictureController?
13
-
14
- private var startAutomatically: Bool {
15
- didSet {
16
- controller?.startAutomatically = startAutomatically
17
- }
18
- }
19
-
20
- private var stopAutomatically: Bool {
21
- didSet {
22
- controller?.stopAutomatically = stopAutomatically
23
- }
24
- }
25
-
26
- var primaryPlaceholderText: String = "No camera" {
27
- didSet {
28
- controller?.primaryPlaceholderText = primaryPlaceholderText
29
- }
30
- }
31
-
32
- var secondaryPlaceholderText: String = "No active speaker" {
33
- didSet {
34
- controller?.secondaryPlaceholderText = secondaryPlaceholderText
35
- }
36
- }
37
-
38
- init(
39
- sourceView: UIView,
40
- eventEmitter: @escaping (EmitableEvent) -> Void,
41
- fishjamClient: FishjamClient?
42
- ) {
43
- self.sourceView = sourceView
44
- self.eventEmitter = eventEmitter
45
- self.fishjamClient = fishjamClient
46
- self.startAutomatically = true
47
- self.stopAutomatically = true
48
-
49
- RNFishjamClient.tracksUpdateListenersManager.add(self)
50
- }
51
-
52
- deinit {
53
- RNFishjamClient.tracksUpdateListenersManager.remove(self)
54
- }
55
-
56
- @discardableResult
57
- private func ensureController() -> PictureInPictureController? {
58
- if controller == nil {
59
- let newController = PictureInPictureController(
60
- sourceView: sourceView,
61
- primaryPlaceholder: primaryPlaceholderText,
62
- secondaryPlaceholder: secondaryPlaceholderText
63
- )
64
- newController.startAutomatically = startAutomatically
65
- newController.stopAutomatically = stopAutomatically
66
- controller = newController
67
-
68
- updateTracks()
69
- }
70
- return controller
71
- }
72
-
73
- private func findLocalCameraTrack() -> RTCVideoTrack? {
74
- guard let fishjamClient = fishjamClient else { return nil }
75
-
76
- let localEndpoint = fishjamClient.getLocalEndpoint()
77
-
78
- for (_, track) in localEndpoint.tracks {
79
- if let videoTrack = track as? LocalVideoTrack,
80
- track.metadata.toDict()["type"] as? String == "camera" {
81
- return videoTrack.mediaTrack as? RTCVideoTrack
82
- }
83
- }
84
-
85
- return nil
86
- }
87
-
88
- private func findRemoteVadActiveTrack() -> RemoteTrackInfo? {
89
- guard let fishjamClient else { return nil }
90
-
91
- let remoteEndpoints = fishjamClient.getRemoteEndpoints()
92
-
93
- // First pass: look for active VAD
94
- for endpoint in remoteEndpoints {
95
- // Check if this endpoint has an active VAD audio track
96
- let hasActiveVad = endpoint.tracks.values.contains { track in
97
- if let audioTrack = track as? RemoteAudioTrack {
98
- return audioTrack.vadStatus == .speech
99
- }
100
- return false
101
- }
102
-
103
- if hasActiveVad {
104
- let videoTrack = endpoint.tracks.values.first { track in
105
- track is RemoteVideoTrack
106
- } as? RemoteVideoTrack
107
- lastActiveVadInfo = trackToTrackInfo(videoTrack: videoTrack, endpoint: endpoint)
108
- return lastActiveVadInfo
109
- }
110
- }
111
- if lastActiveVadInfo != nil {
112
- return lastActiveVadInfo
113
- }
114
-
115
- // Fallback: return first available remote peer with video track
116
- for endpoint in remoteEndpoints {
117
- if let videoTrack = endpoint.tracks.values.first(where: { $0 is RemoteVideoTrack }) as? RemoteVideoTrack {
118
- return trackToTrackInfo(videoTrack: videoTrack, endpoint: endpoint)
119
- }
120
- }
121
-
122
- return nil
123
- }
124
-
125
- private func trackToTrackInfo(videoTrack: RemoteVideoTrack?, endpoint: Endpoint) -> RemoteTrackInfo {
126
- let metadataDict = endpoint.metadata.toDict()
127
- let peerMetadata = metadataDict["peer"] as? [String: String]
128
- let displayName = peerMetadata?["displayName"] ?? peerMetadata?["name"]
129
-
130
- var isVideoTrackActive: Bool? = nil
131
- if videoTrack?.metadata["active"] as? Bool == false { isVideoTrackActive = false }
132
- if videoTrack?.metadata["paused"] as? Bool == true { isVideoTrackActive = false }
133
-
134
- return RemoteTrackInfo(
135
- videoTrack: videoTrack?.mediaTrack as? RTCVideoTrack,
136
- displayName: displayName,
137
- hasVideoTrack: videoTrack != nil,
138
- isVideoActive: isVideoTrackActive ?? true
139
- )
140
- }
141
-
142
- private func updateTracks() {
143
- guard let pipController = controller else { return }
144
-
145
- let localCameraTrack = findLocalCameraTrack()
146
- let remoteTrackInfo = findRemoteVadActiveTrack()
147
-
148
- pipController.primaryVideoTrack = localCameraTrack
149
- pipController.updateSecondaryTrack(trackInfo: remoteTrackInfo)
150
- }
151
-
152
-
153
-
154
- private func emitWarning(_ message: String) {
155
- eventEmitter(.warning(message: message))
156
- }
157
-
158
-
159
- func start() {
160
- _ = ensureController()
161
- controller?.startPictureInPicture()
162
- }
163
-
164
- func stop() {
165
- controller?.stopPictureInPicture()
166
- lastActiveVadInfo = nil
167
- }
168
-
169
- func setAllowsCameraWhileInPictureInPicture(_ enabled: Bool) {
170
- guard let fishjamClient = fishjamClient else {
171
- emitWarning("PictureInPicture: Fishjam client not available")
172
- return
173
- }
174
-
175
- let localEndpoint = fishjamClient.getLocalEndpoint()
176
- guard let cameraTrack = localEndpoint.tracks.compactMap({ $0.value as? LocalCameraTrack }).first else {
177
- emitWarning("PictureInPicture: Unable to configure background camera - camera not initialized")
178
- return
179
- }
180
-
181
- guard cameraTrack.isMultitaskingCameraAccessSupported() else {
182
- emitWarning("PictureInPicture: Background camera is not supported on this device.")
183
- return
184
- }
185
-
186
- cameraTrack.setMultitaskingCameraAccessEnabled(enabled)
187
- }
188
-
189
- func setStartAutomatically(_ enabled: Bool) {
190
- if enabled {
191
- ensureController()
192
- }
193
- startAutomatically = enabled
194
- controller?.startAutomatically = enabled
195
- }
196
-
197
- func setStopAutomatically(_ enabled: Bool) {
198
- stopAutomatically = enabled
199
- controller?.stopAutomatically = enabled
200
- }
201
-
202
- func cleanup() {
203
- controller?.stopPictureInPicture()
204
- controller = nil
205
- lastActiveVadInfo = nil
206
- }
207
- }
208
-
209
- extension PictureInPictureManager: TrackUpdateListener {
210
- nonisolated func onTracksUpdate() {
211
- Task { @MainActor in
212
- updateTracks()
213
- }
214
- }
215
- }
@@ -1,56 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- @MainActor
4
- class PipContainerView: ExpoView {
5
- private var pipManager: PictureInPictureManager!
6
-
7
- required init(appContext: AppContext? = nil) {
8
- super.init(appContext: appContext)
9
- pipManager = PictureInPictureManager(
10
- sourceView: self,
11
- eventEmitter: { event in
12
- RNFishjamClient.sendEvent?(event)
13
- },
14
- fishjamClient: RNFishjamClient.fishjamClient
15
- )
16
- }
17
-
18
- var startAutomatically: Bool = true {
19
- didSet {
20
- pipManager.setStartAutomatically(startAutomatically)
21
- }
22
- }
23
-
24
- var stopAutomatically: Bool = true {
25
- didSet {
26
- pipManager.setStopAutomatically(stopAutomatically)
27
- }
28
- }
29
-
30
- var allowsCameraInBackground: Bool = false {
31
- didSet {
32
- pipManager.setAllowsCameraWhileInPictureInPicture(allowsCameraInBackground)
33
- }
34
- }
35
-
36
- var primaryPlaceholderText: String = "No camera" {
37
- didSet {
38
- pipManager.primaryPlaceholderText = primaryPlaceholderText
39
- }
40
- }
41
-
42
- var secondaryPlaceholderText: String = "No active speaker" {
43
- didSet {
44
- pipManager.secondaryPlaceholderText = secondaryPlaceholderText
45
- }
46
- }
47
-
48
- func startPictureInPicture() {
49
- pipManager.start()
50
- }
51
-
52
- func stopPictureInPicture() {
53
- pipManager.stop()
54
- }
55
- }
56
-
@@ -1,48 +0,0 @@
1
- import ExpoModulesCore
2
-
3
- public class PipContainerViewModule: Module {
4
- public func definition() -> ModuleDefinition {
5
- Name("PipContainerViewModule")
6
-
7
- View(PipContainerView.self) {
8
- Prop("startAutomatically") { (view: PipContainerView, value: Bool) in
9
- Task { @MainActor in
10
- view.startAutomatically = value
11
- }
12
- }
13
-
14
- Prop("stopAutomatically") { (view: PipContainerView, value: Bool) in
15
- Task { @MainActor in
16
- view.stopAutomatically = value
17
- }
18
- }
19
-
20
- Prop("allowsCameraInBackground") { (view: PipContainerView, value: Bool) in
21
- Task { @MainActor in
22
- view.allowsCameraInBackground = value
23
- }
24
- }
25
-
26
- Prop("primaryPlaceholderText") { (view: PipContainerView, value: String) in
27
- Task { @MainActor in
28
- view.primaryPlaceholderText = value
29
- }
30
- }
31
-
32
- Prop("secondaryPlaceholderText") { (view: PipContainerView, value: String) in
33
- Task { @MainActor in
34
- view.secondaryPlaceholderText = value
35
- }
36
- }
37
-
38
- AsyncFunction("startPictureInPicture") { (view: PipContainerView) in
39
- await view.startPictureInPicture()
40
- }
41
-
42
- AsyncFunction("stopPictureInPicture") { (view: PipContainerView) in
43
- await view.stopPictureInPicture()
44
- }
45
- }
46
- }
47
- }
48
-
@@ -1,30 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = 'RNFishjamClient'
7
- s.version = package['version']
8
- s.summary = package['description']
9
- s.description = package['description']
10
- s.license = package['license']
11
- s.author = package['author']
12
- s.homepage = package['homepage']
13
- s.platform = :ios, '15.1'
14
- s.swift_version = '5.4'
15
- s.source = { git: 'https://github.com/fishjam-cloud/mobile-client-sdk/tree/main/packages/react-native-client/ios' }
16
- s.static_framework = true
17
-
18
- s.dependency 'ExpoModulesCore'
19
-
20
- # Swift/Objective-C compatibility
21
- s.pod_target_xcconfig = {
22
- 'DEFINES_MODULE' => 'YES',
23
- 'SWIFT_COMPILATION_MODE' => 'wholemodule'
24
- }
25
-
26
- s.source_files = '**/*.{h,m,swift}'
27
-
28
- s.dependency 'FishjamCloudClient', package['version']
29
-
30
- end