@fishjam-cloud/react-native-client 0.1.1 → 0.2.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/README.md +403 -0
- package/android/build.gradle +6 -6
- package/app.plugin.js +1 -1
- package/build/RNFishjamClientModule.d.ts +7 -5
- package/build/RNFishjamClientModule.d.ts.map +1 -1
- package/build/RNFishjamClientModule.js.map +1 -1
- package/build/common/client.d.ts +8 -1
- package/build/common/client.d.ts.map +1 -1
- package/build/common/client.js +9 -2
- package/build/common/client.js.map +1 -1
- package/build/components/VideoPreviewView.d.ts +3 -3
- package/build/components/VideoPreviewView.d.ts.map +1 -1
- package/build/components/VideoPreviewView.js +1 -1
- package/build/components/VideoPreviewView.js.map +1 -1
- package/build/hooks/useAudioSettings.d.ts.map +1 -1
- package/build/hooks/useAudioSettings.js +4 -5
- package/build/hooks/useAudioSettings.js.map +1 -1
- package/build/hooks/useBandwidthEstimation.d.ts +0 -3
- package/build/hooks/useBandwidthEstimation.d.ts.map +1 -1
- package/build/hooks/useBandwidthEstimation.js +3 -6
- package/build/hooks/useBandwidthEstimation.js.map +1 -1
- package/build/hooks/useCamera.d.ts +12 -21
- package/build/hooks/useCamera.d.ts.map +1 -1
- package/build/hooks/useCamera.js +52 -52
- package/build/hooks/useCamera.js.map +1 -1
- package/build/{common/eventEmitter.d.ts → hooks/useFishjamEvent.d.ts} +2 -3
- package/build/hooks/useFishjamEvent.d.ts.map +1 -0
- package/build/{common/eventEmitter.js → hooks/useFishjamEvent.js} +11 -2
- package/build/hooks/useFishjamEvent.js.map +1 -0
- package/build/hooks/useMicrophone.d.ts.map +1 -1
- package/build/hooks/useMicrophone.js +3 -7
- package/build/hooks/useMicrophone.js.map +1 -1
- package/build/hooks/useParticipants.d.ts +0 -3
- package/build/hooks/useParticipants.d.ts.map +1 -1
- package/build/hooks/useParticipants.js +6 -6
- package/build/hooks/useParticipants.js.map +1 -1
- package/build/hooks/useReconnection.d.ts.map +1 -1
- package/build/hooks/useReconnection.js +8 -18
- package/build/hooks/useReconnection.js.map +1 -1
- package/build/hooks/useScreencast.d.ts.map +1 -1
- package/build/hooks/useScreencast.js +3 -7
- package/build/hooks/useScreencast.js.map +1 -1
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +25 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js +10 -1
- package/build/types.js.map +1 -1
- package/build/utils/foregroundService.d.ts +30 -0
- package/build/utils/foregroundService.d.ts.map +1 -0
- package/build/utils/foregroundService.js +41 -0
- package/build/utils/foregroundService.js.map +1 -0
- package/ios/RNFishjamClient.swift +34 -29
- package/ios/RNFishjamClientModule.swift +11 -7
- package/package.json +19 -17
- package/.eslintignore +0 -7
- package/.eslintrc +0 -6
- package/.prettierrc +0 -9
- package/.watchmanconfig +0 -1
- package/android/.editorconfig +0 -9
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/org/membraneframework/reactnative/AudioDeviceKind.kt +0 -34
- package/android/src/main/java/org/membraneframework/reactnative/AudioSwitchManager.kt +0 -61
- package/android/src/main/java/org/membraneframework/reactnative/EmitableEvents.kt +0 -14
- package/android/src/main/java/org/membraneframework/reactnative/Errors.kt +0 -31
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClient.kt +0 -866
- package/android/src/main/java/org/membraneframework/reactnative/RNFishjamClientModule.kt +0 -294
- package/android/src/main/java/org/membraneframework/reactnative/Utils.kt +0 -11
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewView.kt +0 -40
- package/android/src/main/java/org/membraneframework/reactnative/VideoPreviewViewModule.kt +0 -17
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererView.kt +0 -58
- package/android/src/main/java/org/membraneframework/reactnative/VideoRendererViewModule.kt +0 -25
- package/android/src/main/java/org/membraneframework/reactnative/VideoView.kt +0 -77
- package/babel.config.js +0 -2
- package/build/common/eventEmitter.d.ts.map +0 -1
- package/build/common/eventEmitter.js.map +0 -1
- package/expo-module.config.json +0 -17
- package/ios/RNFishjamClient.podspec +0 -30
- package/ios/swift-format-config.json +0 -56
- package/plugin/broadcastExtensionFiles/Info.plist +0 -27
- package/plugin/broadcastExtensionFiles/MembraneBroadcastSampleHandler.swift +0 -50
- package/plugin/broadcastExtensionFiles/MembraneScreenBroadcastExtension.entitlements +0 -10
- package/plugin/src/withMembrane.ts +0 -310
- package/plugin/tsconfig.json +0 -9
- package/scripts/lint.sh +0 -18
- package/scripts/lint_check.sh +0 -14
- package/src/RNFishjamClientModule.ts +0 -73
- package/src/__tests__/index.test.tsx +0 -199
- package/src/common/client.ts +0 -33
- package/src/common/eventEmitter.ts +0 -21
- package/src/common/metadata.ts +0 -12
- package/src/common/webRTC.ts +0 -31
- package/src/components/VideoPreviewView.tsx +0 -33
- package/src/components/VideoRendererView.tsx +0 -31
- package/src/hooks/useAudioSettings.ts +0 -115
- package/src/hooks/useBandwidthEstimation.ts +0 -24
- package/src/hooks/useCamera.ts +0 -270
- package/src/hooks/useMicrophone.ts +0 -38
- package/src/hooks/useParticipants.ts +0 -118
- package/src/hooks/useReconnection.ts +0 -41
- package/src/hooks/useScreencast.ts +0 -146
- package/src/index.tsx +0 -63
- package/src/protos/fishjam/peer_notifications.ts +0 -299
- package/src/stats/types.ts +0 -56
- package/src/stats/useRTCStatistics.ts +0 -97
- package/src/types.ts +0 -49
- package/tsconfig.json +0 -9
- package/typedoc.json +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback,
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
2
|
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
3
|
-
import { ReceivableEvents, eventEmitter } from '../common/eventEmitter';
|
|
4
3
|
import { Platform } from 'react-native';
|
|
4
|
+
import { ReceivableEvents, useFishjamEvent } from './useFishjamEvent';
|
|
5
5
|
const defaultSimulcastConfig = () => ({
|
|
6
6
|
enabled: false,
|
|
7
7
|
activeEncodings: [],
|
|
@@ -14,11 +14,7 @@ let screencastSimulcastConfig = defaultSimulcastConfig();
|
|
|
14
14
|
export function useScreencast() {
|
|
15
15
|
const [isScreencastOn, setIsScreencastOn] = useState(RNFishjamClientModule.isScreencastOn);
|
|
16
16
|
const [simulcastConfig, setSimulcastConfig] = useState(screencastSimulcastConfig);
|
|
17
|
-
|
|
18
|
-
const eventListener = eventEmitter.addListener(ReceivableEvents.IsScreencastOn, (event) => setIsScreencastOn(event.IsScreencastOn));
|
|
19
|
-
setIsScreencastOn(RNFishjamClientModule.isScreencastOn);
|
|
20
|
-
return () => eventListener.remove();
|
|
21
|
-
}, []);
|
|
17
|
+
useFishjamEvent(ReceivableEvents.IsScreencastOn, setIsScreencastOn);
|
|
22
18
|
/**
|
|
23
19
|
* Toggles the screencast on/off
|
|
24
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreencast.js","sourceRoot":"","sources":["../../src/hooks/useScreencast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,
|
|
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;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAClD,qBAAqB,CAAC,cAAc,CACrC,CAAC;IAEF,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CACpD,yBAAyB,CAC1B,CAAC;IAEF,eAAe,CAAC,gBAAgB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAEpE;;OAEG;IACH,MAAM,gBAAgB,GAAG,WAAW,CAClC,KAAK,EAAE,oBAAgD,EAAE,EAAE,EAAE;QAC3D,MAAM,OAAO,GAAG;YACd,GAAG,iBAAiB;YACpB,kBAAkB,EAAE;gBAClB,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,eAAwB;gBAC9B,MAAM,EAAE,CAAC,cAAc;aACxB;SACF,CAAC;QACF,MAAM,qBAAqB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACtD,yBAAyB,GAAG,sBAAsB,EAAE,CAAC,CAAC,kCAAkC;QACxF,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF;;;OAGG;IACH,MAAM,6BAA6B,GAAG,WAAW,CAC/C,KAAK,EAAE,QAAuB,EAAE,EAAE;QAChC,yBAAyB;YACvB,MAAM,qBAAqB,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;QACtE,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,EACD,EAAE,CACH,CAAC;IAEF;;;;OAIG;IACH,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;;;;;;OAMG;IACH,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,gBAAgB;QAChB,6BAA6B;QAC7B,eAAe;QACf,mCAAmC;QACnC,2BAA2B;QAC3B,0BAA0B;KAC3B,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 */\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 /**\n * Toggles the screencast on/off\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 /**\n * Toggles simulcast encoding of a screencast track on/off\n * @param encoding encoding to toggle\n */\n const toggleScreencastTrackEncoding = useCallback(\n async (encoding: TrackEncoding) => {\n screencastSimulcastConfig =\n await RNFishjamClientModule.toggleScreencastTrackEncoding(encoding);\n setSimulcastConfig(screencastSimulcastConfig);\n },\n [],\n );\n\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 */\n const setScreencastTrackEncodingBandwidth = useCallback(\n async (encoding: TrackEncoding, bandwidth: BandwidthLimit) => {\n await RNFishjamClientModule.setScreencastTrackEncodingBandwidth(\n encoding,\n bandwidth,\n );\n },\n [],\n );\n\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 */\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 toggleScreencast,\n toggleScreencastTrackEncoding,\n simulcastConfig,\n setScreencastTrackEncodingBandwidth,\n setScreencastTrackBandwidth,\n handleScreencastPermission,\n };\n}\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ export type { Participant, Track, TrackType, VadStatus, EncodingReason, } from '
|
|
|
2
2
|
export { useParticipants } from './hooks/useParticipants';
|
|
3
3
|
export type { AudioOutputDevice, AudioOutputDeviceType, AudioSessionMode, } from './hooks/useAudioSettings';
|
|
4
4
|
export { useAudioSettings } from './hooks/useAudioSettings';
|
|
5
|
-
export type { BandwidthEstimationEvent } from './hooks/useBandwidthEstimation';
|
|
6
5
|
export { useBandwidthEstimation } from './hooks/useBandwidthEstimation';
|
|
7
|
-
export type {
|
|
6
|
+
export type { Camera, CameraConfig, VideoQuality, CameraFacingDirection, } from './hooks/useCamera';
|
|
8
7
|
export { useCamera } from './hooks/useCamera';
|
|
9
8
|
export { useMicrophone } from './hooks/useMicrophone';
|
|
10
9
|
export { useRTCStatistics } from './stats/useRTCStatistics';
|
|
@@ -15,10 +14,12 @@ export { useReconnection } from './hooks/useReconnection';
|
|
|
15
14
|
export { updatePeerMetadata } from './common/metadata';
|
|
16
15
|
export type { LoggingSeverity } from './common/webRTC';
|
|
17
16
|
export { changeWebRTCLoggingSeverity, setTargetTrackEncoding, } from './common/webRTC';
|
|
18
|
-
export {
|
|
17
|
+
export { joinRoom, leaveRoom } from './common/client';
|
|
19
18
|
export type { VideoPreviewViewProps } from './components/VideoPreviewView';
|
|
20
19
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
21
20
|
export type { VideoRendererProps } from './components/VideoRendererView';
|
|
22
21
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
22
|
+
export { AndroidForegroundServiceType } from './types';
|
|
23
|
+
export { startForegroundService, stopForegroundService, } from './utils/foregroundService';
|
|
23
24
|
export type { TrackBandwidthLimit, TrackEncoding, SimulcastBandwidthLimit, BandwidthLimit, SimulcastConfig, VideoLayout, } from './types';
|
|
24
25
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,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,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
|
@@ -8,7 +8,9 @@ export { useScreencast } from './hooks/useScreencast';
|
|
|
8
8
|
export { useReconnection } from './hooks/useReconnection';
|
|
9
9
|
export { updatePeerMetadata } from './common/metadata';
|
|
10
10
|
export { changeWebRTCLoggingSeverity, setTargetTrackEncoding, } from './common/webRTC';
|
|
11
|
-
export {
|
|
11
|
+
export { joinRoom, leaveRoom } from './common/client';
|
|
12
12
|
export { VideoPreviewView } from './components/VideoPreviewView';
|
|
13
13
|
export { VideoRendererView } from './components/VideoRendererView';
|
|
14
|
+
export { AndroidForegroundServiceType } from './types';
|
|
15
|
+
export { startForegroundService, stopForegroundService, } from './utils/foregroundService';
|
|
14
16
|
//# 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":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAO1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAQxE,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","sourcesContent":["export 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 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"]}
|
package/build/types.d.ts
CHANGED
|
@@ -39,5 +39,30 @@ declare const brand: unique symbol;
|
|
|
39
39
|
export type Brand<T, TBrand extends string> = T & {
|
|
40
40
|
[brand]: TBrand;
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Enum used to set the foreground service types identifying the work done by the service.
|
|
44
|
+
* See Android's [foreground service types](https://developer.android.com/develop/background-work/services/fg-service-types) documentation.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum AndroidForegroundServiceType {
|
|
47
|
+
FOREGROUND_SERVICE_TYPE_CAMERA = 64,
|
|
48
|
+
FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32,
|
|
49
|
+
FOREGROUND_SERVICE_TYPE_MICROPHONE = 128
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A type representing the options required for configuring the foreground service.
|
|
53
|
+
*
|
|
54
|
+
* @param channelId The id of the channel. Must be unique per package.
|
|
55
|
+
* @param channelName The user visible name of the channel.
|
|
56
|
+
* @param notificationTitle The title (first row) of the notification, in a standard notification.
|
|
57
|
+
* @param notificationContent The text (second row) of the notification, in a standard notification.
|
|
58
|
+
* @param foregroundServiceTypes The type of foreground service to launch.
|
|
59
|
+
*/
|
|
60
|
+
export type ForegroundServiceOptions = {
|
|
61
|
+
channelId: string;
|
|
62
|
+
channelName: string;
|
|
63
|
+
notificationTitle: string;
|
|
64
|
+
notificationContent: string;
|
|
65
|
+
foregroundServiceTypes: AndroidForegroundServiceType[];
|
|
66
|
+
};
|
|
42
67
|
export {};
|
|
43
68
|
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzC,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,uBAAuB,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGtD,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC;AACnC,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,MAAM,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzC,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,uBAAuB,CAAC;AAE3E,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGtD,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAC;AACnC,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,MAAM,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,8BAA8B,KAAK;IACnC,wCAAwC,KAAK;IAC7C,kCAAkC,MAAM;CACzC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,4BAA4B,EAAE,CAAC;CACxD,CAAC"}
|
package/build/types.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Enum used to set the foreground service types identifying the work done by the service.
|
|
3
|
+
* See Android's [foreground service types](https://developer.android.com/develop/background-work/services/fg-service-types) documentation.
|
|
4
|
+
*/
|
|
5
|
+
export var AndroidForegroundServiceType;
|
|
6
|
+
(function (AndroidForegroundServiceType) {
|
|
7
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_CAMERA"] = 64] = "FOREGROUND_SERVICE_TYPE_CAMERA";
|
|
8
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION"] = 32] = "FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION";
|
|
9
|
+
AndroidForegroundServiceType[AndroidForegroundServiceType["FOREGROUND_SERVICE_TYPE_MICROPHONE"] = 128] = "FOREGROUND_SERVICE_TYPE_MICROPHONE";
|
|
10
|
+
})(AndroidForegroundServiceType || (AndroidForegroundServiceType = {}));
|
|
2
11
|
//# sourceMappingURL=types.js.map
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// global\nexport type VideoLayout = 'FILL' | 'FIT';\n\nexport type TrackEncoding = 'l' | 'm' | 'h';\n\n/**\n * A type describing simulcast configuration.\n *\n * At the moment, simulcast track is initialized in three versions - low, medium and high.\n * High resolution is the original track resolution, while medium and low resolutions are\n * the original track resolution scaled down by 2 and 4 respectively.\n */\nexport type SimulcastConfig = {\n /**\n * whether to simulcast track or not. By default simulcast is disabled.\n */\n enabled: boolean;\n /**\n * list of active encodings. Encoding can be one of `\"h\"` (original encoding), `\"m\"` (scaled down x2), `\"l\"` (scaled down x4).\n */\n activeEncodings: TrackEncoding[];\n};\n\n/**\n * Type describing maximal bandwidth that can be used, in kbps. 0 is interpreted as unlimited bandwidth.\n */\nexport type BandwidthLimit = number;\n\n/**\n * Type describing bandwidth limit for simulcast track. It is a mapping `encoding -> BandwidthLimit`. If encoding isn't present in this mapping,\n * it will be assumed that this particular encoding shouldn't have any bandwidth limit.\n */\nexport type SimulcastBandwidthLimit = Record<TrackEncoding, BandwidthLimit>;\n\n/**\n * A type describing bandwidth limitation of a track, including simulcast and non-simulcast tracks. Can be `BandwidthLimit` or `SimulcastBandwidthLimit`.\n */\nexport type TrackBandwidthLimit = BandwidthLimit | SimulcastBandwidthLimit;\n\nexport type TrackMetadata = {\n active: boolean;\n type: 'audio' | 'camera' | 'screensharing';\n};\n\nexport type GenericMetadata = Record<string, unknown>;\n\n// branded types are useful for restricting where given value can be passed\ndeclare const brand: unique symbol;\nexport type Brand<T, TBrand extends string> = T & { [brand]: TBrand };\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkDA;;;GAGG;AACH,MAAM,CAAN,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACtC,oIAAmC,CAAA;IACnC,wJAA6C,CAAA;IAC7C,6IAAwC,CAAA;AAC1C,CAAC,EAJW,4BAA4B,KAA5B,4BAA4B,QAIvC","sourcesContent":["// global\nexport type VideoLayout = 'FILL' | 'FIT';\n\nexport type TrackEncoding = 'l' | 'm' | 'h';\n\n/**\n * A type describing simulcast configuration.\n *\n * At the moment, simulcast track is initialized in three versions - low, medium and high.\n * High resolution is the original track resolution, while medium and low resolutions are\n * the original track resolution scaled down by 2 and 4 respectively.\n */\nexport type SimulcastConfig = {\n /**\n * whether to simulcast track or not. By default simulcast is disabled.\n */\n enabled: boolean;\n /**\n * list of active encodings. Encoding can be one of `\"h\"` (original encoding), `\"m\"` (scaled down x2), `\"l\"` (scaled down x4).\n */\n activeEncodings: TrackEncoding[];\n};\n\n/**\n * Type describing maximal bandwidth that can be used, in kbps. 0 is interpreted as unlimited bandwidth.\n */\nexport type BandwidthLimit = number;\n\n/**\n * Type describing bandwidth limit for simulcast track. It is a mapping `encoding -> BandwidthLimit`. If encoding isn't present in this mapping,\n * it will be assumed that this particular encoding shouldn't have any bandwidth limit.\n */\nexport type SimulcastBandwidthLimit = Record<TrackEncoding, BandwidthLimit>;\n\n/**\n * A type describing bandwidth limitation of a track, including simulcast and non-simulcast tracks. Can be `BandwidthLimit` or `SimulcastBandwidthLimit`.\n */\nexport type TrackBandwidthLimit = BandwidthLimit | SimulcastBandwidthLimit;\n\nexport type TrackMetadata = {\n active: boolean;\n type: 'audio' | 'camera' | 'screensharing';\n};\n\nexport type GenericMetadata = Record<string, unknown>;\n\n// branded types are useful for restricting where given value can be passed\ndeclare const brand: unique symbol;\nexport type Brand<T, TBrand extends string> = T & { [brand]: TBrand };\n\n/**\n * Enum used to set the foreground service types identifying the work done by the service.\n * See Android's [foreground service types](https://developer.android.com/develop/background-work/services/fg-service-types) documentation.\n */\nexport enum AndroidForegroundServiceType {\n FOREGROUND_SERVICE_TYPE_CAMERA = 64,\n FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32,\n FOREGROUND_SERVICE_TYPE_MICROPHONE = 128,\n}\n\n/**\n * A type representing the options required for configuring the foreground service.\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 * @param foregroundServiceTypes The type of foreground service to launch.\n */\nexport type ForegroundServiceOptions = {\n channelId: string;\n channelName: string;\n notificationTitle: string;\n notificationContent: string;\n foregroundServiceTypes: AndroidForegroundServiceType[];\n};\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ForegroundServiceOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Launches a foreground service on Android.
|
|
4
|
+
* Does nothing on other platforms.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* You must have have the following permissions enabled before calling this function:
|
|
8
|
+
* @example
|
|
9
|
+
```
|
|
10
|
+
"android.permission.FOREGROUND_SERVICE"
|
|
11
|
+
"android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
|
|
12
|
+
"android.permission.FOREGROUND_SERVICE_CAMERA"
|
|
13
|
+
"android.permission.FOREGROUND_SERVICE_MICROPHONE"
|
|
14
|
+
"android.permission.POST_NOTIFICATIONS"
|
|
15
|
+
*```
|
|
16
|
+
* as well as FishjamForegroundService in your AndroidManifest:
|
|
17
|
+
* @example
|
|
18
|
+
```
|
|
19
|
+
<service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
|
|
20
|
+
```
|
|
21
|
+
*/
|
|
22
|
+
export declare const startForegroundService: (options: ForegroundServiceOptions) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Stops previously launched Android foreground service.
|
|
25
|
+
* @see {@link startForegroundService} for further information.
|
|
26
|
+
*
|
|
27
|
+
* Does nothing on other platforms.
|
|
28
|
+
*/
|
|
29
|
+
export declare const stopForegroundService: () => void;
|
|
30
|
+
//# sourceMappingURL=foregroundService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foregroundService.d.ts","sourceRoot":"","sources":["../../src/utils/foregroundService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;MAmBM;AACN,eAAO,MAAM,sBAAsB,YAAa,wBAAwB,SAKvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,YAKjC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import RNFishjamClientModule from '../RNFishjamClientModule';
|
|
3
|
+
/**
|
|
4
|
+
* Launches a foreground service on Android.
|
|
5
|
+
* Does nothing on other platforms.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* You must have have the following permissions enabled before calling this function:
|
|
9
|
+
* @example
|
|
10
|
+
```
|
|
11
|
+
"android.permission.FOREGROUND_SERVICE"
|
|
12
|
+
"android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
|
|
13
|
+
"android.permission.FOREGROUND_SERVICE_CAMERA"
|
|
14
|
+
"android.permission.FOREGROUND_SERVICE_MICROPHONE"
|
|
15
|
+
"android.permission.POST_NOTIFICATIONS"
|
|
16
|
+
*```
|
|
17
|
+
* as well as FishjamForegroundService in your AndroidManifest:
|
|
18
|
+
* @example
|
|
19
|
+
```
|
|
20
|
+
<service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
|
|
21
|
+
```
|
|
22
|
+
*/
|
|
23
|
+
export const startForegroundService = (options) => {
|
|
24
|
+
if (Platform.OS !== 'android') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
RNFishjamClientModule.startForegroundService(options);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Stops previously launched Android foreground service.
|
|
31
|
+
* @see {@link startForegroundService} for further information.
|
|
32
|
+
*
|
|
33
|
+
* Does nothing on other platforms.
|
|
34
|
+
*/
|
|
35
|
+
export const stopForegroundService = () => {
|
|
36
|
+
if (Platform.OS !== 'android') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
RNFishjamClientModule.stopForegroundService();
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=foregroundService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foregroundService.js","sourceRoot":"","sources":["../../src/utils/foregroundService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;MAmBM;AACN,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAiC,EAAE,EAAE;IAC1E,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,qBAAqB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,qBAAqB,CAAC,qBAAqB,EAAE,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Platform } from 'react-native';\nimport RNFishjamClientModule from '../RNFishjamClientModule';\nimport { ForegroundServiceOptions } from '../types';\n\n/**\n * Launches a foreground service on Android.\n * Does nothing on other platforms.\n * \n * @remarks\n * You must have have the following permissions enabled before calling this function:\n * @example\n ```\n \"android.permission.FOREGROUND_SERVICE\"\n \"android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION\"\n \"android.permission.FOREGROUND_SERVICE_CAMERA\"\n \"android.permission.FOREGROUND_SERVICE_MICROPHONE\"\n \"android.permission.POST_NOTIFICATIONS\"\n *```\n * as well as FishjamForegroundService in your AndroidManifest:\n * @example\n ```\n <service android:name=\"io.fishjam.reactnative.FishjamForegroundService\" android:foregroundServiceType=\"camera|microphone|mediaProjection\"/>\n ```\n */\nexport const startForegroundService = (options: ForegroundServiceOptions) => {\n if (Platform.OS !== 'android') {\n return;\n }\n RNFishjamClientModule.startForegroundService(options);\n};\n\n/**\n * Stops previously launched Android foreground service.\n * @see {@link startForegroundService} for further information.\n *\n * Does nothing on other platforms.\n */\nexport const stopForegroundService = () => {\n if (Platform.OS !== 'android') {\n return;\n }\n RNFishjamClientModule.stopForegroundService();\n};\n"]}
|
|
@@ -21,7 +21,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
21
21
|
var screencastSimulcastConfig: SimulcastConfig = SimulcastConfig()
|
|
22
22
|
var screencastMaxBandwidth: TrackBandwidthLimit = .BandwidthLimit(0)
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var cameraId: String? = nil
|
|
25
25
|
|
|
26
26
|
var audioSessionMode: AVAudioSession.Mode = AVAudioSession.Mode.videoChat
|
|
27
27
|
var errorMessage: String?
|
|
@@ -173,12 +173,15 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
func onAuthSuccess() {
|
|
176
|
-
|
|
176
|
+
join()
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
func
|
|
179
|
+
func joinRoom(
|
|
180
|
+
url: String, participantToken: String, participantMetadata: [String: Any], config: ConnectConfig,
|
|
181
|
+
promise: Promise
|
|
182
|
+
) {
|
|
180
183
|
connectPromise = promise
|
|
181
|
-
localUserMetadata =
|
|
184
|
+
localUserMetadata = participantMetadata.toMetadata()
|
|
182
185
|
|
|
183
186
|
let reconnectConfig = FishjamCloudClient.ReconnectConfig(
|
|
184
187
|
maxAttempts: config.reconnectConfig.maxAttempts, initialDelayMs: config.reconnectConfig.initialDelayMs,
|
|
@@ -186,12 +189,13 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
186
189
|
|
|
187
190
|
RNFishjamClient.fishjamClient?.connect(
|
|
188
191
|
config: FishjamCloudClient.ConnectConfig(
|
|
189
|
-
websocketUrl: url, token:
|
|
192
|
+
websocketUrl: url, token: participantToken, participantMetadata: .init(participantMetadata),
|
|
193
|
+
reconnectConfig: reconnectConfig
|
|
190
194
|
))
|
|
191
195
|
|
|
192
196
|
}
|
|
193
197
|
|
|
194
|
-
func
|
|
198
|
+
func join() {
|
|
195
199
|
RNFishjamClient.fishjamClient?.join(peerMetadata: localUserMetadata)
|
|
196
200
|
}
|
|
197
201
|
|
|
@@ -224,7 +228,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
224
228
|
return RNFishjamClient.fishjamClient!.createVideoTrack(
|
|
225
229
|
videoParameters: videoParameters,
|
|
226
230
|
metadata: config.videoTrackMetadata.toMetadata(),
|
|
227
|
-
captureDeviceName: config.
|
|
231
|
+
captureDeviceName: config.cameraId
|
|
228
232
|
)
|
|
229
233
|
}
|
|
230
234
|
|
|
@@ -236,9 +240,10 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
236
240
|
emitEvent(name: eventName, data: isCameraEnabledMap)
|
|
237
241
|
}
|
|
238
242
|
|
|
239
|
-
func toggleCamera() throws {
|
|
243
|
+
func toggleCamera() throws -> Bool {
|
|
240
244
|
try ensureVideoTrack()
|
|
241
245
|
setCameraTrackState(getLocalVideoTrack()!, enabled: !isCameraOn)
|
|
246
|
+
return isCameraOn
|
|
242
247
|
}
|
|
243
248
|
|
|
244
249
|
func flipCamera() throws {
|
|
@@ -246,9 +251,9 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
246
251
|
getLocalVideoTrack()?.flipCamera()
|
|
247
252
|
}
|
|
248
253
|
|
|
249
|
-
func switchCamera(
|
|
254
|
+
func switchCamera(cameraId: String) throws {
|
|
250
255
|
try ensureVideoTrack()
|
|
251
|
-
getLocalVideoTrack()?.switchCamera(deviceId:
|
|
256
|
+
getLocalVideoTrack()?.switchCamera(deviceId: cameraId)
|
|
252
257
|
|
|
253
258
|
}
|
|
254
259
|
|
|
@@ -314,8 +319,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
314
319
|
description: "No app group name set. Please set AppGroupName in Info.plist")
|
|
315
320
|
}
|
|
316
321
|
|
|
317
|
-
guard !isScreencastOn
|
|
318
|
-
else {
|
|
322
|
+
guard !isScreencastOn else {
|
|
319
323
|
DispatchQueue.main.async {
|
|
320
324
|
RPSystemBroadcastPickerView.show(for: screencastExtensionBundleId)
|
|
321
325
|
}
|
|
@@ -334,12 +338,8 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
334
338
|
videoParameters: videoParameters,
|
|
335
339
|
metadata: screencastMetadata,
|
|
336
340
|
onStart: { [weak self] screencastTrack in
|
|
337
|
-
guard let self = self else {
|
|
338
|
-
|
|
339
|
-
RPSystemBroadcastPickerView.show(for: screencastExtensionBundleId)
|
|
340
|
-
}
|
|
341
|
-
return
|
|
342
|
-
}
|
|
341
|
+
guard let self = self else { return }
|
|
342
|
+
|
|
343
343
|
do {
|
|
344
344
|
//not sure should it be here, or outside or where?
|
|
345
345
|
try setScreencastTrackState(screencastTrack, enabled: true)
|
|
@@ -352,9 +352,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
352
352
|
|
|
353
353
|
},
|
|
354
354
|
onStop: { [weak self] screencastTrack in
|
|
355
|
-
guard let self = self else {
|
|
356
|
-
return
|
|
357
|
-
}
|
|
355
|
+
guard let self = self else { return }
|
|
358
356
|
do {
|
|
359
357
|
//not sure should it be here, or outside or where?
|
|
360
358
|
try setScreencastTrackState(screencastTrack, enabled: false)
|
|
@@ -401,7 +399,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
401
399
|
return [
|
|
402
400
|
"id": track.id,
|
|
403
401
|
"type": "Video",
|
|
404
|
-
"metadata": track.metadata,
|
|
402
|
+
"metadata": track.metadata.toDict(),
|
|
405
403
|
"encoding": track.encoding?.description,
|
|
406
404
|
"encodingReason": track.encodingReason?.rawValue,
|
|
407
405
|
]
|
|
@@ -410,7 +408,7 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
410
408
|
return [
|
|
411
409
|
"id": track.id,
|
|
412
410
|
"type": "Audio",
|
|
413
|
-
"metadata": track.metadata,
|
|
411
|
+
"metadata": track.metadata.toDict(),
|
|
414
412
|
"vadStatus": track.vadStatus.rawValue,
|
|
415
413
|
]
|
|
416
414
|
|
|
@@ -418,21 +416,21 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
418
416
|
return [
|
|
419
417
|
"id": track.id,
|
|
420
418
|
"type": "Video",
|
|
421
|
-
"metadata": track.metadata,
|
|
419
|
+
"metadata": track.metadata.toDict(),
|
|
422
420
|
]
|
|
423
421
|
|
|
424
422
|
case let track as LocalScreencastTrack:
|
|
425
423
|
return [
|
|
426
424
|
"id": track.id,
|
|
427
425
|
"type": "Video",
|
|
428
|
-
"metadata": track.metadata,
|
|
426
|
+
"metadata": track.metadata.toDict(),
|
|
429
427
|
]
|
|
430
428
|
|
|
431
429
|
case let track as LocalAudioTrack:
|
|
432
430
|
return [
|
|
433
431
|
"id": track.id,
|
|
434
432
|
"type": "Audio",
|
|
435
|
-
"metadata": track.metadata,
|
|
433
|
+
"metadata": track.metadata.toDict(),
|
|
436
434
|
]
|
|
437
435
|
|
|
438
436
|
default:
|
|
@@ -446,11 +444,16 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
446
444
|
func getCaptureDevices() -> [[String: Any]] {
|
|
447
445
|
let devices = LocalVideoTrack.getCaptureDevices()
|
|
448
446
|
return devices.map { device -> [String: Any] in
|
|
447
|
+
let facingDirection =
|
|
448
|
+
switch device.position {
|
|
449
|
+
case .front: "front"
|
|
450
|
+
case .back: "back"
|
|
451
|
+
default: "unspecified"
|
|
452
|
+
}
|
|
449
453
|
return [
|
|
450
454
|
"id": device.uniqueID,
|
|
451
455
|
"name": device.localizedName,
|
|
452
|
-
"
|
|
453
|
-
"isBackFacing": device.position == .back,
|
|
456
|
+
"facingDirection": facingDirection,
|
|
454
457
|
]
|
|
455
458
|
}
|
|
456
459
|
}
|
|
@@ -706,7 +709,9 @@ class RNFishjamClient: FishjamClientListener {
|
|
|
706
709
|
addOrUpdateTrack(track)
|
|
707
710
|
}
|
|
708
711
|
|
|
709
|
-
func onTrackAdded(track: Track) {
|
|
712
|
+
func onTrackAdded(track: Track) {
|
|
713
|
+
emitEndpoints()
|
|
714
|
+
}
|
|
710
715
|
|
|
711
716
|
func onTrackRemoved(track: Track) {
|
|
712
717
|
emitEndpoints()
|
|
@@ -28,7 +28,7 @@ struct CameraConfig: Record {
|
|
|
28
28
|
var cameraEnabled: Bool = true
|
|
29
29
|
|
|
30
30
|
@Field
|
|
31
|
-
var
|
|
31
|
+
var cameraId: String? = nil
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
struct MicrophoneConfig: Record {
|
|
@@ -98,9 +98,13 @@ public class RNFishjamClientModule: Module {
|
|
|
98
98
|
}()
|
|
99
99
|
|
|
100
100
|
AsyncFunction("connect") {
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
(
|
|
102
|
+
url: String, participantToken: String, participantMetadata: [String: Any], config: ConnectConfig,
|
|
103
|
+
promise: Promise
|
|
104
|
+
) in
|
|
105
|
+
rnFishjamClient.joinRoom(
|
|
106
|
+
url: url, participantToken: participantToken, participantMetadata: participantMetadata, config: config,
|
|
107
|
+
promise: promise)
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
AsyncFunction("leaveRoom") {
|
|
@@ -131,11 +135,11 @@ public class RNFishjamClientModule: Module {
|
|
|
131
135
|
try rnFishjamClient.flipCamera()
|
|
132
136
|
}
|
|
133
137
|
|
|
134
|
-
AsyncFunction("switchCamera") { (
|
|
135
|
-
try rnFishjamClient.switchCamera(captureDeviceId:
|
|
138
|
+
AsyncFunction("switchCamera") { (cameraId: String) in
|
|
139
|
+
try rnFishjamClient.switchCamera(captureDeviceId: cameraId)
|
|
136
140
|
}
|
|
137
141
|
|
|
138
|
-
|
|
142
|
+
Property("cameras") {
|
|
139
143
|
rnFishjamClient.getCaptureDevices()
|
|
140
144
|
}
|
|
141
145
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/react-native-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A React Native client for Fishjam Cloud",
|
|
5
5
|
"author": "Fishjam Cloud Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"types": "build/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "expo-module build",
|
|
10
|
+
"build": "EXPO_NONINTERACTIVE=1 sh -c 'expo-module build && expo-module build plugin'",
|
|
11
11
|
"clean": "expo-module clean",
|
|
12
12
|
"lint": "sh ./scripts/lint.sh",
|
|
13
13
|
"lint:check": "sh ./scripts/lint_check.sh",
|
|
@@ -47,20 +47,18 @@
|
|
|
47
47
|
"@types/phoenix": "^1.6.5",
|
|
48
48
|
"@types/promise-fs": "^2.1.2",
|
|
49
49
|
"@types/react": "^18.3.5",
|
|
50
|
-
"expo": "^
|
|
51
|
-
"expo-module-scripts": "^3.
|
|
52
|
-
"expo-modules-core": "
|
|
53
|
-
"husky": "^9.1.
|
|
50
|
+
"expo": "^51.0.32",
|
|
51
|
+
"expo-module-scripts": "^3.5.2",
|
|
52
|
+
"expo-modules-core": "^1.12.24",
|
|
53
|
+
"husky": "^9.1.6",
|
|
54
54
|
"jest": "^29.6.1",
|
|
55
55
|
"jest-environment-jsdom": "^29.6.1",
|
|
56
|
-
"jest-expo": "^
|
|
56
|
+
"jest-expo": "^51.0.4",
|
|
57
57
|
"jest-websocket-mock": "^2.4.0",
|
|
58
|
-
"lint-staged": "^15.2.10",
|
|
59
58
|
"pod-install": "^0.2.0",
|
|
60
|
-
"react": "18.
|
|
61
|
-
"react-dom": "18.3.1",
|
|
62
|
-
"react-native": "0.
|
|
63
|
-
"release-it": "^17.6.0",
|
|
59
|
+
"react": "^18.2.0",
|
|
60
|
+
"react-dom": "^18.3.1",
|
|
61
|
+
"react-native": "^0.75.2",
|
|
64
62
|
"ts-proto": "^2.1.0",
|
|
65
63
|
"typedoc": "^0.26.6",
|
|
66
64
|
"typedoc-plugin-mark-react-functional-components": "^0.2.2",
|
|
@@ -79,9 +77,13 @@
|
|
|
79
77
|
],
|
|
80
78
|
"testEnvironment": "jsdom"
|
|
81
79
|
},
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
"files": [
|
|
81
|
+
"build/",
|
|
82
|
+
"ios/*.swift",
|
|
83
|
+
"android/src",
|
|
84
|
+
"android/build.gradle",
|
|
85
|
+
"plugin/build",
|
|
86
|
+
"app.plugin.js",
|
|
87
|
+
"README.md"
|
|
88
|
+
]
|
|
87
89
|
}
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
package/.prettierrc
DELETED
package/.watchmanconfig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/android/.editorconfig
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
[*.{kt,kts}]
|
|
2
|
-
ktlint_code_style = ktlint_official
|
|
3
|
-
ktlint_standard_no-wildcard-imports = disabled
|
|
4
|
-
ktlint_standard_filename = disabled
|
|
5
|
-
ktlint_standard_function-naming = disabled
|
|
6
|
-
ktlint_standard_property-naming = disabled
|
|
7
|
-
ij_kotlin_allow_trailing_comma = false
|
|
8
|
-
ij_kotlin_allow_trailing_comma_on_call_site = false
|
|
9
|
-
ktlint_standard_function-literal = disabled
|