@fishjam-cloud/react-native-client 0.20.0 → 0.21.0

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 (31) hide show
  1. package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +8 -0
  2. package/build/components/LivestreamStreamer.d.ts +33 -1
  3. package/build/components/LivestreamStreamer.d.ts.map +1 -1
  4. package/build/components/LivestreamStreamer.js +28 -2
  5. package/build/components/LivestreamStreamer.js.map +1 -1
  6. package/build/components/LivestreamViewer.d.ts.map +1 -1
  7. package/build/components/LivestreamViewer.js +1 -1
  8. package/build/components/LivestreamViewer.js.map +1 -1
  9. package/build/hooks/useAudioSettings.d.ts +7 -0
  10. package/build/hooks/useAudioSettings.d.ts.map +1 -1
  11. package/build/hooks/useAudioSettings.js.map +1 -1
  12. package/build/hooks/useLivestreamStreamer.d.ts +9 -5
  13. package/build/hooks/useLivestreamStreamer.d.ts.map +1 -1
  14. package/build/hooks/useLivestreamStreamer.js +17 -18
  15. package/build/hooks/useLivestreamStreamer.js.map +1 -1
  16. package/build/hooks/useLivestreamViewer.d.ts +3 -1
  17. package/build/hooks/useLivestreamViewer.d.ts.map +1 -1
  18. package/build/hooks/useLivestreamViewer.js +26 -12
  19. package/build/hooks/useLivestreamViewer.js.map +1 -1
  20. package/build/hooks/useSandbox.d.ts.map +1 -1
  21. package/build/hooks/useSandbox.js +7 -7
  22. package/build/hooks/useSandbox.js.map +1 -1
  23. package/build/index.d.ts +1 -1
  24. package/build/index.d.ts.map +1 -1
  25. package/build/index.js +1 -1
  26. package/build/index.js.map +1 -1
  27. package/ios/Events.swift +8 -1
  28. package/ios/RNFishjamClient.podspec +1 -1
  29. package/ios/RNFishjamClient.swift +7 -0
  30. package/ios/VideoPreviewView.swift +1 -0
  31. package/package.json +2 -2
