@fishjam-cloud/react-native-client 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/RNFishjamClientModule.d.ts +9 -4
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js +1 -0
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/components/FishjamRoom/index.d.ts +6 -6
- package/build/components/FishjamRoom/index.d.ts.map +1 -1
- package/build/components/FishjamRoom/index.js +8 -10
- package/build/components/FishjamRoom/index.js.map +1 -1
- package/build/hooks/internal/useFishjamEvent.d.ts.map +1 -1
- package/build/hooks/internal/useFishjamEvent.js +3 -0
- package/build/hooks/internal/useFishjamEvent.js.map +1 -1
- package/build/hooks/useCallKit.d.ts +121 -0
- package/build/hooks/useCallKit.d.ts.map +1 -0
- package/build/hooks/useCallKit.js +142 -0
- package/build/hooks/useCallKit.js.map +1 -0
- package/build/hooks/useConnection.d.ts +20 -16
- package/build/hooks/useConnection.d.ts.map +1 -1
- package/build/hooks/useConnection.js +10 -11
- package/build/hooks/useConnection.js.map +1 -1
- package/build/hooks/useSandbox.d.ts +3 -3
- package/build/hooks/useSandbox.d.ts.map +1 -1
- package/build/hooks/useSandbox.js +3 -5
- package/build/hooks/useSandbox.js.map +1 -1
- package/build/index.d.ts +4 -17
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -10
- package/build/index.js.map +1 -1
- package/build/livestream/components/LivestreamStreamer.d.ts.map +1 -0
- package/build/livestream/components/LivestreamStreamer.js.map +1 -0
- package/build/livestream/components/LivestreamViewer.d.ts.map +1 -0
- package/build/livestream/components/LivestreamViewer.js.map +1 -0
- package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +1 -0
- package/build/{hooks → livestream/hooks}/useLivestreamStreamer.js +1 -1
- package/build/livestream/hooks/useLivestreamStreamer.js.map +1 -0
- package/build/livestream/hooks/useLivestreamViewer.d.ts.map +1 -0
- package/build/{hooks → livestream/hooks}/useLivestreamViewer.js +1 -1
- package/build/livestream/hooks/useLivestreamViewer.js.map +1 -0
- package/build/livestream/index.d.ts +11 -0
- package/build/livestream/index.d.ts.map +1 -0
- package/build/livestream/index.js +6 -0
- package/build/livestream/index.js.map +1 -0
- package/build/utils/config.d.ts +6 -0
- package/build/utils/config.d.ts.map +1 -0
- package/build/utils/config.js +10 -0
- package/build/utils/config.js.map +1 -0
- package/build/utils/eventPayloadValidator.d.ts.map +1 -1
- package/build/utils/eventPayloadValidator.js +17 -1
- package/build/utils/eventPayloadValidator.js.map +1 -1
- package/build/utils/getFishjamUrl.d.ts +2 -0
- package/build/utils/getFishjamUrl.d.ts.map +1 -0
- package/build/utils/getFishjamUrl.js +10 -0
- package/build/utils/getFishjamUrl.js.map +1 -0
- package/ios/Events.swift +26 -0
- package/ios/RNFishjamClient.swift +40 -4
- package/ios/RNFishjamClientModule.swift +221 -211
- package/livestream/package.json +4 -0
- package/package.json +2 -1
- package/plugin/build/types.d.ts +1 -0
- package/plugin/build/withFishjamIos.js +12 -0
- package/build/common/client.d.ts +0 -25
- package/build/common/client.d.ts.map +0 -1
- package/build/common/client.js +0 -14
- package/build/common/client.js.map +0 -1
- package/build/components/LivestreamStreamer.d.ts.map +0 -1
- package/build/components/LivestreamStreamer.js.map +0 -1
- package/build/components/LivestreamViewer.d.ts.map +0 -1
- package/build/components/LivestreamViewer.js.map +0 -1
- package/build/hooks/useLivestreamStreamer.d.ts.map +0 -1
- package/build/hooks/useLivestreamStreamer.js.map +0 -1
- package/build/hooks/useLivestreamViewer.d.ts.map +0 -1
- package/build/hooks/useLivestreamViewer.js.map +0 -1
- /package/build/{components → livestream/components}/LivestreamStreamer.d.ts +0 -0
- /package/build/{components → livestream/components}/LivestreamStreamer.js +0 -0
- /package/build/{components → livestream/components}/LivestreamViewer.d.ts +0 -0
- /package/build/{components → livestream/components}/LivestreamViewer.js +0 -0
- /package/build/{hooks → livestream/hooks}/useLivestreamStreamer.d.ts +0 -0
- /package/build/{hooks → livestream/hooks}/useLivestreamViewer.d.ts +0 -0
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { joinRoom as joinRoomClient, leaveRoom as leaveRoomClient, } from '../common/client';
|
|
3
2
|
import RNFishjamClientModule, { ReceivableEvents, } from '../RNFishjamClientModule';
|
|
4
3
|
import { useFishjamEventState } from './internal/useFishjamEventState';
|
|
5
|
-
import {
|
|
4
|
+
import { getFishjamUrl } from '../utils/getFishjamUrl';
|
|
6
5
|
function useConnectionStatus() {
|
|
7
6
|
const peerStatus = useFishjamEventState(ReceivableEvents.PeerStatusChanged, RNFishjamClientModule.peerStatus);
|
|
8
7
|
const reconnectionStatus = useFishjamEventState(ReceivableEvents.ReconnectionStatusChanged, RNFishjamClientModule.reconnectionStatus);
|
|
9
8
|
return { peerStatus, reconnectionStatus };
|
|
10
9
|
}
|
|
10
|
+
async function joinRoomClient(url, peerToken, peerMetadata, config) {
|
|
11
|
+
await RNFishjamClientModule.joinRoom(url, peerToken, peerMetadata ?? {}, config ?? {});
|
|
12
|
+
}
|
|
13
|
+
async function leaveRoomClient() {
|
|
14
|
+
await RNFishjamClientModule.leaveRoom();
|
|
15
|
+
}
|
|
11
16
|
/**
|
|
12
17
|
* Connect/leave room. And get connection status.
|
|
13
18
|
* @group Hooks
|
|
@@ -15,15 +20,9 @@ function useConnectionStatus() {
|
|
|
15
20
|
*/
|
|
16
21
|
export function useConnection() {
|
|
17
22
|
const { peerStatus, reconnectionStatus } = useConnectionStatus();
|
|
18
|
-
const joinRoom = useCallback(async ({
|
|
19
|
-
const connectUrl = fishjamId
|
|
20
|
-
|
|
21
|
-
: undefined;
|
|
22
|
-
const fishjamUrl = fishjamId ? connectUrl : url;
|
|
23
|
-
if (!fishjamUrl) {
|
|
24
|
-
throw new Error('Either fishjamId or url must be provided to join the room.');
|
|
25
|
-
}
|
|
26
|
-
await joinRoomClient(fishjamUrl, peerToken, peerMetadata, config);
|
|
23
|
+
const joinRoom = useCallback(async ({ peerToken, peerMetadata, config, fishjamId, }) => {
|
|
24
|
+
const connectUrl = getFishjamUrl(fishjamId);
|
|
25
|
+
await joinRoomClient(connectUrl, peerToken, peerMetadata, config);
|
|
27
26
|
}, []);
|
|
28
27
|
const leaveRoom = useCallback(() => {
|
|
29
28
|
leaveRoomClient();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnection.js","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"useConnection.js","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,qBAAqB,EAAE,EAC5B,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAqBvD,SAAS,mBAAmB;IAC1B,MAAM,UAAU,GAAG,oBAAoB,CACrC,gBAAgB,CAAC,iBAAiB,EAClC,qBAAqB,CAAC,UAAU,CACjC,CAAC;IAEF,MAAM,kBAAkB,GAAG,oBAAoB,CAC7C,gBAAgB,CAAC,yBAAyB,EAC1C,qBAAqB,CAAC,kBAAkB,CACzC,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;AAC5C,CAAC;AAuCD,KAAK,UAAU,cAAc,CAG3B,GAAW,EACX,SAAiB,EACjB,YAA2B,EAC3B,MAAyB;IAEzB,MAAM,qBAAqB,CAAC,QAAQ,CAClC,GAAG,EACH,SAAS,EACT,YAAY,IAAI,EAAE,EAClB,MAAM,IAAI,EAAE,CACb,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,eAAe;IAC5B,MAAM,qBAAqB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAEjE,MAAM,QAAQ,GAAG,WAAW,CAC1B,KAAK,EAA0D,EAC7D,SAAS,EACT,YAAY,EACZ,MAAM,EACN,SAAS,GACoB,EAAE,EAAE;QACjC,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAE5C,MAAM,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,eAAe,EAAE,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL;;;;WAIG;QACH,QAAQ;QACR;;;WAGG;QACH,SAAS;QACT,UAAU;QACV,kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport RNFishjamClientModule, {\n ReceivableEvents,\n} from '../RNFishjamClientModule';\nimport { useFishjamEventState } from './internal/useFishjamEventState';\nimport { GenericMetadata } from '../types';\nimport { getFishjamUrl } from '../utils/getFishjamUrl';\n\n/**\n * Represents the possible statuses of a peer while reconnecting to room\n *\n * - `idle` - No reconnection in progress. See {@link PeerStatus} for more details\n * - `reconnecting` - Peer is in the process of reconnecting.\n * - `error` - There was an error in the reconnection process.\n */\nexport type ReconnectionStatus = 'idle' | 'reconnecting' | 'error';\n\n/**\n * Represents the possible statuses of a peer connection to a room (websocket state).\n *\n * - `idle` - Peer is not connected, either never connected or successfully disconnected.\n * - `connecting` - Peer is in the process of connecting.\n * - `connected` - Peer has successfully connected.\n * - `error` - There was an error in the connection process.\n */\nexport type PeerStatus = 'connecting' | 'connected' | 'error' | 'idle';\n\nfunction useConnectionStatus() {\n const peerStatus = useFishjamEventState(\n ReceivableEvents.PeerStatusChanged,\n RNFishjamClientModule.peerStatus,\n );\n\n const reconnectionStatus = useFishjamEventState(\n ReceivableEvents.ReconnectionStatusChanged,\n RNFishjamClientModule.reconnectionStatus,\n );\n\n return { peerStatus, reconnectionStatus };\n}\nexport type JoinRoomConfig<\n PeerMetadata extends GenericMetadata = GenericMetadata,\n> = {\n /**\n * Fishjam ID, which is used to connect to the room.\n * You can get it at https://fishjam.io/app\n */\n fishjamId: string;\n /**\n * Token received from server (or Room Manager)\n */\n peerToken: string;\n /**\n * String indexed record with metadata, that will be available to all other peers\n */\n peerMetadata?: PeerMetadata;\n /**\n * Additional connection configuration\n */\n config?: ConnectionConfig;\n};\n\nexport type ConnectionConfig = {\n /**\n * Configuration for automatic reconnection\n * sdk uses a linear backoff algorithm, that is the formula\n * for the delay of the nth attempt is\n * n * delayMs + initialDelayMs\n *\n * Pass 0 for maxAttempts to disable automatic reconnection\n */\n reconnectConfig?: {\n maxAttempts?: number;\n initialDelayMs?: number;\n delayMs?: number;\n };\n};\n\nasync function joinRoomClient<\n PeerMetadata extends GenericMetadata = GenericMetadata,\n>(\n url: string,\n peerToken: string,\n peerMetadata?: PeerMetadata,\n config?: ConnectionConfig,\n) {\n await RNFishjamClientModule.joinRoom(\n url,\n peerToken,\n peerMetadata ?? {},\n config ?? {},\n );\n}\n\nasync function leaveRoomClient() {\n await RNFishjamClientModule.leaveRoom();\n}\n\n/**\n * Connect/leave room. And get connection status.\n * @group Hooks\n * @category Connection\n */\nexport function useConnection() {\n const { peerStatus, reconnectionStatus } = useConnectionStatus();\n\n const joinRoom = useCallback(\n async <PeerMetadata extends GenericMetadata = GenericMetadata>({\n peerToken,\n peerMetadata,\n config,\n fishjamId,\n }: JoinRoomConfig<PeerMetadata>) => {\n const connectUrl = getFishjamUrl(fishjamId);\n\n await joinRoomClient(connectUrl, peerToken, peerMetadata, config);\n },\n [],\n );\n\n const leaveRoom = useCallback(() => {\n leaveRoomClient();\n }, []);\n\n return {\n /**\n * Join room and start streaming camera and microphone\n *\n * See {@link JoinRoomConfig} for parameter list\n */\n joinRoom,\n /**\n * Leave room and stop streaming\n * @type function\n */\n leaveRoom,\n peerStatus,\n reconnectionStatus,\n };\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RoomType } from '../types';
|
|
2
2
|
export type UseSandboxProps = {
|
|
3
3
|
fishjamId: string;
|
|
4
|
-
|
|
4
|
+
sandboxApiUrl?: never;
|
|
5
5
|
} | {
|
|
6
6
|
fishjamId?: never;
|
|
7
|
-
|
|
7
|
+
sandboxApiUrl: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const useSandbox: ({ fishjamId,
|
|
9
|
+
export declare const useSandbox: ({ fishjamId, sandboxApiUrl }: UseSandboxProps) => {
|
|
10
10
|
getSandboxPeerToken: (roomName: string, peerName: string, roomType?: RoomType) => Promise<string>;
|
|
11
11
|
getSandboxViewerToken: (roomName: string) => Promise<string>;
|
|
12
12
|
getSandboxLivestream: (roomName: string, isPublic?: boolean) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSandbox.d.ts","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSandbox.d.ts","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAWpC,MAAM,MAAM,eAAe,GACvB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,eAAO,MAAM,UAAU,GAAI,8BAA8B,eAAe;oCAMxD,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,7 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export const useSandbox = ({ fishjamId,
|
|
4
|
-
const managerUrl =
|
|
5
|
-
? `${fishjamUrl}/room-manager`
|
|
6
|
-
: `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}/room-manager`;
|
|
2
|
+
import { getFishjamUrl } from '../utils/getFishjamUrl';
|
|
3
|
+
export const useSandbox = ({ fishjamId, sandboxApiUrl }) => {
|
|
4
|
+
const managerUrl = sandboxApiUrl ?? `${getFishjamUrl(fishjamId)}/room-manager`;
|
|
7
5
|
const getSandboxPeerToken = useCallback(async (roomName, peerName, roomType = 'conference') => {
|
|
8
6
|
try {
|
|
9
7
|
const url = new URL(managerUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSandbox.js","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useSandbox.js","sourceRoot":"","sources":["../../src/hooks/useSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAcvD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAmB,EAAE,EAAE;IAC1E,MAAM,UAAU,GACd,aAAa,IAAI,GAAG,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC;IAE9D,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,C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E,CAAC;YAEjD,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,wCAAwC,QAAQ,MAC9C,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 { RoomType } from '../types';\nimport { getFishjamUrl } from '../utils/getFishjamUrl';\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; sandboxApiUrl?: never }\n | { fishjamId?: never; sandboxApiUrl: string };\n\nexport const useSandbox = ({ fishjamId, sandboxApiUrl }: UseSandboxProps) => {\n const managerUrl =\n sandboxApiUrl ?? `${getFishjamUrl(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
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
export type { SimulcastConfig, VideoLayout, GenericMetadata, TrackMetadata, Brand, RoomType, } from './types';
|
|
2
|
-
export type { ConnectionConfig } from './common/client';
|
|
3
2
|
export { updatePeerMetadata } from './common/metadata';
|
|
4
|
-
export {
|
|
5
|
-
/** @deprecated */
|
|
6
|
-
joinRoom,
|
|
7
|
-
/** @deprecated */
|
|
8
|
-
leaveRoom, } from './common/client';
|
|
9
3
|
export type { VideoPreviewViewProps } from './components/VideoPreviewView';
|
|
10
4
|
export type { VideoRendererProps } from './components/VideoRendererView';
|
|
11
|
-
export type { LivestreamViewerProps, LivestreamViewerRef, } from './components/LivestreamViewer';
|
|
12
5
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
13
6
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
14
|
-
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
15
|
-
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
16
7
|
export type { Peer, PeerId, Track, TrackId, TrackType, VadStatus, EncodingReason, TrackBase, AudioTrack, VideoTrack, UsePeersResult, PeerWithTracks, PeerTrackMetadata, DistinguishedTracks, } from './hooks/usePeers';
|
|
17
8
|
export type { AudioOutputDevice, AudioOutputDeviceType, AudioSessionMode, } from './hooks/useAudioSettings';
|
|
18
9
|
export type { CameraId, Camera, CameraConfig, VideoQuality, CameraFacingDirection, CameraConfigBase, } from './hooks/useCamera';
|
|
19
10
|
export type { ScreenShareOptions, ScreenShareQuality, } from './hooks/useScreenShare';
|
|
20
11
|
export type { ForegroundServiceConfig } from './hooks/useForegroundService';
|
|
21
|
-
export type { JoinRoomConfig, ReconnectionStatus, PeerStatus, } from './hooks/useConnection';
|
|
12
|
+
export type { JoinRoomConfig, ReconnectionStatus, PeerStatus, ConnectionConfig, } from './hooks/useConnection';
|
|
22
13
|
export type { AppScreenShareData } from './hooks/useAppScreenShare';
|
|
23
|
-
export type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';
|
|
24
|
-
export type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';
|
|
25
14
|
export type { UseSandboxProps } from './hooks/useSandbox';
|
|
26
|
-
export type {
|
|
27
|
-
export type { ConnectViewerConfig } from './hooks/useLivestreamViewer';
|
|
15
|
+
export type { UseCallKitResult, CallKitConfig, CallKitAction, } from './hooks/useCallKit';
|
|
28
16
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
29
17
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
30
18
|
export { useCamera } from './hooks/useCamera';
|
|
@@ -37,11 +25,10 @@ export { usePeers } from './hooks/usePeers';
|
|
|
37
25
|
export { useForegroundService } from './hooks/useForegroundService';
|
|
38
26
|
export { useConnection } from './hooks/useConnection';
|
|
39
27
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
40
|
-
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
41
|
-
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
42
28
|
export { useSandbox } from './hooks/useSandbox';
|
|
43
|
-
export {
|
|
29
|
+
export { useCallKitService, useCallKit, useCallKitEvent, } from './hooks/useCallKit';
|
|
44
30
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
45
31
|
export type { FishjamRoomProps } from './components/FishjamRoom';
|
|
46
32
|
export { FishjamRoom } from './components/FishjamRoom';
|
|
33
|
+
export { setOverwriteDebugConfig, DebugConfig } from './utils/config';
|
|
47
34
|
//# sourceMappingURL=index.d.ts.map
|
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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,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,oBAAoB,CAAC;AAI5B,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,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,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;AAKvD,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -2,15 +2,8 @@ import { initializeWarningListener } from './utils/errorListener';
|
|
|
2
2
|
// #endregion
|
|
3
3
|
// #region methods
|
|
4
4
|
export { updatePeerMetadata } from './common/metadata';
|
|
5
|
-
export {
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
joinRoom,
|
|
8
|
-
/** @deprecated */
|
|
9
|
-
leaveRoom, } from './common/client';
|
|
10
5
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
11
6
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
12
|
-
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
13
|
-
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
14
7
|
// #endregion
|
|
15
8
|
// #region hooks
|
|
16
9
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
@@ -25,12 +18,12 @@ export { usePeers } from './hooks/usePeers';
|
|
|
25
18
|
export { useForegroundService } from './hooks/useForegroundService';
|
|
26
19
|
export { useConnection } from './hooks/useConnection';
|
|
27
20
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
28
|
-
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
29
|
-
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
30
21
|
export { useSandbox } from './hooks/useSandbox';
|
|
31
|
-
export {
|
|
22
|
+
export { useCallKitService, useCallKit, useCallKitEvent, } from './hooks/useCallKit';
|
|
32
23
|
// #endregion
|
|
33
24
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
34
25
|
export { FishjamRoom } from './components/FishjamRoom';
|
|
35
26
|
initializeWarningListener();
|
|
27
|
+
// Debug/config API
|
|
28
|
+
export { setOverwriteDebugConfig } from './utils/config';
|
|
36
29
|
//# sourceMappingURL=index.js.map
|
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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CA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';\n\n// #region types\nexport type {\n SimulcastConfig,\n VideoLayout,\n GenericMetadata,\n TrackMetadata,\n Brand,\n RoomType,\n} from './types';\n// #endregion\n\n// #region methods\nexport { updatePeerMetadata } from './common/metadata';\n\n// #region components\nexport type { VideoPreviewViewProps } from './components/VideoPreviewView';\nexport type { VideoRendererProps } from './components/VideoRendererView';\n\nexport { VideoPreviewView } from './components/VideoPreviewView';\nexport { VideoRendererView } from './components/VideoRendererView';\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 ConnectionConfig,\n} from './hooks/useConnection';\nexport type { AppScreenShareData } from './hooks/useAppScreenShare';\nexport type { UseSandboxProps } from './hooks/useSandbox';\nexport type {\n UseCallKitResult,\n CallKitConfig,\n CallKitAction,\n} from './hooks/useCallKit';\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 { useSandbox } from './hooks/useSandbox';\nexport {\n useCallKitService,\n useCallKit,\n useCallKitEvent,\n} from './hooks/useCallKit';\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\n// Debug/config API\nexport { setOverwriteDebugConfig, DebugConfig } from './utils/config';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivestreamStreamer.d.ts","sourceRoot":"","sources":["../../../src/livestream/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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivestreamStreamer.js","sourceRoot":"","sources":["../../../src/livestream/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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivestreamViewer.d.ts","sourceRoot":"","sources":["../../../src/livestream/components/LivestreamViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,8EAQ9B,qBAAqB,gCASvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivestreamViewer.js","sourceRoot":"","sources":["../../../src/livestream/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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivestreamStreamer.d.ts","sourceRoot":"","sources":["../../../src/livestream/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,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useRef } from 'react';
|
|
2
2
|
import { useWhipConnectionState } from 'react-native-whip-whep';
|
|
3
|
-
import { FISHJAM_WHIP_URL } from '
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivestreamStreamer.js","sourceRoot":"","sources":["../../../src/livestream/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,cAAc,CAAC;AAuBhD;;;;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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivestreamViewer.d.ts","sourceRoot":"","sources":["../../../src/livestream/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,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import { WhepClient, useWhepConnectionState } from 'react-native-whip-whep';
|
|
3
|
-
import { FISHJAM_WHEP_URL } from '
|
|
3
|
+
import { FISHJAM_WHEP_URL } from '../../consts';
|
|
4
4
|
const urlFromConfig = (config) => {
|
|
5
5
|
if (config.streamId)
|
|
6
6
|
return `${FISHJAM_WHEP_URL}/${config.streamId}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLivestreamViewer.js","sourceRoot":"","sources":["../../../src/livestream/hooks/useLivestreamViewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhD,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;AAkBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA8B,EAAE;IACjE,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,KAAK,WAAW,CAAC;IAE1C,MAAM,UAAU,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,UAAU,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC;gBAClC,YAAY,EAAE,IAAI;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC,CAAC;QACF,YAAY,EAAE,CAAC;QAEf,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,MAA2B,EAAE,GAAY,EAAE,EAAE;QAClD,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC;YAChC,SAAS,EAAE,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;YACvC,SAAS,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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
2
|
+
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
3
|
+
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
4
|
+
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
5
|
+
export { cameras, VideoParameters, WhipClient, WhepClient, } from 'react-native-whip-whep';
|
|
6
|
+
export type { LivestreamStreamerProps } from './components/LivestreamStreamer';
|
|
7
|
+
export type { ConnectViewerConfig } from './hooks/useLivestreamViewer';
|
|
8
|
+
export type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';
|
|
9
|
+
export type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';
|
|
10
|
+
export type { LivestreamViewerProps, LivestreamViewerRef, } from './components/LivestreamViewer';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/livestream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,YAAY,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,YAAY,EACV,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { LivestreamStreamer } from './components/LivestreamStreamer';
|
|
2
|
+
export { LivestreamViewer } from './components/LivestreamViewer';
|
|
3
|
+
export { useLivestreamViewer } from './hooks/useLivestreamViewer';
|
|
4
|
+
export { useLivestreamStreamer } from './hooks/useLivestreamStreamer';
|
|
5
|
+
export { cameras, VideoParameters, WhipClient, WhepClient, } from 'react-native-whip-whep';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/livestream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,wBAAwB,CAAC","sourcesContent":["export { LivestreamStreamer } from './components/LivestreamStreamer';\nexport { LivestreamViewer } from './components/LivestreamViewer';\nexport { useLivestreamViewer } from './hooks/useLivestreamViewer';\nexport { useLivestreamStreamer } from './hooks/useLivestreamStreamer';\nexport {\n cameras,\n VideoParameters,\n WhipClient,\n WhepClient,\n} from 'react-native-whip-whep';\nexport type { LivestreamStreamerProps } from './components/LivestreamStreamer';\nexport type { ConnectViewerConfig } from './hooks/useLivestreamViewer';\nexport type { useLivestreamViewerResult } from './hooks/useLivestreamViewer';\nexport type { useLivestreamStreamerResult } from './hooks/useLivestreamStreamer';\nexport type {\n LivestreamViewerProps,\n LivestreamViewerRef,\n} from './components/LivestreamViewer';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAE3E;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const debugConfig = {
|
|
2
|
+
validateEventPayloads: process.env.EXPO_PUBLIC_CHECK_EVENT_PAYLOAD ?? false,
|
|
3
|
+
};
|
|
4
|
+
export function setOverwriteDebugConfig(partial) {
|
|
5
|
+
Object.assign(debugConfig, partial);
|
|
6
|
+
}
|
|
7
|
+
export function getDebugConfig() {
|
|
8
|
+
return debugConfig;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,GAAgB;IAC/B,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,KAAK;CAC5E,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,OAA6B;IACnE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["export type DebugConfig = {\n validateEventPayloads: boolean;\n};\n\nconst debugConfig: DebugConfig = {\n validateEventPayloads: process.env.EXPO_PUBLIC_CHECK_EVENT_PAYLOAD ?? false,\n};\n\nexport function setOverwriteDebugConfig(partial: Partial<DebugConfig>): void {\n Object.assign(debugConfig, partial);\n}\n\nexport function getDebugConfig(): DebugConfig {\n return debugConfig;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventPayloadValidator.d.ts","sourceRoot":"","sources":["../../src/utils/eventPayloadValidator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"eventPayloadValidator.d.ts","sourceRoot":"","sources":["../../src/utils/eventPayloadValidator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAyClC,wBAAgB,0BAA0B,CACxC,CAAC,SAAS,MAAM,OAAO,gBAAgB,EACvC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CA8DzD"}
|
|
@@ -25,6 +25,13 @@ const TrackAspectRatioUpdatedEventSchema = z.object({
|
|
|
25
25
|
trackId: z.string(),
|
|
26
26
|
aspectRatio: z.number(),
|
|
27
27
|
});
|
|
28
|
+
const CallKitActionSchema = z.union([
|
|
29
|
+
z.object({ started: z.null() }),
|
|
30
|
+
z.object({ ended: z.null() }),
|
|
31
|
+
z.object({ failed: z.string() }),
|
|
32
|
+
z.object({ muted: z.boolean() }),
|
|
33
|
+
z.object({ held: z.boolean() }),
|
|
34
|
+
]);
|
|
28
35
|
export function validateNativeEventPayload(eventName, payload) {
|
|
29
36
|
switch (eventName) {
|
|
30
37
|
case ReceivableEvents.IsMicrophoneOn:
|
|
@@ -55,7 +62,13 @@ export function validateNativeEventPayload(eventName, payload) {
|
|
|
55
62
|
z.enum(['connecting', 'connected', 'error', 'idle']).parse(payload);
|
|
56
63
|
break;
|
|
57
64
|
case ReceivableEvents.ReconnectionStatusChanged:
|
|
58
|
-
z.enum([
|
|
65
|
+
z.enum([
|
|
66
|
+
'connecting',
|
|
67
|
+
'connected',
|
|
68
|
+
'error',
|
|
69
|
+
'reconnecting',
|
|
70
|
+
'idle',
|
|
71
|
+
]).parse(payload);
|
|
59
72
|
break;
|
|
60
73
|
case ReceivableEvents.CurrentCameraChanged:
|
|
61
74
|
CameraChangedEventSchema.parse(payload);
|
|
@@ -63,6 +76,9 @@ export function validateNativeEventPayload(eventName, payload) {
|
|
|
63
76
|
case ReceivableEvents.TrackAspectRatioUpdated:
|
|
64
77
|
TrackAspectRatioUpdatedEventSchema.parse(payload);
|
|
65
78
|
break;
|
|
79
|
+
case ReceivableEvents.CallKitActionPerformed:
|
|
80
|
+
CallKitActionSchema.parse(payload);
|
|
81
|
+
break;
|
|
66
82
|
default:
|
|
67
83
|
throw new Error(`Unknown event: ${eventName}`);
|
|
68
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventPayloadValidator.js","sourceRoot":"","sources":["../../src/utils/eventPayloadValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;CAClD,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,SA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C;YACpE,MAAM;QAER,KAAK,gBAAgB,CAAC,yBAAyB;YAC7C,CAAC,CAAC,IAAI,CAAC;gBACL,YAAY;gBACZ,WAAW;gBACX,OAAO;gBACP,cAAc;gBACd,MAAM;aACP,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAClB,MAAM;QAER,KAAK,gBAAgB,CAAC,oBAAoB;YACxC,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM;QAER,KAAK,gBAAgB,CAAC,uBAAuB;YAC3C,kCAAkC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAClD,MAAM;QAER,KAAK,gBAAgB,CAAC,sBAAsB;YAC1C,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACnC,MAAM;QAER;YACE,MAAM,IAAI,KAAK,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ReceivableEventPayloads,\n ReceivableEvents,\n} from '../RNFishjamClientModule';\n\nconst SimulcastConfigSchema = z.object({\n enabled: z.boolean(),\n activeEncodings: z.array(z.enum(['l', 'm', 'h'])),\n});\n\nconst AudioOutputDeviceSchema = z.object({\n name: z.string(),\n type: z.enum(['bluetooth', 'headset', 'speaker', 'earpiece']),\n});\n\nconst AudioDeviceEventSchema = z.object({\n availableDevices: z.array(AudioOutputDeviceSchema),\n selectedDevice: AudioOutputDeviceSchema.nullable(),\n});\n\nconst CameraSchema = z.object({\n id: z.string(),\n name: z.string(),\n facingDirection: z.enum(['front', 'back', 'unspecified']),\n});\n\nconst CameraChangedEventSchema = z.object({\n isCameraOn: z.boolean(),\n currentCamera: CameraSchema.nullable(),\n});\n\nconst TrackAspectRatioUpdatedEventSchema = z.object({\n trackId: z.string(),\n aspectRatio: z.number(),\n});\n\nconst CallKitActionSchema = z.union([\n z.object({ started: z.null() }),\n z.object({ ended: z.null() }),\n z.object({ failed: z.string() }),\n z.object({ muted: z.boolean() }),\n z.object({ held: z.boolean() }),\n]);\n\nexport function validateNativeEventPayload<\n T extends keyof typeof ReceivableEvents,\n>(eventName: T, payload: ReceivableEventPayloads[T]): void {\n switch (eventName) {\n case ReceivableEvents.IsMicrophoneOn:\n case ReceivableEvents.IsScreenShareOn:\n case ReceivableEvents.IsAppScreenShareOn:\n z.boolean().parse(payload);\n break;\n\n case ReceivableEvents.SimulcastConfigUpdate:\n SimulcastConfigSchema.parse(payload);\n break;\n\n case ReceivableEvents.PeersUpdate:\n break;\n\n case ReceivableEvents.AudioDeviceUpdate:\n AudioDeviceEventSchema.parse(payload);\n break;\n\n case ReceivableEvents.BandwidthEstimation:\n z.number().nullable().parse(payload);\n break;\n\n case ReceivableEvents.ReconnectionRetriesLimitReached:\n case ReceivableEvents.ReconnectionStarted:\n case ReceivableEvents.Reconnected:\n z.undefined().parse(payload);\n break;\n\n case ReceivableEvents.Warning:\n z.string().parse(payload);\n break;\n\n case ReceivableEvents.PeerStatusChanged:\n z.enum(['connecting', 'connected', 'error', 'idle']).parse(payload);\n break;\n\n case ReceivableEvents.ReconnectionStatusChanged:\n z.enum([\n 'connecting',\n 'connected',\n 'error',\n 'reconnecting',\n 'idle',\n ]).parse(payload);\n break;\n\n case ReceivableEvents.CurrentCameraChanged:\n CameraChangedEventSchema.parse(payload);\n break;\n\n case ReceivableEvents.TrackAspectRatioUpdated:\n TrackAspectRatioUpdatedEventSchema.parse(payload);\n break;\n\n case ReceivableEvents.CallKitActionPerformed:\n CallKitActionSchema.parse(payload);\n break;\n\n default:\n throw new Error(`Unknown event: ${eventName}`);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFishjamUrl.d.ts","sourceRoot":"","sources":["../../src/utils/getFishjamUrl.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,KAAG,MAMjD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FISHJAM_HTTP_CONNECT_URL } from '../consts';
|
|
2
|
+
export const getFishjamUrl = (fishjamId) => {
|
|
3
|
+
try {
|
|
4
|
+
return new URL(fishjamId).href;
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}`;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=getFishjamUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFishjamUrl.js","sourceRoot":"","sources":["../../src/utils/getFishjamUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAU,EAAE;IACzD,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,wBAAwB,IAAI,SAAS,EAAE,CAAC;IACpD,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { FISHJAM_HTTP_CONNECT_URL } from '../consts';\n\nexport const getFishjamUrl = (fishjamId: string): string => {\n try {\n return new URL(fishjamId).href;\n } catch {\n return `${FISHJAM_HTTP_CONNECT_URL}/${fishjamId}`;\n }\n};\n"]}
|
package/ios/Events.swift
CHANGED
|
@@ -8,6 +8,14 @@ enum PeerStatus: String {
|
|
|
8
8
|
case idle
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
enum CallKitAction {
|
|
12
|
+
case started
|
|
13
|
+
case ended
|
|
14
|
+
case failed(String)
|
|
15
|
+
case held(Bool)
|
|
16
|
+
case muted(Bool)
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
class EmitableEvent {
|
|
12
20
|
enum EventName: String, CaseIterable {
|
|
13
21
|
case IsMicrophoneOn
|
|
@@ -22,6 +30,7 @@ class EmitableEvent {
|
|
|
22
30
|
case ReconnectionStatusChanged
|
|
23
31
|
case CurrentCameraChanged
|
|
24
32
|
case TrackAspectRatioUpdated
|
|
33
|
+
case CallKitActionPerformed
|
|
25
34
|
|
|
26
35
|
var name: String {
|
|
27
36
|
rawValue
|
|
@@ -119,6 +128,23 @@ class EmitableEvent {
|
|
|
119
128
|
"availableDevices": [],
|
|
120
129
|
])
|
|
121
130
|
}
|
|
131
|
+
|
|
132
|
+
static func callKitActionPerformed(_ action: CallKitAction) -> EmitableEvent {
|
|
133
|
+
let eventContent: [String: Any?]
|
|
134
|
+
switch action {
|
|
135
|
+
case .started:
|
|
136
|
+
eventContent = ["started": nil]
|
|
137
|
+
case .ended:
|
|
138
|
+
eventContent = ["ended": nil]
|
|
139
|
+
case .failed(let reason):
|
|
140
|
+
eventContent = ["failed": reason]
|
|
141
|
+
case .muted(let isMuted):
|
|
142
|
+
eventContent = ["muted": isMuted]
|
|
143
|
+
case .held(let isOnHold):
|
|
144
|
+
eventContent = ["held": isOnHold]
|
|
145
|
+
}
|
|
146
|
+
return .init(event: .CallKitActionPerformed, eventContent: eventContent)
|
|
147
|
+
}
|
|
122
148
|
|
|
123
149
|
static var allEvents: [String] {
|
|
124
150
|
EventName.allCases.map(\.name)
|