@fishjam-cloud/react-native-client 0.21.0 → 0.22.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.
Files changed (77) hide show
  1. package/build/RNFishjamClientModule.d.ts +9 -4
  2. package/build/RNFishjamClientModule.d.ts.map +1 -1
  3. package/build/RNFishjamClientModule.js +1 -0
  4. package/build/RNFishjamClientModule.js.map +1 -1
  5. package/build/components/FishjamRoom/index.d.ts +6 -6
  6. package/build/components/FishjamRoom/index.d.ts.map +1 -1
  7. package/build/components/FishjamRoom/index.js +8 -10
  8. package/build/components/FishjamRoom/index.js.map +1 -1
  9. package/build/hooks/internal/useFishjamEvent.d.ts.map +1 -1
  10. package/build/hooks/internal/useFishjamEvent.js +3 -0
  11. package/build/hooks/internal/useFishjamEvent.js.map +1 -1
  12. package/build/hooks/useCallKit.d.ts +121 -0
  13. package/build/hooks/useCallKit.d.ts.map +1 -0
  14. package/build/hooks/useCallKit.js +142 -0
  15. package/build/hooks/useCallKit.js.map +1 -0
  16. package/build/hooks/useConnection.d.ts +20 -16
  17. package/build/hooks/useConnection.d.ts.map +1 -1
  18. package/build/hooks/useConnection.js +10 -11
  19. package/build/hooks/useConnection.js.map +1 -1
  20. package/build/hooks/useSandbox.d.ts +3 -3
  21. package/build/hooks/useSandbox.d.ts.map +1 -1
  22. package/build/hooks/useSandbox.js +3 -5
  23. package/build/hooks/useSandbox.js.map +1 -1
  24. package/build/index.d.ts +4 -17
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js +3 -10
  27. package/build/index.js.map +1 -1
  28. package/build/livestream/components/LivestreamStreamer.d.ts.map +1 -0
  29. package/build/livestream/components/LivestreamStreamer.js.map +1 -0
  30. package/build/livestream/components/LivestreamViewer.d.ts.map +1 -0
  31. package/build/livestream/components/LivestreamViewer.js.map +1 -0
  32. package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +1 -0
  33. package/build/{hooks → livestream/hooks}/useLivestreamStreamer.js +1 -1
  34. package/build/livestream/hooks/useLivestreamStreamer.js.map +1 -0
  35. package/build/livestream/hooks/useLivestreamViewer.d.ts.map +1 -0
  36. package/build/{hooks → livestream/hooks}/useLivestreamViewer.js +1 -1
  37. package/build/livestream/hooks/useLivestreamViewer.js.map +1 -0
  38. package/build/livestream/index.d.ts +11 -0
  39. package/build/livestream/index.d.ts.map +1 -0
  40. package/build/livestream/index.js +6 -0
  41. package/build/livestream/index.js.map +1 -0
  42. package/build/utils/config.d.ts +6 -0
  43. package/build/utils/config.d.ts.map +1 -0
  44. package/build/utils/config.js +10 -0
  45. package/build/utils/config.js.map +1 -0
  46. package/build/utils/eventPayloadValidator.d.ts.map +1 -1
  47. package/build/utils/eventPayloadValidator.js +17 -1
  48. package/build/utils/eventPayloadValidator.js.map +1 -1
  49. package/build/utils/getFishjamUrl.d.ts +2 -0
  50. package/build/utils/getFishjamUrl.d.ts.map +1 -0
  51. package/build/utils/getFishjamUrl.js +10 -0
  52. package/build/utils/getFishjamUrl.js.map +1 -0
  53. package/ios/Events.swift +26 -0
  54. package/ios/RNFishjamClient.swift +40 -4
  55. package/ios/RNFishjamClientModule.swift +221 -211
  56. package/livestream/package.json +4 -0
  57. package/package.json +2 -1
  58. package/plugin/build/types.d.ts +1 -0
  59. package/plugin/build/withFishjamIos.js +12 -0
  60. package/build/common/client.d.ts +0 -25
  61. package/build/common/client.d.ts.map +0 -1
  62. package/build/common/client.js +0 -14
  63. package/build/common/client.js.map +0 -1
  64. package/build/components/LivestreamStreamer.d.ts.map +0 -1
  65. package/build/components/LivestreamStreamer.js.map +0 -1
  66. package/build/components/LivestreamViewer.d.ts.map +0 -1
  67. package/build/components/LivestreamViewer.js.map +0 -1
  68. package/build/hooks/useLivestreamStreamer.d.ts.map +0 -1
  69. package/build/hooks/useLivestreamStreamer.js.map +0 -1
  70. package/build/hooks/useLivestreamViewer.d.ts.map +0 -1
  71. package/build/hooks/useLivestreamViewer.js.map +0 -1
  72. /package/build/{components → livestream/components}/LivestreamStreamer.d.ts +0 -0
  73. /package/build/{components → livestream/components}/LivestreamStreamer.js +0 -0
  74. /package/build/{components → livestream/components}/LivestreamViewer.d.ts +0 -0
  75. /package/build/{components → livestream/components}/LivestreamViewer.js +0 -0
  76. /package/build/{hooks → livestream/hooks}/useLivestreamStreamer.d.ts +0 -0
  77. /package/build/{hooks → livestream/hooks}/useLivestreamViewer.d.ts +0 -0
