@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,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
|
-
}
|
package/ios/RNFishjamProxy.swift
DELETED
|
@@ -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
|
-
}
|
package/livestream/package.json
DELETED
|
@@ -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
|
-
}
|