@fishjam-cloud/react-native-client 0.24.0 → 0.25.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -15
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/overrides/RTCPeerConnection.d.ts +8 -0
- package/dist/overrides/RTCPeerConnection.d.ts.map +1 -0
- package/dist/overrides/RTCPeerConnection.js +16 -0
- package/dist/overrides/RTCView.d.ts +11 -0
- package/dist/overrides/RTCView.d.ts.map +1 -0
- package/dist/overrides/RTCView.js +21 -0
- package/dist/polyfills/local-storage.d.ts +10 -0
- package/dist/polyfills/local-storage.d.ts.map +1 -0
- package/dist/polyfills/local-storage.js +24 -0
- package/{build/hooks → dist}/useForegroundService.d.ts +10 -10
- package/dist/useForegroundService.d.ts.map +1 -0
- package/dist/useForegroundService.js +10 -0
- package/dist/webrtc-polyfill.d.ts +2 -0
- package/dist/webrtc-polyfill.d.ts.map +1 -0
- package/dist/webrtc-polyfill.js +14 -0
- package/package.json +44 -92
- package/plugin/broadcastExtensionFiles/Atomic.swift +37 -0
- package/plugin/broadcastExtensionFiles/DarwinNotificationCenter.swift +29 -0
- package/plugin/broadcastExtensionFiles/Info.plist +1 -1
- package/plugin/broadcastExtensionFiles/SampleHandler.swift +104 -0
- package/plugin/broadcastExtensionFiles/SampleUploader.swift +146 -0
- package/plugin/broadcastExtensionFiles/SocketConnection.swift +198 -0
- package/plugin/build/types.d.ts +5 -4
- package/plugin/build/withFishjam.d.ts +31 -2
- package/plugin/build/withFishjam.js +31 -5
- package/plugin/build/withFishjamAndroid.d.ts +2 -2
- package/plugin/build/withFishjamAndroid.js +48 -40
- package/plugin/build/withFishjamIos.d.ts +3 -8
- package/plugin/build/withFishjamIos.js +52 -72
- package/plugin/src/types.ts +19 -0
- package/plugin/src/withFishjam.ts +42 -0
- package/plugin/src/withFishjamAndroid.ts +112 -0
- package/plugin/src/withFishjamIos.ts +336 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/LICENSE.txt +0 -201
- package/android/build.gradle +0 -95
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/io/fishjam/reactnative/AudioDeviceKind.kt +0 -34
- package/android/src/main/java/io/fishjam/reactnative/AudioSwitchManager.kt +0 -61
- package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +0 -126
- package/android/src/main/java/io/fishjam/reactnative/Errors.kt +0 -31
- package/android/src/main/java/io/fishjam/reactnative/PipContainerView.kt +0 -282
- package/android/src/main/java/io/fishjam/reactnative/PipContainerViewModule.kt +0 -41
- package/android/src/main/java/io/fishjam/reactnative/PipTrackSelector.kt +0 -98
- package/android/src/main/java/io/fishjam/reactnative/PipViewFactory.kt +0 -186
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +0 -1001
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +0 -358
- package/android/src/main/java/io/fishjam/reactnative/Utils.kt +0 -11
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewView.kt +0 -40
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewViewModule.kt +0 -22
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererView.kt +0 -76
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererViewModule.kt +0 -33
- package/android/src/main/java/io/fishjam/reactnative/VideoView.kt +0 -257
- package/android/src/main/java/io/fishjam/reactnative/extensions/CaptureDevice.kt +0 -17
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/FishjamForegroundService.kt +0 -101
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceManager.kt +0 -118
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceState.kt +0 -46
- package/android/src/main/java/io/fishjam/reactnative/helpers/PictureInPictureHelperFragment.kt +0 -20
- package/android/src/main/java/io/fishjam/reactnative/managers/ListenerManager.kt +0 -24
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalCameraTracksChangedListenersManager.kt +0 -8
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalTracksSwitchListenersManager.kt +0 -17
- package/android/src/main/java/io/fishjam/reactnative/managers/TracksUpdateListenersManager.kt +0 -7
- package/android/src/main/java/io/fishjam/reactnative/utils/PermissionUtils.kt +0 -45
- package/build/RNFishjamClientModule.d.ts +0 -106
- package/build/RNFishjamClientModule.d.ts.map +0 -1
- package/build/RNFishjamClientModule.js +0 -21
- package/build/RNFishjamClientModule.js.map +0 -1
- package/build/common/metadata.d.ts +0 -9
- package/build/common/metadata.d.ts.map +0 -1
- package/build/common/metadata.js +0 -11
- package/build/common/metadata.js.map +0 -1
- package/build/components/FishjamRoom/GridTrackItem.d.ts +0 -12
- package/build/components/FishjamRoom/GridTrackItem.d.ts.map +0 -1
- package/build/components/FishjamRoom/GridTrackItem.js +0 -56
- package/build/components/FishjamRoom/GridTrackItem.js.map +0 -1
- package/build/components/FishjamRoom/VideosGrid.d.ts +0 -3
- package/build/components/FishjamRoom/VideosGrid.d.ts.map +0 -1
- package/build/components/FishjamRoom/VideosGrid.js +0 -20
- package/build/components/FishjamRoom/VideosGrid.js.map +0 -1
- package/build/components/FishjamRoom/index.d.ts +0 -33
- package/build/components/FishjamRoom/index.d.ts.map +0 -1
- package/build/components/FishjamRoom/index.js +0 -52
- package/build/components/FishjamRoom/index.js.map +0 -1
- package/build/components/FishjamRoom/parsePeersToTracks.d.ts +0 -4
- package/build/components/FishjamRoom/parsePeersToTracks.d.ts.map +0 -1
- package/build/components/FishjamRoom/parsePeersToTracks.js +0 -37
- package/build/components/FishjamRoom/parsePeersToTracks.js.map +0 -1
- package/build/components/PipContainerView.d.ts +0 -48
- package/build/components/PipContainerView.d.ts.map +0 -1
- package/build/components/PipContainerView.js +0 -34
- package/build/components/PipContainerView.js.map +0 -1
- package/build/components/VideoPreviewView.d.ts +0 -28
- package/build/components/VideoPreviewView.d.ts.map +0 -1
- package/build/components/VideoPreviewView.js +0 -17
- package/build/components/VideoPreviewView.js.map +0 -1
- package/build/components/VideoRendererView.d.ts +0 -39
- package/build/components/VideoRendererView.d.ts.map +0 -1
- package/build/components/VideoRendererView.js +0 -25
- package/build/components/VideoRendererView.js.map +0 -1
- package/build/consts/index.d.ts +0 -5
- package/build/consts/index.d.ts.map +0 -1
- package/build/consts/index.js +0 -8
- package/build/consts/index.js.map +0 -1
- package/build/debug/common/webRTC.d.ts +0 -9
- package/build/debug/common/webRTC.d.ts.map +0 -1
- package/build/debug/common/webRTC.js +0 -11
- package/build/debug/common/webRTC.js.map +0 -1
- package/build/debug/index.d.ts +0 -4
- package/build/debug/index.d.ts.map +0 -1
- package/build/debug/index.js +0 -3
- package/build/debug/index.js.map +0 -1
- package/build/debug/stats/types.d.ts +0 -55
- package/build/debug/stats/types.d.ts.map +0 -1
- package/build/debug/stats/types.js +0 -2
- package/build/debug/stats/types.js.map +0 -1
- package/build/debug/stats/useRTCStatistics.d.ts +0 -9
- package/build/debug/stats/useRTCStatistics.d.ts.map +0 -1
- package/build/debug/stats/useRTCStatistics.js +0 -79
- package/build/debug/stats/useRTCStatistics.js.map +0 -1
- package/build/hooks/internal/useFishjamEvent.d.ts +0 -4
- package/build/hooks/internal/useFishjamEvent.d.ts.map +0 -1
- package/build/hooks/internal/useFishjamEvent.js +0 -38
- package/build/hooks/internal/useFishjamEvent.js.map +0 -1
- package/build/hooks/internal/useFishjamEventState.d.ts +0 -3
- package/build/hooks/internal/useFishjamEventState.d.ts.map +0 -1
- package/build/hooks/internal/useFishjamEventState.js +0 -18
- package/build/hooks/internal/useFishjamEventState.js.map +0 -1
- package/build/hooks/useAppScreenShare.d.ts +0 -18
- package/build/hooks/useAppScreenShare.d.ts.map +0 -1
- package/build/hooks/useAppScreenShare.js +0 -46
- package/build/hooks/useAppScreenShare.js.map +0 -1
- package/build/hooks/useAudioSettings.d.ts +0 -49
- package/build/hooks/useAudioSettings.d.ts.map +0 -1
- package/build/hooks/useAudioSettings.js +0 -70
- package/build/hooks/useAudioSettings.js.map +0 -1
- package/build/hooks/useBandwidthEstimation.d.ts +0 -14
- package/build/hooks/useBandwidthEstimation.d.ts.map +0 -1
- package/build/hooks/useBandwidthEstimation.js +0 -19
- package/build/hooks/useBandwidthEstimation.js.map +0 -1
- package/build/hooks/useCallKit.d.ts +0 -121
- package/build/hooks/useCallKit.d.ts.map +0 -1
- package/build/hooks/useCallKit.js +0 -142
- package/build/hooks/useCallKit.js.map +0 -1
- package/build/hooks/useCamera.d.ts +0 -113
- package/build/hooks/useCamera.d.ts.map +0 -1
- package/build/hooks/useCamera.js +0 -93
- package/build/hooks/useCamera.js.map +0 -1
- package/build/hooks/useConnection.d.ts +0 -73
- package/build/hooks/useConnection.d.ts.map +0 -1
- package/build/hooks/useConnection.js +0 -46
- package/build/hooks/useConnection.js.map +0 -1
- package/build/hooks/useForegroundService.d.ts.map +0 -1
- package/build/hooks/useForegroundService.js +0 -66
- package/build/hooks/useForegroundService.js.map +0 -1
- package/build/hooks/useMicrophone.d.ts +0 -16
- package/build/hooks/useMicrophone.d.ts.map +0 -1
- package/build/hooks/useMicrophone.js +0 -31
- package/build/hooks/useMicrophone.js.map +0 -1
- package/build/hooks/usePeerStatus.d.ts +0 -10
- package/build/hooks/usePeerStatus.d.ts.map +0 -1
- package/build/hooks/usePeerStatus.js +0 -13
- package/build/hooks/usePeerStatus.js.map +0 -1
- package/build/hooks/usePeers.d.ts +0 -98
- package/build/hooks/usePeers.d.ts.map +0 -1
- package/build/hooks/usePeers.js +0 -81
- package/build/hooks/usePeers.js.map +0 -1
- package/build/hooks/usePermissions.d.ts +0 -24
- package/build/hooks/usePermissions.d.ts.map +0 -1
- package/build/hooks/usePermissions.js +0 -61
- package/build/hooks/usePermissions.js.map +0 -1
- package/build/hooks/useReconnection.d.ts +0 -11
- package/build/hooks/useReconnection.d.ts.map +0 -1
- package/build/hooks/useReconnection.js +0 -14
- package/build/hooks/useReconnection.js.map +0 -1
- package/build/hooks/useSandbox.d.ts +0 -20
- package/build/hooks/useSandbox.d.ts.map +0 -1
- package/build/hooks/useSandbox.js +0 -54
- package/build/hooks/useSandbox.js.map +0 -1
- package/build/hooks/useScreenShare.d.ts +0 -36
- package/build/hooks/useScreenShare.d.ts.map +0 -1
- package/build/hooks/useScreenShare.js +0 -45
- package/build/hooks/useScreenShare.js.map +0 -1
- package/build/hooks/useUpdatePeerMetadata.d.ts +0 -15
- package/build/hooks/useUpdatePeerMetadata.d.ts.map +0 -1
- package/build/hooks/useUpdatePeerMetadata.js +0 -21
- package/build/hooks/useUpdatePeerMetadata.js.map +0 -1
- package/build/index.d.ts +0 -36
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -30
- package/build/index.js.map +0 -1
- package/build/livestream/components/LivestreamStreamer.d.ts +0 -24
- package/build/livestream/components/LivestreamStreamer.d.ts.map +0 -1
- package/build/livestream/components/LivestreamStreamer.js +0 -12
- package/build/livestream/components/LivestreamStreamer.js.map +0 -1
- package/build/livestream/components/LivestreamViewer.d.ts +0 -46
- package/build/livestream/components/LivestreamViewer.d.ts.map +0 -1
- package/build/livestream/components/LivestreamViewer.js +0 -10
- package/build/livestream/components/LivestreamViewer.js.map +0 -1
- package/build/livestream/hooks/useLivestreamScreenSharingStreamer.d.ts +0 -49
- package/build/livestream/hooks/useLivestreamScreenSharingStreamer.d.ts.map +0 -1
- package/build/livestream/hooks/useLivestreamScreenSharingStreamer.js +0 -58
- package/build/livestream/hooks/useLivestreamScreenSharingStreamer.js.map +0 -1
- package/build/livestream/hooks/useLivestreamStreamer.d.ts +0 -65
- package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +0 -1
- package/build/livestream/hooks/useLivestreamStreamer.js +0 -71
- package/build/livestream/hooks/useLivestreamStreamer.js.map +0 -1
- package/build/livestream/hooks/useLivestreamViewer.d.ts +0 -36
- package/build/livestream/hooks/useLivestreamViewer.d.ts.map +0 -1
- package/build/livestream/hooks/useLivestreamViewer.js +0 -73
- package/build/livestream/hooks/useLivestreamViewer.js.map +0 -1
- package/build/livestream/index.d.ts +0 -12
- package/build/livestream/index.d.ts.map +0 -1
- package/build/livestream/index.js +0 -7
- package/build/livestream/index.js.map +0 -1
- package/build/protos/fishjam/peer_notifications.d.ts +0 -63
- package/build/protos/fishjam/peer_notifications.d.ts.map +0 -1
- package/build/protos/fishjam/peer_notifications.js +0 -235
- package/build/protos/fishjam/peer_notifications.js.map +0 -1
- package/build/types.d.ts +0 -34
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -2
- package/build/types.js.map +0 -1
- package/build/utils/config.d.ts +0 -6
- package/build/utils/config.d.ts.map +0 -1
- package/build/utils/config.js +0 -10
- package/build/utils/config.js.map +0 -1
- package/build/utils/errorListener.d.ts +0 -2
- package/build/utils/errorListener.d.ts.map +0 -1
- package/build/utils/errorListener.js +0 -15
- package/build/utils/errorListener.js.map +0 -1
- package/build/utils/eventPayloadValidator.d.ts +0 -3
- package/build/utils/eventPayloadValidator.d.ts.map +0 -1
- package/build/utils/eventPayloadValidator.js +0 -86
- package/build/utils/eventPayloadValidator.js.map +0 -1
- package/build/utils/getFishjamUrl.d.ts +0 -2
- package/build/utils/getFishjamUrl.d.ts.map +0 -1
- package/build/utils/getFishjamUrl.js +0 -10
- package/build/utils/getFishjamUrl.js.map +0 -1
- package/debug/package.json +0 -4
- package/expo-module.config.json +0 -19
- package/ios/CameraPermissionsRequester.swift +0 -117
- package/ios/Events.swift +0 -152
- package/ios/PictureInPictureManager.swift +0 -215
- package/ios/PipContainerView.swift +0 -56
- package/ios/PipContainerViewModule.swift +0 -48
- package/ios/RNFishjamClient.podspec +0 -30
- package/ios/RNFishjamClient.swift +0 -995
- package/ios/RNFishjamClientModule.swift +0 -289
- package/ios/RNFishjamProxy.swift +0 -12
- package/ios/Utils/PermissionUtils.swift +0 -16
- package/ios/Utils.swift +0 -23
- package/ios/VideoPreviewView.swift +0 -54
- package/ios/VideoPreviewViewModule.swift +0 -21
- package/ios/VideoRendererView.swift +0 -98
- package/ios/VideoRendererViewModule.swift +0 -23
- package/ios/extensions/AVCaptureDevice.swift +0 -20
- package/ios/managers/LocalCameraTracksChangedListenersManager.swift +0 -23
- package/ios/managers/TracksUpdateListenersManager.swift +0 -21
- package/livestream/package.json +0 -4
- package/plugin/broadcastExtensionFiles/FishjamBroadcastSampleHandler.swift +0 -50
- /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
|