@@ -7,6 +7,7 @@ import WebRTC
7
7
 
8
8
  class RNFishjamClient: FishjamClientListener {
9
9
  static var fishjamClient: FishjamClient? = nil
10
+ private var callKitManager: CallKitManager?
10
11
 
11
12
  var isMicrophoneOn = false
12
13
  var isCameraOn = false
@@ -430,6 +431,13 @@ class RNFishjamClient: FishjamClientListener {
430
431
  }
431
432
  return
432
433
  }
434
+
435
+ if RNFishjamClient.fishjamClient?.lastSdpAnswer?.detectedCodec != .h264 {
436
+ emit(event: .warning(
437
+ message: "Incompatible codec detected: \(RNFishjamClient.fishjamClient?.lastSdpAnswer?.detectedCodec?.rawValue ?? "Unknown"). Screen sharing requires H264, otherwise UploadBroadcastExtenstion will crash due to memory pressure (no hardware acceleration). " +
438
+ "Please configure your Fishjam room to use H264 codec for better screen sharing performance."
439
+ ))
440
+ }
433
441
 
434
442
  let simulcastConfig = try getSimulcastConfigFromOptions(simulcastConfig: screenShareOptions.simulcastConfig)
435
443
 
@@ -866,10 +874,8 @@ class RNFishjamClient: FishjamClientListener {
866
874
  peerStatus = .idle
867
875
  }
868
876
 
