@fishjam-cloud/react-native-client 0.22.0 → 0.23.0-RC.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/RNFishjamClientModule.d.ts +8 -2
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js +1 -0
- package/build/RNFishjamClientModule.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/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- 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/ios/Events.swift +26 -0
- package/ios/RNFishjamClient.swift +38 -0
- package/ios/RNFishjamClientModule.swift +221 -211
- package/package.json +1 -1
- package/plugin/build/types.d.ts +1 -0
- package/plugin/build/withFishjamIos.js +12 -0
|
@@ -8,6 +8,7 @@ import type { ForegroundServiceConfig } from './hooks/useForegroundService';
|
|
|
8
8
|
import type { Peer } from './hooks/usePeers';
|
|
9
9
|
import type { ScreenShareOptionsInternal } from './hooks/useScreenShare';
|
|
10
10
|
import type { GenericMetadata, SimulcastConfig } from './types';
|
|
11
|
+
import type { CallKitAction } from './hooks/useCallKit';
|
|
11
12
|
type Metadata = {
|
|
12
13
|
[key: string]: unknown;
|
|
13
14
|
};
|
|
@@ -21,6 +22,7 @@ type RNFishjamClient = {
|
|
|
21
22
|
peerStatus: PeerStatus;
|
|
22
23
|
reconnectionStatus: ReconnectionStatus;
|
|
23
24
|
isCameraInitialized: boolean;
|
|
25
|
+
hasActiveCallKitSession: boolean;
|
|
24
26
|
getPeers: <PeerMetadataType extends Metadata, ServerMetadata extends Metadata = GenericMetadata>() => Peer<PeerMetadataType, ServerMetadata>[];
|
|
25
27
|
joinRoom: (url: string, peerToken: string, peerMetadata: Metadata, config: ConnectionConfig) => Promise<void>;
|
|
26
28
|
leaveRoom: () => Promise<void>;
|
|
@@ -49,12 +51,14 @@ type RNFishjamClient = {
|
|
|
49
51
|
setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;
|
|
50
52
|
changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;
|
|
51
53
|
getStatistics: () => Promise<RTCStats>;
|
|
52
|
-
startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;
|
|
53
|
-
stopForegroundService: () => void;
|
|
54
54
|
getCameraPermissionsAsync: () => Promise<PermissionResponse>;
|
|
55
55
|
requestCameraPermissionsAsync: () => Promise<PermissionResponse>;
|
|
56
56
|
getMicrophonePermissionsAsync: () => Promise<PermissionResponse>;
|
|
57
57
|
requestMicrophonePermissionsAsync: () => Promise<PermissionResponse>;
|
|
58
|
+
startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;
|
|
59
|
+
stopForegroundService: () => void;
|
|
60
|
+
startCallKitSession: (displayName: string, isVideo: boolean) => Promise<void>;
|
|
61
|
+
endCallKitSession: () => Promise<void>;
|
|
58
62
|
};
|
|
59
63
|
export declare const ReceivableEvents: {
|
|
60
64
|
readonly IsMicrophoneOn: "IsMicrophoneOn";
|
|
@@ -72,6 +76,7 @@ export declare const ReceivableEvents: {
|
|
|
72
76
|
readonly ReconnectionStatusChanged: "ReconnectionStatusChanged";
|
|
73
77
|
readonly CurrentCameraChanged: "CurrentCameraChanged";
|
|
74
78
|
readonly TrackAspectRatioUpdated: "TrackAspectRatioUpdated";
|
|
79
|
+
readonly CallKitActionPerformed: "CallKitActionPerformed";
|
|
75
80
|
};
|
|
76
81
|
export type ReceivableEventPayloads = {
|
|
77
82
|
[ReceivableEvents.IsMicrophoneOn]: boolean;
|
|
@@ -92,6 +97,7 @@ export type ReceivableEventPayloads = {
|
|
|
92
97
|
trackId: string;
|
|
93
98
|
aspectRatio: number | null;
|
|
94
99
|
};
|
|
100
|
+
[ReceivableEvents.CallKitActionPerformed]: CallKitAction;
|
|
95
101
|
};
|
|
96
102
|
declare const _default: RNFishjamClient & NativeModule<Record<keyof typeof ReceivableEvents, (payload: ReceivableEventPayloads) => void>>;
|
|
97
103
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EACV,MAAM,EACN,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB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C5B,CAAC;IACF,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,EAAE,aAAa,CAAC;CAC1D,CAAC;wBAEuD,eAAe,GACtE,YAAY,CACV,MAAM,CACJ,MAAM,OAAO,gBAAgB,EAC7B,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAC3C,CACF;AANH,wBAMI"}
|
|
@@ -15,6 +15,7 @@ export const ReceivableEvents = {
|
|
|
15
15
|
ReconnectionStatusChanged: 'ReconnectionStatusChanged',
|
|
16
16
|
CurrentCameraChanged: 'CurrentCameraChanged',
|
|
17
17
|
TrackAspectRatioUpdated: 'TrackAspectRatioUpdated',
|
|
18
|
+
CallKitActionPerformed: 'CallKitActionPerformed',
|
|
18
19
|
};
|
|
19
20
|
export default requireNativeModule('RNFishjamClient');
|
|
20
21
|
//# sourceMappingURL=RNFishjamClientModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAoG5E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB,EAAE,eAAe;IACzD,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,yBAAyB,EAAE,2BAA2B;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;IAClD,sBAAsB,EAAE,wBAAwB;CACxC,CAAC;AAwBX,eAAe,mBAAmB,CAAC,iBAAiB,CAMjD,CAAC","sourcesContent":["import { PermissionResponse, requireNativeModule } from 'expo-modules-core';\n\nimport type { NativeModule } from 'expo-modules-core/types';\nimport type { RTCStats } from './debug/stats/types';\nimport type { OnAudioDeviceEvent } from './hooks/useAudioSettings';\nimport type {\n Camera,\n CameraConfigInternal,\n CurrentCameraChangedType,\n} from './hooks/useCamera';\nimport type {\n PeerStatus,\n ReconnectionStatus,\n ConnectionConfig,\n} from './hooks/useConnection';\nimport type { ForegroundServiceConfig } from './hooks/useForegroundService';\nimport type { Peer } from './hooks/usePeers';\nimport type { ScreenShareOptionsInternal } from './hooks/useScreenShare';\nimport type { GenericMetadata, SimulcastConfig } from './types';\nimport type { CallKitAction } from './hooks/useCallKit';\n\ntype Metadata = { [key: string]: unknown };\n\ntype RNFishjamClient = {\n isMicrophoneOn: boolean;\n isCameraOn: boolean;\n isScreenShareOn: boolean;\n isAppScreenShareOn: boolean; // only available on ios\n cameras: readonly Camera[];\n currentCamera: Camera | null;\n peerStatus: PeerStatus;\n reconnectionStatus: ReconnectionStatus;\n isCameraInitialized: boolean;\n hasActiveCallKitSession: boolean;\n\n getPeers: <\n PeerMetadataType extends Metadata,\n ServerMetadata extends Metadata = GenericMetadata,\n >() => Peer<PeerMetadataType, ServerMetadata>[];\n\n joinRoom: (\n url: string,\n peerToken: string,\n peerMetadata: Metadata,\n config: ConnectionConfig,\n ) => Promise<void>;\n leaveRoom: () => Promise<void>;\n startCamera: (config: CameraConfigInternal) => Promise<boolean>;\n toggleMicrophone: () => Promise<boolean>;\n toggleCamera: () => Promise<boolean>;\n flipCamera: () => Promise<void>;\n switchCamera: (cameraId: string) => Promise<void>;\n handleScreenSharePermission: () => Promise<'granted' | 'denied'>;\n toggleScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n toggleAppScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n updatePeerMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateVideoTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateScreenShareTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n setOutputAudioDevice: (audioDevice: string) => Promise<void>;\n startAudioSwitcher: () => Promise<void>;\n stopAudioSwitcher: () => Promise<void>;\n selectAudioSessionMode: (sessionMode: string) => Promise<void>;\n showAudioRoutePicker: () => Promise<void>;\n toggleScreenShareTrackEncoding: (\n encoding: string,\n ) => Promise<SimulcastConfig>;\n setScreenShareTrackBandwidth: (bandwidth: number) => Promise<void>;\n setScreenShareTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setTargetTrackEncoding: (trackId: string, encoding: string) => Promise<void>;\n toggleVideoTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;\n setVideoTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;\n changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;\n getStatistics: () => Promise<RTCStats>;\n getCameraPermissionsAsync: () => Promise<PermissionResponse>;\n requestCameraPermissionsAsync: () => Promise<PermissionResponse>;\n getMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n requestMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;\n stopForegroundService: () => void;\n startCallKitSession: (displayName: string, isVideo: boolean) => Promise<void>;\n endCallKitSession: () => Promise<void>;\n};\n\nexport const ReceivableEvents = {\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreenShareOn: 'IsScreenShareOn',\n IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n Warning: 'Warning',\n PeerStatusChanged: 'PeerStatusChanged',\n ReconnectionStatusChanged: 'ReconnectionStatusChanged',\n CurrentCameraChanged: 'CurrentCameraChanged',\n TrackAspectRatioUpdated: 'TrackAspectRatioUpdated',\n CallKitActionPerformed: 'CallKitActionPerformed',\n} as const;\n\nexport type ReceivableEventPayloads = {\n [ReceivableEvents.IsMicrophoneOn]: boolean;\n [ReceivableEvents.IsScreenShareOn]: boolean;\n [ReceivableEvents.IsAppScreenShareOn]: boolean;\n [ReceivableEvents.SimulcastConfigUpdate]: SimulcastConfig;\n [ReceivableEvents.PeersUpdate]: void;\n [ReceivableEvents.AudioDeviceUpdate]: OnAudioDeviceEvent;\n [ReceivableEvents.BandwidthEstimation]: number | null;\n [ReceivableEvents.ReconnectionRetriesLimitReached]: void;\n [ReceivableEvents.ReconnectionStarted]: void;\n [ReceivableEvents.Reconnected]: void;\n [ReceivableEvents.Warning]: string;\n [ReceivableEvents.PeerStatusChanged]: PeerStatus;\n [ReceivableEvents.ReconnectionStatusChanged]: ReconnectionStatus;\n [ReceivableEvents.CurrentCameraChanged]: CurrentCameraChangedType;\n [ReceivableEvents.TrackAspectRatioUpdated]: {\n trackId: string;\n aspectRatio: number | null;\n };\n [ReceivableEvents.CallKitActionPerformed]: CallKitAction;\n};\n\nexport default requireNativeModule('RNFishjamClient') as RNFishjamClient &\n NativeModule<\n Record<\n keyof typeof ReceivableEvents,\n (payload: ReceivableEventPayloads) => void\n >\n >;\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export type CallKitAction = {
|
|
2
|
+
['started']: undefined;
|
|
3
|
+
['ended']: undefined;
|
|
4
|
+
['failed']: string;
|
|
5
|
+
['muted']: boolean;
|
|
6
|
+
['held']: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type UseCallKitResult = {
|
|
9
|
+
/**
|
|
10
|
+
* Starts a CallKit session for the current call
|
|
11
|
+
* @param config - Configuration object containing displayName and isVideo
|
|
12
|
+
*/
|
|
13
|
+
startCallKitSession: (config: CallKitConfig) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Ends the current CallKit session
|
|
16
|
+
*/
|
|
17
|
+
endCallKitSession: () => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns whether there is currently an active CallKit session
|
|
20
|
+
*/
|
|
21
|
+
getCallKitSessionStatus: () => Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
export type CallKitConfig = {
|
|
24
|
+
/**
|
|
25
|
+
* The name to display in the CallKit UI
|
|
26
|
+
*/
|
|
27
|
+
displayName: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the should support video
|
|
30
|
+
*/
|
|
31
|
+
isVideo: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare function useCallKitIos(): UseCallKitResult;
|
|
34
|
+
declare const useCallKitServiceIos: (config: CallKitConfig) => void;
|
|
35
|
+
declare const useCallKitEventIos: <T extends keyof CallKitAction>(action: T, callback: (event: CallKitAction[T]) => void) => void;
|
|
36
|
+
/**
|
|
37
|
+
* A hook for listening to CallKit actions on iOS. Does nothing on other platforms.
|
|
38
|
+
* This hook allows you to respond to user interactions with the native iOS CallKit interface,
|
|
39
|
+
* such as muting/unmuting the call, putting the call on hold, or ending the call from the
|
|
40
|
+
* system's phone UI or lock screen controls.
|
|
41
|
+
*
|
|
42
|
+
* @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:
|
|
43
|
+
* - `'started'` - CallKit session has started
|
|
44
|
+
* - `'ended'` - User ended the call from CallKit UI
|
|
45
|
+
* - `'failed'` - CallKit session failed to start
|
|
46
|
+
* - `'muted'` - User toggled mute from CallKit UI
|
|
47
|
+
* - `'held'` - User toggled hold from CallKit UI
|
|
48
|
+
*
|
|
49
|
+
* @param {Function} callback - Function called when the specified action occurs.
|
|
50
|
+
*
|
|
51
|
+
* @group Hooks
|
|
52
|
+
* @category Connection
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import { useCallKitEvent } from '@fishjam-cloud/react-native-client';
|
|
57
|
+
*
|
|
58
|
+
* // Listen for hold state changes
|
|
59
|
+
* useCallKitEvent('held', (isOnHold: boolean) => {
|
|
60
|
+
* console.log('Call hold state:', isOnHold);
|
|
61
|
+
* // Handle hold state in your app
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const useCallKitEvent: typeof useCallKitEventIos;
|
|
66
|
+
/**
|
|
67
|
+
* A hook for managing CallKit sessions on iOS. Does nothing on other platforms.
|
|
68
|
+
* CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's
|
|
69
|
+
* phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.
|
|
70
|
+
*
|
|
71
|
+
* @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:
|
|
72
|
+
* - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration
|
|
73
|
+
* - `endCallKitSession()` - Ends the current CallKit session
|
|
74
|
+
* - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session
|
|
75
|
+
*
|
|
76
|
+
* @group Hooks
|
|
77
|
+
* @category Connection
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import { useCallKit } from '@fishjam-cloud/react-native-client';
|
|
82
|
+
*
|
|
83
|
+
* const { startCallKitSession, endCallKitSession } = useCallKit();
|
|
84
|
+
*
|
|
85
|
+
* // Start a CallKit session
|
|
86
|
+
* await startCallKitSession({ displayName: 'John Doe', isVideo: true });
|
|
87
|
+
*
|
|
88
|
+
* // Later, end the session
|
|
89
|
+
* await endCallKitSession();
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const useCallKit: typeof useCallKitIos;
|
|
93
|
+
/**
|
|
94
|
+
* A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.
|
|
95
|
+
* This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.
|
|
96
|
+
* Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).
|
|
97
|
+
*
|
|
98
|
+
* @param {CallKitConfig} config - Configuration object containing:
|
|
99
|
+
* - `displayName` - The name to display in the CallKit UI (e.g., username, call title)
|
|
100
|
+
* - `isVideo` - Whether the call is video or audio only
|
|
101
|
+
*
|
|
102
|
+
* @group Hooks
|
|
103
|
+
* @category Connection
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* import React from 'react';
|
|
108
|
+
* import { useCallKitService } from '@fishjam-cloud/react-native-client';
|
|
109
|
+
*
|
|
110
|
+
* function CallScreen({ username }: { username: string }) {
|
|
111
|
+
* // CallKit session will automatically start when this component mounts
|
|
112
|
+
* // and end when it unmounts
|
|
113
|
+
* useCallKitService({ displayName: username, isVideo: true });
|
|
114
|
+
*
|
|
115
|
+
* return null;
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare const useCallKitService: typeof useCallKitServiceIos;
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=useCallKit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCallKit.d.ts","sourceRoot":"","sources":["../../src/hooks/useCallKit.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IACvB,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9D;;OAEG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,uBAAuB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,iBAAS,aAAa,IAAI,gBAAgB,CA+BzC;AAED,QAAA,MAAM,oBAAoB,GAAI,QAAQ,aAAa,SAYlD,CAAC;AAIF,QAAA,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,aAAa,EACvD,QAAQ,CAAC,EACT,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,SAK5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe,EAGtB,OAAO,kBAAkB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,EAGjB,OAAO,aAAa,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,iBAAiB,EAGxB,OAAO,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import RNFishjamClient, { ReceivableEvents } from '../RNFishjamClientModule';
|
|
4
|
+
import { useFishjamEvent } from './internal/useFishjamEvent';
|
|
5
|
+
function useCallKitIos() {
|
|
6
|
+
const startCallKitSession = useCallback(async ({ displayName, isVideo }) => {
|
|
7
|
+
try {
|
|
8
|
+
await RNFishjamClient.startCallKitSession(displayName, isVideo);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.error('Failed to start CallKit session:', error);
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
const endCallKitSession = useCallback(async () => {
|
|
16
|
+
try {
|
|
17
|
+
await RNFishjamClient.endCallKitSession();
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Failed to end CallKit session:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
const getCallKitSessionStatus = useCallback(async () => {
|
|
25
|
+
return RNFishjamClient.hasActiveCallKitSession;
|
|
26
|
+
}, []);
|
|
27
|
+
return {
|
|
28
|
+
startCallKitSession,
|
|
29
|
+
endCallKitSession,
|
|
30
|
+
getCallKitSessionStatus,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const useCallKitServiceIos = (config) => {
|
|
34
|
+
const { displayName, isVideo } = config;
|
|
35
|
+
const { startCallKitSession, endCallKitSession } = useCallKitIos();
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
startCallKitSession({ displayName, isVideo });
|
|
38
|
+
return () => {
|
|
39
|
+
endCallKitSession();
|
|
40
|
+
};
|
|
41
|
+
}, [startCallKitSession, endCallKitSession, displayName, isVideo]);
|
|
42
|
+
};
|
|
43
|
+
const emptyFunction = () => { };
|
|
44
|
+
const useCallKitEventIos = (action, callback) => {
|
|
45
|
+
useFishjamEvent(ReceivableEvents.CallKitActionPerformed, (event) => {
|
|
46
|
+
event[action] && callback(event[action]);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A hook for listening to CallKit actions on iOS. Does nothing on other platforms.
|
|
51
|
+
* This hook allows you to respond to user interactions with the native iOS CallKit interface,
|
|
52
|
+
* such as muting/unmuting the call, putting the call on hold, or ending the call from the
|
|
53
|
+
* system's phone UI or lock screen controls.
|
|
54
|
+
*
|
|
55
|
+
* @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:
|
|
56
|
+
* - `'started'` - CallKit session has started
|
|
57
|
+
* - `'ended'` - User ended the call from CallKit UI
|
|
58
|
+
* - `'failed'` - CallKit session failed to start
|
|
59
|
+
* - `'muted'` - User toggled mute from CallKit UI
|
|
60
|
+
* - `'held'` - User toggled hold from CallKit UI
|
|
61
|
+
*
|
|
62
|
+
* @param {Function} callback - Function called when the specified action occurs.
|
|
63
|
+
*
|
|
64
|
+
* @group Hooks
|
|
65
|
+
* @category Connection
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { useCallKitEvent } from '@fishjam-cloud/react-native-client';
|
|
70
|
+
*
|
|
71
|
+
* // Listen for hold state changes
|
|
72
|
+
* useCallKitEvent('held', (isOnHold: boolean) => {
|
|
73
|
+
* console.log('Call hold state:', isOnHold);
|
|
74
|
+
* // Handle hold state in your app
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export const useCallKitEvent = Platform.select({
|
|
79
|
+
ios: useCallKitEventIos,
|
|
80
|
+
default: emptyFunction,
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* A hook for managing CallKit sessions on iOS. Does nothing on other platforms.
|
|
84
|
+
* CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's
|
|
85
|
+
* phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.
|
|
86
|
+
*
|
|
87
|
+
* @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:
|
|
88
|
+
* - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration
|
|
89
|
+
* - `endCallKitSession()` - Ends the current CallKit session
|
|
90
|
+
* - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session
|
|
91
|
+
*
|
|
92
|
+
* @group Hooks
|
|
93
|
+
* @category Connection
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* import { useCallKit } from '@fishjam-cloud/react-native-client';
|
|
98
|
+
*
|
|
99
|
+
* const { startCallKitSession, endCallKitSession } = useCallKit();
|
|
100
|
+
*
|
|
101
|
+
* // Start a CallKit session
|
|
102
|
+
* await startCallKitSession({ displayName: 'John Doe', isVideo: true });
|
|
103
|
+
*
|
|
104
|
+
* // Later, end the session
|
|
105
|
+
* await endCallKitSession();
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export const useCallKit = Platform.select({
|
|
109
|
+
ios: useCallKitIos,
|
|
110
|
+
default: emptyFunction,
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.
|
|
114
|
+
* This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.
|
|
115
|
+
* Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).
|
|
116
|
+
*
|
|
117
|
+
* @param {CallKitConfig} config - Configuration object containing:
|
|
118
|
+
* - `displayName` - The name to display in the CallKit UI (e.g., username, call title)
|
|
119
|
+
* - `isVideo` - Whether the call is video or audio only
|
|
120
|
+
*
|
|
121
|
+
* @group Hooks
|
|
122
|
+
* @category Connection
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* import React from 'react';
|
|
127
|
+
* import { useCallKitService } from '@fishjam-cloud/react-native-client';
|
|
128
|
+
*
|
|
129
|
+
* function CallScreen({ username }: { username: string }) {
|
|
130
|
+
* // CallKit session will automatically start when this component mounts
|
|
131
|
+
* // and end when it unmounts
|
|
132
|
+
* useCallKitService({ displayName: username, isVideo: true });
|
|
133
|
+
*
|
|
134
|
+
* return null;
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export const useCallKitService = Platform.select({
|
|
139
|
+
ios: useCallKitServiceIos,
|
|
140
|
+
default: emptyFunction,
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=useCallKit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCallKit.js","sourceRoot":"","sources":["../../src/hooks/useCallKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,eAAe,EAAE,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAuC7D,SAAS,aAAa;IACpB,MAAM,mBAAmB,GAAG,WAAW,CACrC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAiB,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,eAAe,CAAC,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;YACzD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,iBAAiB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,eAAe,CAAC,iBAAiB,EAAE,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,uBAAuB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACrD,OAAO,eAAe,CAAC,uBAAuB,CAAC;IACjD,CAA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;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,oBAAoB;IACzB,OAAO,EAAE,aAAa;CACvB,CAAgC,CAAC","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { Platform } from 'react-native';\nimport RNFishjamClient, { ReceivableEvents } from '../RNFishjamClientModule';\nimport { useFishjamEvent } from './internal/useFishjamEvent';\n\nexport type CallKitAction = {\n ['started']: undefined;\n ['ended']: undefined;\n ['failed']: string;\n ['muted']: boolean;\n ['held']: boolean;\n};\n\nexport type UseCallKitResult = {\n /**\n * Starts a CallKit session for the current call\n * @param config - Configuration object containing displayName and isVideo\n */\n startCallKitSession: (config: CallKitConfig) => Promise<void>;\n\n /**\n * Ends the current CallKit session\n */\n endCallKitSession: () => Promise<void>;\n\n /**\n * Returns whether there is currently an active CallKit session\n */\n getCallKitSessionStatus: () => Promise<boolean>;\n};\n\nexport type CallKitConfig = {\n /**\n * The name to display in the CallKit UI\n */\n displayName: string;\n /**\n * Whether the should support video\n */\n isVideo: boolean;\n};\n\nfunction useCallKitIos(): UseCallKitResult {\n const startCallKitSession = useCallback(\n async ({ displayName, isVideo }: CallKitConfig) => {\n try {\n await RNFishjamClient.startCallKitSession(displayName, isVideo);\n } catch (error) {\n console.error('Failed to start CallKit session:', error);\n throw error;\n }\n },\n [],\n );\n\n const endCallKitSession = useCallback(async () => {\n try {\n await RNFishjamClient.endCallKitSession();\n } catch (error) {\n console.error('Failed to end CallKit session:', error);\n throw error;\n }\n }, []);\n\n const getCallKitSessionStatus = useCallback(async () => {\n return RNFishjamClient.hasActiveCallKitSession;\n }, []);\n\n return {\n startCallKitSession,\n endCallKitSession,\n getCallKitSessionStatus,\n };\n}\n\nconst useCallKitServiceIos = (config: CallKitConfig) => {\n const { displayName, isVideo } = config;\n\n const { startCallKitSession, endCallKitSession } = useCallKitIos();\n\n useEffect(() => {\n startCallKitSession({ displayName, isVideo });\n\n return () => {\n endCallKitSession();\n };\n }, [startCallKitSession, endCallKitSession, displayName, isVideo]);\n};\n\nconst emptyFunction = () => {};\n\nconst useCallKitEventIos = <T extends keyof CallKitAction>(\n action: T,\n callback: (event: CallKitAction[T]) => void,\n) => {\n useFishjamEvent(ReceivableEvents.CallKitActionPerformed, (event) => {\n event[action] && callback(event[action]);\n });\n};\n\n/**\n * A hook for listening to CallKit actions on iOS. Does nothing on other platforms.\n * This hook allows you to respond to user interactions with the native iOS CallKit interface,\n * such as muting/unmuting the call, putting the call on hold, or ending the call from the\n * system's phone UI or lock screen controls.\n *\n * @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:\n * - `'started'` - CallKit session has started\n * - `'ended'` - User ended the call from CallKit UI\n * - `'failed'` - CallKit session failed to start\n * - `'muted'` - User toggled mute from CallKit UI\n * - `'held'` - User toggled hold from CallKit UI\n *\n * @param {Function} callback - Function called when the specified action occurs.\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import { useCallKitEvent } from '@fishjam-cloud/react-native-client';\n *\n * // Listen for hold state changes\n * useCallKitEvent('held', (isOnHold: boolean) => {\n * console.log('Call hold state:', isOnHold);\n * // Handle hold state in your app\n * });\n * ```\n */\nexport const useCallKitEvent = Platform.select({\n ios: useCallKitEventIos,\n default: emptyFunction,\n}) as typeof useCallKitEventIos;\n\n/**\n * A hook for managing CallKit sessions on iOS. Does nothing on other platforms.\n * CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's\n * phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.\n *\n * @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:\n * - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration\n * - `endCallKitSession()` - Ends the current CallKit session\n * - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import { useCallKit } from '@fishjam-cloud/react-native-client';\n *\n * const { startCallKitSession, endCallKitSession } = useCallKit();\n *\n * // Start a CallKit session\n * await startCallKitSession({ displayName: 'John Doe', isVideo: true });\n *\n * // Later, end the session\n * await endCallKitSession();\n * ```\n */\nexport const useCallKit = Platform.select({\n ios: useCallKitIos,\n default: emptyFunction,\n}) as typeof useCallKitIos;\n\n/**\n * A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.\n * This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.\n * Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).\n *\n * @param {CallKitConfig} config - Configuration object containing:\n * - `displayName` - The name to display in the CallKit UI (e.g., username, call title)\n * - `isVideo` - Whether the call is video or audio only\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import React from 'react';\n * import { useCallKitService } from '@fishjam-cloud/react-native-client';\n *\n * function CallScreen({ username }: { username: string }) {\n * // CallKit session will automatically start when this component mounts\n * // and end when it unmounts\n * useCallKitService({ displayName: username, isVideo: true });\n *\n * return null;\n * }\n * ```\n */\nexport const useCallKitService = Platform.select({\n ios: useCallKitServiceIos,\n default: emptyFunction,\n}) as typeof useCallKitServiceIos;\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type { ForegroundServiceConfig } from './hooks/useForegroundService';
|
|
|
12
12
|
export type { JoinRoomConfig, ReconnectionStatus, PeerStatus, ConnectionConfig, } from './hooks/useConnection';
|
|
13
13
|
export type { AppScreenShareData } from './hooks/useAppScreenShare';
|
|
14
14
|
export type { UseSandboxProps } from './hooks/useSandbox';
|
|
15
|
+
export type { UseCallKitResult, CallKitConfig, CallKitAction, } from './hooks/useCallKit';
|
|
15
16
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
16
17
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
17
18
|
export { useCamera } from './hooks/useCamera';
|
|
@@ -25,6 +26,7 @@ export { useForegroundService } from './hooks/useForegroundService';
|
|
|
25
26
|
export { useConnection } from './hooks/useConnection';
|
|
26
27
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
27
28
|
export { useSandbox } from './hooks/useSandbox';
|
|
29
|
+
export { useCallKitService, useCallKit, useCallKitEvent, } from './hooks/useCallKit';
|
|
28
30
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
29
31
|
export type { FishjamRoomProps } from './components/FishjamRoom';
|
|
30
32
|
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;AAIjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAInE,YAAY,EACV,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,kBAAkB,EAClB,kBAAkB,GACnB,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AAM,gBAAgB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { useForegroundService } from './hooks/useForegroundService';
|
|
|
19
19
|
export { useConnection } from './hooks/useConnection';
|
|
20
20
|
export { useUpdatePeerMetadata } from './hooks/useUpdatePeerMetadata';
|
|
21
21
|
export { useSandbox } from './hooks/useSandbox';
|
|
22
|
+
export { useCallKitService, useCallKit, useCallKitEvent, } from './hooks/useCallKit';
|
|
22
23
|
// #endregion
|
|
23
24
|
export { useCameraPermissions, useMicrophonePermissions, } from './hooks/usePermissions';
|
|
24
25
|
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;AAWlE,aAAa;AAEb,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAWlE,aAAa;AAEb,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAsDnE,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,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,aAAa;AAEb,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,yBAAyB,EAAE,CAAC;AAE5B,mBAAmB;AACnB,OAAO,EAAE,uBAAuB,EAAe,MAAM,gBAAgB,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';\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"]}
|
|
@@ -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,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;CAC9D,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAClD,cAAc,EAAE,uBAAuB,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AAM;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"]}
|
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)
|
|
@@ -7,6 +7,7 @@ import WebRTC
|
|
|
7
7
|
|
|
8
8
|
class RNFishjamClient: FishjamClientListener {
|
|
9
9
|
static var fishjamClient: FishjamClient? = nil
|
|
10
|
+
private var callKitManager: CallKitManager?
|
|
10
11
|
|
|
11
12
|
var isMicrophoneOn = false
|
|
12
13
|
var isCameraOn = false
|
|
@@ -430,6 +431,13 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
430
431
|
}
|
|
431
432
|
return
|
|
432
433
|
}
|
|
434
|
+
|
|
435
|
+
if RNFishjamClient.fishjamClient?.lastSdpAnswer?.detectedCodec != .h264 {
|
|
436
|
+
emit(event: .warning(
|
|
437
|
+
message: "Incompatible codec detected: \(RNFishjamClient.fishjamClient?.lastSdpAnswer?.detectedCodec?.rawValue ?? "Unknown"). Screen sharing requires H264, otherwise UploadBroadcastExtenstion will crash due to memory pressure (no hardware acceleration). " +
|
|
438
|
+
"Please configure your Fishjam room to use H264 codec for better screen sharing performance."
|
|
439
|
+
))
|
|
440
|
+
}
|
|
433
441
|
|
|
434
442
|
let simulcastConfig = try getSimulcastConfigFromOptions(simulcastConfig: screenShareOptions.simulcastConfig)
|
|
435
443
|
|
|
@@ -945,6 +953,36 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
945
953
|
static func remove(customSource: CustomSource) {
|
|
946
954
|
fishjamClient?.remove(customSource: customSource)
|
|
947
955
|
}
|
|
956
|
+
|
|
957
|
+
public func startCallKitSessionWith(displayName: String, isVideo: Bool) throws {
|
|
958
|
+
if callKitManager == nil {
|
|
959
|
+
callKitManager = CallKitManager()
|
|
960
|
+
callKitManager?.onCallStarted = { [weak self] in
|
|
961
|
+
self?.emit(event: .callKitActionPerformed(.started))
|
|
962
|
+
}
|
|
963
|
+
callKitManager?.onCallEnded = { [weak self] in
|
|
964
|
+
self?.emit(event: .callKitActionPerformed(.ended))
|
|
965
|
+
}
|
|
966
|
+
callKitManager?.onCallFailed = { [weak self] reason in
|
|
967
|
+
self?.emit(event: .callKitActionPerformed(.failed(reason)))
|
|
968
|
+
}
|
|
969
|
+
callKitManager?.onCallMuted = { [weak self] isMuted in
|
|
970
|
+
self?.emit(event: .callKitActionPerformed(.muted(isMuted)))
|
|
971
|
+
}
|
|
972
|
+
callKitManager?.onCallHeld = { [weak self] isOnHold in
|
|
973
|
+
self?.emit(event: .callKitActionPerformed(.held(isOnHold)))
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
try callKitManager?.startCallWith(displayName: displayName, isVideo: isVideo)
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
public func endCallKitSession() {
|
|
980
|
+
callKitManager?.endCall()
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
public var hasActiveCallKitSession: Bool {
|
|
984
|
+
return callKitManager?.hasActiveCall ?? false
|
|
985
|
+
}
|
|
948
986
|
}
|
|
949
987
|
|
|
950
988
|
extension RNFishjamClient: CameraCapturerDeviceChangedListener {
|
|
@@ -63,216 +63,226 @@ struct ConnectConfig: Record {
|
|
|
63
63
|
typealias RNTrackBandwidthLimit = Either<Int, [String: Int]>
|
|
64
64
|
|
|
65
65
|
public class RNFishjamClientModule: Module {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
66
|
+
public func definition() -> ModuleDefinition {
|
|
67
|
+
let rnFishjamClient: RNFishjamClient = {
|
|
68
|
+
let client = RNFishjamClient(sendEvent)
|
|
69
|
+
client.create()
|
|
70
|
+
return client
|
|
71
|
+
}()
|
|
72
|
+
|
|
73
|
+
Name("RNFishjamClient")
|
|
74
|
+
|
|
75
|
+
Events(EmitableEvent.allEvents)
|
|
76
|
+
|
|
77
|
+
OnCreate {
|
|
78
|
+
let permissionsManager = self.appContext?.permissions
|
|
79
|
+
EXPermissionsMethodsDelegate.register(
|
|
80
|
+
[
|
|
81
|
+
CameraOnlyPermissionRequester(),
|
|
82
|
+
CameraMicrophonePermissionRequester()
|
|
83
|
+
],
|
|
84
|
+
withPermissionsManager: permissionsManager
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Property("peerStatus") {
|
|
89
|
+
return rnFishjamClient.peerStatus.rawValue
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Property("reconnectionStatus") {
|
|
93
|
+
return rnFishjamClient.reconnectionStatus.rawValue
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Property("isMicrophoneOn") {
|
|
97
|
+
return rnFishjamClient.isMicrophoneOn
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Property("isCameraOn") {
|
|
101
|
+
return rnFishjamClient.isCameraOn
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Property("cameras") {
|
|
105
|
+
return rnFishjamClient.getCaptureDevices()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
Property("currentCamera") {
|
|
109
|
+
return rnFishjamClient.currentCamera
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Property("isScreenShareOn") {
|
|
113
|
+
return rnFishjamClient.isScreenShareOn
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
Property("isAppScreenShareOn") {
|
|
117
|
+
return rnFishjamClient.isAppScreenShareOn
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Property("isCameraInitialized") {
|
|
121
|
+
return rnFishjamClient.isCameraInitialized
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
Function("getPeers") {
|
|
125
|
+
return rnFishjamClient.getPeers()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
AsyncFunction("joinRoom") {
|
|
129
|
+
(
|
|
130
|
+
url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
|
|
131
|
+
promise: Promise
|
|
132
|
+
) in
|
|
133
|
+
rnFishjamClient.joinRoom(
|
|
134
|
+
url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
|
|
135
|
+
promise: promise)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
AsyncFunction("leaveRoom") {
|
|
139
|
+
rnFishjamClient.leaveRoom()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
AsyncFunction("startCamera") { (config: CameraConfig) in
|
|
143
|
+
try await rnFishjamClient.startCamera(config: config)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
AsyncFunction("toggleMicrophone") {
|
|
147
|
+
try await rnFishjamClient.toggleMicrophone()
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
AsyncFunction("startMicrophone") {
|
|
151
|
+
try await rnFishjamClient.startMicrophone()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
AsyncFunction("stopMicrophone") {
|
|
155
|
+
try rnFishjamClient.stopMicrophone()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
AsyncFunction("toggleCamera") {
|
|
159
|
+
try rnFishjamClient.toggleCamera()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
AsyncFunction("flipCamera") {
|
|
163
|
+
try rnFishjamClient.flipCamera()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
AsyncFunction("switchCamera") { (cameraId: String) in
|
|
167
|
+
try rnFishjamClient.switchCamera(cameraId: cameraId)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
|
|
171
|
+
try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
|
|
175
|
+
try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
|
|
179
|
+
try rnFishjamClient.updatePeerMetadata(metadata: metadata)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
AsyncFunction("updateVideoTrackMetadata") { (metadata: [String: Any]) in
|
|
183
|
+
try rnFishjamClient.updateLocalVideoTrackMetadata(metadata: metadata)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
AsyncFunction("updateScreenShareTrackMetadata") { (metadata: [String: Any]) in
|
|
187
|
+
try rnFishjamClient.updateLocalScreenShareTrackMetadata(metadata: metadata)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
AsyncFunction("toggleScreenShareTrackEncoding") { (encoding: String) in
|
|
191
|
+
try rnFishjamClient.toggleScreenShareTrackEncoding(encoding: encoding)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
AsyncFunction("setScreenShareTrackBandwidth") { (bandwidth: Int) in
|
|
195
|
+
try rnFishjamClient.setScreenShareTrackBandwidth(bandwidth: bandwidth)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
AsyncFunction("setScreenShareTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
|
|
199
|
+
try rnFishjamClient.setScreenShareTrackEncodingBandwidth(
|
|
200
|
+
encoding: encoding, bandwidth: bandwidth)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
AsyncFunction("setTargetTrackEncoding") { (trackId: String, encoding: String) in
|
|
204
|
+
try rnFishjamClient.setTargetTrackEncoding(trackId: trackId, encoding: encoding)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
AsyncFunction("toggleVideoTrackEncoding") { (encoding: String) in
|
|
208
|
+
try rnFishjamClient.toggleVideoTrackEncoding(encoding: encoding)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
AsyncFunction("setVideoTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
|
|
212
|
+
try rnFishjamClient.setVideoTrackEncodingBandwidth(
|
|
213
|
+
encoding: encoding, bandwidth: bandwidth)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
AsyncFunction("setVideoTrackBandwidth") { (bandwidth: Int) in
|
|
217
|
+
try rnFishjamClient.setVideoTrackBandwidth(bandwidth: bandwidth)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
AsyncFunction("changeWebRTCLoggingSeverity") { (severity: String) in
|
|
221
|
+
try rnFishjamClient.changeWebRTCLoggingSeverity(severity: severity)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
AsyncFunction("getStatistics") {
|
|
225
|
+
try await rnFishjamClient.getStatistics()
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
|
|
229
|
+
try rnFishjamClient.selectAudioSessionMode(sessionMode: sessionMode)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
AsyncFunction("showAudioRoutePicker") {
|
|
233
|
+
rnFishjamClient.showAudioRoutePicker()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
AsyncFunction("startAudioSwitcher") {
|
|
237
|
+
rnFishjamClient.startAudioSwitcher()
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
AsyncFunction("getCameraPermissionsAsync") { (promise: Promise) in
|
|
241
|
+
EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
|
|
242
|
+
self.appContext?.permissions,
|
|
243
|
+
withRequester: CameraOnlyPermissionRequester.self,
|
|
244
|
+
resolve: promise.resolver,
|
|
245
|
+
reject: promise.legacyRejecter
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
|
|
250
|
+
EXPermissionsMethodsDelegate.askForPermission(
|
|
251
|
+
withPermissionsManager: self.appContext?.permissions,
|
|
252
|
+
withRequester: CameraOnlyPermissionRequester.self,
|
|
253
|
+
resolve: promise.resolver,
|
|
254
|
+
reject: promise.legacyRejecter
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
AsyncFunction("getMicrophonePermissionsAsync") { (promise: Promise) in
|
|
259
|
+
EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
|
|
260
|
+
self.appContext?.permissions,
|
|
261
|
+
withRequester: CameraMicrophonePermissionRequester.self,
|
|
262
|
+
resolve: promise.resolver,
|
|
263
|
+
reject: promise.legacyRejecter
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
AsyncFunction("requestMicrophonePermissionsAsync") { (promise: Promise) in
|
|
268
|
+
EXPermissionsMethodsDelegate.askForPermission(
|
|
269
|
+
withPermissionsManager: self.appContext?.permissions,
|
|
270
|
+
withRequester: CameraMicrophonePermissionRequester.self,
|
|
271
|
+
resolve: promise.resolver,
|
|
272
|
+
reject: promise.legacyRejecter
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
AsyncFunction("startCallKitSession") { (displayName: String, isVideo: Bool? ) in
|
|
277
|
+
try rnFishjamClient.startCallKitSessionWith(displayName: displayName, isVideo: isVideo ?? true)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
AsyncFunction("endCallKitSession") {
|
|
281
|
+
rnFishjamClient.endCallKitSession()
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
Property("hasActiveCallKitSession") {
|
|
285
|
+
return rnFishjamClient.hasActiveCallKitSession
|
|
86
286
|
}
|
|
87
|
-
|
|
88
|
-
Property("peerStatus") {
|
|
89
|
-
return rnFishjamClient.peerStatus.rawValue
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Property("reconnectionStatus") {
|
|
93
|
-
return rnFishjamClient.reconnectionStatus.rawValue
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
Property("isMicrophoneOn") {
|
|
97
|
-
return rnFishjamClient.isMicrophoneOn
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Property("isCameraOn") {
|
|
101
|
-
return rnFishjamClient.isCameraOn
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
Property("cameras") {
|
|
105
|
-
return rnFishjamClient.getCaptureDevices()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
Property("currentCamera") {
|
|
109
|
-
return rnFishjamClient.currentCamera
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
Property("isScreenShareOn") {
|
|
113
|
-
return rnFishjamClient.isScreenShareOn
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
Property("isAppScreenShareOn") {
|
|
117
|
-
return rnFishjamClient.isAppScreenShareOn
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
Property("isCameraInitialized") {
|
|
121
|
-
return rnFishjamClient.isCameraInitialized
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
Function("getPeers") {
|
|
125
|
-
return rnFishjamClient.getPeers()
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
AsyncFunction("joinRoom") {
|
|
129
|
-
(
|
|
130
|
-
url: String, peerToken: String, peerMetadata: [String: Any], config: ConnectConfig,
|
|
131
|
-
promise: Promise
|
|
132
|
-
) in
|
|
133
|
-
rnFishjamClient.joinRoom(
|
|
134
|
-
url: url, peerToken: peerToken, peerMetadata: peerMetadata, config: config,
|
|
135
|
-
promise: promise)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
AsyncFunction("leaveRoom") {
|
|
139
|
-
rnFishjamClient.leaveRoom()
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
AsyncFunction("startCamera") { (config: CameraConfig) in
|
|
143
|
-
try await rnFishjamClient.startCamera(config: config)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
AsyncFunction("toggleMicrophone") {
|
|
147
|
-
try await rnFishjamClient.toggleMicrophone()
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
AsyncFunction("startMicrophone") {
|
|
151
|
-
try await rnFishjamClient.startMicrophone()
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
AsyncFunction("stopMicrophone") {
|
|
155
|
-
try rnFishjamClient.stopMicrophone()
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
AsyncFunction("toggleCamera") {
|
|
159
|
-
try rnFishjamClient.toggleCamera()
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
AsyncFunction("flipCamera") {
|
|
163
|
-
try rnFishjamClient.flipCamera()
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
AsyncFunction("switchCamera") { (cameraId: String) in
|
|
167
|
-
try rnFishjamClient.switchCamera(cameraId: cameraId)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
AsyncFunction("toggleScreenShare") { (screenShareOptions: ScreenShareOptions) in
|
|
171
|
-
try rnFishjamClient.toggleScreenShare(screenShareOptions: screenShareOptions)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
AsyncFunction("toggleAppScreenShare") { (screenShareOptions: ScreenShareOptions) in
|
|
175
|
-
try rnFishjamClient.toggleAppScreenShare(screenShareOptions: screenShareOptions)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
AsyncFunction("updatePeerMetadata") { (metadata: [String: Any]) in
|
|
179
|
-
try rnFishjamClient.updatePeerMetadata(metadata: metadata)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
AsyncFunction("updateVideoTrackMetadata") { (metadata: [String: Any]) in
|
|
183
|
-
try rnFishjamClient.updateLocalVideoTrackMetadata(metadata: metadata)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
AsyncFunction("updateScreenShareTrackMetadata") { (metadata: [String: Any]) in
|
|
187
|
-
try rnFishjamClient.updateLocalScreenShareTrackMetadata(metadata: metadata)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
AsyncFunction("toggleScreenShareTrackEncoding") { (encoding: String) in
|
|
191
|
-
try rnFishjamClient.toggleScreenShareTrackEncoding(encoding: encoding)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
AsyncFunction("setScreenShareTrackBandwidth") { (bandwidth: Int) in
|
|
195
|
-
try rnFishjamClient.setScreenShareTrackBandwidth(bandwidth: bandwidth)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
AsyncFunction("setScreenShareTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
|
|
199
|
-
try rnFishjamClient.setScreenShareTrackEncodingBandwidth(
|
|
200
|
-
encoding: encoding, bandwidth: bandwidth)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
AsyncFunction("setTargetTrackEncoding") { (trackId: String, encoding: String) in
|
|
204
|
-
try rnFishjamClient.setTargetTrackEncoding(trackId: trackId, encoding: encoding)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
AsyncFunction("toggleVideoTrackEncoding") { (encoding: String) in
|
|
208
|
-
try rnFishjamClient.toggleVideoTrackEncoding(encoding: encoding)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
AsyncFunction("setVideoTrackEncodingBandwidth") { (encoding: String, bandwidth: Int) in
|
|
212
|
-
try rnFishjamClient.setVideoTrackEncodingBandwidth(
|
|
213
|
-
encoding: encoding, bandwidth: bandwidth)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
AsyncFunction("setVideoTrackBandwidth") { (bandwidth: Int) in
|
|
217
|
-
try rnFishjamClient.setVideoTrackBandwidth(bandwidth: bandwidth)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
AsyncFunction("changeWebRTCLoggingSeverity") { (severity: String) in
|
|
221
|
-
try rnFishjamClient.changeWebRTCLoggingSeverity(severity: severity)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
AsyncFunction("getStatistics") {
|
|
225
|
-
try await rnFishjamClient.getStatistics()
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
AsyncFunction("selectAudioSessionMode") { (sessionMode: String) in
|
|
229
|
-
try rnFishjamClient.selectAudioSessionMode(sessionMode: sessionMode)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
AsyncFunction("showAudioRoutePicker") {
|
|
233
|
-
rnFishjamClient.showAudioRoutePicker()
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
AsyncFunction("startAudioSwitcher") {
|
|
237
|
-
rnFishjamClient.startAudioSwitcher()
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
AsyncFunction("getCameraPermissionsAsync") { (promise: Promise) in
|
|
241
|
-
EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
|
|
242
|
-
self.appContext?.permissions,
|
|
243
|
-
withRequester: CameraOnlyPermissionRequester.self,
|
|
244
|
-
resolve: promise.resolver,
|
|
245
|
-
reject: promise.legacyRejecter
|
|
246
|
-
)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
|
|
250
|
-
EXPermissionsMethodsDelegate.askForPermission(
|
|
251
|
-
withPermissionsManager: self.appContext?.permissions,
|
|
252
|
-
withRequester: CameraOnlyPermissionRequester.self,
|
|
253
|
-
resolve: promise.resolver,
|
|
254
|
-
reject: promise.legacyRejecter
|
|
255
|
-
)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
AsyncFunction("getMicrophonePermissionsAsync") { (promise: Promise) in
|
|
259
|
-
EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
|
|
260
|
-
self.appContext?.permissions,
|
|
261
|
-
withRequester: CameraMicrophonePermissionRequester.self,
|
|
262
|
-
resolve: promise.resolver,
|
|
263
|
-
reject: promise.legacyRejecter
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
AsyncFunction("requestMicrophonePermissionsAsync") { (promise: Promise) in
|
|
268
|
-
EXPermissionsMethodsDelegate.askForPermission(
|
|
269
|
-
withPermissionsManager: self.appContext?.permissions,
|
|
270
|
-
withRequester: CameraMicrophonePermissionRequester.self,
|
|
271
|
-
resolve: promise.resolver,
|
|
272
|
-
reject: promise.legacyRejecter
|
|
273
|
-
)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
287
|
}
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
}
|
package/package.json
CHANGED
package/plugin/build/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type FishjamPluginOptions = {
|
|
|
7
7
|
iphoneDeploymentTarget?: string;
|
|
8
8
|
enableScreensharing?: boolean;
|
|
9
9
|
supportsPictureInPicture?: boolean;
|
|
10
|
+
enableVoIPBackgroundMode?: boolean;
|
|
10
11
|
appGroupContainerId?: string;
|
|
11
12
|
mainTargetName?: string;
|
|
12
13
|
broadcastExtensionTargetName?: string;
|
|
@@ -265,6 +265,17 @@ const withFishjamPictureInPicture = (config, props) => (0, config_plugins_1.with
|
|
|
265
265
|
}
|
|
266
266
|
return configuration;
|
|
267
267
|
});
|
|
268
|
+
/**
|
|
269
|
+
* Adds iOS VoIP background mode to keep the app running during calls
|
|
270
|
+
*/
|
|
271
|
+
const withFishjamVoIPBackgroundMode = (config, props) => (0, config_plugins_1.withInfoPlist)(config, (configuration) => {
|
|
272
|
+
if (props?.ios?.enableVoIPBackgroundMode) {
|
|
273
|
+
const backgroundModes = new Set(configuration.modResults.UIBackgroundModes ?? []);
|
|
274
|
+
backgroundModes.add('voip');
|
|
275
|
+
configuration.modResults.UIBackgroundModes = Array.from(backgroundModes);
|
|
276
|
+
}
|
|
277
|
+
return configuration;
|
|
278
|
+
});
|
|
268
279
|
/**
|
|
269
280
|
* Applies screen sharing plugin if enabled. In order for screensharing to work, we need to copy extension files to your iOS project.
|
|
270
281
|
* Allows for dynamically changing deploymentTarget.
|
|
@@ -281,6 +292,7 @@ const withFishjamIos = (config, props) => {
|
|
|
281
292
|
return configuration;
|
|
282
293
|
});
|
|
283
294
|
config = withFishjamPictureInPicture(config, props);
|
|
295
|
+
config = withFishjamVoIPBackgroundMode(config, props);
|
|
284
296
|
return config;
|
|
285
297
|
};
|
|
286
298
|
exports.default = withFishjamIos;
|