@fishjam-cloud/react-native-client 0.19.1 → 0.20.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.
- package/build/components/LivestreamStreamer.d.ts +19 -0
- package/build/components/LivestreamStreamer.d.ts.map +1 -0
- package/build/components/LivestreamStreamer.js +10 -0
- package/build/components/LivestreamStreamer.js.map +1 -0
- package/build/components/{LivestreamView.d.ts → LivestreamViewer.d.ts} +6 -6
- package/build/components/LivestreamViewer.d.ts.map +1 -0
- package/build/components/LivestreamViewer.js +10 -0
- package/build/components/LivestreamViewer.js.map +1 -0
- package/build/consts/index.d.ts +2 -0
- package/build/consts/index.d.ts.map +1 -1
- package/build/consts/index.js +5 -1
- package/build/consts/index.js.map +1 -1
- package/build/hooks/useLivestreamStreamer.d.ts +24 -0
- package/build/hooks/useLivestreamStreamer.d.ts.map +1 -0
- package/build/hooks/useLivestreamStreamer.js +31 -0
- package/build/hooks/useLivestreamStreamer.js.map +1 -0
- package/build/hooks/useLivestreamViewer.d.ts +27 -0
- package/build/hooks/useLivestreamViewer.d.ts.map +1 -0
- package/build/hooks/useLivestreamViewer.js +31 -0
- package/build/hooks/useLivestreamViewer.js.map +1 -0
- package/build/hooks/useSandbox.d.ts +7 -0
- package/build/hooks/useSandbox.d.ts.map +1 -1
- package/build/hooks/useSandbox.js +14 -0
- package/build/hooks/useSandbox.js.map +1 -1
- package/build/index.d.ts +10 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/build/components/LivestreamView.d.ts.map +0 -1
- package/build/components/LivestreamView.js +0 -10
- package/build/components/LivestreamView.js.map +0 -1
- package/build/hooks/useLivestream.d.ts +0 -6
- package/build/hooks/useLivestream.d.ts.map +0 -1
- package/build/hooks/useLivestream.js +0 -12
- package/build/hooks/useLivestream.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Props of the LivestreamView component
|
|
4
|
+
*/
|
|
5
|
+
export type LivestreamStreamerProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Styles of the LivestreamView component
|
|
8
|
+
*/
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Renders a video player playing the livestream set up with {@link useLivestreamStreamer} hook.
|
|
13
|
+
*
|
|
14
|
+
* @category Components
|
|
15
|
+
* @param {object} props
|
|
16
|
+
* @param {object} props.style
|
|
17
|
+
*/
|
|
18
|
+
export declare const LivestreamStreamer: ({ style }: LivestreamStreamerProps) => import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=LivestreamStreamer.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WhipClientView } from 'react-native-whip-whep';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a video player playing the livestream set up with {@link useLivestreamStreamer} hook.
|
|
4
|
+
*
|
|
5
|
+
* @category Components
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {object} props.style
|
|
8
|
+
*/
|
|
9
|
+
export const LivestreamStreamer = ({ style }) => (<WhipClientView style={style}/>);
|
|
10
|
+
//# sourceMappingURL=LivestreamStreamer.js.map
|
|
@@ -0,0 +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,11 +1,11 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { WhepClientViewRef } from 'react-native-whip-whep';
|
|
4
|
-
export type
|
|
4
|
+
export type LivestreamViewerRef = WhepClientViewRef;
|
|
5
5
|
/**
|
|
6
6
|
* Props of the LivestreamView component
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type LivestreamViewerProps = {
|
|
9
9
|
/**
|
|
10
10
|
* Styles of the LivestreamView component
|
|
11
11
|
*/
|
|
@@ -38,14 +38,14 @@ export type LivestreamViewProps = {
|
|
|
38
38
|
width: number;
|
|
39
39
|
height: number;
|
|
40
40
|
};
|
|
41
|
-
ref?: Ref<
|
|
41
|
+
ref?: Ref<LivestreamViewerRef>;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
|
-
* Renders a video player playing the livestream set up with {@link
|
|
44
|
+
* Renders a video player playing the livestream set up with {@link useLivestreamViewer} hook.
|
|
45
45
|
*
|
|
46
46
|
* @category Components
|
|
47
47
|
* @param {object} props
|
|
48
48
|
* @param {object} props.style
|
|
49
49
|
*/
|
|
50
|
-
export declare const
|
|
51
|
-
//# sourceMappingURL=
|
|
50
|
+
export declare const LivestreamViewer: ({ style, orientation, pipEnabled, autoStartPip, autoStopPip, pipSize, ref, }: LivestreamViewerProps) => import("react").JSX.Element;
|
|
51
|
+
//# sourceMappingURL=LivestreamViewer.d.ts.map
|
|
@@ -0,0 +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;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,gCAUvB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WhepClientView } from 'react-native-whip-whep';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a video player playing the livestream set up with {@link useLivestreamViewer} hook.
|
|
4
|
+
*
|
|
5
|
+
* @category Components
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {object} props.style
|
|
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}/>);
|
|
10
|
+
//# sourceMappingURL=LivestreamViewer.js.map
|
|
@@ -0,0 +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"]}
|
package/build/consts/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const FISHJAM_HTTP_CONNECT_URL = "https://fishjam.io/api/v1/connect";
|
|
2
2
|
export declare const FISHJAM_WS_CONNECT_URL = "wss://fishjam.io/api/v1/connect";
|
|
3
|
+
export declare const FISHJAM_WHIP_URL = "https://fishjam.io/api/v1/live/api/whip";
|
|
4
|
+
export declare const FISHJAM_WHEP_URL = "https://fishjam.io/api/v1/live/api/whep";
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,sCAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,oCAAkC,CAAC;AAItE,eAAO,MAAM,gBAAgB,4CAAiC,CAAC;AAC/D,eAAO,MAAM,gBAAgB,4CAAiC,CAAC"}
|
package/build/consts/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const FISHJAM_URL_BASE = 'fishjam.io/api/v1';
|
|
2
|
+
const FISHJAM_CONNECT_PATH = `${FISHJAM_URL_BASE}/connect`;
|
|
2
3
|
export const FISHJAM_HTTP_CONNECT_URL = `https://${FISHJAM_CONNECT_PATH}`;
|
|
3
4
|
export const FISHJAM_WS_CONNECT_URL = `wss://${FISHJAM_CONNECT_PATH}`;
|
|
5
|
+
const FISHJAM_LIVE_URL = `https://${FISHJAM_URL_BASE}/live`;
|
|
6
|
+
export const FISHJAM_WHIP_URL = `${FISHJAM_LIVE_URL}/api/whip`;
|
|
7
|
+
export const FISHJAM_WHEP_URL = `${FISHJAM_LIVE_URL}/api/whep`;
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consts/index.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAC7C,MAAM,oBAAoB,GAAG,GAAG,gBAAgB,UAAU,CAAC;AAE3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,oBAAoB,EAAE,CAAC;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,oBAAoB,EAAE,CAAC;AAEtE,MAAM,gBAAgB,GAAG,WAAW,gBAAgB,OAAO,CAAC;AAE5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,gBAAgB,WAAW,CAAC;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,gBAAgB,WAAW,CAAC","sourcesContent":["const FISHJAM_URL_BASE = 'fishjam.io/api/v1';\nconst FISHJAM_CONNECT_PATH = `${FISHJAM_URL_BASE}/connect`;\n\nexport const FISHJAM_HTTP_CONNECT_URL = `https://${FISHJAM_CONNECT_PATH}`;\nexport const FISHJAM_WS_CONNECT_URL = `wss://${FISHJAM_CONNECT_PATH}`;\n\nconst FISHJAM_LIVE_URL = `https://${FISHJAM_URL_BASE}/live`;\n\nexport const FISHJAM_WHIP_URL = `${FISHJAM_LIVE_URL}/api/whip`;\nexport const FISHJAM_WHEP_URL = `${FISHJAM_LIVE_URL}/api/whep`;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Camera } from 'react-native-whip-whep';
|
|
2
|
+
/**
|
|
3
|
+
* @category Livestream
|
|
4
|
+
*/
|
|
5
|
+
export interface useLivestreamStreamerResult {
|
|
6
|
+
/**
|
|
7
|
+
* Callback used to start publishing the selected audio and video media streams.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Calling {@link connect} multiple times will have the effect of only publishing the **last** specified inputs.
|
|
11
|
+
*/
|
|
12
|
+
connect: (token: string, urlOverride?: string) => Promise<void>;
|
|
13
|
+
/** Callback to stop publishing anything previously published with {@link connect} */
|
|
14
|
+
disconnect: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}
|
|
18
|
+
* @category Livestream
|
|
19
|
+
* @group Hooks
|
|
20
|
+
*/
|
|
21
|
+
export declare const useLivestreamStreamer: ({ camera, }: {
|
|
22
|
+
camera?: Camera;
|
|
23
|
+
}) => useLivestreamStreamerResult;
|
|
24
|
+
//# sourceMappingURL=useLivestreamStreamer.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { connectWhipClient, createWhipClient, disconnectWhipClient, cameras, } from 'react-native-whip-whep';
|
|
3
|
+
import { FISHJAM_WHIP_URL } from '../consts';
|
|
4
|
+
/**
|
|
5
|
+
* Hook for publishing a livestream, which can be then received with {@link useLivestreamViewer}
|
|
6
|
+
* @category Livestream
|
|
7
|
+
* @group Hooks
|
|
8
|
+
*/
|
|
9
|
+
export const useLivestreamStreamer = ({ camera, }) => {
|
|
10
|
+
const isWhipClientCreatedRef = useRef(false);
|
|
11
|
+
const connect = useCallback(async (token, urlOverride) => {
|
|
12
|
+
if (isWhipClientCreatedRef.current) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const resolvedUrl = urlOverride ?? FISHJAM_WHIP_URL;
|
|
16
|
+
createWhipClient(resolvedUrl, {
|
|
17
|
+
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
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
return { connect, disconnect };
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useLivestreamStreamer.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ConnectViewerConfig = {
|
|
2
|
+
token: string;
|
|
3
|
+
streamId?: never;
|
|
4
|
+
} | {
|
|
5
|
+
streamId: string;
|
|
6
|
+
token?: never;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @category Livestream
|
|
10
|
+
*/
|
|
11
|
+
export interface useLivestreamViewerResult {
|
|
12
|
+
/**
|
|
13
|
+
* Callback to start receiving a livestream.
|
|
14
|
+
* If the livestream is private, provide `token`.
|
|
15
|
+
* If the livestream is public, provide `streamId`.
|
|
16
|
+
*/
|
|
17
|
+
connect: (config: ConnectViewerConfig, url?: string) => Promise<void>;
|
|
18
|
+
/** Disconnect from a stream previously connected to with {@link connect} */
|
|
19
|
+
disconnect: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hook for receiving a published livestream.
|
|
23
|
+
* @category Livestream
|
|
24
|
+
* @group Hooks
|
|
25
|
+
*/
|
|
26
|
+
export declare const useLivestreamViewer: () => useLivestreamViewerResult;
|
|
27
|
+
//# sourceMappingURL=useLivestreamViewer.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { connectWhepClient, createWhepClient, disconnectWhepClient, } from 'react-native-whip-whep';
|
|
3
|
+
import { FISHJAM_WHEP_URL } from '../consts';
|
|
4
|
+
const urlFromConfig = (config) => {
|
|
5
|
+
if (config.streamId)
|
|
6
|
+
return `${FISHJAM_WHEP_URL}/${config.streamId}`;
|
|
7
|
+
return FISHJAM_WHEP_URL;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Hook for receiving a published livestream.
|
|
11
|
+
* @category Livestream
|
|
12
|
+
* @group Hooks
|
|
13
|
+
*/
|
|
14
|
+
export const useLivestreamViewer = () => {
|
|
15
|
+
const isWhepClientCreatedRef = useRef(false);
|
|
16
|
+
const connect = useCallback(async (config, url) => {
|
|
17
|
+
createWhepClient(url ?? urlFromConfig(config), {
|
|
18
|
+
authToken: config.token,
|
|
19
|
+
});
|
|
20
|
+
isWhepClientCreatedRef.current = true;
|
|
21
|
+
await connectWhepClient();
|
|
22
|
+
}, []);
|
|
23
|
+
const disconnect = useCallback(() => {
|
|
24
|
+
// TODO: Remove when FCE-1786 fixed
|
|
25
|
+
if (isWhepClientCreatedRef.current) {
|
|
26
|
+
disconnectWhepClient();
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
return { connect, disconnect };
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useLivestreamViewer.js.map
|
|
@@ -0,0 +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};\n"]}
|
|
@@ -9,5 +9,12 @@ export type UseSandboxProps = {
|
|
|
9
9
|
export declare const useSandbox: ({ fishjamId, fishjamUrl }: UseSandboxProps) => {
|
|
10
10
|
getSandboxPeerToken: (roomName: string, peerName: string, roomType?: RoomType) => Promise<string>;
|
|
11
11
|
getSandboxViewerToken: (roomName: string) => Promise<string>;
|
|
12
|
+
getSandboxLivestream: (roomName: string, isPublic?: boolean) => Promise<{
|
|
13
|
+
streamerToken: string;
|
|
14
|
+
room: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
12
19
|
};
|
|
13
20
|
//# sourceMappingURL=useSandbox.d.ts.map
|
|
@@ -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;
|
|
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"}
|
|
@@ -34,9 +34,23 @@ export const useSandbox = ({ fishjamId, fishjamUrl }) => {
|
|
|
34
34
|
throw new Error(`Failed to get viewer token for room '${roomName}': ${error instanceof Error ? error.message : String(error)}`);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
const getSandboxLivestream = async (roomName, isPublic = false) => {
|
|
38
|
+
const url = new URL(`${managerUrl}/livestream`);
|
|
39
|
+
url.searchParams.set('roomName', roomName);
|
|
40
|
+
url.searchParams.set('public', isPublic.toString());
|
|
41
|
+
console.log({ sanurl: url.toString() });
|
|
42
|
+
const res = await fetch(url);
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
console.log(await res.json());
|
|
45
|
+
throw new Error(`Failed to retrieve streamer token for '${roomName}' livestream room.`);
|
|
46
|
+
}
|
|
47
|
+
const data = await res.json();
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
37
50
|
return {
|
|
38
51
|
getSandboxPeerToken,
|
|
39
52
|
getSandboxViewerToken,
|
|
53
|
+
getSandboxLivestream,
|
|
40
54
|
};
|
|
41
55
|
};
|
|
42
56
|
//# sourceMappingURL=useSandbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSandbox.js","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AAAA,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,KAAK,EAC/B,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,EAAE,QAAQ,CAAC,CAAC;YAC3C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAE3C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAExC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CACb,SAAS,QAAQ,cAAc,QAAQ,iDAAiD,CACzF,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,GAAwB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACnD,OAA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C;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"]}
|
package/build/index.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ joinRoom,
|
|
|
8
8
|
leaveRoom, } from './common/client';
|
|
9
9
|
export type { VideoPreviewViewProps } from './components/VideoPreviewView';
|
|
10
10
|
export type { VideoRendererProps } from './components/VideoRendererView';
|
|
11
|
-
export type {
|
|
11
|
+
export type { LivestreamViewerProps, LivestreamViewerRef, } from './components/LivestreamViewer';
|
|
12
12
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
13
13
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
14
|
-
export {
|
|
14
|
+
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
15
|
+
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
15
16
|
export type { Peer, PeerId, Track, TrackId, TrackType, VadStatus, EncodingReason, TrackBase, AudioTrack, VideoTrack, UsePeersResult, PeerWithTracks, PeerTrackMetadata, DistinguishedTracks, } from './hooks/usePeers';
|
|
16
17
|
export type { AudioOutputDevice, AudioOutputDeviceType, AudioSessionMode, } from './hooks/useAudioSettings';
|
|
17
18
|
export type { CameraId, Camera, CameraConfig, VideoQuality, CameraFacingDirection, CameraConfigBase, } from './hooks/useCamera';
|
|
@@ -19,8 +20,11 @@ export type { ScreenShareOptions, ScreenShareQuality, } from './hooks/useScreenS
|
|
|
19
20
|
export type { ForegroundServiceConfig } from './hooks/useForegroundService';
|
|
20
21
|
export type { JoinRoomConfig, ReconnectionStatus, PeerStatus, } from './hooks/useConnection';
|
|
21
22
|
export type { AppScreenShareData } from './hooks/useAppScreenShare';
|
|
22
|
-
export type {
|
|
23
|
+
export type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';
|
|
24
|
+
export type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';
|
|
23
25
|
export type { UseSandboxProps } from './hooks/useSandbox';
|
|
26
|
+
export type { LivestreamStreamerProps } from './components/LivestreamStreamer';
|
|
27
|
+
export type { ConnectViewerConfig } from './hooks/useLivestreamViewer';
|
|
24
28
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
25
29
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
26
30
|
export { useCamera } from './hooks/useCamera';
|
|
@@ -33,8 +37,10 @@ export { usePeers } from './hooks/usePeers';
|
|
|
33
37
|
export { useForegroundService } from './hooks/useForegroundService';
|
|
34
38
|
export { useConnection } from './hooks/useConnection';
|
|
35
39
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
36
|
-
export {
|
|
40
|
+
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
41
|
+
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
37
42
|
export { useSandbox } from './hooks/useSandbox';
|
|
43
|
+
export { cameras } from 'react-native-whip-whep';
|
|
38
44
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
39
45
|
export type { FishjamRoomProps } from './components/FishjamRoom';
|
|
40
46
|
export { FishjamRoom } from './components/FishjamRoom';
|
package/build/index.d.ts.map
CHANGED
|
@@ -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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AAM,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,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,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
|
@@ -9,7 +9,8 @@ joinRoom,
|
|
|
9
9
|
leaveRoom, } from './common/client';
|
|
10
10
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
11
11
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
12
|
-
export {
|
|
12
|
+
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
13
|
+
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
13
14
|
// #endregion
|
|
14
15
|
// #region hooks
|
|
15
16
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
@@ -24,8 +25,10 @@ export { usePeers } from './hooks/usePeers';
|
|
|
24
25
|
export { useForegroundService } from './hooks/useForegroundService';
|
|
25
26
|
export { useConnection } from './hooks/useConnection';
|
|
26
27
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
27
|
-
export {
|
|
28
|
+
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
29
|
+
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
28
30
|
export { useSandbox } from './hooks/useSandbox';
|
|
31
|
+
export { cameras } from 'react-native-whip-whep';
|
|
29
32
|
// #endregion
|
|
30
33
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
31
34
|
export { FishjamRoom } from './components/FishjamRoom';
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,kBAAkB;AAClB,QAAQ;AACR,kBAAkB;AAClB,SAAS,GACV,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,
|
|
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,kBAAkB;AAClB,QAAQ;AACR,kBAAkB;AAClB,SAAS,GACV,MAAM,iBAAiB,CAAC;AAWzB,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;AAoDrE,aAAa;AAEb,gBAAgB;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,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,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"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LivestreamView.d.ts","sourceRoot":"","sources":["../../src/components/LivestreamView.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,iBAAiB,GAAG,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;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,iBAAiB,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,8EAQ5B,mBAAmB,gCAUrB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { WhepClientView } from 'react-native-whip-whep';
|
|
2
|
-
/**
|
|
3
|
-
* Renders a video player playing the livestream set up with {@link useLivestream} hook.
|
|
4
|
-
*
|
|
5
|
-
* @category Components
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {object} props.style
|
|
8
|
-
*/
|
|
9
|
-
export const LivestreamView = ({ style, orientation, pipEnabled, autoStartPip, autoStopPip, pipSize, ref, }) => (<WhepClientView ref={ref} style={style} orientation={orientation} pipEnabled={pipEnabled} autoStartPip={autoStartPip} autoStopPip={autoStopPip} pipSize={pipSize}/>);
|
|
10
|
-
//# sourceMappingURL=LivestreamView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LivestreamView.js","sourceRoot":"","sources":["../../src/components/LivestreamView.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAC;AA4C3E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,GAAG,GACiB,EAAE,EAAE,CAAC,CACzB,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 LivestreamViewRef = WhepClientViewRef;\n\n/**\n * Props of the LivestreamView component\n */\nexport type LivestreamViewProps = {\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<LivestreamViewRef>;\n};\n\n/**\n * Renders a video player playing the livestream set up with {@link useLivestream} hook.\n *\n * @category Components\n * @param {object} props\n * @param {object} props.style\n */\nexport const LivestreamView = ({\n style,\n orientation,\n pipEnabled,\n autoStartPip,\n autoStopPip,\n pipSize,\n ref,\n}: LivestreamViewProps) => (\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLivestream.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestream.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,QAAO,mBAShC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { connectWhepClient, createWhepClient, disconnectWhepClient, } from 'react-native-whip-whep';
|
|
3
|
-
export const useLivestream = () => {
|
|
4
|
-
const connect = useCallback(async (url, token) => {
|
|
5
|
-
createWhepClient(url, {
|
|
6
|
-
authToken: token,
|
|
7
|
-
});
|
|
8
|
-
await connectWhepClient();
|
|
9
|
-
}, []);
|
|
10
|
-
return { connect, disconnect: disconnectWhepClient };
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=useLivestream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLivestream.js","sourceRoot":"","sources":["../../src/hooks/useLivestream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAOhC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAwB,EAAE;IACrD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,GAAW,EAAE,KAAa,EAAE,EAAE;QAC/D,gBAAgB,CAAC,GAAG,EAAE;YACpB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QACH,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport {\n connectWhepClient,\n createWhepClient,\n disconnectWhepClient,\n} from 'react-native-whip-whep';\n\nexport interface UseLivestreamResult {\n connect: (url: string, token: string) => Promise<void>;\n disconnect: () => void;\n}\n\nexport const useLivestream = (): UseLivestreamResult => {\n const connect = useCallback(async (url: string, token: string) => {\n createWhepClient(url, {\n authToken: token,\n });\n await connectWhepClient();\n }, []);\n\n return { connect, disconnect: disconnectWhepClient };\n};\n"]}
|