869
- func onSocketError() {
870
- if let connectPromise = connectPromise {
871
- connectPromise.reject("E_MEMBRANE_CONNECT", "Failed to connect: socket error")
872
- }
877
+ func onSocketError(_ errorMessage: String? = nil) {
878
+ connectPromise?.reject("E_MEMBRANE_CONNECT", "Failed to connect: socket error\(errorMessage.map { " - \($0)" } ?? "")")
873
879
  connectPromise = nil
874
880
  peerStatus = .error
875
881
  }
@@ -947,6 +953,36 @@ class RNFishjamClient: FishjamClientListener {
947
953
  static func remove(customSource: CustomSource) {
948
954
  fishjamClient?.remove(customSource: customSource)
949
955
  }
956
+
957
+ public func startCallKitSessionWith(displayName: String, isVideo: Bool) throws {
958
+ if callKitManager == nil {
959
+ callKitManager = CallKitManager()
960
+ callKitManager?.onCallStarted = { [weak self] in
961
+ self?.emit(event: .callKitActionPerformed(.started))
962
+ }
963
+ callKitManager?.onCallEnded = { [weak self] in
964
+ self?.emit(event: .callKitActionPerformed(.ended))
965
+ }
966
+ callKitManager?.onCallFailed = { [weak self] reason in
967
+ self?.emit(event: .callKitActionPerformed(.failed(reason)))
968
+ }
969
+ callKitManager?.onCallMuted = { [weak self] isMuted in
970
+ self?.emit(event: .callKitActionPerformed(.muted(isMuted)))
971
+ }
972
+ callKitManager?.onCallHeld = { [weak self] isOnHold in
973
+ self?.emit(event: .callKitActionPerformed(.held(isOnHold)))
974
+ }
975
+ }
976
+ try callKitManager?.startCallWith(displayName: displayName, isVideo: isVideo)
977
+ }
978
+
979
+ public func endCallKitSession() {
980
+ callKitManager?.endCall()
981
+ }
982
+
983
+ public var hasActiveCallKitSession: Bool {
984
+ return callKitManager?.hasActiveCall ?? false
985
+ }
950
986
  }
951
987
 
952
988
  extension RNFishjamClient: CameraCapturerDeviceChangedListener {
@@ -63,216 +63,226 @@ struct ConnectConfig: Record {
63
63
  typealias RNTrackBandwidthLimit = Either<Int, [String: Int]>
64
64
 
65
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
- )
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
+ Function("getPeers") {
125
+ return rnFishjamClient.getPeers()
126
+ }
127
+
128
+ AsyncFunction("joinRoom") {
129
+ (
130
+ url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
131
+ promise: Promise
132
+ ) in
133
+ rnFishjamClient.joinRoom(
134
+ url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
135
+ promise: promise)
136
+ }
137
+
138
+ AsyncFunction("leaveRoom") {
139
+ rnFishjamClient.leaveRoom()
140
+ }
141
+
142
+ AsyncFunction("startCamera") { (config: CameraConfig) in
143
+ try await rnFishjamClient.startCamera(config: config)
144
+ }
145
+
146
+ AsyncFunction("toggleMicrophone") {
147
+ try await rnFishjamClient.toggleMicrophone()
148
+ }
149
+
150
+ AsyncFunction("startMicrophone") {
151
+ try await rnFishjamClient.startMicrophone()
152
+ }
153
+
154
+ AsyncFunction("stopMicrophone") {
155
+ try rnFishjamClient.stopMicrophone()
156
+ }
157
+
158
+ AsyncFunction("toggleCamera") {
159
+ try rnFishjamClient.toggleCamera()
160
+ }
161
+
162
+ AsyncFunction("flipCamera") {
163
+ try rnFishjamClient.flipCamera()
164
+ }
165
+
166
+ AsyncFunction("switchCamera") { (cameraId: String) in
167
+ try rnFishjamClient.switchCamera(cameraId: cameraId)
168
+ }
169
+
170
+ AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
171
+ try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
172
+ }
173
+
174
+ AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
175
+ try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
176
+ }
177
+
178
+ AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
179
+ try rnFishjamClient.updatePeerMetadata(metadata: metadata)
180
+ }
181
+
182
+ AsyncFunction("updateVideoTrackMetadata") { (metadata: [String: Any]) in
183
+ try rnFishjamClient.updateLocalVideoTrackMetadata(metadata: metadata)
184
+ }
185
+
186
+ AsyncFunction("updateScreenShareTrackMetadata") { (metadata: [String: Any]) in
187
+ try rnFishjamClient.updateLocalScreenShareTrackMetadata(metadata: metadata)
188
+ }
189
+
190
+ AsyncFunction("toggleScreenShareTrackEncoding") { (encoding: String) in
191
+ try rnFishjamClient.toggleScreenShareTrackEncoding(encoding: encoding)
192
+ }
193
+
194
+ AsyncFunction("setScreenShareTrackBandwidth") { (bandwidth: Int) in
195
+ try rnFishjamClient.setScreenShareTrackBandwidth(bandwidth: bandwidth)
196
+ }
197
+
198
+ AsyncFunction("setScreenShareTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
199
+ try rnFishjamClient.setScreenShareTrackEncodingBandwidth(
200
+ encoding: encoding, bandwidth: bandwidth)
201
+ }
202
+
203
+ AsyncFunction("setTargetTrackEncoding") { (trackId: String, encoding: String) in
204
+ try rnFishjamClient.setTargetTrackEncoding(trackId: trackId, encoding: encoding)
205
+ }
206
+
207
+ AsyncFunction("toggleVideoTrackEncoding") { (encoding: String) in
208
+ try rnFishjamClient.toggleVideoTrackEncoding(encoding: encoding)
209
+ }
210
+
211
+ AsyncFunction("setVideoTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
212
+ try rnFishjamClient.setVideoTrackEncodingBandwidth(
213
+ encoding: encoding, bandwidth: bandwidth)
214
+ }
215
+
216
+ AsyncFunction("setVideoTrackBandwidth") { (bandwidth: Int) in
217
+ try rnFishjamClient.setVideoTrackBandwidth(bandwidth: bandwidth)
218
+ }
219
+
220
+ AsyncFunction("changeWebRTCLoggingSeverity") { (severity: String) in
221
+ try rnFishjamClient.changeWebRTCLoggingSeverity(severity: severity)
222
+ }
223
+
224
+ AsyncFunction("getStatistics") {
225
+ try await rnFishjamClient.getStatistics()
226
+ }
227
+
228
+ AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
229
+ try rnFishjamClient.selectAudioSessionMode(sessionMode: sessionMode)
230
+ }
231
+
232
+ AsyncFunction("showAudioRoutePicker") {
233
+ rnFishjamClient.showAudioRoutePicker()
234
+ }
235
+
236
+ AsyncFunction("startAudioSwitcher") {
237
+ rnFishjamClient.startAudioSwitcher()
238
+ }
239
+
240
+ AsyncFunction("getCameraPermissionsAsync") { (promise: Promise) in
241
+ EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
242
+ self.appContext?.permissions,
243
+ withRequester: CameraOnlyPermissionRequester.self,
244
+ resolve: promise.resolver,
245
+ reject: promise.legacyRejecter
246
+ )
247
+ }
248
+
249
+ AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
250
+ EXPermissionsMethodsDelegate.askForPermission(
251
+ withPermissionsManager: self.appContext?.permissions,
252
+ withRequester: CameraOnlyPermissionRequester.self,
253
+ resolve: promise.resolver,
254
+ reject: promise.legacyRejecter
255
+ )
256
+ }
257
+
258
+ AsyncFunction("getMicrophonePermissionsAsync") { (promise: Promise) in
259
+ EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
260
+ self.appContext?.permissions,
261
+ withRequester: CameraMicrophonePermissionRequester.self,
262
+ resolve: promise.resolver,
263
+ reject: promise.legacyRejecter
264
+ )
265
+ }
266
+
267
+ AsyncFunction("requestMicrophonePermissionsAsync") { (promise: Promise) in
268
+ EXPermissionsMethodsDelegate.askForPermission(
269
+ withPermissionsManager: self.appContext?.permissions,
270
+ withRequester: CameraMicrophonePermissionRequester.self,
271
+ resolve: promise.resolver,
272
+ reject: promise.legacyRejecter
273
+ )
274
+ }
275
+
276
+ AsyncFunction("startCallKitSession") { (displayName: String, isVideo: Bool? ) in
277
+ try rnFishjamClient.startCallKitSessionWith(displayName: displayName, isVideo: isVideo ?? true)
278
+ }
279
+
280
+ AsyncFunction("endCallKitSession") {
281
+ rnFishjamClient.endCallKitSession()
282
+ }
283
+
284
+ Property("hasActiveCallKitSession") {
285
+ return rnFishjamClient.hasActiveCallKitSession
86
286
  }
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
- Function("getPeers") {
125
- return rnFishjamClient.getPeers()
126
- }
127
-
128
- AsyncFunction("joinRoom") {
129
- (
130
- url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
131
- promise: Promise
132
- ) in
133
- rnFishjamClient.joinRoom(
134
- url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
135
- promise: promise)
136
- }
137
-
138
- AsyncFunction("leaveRoom") {
139
- rnFishjamClient.leaveRoom()
140
- }
141
-
142
- AsyncFunction("startCamera") { (config: CameraConfig) in
143
- try await rnFishjamClient.startCamera(config: config)
144
- }
145
-
146
- AsyncFunction("toggleMicrophone") {
147
- try await rnFishjamClient.toggleMicrophone()
148
- }
149
-
150
- AsyncFunction("startMicrophone") {
151
- try await rnFishjamClient.startMicrophone()
152
- }
153
-
154
- AsyncFunction("stopMicrophone") {
155
- try rnFishjamClient.stopMicrophone()
156
- }
157
-
158
- AsyncFunction("toggleCamera") {
159
- try rnFishjamClient.toggleCamera()
160
- }
161
-
162
- AsyncFunction("flipCamera") {
163
- try rnFishjamClient.flipCamera()
164
- }
165
-
166
- AsyncFunction("switchCamera") { (cameraId: String) in
167
- try rnFishjamClient.switchCamera(cameraId: cameraId)
168
- }
169
-
170
- AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
171
- try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
172
- }
173
-
174
- AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
175
- try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
176
- }
177
-
178
- AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
179
- try rnFishjamClient.updatePeerMetadata(metadata: metadata)
180
- }
181
-
182
- AsyncFunction("updateVideoTrackMetadata") { (metadata: [String: Any]) in
183
- try rnFishjamClient.updateLocalVideoTrackMetadata(metadata: metadata)
184
- }
185
-
186
- AsyncFunction("updateScreenShareTrackMetadata") { (metadata: [String: Any]) in
187
- try rnFishjamClient.updateLocalScreenShareTrackMetadata(metadata: metadata)
188
- }
189
-
190
- AsyncFunction("toggleScreenShareTrackEncoding") { (encoding: String) in
191
- try rnFishjamClient.toggleScreenShareTrackEncoding(encoding: encoding)
192
- }
193
-
194
- AsyncFunction("setScreenShareTrackBandwidth") { (bandwidth: Int) in
195
- try rnFishjamClient.setScreenShareTrackBandwidth(bandwidth: bandwidth)
196
- }
197
-
198
- AsyncFunction("setScreenShareTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
199
- try rnFishjamClient.setScreenShareTrackEncodingBandwidth(
200
- encoding: encoding, bandwidth: bandwidth)
201
- }
202
-
203
- AsyncFunction("setTargetTrackEncoding") { (trackId: String, encoding: String) in
204
- try rnFishjamClient.setTargetTrackEncoding(trackId: trackId, encoding: encoding)
205
- }
206
-
207
- AsyncFunction("toggleVideoTrackEncoding") { (encoding: String) in
208
- try rnFishjamClient.toggleVideoTrackEncoding(encoding: encoding)
209
- }
210
-
211
- AsyncFunction("setVideoTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
212
- try rnFishjamClient.setVideoTrackEncodingBandwidth(
213
- encoding: encoding, bandwidth: bandwidth)
214
- }
215
-
216
- AsyncFunction("setVideoTrackBandwidth") { (bandwidth: Int) in
217
- try rnFishjamClient.setVideoTrackBandwidth(bandwidth: bandwidth)
218
- }
219
-
220
- AsyncFunction("changeWebRTCLoggingSeverity") { (severity: String) in
221
- try rnFishjamClient.changeWebRTCLoggingSeverity(severity: severity)
222
- }
223
-
224
- AsyncFunction("getStatistics") {
225
- try await rnFishjamClient.getStatistics()
226
- }
227
-
228
- AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
229
- try rnFishjamClient.selectAudioSessionMode(sessionMode: sessionMode)
230
- }
231
-
232
- AsyncFunction("showAudioRoutePicker") {
233
- rnFishjamClient.showAudioRoutePicker()
234
- }
235
-
236
- AsyncFunction("startAudioSwitcher") {
237
- rnFishjamClient.startAudioSwitcher()
238
- }
239
-
240
- AsyncFunction("getCameraPermissionsAsync") { (promise: Promise) in
241
- EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
242
- self.appContext?.permissions,
243
- withRequester: CameraOnlyPermissionRequester.self,
244
- resolve: promise.resolver,
245
- reject: promise.legacyRejecter
246
- )
247
- }
248
-
249
- AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
250
- EXPermissionsMethodsDelegate.askForPermission(
251
- withPermissionsManager: self.appContext?.permissions,
252
- withRequester: CameraOnlyPermissionRequester.self,
253
- resolve: promise.resolver,
254
- reject: promise.legacyRejecter
255
- )
256
- }
257
-
258
- AsyncFunction("getMicrophonePermissionsAsync") { (promise: Promise) in
259
- EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
260
- self.appContext?.permissions,
261
- withRequester: CameraMicrophonePermissionRequester.self,
262
- resolve: promise.resolver,
263
- reject: promise.legacyRejecter
264
- )
265
- }
266
-
267
- AsyncFunction("requestMicrophonePermissionsAsync") { (promise: Promise) in
268
- EXPermissionsMethodsDelegate.askForPermission(
269
- withPermissionsManager: self.appContext?.permissions,
270
- withRequester: CameraMicrophonePermissionRequester.self,
271
- resolve: promise.resolver,
272
- reject: promise.legacyRejecter
273
- )
274
- }
275
-
276
287
  }
