@fishjam-cloud/react-native-client 0.2.2 → 0.2.3
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/android/build.gradle +1 -1
- package/android/src/main/java/io/fishjam/reactnative/EmitableEvents.kt +1 -0
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClient.kt +13 -0
- package/android/src/main/java/io/fishjam/reactnative/RNFishjamClientModule.kt +2 -1
- package/build/RNFishjamClientModule.d.ts +2 -0
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js +2 -1
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/common/client.d.ts +4 -1
- package/build/common/client.d.ts.map +1 -1
- package/build/common/client.js +4 -1
- package/build/common/client.js.map +1 -1
- package/build/common/metadata.d.ts +1 -0
- package/build/common/metadata.d.ts.map +1 -1
- package/build/common/metadata.js +1 -0
- package/build/common/metadata.js.map +1 -1
- package/build/common/webRTC.d.ts +2 -0
- package/build/common/webRTC.d.ts.map +1 -1
- package/build/common/webRTC.js +2 -0
- package/build/common/webRTC.js.map +1 -1
- package/build/components/VideoPreviewView.d.ts +6 -3
- package/build/components/VideoPreviewView.d.ts.map +1 -1
- package/build/components/VideoPreviewView.js +5 -0
- package/build/components/VideoPreviewView.js.map +1 -1
- package/build/components/VideoRendererView.d.ts +5 -3
- package/build/components/VideoRendererView.d.ts.map +1 -1
- package/build/components/VideoRendererView.js +4 -0
- package/build/components/VideoRendererView.js.map +1 -1
- package/build/hooks/useAudioSettings.d.ts +15 -0
- package/build/hooks/useAudioSettings.d.ts.map +1 -1
- package/build/hooks/useAudioSettings.js +15 -13
- package/build/hooks/useAudioSettings.js.map +1 -1
- package/build/hooks/useBandwidthEstimation.d.ts +2 -0
- package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
- package/build/hooks/useBandwidthEstimation.js +2 -0
- package/build/hooks/useBandwidthEstimation.js.map +1 -1
- package/build/hooks/useCamera.d.ts +45 -1
- package/build/hooks/useCamera.d.ts.map +1 -1
- package/build/hooks/useCamera.js +45 -37
- package/build/hooks/useCamera.js.map +1 -1
- package/build/hooks/useFishjamEvent.d.ts +1 -0
- package/build/hooks/useFishjamEvent.d.ts.map +1 -1
- package/build/hooks/useFishjamEvent.js +3 -4
- package/build/hooks/useFishjamEvent.js.map +1 -1
- package/build/hooks/useMicrophone.d.ts +4 -0
- package/build/hooks/useMicrophone.d.ts.map +1 -1
- package/build/hooks/useMicrophone.js +8 -4
- package/build/hooks/useMicrophone.js.map +1 -1
- package/build/hooks/useParticipants.d.ts +2 -0
- package/build/hooks/useParticipants.d.ts.map +1 -1
- package/build/hooks/useParticipants.js +2 -0
- package/build/hooks/useParticipants.js.map +1 -1
- package/build/hooks/useReconnection.d.ts +6 -0
- package/build/hooks/useReconnection.d.ts.map +1 -1
- package/build/hooks/useReconnection.js +6 -0
- package/build/hooks/useReconnection.js.map +1 -1
- package/build/hooks/useScreencast.d.ts +22 -3
- package/build/hooks/useScreencast.d.ts.map +1 -1
- package/build/hooks/useScreencast.js +30 -22
- package/build/hooks/useScreencast.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/stats/useRTCStatistics.d.ts +1 -0
- package/build/stats/useRTCStatistics.d.ts.map +1 -1
- package/build/stats/useRTCStatistics.js +1 -0
- package/build/stats/useRTCStatistics.js.map +1 -1
- package/build/types.d.ts +6 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/utils/errorListener.d.ts +2 -0
- package/build/utils/errorListener.d.ts.map +1 -0
- package/build/utils/errorListener.js +16 -0
- package/build/utils/errorListener.js.map +1 -0
- package/build/utils/foregroundService.d.ts +2 -0
- package/build/utils/foregroundService.d.ts.map +1 -1
- package/build/utils/foregroundService.js +2 -0
- package/build/utils/foregroundService.js.map +1 -1
- package/ios/Events.swift +1 -0
- package/ios/RNFishjamClient.podspec +1 -1
- package/ios/RNFishjamClient.swift +14 -0
- package/package.json +4 -3
- package/plugin/broadcastExtensionFiles/FishjamBroadcastSampleHandler.swift +50 -0
- package/plugin/broadcastExtensionFiles/FishjamScreenBroadcastExtension.entitlements +10 -0
- package/plugin/broadcastExtensionFiles/Info.plist +27 -0
- package/plugin/build/types.d.ts +5 -5
- package/plugin/build/withFishjamAndroid.js +2 -2
- package/plugin/build/withFishjamIos.js +3 -3
package/build/hooks/useCamera.js
CHANGED
|
@@ -45,6 +45,8 @@ export function updateCameraConfig(config) {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* This hook can toggle camera on/off and provides current camera state.
|
|
48
|
+
* @category Devices
|
|
49
|
+
* @group Hooks
|
|
48
50
|
*/
|
|
49
51
|
export function useCamera() {
|
|
50
52
|
const [isCameraOn, setIsCameraOn] = useState(RNFishjamClientModule.isCameraOn);
|
|
@@ -52,18 +54,9 @@ export function useCamera() {
|
|
|
52
54
|
const [simulcastConfig, setSimulcastConfig] = useState(defaultSimulcastConfig());
|
|
53
55
|
useFishjamEvent(ReceivableEvents.SimulcastConfigUpdate, setSimulcastConfig);
|
|
54
56
|
useFishjamEvent(ReceivableEvents.IsCameraOn, setIsCameraOn);
|
|
55
|
-
/**
|
|
56
|
-
* Property that lists cameras available on device.
|
|
57
|
-
* @returns A promise that resolves to the list of available cameras.
|
|
58
|
-
*/
|
|
59
57
|
const cameras = useMemo(() => {
|
|
60
58
|
return RNFishjamClientModule.cameras;
|
|
61
59
|
}, []);
|
|
62
|
-
/**
|
|
63
|
-
* Prepares camera and starts local camera capture.
|
|
64
|
-
* @param config configuration of the camera capture
|
|
65
|
-
* @returns A promise that resolves when camera is started.
|
|
66
|
-
*/
|
|
67
60
|
const prepareCamera = useCallback(async (config = {}) => {
|
|
68
61
|
const camera = RNFishjamClientModule.cameras.find((camera) => config.cameraId
|
|
69
62
|
? camera.id === config.cameraId
|
|
@@ -75,9 +68,6 @@ export function useCamera() {
|
|
|
75
68
|
});
|
|
76
69
|
await RNFishjamClientModule.startCamera(updatedConfig);
|
|
77
70
|
}, []);
|
|
78
|
-
/**
|
|
79
|
-
* Toggles camera on/off
|
|
80
|
-
*/
|
|
81
71
|
const toggleCamera = useCallback(async () => {
|
|
82
72
|
const state = await RNFishjamClientModule.toggleCamera();
|
|
83
73
|
await RNFishjamClientModule.updateVideoTrackMetadata({
|
|
@@ -86,54 +76,72 @@ export function useCamera() {
|
|
|
86
76
|
});
|
|
87
77
|
setIsCameraOn(state);
|
|
88
78
|
}, []);
|
|
89
|
-
/**
|
|
90
|
-
* Switches to the specified camera.
|
|
91
|
-
* List of available devices can be retrieved from `cameras` variable
|
|
92
|
-
* @returns A promise that resolves when camera is switched.
|
|
93
|
-
*/
|
|
94
79
|
const switchCamera = useCallback(async (cameraId) => {
|
|
95
80
|
await RNFishjamClientModule.switchCamera(cameraId);
|
|
96
81
|
setCurrentCamera(cameras.find((camera) => camera.id === cameraId));
|
|
97
82
|
}, [cameras]);
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated
|
|
100
|
-
* updates maximum bandwidth for the video track. This value directly translates
|
|
101
|
-
* to quality of the stream and the amount of RTP packets being sent. In case simulcast
|
|
102
|
-
* is enabled bandwidth is split between all of the variant streams proportionally to
|
|
103
|
-
* their resolution.
|
|
104
|
-
* @param BandwidthLimit to set
|
|
105
|
-
*/
|
|
106
83
|
const setVideoTrackBandwidth = useCallback(async (bandwidth) => {
|
|
107
84
|
await RNFishjamClientModule.setVideoTrackBandwidth(bandwidth);
|
|
108
85
|
}, []);
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated
|
|
111
|
-
* toggles encoding of a video track on/off
|
|
112
|
-
* @param encoding encoding to toggle
|
|
113
|
-
*/
|
|
114
86
|
const toggleVideoTrackEncoding = useCallback(async (encoding) => {
|
|
115
87
|
const videoSimulcastConfig = await RNFishjamClientModule.toggleVideoTrackEncoding(encoding);
|
|
116
88
|
setSimulcastConfig(videoSimulcastConfig);
|
|
117
89
|
}, []);
|
|
118
|
-
/**
|
|
119
|
-
* @deprecated
|
|
120
|
-
* updates maximum bandwidth for the given simulcast encoding of the video track
|
|
121
|
-
* @param encoding encoding to update
|
|
122
|
-
* @param bandwidth BandwidthLimit to set
|
|
123
|
-
*/
|
|
124
90
|
const setVideoTrackEncodingBandwidth = useCallback(async (encoding, bandwidth) => {
|
|
125
91
|
await RNFishjamClientModule.setVideoTrackEncodingBandwidth(encoding, bandwidth);
|
|
126
92
|
}, []);
|
|
127
93
|
return {
|
|
94
|
+
/**
|
|
95
|
+
* Informs if user camera is streaming video
|
|
96
|
+
*/
|
|
128
97
|
isCameraOn,
|
|
98
|
+
/**
|
|
99
|
+
* Which camera is now used for streaming (or will be used as default when camera will be enabled)
|
|
100
|
+
*/
|
|
129
101
|
currentCamera,
|
|
102
|
+
/**
|
|
103
|
+
* Simulcast configuration
|
|
104
|
+
*/
|
|
130
105
|
simulcastConfig,
|
|
106
|
+
/**
|
|
107
|
+
* Property that lists cameras available on device.
|
|
108
|
+
* @returns A promise that resolves to the list of available cameras.
|
|
109
|
+
*/
|
|
131
110
|
cameras,
|
|
111
|
+
/** Enable/disable current camera */
|
|
132
112
|
toggleCamera,
|
|
113
|
+
/**
|
|
114
|
+
* Prepares camera and starts local video track
|
|
115
|
+
* @param config configuration of the camera capture
|
|
116
|
+
* @returns A promise that resolves when camera is started.
|
|
117
|
+
*/
|
|
133
118
|
prepareCamera,
|
|
134
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Switches to the specified camera.
|
|
121
|
+
* List of available devices can be retrieved from `cameras` variable
|
|
122
|
+
* @returns A promise that resolves when camera is switched.
|
|
123
|
+
*/ switchCamera,
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated
|
|
126
|
+
* toggles encoding of a video track on/off
|
|
127
|
+
* @param encoding encoding to toggle
|
|
128
|
+
*/
|
|
135
129
|
toggleVideoTrackEncoding,
|
|
130
|
+
/**
|
|
131
|
+
* updates maximum bandwidth for the given simulcast encoding of the video track
|
|
132
|
+
* @param encoding encoding to update
|
|
133
|
+
* @param bandwidth BandwidthLimit to set
|
|
134
|
+
* @deprecated
|
|
135
|
+
*/
|
|
136
136
|
setVideoTrackEncodingBandwidth,
|
|
137
|
+
/**
|
|
138
|
+
* updates maximum bandwidth for the video track. This value directly translates
|
|
139
|
+
* to quality of the stream and the amount of RTP packets being sent. In case simulcast
|
|
140
|
+
* is enabled bandwidth is split between all of the variant streams proportionally to
|
|
141
|
+
* their resolution.
|
|
142
|
+
* @param BandwidthLimit to set
|
|
143
|
+
* @deprecated
|
|
144
|
+
*/
|
|
137
145
|
setVideoTrackBandwidth,
|
|
138
146
|
};
|
|
139
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCamera.js","sourceRoot":"","sources":["../../src/hooks/useCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAUxC,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAuEtE,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,EAAE;CACpB,CAAC,CAAC;AAEH,SAAS,kBAAkB,CAAC,YAA6C;IACvE,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO;gBACL,YAAY,EAAE,SAAS;gBACvB,eAAe,EAAE,YAAY;aAC9B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,YAAY,EAAE,SAAS;gBACvB,eAAe,EAAE,YAAY;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,YAAY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AAC,CAAC,CAAC;IACrE,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,sBAAsB,GAAG,WAAW,CACxC,KAAK,EAAE,SAAyB,EAAE,EAAE;QAClC,MAAM,qBAAqB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC,EACD,EAAE,CACH,CAAC;IAEF;;;;OAIG;IACH,MAAM,wBAAwB,GAAG,WAAW,CAC1C,KAAK,EAAE,QAAuB,EAAE,EAAE;QAChC,MAAM,oBAAoB,GACxB,MAAM,qBAAqB,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACjE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IAC3C,CAAC,EACD,EAAE,CACH,CAAC;IAEF;;;;;OAKG;IACH,MAAM,8BAA8B,GAAG,WAAW,CAChD,KAAK,EAAE,QAAuB,EAAE,SAAyB,EAAE,EAAE;QAC3D,MAAM,qBAAqB,CAAC,8BAA8B,CACxD,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,UAAU;QACV,aAAa;QACb,eAAe;QACf,OAAO;QAEP,YAAY;QACZ,aAAa;QACb,YAAY;QAEZ,wBAAwB;QACxB,8BAA8B;QAC9B,sBAAsB;KACvB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { Platform } from 'react-native';\n\nimport {\n BandwidthLimit,\n Brand,\n SimulcastBandwidthLimit,\n SimulcastConfig,\n TrackBandwidthLimit,\n TrackEncoding,\n} from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\ntype SimulcastConfigUpdateEvent = SimulcastConfig;\nexport type CameraId = Brand<string, 'CameraId'>;\n\nexport type CameraFacingDirection = 'front' | 'back' | 'unspecified';\n\nexport type Camera = {\n id: CameraId;\n name: string;\n facingDirection: CameraFacingDirection;\n};\n\nexport type VideoQuality =\n | 'QVGA169'\n | 'VGA169'\n | 'QHD169'\n | 'HD169'\n | 'FHD169'\n | 'QVGA43'\n | 'VGA43'\n | 'QHD43'\n | 'HD43'\n | 'FHD43';\n\ntype CameraConfigBase = {\n /**\n * resolution + aspect ratio of local video track, one of: `QVGA_169`, `VGA_169`, `QHD_169`, `HD_169`,\n * `FHD_169`, `QVGA_43`, `VGA_43`, `QHD_43`, `HD_43`, `FHD_43`. Note that quality might be worse than\n * specified due to device capabilities, internet connection etc.\n * @default `VGA_169`\n */\n quality?: VideoQuality;\n /**\n * whether the camera track is initially enabled, you can toggle it on/off later with toggleCamera method\n * @default `true`\n */\n cameraEnabled?: boolean;\n /**\n * id of the camera to start capture with. Get available cameras with `cameras`.\n * You can switch the cameras later with `switchCamera` functions.\n * @default the first front camera\n */\n cameraId?: CameraId;\n};\n\nexport type CameraConfig = CameraConfigBase & {\n /**\n * whether video track uses simulcast. By default simulcast is disabled.\n */\n simulcastEnabled?: boolean;\n /**\n * bandwidth limit of a video track. By default there is no bandwidth limit.\n */\n};\n\nexport type CameraConfigInternal = CameraConfigBase & {\n videoTrackMetadata?: { active: boolean; type: 'camera' };\n /**\n * SimulcastConfig of a video track. By default simulcast is disabled.\n */\n simulcastConfig?: SimulcastConfig;\n /**\n * bandwidth limit of a video track. By default there is no bandwidth limit.\n */\n maxBandwidth?: TrackBandwidthLimit;\n} & (\n | { maxBandwidthInt?: BandwidthLimit }\n | { maxBandwidthMap?: SimulcastBandwidthLimit }\n );\n\nconst defaultSimulcastConfig = () => ({\n enabled: false,\n activeEncodings: [],\n});\n\nfunction maxBandwidthConfig(maxBandwidth: TrackBandwidthLimit | undefined) {\n if (Platform.OS === 'android') {\n if (typeof maxBandwidth === 'object') {\n return {\n maxBandwidth: undefined,\n maxBandwidthMap: maxBandwidth,\n };\n } else {\n return {\n maxBandwidth: undefined,\n maxBandwidthInt: maxBandwidth,\n };\n }\n }\n return { maxBandwidth };\n}\n\nfunction simulcastConfig(\n simulcastEnabled: boolean | undefined,\n): SimulcastConfig | undefined {\n // iOS has a limit of 3 hardware encoders\n // 3 simulcast layers + 1 screencast layer = 4, which is too much\n // so we limit simulcast layers to 2\n if (simulcastEnabled) {\n return Platform.select<SimulcastConfig>({\n ios: { enabled: true, activeEncodings: ['l', 'h'] },\n android: { enabled: true, activeEncodings: ['l', 'm', 'h'] },\n });\n }\n return undefined;\n}\n\nexport function updateCameraConfig(\n config: Readonly<CameraConfig>,\n): CameraConfigInternal {\n return {\n ...config,\n ...maxBandwidthConfig({ l: 150, m: 500, h: 1500 }),\n videoTrackMetadata: { active: true, type: 'camera' },\n simulcastConfig: simulcastConfig(config.simulcastEnabled),\n };\n}\n\n/**\n * This hook can toggle camera on/off and provides current camera state.\n */\nexport function useCamera() {\n const [isCameraOn, setIsCameraOn] = useState<boolean>(\n RNFishjamClientModule.isCameraOn,\n );\n\n const [currentCamera, setCurrentCamera] = useState<Camera | undefined>(\n undefined,\n );\n\n const [simulcastConfig, setSimulcastConfig] = useState<SimulcastConfig>(\n defaultSimulcastConfig(),\n );\n\n useFishjamEvent<SimulcastConfigUpdateEvent>(\n ReceivableEvents.SimulcastConfigUpdate,\n setSimulcastConfig,\n );\n\n useFishjamEvent(ReceivableEvents.IsCameraOn, setIsCameraOn);\n\n /**\n * Property that lists cameras available on device.\n * @returns A promise that resolves to the list of available cameras.\n */\n const cameras = useMemo(() => {\n return RNFishjamClientModule.cameras;\n }, []);\n\n /**\n * Prepares camera and starts local camera capture.\n * @param config configuration of the camera capture\n * @returns A promise that resolves when camera is started.\n */\n const prepareCamera = useCallback(\n async (config: Readonly<CameraConfig> = {}) => {\n const camera = RNFishjamClientModule.cameras.find((camera) =>\n config.cameraId\n ? camera.id === config.cameraId\n : camera.facingDirection === 'front',\n );\n\n setCurrentCamera(camera);\n const updatedConfig = updateCameraConfig({\n ...config,\n cameraId: camera?.id,\n });\n await RNFishjamClientModule.startCamera(updatedConfig);\n },\n [],\n );\n\n /**\n * Toggles camera on/off\n */\n const toggleCamera = useCallback(async () => {\n const state = await RNFishjamClientModule.toggleCamera();\n await RNFishjamClientModule.updateVideoTrackMetadata({\n active: state,\n type: 'camera',\n });\n setIsCameraOn(state);\n }, []);\n\n /**\n * Switches to the specified camera.\n * List of available devices can be retrieved from `cameras` variable\n * @returns A promise that resolves when camera is switched.\n */\n const switchCamera = useCallback(\n async (cameraId: CameraId) => {\n await RNFishjamClientModule.switchCamera(cameraId);\n setCurrentCamera(cameras.find((camera) => camera.id === cameraId));\n },\n [cameras],\n );\n\n /**\n * @deprecated\n * updates maximum bandwidth for the video track. This value directly translates\n * to quality of the stream and the amount of RTP packets being sent. In case simulcast\n * is enabled bandwidth is split between all of the variant streams proportionally to\n * their resolution.\n * @param BandwidthLimit to set\n */\n const setVideoTrackBandwidth = useCallback(\n async (bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setVideoTrackBandwidth(bandwidth);\n },\n [],\n );\n\n /**\n * @deprecated\n * toggles encoding of a video track on/off\n * @param encoding encoding to toggle\n */\n const toggleVideoTrackEncoding = useCallback(\n async (encoding: TrackEncoding) => {\n const videoSimulcastConfig =\n await RNFishjamClientModule.toggleVideoTrackEncoding(encoding);\n setSimulcastConfig(videoSimulcastConfig);\n },\n [],\n );\n\n /**\n * @deprecated\n * updates maximum bandwidth for the given simulcast encoding of the video track\n * @param encoding encoding to update\n * @param bandwidth BandwidthLimit to set\n */\n const setVideoTrackEncodingBandwidth = useCallback(\n async (encoding: TrackEncoding, bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setVideoTrackEncodingBandwidth(\n encoding,\n bandwidth,\n );\n },\n [],\n );\n\n return {\n isCameraOn,\n currentCamera,\n simulcastConfig,\n cameras,\n\n toggleCamera,\n prepareCamera,\n switchCamera,\n\n toggleVideoTrackEncoding,\n setVideoTrackEncodingBandwidth,\n setVideoTrackBandwidth,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useCamera.js","sourceRoot":"","sources":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AAM,qBAAqB,CAAC,8BAA8B,CACxD,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO;QACL;;WAEG;QACH,UAAU;QACV;;WAEG;QACH,aAAa;QACb;;WAEG;QACH,eAAe;QACf;;;WAGG;QACH,OAAO;QAEP,oCAAoC;QACpC,YAAY;QACZ;;;;WAIG;QACH,aAAa;QACb;;;;WAIG,CAAC,YAAY;QAEhB;;;;WAIG;QACH,wBAAwB;QACxB;;;;;WAKG;QACH,8BAA8B;QAC9B;;;;;;;WAOG;QACH,sBAAsB;KACvB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { Platform } from 'react-native';\n\nimport {\n BandwidthLimit,\n Brand,\n SimulcastBandwidthLimit,\n SimulcastConfig,\n TrackBandwidthLimit,\n TrackEncoding,\n} from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\ntype SimulcastConfigUpdateEvent = SimulcastConfig;\nexport type CameraId = Brand<string, 'CameraId'>;\n\nexport type CameraFacingDirection = 'front' | 'back' | 'unspecified';\n\nexport type Camera = {\n id: CameraId;\n name: string;\n facingDirection: CameraFacingDirection;\n};\n\nexport type VideoQuality =\n | 'QVGA169'\n | 'VGA169'\n | 'QHD169'\n | 'HD169'\n | 'FHD169'\n | 'QVGA43'\n | 'VGA43'\n | 'QHD43'\n | 'HD43'\n | 'FHD43';\n\ntype CameraConfigBase = {\n /**\n * resolution + aspect ratio of local video track, one of: `QVGA_169`, `VGA_169`, `QHD_169`, `HD_169`,\n * `FHD_169`, `QVGA_43`, `VGA_43`, `QHD_43`, `HD_43`, `FHD_43`. Note that quality might be worse than\n * specified due to device capabilities, internet connection etc.\n * @default `VGA_169`\n */\n quality?: VideoQuality;\n /**\n * whether the camera track is initially enabled, you can toggle it on/off later with toggleCamera method\n * @default `true`\n */\n cameraEnabled?: boolean;\n /**\n * id of the camera to start capture with. Get available cameras with `cameras`.\n * You can switch the cameras later with `switchCamera` functions.\n * @default the first front camera\n */\n cameraId?: CameraId;\n};\n\nexport type CameraConfig = CameraConfigBase & {\n /**\n * whether video track uses simulcast. By default simulcast is disabled.\n */\n simulcastEnabled?: boolean;\n /**\n * bandwidth limit of a video track. By default there is no bandwidth limit.\n */\n};\n\nexport type CameraConfigInternal = CameraConfigBase & {\n videoTrackMetadata?: { active: boolean; type: 'camera' };\n /**\n * SimulcastConfig of a video track. By default simulcast is disabled.\n */\n simulcastConfig?: SimulcastConfig;\n /**\n * bandwidth limit of a video track. By default there is no bandwidth limit.\n */\n maxBandwidth?: TrackBandwidthLimit;\n} & (\n | { maxBandwidthInt?: BandwidthLimit }\n | { maxBandwidthMap?: SimulcastBandwidthLimit }\n );\n\nconst defaultSimulcastConfig = () => ({\n enabled: false,\n activeEncodings: [],\n});\n\nfunction maxBandwidthConfig(maxBandwidth: TrackBandwidthLimit | undefined) {\n if (Platform.OS === 'android') {\n if (typeof maxBandwidth === 'object') {\n return {\n maxBandwidth: undefined,\n maxBandwidthMap: maxBandwidth,\n };\n } else {\n return {\n maxBandwidth: undefined,\n maxBandwidthInt: maxBandwidth,\n };\n }\n }\n return { maxBandwidth };\n}\n\nfunction simulcastConfig(\n simulcastEnabled: boolean | undefined,\n): SimulcastConfig | undefined {\n // iOS has a limit of 3 hardware encoders\n // 3 simulcast layers + 1 screencast layer = 4, which is too much\n // so we limit simulcast layers to 2\n if (simulcastEnabled) {\n return Platform.select<SimulcastConfig>({\n ios: { enabled: true, activeEncodings: ['l', 'h'] },\n android: { enabled: true, activeEncodings: ['l', 'm', 'h'] },\n });\n }\n return undefined;\n}\n\nexport function updateCameraConfig(\n config: Readonly<CameraConfig>,\n): CameraConfigInternal {\n return {\n ...config,\n ...maxBandwidthConfig({ l: 150, m: 500, h: 1500 }),\n videoTrackMetadata: { active: true, type: 'camera' },\n simulcastConfig: simulcastConfig(config.simulcastEnabled),\n };\n}\n\n/**\n * This hook can toggle camera on/off and provides current camera state.\n * @category Devices\n * @group Hooks\n */\nexport function useCamera() {\n const [isCameraOn, setIsCameraOn] = useState<boolean>(\n RNFishjamClientModule.isCameraOn,\n );\n\n const [currentCamera, setCurrentCamera] = useState<Camera | undefined>(\n undefined,\n );\n\n const [simulcastConfig, setSimulcastConfig] = useState<SimulcastConfig>(\n defaultSimulcastConfig(),\n );\n\n useFishjamEvent<SimulcastConfigUpdateEvent>(\n ReceivableEvents.SimulcastConfigUpdate,\n setSimulcastConfig,\n );\n\n useFishjamEvent(ReceivableEvents.IsCameraOn, setIsCameraOn);\n\n const cameras = useMemo(() => {\n return RNFishjamClientModule.cameras;\n }, []);\n\n const prepareCamera = useCallback(\n async (config: Readonly<CameraConfig> = {}) => {\n const camera = RNFishjamClientModule.cameras.find((camera) =>\n config.cameraId\n ? camera.id === config.cameraId\n : camera.facingDirection === 'front',\n );\n\n setCurrentCamera(camera);\n const updatedConfig = updateCameraConfig({\n ...config,\n cameraId: camera?.id,\n });\n await RNFishjamClientModule.startCamera(updatedConfig);\n },\n [],\n );\n\n const toggleCamera = useCallback(async () => {\n const state = await RNFishjamClientModule.toggleCamera();\n await RNFishjamClientModule.updateVideoTrackMetadata({\n active: state,\n type: 'camera',\n });\n setIsCameraOn(state);\n }, []);\n\n const switchCamera = useCallback(\n async (cameraId: CameraId) => {\n await RNFishjamClientModule.switchCamera(cameraId);\n setCurrentCamera(cameras.find((camera) => camera.id === cameraId));\n },\n [cameras],\n );\n\n const setVideoTrackBandwidth = useCallback(\n async (bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setVideoTrackBandwidth(bandwidth);\n },\n [],\n );\n\n const toggleVideoTrackEncoding = useCallback(\n async (encoding: TrackEncoding) => {\n const videoSimulcastConfig =\n await RNFishjamClientModule.toggleVideoTrackEncoding(encoding);\n setSimulcastConfig(videoSimulcastConfig);\n },\n [],\n );\n\n const setVideoTrackEncodingBandwidth = useCallback(\n async (encoding: TrackEncoding, bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setVideoTrackEncodingBandwidth(\n encoding,\n bandwidth,\n );\n },\n [],\n );\n\n return {\n /**\n * Informs if user camera is streaming video\n */\n isCameraOn,\n /**\n * Which camera is now used for streaming (or will be used as default when camera will be enabled)\n */\n currentCamera,\n /**\n * Simulcast configuration\n */\n simulcastConfig,\n /**\n * Property that lists cameras available on device.\n * @returns A promise that resolves to the list of available cameras.\n */\n cameras,\n\n /** Enable/disable current camera */\n toggleCamera,\n /**\n * Prepares camera and starts local video track\n * @param config configuration of the camera capture\n * @returns A promise that resolves when camera is started.\n */\n prepareCamera,\n /**\n * Switches to the specified camera.\n * List of available devices can be retrieved from `cameras` variable\n * @returns A promise that resolves when camera is switched.\n */ switchCamera,\n\n /**\n * @deprecated\n * toggles encoding of a video track on/off\n * @param encoding encoding to toggle\n */\n toggleVideoTrackEncoding,\n /**\n * updates maximum bandwidth for the given simulcast encoding of the video track\n * @param encoding encoding to update\n * @param bandwidth BandwidthLimit to set\n * @deprecated\n */\n setVideoTrackEncodingBandwidth,\n /**\n * updates maximum bandwidth for the video track. This value directly translates\n * to quality of the stream and the amount of RTP packets being sent. In case simulcast\n * is enabled bandwidth is split between all of the variant streams proportionally to\n * their resolution.\n * @param BandwidthLimit to set\n * @deprecated\n */\n setVideoTrackBandwidth,\n };\n}\n"]}
|
|
@@ -10,6 +10,7 @@ export declare const ReceivableEvents: {
|
|
|
10
10
|
readonly ReconnectionRetriesLimitReached: "ReconnectionRetriesLimitReached";
|
|
11
11
|
readonly ReconnectionStarted: "ReconnectionStarted";
|
|
12
12
|
readonly Reconnected: "Reconnected";
|
|
13
|
+
readonly Warning: "Warning";
|
|
13
14
|
};
|
|
14
15
|
export declare function useFishjamEvent<T>(eventName: keyof typeof ReceivableEvents, callback: (event: T) => void): void;
|
|
15
16
|
//# sourceMappingURL=useFishjamEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useFishjamEvent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAanB,CAAC;AAEX,wBAAgB,eAAe,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,OAAO,gBAAgB,EACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAU7B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
2
|
+
import { nativeModuleEventEmitter } from '../RNFishjamClientModule';
|
|
4
3
|
export const ReceivableEvents = {
|
|
5
4
|
IsCameraOn: 'IsCameraOn',
|
|
6
5
|
IsMicrophoneOn: 'IsMicrophoneOn',
|
|
@@ -13,11 +12,11 @@ export const ReceivableEvents = {
|
|
|
13
12
|
ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',
|
|
14
13
|
ReconnectionStarted: 'ReconnectionStarted',
|
|
15
14
|
Reconnected: 'Reconnected',
|
|
15
|
+
Warning: 'Warning',
|
|
16
16
|
};
|
|
17
|
-
const eventEmitter = new EventEmitter(RNFishjamClientModule ?? NativeModulesProxy.RNFishjamClient);
|
|
18
17
|
export function useFishjamEvent(eventName, callback) {
|
|
19
18
|
useEffect(() => {
|
|
20
|
-
const eventListener =
|
|
19
|
+
const eventListener = nativeModuleEventEmitter.addListener(eventName, (event) => {
|
|
21
20
|
callback(event[eventName]);
|
|
22
21
|
});
|
|
23
22
|
return () => eventListener.remove();
|
|
@@ -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,
|
|
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,cAAc,EAAE,gBAAgB;IAChC,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;CACV,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 IsScreencastOn: 'IsScreencastOn',\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} 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"]}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This hook can toggle microphone on/off and provides current microphone state.
|
|
3
|
+
* @category Devices
|
|
4
|
+
* @group Hooks
|
|
3
5
|
*/
|
|
4
6
|
export declare function useMicrophone(): {
|
|
7
|
+
/** Informs if microhpone is streaming audio */
|
|
5
8
|
isMicrophoneOn: boolean;
|
|
9
|
+
/** Function to toggle microphone on/off */
|
|
6
10
|
toggleMicrophone: () => Promise<void>;
|
|
7
11
|
};
|
|
8
12
|
//# sourceMappingURL=useMicrophone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMicrophone.d.ts","sourceRoot":"","sources":["../../src/hooks/useMicrophone.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"useMicrophone.d.ts","sourceRoot":"","sources":["../../src/hooks/useMicrophone.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,aAAa;IAiBzB,+CAA+C;;IAE/C,2CAA2C;;EAG9C"}
|
|
@@ -3,13 +3,12 @@ import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
|
3
3
|
import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
|
|
4
4
|
/**
|
|
5
5
|
* This hook can toggle microphone on/off and provides current microphone state.
|
|
6
|
+
* @category Devices
|
|
7
|
+
* @group Hooks
|
|
6
8
|
*/
|
|
7
9
|
export function useMicrophone() {
|
|
8
10
|
const [isMicrophoneOn, setIsMicrophoneOn] = useState(RNFishjamClientModule.isMicrophoneOn);
|
|
9
11
|
useFishjamEvent(ReceivableEvents.IsMicrophoneOn, setIsMicrophoneOn);
|
|
10
|
-
/**
|
|
11
|
-
* Function to toggle microphone on/off
|
|
12
|
-
*/
|
|
13
12
|
const toggleMicrophone = useCallback(async () => {
|
|
14
13
|
const status = await RNFishjamClientModule.toggleMicrophone();
|
|
15
14
|
await RNFishjamClientModule.updateAudioTrackMetadata({
|
|
@@ -18,6 +17,11 @@ export function useMicrophone() {
|
|
|
18
17
|
});
|
|
19
18
|
setIsMicrophoneOn(status);
|
|
20
19
|
}, []);
|
|
21
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
/** Informs if microhpone is streaming audio */
|
|
22
|
+
isMicrophoneOn,
|
|
23
|
+
/** Function to toggle microphone on/off */
|
|
24
|
+
toggleMicrophone,
|
|
25
|
+
};
|
|
22
26
|
}
|
|
23
27
|
//# sourceMappingURL=useMicrophone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMicrophone.js","sourceRoot":"","sources":["../../src/hooks/useMicrophone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"useMicrophone.js","sourceRoot":"","sources":["../../src/hooks/useMicrophone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAClD,qBAAqB,CAAC,cAAc,CACrC,CAAC;IAEF,eAAe,CAAC,gBAAgB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAEpE,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC9C,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,gBAAgB,EAAE,CAAC;QAC9D,MAAM,qBAAqB,CAAC,wBAAwB,CAAC;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;QACH,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,+CAA+C;QAC/C,cAAc;QACd,2CAA2C;QAC3C,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\n\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\n/**\n * This hook can toggle microphone on/off and provides current microphone state.\n * @category Devices\n * @group Hooks\n */\nexport function useMicrophone() {\n const [isMicrophoneOn, setIsMicrophoneOn] = useState<boolean>(\n RNFishjamClientModule.isMicrophoneOn,\n );\n\n useFishjamEvent(ReceivableEvents.IsMicrophoneOn, setIsMicrophoneOn);\n\n const toggleMicrophone = useCallback(async () => {\n const status = await RNFishjamClientModule.toggleMicrophone();\n await RNFishjamClientModule.updateAudioTrackMetadata({\n active: status,\n type: 'audio',\n });\n setIsMicrophoneOn(status);\n }, []);\n\n return {\n /** Informs if microhpone is streaming audio */\n isMicrophoneOn,\n /** Function to toggle microphone on/off */\n toggleMicrophone,\n };\n}\n"]}
|
|
@@ -51,6 +51,8 @@ export type Participant<ParticipantMetadata extends GenericMetadata = GenericMet
|
|
|
51
51
|
/**
|
|
52
52
|
* This hook provides live updates of room participants.
|
|
53
53
|
* @returns An array of room participants.
|
|
54
|
+
* @category Connection
|
|
55
|
+
* @group Hooks
|
|
54
56
|
*/
|
|
55
57
|
export declare function useParticipants<ParticipantMetadata extends GenericMetadata = GenericMetadata>(): {
|
|
56
58
|
participants: Participant<ParticipantMetadata>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParticipants.d.ts","sourceRoot":"","sources":["../../src/hooks/useParticipants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAiB,MAAM,UAAU,CAAC;AAIzE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAE/B,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAC5C;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,mBAAmB,GAAG,eAAe,CAAC;AAE7E,MAAM,MAAM,WAAW,CACrB,mBAAmB,SAAS,eAAe,GAAG,eAAe,IAC3D;IACF;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EA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BAAmB,SAAS,eAAe,GAAG,eAAe;;EA0B9D"}
|
|
@@ -13,6 +13,8 @@ function addIsActiveToTracks(participants) {
|
|
|
13
13
|
/**
|
|
14
14
|
* This hook provides live updates of room participants.
|
|
15
15
|
* @returns An array of room participants.
|
|
16
|
+
* @category Connection
|
|
17
|
+
* @group Hooks
|
|
16
18
|
*/
|
|
17
19
|
export function useParticipants() {
|
|
18
20
|
const [participants, setParticipants] = useState([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParticipants.js","sourceRoot":"","sources":["../../src/hooks/useParticipants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzD,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8DtE,SAAS,mBAAmB,CAG1B,YAA6D;IAE7D,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,WAAW;QACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACzC,GAAG,KAAK;YACR,QAAQ,EACL,KAAsC,EAAE,QAAQ,EAAE,MAAM,IAAI,IAAI;SACpE,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC;AACD
|
|
1
|
+
{"version":3,"file":"useParticipants.js","sourceRoot":"","sources":["../../src/hooks/useParticipants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzD,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA8DtE,SAAS,mBAAmB,CAG1B,YAA6D;IAE7D,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,WAAW;QACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACzC,GAAG,KAAK;YACR,QAAQ,EACL,KAAsC,EAAE,QAAQ,EAAE,MAAM,IAAI,IAAI;SACpE,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAG7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAE9C,EAAE,CAAC,CAAC;IAEN,MAAM,wBAAwB,GAAG,WAAW,CAC1C,CAAC,YAAgD,EAAE,EAAE;QACnD,eAAe,CAAC,mBAAmB,CAAsB,YAAY,CAAC,CAAC,CAAC;IAC1E,CAAC,EACD,EAAE,CACH,CAAC;IAEF,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,kBAAkB;YAC/B,MAAM,YAAY,GAChB,MAAM,qBAAqB,CAAC,QAAQ,EAAuB,CAAC;YAC9D,eAAe,CAAC,mBAAmB,CAAsB,YAAY,CAAC,CAAC,CAAC;QAC1E,CAAC;QAED,kBAAkB,EAAE,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport { GenericMetadata, TrackEncoding, TrackMetadata } from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport type TrackType = 'Audio' | 'Video';\n\n/**\n * Type describing Voice Activity Detection statuses.\n *\n * speech - voice activity has been detected\n * silence - lack of voice activity has been detected\n */\nexport type VadStatus = 'silence' | 'speech';\n\ntype TrackBase = {\n id: string;\n type: TrackType;\n isActive: boolean;\n};\n\nexport type AudioTrack = TrackBase & {\n type: 'Audio';\n vadStatus: VadStatus | undefined;\n};\n\nexport type VideoTrack = TrackBase & {\n type: 'Video';\n // Encoding that is currently received. Only present for remote tracks.\n encoding: TrackEncoding | null;\n // The reason of currently selected encoding. Only present for remote tracks.\n encodingReason: EncodingReason | null;\n};\n\nexport type Track = VideoTrack | AudioTrack;\n/**\n * Type describing possible reasons of currently selected encoding.\n *\n * - other - the exact reason couldn't be determined\n * - encoding_inactive - previously selected encoding became inactive\n * - low_bandwidth - there is no longer enough bandwidth to maintain previously selected encoding\n */\nexport type EncodingReason = 'other' | 'encoding_inactive' | 'low_bandwidth';\n\nexport type Participant<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n> = {\n /**\n * id used to identify a participant\n */\n id: string;\n /**\n * whether the participant is local or remote\n */\n isLocal: boolean;\n /**\n * a map indexed by strings, containing participant metadata from the server\n */\n metadata: ParticipantMetadata;\n /**\n * a list of participants's video and audio tracks\n */\n tracks: Track[];\n};\n\nfunction addIsActiveToTracks<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>(\n participants: ReadonlyArray<Participant<ParticipantMetadata>>,\n): Participant<ParticipantMetadata>[] {\n return participants.map((participant) => ({\n ...participant,\n tracks: participant.tracks.map((track) => ({\n ...track,\n isActive:\n (track as { metadata?: TrackMetadata })?.metadata?.active ?? true,\n })),\n }));\n}\n/**\n * This hook provides live updates of room participants.\n * @returns An array of room participants.\n * @category Connection\n * @group Hooks\n */\nexport function useParticipants<\n ParticipantMetadata extends GenericMetadata = GenericMetadata,\n>() {\n const [participants, setParticipants] = useState<\n Participant<ParticipantMetadata>[]\n >([]);\n\n const updateActiveParticipants = useCallback(\n (participants: Participant<ParticipantMetadata>[]) => {\n setParticipants(addIsActiveToTracks<ParticipantMetadata>(participants));\n },\n [],\n );\n\n useFishjamEvent(ReceivableEvents.PeersUpdate, updateActiveParticipants);\n\n useEffect(() => {\n async function updateParticipants() {\n const participants =\n await RNFishjamClientModule.getPeers<ParticipantMetadata>();\n setParticipants(addIsActiveToTracks<ParticipantMetadata>(participants));\n }\n\n updateParticipants();\n }, []);\n\n return { participants };\n}\n"]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export type ReconnectionStatus = 'idle' | 'reconnecting' | 'error';
|
|
2
|
+
/**
|
|
3
|
+
* Information about reconnection status.
|
|
4
|
+
* Could be used to retrieve connection status, once user will be disconnected
|
|
5
|
+
* @group Hooks
|
|
6
|
+
* @category Connection
|
|
7
|
+
*/
|
|
2
8
|
export declare function useReconnection(): {
|
|
3
9
|
reconnectionStatus: ReconnectionStatus;
|
|
4
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReconnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useReconnection.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AAEnE,wBAAgB,eAAe;;EAmB9B"}
|
|
1
|
+
{"version":3,"file":"useReconnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useReconnection.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,eAAe;;EAmB9B"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
2
|
import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
|
|
3
|
+
/**
|
|
4
|
+
* Information about reconnection status.
|
|
5
|
+
* Could be used to retrieve connection status, once user will be disconnected
|
|
6
|
+
* @group Hooks
|
|
7
|
+
* @category Connection
|
|
8
|
+
*/
|
|
3
9
|
export function useReconnection() {
|
|
4
10
|
const [reconnectionStatus, setReconnectionStatus] = useState('idle');
|
|
5
11
|
const setStatusIdle = useCallback(() => setReconnectionStatus('idle'), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReconnection.js","sourceRoot":"","sources":["../../src/hooks/useReconnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAItE,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/C,QAAQ,CAAqB,MAAM,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3E,MAAM,qBAAqB,GAAG,WAAW,CACvC,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAC3C,EAAE,CACH,CAAC;IACF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAE7E,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC7D,eAAe,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;IAC7E,eAAe,CACb,gBAAgB,CAAC,+BAA+B,EAChD,cAAc,CACf,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport type ReconnectionStatus = 'idle' | 'reconnecting' | 'error';\n\nexport function useReconnection() {\n const [reconnectionStatus, setReconnectionStatus] =\n useState<ReconnectionStatus>('idle');\n\n const setStatusIdle = useCallback(() => setReconnectionStatus('idle'), []);\n const setStatusReconnecting = useCallback(\n () => setReconnectionStatus('reconnecting'),\n [],\n );\n const setStatusError = useCallback(() => setReconnectionStatus('error'), []);\n\n useFishjamEvent(ReceivableEvents.Reconnected, setStatusIdle);\n useFishjamEvent(ReceivableEvents.ReconnectionStarted, setStatusReconnecting);\n useFishjamEvent(\n ReceivableEvents.ReconnectionRetriesLimitReached,\n setStatusError,\n );\n\n return { reconnectionStatus };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useReconnection.js","sourceRoot":"","sources":["../../src/hooks/useReconnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAItE;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/C,QAAQ,CAAqB,MAAM,CAAC,CAAC;IAEvC,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3E,MAAM,qBAAqB,GAAG,WAAW,CACvC,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAC3C,EAAE,CACH,CAAC;IACF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAE7E,eAAe,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC7D,eAAe,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;IAC7E,eAAe,CACb,gBAAgB,CAAC,+BAA+B,EAChD,cAAc,CACf,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport type ReconnectionStatus = 'idle' | 'reconnecting' | 'error';\n\n/**\n * Information about reconnection status.\n * Could be used to retrieve connection status, once user will be disconnected\n * @group Hooks\n * @category Connection\n */\nexport function useReconnection() {\n const [reconnectionStatus, setReconnectionStatus] =\n useState<ReconnectionStatus>('idle');\n\n const setStatusIdle = useCallback(() => setReconnectionStatus('idle'), []);\n const setStatusReconnecting = useCallback(\n () => setReconnectionStatus('reconnecting'),\n [],\n );\n const setStatusError = useCallback(() => setReconnectionStatus('error'), []);\n\n useFishjamEvent(ReceivableEvents.Reconnected, setStatusIdle);\n useFishjamEvent(ReceivableEvents.ReconnectionStarted, setStatusReconnecting);\n useFishjamEvent(\n ReceivableEvents.ReconnectionRetriesLimitReached,\n setStatusError,\n );\n\n return { reconnectionStatus };\n}\n"]}
|
|
@@ -25,14 +25,33 @@ export type ScreencastOptionsInternal = {
|
|
|
25
25
|
/**
|
|
26
26
|
* This hook can toggle screen sharing on/off and provides current screencast state.
|
|
27
27
|
* @returns An object with functions to manage screencast.
|
|
28
|
+
* @category Screenshare
|
|
29
|
+
* @group Hooks
|
|
28
30
|
*/
|
|
29
31
|
export declare function useScreencast(): {
|
|
30
32
|
isScreencastOn: boolean;
|
|
33
|
+
simulcastConfig: SimulcastConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Toggles the screencast on/off
|
|
36
|
+
*/
|
|
31
37
|
toggleScreencast: (screencastOptions?: Partial<ScreencastOptions>) => Promise<void>;
|
|
38
|
+
handleScreencastPermission: () => Promise<"granted" | "denied">;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
setScreencastTrackBandwidth: (bandwidth: BandwidthLimit) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Toggles simulcast encoding of a screencast track on/off
|
|
45
|
+
* @param encoding encoding to toggle
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
32
48
|
toggleScreencastTrackEncoding: (encoding: TrackEncoding) => Promise<void>;
|
|
33
|
-
|
|
49
|
+
/**
|
|
50
|
+
* updates maximum bandwidth for the given simulcast encoding of the screencast track
|
|
51
|
+
* @param encoding encoding to update
|
|
52
|
+
* @param bandwidth BandwidthLimit to set
|
|
53
|
+
* @deprecated
|
|
54
|
+
*/
|
|
34
55
|
setScreencastTrackEncodingBandwidth: (encoding: TrackEncoding, bandwidth: BandwidthLimit) => Promise<void>;
|
|
35
|
-
setScreencastTrackBandwidth: (bandwidth: BandwidthLimit) => Promise<void>;
|
|
36
|
-
handleScreencastPermission: () => Promise<"granted" | "denied">;
|
|
37
56
|
};
|
|
38
57
|
//# sourceMappingURL=useScreencast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreencast.d.ts","sourceRoot":"","sources":["../../src/hooks/useScreencast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,aAAa,EACd,MAAM,UAAU,CAAC;AAKlB,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG;IACtC,kBAAkB,EAAE,aAAa,GAAG;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AASF
|
|
1
|
+
{"version":3,"file":"useScreencast.d.ts","sourceRoot":"","sources":["../../src/hooks/useScreencast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,aAAa,EACd,MAAM,UAAU,CAAC;AAKlB,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,OAAO,EAAE,iBAAiB,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;CACnC,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG;IACtC,kBAAkB,EAAE,aAAa,GAAG;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,aAAa;;;IAiEzB;;OAEG;2CAvDuB,OAAO,CAAC,iBAAiB,CAAC;;IA2DpD;;OAEG;6CAzBe,cAAc;IA2BhC;;;;OAIG;8CAlDc,aAAa;IAoD9B;;;;;OAKG;oDAhDc,aAAa,aAAa,cAAc;EA2D5D"}
|
|
@@ -10,14 +10,13 @@ let screencastSimulcastConfig = defaultSimulcastConfig();
|
|
|
10
10
|
/**
|
|
11
11
|
* This hook can toggle screen sharing on/off and provides current screencast state.
|
|
12
12
|
* @returns An object with functions to manage screencast.
|
|
13
|
+
* @category Screenshare
|
|
14
|
+
* @group Hooks
|
|
13
15
|
*/
|
|
14
16
|
export function useScreencast() {
|
|
15
17
|
const [isScreencastOn, setIsScreencastOn] = useState(RNFishjamClientModule.isScreencastOn);
|
|
16
18
|
const [simulcastConfig, setSimulcastConfig] = useState(screencastSimulcastConfig);
|
|
17
19
|
useFishjamEvent(ReceivableEvents.IsScreencastOn, setIsScreencastOn);
|
|
18
|
-
/**
|
|
19
|
-
* Toggles the screencast on/off
|
|
20
|
-
*/
|
|
21
20
|
const toggleScreencast = useCallback(async (screencastOptions = {}) => {
|
|
22
21
|
const options = {
|
|
23
22
|
...screencastOptions,
|
|
@@ -31,30 +30,14 @@ export function useScreencast() {
|
|
|
31
30
|
screencastSimulcastConfig = defaultSimulcastConfig(); //to do: sync with camera settings
|
|
32
31
|
setSimulcastConfig(screencastSimulcastConfig);
|
|
33
32
|
}, [isScreencastOn]);
|
|
34
|
-
/**
|
|
35
|
-
* Toggles simulcast encoding of a screencast track on/off
|
|
36
|
-
* @param encoding encoding to toggle
|
|
37
|
-
*/
|
|
38
33
|
const toggleScreencastTrackEncoding = useCallback(async (encoding) => {
|
|
39
34
|
screencastSimulcastConfig =
|
|
40
35
|
await RNFishjamClientModule.toggleScreencastTrackEncoding(encoding);
|
|
41
36
|
setSimulcastConfig(screencastSimulcastConfig);
|
|
42
37
|
}, []);
|
|
43
|
-
/**
|
|
44
|
-
* updates maximum bandwidth for the given simulcast encoding of the screencast track
|
|
45
|
-
* @param encoding encoding to update
|
|
46
|
-
* @param bandwidth BandwidthLimit to set
|
|
47
|
-
*/
|
|
48
38
|
const setScreencastTrackEncodingBandwidth = useCallback(async (encoding, bandwidth) => {
|
|
49
39
|
await RNFishjamClientModule.setScreencastTrackEncodingBandwidth(encoding, bandwidth);
|
|
50
40
|
}, []);
|
|
51
|
-
/**
|
|
52
|
-
* updates maximum bandwidth for the screencast track. This value directly translates
|
|
53
|
-
* to quality of the stream and the amount of RTP packets being sent. In case simulcast
|
|
54
|
-
* is enabled bandwidth is split between all of the variant streams proportionally to
|
|
55
|
-
* their resolution
|
|
56
|
-
* @param bandwidth BandwidthLimit to set
|
|
57
|
-
*/
|
|
58
41
|
const setScreencastTrackBandwidth = useCallback(async (bandwidth) => {
|
|
59
42
|
await RNFishjamClientModule.setScreencastTrackBandwidth(bandwidth);
|
|
60
43
|
}, []);
|
|
@@ -66,12 +49,37 @@ export function useScreencast() {
|
|
|
66
49
|
}, []);
|
|
67
50
|
return {
|
|
68
51
|
isScreencastOn,
|
|
52
|
+
simulcastConfig,
|
|
53
|
+
/**
|
|
54
|
+
* Toggles the screencast on/off
|
|
55
|
+
*/
|
|
69
56
|
toggleScreencast,
|
|
57
|
+
handleScreencastPermission,
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated
|
|
60
|
+
*/
|
|
61
|
+
setScreencastTrackBandwidth,
|
|
62
|
+
/**
|
|
63
|
+
* Toggles simulcast encoding of a screencast track on/off
|
|
64
|
+
* @param encoding encoding to toggle
|
|
65
|
+
* @deprecated
|
|
66
|
+
*/
|
|
70
67
|
toggleScreencastTrackEncoding,
|
|
71
|
-
|
|
68
|
+
/**
|
|
69
|
+
* updates maximum bandwidth for the given simulcast encoding of the screencast track
|
|
70
|
+
* @param encoding encoding to update
|
|
71
|
+
* @param bandwidth BandwidthLimit to set
|
|
72
|
+
* @deprecated
|
|
73
|
+
*/
|
|
72
74
|
setScreencastTrackEncodingBandwidth,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
/**
|
|
76
|
+
* updates maximum bandwidth for the screencast track. This value directly translates
|
|
77
|
+
* to quality of the stream and the amount of RTP packets being sent. In case simulcast
|
|
78
|
+
* is enabled bandwidth is split between all of the variant streams proportionally to
|
|
79
|
+
* their resolution
|
|
80
|
+
* @param bandwidth BandwidthLimit to set
|
|
81
|
+
* @deprecated
|
|
82
|
+
*/
|
|
75
83
|
};
|
|
76
84
|
}
|
|
77
85
|
//# sourceMappingURL=useScreencast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreencast.js","sourceRoot":"","sources":["../../src/hooks/useScreencast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAS9C,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBtE,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,EAAE;CACpB,CAAC,CAAC;AAEH,IAAI,yBAAyB,GAAoB,sBAAsB,EAAE,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"useScreencast.js","sourceRoot":"","sources":["../../src/hooks/useScreencast.ts"],"names":[],"mappings":"AAAA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B,CAAC,QAAQ,CAAC,CAAC;QACtE,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,mCAAmC,GAAG,WAAW,CACrD,KAAK,EAAE,QAAuB,EAAE,SAAyB,EAAE,EAAE;QAC3D,MAAM,qBAAqB,CAAC,mCAAmC,CAC7D,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,2BAA2B,GAAG,WAAW,CAC7C,KAAK,EAAE,SAAyB,EAAE,EAAE;QAClC,MAAM,qBAAqB,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACrE,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,0BAA0B,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxD,IAAI,QAAQ,CAAC,EAAE,IAAI,SAAS,EAAE,CAAC;YAC7B,OAAO,MAAM,qBAAqB,CAAC,0BAA0B,EAAE,CAAC;QAClE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,cAAc;QACd,eAAe;QAEf;;WAEG;QACH,gBAAgB;QAChB,0BAA0B;QAE1B;;WAEG;QACH,2BAA2B;QAC3B;;;;WAIG;QACH,6BAA6B;QAC7B;;;;;WAKG;QACH,mCAAmC;QACnC;;;;;;;WAOG;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\n\nimport {\n BandwidthLimit,\n SimulcastConfig,\n TrackBandwidthLimit,\n TrackEncoding,\n TrackMetadata,\n} from '../types';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { Platform } from 'react-native';\nimport { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';\n\nexport type ScreencastQuality = 'VGA' | 'HD5' | 'HD15' | 'FHD15' | 'FHD30';\n\nexport type ScreencastOptions = {\n /**\n * Resolution + fps of screencast track, one of: `VGA`, `HD5`, `HD15`, `FHD15`, `FHD30`.\n * Note that quality might be worse than specified due to device capabilities, internet\n * connection etc.\n * @default `HD15``\n */\n quality: ScreencastQuality;\n /**\n * bandwidth limit of a screencast track. By default there is no bandwidth limit.\n */\n maxBandwidth: TrackBandwidthLimit;\n};\nexport type ScreencastOptionsInternal = {\n screencastMetadata: TrackMetadata & { displayName?: string };\n /**\n * SimulcastConfig of a screencast track. By default simulcast is disabled.\n */\n simulcastConfig: SimulcastConfig;\n};\n\nconst defaultSimulcastConfig = () => ({\n enabled: false,\n activeEncodings: [],\n});\n\nlet screencastSimulcastConfig: SimulcastConfig = defaultSimulcastConfig();\n\n/**\n * This hook can toggle screen sharing on/off and provides current screencast state.\n * @returns An object with functions to manage screencast.\n * @category Screenshare\n * @group Hooks\n */\nexport function useScreencast() {\n const [isScreencastOn, setIsScreencastOn] = useState(\n RNFishjamClientModule.isScreencastOn,\n );\n\n const [simulcastConfig, setSimulcastConfig] = useState<SimulcastConfig>(\n screencastSimulcastConfig,\n );\n\n useFishjamEvent(ReceivableEvents.IsScreencastOn, setIsScreencastOn);\n\n const toggleScreencast = useCallback(\n async (screencastOptions: Partial<ScreencastOptions> = {}) => {\n const options = {\n ...screencastOptions,\n screencastMetadata: {\n displayName: 'presenting',\n type: 'screensharing' as const,\n active: !isScreencastOn,\n },\n };\n await RNFishjamClientModule.toggleScreencast(options);\n screencastSimulcastConfig = defaultSimulcastConfig(); //to do: sync with camera settings\n setSimulcastConfig(screencastSimulcastConfig);\n },\n [isScreencastOn],\n );\n\n const toggleScreencastTrackEncoding = useCallback(\n async (encoding: TrackEncoding) => {\n screencastSimulcastConfig =\n await RNFishjamClientModule.toggleScreencastTrackEncoding(encoding);\n setSimulcastConfig(screencastSimulcastConfig);\n },\n [],\n );\n\n const setScreencastTrackEncodingBandwidth = useCallback(\n async (encoding: TrackEncoding, bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setScreencastTrackEncodingBandwidth(\n encoding,\n bandwidth,\n );\n },\n [],\n );\n\n const setScreencastTrackBandwidth = useCallback(\n async (bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setScreencastTrackBandwidth(bandwidth);\n },\n [],\n );\n\n const handleScreencastPermission = useCallback(async () => {\n if (Platform.OS == 'android') {\n return await RNFishjamClientModule.handleScreencastPermission();\n }\n return 'denied';\n }, []);\n\n return {\n isScreencastOn,\n simulcastConfig,\n\n /**\n * Toggles the screencast on/off\n */\n toggleScreencast,\n handleScreencastPermission,\n\n /**\n * @deprecated\n */\n setScreencastTrackBandwidth,\n /**\n * Toggles simulcast encoding of a screencast track on/off\n * @param encoding encoding to toggle\n * @deprecated\n */\n toggleScreencastTrackEncoding,\n /**\n * updates maximum bandwidth for the given simulcast encoding of the screencast track\n * @param encoding encoding to update\n * @param bandwidth BandwidthLimit to set\n * @deprecated\n */\n setScreencastTrackEncodingBandwidth,\n /**\n * updates maximum bandwidth for the screencast track. This value directly translates\n * to quality of the stream and the amount of RTP packets being sent. In case simulcast\n * is enabled bandwidth is split between all of the variant streams proportionally to\n * their resolution\n * @param bandwidth BandwidthLimit to set\n * @deprecated\n */\n };\n}\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { useParticipants } from './hooks/useParticipants';
|
|
|
3
3
|
export type { AudioOutputDevice, AudioOutputDeviceType, AudioSessionMode, } from './hooks/useAudioSettings';
|
|
4
4
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
5
5
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
6
|
-
export type { Camera, CameraConfig, VideoQuality, CameraFacingDirection, } from './hooks/useCamera';
|
|
6
|
+
export type { CameraId, Camera, CameraConfig, VideoQuality, CameraFacingDirection, } from './hooks/useCamera';
|
|
7
7
|
export { useCamera } from './hooks/useCamera';
|
|
8
8
|
export { useMicrophone } from './hooks/useMicrophone';
|
|
9
9
|
export { useRTCStatistics } from './stats/useRTCStatistics';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,YAAY,EACV,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,YAAY,EACV,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,YAAY,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { initializeWarningListener } from './utils/errorListener';
|
|
1
2
|
export { useParticipants } from './hooks/useParticipants';
|
|
2
3
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
3
4
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
@@ -13,4 +14,5 @@ export { VideoPreviewView } from './components/VideoPreviewView';
|
|
|
13
14
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
14
15
|
export { AndroidForegroundServiceType } from './types';
|
|
15
16
|
export { startForegroundService, stopForegroundService, } from './utils/foregroundService';
|
|
17
|
+
initializeWarningListener();
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AASlE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AASxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAM5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAWnC,yBAAyB,EAAE,CAAC","sourcesContent":["import { initializeWarningListener } from './utils/errorListener';\n\nexport type {\n Participant,\n Track,\n TrackType,\n VadStatus,\n EncodingReason,\n} from './hooks/useParticipants';\nexport { useParticipants } from './hooks/useParticipants';\n\nexport type {\n AudioOutputDevice,\n AudioOutputDeviceType,\n AudioSessionMode,\n} from './hooks/useAudioSettings';\nexport { useAudioSettings } from './hooks/useAudioSettings';\n\nexport { useBandwidthEstimation } from './hooks/useBandwidthEstimation';\n\nexport type {\n CameraId,\n Camera,\n CameraConfig,\n VideoQuality,\n CameraFacingDirection,\n} from './hooks/useCamera';\nexport { useCamera } from './hooks/useCamera';\n\nexport { useMicrophone } from './hooks/useMicrophone';\n\nexport { useRTCStatistics } from './stats/useRTCStatistics';\n\nexport type {\n ScreencastOptions,\n ScreencastQuality,\n} from './hooks/useScreencast';\nexport { useScreencast } from './hooks/useScreencast';\n\nexport type { ReconnectionStatus } from './hooks/useReconnection';\nexport { useReconnection } from './hooks/useReconnection';\n\nexport { updatePeerMetadata } from './common/metadata';\n\nexport type { LoggingSeverity } from './common/webRTC';\nexport {\n changeWebRTCLoggingSeverity,\n setTargetTrackEncoding,\n} from './common/webRTC';\n\nexport { joinRoom, leaveRoom } from './common/client';\n\nexport type { VideoPreviewViewProps } from './components/VideoPreviewView';\nexport { VideoPreviewView } from './components/VideoPreviewView';\n\nexport type { VideoRendererProps } from './components/VideoRendererView';\nexport { VideoRendererView } from './components/VideoRendererView';\n\nexport { AndroidForegroundServiceType } from './types';\nexport {\n startForegroundService,\n stopForegroundService,\n} from './utils/foregroundService';\n\nexport type {\n TrackBandwidthLimit,\n TrackEncoding,\n SimulcastBandwidthLimit,\n BandwidthLimit,\n SimulcastConfig,\n VideoLayout,\n} from './types';\n\ninitializeWarningListener();\n"]}
|