@@ -298,6 +298,11 @@ class RNFishjamClient(
298
298
  config: ConnectConfig,
299
299
  promise: Promise
300
300
  ) {
301
+ if (connectPromise != null || peerStatus == PeerStatus.Connected) {
302
+ promise.reject(JoinError("Room already joined or it's connecting. You must call leaveRoom() before calling joinRoom() again."))
303
+ return
304
+ }
305
+
301
306
  peerStatus = PeerStatus.Connecting
302
307
  connectPromise = promise
303
308
  localUserMetadata = mapOf("server" to emptyMap(), "peer" to peerMetadata)
@@ -316,6 +321,9 @@ class RNFishjamClient(
316
321
  }
317
322
 
318
323
  fun leaveRoom() {
324
+ connectPromise?.reject(JoinError("leaveRoom called before connected"))
325
+ connectPromise = null
326
+
319
327
  if (isScreenShareOn) {
320
328
  stopScreenShare()
321
329
  }
@@ -1,4 +1,5 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
+ import { Camera, SenderAudioCodecName, SenderVideoCodecName, VideoParameters, WhipClient } from 'react-native-whip-whep';
2
3
  /**
3
4
  * Props of the LivestreamView component
4
5
  */
@@ -7,6 +8,37 @@ export type LivestreamStreamerProps = {
7
8
  * Styles of the LivestreamView component
8
9
  */
9
10
  style?: StyleProp<ViewStyle>;
11
+ /**
12
+ * If video track should be enabled.
13
+ */
14
+ videoEnabled: boolean;
15
+ /**
16
+ * If audio track should be enabled.
17
+ */
18
+ audioEnabled: boolean;
19
+ /**
20
+ * Camera to use for the livestream.
21
+ * Use {@link cameras} to get the list of supported cameras.
22
+ */
23
+ camera?: Camera;
24
+ /**
25
+ * Set video parameters for the camera
26
+ */
27
+ videoParameters?: VideoParameters;
28
+ /**
29
+ * Set the preferred video codecs for sending the video.
30
+ * Use {@link WhipClient.getSupportedVideoCodecs} to get the list of supported video codecs.
31
+ */
32
+ preferredVideoCodecs?: SenderVideoCodecName[];
33
+ /**
34
+ * Set the preferred audio codecs for sending the audio.
35
+ * Use {@link WhipClient.getSupportedAudioCodecs} to get the list of supported audio codecs.
36
+ */
37
+ preferredAudioCodecs?: SenderAudioCodecName[];
38
+ /**
39
+ * Reference to the WhipClient instance. Needs to be passed from the {@link useLivestreamStreamer} hook.
40
+ */
41
+ whipClientRef: React.RefObject<WhipClient | null>;
10
42
  };
11
43
  /**
12
44
  * Renders a video player playing the livestream set up with {@link useLivestreamStreamer} hook.
@@ -15,5 +47,5 @@ export type LivestreamStreamerProps = {
15
47
  * @param {object} props
16
48
  * @param {object} props.style
17
49
  */
18
- export declare const LivestreamStreamer: ({ style }: LivestreamStreamerProps) => import("react").JSX.Element;
50
+ export declare const LivestreamStreamer: ({ style, whipClientRef, videoEnabled, audioEnabled, camera, videoParameters, preferredVideoCodecs, preferredAudioCodecs, }: LivestreamStreamerProps) => import("react").JSX.Element;
19
51
  //# sourceMappingURL=LivestreamStreamer.d.ts.map
@@ -1 +1 @@
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;AAGpD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,uBAAuB,gCAEpE,CAAC"}
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,4 +1,5 @@
1
- import { WhipClientView } from 'react-native-whip-whep';
1
+ import { useEffect, useRef } from 'react';
2
+ import { cameras, WhipClient, WhipClientView, } from 'react-native-whip-whep';
2
3
  /**
3
4
  * Renders a video player playing the livestream set up with {@link useLivestreamStreamer} hook.
4
5
  *
@@ -6,5 +7,30 @@ import { WhipClientView } from 'react-native-whip-whep';
6
7
  * @param {object} props
7
8
  * @param {object} props.style
8
9
  */
9
- export const LivestreamStreamer = ({ style }) => (<WhipClientView style={style}/>);
10
+ export const LivestreamStreamer = ({ style, whipClientRef, videoEnabled, audioEnabled, camera, videoParameters, preferredVideoCodecs, preferredAudioCodecs, }) => {
11
+ const whipClient = useRef(null);
12
+ useEffect(() => {
13
+ whipClient.current = new WhipClient({
14
+ audioEnabled,
15
+ videoEnabled,
16
+ videoParameters,
17
+ videoDeviceId: camera?.id ?? cameras[0].id,
18
+ }, preferredVideoCodecs, preferredAudioCodecs);
19
+ whipClientRef.current = whipClient.current;
20
+ return () => {
21
+ whipClient.current?.disconnect();
22
+ whipClient.current?.cleanup();
23
+ whipClientRef.current = null;
24
+ };
25
+ }, [
26
+ camera,
27
+ videoParameters,
28
+ videoEnabled,
29
+ audioEnabled,
30
+ preferredVideoCodecs,
31
+ preferredAudioCodecs,
32
+ whipClientRef,
33
+ ]);
34
+ return <WhipClientView style={style}/>;
35
+ };
10
36
  //# sourceMappingURL=LivestreamStreamer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LivestreamStreamer.js","sourceRoot":"","sources":["../../src/components/LivestreamStreamer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAYxD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAA2B,EAAE,EAAE,CAAC,CACxE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,KAAsB,CAAC,EAAG,CAClD,CAAC","sourcesContent":["import { CSSProperties } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { WhipClientView } 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\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 = ({ style }: LivestreamStreamerProps) => (\n <WhipClientView style={style as CSSProperties} />\n);\n"]}
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 +1 @@
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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gB,GAAI,8EAQ9B,qBAAqB,gCASvB,CAAC"}
@@ -6,5 +6,5 @@ import { WhepClientView } from 'react-native-whip-whep';
6
6
  * @param {object} props
7
7
  * @param {object} props.style
8
8
  */
9
- export const LivestreamViewer = ({ style, orientation, pipEnabled, autoStartPip, autoStopPip, pipSize, ref, }) => (<WhepClientView ref={ref} style={style} orientation={orientation} pipEnabled={pipEnabled} autoStartPip={autoStartPip} autoStopPip={autoStopPip} pipSize={pipSize}/>);
9
+ export const LivestreamViewer = ({ style, orientation, pipEnabled, autoStartPip, autoStopPip, pipSize, ref, }) => (<WhepClientView ref={ref} style={style} pipEnabled={pipEnabled} autoStartPip={autoStartPip} autoStopPip={autoStopPip} pipSize={pipSize}/>);
10
10
  //# sourceMappingURL=LivestreamViewer.js.map
@@ -1 +1 @@
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,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,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 orientation={orientation}\n pipEnabled={pipEnabled}\n autoStartPip={autoStartPip}\n autoStopPip={autoStopPip}\n pipSize={pipSize}\n />\n);\n"]}
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"]}
@@ -5,7 +5,14 @@ export type AudioOutputDevice = {
5
5
  name: string;
6
6
  };
7
7
  export type OnAudioDeviceEvent = {
8
+ /**
9
+ * Currently selected output audio device.
10
+ * On iOS this property can briefly become null, even if it was previously initialized, when AVAudioSession's .currentRoute is empty.
11
+ */
8
12
  selectedDevice: AudioOutputDevice | null;
13
+ /**
14
+ * [Android only] available audio output devices to be set
15
+ */
9
16
  availableDevices: AudioOutputDevice[];
10
17
  };
11
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useAudioSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioSettings.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB;IAkD5B;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;sCA5CY,qBAAqB;IA8CpC;;;;OAIG;+CArCsB,gBAAgB;IAuCzC;;;OAGG;;EAGN"}
1
+ {"version":3,"file":"useAudioSettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioSettings.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,G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AM,KAAK,CACT,iEAAiE;gBAC/D,sGAAsG,CACzG,CAAC;QACJ,CAAC;QACD,MAAM,qBAAqB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,sBAAsB,GAAG,WAAW,CACxC,KAAK,EAAE,gBAAkC,EAAE,EAAE;QAC3C,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,qBAAqB,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IACvE,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAClD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,KAAK,CACT,0DAA0D;gBACxD,kFAAkF,CACrF,CAAC;QACJ,CAAC;QACD,MAAM,qBAAqB,CAAC,oBAAoB,EAAE,CAAC;IACrD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL;;WAEG;QACH,yBAAyB;QACzB;;WAEG;QACH,gBAAgB;QAChB;;;WAGG;QACH,uBAAuB;QACvB;;;;WAIG;QACH,sBAAsB;QACtB;;;WAGG;QACH,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { Platform } from 'react-native';\n\nimport RNFishjamClientModule, {\n ReceivableEvents,\n} from '../RNFishjamClientModule';\nimport { useFishjamEventState } from './internal/useFishjamEventState';\n\nexport type AudioOutputDeviceType =\n | 'bluetooth'\n | 'headset'\n | 'speaker'\n | 'earpiece';\n\nexport type AudioSessionMode = 'voiceChat' | 'videoChat';\n\nexport type AudioOutputDevice = {\n type: AudioOutputDeviceType;\n name: string;\n};\n\nexport type OnAudioDeviceEvent = {\n selectedDevice: AudioOutputDevice | null;\n availableDevices: AudioOutputDevice[];\n};\n\n/**\n * This hook manages audio settings.\n * @category Devices\n * @group Hooks\n */\nexport function useAudioSettings() {\n const { selectedDevice: selectedAudioOutputDevice, availableDevices } =\n useFishjamEventState(ReceivableEvents.AudioDeviceUpdate, {\n selectedDevice: null,\n availableDevices: [],\n });\n\n useEffect(() => {\n RNFishjamClientModule.startAudioSwitcher();\n return () => {\n if (Platform.OS === 'android') {\n RNFishjamClientModule.stopAudioSwitcher();\n }\n };\n }, []);\n\n const selectOutputAudioDevice = useCallback(\n async (device: AudioOutputDeviceType) => {\n if (Platform.OS === 'ios') {\n throw Error(\n 'selectOutputAudioDevice function is supported only on Android. ' +\n 'To select an output audio device on iOS use selectAudioSessionMode or showAudioRoutePicker functions',\n );\n }\n await RNFishjamClientModule.setOutputAudioDevice(device);\n },\n [],\n );\n\n const selectAudioSessionMode = useCallback(\n async (audioSessionMode: AudioSessionMode) => {\n if (Platform.OS === 'android') {\n throw Error('selectAudioSessionMode function is supported only on iOS');\n }\n await RNFishjamClientModule.selectAudioSessionMode(audioSessionMode);\n },\n [],\n );\n\n const showAudioRoutePicker = useCallback(async () => {\n if (Platform.OS === 'android') {\n throw Error(\n 'showAudioRoutePicker function is supported only on iOS. ' +\n 'To select an output audio device on Android use selectOutputAudioDevice function',\n );\n }\n await RNFishjamClientModule.showAudioRoutePicker();\n }, []);\n\n return {\n /**\n * currently selected output audio device\n */\n selectedAudioOutputDevice,\n /**\n * [Android only] available audio output devices to be set\n */\n availableDevices,\n /**\n * [Android only] selects output audio device.\n * For detecting and selecting bluettoth devices make sure you have the BLUETOOTH_CONNECT permission.\n */\n selectOutputAudioDevice,\n /**\n * [iOS only] selects audio session mode. For more information refer to Apple's documentation:\n * https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/\n *\n */\n selectAudioSessionMode,\n /**\n * [iOS only] Shows a picker modal that allows user to select output audio device. For more\n * information refer to Apple's documentation: https://developer.apple.com/documentation/avkit/avroutepickerview\n */\n showAudioRoutePicker,\n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MAAM,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,qBAAqB,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IACvE,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAClD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,KAAK,CACT,0DAA0D;gBACxD,kFAAkF,CACrF,CAAC;QACJ,CAAC;QACD,MAAM,qBAAqB,CAAC,oBAAoB,EAAE,CAAC;IACrD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL;;WAEG;QACH,yBAAyB;QACzB;;WAEG;QACH,gBAAgB;QAChB;;;WAGG;QACH,uBAAuB;QACvB;;;;WAIG;QACH,sBAAsB;QACtB;;;WAGG;QACH,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { Platform } from 'react-native';\n\nimport RNFishjamClientModule, {\n ReceivableEvents,\n} from '../RNFishjamClientModule';\nimport { useFishjamEventState } from './internal/useFishjamEventState';\n\nexport type AudioOutputDeviceType =\n | 'bluetooth'\n | 'headset'\n | 'speaker'\n | 'earpiece';\n\nexport type AudioSessionMode = 'voiceChat' | 'videoChat';\n\nexport type AudioOutputDevice = {\n type: AudioOutputDeviceType;\n name: string;\n};\n\nexport type OnAudioDeviceEvent = {\n /**\n * Currently selected output audio device.\n * On iOS this property can briefly become null, even if it was previously initialized, when AVAudioSession's .currentRoute is empty.\n */\n selectedDevice: AudioOutputDevice | null;\n /**\n * [Android only] available audio output devices to be set\n */\n availableDevices: AudioOutputDevice[];\n};\n\n/**\n * This hook manages audio settings.\n * @category Devices\n * @group Hooks\n */\nexport function useAudioSettings() {\n const { selectedDevice: selectedAudioOutputDevice, availableDevices } =\n useFishjamEventState(ReceivableEvents.AudioDeviceUpdate, {\n selectedDevice: null,\n availableDevices: [],\n });\n\n useEffect(() => {\n RNFishjamClientModule.startAudioSwitcher();\n return () => {\n if (Platform.OS === 'android') {\n RNFishjamClientModule.stopAudioSwitcher();\n }\n };\n }, []);\n\n const selectOutputAudioDevice = useCallback(\n async (device: AudioOutputDeviceType) => {\n if (Platform.OS === 'ios') {\n throw Error(\n 'selectOutputAudioDevice function is supported only on Android. ' +\n 'To select an output audio device on iOS use selectAudioSessionMode or showAudioRoutePicker functions',\n );\n }\n await RNFishjamClientModule.setOutputAudioDevice(device);\n },\n [],\n );\n\n const selectAudioSessionMode = useCallback(\n async (audioSessionMode: AudioSessionMode) => {\n if (Platform.OS === 'android') {\n throw Error('selectAudioSessionMode function is supported only on iOS');\n }\n await RNFishjamClientModule.selectAudioSessionMode(audioSessionMode);\n },\n [],\n );\n\n const showAudioRoutePicker = useCallback(async () => {\n if (Platform.OS === 'android') {\n throw Error(\n 'showAudioRoutePicker function is supported only on iOS. ' +\n 'To select an output audio device on Android use selectOutputAudioDevice function',\n );\n }\n await RNFishjamClientModule.showAudioRoutePicker();\n }, []);\n\n return {\n /**\n * currently selected output audio device\n */\n selectedAudioOutputDevice,\n /**\n * [Android only] available audio output devices to be set\n */\n availableDevices,\n /**\n * [Android only] selects output audio device.\n * For detecting and selecting bluettoth devices make sure you have the BLUETOOTH_CONNECT permission.\n */\n selectOutputAudioDevice,\n /**\n * [iOS only] selects audio session mode. For more information refer to Apple's documentation:\n * https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/\n *\n */\n selectAudioSessionMode,\n /**\n * [iOS only] Shows a picker modal that allows user to select output audio device. For more\n * information refer to Apple's documentation: https://developer.apple.com/documentation/avkit/avroutepickerview\n */\n showAudioRoutePicker,\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Camera } from 'react-native-whip-whep';
1
+ import { WhipClient } from 'react-native-whip-whep';
2
2
  /**
3
3
  * @category Livestream
4
4
  */
@@ -11,14 +11,18 @@ export interface useLivestreamStreamerResult {
11
11
  */
12
12
  connect: (token: string, urlOverride?: string) => Promise<void>;
13
13
  /** Callback to stop publishing anything previously published with {@link connect} */
14
- disconnect: () => void;
14
+ disconnect: () => Promise<void>;
15
+ /** Utility flag which indicates the current connection status */
16
+ isConnected: boolean;
17
+ /**
18
+ * Reference to the WhipClient instance. Needs to be passed to the {@link LivestreamStreamer} component.
19
+ */
20
+ whipClientRef: React.RefObject<WhipClient | null>;
15
21
  }
16
22
  /**
17
23
  * Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}
18
24
  * @category Livestream
19
25
  * @group Hooks
20
26
  */
21
- export declare const useLivestreamStreamer: ({ camera, }: {
22
- camera?: Camera;
23
- }) => useLivestreamStreamerResult;
27
+ export declare const useLivestreamStreamer: () => useLivestreamStreamerResult;
24
28
  //# sourceMappingURL=useLivestreamStreamer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLivestreamStreamer.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestreamStreamer.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,MAAM,EACP,MAAM,wBAAwB,CAAC;AAGhC;;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,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAEnC;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,2BA+BH,CAAC"}
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,31 +1,30 @@
1
1
  import { useCallback, useRef } from 'react';
2
- import { connectWhipClient, createWhipClient, disconnectWhipClient, cameras, } from 'react-native-whip-whep';
2
+ import { useWhipConnectionState } from 'react-native-whip-whep';
3
3
  import { FISHJAM_WHIP_URL } from '../consts';
4
4
  /**
5
5
  * Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}
6
6
  * @category Livestream
7
7
  * @group Hooks
8
8
  */
9
- export const useLivestreamStreamer = ({ camera, }) => {
10
- const isWhipClientCreatedRef = useRef(false);
9
+ export const useLivestreamStreamer = () => {
10
+ const state = useWhipConnectionState();
11
+ const isConnected = state === 'connected';
12
+ const whipClientRef = useRef(null);
11
13
  const connect = useCallback(async (token, urlOverride) => {
12
- if (isWhipClientCreatedRef.current) {
13
- return;
14
- }
15
14
  const resolvedUrl = urlOverride ?? FISHJAM_WHIP_URL;
16
- createWhipClient(resolvedUrl, {
15
+ await whipClientRef.current?.connect({
17
16
  authToken: token,
18
- }, camera?.id ?? cameras[0].id);
19
- isWhipClientCreatedRef.current = true;
20
- await connectWhipClient();
21
- }, [camera]);
22
- const disconnect = useCallback(() => {
23
- // TODO: Remove when FCE-1786 fixed
24
- if (isWhipClientCreatedRef.current) {
25
- disconnectWhipClient();
26
- isWhipClientCreatedRef.current = false;
27
- }
17
+ serverUrl: resolvedUrl,
18
+ });
28
19
  }, []);
29
- return { connect, disconnect };
20
+ const disconnect = useCallback(async () => {
21
+ await whipClientRef.current?.disconnect();
22
+ }, []);
23
+ return {
24
+ connect,
25
+ disconnect,
26
+ isConnected,
27
+ whipClientRef,
28
+ };
30
29
  };
31
30
  //# sourceMappingURL=useLivestreamStreamer.js.map
@@ -1 +1 @@
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,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,GAER,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAiB7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,MAAM,GAGP,EAA+B,EAAE;IAChC,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,KAAa,EAAE,WAAoB,EAAE,EAAE;QAC5C,IAAI,sBAAsB,CAAC,OAAO,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QACD,MAAM,WAAW,GAAG,WAAW,IAAI,gBAAgB,CAAC;QACpD,gBAAgB,CACd,WAAW,EACX;YACE,SAAS,EAAE,KAAK;SACjB,EACD,MAAM,EAAE,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAC5B,CAAC;QACF,sBAAsB,CAAC,OAAO,GAAG,IAAI,CAAC;QACtC,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,mCAAmC;QACnC,IAAI,sBAAsB,CAAC,OAAO,EAAE,CAAC;YACnC,oBAAoB,EAAE,CAAC;YACvB,sBAAsB,CAAC,OAAO,GAAG,KAAK,CAAC;QACzC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import { useCallback, useRef } from 'react';\nimport {\n connectWhipClient,\n createWhipClient,\n disconnectWhipClient,\n cameras,\n Camera,\n} 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: () => void;\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 = ({\n camera,\n}: {\n camera?: Camera;\n}): useLivestreamStreamerResult => {\n const isWhipClientCreatedRef = useRef(false);\n\n const connect = useCallback(\n async (token: string, urlOverride?: string) => {\n if (isWhipClientCreatedRef.current) {\n return;\n }\n const resolvedUrl = urlOverride ?? FISHJAM_WHIP_URL;\n createWhipClient(\n resolvedUrl,\n {\n authToken: token,\n },\n camera?.id ?? cameras[0].id,\n );\n isWhipClientCreatedRef.current = true;\n await connectWhipClient();\n },\n [camera],\n );\n\n const disconnect = useCallback(() => {\n // TODO: Remove when FCE-1786 fixed\n if (isWhipClientCreatedRef.current) {\n disconnectWhipClient();\n isWhipClientCreatedRef.current = false;\n }\n }, []);\n\n return { connect, disconnect };\n};\n"]}
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"]}
@@ -16,7 +16,9 @@ export interface useLivestreamViewerResult {
16
16
  */
17
17
  connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;
18
18
  /** Disconnect from a stream previously connected to with {@link connect} */
19
- disconnect: () => void;
19
+ disconnect: () => Promise<void>;
20
+ /** Utility flag which indicates the current connection status */
21
+ isConnected: boolean;
20
22
  }
21
23
  /**
22
24
  * Hook for receiving a published livestream.
@@ -1 +1 @@
1
- {"version":3,"file":"useLivestreamViewer.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestreamViewer.ts"],"names":[],"mappings":"AAQA,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,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAO,yBAsBtC,CAAC"}
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"}
@@ -1,5 +1,5 @@
1
- import { useCallback, useRef } from 'react';
2
- import { connectWhepClient, createWhepClient, disconnectWhepClient, } from 'react-native-whip-whep';
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { WhepClient, useWhepConnectionState } from 'react-native-whip-whep';
3
3
  import { FISHJAM_WHEP_URL } from '../consts';
4
4
  const urlFromConfig = (config) => {
5
5
  if (config.streamId)
@@ -12,20 +12,34 @@ const urlFromConfig = (config) => {
12
12
  * @group Hooks
13
13
  */
14
14
  export const useLivestreamViewer = () => {
15
- const isWhepClientCreatedRef = useRef(false);
15
+ const state = useWhepConnectionState();
16
+ const isConnected = state === 'connected';
17
+ const whepClient = useRef(null);
18
+ useEffect(() => {
19
+ const createClient = () => {
20
+ whepClient.current = new WhepClient({
21
+ audioEnabled: true,
22
+ videoEnabled: true,
23
+ });
24
+ };
25
+ createClient();
26
+ return () => {
27
+ whepClient.current?.disconnect();
28
+ };
29
+ }, []);
16
30
  const connect = useCallback(async (config, url) => {
17
- createWhepClient(url ?? urlFromConfig(config), {
31
+ await whepClient.current?.connect({
32
+ serverUrl: url ?? urlFromConfig(config),
18
33
  authToken: config.token,
19
34
  });
20
- isWhepClientCreatedRef.current = true;
21
- await connectWhepClient();
22
35
  }, []);
23
- const disconnect = useCallback(() => {
24
- // TODO: Remove when FCE-1786 fixed
25
- if (isWhepClientCreatedRef.current) {
26
- disconnectWhepClient();
27
- }
36
+ const disconnect = useCallback(async () => {
37
+ await whepClient.current?.disconnect();
28
38
  }, []);
29
- return { connect, disconnect };
39
+ return {
40
+ connect,
41
+ disconnect,
42
+ isConnected,
43
+ };
30
44
  };
31
45
  //# sourceMappingURL=useLivestreamViewer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLivestreamViewer.js","sourceRoot":"","sources":["../../src/hooks/useLivestreamViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,aAAa,GAAG,CAAC,MAA2B,EAAE,EAAE;IACpD,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,GAAG,gBAAgB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;IACrE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAgBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA8B,EAAE;IACjE,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,MAA2B,EAAE,GAAY,EAAE,EAAE;QAClD,gBAAgB,CAAC,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;YAC7C,SAAS,EAAE,MAAM,CAAC,KAAK;SACxB,CAAC,CAAC;QACH,sBAAsB,CAAC,OAAO,GAAG,IAAI,CAAC;QACtC,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,mCAAmC;QACnC,IAAI,sBAAsB,CAAC,OAAO,EAAE,CAAC;YACnC,oBAAoB,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import { useCallback, useRef } from 'react';\nimport {\n connectWhepClient,\n createWhepClient,\n disconnectWhepClient,\n} from 'react-native-whip-whep';\nimport { FISHJAM_WHEP_URL } from '../consts';\n\nexport type ConnectViewerConfig =\n | { token: string; streamId?: never }\n | { streamId: string; token?: never };\n\nconst urlFromConfig = (config: ConnectViewerConfig) => {\n if (config.streamId) return `${FISHJAM_WHEP_URL}/${config.streamId}`;\n return FISHJAM_WHEP_URL;\n};\n\n/**\n * @category Livestream\n */\nexport interface useLivestreamViewerResult {\n /**\n * Callback to start receiving a livestream.\n * If the livestream is private, provide `token`.\n * If the livestream is public, provide `streamId`.\n */\n connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;\n /** Disconnect from a stream previously connected to with {@link connect} */\n disconnect: () => void;\n}\n\n/**\n * Hook for receiving a published livestream.\n * @category Livestream\n * @group Hooks\n */\nexport const useLivestreamViewer = (): useLivestreamViewerResult => {\n const isWhepClientCreatedRef = useRef(false);\n\n const connect = useCallback(\n async (config: ConnectViewerConfig, url?: string) => {\n createWhepClient(url ?? urlFromConfig(config), {\n authToken: config.token,\n });\n isWhepClientCreatedRef.current = true;\n await connectWhepClient();\n },\n [],\n );\n\n const disconnect = useCallback(() => {\n // TODO: Remove when FCE-1786 fixed\n if (isWhepClientCreatedRef.current) {\n disconnectWhepClient();\n }\n }, []);\n\n return { connect, disconnect };\n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,EAAE,MAAM,CAAC,KAAK;SACxB,CAAC,CAAC;IACL,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxC,MAAM,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,OAAO;QACP,UAAU;QACV,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport { WhepClient, useWhepConnectionState } from 'react-native-whip-whep';\nimport { FISHJAM_WHEP_URL } from '../consts';\n\nexport type ConnectViewerConfig =\n | { token: string; streamId?: never }\n | { streamId: string; token?: never };\n\nconst urlFromConfig = (config: ConnectViewerConfig) => {\n if (config.streamId) return `${FISHJAM_WHEP_URL}/${config.streamId}`;\n return FISHJAM_WHEP_URL;\n};\n\n/**\n * @category Livestream\n */\nexport interface useLivestreamViewerResult {\n /**\n * Callback to start receiving a livestream.\n * If the livestream is private, provide `token`.\n * If the livestream is public, provide `streamId`.\n */\n connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;\n /** Disconnect from a stream previously connected to with {@link connect} */\n disconnect: () => Promise<void>;\n /** Utility flag which indicates the current connection status */\n isConnected: boolean;\n}\n\n/**\n * Hook for receiving a published livestream.\n * @category Livestream\n * @group Hooks\n */\nexport const useLivestreamViewer = (): useLivestreamViewerResult => {\n const state = useWhepConnectionState();\n const isConnected = state === 'connected';\n\n const whepClient = useRef<WhepClient | null>(null);\n\n useEffect(() => {\n const createClient = () => {\n whepClient.current = new WhepClient({\n audioEnabled: true,\n videoEnabled: true,\n });\n };\n createClient();\n\n return () => {\n whepClient.current?.disconnect();\n };\n }, []);\n\n const connect = useCallback(\n async (config: ConnectViewerConfig, url?: string) => {\n await whepClient.current?.connect({\n serverUrl: url ?? urlFromConfig(config),\n authToken: config.token,\n });\n },\n [],\n );\n\n const disconnect = useCallback(async () => {\n await whepClient.current?.disconnect();\n }, []);\n\n return {\n connect,\n disconnect,\n isConnected,\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSandbox.d.ts","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAUpC,MAAM,MAAM,eAAe,GACvB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACzC;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,eAAO,MAAM,UAAU,GAAI,2BAA2B,eAAe;oCAMvD,MAAM,YACN,MAAM,aACN,QAAQ;sCA0B2B,MAAM;qCAwBzC,MAAM,aACN,OAAO;uBAiBA,MAAM;cACf;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;;CASvC,CAAC"}
1
+ {"version":3,"file":"useSandbox.d.ts","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAUpC,MAAM,MAAM,eAAe,GACvB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACzC;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,eAAO,MAAM,UAAU,GAAI,2BAA2B,eAAe;oCAOrD,MAAM,YACN,MAAM,aACN,QAAQ;sCA6BH,MAAM;qCA4BN,MAAM,aAAY,OAAO;uBAevB,MAAM;cACf;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;;CAWzC,CAAC"}
@@ -1,9 +1,10 @@
1
+ import { useCallback } from 'react';
1
2
  import { FISHJAM_HTTP_CONNECT_URL } from '../consts';
2
3
  export const useSandbox = ({ fishjamId, fishjamUrl }) => {
3
4
  const managerUrl = fishjamUrl
4
5
  ? `${fishjamUrl}/room-manager`
5
6
  : `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}/room-manager`;
6
- const getSandboxPeerToken = async (roomName, peerName, roomType = 'conference') => {
7
+ const getSandboxPeerToken = useCallback(async (roomName, peerName, roomType = 'conference') => {
7
8
  try {
8
9
  const url = new URL(managerUrl);
9
10
  url.searchParams.set('roomName', roomName);
@@ -19,8 +20,8 @@ export const useSandbox = ({ fishjamId, fishjamUrl }) => {
19
20
  catch (error) {
20
21
  throw new Error(`Failed to get peer token for room '${roomName}', peer '${peerName}': ${error instanceof Error ? error.message : String(error)}`);
21
22
  }
22
- };
23
- const getSandboxViewerToken = async (roomName) => {
23
+ }, [managerUrl]);
24
+ const getSandboxViewerToken = useCallback(async (roomName) => {
24
25
  try {
25
26
  const url = new URL(`${managerUrl}/${roomName}/livestream-viewer-token`);
26
27
  const res = await fetch(url);
@@ -33,12 +34,11 @@ export const useSandbox = ({ fishjamId, fishjamUrl }) => {
33
34
  catch (error) {
34
35
  throw new Error(`Failed to get viewer token for room '${roomName}': ${error instanceof Error ? error.message : String(error)}`);
35
36
  }
36
- };
37
- const getSandboxLivestream = async (roomName, isPublic = false) => {
37
+ }, [managerUrl]);
38
+ const getSandboxLivestream = useCallback(async (roomName, isPublic = false) => {
38
39
  const url = new URL(`${managerUrl}/livestream`);
39
40
  url.searchParams.set('roomName', roomName);
40
41
  url.searchParams.set('public', isPublic.toString());
41
- console.log({ sanurl: url.toString() });
42
42
  const res = await fetch(url);
43
43
  if (!res.ok) {
44
44
  console.log(await res.json());
@@ -46,7 +46,7 @@ export const useSandbox = ({ fishjamId, fishjamUrl }) => {
46
46
  }
47
47
  const data = await res.json();
48
48
  return data;
49
- };
49
+ }, [managerUrl]);
50
50
  return {
51
51
  getSandboxPeerToken,
52
52
  getSandboxViewerToken,
@@ -1 +1 @@
1
- {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EAAE,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,0CAA0C,QAAQ,oBAAoB,CACvE,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,IAGN,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FISHJAM_HTTP_CONNECT_URL } from '../consts';\nimport { RoomType } from '../types';\n\ntype BasicInfo = { id: string; name: string };\ntype RoomManagerResponse = {\n peerToken: string;\n url: string;\n room: BasicInfo;\n peer: BasicInfo;\n};\n\nexport type UseSandboxProps =\n | { fishjamId: string; fishjamUrl?: never }\n | { fishjamId?: never; fishjamUrl: string };\n\nexport const useSandbox = ({ fishjamId, fishjamUrl }: UseSandboxProps) => {\n const managerUrl = fishjamUrl\n ? `${fishjamUrl}/room-manager`\n : `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}/room-manager`;\n\n const getSandboxPeerToken = async (\n roomName: string,\n peerName: string,\n roomType: RoomType = 'conference',\n ) => {\n try {\n const url = new URL(managerUrl);\n url.searchParams.set('roomName', roomName);\n url.searchParams.set('peerName', peerName);\n url.searchParams.set('roomType', roomType);\n\n const res = await fetch(url.toString());\n\n if (!res.ok) {\n throw new Error(\n `Room '${roomName}' or peer '${peerName}' does not exist or cannot retrieve peer token.`,\n );\n }\n const data: RoomManagerResponse = await res.json();\n return data.peerToken;\n } catch (error) {\n throw new Error(\n `Failed to get peer token for room '${roomName}', peer '${peerName}': ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n };\n\n const getSandboxViewerToken = async (roomName: string) => {\n try {\n const url = new URL(`${managerUrl}/${roomName}/livestream-viewer-token`);\n const res = await fetch(url);\n\n if (!res.ok) {\n throw new Error(\n `Room '${roomName}' does not exist or cannot retrieve viewer token.`,\n );\n }\n\n const data: { token: string } = await res.json();\n\n return data.token;\n } catch (error) {\n throw new Error(\n `Failed to get viewer token for room '${roomName}': ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n };\n\n const getSandboxLivestream = async (\n roomName: string,\n isPublic: boolean = false,\n ) => {\n const url = new URL(`${managerUrl}/livestream`);\n url.searchParams.set('roomName', roomName);\n url.searchParams.set('public', isPublic.toString());\n\n console.log({ sanurl: url.toString() });\n const res = await fetch(url);\n if (!res.ok) {\n console.log(await res.json());\n throw new Error(\n `Failed to retrieve streamer token for '${roomName}' livestream room.`,\n );\n }\n\n const data = await res.json();\n return data as {\n streamerToken: string;\n room: { id: string; name: string };\n };\n };\n\n return {\n getSandboxPeerToken,\n getSandboxViewerToken,\n getSandboxLivestream,\n };\n};\n"]}
1
+ {"version":3,"file":"useSandbox.js","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAerD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAAmB,EAAE,EAAE;IACvE,MAAM,UAAU,GAAG,UAAU;QAC3B,CAAC,CAAC,GAAG,UAAU,eAAe;QAC9B,CAAC,CAAC,GAAG,wBAAwB,IAAI,SAAS,eAAe,CAAC;IAE5D,MAAM,mBAAmB,GAAG,WAAW,CACrC,KAAK,EACH,QAAgB,EAChB,QAAgB,EAChB,WAAqB,YAAY,EACjC,EAAE;QACF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;YAChC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAC3C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,E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9C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,MAAM,oBAAoB,GAAG,WAAW,CACtC,KAAK,EAAE,QAAgB,EAAE,WAAoB,KAAK,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,UAAU,aAAa,CAAC,CAAC;QAChD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC3C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEpD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,0CAA0C,QAAQ,oBAAoB,CACvE,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,IAGN,CAAC;IACJ,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO;QACL,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport { FISHJAM_HTTP_CONNECT_URL } from '../consts';\nimport { RoomType } from '../types';\n\ntype BasicInfo = { id: string; name: string };\ntype RoomManagerResponse = {\n peerToken: string;\n url: string;\n room: BasicInfo;\n peer: BasicInfo;\n};\n\nexport type UseSandboxProps =\n | { fishjamId: string; fishjamUrl?: never }\n | { fishjamId?: never; fishjamUrl: string };\n\nexport const useSandbox = ({ fishjamId, fishjamUrl }: UseSandboxProps) => {\n const managerUrl = fishjamUrl\n ? `${fishjamUrl}/room-manager`\n : `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}/room-manager`;\n\n const getSandboxPeerToken = useCallback(\n async (\n roomName: string,\n peerName: string,\n roomType: RoomType = 'conference',\n ) => {\n try {\n const url = new URL(managerUrl);\n url.searchParams.set('roomName', roomName);\n url.searchParams.set('peerName', peerName);\n url.searchParams.set('roomType', roomType);\n\n const res = await fetch(url.toString());\n\n if (!res.ok) {\n throw new Error(\n `Room '${roomName}' or peer '${peerName}' does not exist or cannot retrieve peer token.`,\n );\n }\n const data: RoomManagerResponse = await res.json();\n return data.peerToken;\n } catch (error) {\n throw new Error(\n `Failed to get peer token for room '${roomName}', peer '${peerName}': ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n },\n [managerUrl],\n );\n\n const getSandboxViewerToken = useCallback(\n async (roomName: string) => {\n try {\n const url = new URL(\n `${managerUrl}/${roomName}/livestream-viewer-token`,\n );\n const res = await fetch(url);\n\n if (!res.ok) {\n throw new Error(\n `Room '${roomName}' does not exist or cannot retrieve viewer token.`,\n );\n }\n\n const data: { token: string } = await res.json();\n\n return data.token;\n } catch (error) {\n throw new Error(\n `Failed to get viewer token for room '${roomName}': ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n },\n [managerUrl],\n );\n\n const getSandboxLivestream = useCallback(\n async (roomName: string, isPublic: boolean = false) => {\n const url = new URL(`${managerUrl}/livestream`);\n url.searchParams.set('roomName', roomName);\n url.searchParams.set('public', isPublic.toString());\n\n const res = await fetch(url);\n if (!res.ok) {\n console.log(await res.json());\n throw new Error(\n `Failed to retrieve streamer token for '${roomName}' livestream room.`,\n );\n }\n\n const data = await res.json();\n return data as {\n streamerToken: string;\n room: { id: string; name: string };\n };\n },\n [managerUrl],\n );\n\n return {\n getSandboxPeerToken,\n getSandboxViewerToken,\n getSandboxLivestream,\n };\n};\n"]}
package/build/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
40
40
  export { useLivestreamViewer } from './hooks/useLivestreamViewer';
41
41
  export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
42
42
  export { useSandbox } from './hooks/useSandbox';
43
- export { cameras } from 'react-native-whip-whep';
43
+ export { cameras, VideoParameters, WhipClient, WhepClient, } from 'react-native-whip-whep';
44
44
  export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
45
45
  export type { FishjamRoomProps } from './components/FishjamRoom';
46
46
  export { FishjamRoom } from './components/FishjamRoom';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAGA,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,KAAK,EACL,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO;AACL,kBAAkB;AAClB,QAAQ;AACR,kBAAkB;AAClB,SAAS,GACV,MAAM,iBAAiB,CAAC;AAIzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EACV,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,YAAY,EACV,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,S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,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
package/build/index.js CHANGED
@@ -28,7 +28,7 @@ export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
28
28
  export { useLivestreamViewer } from './hooks/useLivestreamViewer';
29
29
  export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
30
30
  export { useSandbox } from './hooks/useSandbox';
31
- export { cameras } from 'react-native-whip-whep';
31
+ export { cameras, VideoParameters, WhipClient, WhepClient, } from 'react-native-whip-whep';
32
32
  // #endregion
33
33
  export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
34
34
  export { FishjamRoom } from './components/FishjamRoom';
@@ -1 +1 @@
1
- {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MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,aAAa;AAEb,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,yBAAyB,EAAE,CAAC","sourcesContent":["import { initializeWarningListener } from './utils/errorListener';\n\n// #region types\nexport type {\n SimulcastConfig,\n VideoLayout,\n GenericMetadata,\n TrackMetadata,\n Brand,\n RoomType,\n} from './types';\nexport type { ConnectionConfig } from './common/client';\n// #endregion\n\n// #region methods\nexport { updatePeerMetadata } from './common/metadata';\nexport {\n /** @deprecated */\n joinRoom,\n /** @deprecated */\n leaveRoom,\n} from './common/client';\n// #endregion\n\n// #region components\nexport type { VideoPreviewViewProps } from './components/VideoPreviewView';\nexport type { VideoRendererProps } from './components/VideoRendererView';\nexport type {\n LivestreamViewerProps,\n LivestreamViewerRef,\n} from './components/LivestreamViewer';\n\nexport { VideoPreviewView } from './components/VideoPreviewView';\nexport { VideoRendererView } from './components/VideoRendererView';\nexport { LivestreamViewer } from './components/LivestreamViewer';\nexport { LivestreamStreamer } from './components/LivestreamStreamer';\n// #endregion\n\n// #region types for hooks\nexport type {\n Peer,\n PeerId,\n Track,\n TrackId,\n TrackType,\n VadStatus,\n EncodingReason,\n TrackBase,\n AudioTrack,\n VideoTrack,\n UsePeersResult,\n PeerWithTracks,\n PeerTrackMetadata,\n DistinguishedTracks,\n} from './hooks/usePeers';\n\nexport type {\n AudioOutputDevice,\n AudioOutputDeviceType,\n AudioSessionMode,\n} from './hooks/useAudioSettings';\n\nexport type {\n CameraId,\n Camera,\n CameraConfig,\n VideoQuality,\n CameraFacingDirection,\n CameraConfigBase,\n} from './hooks/useCamera';\n\nexport type {\n ScreenShareOptions,\n ScreenShareQuality,\n} from './hooks/useScreenShare';\nexport type { ForegroundServiceConfig } from './hooks/useForegroundService';\nexport type {\n JoinRoomConfig,\n ReconnectionStatus,\n PeerStatus,\n} from './hooks/useConnection';\nexport type { AppScreenShareData } from './hooks/useAppScreenShare';\nexport type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';\nexport type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';\nexport type { UseSandboxProps } from './hooks/useSandbox';\nexport type { LivestreamStreamerProps } from './components/LivestreamStreamer';\nexport type { ConnectViewerConfig } from './hooks/useLivestreamViewer';\n// #endregion\n\n// #region hooks\nexport { useAudioSettings } from './hooks/useAudioSettings';\nexport { useBandwidthEstimation } from './hooks/useBandwidthEstimation';\nexport { useCamera } from './hooks/useCamera';\nexport { useMicrophone } from './hooks/useMicrophone';\nexport { useScreenShare } from './hooks/useScreenShare';\nexport { useAppScreenShare } from './hooks/useAppScreenShare';\nexport { useReconnection } from './hooks/useReconnection';\nexport { usePeerStatus } from './hooks/usePeerStatus';\nexport { usePeers } from './hooks/usePeers';\nexport { useForegroundService } from './hooks/useForegroundService';\nexport { useConnection } from './hooks/useConnection';\nexport { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';\nexport { useLivestreamViewer } from './hooks/useLivestreamViewer';\nexport { useLivestreamStreamer } from './hooks/useLivestreamStreamer';\nexport { useSandbox } from './hooks/useSandbox';\nexport { cameras } from 'react-native-whip-whep';\n// #endregion\n\nexport {\n useCameraPermissions,\n useMicrophonePermissions,\n} from './hooks/usePermissions';\n\nexport type { FishjamRoomProps } from './components/FishjamRoom';\nexport { FishjamRoom } from './components/FishjamRoom';\n\ninitializeWarningListener();\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAYlE,aAAa;AAEb,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO;AACL,kBAA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AM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,yBAAyB,EAAE,CAAC","sourcesContent":["import { initializeWarningListener } from './utils/errorListener';\n\n// #region types\nexport type {\n SimulcastConfig,\n VideoLayout,\n GenericMetadata,\n TrackMetadata,\n Brand,\n RoomType,\n} from './types';\nexport type { ConnectionConfig } from './common/client';\n// #endregion\n\n// #region methods\nexport { updatePeerMetadata } from './common/metadata';\nexport {\n /** @deprecated */\n joinRoom,\n /** @deprecated */\n leaveRoom,\n} from './common/client';\n// #endregion\n\n// #region components\nexport type { VideoPreviewViewProps } from './components/VideoPreviewView';\nexport type { VideoRendererProps } from './components/VideoRendererView';\nexport type {\n LivestreamViewerProps,\n LivestreamViewerRef,\n} from './components/LivestreamViewer';\n\nexport { VideoPreviewView } from './components/VideoPreviewView';\nexport { VideoRendererView } from './components/VideoRendererView';\nexport { LivestreamViewer } from './components/LivestreamViewer';\nexport { LivestreamStreamer } from './components/LivestreamStreamer';\n// #endregion\n\n// #region types for hooks\nexport type {\n Peer,\n PeerId,\n Track,\n TrackId,\n TrackType,\n VadStatus,\n EncodingReason,\n TrackBase,\n AudioTrack,\n VideoTrack,\n UsePeersResult,\n PeerWithTracks,\n PeerTrackMetadata,\n DistinguishedTracks,\n} from './hooks/usePeers';\n\nexport type {\n AudioOutputDevice,\n AudioOutputDeviceType,\n AudioSessionMode,\n} from './hooks/useAudioSettings';\n\nexport type {\n CameraId,\n Camera,\n CameraConfig,\n VideoQuality,\n CameraFacingDirection,\n CameraConfigBase,\n} from './hooks/useCamera';\n\nexport type {\n ScreenShareOptions,\n ScreenShareQuality,\n} from './hooks/useScreenShare';\nexport type { ForegroundServiceConfig } from './hooks/useForegroundService';\nexport type {\n JoinRoomConfig,\n ReconnectionStatus,\n PeerStatus,\n} from './hooks/useConnection';\nexport type { AppScreenShareData } from './hooks/useAppScreenShare';\nexport type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';\nexport type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';\nexport type { UseSandboxProps } from './hooks/useSandbox';\nexport type { LivestreamStreamerProps } from './components/LivestreamStreamer';\nexport type { ConnectViewerConfig } from './hooks/useLivestreamViewer';\n// #endregion\n\n// #region hooks\nexport { useAudioSettings } from './hooks/useAudioSettings';\nexport { useBandwidthEstimation } from './hooks/useBandwidthEstimation';\nexport { useCamera } from './hooks/useCamera';\nexport { useMicrophone } from './hooks/useMicrophone';\nexport { useScreenShare } from './hooks/useScreenShare';\nexport { useAppScreenShare } from './hooks/useAppScreenShare';\nexport { useReconnection } from './hooks/useReconnection';\nexport { usePeerStatus } from './hooks/usePeerStatus';\nexport { usePeers } from './hooks/usePeers';\nexport { useForegroundService } from './hooks/useForegroundService';\nexport { useConnection } from './hooks/useConnection';\nexport { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';\nexport { useLivestreamViewer } from './hooks/useLivestreamViewer';\nexport { useLivestreamStreamer } from './hooks/useLivestreamStreamer';\nexport { useSandbox } from './hooks/useSandbox';\nexport {\n cameras,\n VideoParameters,\n WhipClient,\n WhepClient,\n} from 'react-native-whip-whep';\n// #endregion\n\nexport {\n useCameraPermissions,\n useMicrophonePermissions,\n} from './hooks/usePermissions';\n\nexport type { FishjamRoomProps } from './components/FishjamRoom';\nexport { FishjamRoom } from './components/FishjamRoom';\n\ninitializeWarningListener();\n"]}
package/ios/Events.swift CHANGED
@@ -93,7 +93,14 @@ class EmitableEvent {
93
93
  }
94
94
 
95
95
  static func audioDeviceUpdate(currentRoute: AVAudioSessionRouteDescription) -> EmitableEvent {
96
- let output = currentRoute.outputs[0]
96
+ guard let output = currentRoute.outputs.first else {
97
+ return .init(
98
+ event: .AudioDeviceUpdate,
99
+ eventContent: [
100
+ "selectedDevice": nil,
101
+ "availableDevices": [],
102
+ ])
103
+ }
97
104
  let deviceType = output.portType
98
105
 
99
106
  let deviceTypeString =
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, '13.0'
13
+ s.platform = :ios, '15.1'
14
14
  s.swift_version = '5.4'
15
15
  s.source = { git: 'https://github.com/fishjam-cloud/mobile-client-sdk/tree/main/packages/react-native-client/ios' }
16
16
  s.static_framework = true
@@ -224,6 +224,11 @@ class RNFishjamClient: FishjamClientListener {
224
224
  url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
225
225
  promise: Promise
226
226
  ) {
227
+ guard connectPromise == nil && peerStatus != .connected else {
228
+ promise.reject("E_MEMBRANE_CONNECT", "Room already joined or it's connecting. You must call leaveRoom() before calling joinRoom() again.")
229
+ return
230
+ }
231
+
227
232
  peerStatus = .connecting
228
233
  connectPromise = promise
229
234
 
@@ -240,6 +245,8 @@ class RNFishjamClient: FishjamClientListener {
240
245
  }
241
246
 
242
247
  func leaveRoom() {
248
+ connectPromise?.reject("E_MEMBRANE_CONNECT", "leaveRoom called before connected")
249
+ connectPromise = nil
243
250
  if isScreenShareOn {
244
251
  let screenShareExtensionBundleId =
245
252
  Bundle.main.infoDictionary?["ScreenShareExtensionBundleId"] as? String
@@ -1,5 +1,6 @@
1
1
  import ExpoModulesCore
2
2
  import FishjamCloudClient
3
+ import os.log
3
4
 
4
5
  class VideoPreviewView: VideoRendererView, LocalCameraTrackChangedListener {
5
6
  private var localVideoTrack: LocalCameraTrack?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishjam-cloud/react-native-client",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "A React Native client for Fishjam",
5
5
  "author": "Fishjam Team",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "promise-fs": "^2.1.1",
44
44
  "protobufjs": "^7.4.0",
45
- "react-native-whip-whep": "0.2.3",
45
+ "react-native-whip-whep": "0.3.1",
46
46
  "zod": "^3.25.71"
47
47
  },
48
48
  "devDependencies": {