277
- }
278
-
288
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../build/livestream/index.js",
3
+ "types": "../build/livestream/index.d.ts"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/react-native-client",
3
- "version": "0.21.0",
3
+ "version": "0.22.1",
4
4
  "description": "A React Native client for Fishjam",
5
5
  "author": "Fishjam Team",
6
6
  "license": "Apache-2.0",
@@ -86,6 +86,7 @@
86
86
  "files": [
87
87
  "build/**",
88
88
  "debug",
89
+ "livestream",
89
90
  "android/build.gradle",
90
91
  "android/src/**",
91
92
  "ios/**/*.swift",
@@ -7,6 +7,7 @@ export type FishjamPluginOptions = {
7
7
  iphoneDeploymentTarget?: string;
8
8
  enableScreensharing?: boolean;
9
9
  supportsPictureInPicture?: boolean;
10
+ enableVoIPBackgroundMode?: boolean;
10
11
  appGroupContainerId?: string;
11
12
  mainTargetName?: string;
12
13
  broadcastExtensionTargetName?: string;
@@ -265,6 +265,17 @@ const withFishjamPictureInPicture = (config, props) => (0, config_plugins_1.with
265
265
  }
266
266
  return configuration;
267
267
  });
268
+ /**
269
+ * Adds iOS VoIP background mode to keep the app running during calls
270
+ */
271
+ const withFishjamVoIPBackgroundMode = (config, props) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
272
+ if (props?.ios?.enableVoIPBackgroundMode) {
273
+ const backgroundModes = new Set(configuration.modResults.UIBackgroundModes ?? []);
274
+ backgroundModes.add('voip');
275
+ configuration.modResults.UIBackgroundModes = Array.from(backgroundModes);
276
+ }
277
+ return configuration;
278
+ });
268
279
  /**
269
280
  * Applies screen sharing plugin if enabled. In order for screensharing to work, we need to copy extension files to your iOS project.
270
281
  * Allows for dynamically changing deploymentTarget.
@@ -281,6 +292,7 @@ const withFishjamIos = (config, props) => {
281
292
  return configuration;
282
293
  });
283
294
  config = withFishjamPictureInPicture(config, props);
295
+ config = withFishjamVoIPBackgroundMode(config, props);
284
296
  return config;
285
297
  };
286
298
  exports.default = withFishjamIos;
@@ -1,25 +0,0 @@
1
- import { GenericMetadata } from '../types';
2
- export type ConnectionConfig = {
3
- /**
4
- * Configuration for automatic reconnection
5
- * sdk uses a linear backoff algorithm, that is the formula
6
- * for the delay of the nth attempt is
7
- * n * delayMs + initialDelayMs
8
- *
9
- * Pass 0 for maxAttempts to disable automatic reconnection
10
- */
11
- reconnectConfig?: {
12
- maxAttempts?: number;
13
- initialDelayMs?: number;
14
- delayMs?: number;
15
- };
16
- };
17
- /**
18
- * @ignore
19
- */
20
- export declare function joinRoom<PeerMetadata extends GenericMetadata = GenericMetadata>(url: string, peerToken: string, peerMetadata?: PeerMetadata, config?: ConnectionConfig): Promise<void>;
21
- /**
22
- * @ignore
23
- */
24
- export declare function leaveRoom(): Promise<void>;
25
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,YAAY,SAAS,eAAe,GAAG,eAAe,EAEtD,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,YAAY,EAC3B,MAAM,CAAC,EAAE,gBAAgB,iBAQ1B;AACD;;GAEG;AACH,wBAAsB,SAAS,kBAE9B"}
@@ -1,14 +0,0 @@
1
- import RNFishjamClientModule from '../RNFishjamClientModule';
2
- /**
3
- * @ignore
4
- */
5
- export async function joinRoom(url, peerToken, peerMetadata, config) {
6
- await RNFishjamClientModule.joinRoom(url, peerToken, peerMetadata ?? {}, config ?? {});
7
- }
8
- /**
9
- * @ignore
10
- */
11
- export async function leaveRoom() {
12
- await RNFishjamClientModule.leaveRoom();
13
- }
14
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAkB7D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,GAAW,EACX,SAAiB,EACjB,YAA2B,EAC3B,MAAyB;IAEzB,MAAM,qBAAqB,CAAC,QAAQ,CAClC,GAAG,EACH,SAAS,EACT,YAAY,IAAI,EAAE,EAClB,MAAM,IAAI,EAAE,CACb,CAAC;AACJ,CAAC;AACD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,qBAAqB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { GenericMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\nexport type ConnectionConfig = {\n /**\n * Configuration for automatic reconnection\n * sdk uses a linear backoff algorithm, that is the formula\n * for the delay of the nth attempt is\n * n * delayMs + initialDelayMs\n *\n * Pass 0 for maxAttempts to disable automatic reconnection\n */\n reconnectConfig?: {\n maxAttempts?: number;\n initialDelayMs?: number;\n delayMs?: number;\n };\n};\n\n/**\n * @ignore\n */\nexport async function joinRoom<\n PeerMetadata extends GenericMetadata = GenericMetadata,\n>(\n url: string,\n peerToken: string,\n peerMetadata?: PeerMetadata,\n config?: ConnectionConfig,\n) {\n await RNFishjamClientModule.joinRoom(\n url,\n peerToken,\n peerMetadata ?? {},\n config ?? {},\n );\n}\n/**\n * @ignore\n */\nexport async function leaveRoom() {\n await RNFishjamClientModule.leaveRoom();\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivestreamStreamer.d.ts","sourceRoot":"","sources":["../../src/components/LivestreamStreamer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,MAAM,EAEN,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,UAAU,EAEX,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC9C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAE9C;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,4HAShC,uBAAuB,gCAgCzB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivestreamStreamer.js","sourceRoot":"","sources":["../../src/components/LivestreamStreamer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAEL,OAAO,EAIP,UAAU,EACV,cAAc,GACf,MAAM,wBAAwB,CAAC;AA4ChC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACI,EAAE,EAAE;IAC5B,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,OAAO,GAAG,IAAI,UAAU,CACjC;YACE,YAAY;YACZ,YAAY;YACZ,eAAe;YACf,aAAa,EAAE,MAAM,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;SAC3C,EACD,oBAAoB,EACpB,oBAAoB,CACrB,CAAC;QACF,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAE3C,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;YACjC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC9B,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,MAAM;QACN,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,oBAAoB;QACpB,oBAAoB;QACpB,aAAa;KACd,CAAC,CAAC;IAEH,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,KAAsB,CAAC,EAAG,CAAC;AAC3D,CAAC,CAAC","sourcesContent":["import { CSSProperties, useEffect, useRef } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport {\n Camera,\n cameras,\n SenderAudioCodecName,\n SenderVideoCodecName,\n VideoParameters,\n WhipClient,\n WhipClientView,\n} from 'react-native-whip-whep';\n\n/**\n * Props of the LivestreamView component\n */\nexport type LivestreamStreamerProps = {\n /**\n * Styles of the LivestreamView component\n */\n style?: StyleProp<ViewStyle>;\n /**\n * If video track should be enabled.\n */\n videoEnabled: boolean;\n /**\n * If audio track should be enabled.\n */\n audioEnabled: boolean;\n /**\n * Camera to use for the livestream.\n * Use {@link cameras} to get the list of supported cameras.\n */\n camera?: Camera;\n /**\n * Set video parameters for the camera\n */\n videoParameters?: VideoParameters;\n /**\n * Set the preferred video codecs for sending the video.\n * Use {@link WhipClient.getSupportedVideoCodecs} to get the list of supported video codecs.\n */\n preferredVideoCodecs?: SenderVideoCodecName[];\n /**\n * Set the preferred audio codecs for sending the audio.\n * Use {@link WhipClient.getSupportedAudioCodecs} to get the list of supported audio codecs.\n */\n preferredAudioCodecs?: SenderAudioCodecName[];\n\n /**\n * Reference to the WhipClient instance. Needs to be passed from the {@link useLivestreamStreamer} hook.\n */\n whipClientRef: React.RefObject<WhipClient | null>;\n};\n\n/**\n * Renders a video player playing the livestream set up with {@link useLivestreamStreamer} hook.\n *\n * @category Components\n * @param {object} props\n * @param {object} props.style\n */\nexport const LivestreamStreamer = ({\n style,\n whipClientRef,\n videoEnabled,\n audioEnabled,\n camera,\n videoParameters,\n preferredVideoCodecs,\n preferredAudioCodecs,\n}: LivestreamStreamerProps) => {\n const whipClient = useRef<WhipClient | null>(null);\n\n useEffect(() => {\n whipClient.current = new WhipClient(\n {\n audioEnabled,\n videoEnabled,\n videoParameters,\n videoDeviceId: camera?.id ?? cameras[0].id,\n },\n preferredVideoCodecs,\n preferredAudioCodecs,\n );\n whipClientRef.current = whipClient.current;\n\n return () => {\n whipClient.current?.disconnect();\n whipClient.current?.cleanup();\n whipClientRef.current = null;\n };\n }, [\n camera,\n videoParameters,\n videoEnabled,\n audioEnabled,\n preferredVideoCodecs,\n preferredAudioCodecs,\n whipClientRef,\n ]);\n\n return <WhipClientView style={style as CSSProperties} />;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivestreamViewer.d.ts","sourceRoot":"","sources":["../../src/components/LivestreamViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,8EAQ9B,qBAAqB,gCASvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivestreamViewer.js","sourceRoot":"","sources":["../../src/components/LivestreamViewer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAC;AA4C3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,GAAG,GACmB,EAAE,EAAE,CAAC,CAC3B,CAAC,cAAc,CACb,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,KAAK,CAAC,CAAC,KAAsB,CAAC,CAC9B,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,EACjB,CACH,CAAC","sourcesContent":["import { CSSProperties, Ref } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { WhepClientView, WhepClientViewRef } from 'react-native-whip-whep';\n\nexport type LivestreamViewerRef = WhepClientViewRef;\n\n/**\n * Props of the LivestreamView component\n */\nexport type LivestreamViewerProps = {\n /**\n * Styles of the LivestreamView component\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Used to override the orientation of the video (from metadata).\n * Defaults to \"portrait\".\n */\n orientation?: 'landscape' | 'portrait';\n /**\n * A variable deciding whether the Picture-in-Picture is enabled.\n * Defaults to true.\n */\n pipEnabled?: boolean;\n /**\n * A variable deciding whether the Picture-in-Picture mode should be started automatically after the app is backgrounded.\n * Defaults to false.\n */\n autoStartPip?: boolean;\n /**\n * A variable deciding whether the Picture-in-Picture mode should be stopped automatically on iOS after the app is foregrounded.\n * Always enabled on Android as PiP is not supported in foreground.\n * Defaults to false.\n */\n autoStopPip?: boolean;\n /**\n * A variable deciding the size of the Picture-in-Picture mode.\n */\n pipSize?: {\n width: number;\n height: number;\n };\n\n ref?: Ref<LivestreamViewerRef>;\n};\n\n/**\n * Renders a video player playing the livestream set up with {@link useLivestreamViewer} hook.\n *\n * @category Components\n * @param {object} props\n * @param {object} props.style\n */\nexport const LivestreamViewer = ({\n style,\n orientation,\n pipEnabled,\n autoStartPip,\n autoStopPip,\n pipSize,\n ref,\n}: LivestreamViewerProps) => (\n <WhepClientView\n ref={ref}\n style={style as CSSProperties}\n pipEnabled={pipEnabled}\n autoStartPip={autoStartPip}\n autoStopPip={autoStopPip}\n pipSize={pipSize}\n />\n);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLivestreamStreamer.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestreamStreamer.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAG5E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,qFAAqF;IACrF,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,iEAAiE;IACjE,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BAwBxC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLivestreamStreamer.js","sourceRoot":"","sources":["../../src/hooks/useLivestreamStreamer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAc,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAuB7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAgC,EAAE;IACrE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,KAAK,WAAW,CAAC;IAE1C,MAAM,aAAa,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,KAAa,EAAE,WAAoB,EAAE,EAAE;QACxE,MAAM,WAAW,GAAG,WAAW,IAAI,gBAAgB,CAAC;QACpD,MAAM,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC;YACnC,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,WAAW;SACvB,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxC,MAAM,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,OAAO;QACP,UAAU;QACV,WAAW;QACX,aAAa;KACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useCallback, useRef } from 'react';\nimport { useWhipConnectionState, WhipClient } from 'react-native-whip-whep';\nimport { FISHJAM_WHIP_URL } from '../consts';\n\n/**\n * @category Livestream\n */\nexport interface useLivestreamStreamerResult {\n /**\n * Callback used to start publishing the selected audio and video media streams.\n *\n * @remarks\n * Calling {@link connect} multiple times will have the effect of only publishing the **last** specified inputs.\n */\n connect: (token: string, urlOverride?: string) => Promise<void>;\n /** Callback to stop publishing anything previously published with {@link connect} */\n disconnect: () => Promise<void>;\n /** Utility flag which indicates the current connection status */\n isConnected: boolean;\n /**\n * Reference to the WhipClient instance. Needs to be passed to the {@link LivestreamStreamer} component.\n */\n whipClientRef: React.RefObject<WhipClient | null>;\n}\n\n/**\n * Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}\n * @category Livestream\n * @group Hooks\n */\nexport const useLivestreamStreamer = (): useLivestreamStreamerResult => {\n const state = useWhipConnectionState();\n const isConnected = state === 'connected';\n\n const whipClientRef = useRef<WhipClient | null>(null);\n\n const connect = useCallback(async (token: string, urlOverride?: string) => {\n const resolvedUrl = urlOverride ?? FISHJAM_WHIP_URL;\n await whipClientRef.current?.connect({\n authToken: token,\n serverUrl: resolvedUrl,\n });\n }, []);\n\n const disconnect = useCallback(async () => {\n await whipClientRef.current?.disconnect();\n }, []);\n\n return {\n connect,\n disconnect,\n isConnected,\n whipClientRef,\n };\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLivestreamViewer.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestreamViewer.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,mBAAmB,GAC3B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GACnC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAOxC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,4EAA4E;IAC5E,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,iEAAiE;IACjE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAO,yBAuCtC,CAAC"}