@fishjam-cloud/react-native-client 0.2.4 → 0.4.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/LICENSE +201 -0
- package/README.md +9 -8
- package/android/build.gradle +4 -4
- package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +25 -12
- package/android/src/main/java/io/fishjam/reactnative/Errors.kt +1 -2
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +94 -52
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +42 -90
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewView.kt +14 -3
- package/android/src/main/java/io/fishjam/reactnative/VideoPreviewViewModule.kt +5 -0
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererView.kt +4 -3
- package/android/src/main/java/io/fishjam/reactnative/VideoRendererViewModule.kt +2 -0
- package/android/src/main/java/io/fishjam/reactnative/VideoView.kt +3 -2
- package/android/src/main/java/io/fishjam/reactnative/{FishjamForegroundService.kt → foregroundService/FishjamForegroundService.kt} +7 -2
- package/android/src/main/java/io/fishjam/reactnative/foregroundService/ForegroundServiceManager.kt +147 -0
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalCameraTracksChangedListenersManager.kt +21 -0
- package/android/src/main/java/io/fishjam/reactnative/managers/LocalTracksSwitchListenersManager.kt +27 -0
- package/android/src/main/java/io/fishjam/reactnative/managers/TracksUpdateListenersManager.kt +21 -0
- package/android/src/main/java/io/fishjam/reactnative/utils/PermissionUtils.kt +45 -0
- package/build/RNFishjamClientModule.d.ts +16 -10
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/common/client.d.ts +3 -3
- package/build/common/client.d.ts.map +1 -1
- package/build/common/client.js +4 -4
- package/build/common/client.js.map +1 -1
- package/build/common/metadata.d.ts +3 -3
- package/build/common/metadata.d.ts.map +1 -1
- package/build/common/metadata.js +4 -4
- package/build/common/metadata.js.map +1 -1
- package/build/common/webRTC.d.ts +0 -8
- package/build/common/webRTC.d.ts.map +1 -1
- package/build/common/webRTC.js +0 -9
- package/build/common/webRTC.js.map +1 -1
- package/build/components/VideoRendererView.d.ts +1 -1
- package/build/components/VideoRendererView.js +1 -1
- package/build/components/VideoRendererView.js.map +1 -1
- package/build/debug/common/webRTC.d.ts +9 -0
- package/build/debug/common/webRTC.d.ts.map +1 -0
- package/build/debug/common/webRTC.js +11 -0
- package/build/debug/common/webRTC.js.map +1 -0
- package/build/debug/index.d.ts +4 -0
- package/build/debug/index.d.ts.map +1 -0
- package/build/debug/index.js +3 -0
- package/build/debug/index.js.map +1 -0
- package/build/debug/stats/types.d.ts.map +1 -0
- package/build/debug/stats/types.js.map +1 -0
- package/build/debug/stats/useRTCStatistics.d.ts.map +1 -0
- package/build/{stats → debug/stats}/useRTCStatistics.js +1 -1
- package/build/debug/stats/useRTCStatistics.js.map +1 -0
- package/build/hooks/useAppScreenShare.d.ts +11 -0
- package/build/hooks/useAppScreenShare.d.ts.map +1 -0
- package/build/hooks/useAppScreenShare.js +54 -0
- package/build/hooks/useAppScreenShare.js.map +1 -0
- package/build/hooks/useFishjamEvent.d.ts +2 -0
- package/build/hooks/useFishjamEvent.d.ts.map +1 -1
- package/build/hooks/useFishjamEvent.js +2 -0
- package/build/hooks/useFishjamEvent.js.map +1 -1
- package/build/hooks/useForegroundService.d.ts +44 -0
- package/build/hooks/useForegroundService.d.ts.map +1 -0
- package/build/hooks/useForegroundService.js +57 -0
- package/build/hooks/useForegroundService.js.map +1 -0
- package/build/hooks/useMicrophone.d.ts +1 -1
- package/build/hooks/useMicrophone.js +1 -1
- package/build/hooks/useMicrophone.js.map +1 -1
- package/build/hooks/usePeerStatus.d.ts +19 -0
- package/build/hooks/usePeerStatus.d.ts.map +1 -0
- package/build/hooks/usePeerStatus.js +18 -0
- package/build/hooks/usePeerStatus.js.map +1 -0
- package/build/hooks/{useParticipants.d.ts → usePeers.d.ts} +11 -11
- package/build/hooks/usePeers.d.ts.map +1 -0
- package/build/hooks/usePeers.js +34 -0
- package/build/hooks/usePeers.js.map +1 -0
- package/build/hooks/useScreenShare.d.ts +1 -0
- package/build/hooks/useScreenShare.d.ts.map +1 -1
- package/build/hooks/useScreenShare.js +20 -13
- package/build/hooks/useScreenShare.js.map +1 -1
- package/build/index.d.ts +8 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -5
- package/build/index.js.map +1 -1
- package/build/types.d.ts +0 -25
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -10
- package/build/types.js.map +1 -1
- package/debug/package.json +4 -0
- package/ios/Events.swift +30 -13
- package/ios/RNFishjamClient.podspec +1 -1
- package/ios/RNFishjamClient.swift +196 -106
- package/ios/RNFishjamClientModule.swift +34 -34
- package/ios/VideoPreviewView.swift +26 -12
- package/ios/VideoRendererView.swift +5 -14
- package/package.json +7 -6
- package/plugin/build/withFishjamAndroid.js +1 -1
- package/plugin/build/withFishjamIos.js +2 -2
- package/build/hooks/useParticipants.d.ts.map +0 -1
- package/build/hooks/useParticipants.js +0 -34
- package/build/hooks/useParticipants.js.map +0 -1
- package/build/stats/types.d.ts.map +0 -1
- package/build/stats/types.js.map +0 -1
- package/build/stats/useRTCStatistics.d.ts.map +0 -1
- package/build/stats/useRTCStatistics.js.map +0 -1
- package/build/utils/foregroundService.d.ts +0 -32
- package/build/utils/foregroundService.d.ts.map +0 -1
- package/build/utils/foregroundService.js +0 -43
- package/build/utils/foregroundService.js.map +0 -1
- /package/build/{stats → debug/stats}/types.d.ts +0 -0
- /package/build/{stats → debug/stats}/types.js +0 -0
- /package/build/{stats → debug/stats}/useRTCStatistics.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,E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,IAAI,CAAC;CACnC,CAAC;AAGF,eAAO,MAAM,wBAAwB,cAAiC,CAAC;wBAExC,eAAe,GAAG,YAAY;AAA7D,wBAA8D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAyFtE,MAAM,YAAY,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;AAEvE,eAAe,YAA8C,CAAC","sourcesContent":["import { EventEmitter, requireNativeModule } from 'expo-modules-core';\nimport { NativeModule } from 'react-native';\n\nimport type { RTCStats } from './debug/stats/types';\nimport type { SimulcastConfig } from './types';\nimport type { CameraConfigInternal, Camera } from './hooks/useCamera';\nimport type { Peer } from './hooks/usePeers';\nimport type { ScreenShareOptionsInternal } from './hooks/useScreenShare';\nimport type { ConnectionConfig } from './common/client';\nimport { PeerStatus } from './hooks/usePeerStatus';\nimport {\n ForegroundServiceNotificationConfig,\n ForegroundServicePermissionsConfigInternal,\n} from './hooks/useForegroundService';\n\ntype Metadata = { [key: string]: any };\n\ntype RNFishjamClient = {\n isMicrophoneOn: boolean;\n isCameraOn: boolean;\n isScreenShareOn: boolean;\n isAppScreenShareOn: boolean; // only available on ios\n cameras: ReadonlyArray<Camera>;\n peerStatus: PeerStatus;\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<void>;\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 getPeers: <PeerMetadataType extends Metadata>() => Promise<\n Peer<PeerMetadataType>[]\n >;\n updatePeerMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateVideoTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateAudioTrackMetadata: <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 configureForegroundService: (\n config: ForegroundServiceNotificationConfig,\n ) => void;\n startForegroundService: (\n config: ForegroundServicePermissionsConfigInternal,\n ) => Promise<void>;\n stopForegroundService: () => void;\n};\n\nconst nativeModule = requireNativeModule('RNFishjamClient');\nexport const nativeModuleEventEmitter = new EventEmitter(nativeModule);\n\nexport default nativeModule as RNFishjamClient & NativeModule;\n"]}
|
package/build/common/client.d.ts
CHANGED
|
@@ -16,12 +16,12 @@ export type ConnectionConfig = {
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* @param url fishjam Url
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
19
|
+
* @param peerToken token received from server (or Room Manager)
|
|
20
|
+
* @param peerMetadata string indexed record with metadata, that will be available to all other peers
|
|
21
21
|
* @param config additional connection configuration
|
|
22
22
|
* @category Connection
|
|
23
23
|
*/
|
|
24
|
-
export declare function joinRoom<
|
|
24
|
+
export declare function joinRoom<PeerMetadata extends GenericMetadata = GenericMetadata>(url: string, peerToken: string, peerMetadata?: PeerMetadata, config?: ConnectionConfig): Promise<void>;
|
|
25
25
|
/**
|
|
26
26
|
* @category Connection
|
|
27
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,YAAY,SAAS,eAAe,GAAG,eAAe,EAEtD,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,YAAY,EAC3B,MAAM,CAAC,EAAE,gBAAgB,iBAQ1B;AACD;;GAEG;AACH,wBAAsB,SAAS,kBAE9B"}
|
package/build/common/client.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
2
2
|
/**
|
|
3
3
|
* @param url fishjam Url
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param peerToken token received from server (or Room Manager)
|
|
5
|
+
* @param peerMetadata string indexed record with metadata, that will be available to all other peers
|
|
6
6
|
* @param config additional connection configuration
|
|
7
7
|
* @category Connection
|
|
8
8
|
*/
|
|
9
|
-
export async function joinRoom(url,
|
|
10
|
-
await RNFishjamClientModule.joinRoom(url,
|
|
9
|
+
export async function joinRoom(url, peerToken, peerMetadata, config) {
|
|
10
|
+
await RNFishjamClientModule.joinRoom(url, peerToken, peerMetadata ?? {}, config ?? {});
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* @category Connection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAkB7D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,GAAW,EACX,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAkB7D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,GAAW,EACX,SAAiB,EACjB,YAA2B,EAC3B,MAAyB;IAEzB,MAAM,qBAAqB,CAAC,QAAQ,CAClC,GAAG,EACH,SAAS,EACT,YAAY,IAAI,EAAE,EAClB,MAAM,IAAI,EAAE,CACb,CAAC;AACJ,CAAC;AACD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,qBAAqB,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { GenericMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\nexport type ConnectionConfig = {\n /**\n * Configuration for automatic reconnection\n * sdk uses a linear backoff algorithm, that is the formula\n * for the delay of the nth attempt is\n * n * delayMs + initialDelayMs\n *\n * Pass 0 for maxAttempts to disable automatic reconnection\n */\n reconnectConfig?: {\n maxAttempts?: number;\n initialDelayMs?: number;\n delayMs?: number;\n };\n};\n\n/**\n * @param url fishjam Url\n * @param peerToken token received from server (or Room Manager)\n * @param peerMetadata string indexed record with metadata, that will be available to all other peers\n * @param config additional connection configuration\n * @category Connection\n */\nexport async function joinRoom<\n PeerMetadata extends GenericMetadata = GenericMetadata,\n>(\n url: string,\n peerToken: string,\n peerMetadata?: PeerMetadata,\n config?: ConnectionConfig,\n) {\n await RNFishjamClientModule.joinRoom(\n url,\n peerToken,\n peerMetadata ?? {},\n config ?? {},\n );\n}\n/**\n * @category Connection\n */\nexport async function leaveRoom() {\n await RNFishjamClientModule.leaveRoom();\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GenericMetadata } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Updates metadata send to other
|
|
4
|
-
* @param
|
|
3
|
+
* Updates metadata send to other peers
|
|
4
|
+
* @param peerMetadata string indexed record with metadata, that will be available to all other peers
|
|
5
5
|
* @category Connection
|
|
6
6
|
*/
|
|
7
|
-
export declare function updatePeerMetadata<
|
|
7
|
+
export declare function updatePeerMetadata<PeerMetadata extends GenericMetadata = GenericMetadata>(peerMetadata: PeerMetadata): Promise<void>;
|
|
8
8
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/common/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/common/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,SAAS,eAAe,GAAG,eAAe,EACtD,YAAY,EAAE,YAAY,iBAE3B"}
|
package/build/common/metadata.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
2
2
|
/**
|
|
3
|
-
* Updates metadata send to other
|
|
4
|
-
* @param
|
|
3
|
+
* Updates metadata send to other peers
|
|
4
|
+
* @param peerMetadata string indexed record with metadata, that will be available to all other peers
|
|
5
5
|
* @category Connection
|
|
6
6
|
*/
|
|
7
|
-
export async function updatePeerMetadata(
|
|
8
|
-
await RNFishjamClientModule.updatePeerMetadata(
|
|
7
|
+
export async function updatePeerMetadata(peerMetadata) {
|
|
8
|
+
await RNFishjamClientModule.updatePeerMetadata(peerMetadata);
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/common/metadata.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAEtC,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/common/metadata.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAEtC,YAA0B;IAC1B,MAAM,qBAAqB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import { GenericMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\n/**\n * Updates metadata send to other peers\n * @param peerMetadata string indexed record with metadata, that will be available to all other peers\n * @category Connection\n */\nexport async function updatePeerMetadata<\n PeerMetadata extends GenericMetadata = GenericMetadata,\n>(peerMetadata: PeerMetadata) {\n await RNFishjamClientModule.updatePeerMetadata(peerMetadata);\n}\n"]}
|
package/build/common/webRTC.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TrackEncoding } from '../types';
|
|
2
|
-
export type LoggingSeverity = 'verbose' | 'info' | 'warning' | 'error' | 'none';
|
|
3
2
|
/**
|
|
4
3
|
* sets track encoding that server should send to the client library.
|
|
5
4
|
* The encoding will be sent whenever it is available. If chooses encoding is
|
|
@@ -11,11 +10,4 @@ export type LoggingSeverity = 'verbose' | 'info' | 'warning' | 'error' | 'none';
|
|
|
11
10
|
* @category Debugging
|
|
12
11
|
*/
|
|
13
12
|
export declare function setTargetTrackEncoding(trackId: string, encoding: TrackEncoding): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Function that changes level of debugging logs in WebRTC.
|
|
16
|
-
* @param severity to use when displaying logs
|
|
17
|
-
* @returns a promise that is resolved when debug severity is changed
|
|
18
|
-
* @category Debugging
|
|
19
|
-
*/
|
|
20
|
-
export declare function changeWebRTCLoggingSeverity(severity: LoggingSeverity): Promise<void>;
|
|
21
13
|
//# sourceMappingURL=webRTC.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webRTC.d.ts","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC
|
|
1
|
+
{"version":3,"file":"webRTC.d.ts","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,iBAGxB"}
|
package/build/common/webRTC.js
CHANGED
|
@@ -12,13 +12,4 @@ import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
|
12
12
|
export async function setTargetTrackEncoding(trackId, encoding) {
|
|
13
13
|
await RNFishjamClientModule.setTargetTrackEncoding(trackId, encoding);
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Function that changes level of debugging logs in WebRTC.
|
|
17
|
-
* @param severity to use when displaying logs
|
|
18
|
-
* @returns a promise that is resolved when debug severity is changed
|
|
19
|
-
* @category Debugging
|
|
20
|
-
*/
|
|
21
|
-
export function changeWebRTCLoggingSeverity(severity) {
|
|
22
|
-
return RNFishjamClientModule.changeWebRTCLoggingSeverity(severity);
|
|
23
|
-
}
|
|
24
15
|
//# sourceMappingURL=webRTC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webRTC.js","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"webRTC.js","sourceRoot":"","sources":["../../src/common/webRTC.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAe,EACf,QAAuB;IAEvB,MAAM,qBAAqB,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { TrackEncoding } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\n/**\n * sets track encoding that server should send to the client library.\n * The encoding will be sent whenever it is available. If chooses encoding is\n * temporarily unavailable, some other encoding will be sent until choose encoding\n * becomes active again.\n *\n * @param trackId id of a track which encoding you want to select\n * @param encoding encoding to select\n * @category Debugging\n */\nexport async function setTargetTrackEncoding(\n trackId: string,\n encoding: TrackEncoding,\n) {\n await RNFishjamClientModule.setTargetTrackEncoding(trackId, encoding);\n}\n"]}
|
|
@@ -14,7 +14,7 @@ export type VideoRendererProps = {
|
|
|
14
14
|
style?: ViewStyle;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Render video track received from {@link
|
|
17
|
+
* Render video track received from {@link usePeers} hook
|
|
18
18
|
* @category Components
|
|
19
19
|
*/
|
|
20
20
|
export declare const VideoRendererView: React.ForwardRefExoticComponent<VideoRendererProps & React.RefAttributes<React.ComponentType<VideoRendererProps>>>;
|
|
@@ -2,7 +2,7 @@ import { requireNativeViewManager } from 'expo-modules-core';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
const NativeView = requireNativeViewManager('VideoRendererViewModule');
|
|
4
4
|
/**
|
|
5
|
-
* Render video track received from {@link
|
|
5
|
+
* Render video track received from {@link usePeers} hook
|
|
6
6
|
* @category Components
|
|
7
7
|
*/
|
|
8
8
|
export const VideoRendererView = React.forwardRef((props, ref) => (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoRendererView.js","sourceRoot":"","sources":["../../src/components/VideoRendererView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,UAAU,GACd,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAG/C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;AAChB,gDAAgD;AAChD,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CACpC,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport { ViewStyle } from 'react-native';\n\nimport { VideoLayout } from '../types';\n\nexport type VideoRendererProps = {\n /**\n * id of the video track which you want to render.\n */\n trackId: string;\n /**\n * Video layout inside of the component\n * @default `FILL`\n */\n videoLayout?: VideoLayout;\n style?: ViewStyle;\n};\n\nconst NativeView: React.ComponentType<VideoRendererProps> =\n requireNativeViewManager('VideoRendererViewModule');\n\n/**\n * Render video track received from {@link
|
|
1
|
+
{"version":3,"file":"VideoRendererView.js","sourceRoot":"","sources":["../../src/components/VideoRendererView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,UAAU,GACd,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAG/C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;AAChB,gDAAgD;AAChD,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CACpC,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\nimport { ViewStyle } from 'react-native';\n\nimport { VideoLayout } from '../types';\n\nexport type VideoRendererProps = {\n /**\n * id of the video track which you want to render.\n */\n trackId: string;\n /**\n * Video layout inside of the component\n * @default `FILL`\n */\n videoLayout?: VideoLayout;\n style?: ViewStyle;\n};\n\nconst NativeView: React.ComponentType<VideoRendererProps> =\n requireNativeViewManager('VideoRendererViewModule');\n\n/**\n * Render video track received from {@link usePeers} hook\n * @category Components\n */\nexport const VideoRendererView = React.forwardRef<\n React.ComponentType<VideoRendererProps>,\n VideoRendererProps\n>((props, ref) => (\n // @ts-expect-error ref prop needs to be updated\n <NativeView {...props} ref={ref} />\n));\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LoggingSeverity = 'verbose' | 'info' | 'warning' | 'error' | 'none';
|
|
2
|
+
/**
|
|
3
|
+
* Function that changes level of debugging logs in WebRTC.
|
|
4
|
+
* @param severity to use when displaying logs
|
|
5
|
+
* @returns a promise that is resolved when debug severity is changed
|
|
6
|
+
* @category Debugging
|
|
7
|
+
*/
|
|
8
|
+
export declare function changeWebRTCLoggingSeverity(severity: LoggingSeverity): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=webRTC.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webRTC.d.ts","sourceRoot":"","sources":["../../../src/debug/common/webRTC.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import RNFishjamClientModule from '../../RNFishjamClientModule';
|
|
2
|
+
/**
|
|
3
|
+
* Function that changes level of debugging logs in WebRTC.
|
|
4
|
+
* @param severity to use when displaying logs
|
|
5
|
+
* @returns a promise that is resolved when debug severity is changed
|
|
6
|
+
* @category Debugging
|
|
7
|
+
*/
|
|
8
|
+
export function changeWebRTCLoggingSeverity(severity) {
|
|
9
|
+
return RNFishjamClientModule.changeWebRTCLoggingSeverity(severity);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=webRTC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webRTC.js","sourceRoot":"","sources":["../../../src/debug/common/webRTC.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAIhE;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAyB;IAEzB,OAAO,qBAAqB,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import RNFishjamClientModule from '../../RNFishjamClientModule';\n\nexport type LoggingSeverity = 'verbose' | 'info' | 'warning' | 'error' | 'none';\n\n/**\n * Function that changes level of debugging logs in WebRTC.\n * @param severity to use when displaying logs\n * @returns a promise that is resolved when debug severity is changed\n * @category Debugging\n */\nexport function changeWebRTCLoggingSeverity(\n severity: LoggingSeverity,\n): Promise<void> {\n return RNFishjamClientModule.changeWebRTCLoggingSeverity(severity);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { useRTCStatistics } from './stats/useRTCStatistics';\n\nexport type { LoggingSeverity } from './common/webRTC';\nexport { changeWebRTCLoggingSeverity } from './common/webRTC';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/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C;AAE/D,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/debug/stats/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A record of the total time, in seconds,\n * that this stream has spent in each quality limitation state.\n * none: The resolution and/or framerate is not limited.\n * bandwidth: The resolution and/or framerate is primarily limited due to\n * congestion cues during bandwidth estimation.\n * Typical, congestion control algorithms use inter-arrival time,\n * round-trip time, packet or other congestion cues to perform bandwidth estimation.\n * cpu: The resolution and/or framerate is primarily limited due to CPU load.\n * other: The resolution and/or framerate is primarily limited\n * for a reason other than the above.\n */\nexport type QualityLimitationDurations = {\n bandwidth: number;\n cpu: number;\n none: number;\n other: number;\n};\n\nexport type RTCOutboundStats = {\n 'kind': string;\n 'rid': string;\n 'bytesSent': number;\n 'targetBitrate': number;\n 'packetsSent': number;\n 'framesEncoded': number;\n 'framesPerSecond': number;\n 'frameWidth': number;\n 'frameHeight': number;\n 'qualityLimitationDurations': QualityLimitationDurations;\n 'bytesSent/s': number;\n 'packetsSent/s': number;\n 'framesEncoded/s': number;\n};\n\nexport type RTCInboundStats = {\n 'kind': number;\n 'jitter': number;\n 'packetsLost': number;\n 'packetsReceived': number;\n 'bytesReceived': number;\n 'framesReceived': number;\n 'frameWidth': number;\n 'frameHeight': number;\n 'framesPerSecond': number;\n 'framesDropped': number;\n 'packetsLost/s': number;\n 'packetsReceived/s': number;\n 'bytesReceived/s': number;\n 'framesReceived/s': number;\n 'framesDropped/s': number;\n};\n\nexport type RTCTrackStats = RTCOutboundStats | RTCInboundStats;\n\nexport type RTCStats = { [key: string]: RTCTrackStats };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRTCStatistics.d.ts","sourceRoot":"","sources":["../../../src/debug/stats/useRTCStatistics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqC,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG3E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM;;EAuFvD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { takeRight } from 'lodash';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import RNFishjamClientModule from '
|
|
3
|
+
import RNFishjamClientModule from '../../RNFishjamClientModule';
|
|
4
4
|
/**
|
|
5
5
|
* This hook provides access to current rtc statistics data.
|
|
6
6
|
* @category Debugging
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRTCStatistics.js","sourceRoot":"","sources":["../../../src/debug/stats/useRTCStatistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzD,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,eAAuB;IACtD,MAAM,QAAQ,GAAG,GAAG,CAAC;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;IAE7D,sDAAsD;IACtD,gDAAgD;IAChD,MAAM,oBAAoB,GAAG,WAAW,CACtC,CAAC,UAAmC,EAAE,KAAyB,EAAE,EAAE;QACjE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAoB,CAAC;gBAE/C,IACE,UAAU,CAAC,MAAM,GAAG,CAAC;oBACrB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAA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AAC,aAAa,EAAE,eAAe,CAAC,CAAC;QAC/D,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,UAAU,CAAC,CAAC;YAC1B,aAAa,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC;IAErC,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import { takeRight } from 'lodash';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { RTCInboundStats, RTCOutboundStats, RTCStats } from './types';\nimport RNFishjamClientModule from '../../RNFishjamClientModule';\n\n/**\n * This hook provides access to current rtc statistics data.\n * @category Debugging\n */\nexport function useRTCStatistics(refreshInterval: number) {\n const MAX_SIZE = 120;\n const [statistics, setStatistics] = useState<RTCStats[]>([]);\n\n // Calculates diff between pervious and current stats,\n // providing end users with a per second metric.\n const processIncomingStats = useCallback(\n (statistics: ReadonlyArray<RTCStats>, stats: Readonly<RTCStats>) => {\n Object.keys(stats).forEach((obj) => {\n if (obj.includes('Inbound')) {\n const rtcStats = stats[obj] as RTCInboundStats;\n\n if (\n statistics.length > 0 &&\n Object.keys(statistics[statistics.length - 1]).includes(obj)\n ) {\n const prevRtcStats = statistics[statistics.length - 1][\n obj\n ] as RTCInboundStats;\n\n rtcStats['packetsLost/s'] =\n rtcStats['packetsLost'] - prevRtcStats['packetsLost'];\n rtcStats['packetsReceived/s'] =\n rtcStats['packetsReceived'] - prevRtcStats['packetsReceived'];\n rtcStats['bytesReceived/s'] =\n rtcStats['bytesReceived'] - prevRtcStats['bytesReceived'];\n rtcStats['framesReceived/s'] =\n rtcStats['framesReceived'] - prevRtcStats['framesReceived'];\n rtcStats['framesDropped/s'] =\n rtcStats['framesDropped'] - prevRtcStats['framesDropped'];\n } else {\n rtcStats['packetsLost/s'] = 0;\n rtcStats['packetsReceived/s'] = 0;\n rtcStats['bytesReceived/s'] = 0;\n rtcStats['framesReceived/s'] = 0;\n rtcStats['framesDropped/s'] = 0;\n }\n return stats;\n }\n // Outbound\n const rtcStats = stats[obj] as RTCOutboundStats;\n\n if (\n statistics.length > 0 &&\n Object.keys(statistics[statistics.length - 1]).includes(obj)\n ) {\n const prevRtcStats = statistics[statistics.length - 1][\n obj\n ] as RTCOutboundStats;\n\n rtcStats['bytesSent/s'] =\n rtcStats['bytesSent'] - prevRtcStats['bytesSent'];\n rtcStats['packetsSent/s'] =\n rtcStats['packetsSent'] - prevRtcStats['packetsSent'];\n rtcStats['framesEncoded/s'] =\n rtcStats['framesEncoded'] - prevRtcStats['framesEncoded'];\n } else {\n rtcStats['bytesSent/s'] = 0;\n rtcStats['packetsSent/s'] = 0;\n rtcStats['framesEncoded/s'] = 0;\n }\n return stats;\n });\n return stats;\n },\n [],\n );\n\n // Gets stats from the native libraries.\n const getStatistics = useCallback(async () => {\n const stats = await RNFishjamClientModule.getStatistics();\n setStatistics((prev) => {\n const newStats = [...prev, processIncomingStats(prev, stats)];\n takeRight(newStats, MAX_SIZE);\n return newStats;\n });\n }, [processIncomingStats]);\n\n useEffect(() => {\n const intervalId = setInterval(getStatistics, refreshInterval);\n return () => {\n clearInterval(intervalId);\n setStatistics([]);\n };\n }, [getStatistics, refreshInterval]);\n\n return { statistics };\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SimulcastConfig } from '../types';
|
|
2
|
+
import { ScreenShareOptions } from './useScreenShare';
|
|
3
|
+
type AppScreenShareData = {
|
|
4
|
+
isAppScreenShareOn: boolean;
|
|
5
|
+
simulcastConfig: SimulcastConfig;
|
|
6
|
+
toggleAppScreenShare: (screenShareOptions?: Partial<ScreenShareOptions>) => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
declare function useDefaultAppScreenShareAndroid(): AppScreenShareData;
|
|
9
|
+
export declare const useAppScreenShare: typeof useDefaultAppScreenShareAndroid;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useAppScreenShare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppScreenShare.d.ts","sourceRoot":"","sources":["../../src/hooks/useAppScreenShare.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAUtD,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,oBAAoB,EAAE,CACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC;AA+CF,iBAAS,+BAA+B,IAAI,kBAAkB,CAM7D;AAED,eAAO,MAAM,iBAAiB,wCAG5B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
3
|
+
import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
const defaultSimulcastConfig = () => ({
|
|
6
|
+
enabled: false,
|
|
7
|
+
activeEncodings: [],
|
|
8
|
+
});
|
|
9
|
+
let screenShareSimulcastConfig = defaultSimulcastConfig();
|
|
10
|
+
/**
|
|
11
|
+
* This hook can toggle client app screen sharing on/off and provides current screen share state. It works only on iOS.
|
|
12
|
+
* @returns An object with functions to manage app screen share on iOS and null on android.
|
|
13
|
+
* @category Screenshare
|
|
14
|
+
* @group Hooks
|
|
15
|
+
*/
|
|
16
|
+
function useIosAppScreenShare() {
|
|
17
|
+
const [isAppScreenShareOn, setIsAppScreenShareOn] = useState(RNFishjamClientModule.isAppScreenShareOn);
|
|
18
|
+
const [simulcastConfig, setSimulcastConfig] = useState(screenShareSimulcastConfig);
|
|
19
|
+
useFishjamEvent(ReceivableEvents.IsAppScreenShareOn, setIsAppScreenShareOn);
|
|
20
|
+
const toggleAppScreenShare = useCallback(async (screenShareOptions = {}) => {
|
|
21
|
+
const options = {
|
|
22
|
+
...screenShareOptions,
|
|
23
|
+
screenShareMetadata: {
|
|
24
|
+
displayName: 'presenting',
|
|
25
|
+
type: 'screensharing',
|
|
26
|
+
active: !isAppScreenShareOn,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
await RNFishjamClientModule.toggleAppScreenShare(options);
|
|
30
|
+
screenShareSimulcastConfig = defaultSimulcastConfig(); //to do: sync with camera settings
|
|
31
|
+
setSimulcastConfig(screenShareSimulcastConfig);
|
|
32
|
+
}, [isAppScreenShareOn]);
|
|
33
|
+
return {
|
|
34
|
+
isAppScreenShareOn,
|
|
35
|
+
simulcastConfig,
|
|
36
|
+
/**
|
|
37
|
+
* Toggles the screen share on/off.
|
|
38
|
+
* Emits warning on ios when user is screensharing full screen.
|
|
39
|
+
*/
|
|
40
|
+
toggleAppScreenShare,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function useDefaultAppScreenShareAndroid() {
|
|
44
|
+
return {
|
|
45
|
+
isAppScreenShareOn: false,
|
|
46
|
+
simulcastConfig: defaultSimulcastConfig(),
|
|
47
|
+
toggleAppScreenShare: async () => { },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export const useAppScreenShare = Platform.select({
|
|
51
|
+
ios: useIosAppScreenShare,
|
|
52
|
+
default: useDefaultAppScreenShareAndroid,
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=useAppScreenShare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppScreenShare.js","sourceRoot":"","sources":["../../src/hooks/useAppScreenShare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAA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CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,oBAAoB;IACzB,OAAO,EAAE,+BAA+B;CACzC,CAAC,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { SimulcastConfig } from '../types';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\nimport { ScreenShareOptions } from './useScreenShare';\nimport { Platform } from 'react-native';\n\nconst defaultSimulcastConfig = () => ({\n enabled: false,\n activeEncodings: [],\n});\n\nlet screenShareSimulcastConfig: SimulcastConfig = defaultSimulcastConfig();\n\ntype AppScreenShareData = {\n isAppScreenShareOn: boolean;\n simulcastConfig: SimulcastConfig;\n toggleAppScreenShare: (\n screenShareOptions?: Partial<ScreenShareOptions>,\n ) => Promise<void>;\n};\n\n/**\n * This hook can toggle client app screen sharing on/off and provides current screen share state. It works only on iOS.\n * @returns An object with functions to manage app screen share on iOS and null on android.\n * @category Screenshare\n * @group Hooks\n */\nfunction useIosAppScreenShare(): AppScreenShareData {\n const [isAppScreenShareOn, setIsAppScreenShareOn] = useState(\n RNFishjamClientModule.isAppScreenShareOn,\n );\n\n const [simulcastConfig, setSimulcastConfig] = useState<SimulcastConfig>(\n screenShareSimulcastConfig,\n );\n\n useFishjamEvent(ReceivableEvents.IsAppScreenShareOn, setIsAppScreenShareOn);\n\n const toggleAppScreenShare = useCallback(\n async (screenShareOptions: Partial<ScreenShareOptions> = {}) => {\n const options = {\n ...screenShareOptions,\n screenShareMetadata: {\n displayName: 'presenting',\n type: 'screensharing' as const,\n active: !isAppScreenShareOn,\n },\n };\n await RNFishjamClientModule.toggleAppScreenShare(options);\n screenShareSimulcastConfig = defaultSimulcastConfig(); //to do: sync with camera settings\n setSimulcastConfig(screenShareSimulcastConfig);\n },\n [isAppScreenShareOn],\n );\n\n return {\n isAppScreenShareOn,\n simulcastConfig,\n /**\n * Toggles the screen share on/off.\n * Emits warning on ios when user is screensharing full screen.\n */\n toggleAppScreenShare,\n };\n}\n\nfunction useDefaultAppScreenShareAndroid(): AppScreenShareData {\n return {\n isAppScreenShareOn: false,\n simulcastConfig: defaultSimulcastConfig(),\n toggleAppScreenShare: async () => {},\n };\n}\n\nexport const useAppScreenShare = Platform.select({\n ios: useIosAppScreenShare,\n default: useDefaultAppScreenShareAndroid,\n});\n"]}
|
|
@@ -2,6 +2,7 @@ export declare const ReceivableEvents: {
|
|
|
2
2
|
readonly IsCameraOn: "IsCameraOn";
|
|
3
3
|
readonly IsMicrophoneOn: "IsMicrophoneOn";
|
|
4
4
|
readonly IsScreenShareOn: "IsScreenShareOn";
|
|
5
|
+
readonly IsAppScreenShareOn: "IsAppScreenShareOn";
|
|
5
6
|
readonly SimulcastConfigUpdate: "SimulcastConfigUpdate";
|
|
6
7
|
readonly PeersUpdate: "PeersUpdate";
|
|
7
8
|
readonly AudioDeviceUpdate: "AudioDeviceUpdate";
|
|
@@ -11,6 +12,7 @@ export declare const ReceivableEvents: {
|
|
|
11
12
|
readonly ReconnectionStarted: "ReconnectionStarted";
|
|
12
13
|
readonly Reconnected: "Reconnected";
|
|
13
14
|
readonly Warning: "Warning";
|
|
15
|
+
readonly PeerStatusChanged: "PeerStatusChanged";
|
|
14
16
|
};
|
|
15
17
|
export declare function useFishjamEvent<T>(eventName: keyof typeof ReceivableEvents, callback: (event: T) => void): void;
|
|
16
18
|
//# sourceMappingURL=useFishjamEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAenB,CAAC;AAEX,wBAAgB,eAAe,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,OAAO,gBAAgB,EACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAU7B"}
|
|
@@ -4,6 +4,7 @@ export const ReceivableEvents = {
|
|
|
4
4
|
IsCameraOn: 'IsCameraOn',
|
|
5
5
|
IsMicrophoneOn: 'IsMicrophoneOn',
|
|
6
6
|
IsScreenShareOn: 'IsScreenShareOn',
|
|
7
|
+
IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS
|
|
7
8
|
SimulcastConfigUpdate: 'SimulcastConfigUpdate',
|
|
8
9
|
PeersUpdate: 'PeersUpdate',
|
|
9
10
|
AudioDeviceUpdate: 'AudioDeviceUpdate',
|
|
@@ -13,6 +14,7 @@ export const ReceivableEvents = {
|
|
|
13
14
|
ReconnectionStarted: 'ReconnectionStarted',
|
|
14
15
|
Reconnected: 'Reconnected',
|
|
15
16
|
Warning: 'Warning',
|
|
17
|
+
PeerStatusChanged: 'PeerStatusChanged',
|
|
16
18
|
};
|
|
17
19
|
export function useFishjamEvent(eventName, callback) {
|
|
18
20
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFishjamEvent.js","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"useFishjamEvent.js","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,YAAY;IACxB,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,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC;AAEX,MAAM,UAAU,eAAe,CAC7B,SAAwC,EACxC,QAA4B;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,wBAAwB,CAAC,WAAW,CAExD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACrB,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IACtC,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport { nativeModuleEventEmitter } from '../RNFishjamClientModule';\n\nexport const ReceivableEvents = {\n IsCameraOn: 'IsCameraOn',\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreenShareOn: 'IsScreenShareOn',\n IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n SendMediaEvent: 'SendMediaEvent',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n Warning: 'Warning',\n PeerStatusChanged: 'PeerStatusChanged',\n} as const;\n\nexport function useFishjamEvent<T>(\n eventName: keyof typeof ReceivableEvents,\n callback: (event: T) => void,\n) {\n useEffect(() => {\n const eventListener = nativeModuleEventEmitter.addListener<\n Record<keyof typeof ReceivableEvents, T>\n >(eventName, (event) => {\n callback(event[eventName]);\n });\n return () => eventListener.remove();\n }, [callback, eventName]);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type ForegroundServicePermissionsConfigInternal = {
|
|
2
|
+
enableCamera?: boolean;
|
|
3
|
+
enableMicrophone?: boolean;
|
|
4
|
+
enableScreenSharing?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A type representing the options required for configuring the foreground service notifcation.
|
|
8
|
+
*
|
|
9
|
+
* @param channelId The id of the channel. Must be unique per package.
|
|
10
|
+
* @param channelName The user visible name of the channel.
|
|
11
|
+
* @param notificationTitle The title (first row) of the notification, in a standard notification.
|
|
12
|
+
* @param notificationContent The text (second row) of the notification, in a standard notification.
|
|
13
|
+
*/
|
|
14
|
+
export type ForegroundServiceNotificationConfig = {
|
|
15
|
+
channelId: string;
|
|
16
|
+
channelName: string;
|
|
17
|
+
notificationTitle: string;
|
|
18
|
+
notificationContent: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A type representing the configuration for foreground service permissions.
|
|
22
|
+
*
|
|
23
|
+
* @param enableCamera Indicates whether the camera is enabled for the foreground service.
|
|
24
|
+
* @param enableMicrophone Indicates whether the microphone is enabled for the foreground service.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export type ForegroundServicePermissionsConfig = Pick<ForegroundServicePermissionsConfigInternal, 'enableCamera' | 'enableMicrophone'>;
|
|
28
|
+
/**
|
|
29
|
+
* useForegroundService
|
|
30
|
+
*
|
|
31
|
+
* A hook for managing a foreground service on Android. Does nothing on other platforms.
|
|
32
|
+
* You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing.
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} config - Configuration options for the foreground service.
|
|
35
|
+
* @param {boolean} config.enableCamera - Flag to enable or disable camera usage in the foreground service. Only enable after the user has granted the necessary permissions.
|
|
36
|
+
* @param {boolean} config.enableMicrophone - Flag to enable or disable microphone usage in the foreground service. Only enable after the user has granted the necessary permissions.
|
|
37
|
+
* @param {Object} config.channelId - The id of the channel. Must be unique per package.
|
|
38
|
+
* @param {Object} config.channelName - The user visible name of the channel.
|
|
39
|
+
* @param {Object} config.notificationTitle - The title (first row) of the notification, in a standard notification.
|
|
40
|
+
* @param {Object} config.notificationContent - The text (second row) of the notification, in a standard notification.
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
export declare const useForegroundService: ({ enableCamera, enableMicrophone, ...restOptions }: ForegroundServiceNotificationConfig & ForegroundServicePermissionsConfig) => void;
|
|
44
|
+
//# sourceMappingURL=useForegroundService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForegroundService.d.ts","sourceRoot":"","sources":["../../src/hooks/useForegroundService.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,0CAA0C,GAAG;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AACF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG,IAAI,CACnD,0CAA0C,EAC1C,cAAc,GAAG,kBAAkB,CACpC,CAAC;AAiDF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,uDA3C9B,mCAAmC,GACpC,kCAAkC,SA6ClC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
3
|
+
import { PermissionsAndroid, Platform } from 'react-native';
|
|
4
|
+
const requestNotificationsPermission = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const result = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
|
|
7
|
+
if (result !== PermissionsAndroid.RESULTS.GRANTED) {
|
|
8
|
+
console.warn("Notifications permission not granted. User won't be able to see a the app is in background.");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
console.warn(err);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const useForegroundServiceAndroid = ({ enableCamera, enableMicrophone, ...restOptions }) => {
|
|
16
|
+
const [isConfigured, setIsConfigured] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isConfigured) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
RNFishjamClientModule.startForegroundService({
|
|
22
|
+
enableCamera,
|
|
23
|
+
enableMicrophone,
|
|
24
|
+
});
|
|
25
|
+
}, [enableCamera, enableMicrophone, isConfigured]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const runConfiguration = async () => {
|
|
28
|
+
await requestNotificationsPermission();
|
|
29
|
+
RNFishjamClientModule.configureForegroundService(restOptions);
|
|
30
|
+
setIsConfigured(true);
|
|
31
|
+
};
|
|
32
|
+
runConfiguration();
|
|
33
|
+
return () => RNFishjamClientModule.stopForegroundService();
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, []);
|
|
36
|
+
};
|
|
37
|
+
const emptyFunction = () => { };
|
|
38
|
+
/**
|
|
39
|
+
* useForegroundService
|
|
40
|
+
*
|
|
41
|
+
* A hook for managing a foreground service on Android. Does nothing on other platforms.
|
|
42
|
+
* You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} config - Configuration options for the foreground service.
|
|
45
|
+
* @param {boolean} config.enableCamera - Flag to enable or disable camera usage in the foreground service. Only enable after the user has granted the necessary permissions.
|
|
46
|
+
* @param {boolean} config.enableMicrophone - Flag to enable or disable microphone usage in the foreground service. Only enable after the user has granted the necessary permissions.
|
|
47
|
+
* @param {Object} config.channelId - The id of the channel. Must be unique per package.
|
|
48
|
+
* @param {Object} config.channelName - The user visible name of the channel.
|
|
49
|
+
* @param {Object} config.notificationTitle - The title (first row) of the notification, in a standard notification.
|
|
50
|
+
* @param {Object} config.notificationContent - The text (second row) of the notification, in a standard notification.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export const useForegroundService = Platform.select({
|
|
54
|
+
android: useForegroundServiceAndroid,
|
|
55
|
+
default: emptyFunction,
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=useForegroundService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForegroundService.js","sourceRoot":"","sources":["../../src/hooks/useForegroundService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAkC5D,MAAM,8BAA8B,GAAG,KAAK,I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;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\n\nimport { PermissionsAndroid, Platform } from 'react-native';\n\nexport type ForegroundServicePermissionsConfigInternal = {\n enableCamera?: boolean;\n enableMicrophone?: boolean;\n enableScreenSharing?: boolean;\n};\n\n/**\n * A type representing the options required for configuring the foreground service notifcation.\n *\n * @param channelId The id of the channel. Must be unique per package.\n * @param channelName The user visible name of the channel.\n * @param notificationTitle The title (first row) of the notification, in a standard notification.\n * @param notificationContent The text (second row) of the notification, in a standard notification.\n */\nexport type ForegroundServiceNotificationConfig = {\n channelId: string;\n channelName: string;\n notificationTitle: string;\n notificationContent: string;\n};\n/**\n * A type representing the configuration for foreground service permissions.\n *\n * @param enableCamera Indicates whether the camera is enabled for the foreground service.\n * @param enableMicrophone Indicates whether the microphone is enabled for the foreground service.\n *\n */\nexport type ForegroundServicePermissionsConfig = Pick<\n ForegroundServicePermissionsConfigInternal,\n 'enableCamera' | 'enableMicrophone'\n>;\n\nconst requestNotificationsPermission = async () => {\n try {\n const result = await PermissionsAndroid.request(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS,\n );\n if (result !== PermissionsAndroid.RESULTS.GRANTED) {\n console.warn(\n \"Notifications permission not granted. User won't be able to see a the app is in background.\",\n );\n }\n } catch (err) {\n console.warn(err);\n }\n};\n\nconst useForegroundServiceAndroid = ({\n enableCamera,\n enableMicrophone,\n ...restOptions\n}: ForegroundServiceNotificationConfig &\n ForegroundServicePermissionsConfig) => {\n const [isConfigured, setIsConfigured] = useState(false);\n\n useEffect(() => {\n if (!isConfigured) {\n return;\n }\n RNFishjamClientModule.startForegroundService({\n enableCamera,\n enableMicrophone,\n });\n }, [enableCamera, enableMicrophone, isConfigured]);\n\n useEffect(() => {\n const runConfiguration = async () => {\n await requestNotificationsPermission();\n RNFishjamClientModule.configureForegroundService(restOptions);\n setIsConfigured(true);\n };\n runConfiguration();\n return () => RNFishjamClientModule.stopForegroundService();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n};\n\nconst emptyFunction = () => {};\n\n/**\n * useForegroundService\n *\n * A hook for managing a foreground service on Android. Does nothing on other platforms.\n * You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing.\n *\n * @param {Object} config - Configuration options for the foreground service.\n * @param {boolean} config.enableCamera - Flag to enable or disable camera usage in the foreground service. Only enable after the user has granted the necessary permissions.\n * @param {boolean} config.enableMicrophone - Flag to enable or disable microphone usage in the foreground service. Only enable after the user has granted the necessary permissions.\n * @param {Object} config.channelId - The id of the channel. Must be unique per package.\n * @param {Object} config.channelName - The user visible name of the channel.\n * @param {Object} config.notificationTitle - The title (first row) of the notification, in a standard notification.\n * @param {Object} config.notificationContent - The text (second row) of the notification, in a standard notification.\n *\n */\nexport const useForegroundService = Platform.select({\n android: useForegroundServiceAndroid,\n default: emptyFunction,\n});\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @group Hooks
|
|
5
5
|
*/
|
|
6
6
|
export declare function useMicrophone(): {
|
|
7
|
-
/** Informs if
|
|
7
|
+
/** Informs if microphone is streaming audio */
|
|
8
8
|
isMicrophoneOn: boolean;
|
|
9
9
|
/** Function to toggle microphone on/off */
|
|
10
10
|
toggleMicrophone: () => Promise<void>;
|
|
@@ -18,7 +18,7 @@ export function useMicrophone() {
|
|
|
18
18
|
setIsMicrophoneOn(status);
|
|
19
19
|
}, []);
|
|
20
20
|
return {
|
|
21
|
-
/** Informs if
|
|
21
|
+
/** Informs if microphone is streaming audio */
|
|
22
22
|
isMicrophoneOn,
|
|
23
23
|
/** Function to toggle microphone on/off */
|
|
24
24
|
toggleMicrophone,
|