@fishjam-cloud/react-native-client 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -36
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/overrides/RTCPeerConnection.d.ts +2 -0
- package/dist/overrides/RTCPeerConnection.d.ts.map +1 -1
- package/dist/overrides/hooks.d.ts +4 -42
- package/dist/overrides/hooks.d.ts.map +1 -1
- package/dist/overrides/hooks.js +18 -1
- package/dist/overrides/types.d.ts +38 -7
- package/dist/overrides/types.d.ts.map +1 -1
- package/dist/useForegroundService.d.ts +1 -1
- package/dist/useForegroundService.d.ts.map +1 -1
- package/dist/webrtc-polyfill.js +31 -0
- package/package.json +10 -8
- package/plugin/build/withFishjamAndroid.js +4 -17
package/README.md
CHANGED
|
@@ -12,59 +12,70 @@ yarn add @fishjam-cloud/react-native-client
|
|
|
12
12
|
|
|
13
13
|
## Local Development with WebRTC Fork
|
|
14
14
|
|
|
15
|
-
This package depends on `@fishjam-cloud/react-native-webrtc`,
|
|
15
|
+
This package depends on `@fishjam-cloud/react-native-webrtc`, a fork of `react-native-webrtc`. The fork lives in [its own GitHub repo](https://github.com/fishjam-cloud/fishjam-react-native-webrtc) and is included in this monorepo as a git submodule at `packages/react-native-webrtc/`, wired up as a yarn workspace. No manual linking is required.
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### Setup
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Clone the repository with submodules:
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
```bash
|
|
22
|
+
git clone --recurse-submodules https://github.com/fishjam-cloud/web-client-sdk.git
|
|
23
|
+
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
If you already cloned without `--recurse-submodules`, initialize the submodules from inside the repo:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
```bash
|
|
28
|
+
git submodule update --init --recursive
|
|
29
|
+
```
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Then install dependencies from the repo root:
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
```bash
|
|
34
|
+
yarn install
|
|
35
|
+
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
Yarn resolves `@fishjam-cloud/react-native-webrtc` to the workspace at `packages/react-native-webrtc/`, and React Native autolinking picks up the native iOS and Android code automatically through the symlinked package.
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
"@fishjam-cloud/react-native-webrtc": "file:<PATH_TO_CLONED_REPO>/react-native-webrtc"
|
|
39
|
-
```
|
|
39
|
+
### Development Workflow
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
| Change Type | What to Do |
|
|
42
|
+
| ------------------------------------- | ----------------------------------------------------- |
|
|
43
|
+
| **JS/TS changes** in the fork | Save → Metro hot reloads automatically |
|
|
44
|
+
| **Native code changes** (iOS/Android) | Save → Rebuild the app (`yarn ios` or `yarn android`) |
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
No `pod install` or `yarn install` is needed after native code changes — just rebuild the app.
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
yarn install
|
|
47
|
-
```
|
|
48
|
+
### Updating the Submodule
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
The submodule tracks the fork's `master` branch but is pinned to a specific commit. To update to the latest upstream:
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
```bash
|
|
53
|
+
git submodule update --remote packages/react-native-webrtc
|
|
54
|
+
git add packages/react-native-webrtc
|
|
55
|
+
git commit -m "Bump react-native-webrtc submodule"
|
|
56
|
+
```
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
To check out a specific tag or commit:
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
```bash
|
|
61
|
+
git -C packages/react-native-webrtc fetch
|
|
62
|
+
git -C packages/react-native-webrtc checkout <tag-or-sha>
|
|
63
|
+
git add packages/react-native-webrtc
|
|
64
|
+
git commit -m "Pin react-native-webrtc to <tag-or-sha>"
|
|
65
|
+
```
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
When bumping the submodule across a version boundary, also update `peerDependencies.@fishjam-cloud/react-native-webrtc` in this package's `package.json` so external consumers see the correct range.
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
### Contributing Changes to the Fork
|
|
64
70
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
Changes inside `packages/react-native-webrtc/` belong to the fork's own repo, not this one. To push them upstream:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd packages/react-native-webrtc
|
|
75
|
+
git checkout -b your-feature-branch
|
|
76
|
+
# commit your changes
|
|
77
|
+
git push origin your-feature-branch
|
|
78
|
+
# open a PR against fishjam-cloud/fishjam-react-native-webrtc
|
|
79
|
+
```
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
Once the upstream PR is merged, bump the submodule sha here (see "Updating the Submodule" above).
|
package/dist/index.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ import React from 'react';
|
|
|
8
8
|
import { type FishjamProviderProps as ReactClientFishjamProviderProps } from '@fishjam-cloud/react-client';
|
|
9
9
|
export { RTCView, RTCPIPView, type RTCVideoViewProps, type RTCPIPViewProps } from './overrides/RTCView';
|
|
10
10
|
export { ScreenCapturePickerView, startPIP, stopPIP, AudioDeviceType, useAudioOutput, } from '@fishjam-cloud/react-native-webrtc';
|
|
11
|
-
export type { CallKitAction, CallKitConfig, MediaStream, AudioDevice, AudioOutputChangedInfo, UseAudioOutputResult, } from '@fishjam-cloud/react-native-webrtc';
|
|
11
|
+
export type { CallKitAction, CallKitConfig, MediaStream, MediaStreamTrack, AudioDevice, AudioOutputChangedInfo, UseAudioOutputResult, } from '@fishjam-cloud/react-native-webrtc';
|
|
12
12
|
export { useForegroundService, type ForegroundServiceConfig } from './useForegroundService';
|
|
13
13
|
export { useCameraPermissions, useMicrophonePermissions, type PermissionStatus } from './hooks/usePermissions';
|
|
14
14
|
export { InitializeDevicesSettings, useConnection, useDataChannel, useSandbox, useUpdatePeerMetadata, useVAD, Variant, } from '@fishjam-cloud/react-client';
|
|
15
15
|
export { useCamera, useInitializeDevices, useMicrophone, useScreenShare, useCustomSource, useLivestreamStreamer, useLivestreamViewer, usePeers, useCallKit, useCallKitEvent, useCallKitService, } from './overrides/hooks';
|
|
16
|
-
export type { StreamerInputs, ConnectStreamerConfig, UseLivestreamStreamerResult, UseLivestreamViewerResult, UseCameraResult, UseMicrophoneResult, UseScreenShareResult, UseCustomSourceResult, UseInitializeDevicesReturn, Track, RemoteTrack, CustomSource, InitializeDevicesResult, PeerWithTracks, TrackFields, } from './overrides/types';
|
|
17
|
-
export type { UseInitializeDevicesParams, JoinRoomConfig, ConnectViewerConfig, RoomType, UseSandboxProps, BandwidthLimits, Brand, DeviceError, DeviceItem, InitializeDevicesStatus,
|
|
16
|
+
export type { StreamerInputs, ConnectStreamerConfig, UseLivestreamStreamerResult, UseLivestreamViewerResult, UseCameraResult, UseMicrophoneResult, UseScreenShareResult, UseCustomSourceResult, UseInitializeDevicesReturn, Track, RemoteTrack, CustomSource, InitializeDevicesResult, PeerWithTracks, TrackFields, MiddlewareResult, TrackMiddleware, TracksMiddleware, TracksMiddlewareResult, } from './overrides/types';
|
|
17
|
+
export type { UseInitializeDevicesParams, JoinRoomConfig, ConnectViewerConfig, RoomType, UseSandboxProps, BandwidthLimits, Brand, DeviceError, DeviceItem, InitializeDevicesStatus, PeerId, PeerStatus, PersistLastDeviceHandlers, SimulcastBandwidthLimits, StreamConfig, TrackId, AuthErrorReason, JoinErrorReason, UseDataChannelResult, DataCallback, DataChannelOptions, Metadata, ReconnectConfig, ReconnectionStatus, SimulcastBandwidthLimit, SimulcastConfig, TrackBandwidthLimit, } from '@fishjam-cloud/react-client';
|
|
18
18
|
export type FishjamProviderProps = Omit<ReactClientFishjamProviderProps, 'persistLastDevice' | 'fishjamClient'>;
|
|
19
19
|
export declare function FishjamProvider(props: FishjamProviderProps): React.FunctionComponentElement<ReactClientFishjamProviderProps>;
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,oBAAoB,IAAI,+BAA+B,EAC7D,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,cAAc,GACf,MAAM,oCAAoC,CAAC;AAE5C,YAAY,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/G,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,UAAU,EACV,qBAAqB,EACrB,MAAM,EACN,OAAO,GACR,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,cAAc,EACd,qBAAqB,E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AC3B,yBAAyB,EACzB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,EACL,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,KAAK,EACL,WAAW,EACX,UAAU,EACV,uBAAuB,EACvB,MAAM,EACN,UAAU,EACV,yBAAyB,EACzB,wBAAwB,EACxB,YAAY,EACZ,OAAO,EACP,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,+BAA+B,EAAE,mBAAmB,GAAG,eAAe,CAAC,CAAC;AAChH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,mEAO1D"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RTCPeerConnection as OriginalRTCPeerConnection } from '@fishjam-cloud/react-native-webrtc';
|
|
2
|
+
type RTCConfiguration = NonNullable<ConstructorParameters<typeof OriginalRTCPeerConnection>[0]>;
|
|
2
3
|
export declare class RTCPeerConnection extends OriginalRTCPeerConnection {
|
|
3
4
|
private _configuration;
|
|
4
5
|
constructor(configuration?: RTCConfiguration);
|
|
5
6
|
setConfiguration(configuration: RTCConfiguration): void;
|
|
6
7
|
getConfiguration(): RTCConfiguration;
|
|
7
8
|
}
|
|
9
|
+
export {};
|
|
8
10
|
//# sourceMappingURL=RTCPeerConnection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTCPeerConnection.d.ts","sourceRoot":"","sources":["../../src/overrides/RTCPeerConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpG,qBAAa,iBAAkB,SAAQ,yBAAyB;IAE9D,OAAO,CAAC,cAAc,CAAmB;gBAE7B,aAAa,CAAC,EAAE,gBAAgB;IAK5C,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI;IAKvD,gBAAgB,IAAI,gBAAgB;CAGrC"}
|
|
1
|
+
{"version":3,"file":"RTCPeerConnection.d.ts","sourceRoot":"","sources":["../../src/overrides/RTCPeerConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAEpG,KAAK,gBAAgB,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhG,qBAAa,iBAAkB,SAAQ,yBAAyB;IAE9D,OAAO,CAAC,cAAc,CAAmB;gBAE7B,aAAa,CAAC,EAAE,gBAAgB;IAK5C,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI;IAKvD,gBAAgB,IAAI,gBAAgB;CAGrC"}
|
|
@@ -1,46 +1,8 @@
|
|
|
1
1
|
import type { CallKitAction, CallKitConfig, MediaStream as RNMediaStream } from '@fishjam-cloud/react-native-webrtc';
|
|
2
|
-
import type { InitializeDevicesResult, PeerWithTracks, RemoteTrack, UseLivestreamStreamerResult, UseLivestreamViewerResult } from './types';
|
|
3
|
-
export declare function useCamera():
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
stopCamera: () => void;
|
|
7
|
-
startCamera: (deviceId?: string | null) => Promise<[MediaStreamTrack, null] | [null, import("@fishjam-cloud/react-client").DeviceError]>;
|
|
8
|
-
selectCamera: (deviceId: string) => Promise<undefined | import("@fishjam-cloud/react-client").DeviceError>;
|
|
9
|
-
activeCamera: import("@fishjam-cloud/react-client").DeviceItem | null;
|
|
10
|
-
currentCamera: MediaDeviceInfo | null;
|
|
11
|
-
isCameraOn: boolean;
|
|
12
|
-
currentCameraMiddleware: import("@fishjam-cloud/react-client").TrackMiddleware;
|
|
13
|
-
setCameraTrackMiddleware: (middleware: import("@fishjam-cloud/react-client").TrackMiddleware | null) => Promise<void>;
|
|
14
|
-
cameraDevices: import("@fishjam-cloud/react-client").DeviceItem[];
|
|
15
|
-
cameraDeviceError: import("@fishjam-cloud/react-client").DeviceError | null;
|
|
16
|
-
};
|
|
17
|
-
export declare function useMicrophone(): {
|
|
18
|
-
microphoneStream: RNMediaStream | null;
|
|
19
|
-
toggleMicrophone: () => Promise<undefined | import("@fishjam-cloud/react-client").DeviceError>;
|
|
20
|
-
stopMicrophone: () => void;
|
|
21
|
-
startMicrophone: (deviceId?: string | null) => Promise<[MediaStreamTrack, null] | [null, import("@fishjam-cloud/react-client").DeviceError]>;
|
|
22
|
-
selectMicrophone: (deviceId: string) => Promise<undefined | import("@fishjam-cloud/react-client").DeviceError>;
|
|
23
|
-
activeMicrophone: import("@fishjam-cloud/react-client").DeviceItem | null;
|
|
24
|
-
currentMicrophone: MediaDeviceInfo | null;
|
|
25
|
-
isMicrophoneOn: boolean;
|
|
26
|
-
isMicrophoneMuted: boolean;
|
|
27
|
-
currentMicrophoneMiddleware: import("@fishjam-cloud/react-client").TrackMiddleware;
|
|
28
|
-
setMicrophoneTrackMiddleware: (middleware: import("@fishjam-cloud/react-client").TrackMiddleware | null) => Promise<void>;
|
|
29
|
-
microphoneDevices: import("@fishjam-cloud/react-client").DeviceItem[];
|
|
30
|
-
microphoneDeviceError: import("@fishjam-cloud/react-client").DeviceError | null;
|
|
31
|
-
};
|
|
32
|
-
export declare function useScreenShare(): {
|
|
33
|
-
stream: RNMediaStream | null;
|
|
34
|
-
startStreaming: (props?: {
|
|
35
|
-
audioConstraints?: boolean | MediaTrackConstraints;
|
|
36
|
-
videoConstraints?: boolean | MediaTrackConstraints;
|
|
37
|
-
}) => Promise<void>;
|
|
38
|
-
stopStreaming: () => Promise<void>;
|
|
39
|
-
videoTrack: MediaStreamTrack | null;
|
|
40
|
-
audioTrack: MediaStreamTrack | null;
|
|
41
|
-
currentTracksMiddleware: import("@fishjam-cloud/react-client").TracksMiddleware | null;
|
|
42
|
-
setTracksMiddleware: (middleware: import("@fishjam-cloud/react-client").TracksMiddleware | null) => Promise<void>;
|
|
43
|
-
};
|
|
2
|
+
import type { InitializeDevicesResult, PeerWithTracks, RemoteTrack, UseCameraResult, UseLivestreamStreamerResult, UseLivestreamViewerResult, UseMicrophoneResult, UseScreenShareResult } from './types';
|
|
3
|
+
export declare function useCamera(): UseCameraResult;
|
|
4
|
+
export declare function useMicrophone(): UseMicrophoneResult;
|
|
5
|
+
export declare function useScreenShare(): UseScreenShareResult;
|
|
44
6
|
export declare function useCustomSource<T extends string>(sourceId: T): {
|
|
45
7
|
stream: RNMediaStream | undefined;
|
|
46
8
|
setStream: (newStream: RNMediaStream | null) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/overrides/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/overrides/hooks.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,oCAAoC,CAAC;AASrH,OAAO,KAAK,EAEV,uBAAuB,EACvB,cAAc,EACd,WAAW,EAGX,eAAe,EACf,2BAA2B,EAC3B,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,SAAS,IAAI,eAAe,CAc3C;AAED,wBAAgB,aAAa,IAAI,mBAAmB,CAcnD;AAED,wBAAgB,cAAc,IAAI,oBAAoB,CAgBrD;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,CAAC;YAIhC,aAAa,GAAG,SAAS;eACnB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC;EAEpF;AAED,wBAAgB,qBAAqB,IAAI,2BAA2B,CAYnE;AAED,wBAAgB,mBAAmB,IAAI,yBAAyB,CAM/D;AAED,wBAAgB,oBAAoB;uBAGO,CACrC,GAAG,IAAI,EAAE,UAAU,wJAAyB,KACzC,OAAO,CAAC,uBAAuB,CAAC;EAExC;AAED,wBAAgB,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B;IAC/C,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IACvC,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC;IACjD,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC;CAC5C,CACF;AAED,wBAAgB,UAAU;;;;EAGzB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,QAEtD;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,QAEpH"}
|
package/dist/overrides/hooks.js
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
import { useCamera as useCameraReactClient, useCustomSource as useCustomSourceReactClient, useInitializeDevices as useInitializeDevicesReactClient, useLivestreamStreamer as useLivestreamStreamerReactClient, useLivestreamViewer as useLivestreamViewerReactClient, useMicrophone as useMicrophoneReactClient, usePeers as usePeersReactClient, useScreenShare as useScreenShareReactClient, } from '@fishjam-cloud/react-client';
|
|
2
|
-
import { useCallKit as useCallKitRNWebRTC, useCallKitEvent as useCallKitEventRNWebRTC, useCallKitService as useCallKitServiceRNWebRTC, } from '@fishjam-cloud/react-native-webrtc';
|
|
2
|
+
import { presentBroadcastPicker, useCallKit as useCallKitRNWebRTC, useCallKitEvent as useCallKitEventRNWebRTC, useCallKitService as useCallKitServiceRNWebRTC, } from '@fishjam-cloud/react-native-webrtc';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
export function useCamera() {
|
|
5
5
|
const result = useCameraReactClient();
|
|
6
|
+
const { setCameraTrackMiddleware: setCameraTrackMiddlewareReact } = result;
|
|
7
|
+
const setCameraTrackMiddleware = useCallback((middleware) => setCameraTrackMiddlewareReact(middleware), [setCameraTrackMiddlewareReact]);
|
|
6
8
|
return {
|
|
7
9
|
...result,
|
|
8
10
|
cameraStream: result.cameraStream,
|
|
11
|
+
startCamera: result.startCamera,
|
|
12
|
+
currentCameraMiddleware: result.currentCameraMiddleware,
|
|
13
|
+
setCameraTrackMiddleware,
|
|
9
14
|
};
|
|
10
15
|
}
|
|
11
16
|
export function useMicrophone() {
|
|
12
17
|
const { toggleMicrophoneMute: _, ...rest } = useMicrophoneReactClient();
|
|
18
|
+
const { setMicrophoneTrackMiddleware: setMicrophoneTrackMiddlewareReact } = rest;
|
|
19
|
+
const setMicrophoneTrackMiddleware = useCallback((middleware) => setMicrophoneTrackMiddlewareReact(middleware), [setMicrophoneTrackMiddlewareReact]);
|
|
13
20
|
return {
|
|
14
21
|
...rest,
|
|
15
22
|
microphoneStream: rest.microphoneStream,
|
|
23
|
+
startMicrophone: rest.startMicrophone,
|
|
24
|
+
currentMicrophoneMiddleware: rest.currentMicrophoneMiddleware,
|
|
25
|
+
setMicrophoneTrackMiddleware,
|
|
16
26
|
};
|
|
17
27
|
}
|
|
18
28
|
export function useScreenShare() {
|
|
19
29
|
const result = useScreenShareReactClient();
|
|
30
|
+
const { setTracksMiddleware: setTracksMiddlewareReact } = result;
|
|
31
|
+
const setTracksMiddleware = useCallback((middleware) => setTracksMiddlewareReact(middleware), [setTracksMiddlewareReact]);
|
|
20
32
|
return {
|
|
21
33
|
...result,
|
|
22
34
|
stream: result.stream,
|
|
35
|
+
videoTrack: result.videoTrack,
|
|
36
|
+
audioTrack: result.audioTrack,
|
|
37
|
+
currentTracksMiddleware: result.currentTracksMiddleware,
|
|
38
|
+
setTracksMiddleware,
|
|
39
|
+
presentBroadcastPicker,
|
|
23
40
|
};
|
|
24
41
|
}
|
|
25
42
|
export function useCustomSource(sourceId) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CustomSource as ReactClientCustomSource, InitializeDevicesResult as ReactClientInitializeDevicesResult, PeerWithTracks as ReactClientPeerWithTracks, RemoteTrack as ReactClientRemoteTrack, Track as ReactClientTrack, useCamera as useCameraReactClient, useCustomSource as useCustomSourceReactClient, useInitializeDevices as useInitializeDevicesReactClient, UseLivestreamStreamerResult as ReactClientUseLivestreamStreamerResult, UseLivestreamViewerResult as ReactClientUseLivestreamViewerResult, useMicrophone as useMicrophoneReactClient, useScreenShare as useScreenShareReactClient } from '@fishjam-cloud/react-client';
|
|
2
|
-
import type { MediaStream as RNMediaStream } from '@fishjam-cloud/react-native-webrtc';
|
|
1
|
+
import type { CustomSource as ReactClientCustomSource, DeviceError, InitializeDevicesResult as ReactClientInitializeDevicesResult, PeerWithTracks as ReactClientPeerWithTracks, RemoteTrack as ReactClientRemoteTrack, Track as ReactClientTrack, useCamera as useCameraReactClient, useCustomSource as useCustomSourceReactClient, useInitializeDevices as useInitializeDevicesReactClient, UseLivestreamStreamerResult as ReactClientUseLivestreamStreamerResult, UseLivestreamViewerResult as ReactClientUseLivestreamViewerResult, useMicrophone as useMicrophoneReactClient, useScreenShare as useScreenShareReactClient } from '@fishjam-cloud/react-client';
|
|
2
|
+
import type { MediaStream as RNMediaStream, MediaStreamTrack as RNMediaStreamTrack } from '@fishjam-cloud/react-native-webrtc';
|
|
3
3
|
export type StreamerInputs = {
|
|
4
4
|
video: RNMediaStream;
|
|
5
5
|
audio?: RNMediaStream | null;
|
|
@@ -17,14 +17,43 @@ export type UseLivestreamStreamerResult = Omit<ReactClientUseLivestreamStreamerR
|
|
|
17
17
|
export type UseLivestreamViewerResult = Omit<ReactClientUseLivestreamViewerResult, 'stream'> & {
|
|
18
18
|
stream: RNMediaStream | null;
|
|
19
19
|
};
|
|
20
|
-
export type
|
|
20
|
+
export type MiddlewareResult = {
|
|
21
|
+
track: RNMediaStreamTrack;
|
|
22
|
+
onClear?: () => void;
|
|
23
|
+
};
|
|
24
|
+
export type TrackMiddleware = ((track: RNMediaStreamTrack) => MiddlewareResult | Promise<MiddlewareResult>) | null;
|
|
25
|
+
export type TracksMiddlewareResult = {
|
|
26
|
+
videoTrack: RNMediaStreamTrack;
|
|
27
|
+
audioTrack: RNMediaStreamTrack | null;
|
|
28
|
+
onClear: () => void;
|
|
29
|
+
};
|
|
30
|
+
export type TracksMiddleware = (videoTrack: RNMediaStreamTrack, audioTrack: RNMediaStreamTrack | null) => TracksMiddlewareResult | Promise<TracksMiddlewareResult>;
|
|
31
|
+
export type UseCameraResult = Omit<ReturnType<typeof useCameraReactClient>, 'cameraStream' | 'startCamera' | 'currentCameraMiddleware' | 'setCameraTrackMiddleware'> & {
|
|
21
32
|
cameraStream: RNMediaStream | null;
|
|
33
|
+
startCamera: (...args: Parameters<ReturnType<typeof useCameraReactClient>['startCamera']>) => Promise<[RNMediaStreamTrack, null] | [null, DeviceError]>;
|
|
34
|
+
currentCameraMiddleware: TrackMiddleware;
|
|
35
|
+
setCameraTrackMiddleware: (middleware: TrackMiddleware) => Promise<void>;
|
|
22
36
|
};
|
|
23
|
-
export type UseMicrophoneResult = Omit<ReturnType<typeof useMicrophoneReactClient>, 'toggleMicrophoneMute' | 'microphoneStream'> & {
|
|
37
|
+
export type UseMicrophoneResult = Omit<ReturnType<typeof useMicrophoneReactClient>, 'toggleMicrophoneMute' | 'microphoneStream' | 'startMicrophone' | 'currentMicrophoneMiddleware' | 'setMicrophoneTrackMiddleware'> & {
|
|
24
38
|
microphoneStream: RNMediaStream | null;
|
|
39
|
+
startMicrophone: (...args: Parameters<ReturnType<typeof useMicrophoneReactClient>['startMicrophone']>) => Promise<[RNMediaStreamTrack, null] | [null, DeviceError]>;
|
|
40
|
+
currentMicrophoneMiddleware: TrackMiddleware;
|
|
41
|
+
setMicrophoneTrackMiddleware: (middleware: TrackMiddleware) => Promise<void>;
|
|
25
42
|
};
|
|
26
|
-
export type UseScreenShareResult = Omit<ReturnType<typeof useScreenShareReactClient>, 'stream'> & {
|
|
43
|
+
export type UseScreenShareResult = Omit<ReturnType<typeof useScreenShareReactClient>, 'stream' | 'videoTrack' | 'audioTrack' | 'currentTracksMiddleware' | 'setTracksMiddleware'> & {
|
|
27
44
|
stream: RNMediaStream | null;
|
|
45
|
+
videoTrack: RNMediaStreamTrack | null;
|
|
46
|
+
audioTrack: RNMediaStreamTrack | null;
|
|
47
|
+
currentTracksMiddleware: TracksMiddleware | null;
|
|
48
|
+
setTracksMiddleware: (middleware: TracksMiddleware | null) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* iOS only. Presents the system `RPSystemBroadcastPickerView`. When a
|
|
51
|
+
* broadcast is active, this opens the system "Stop Broadcast" sheet so
|
|
52
|
+
* the user can end it cleanly (via `broadcastFinished()`) and avoid the
|
|
53
|
+
* "Screen sharing stopped" error dialog that `stopStreaming` triggers
|
|
54
|
+
* by force-closing the host-side socket. No-op on non-iOS.
|
|
55
|
+
*/
|
|
56
|
+
presentBroadcastPicker: () => Promise<void>;
|
|
28
57
|
};
|
|
29
58
|
export type UseCustomSourceResult = Omit<ReturnType<typeof useCustomSourceReactClient>, 'stream' | 'setStream'> & {
|
|
30
59
|
stream: RNMediaStream | undefined;
|
|
@@ -33,11 +62,13 @@ export type UseCustomSourceResult = Omit<ReturnType<typeof useCustomSourceReactC
|
|
|
33
62
|
export type UseInitializeDevicesReturn = {
|
|
34
63
|
initializeDevices: (...args: Parameters<ReturnType<typeof useInitializeDevicesReactClient>['initializeDevices']>) => Promise<InitializeDevicesResult>;
|
|
35
64
|
};
|
|
36
|
-
export type Track = Omit<ReactClientTrack, 'stream'> & {
|
|
65
|
+
export type Track = Omit<ReactClientTrack, 'stream' | 'track'> & {
|
|
37
66
|
stream: RNMediaStream | null;
|
|
67
|
+
track: RNMediaStreamTrack | null;
|
|
38
68
|
};
|
|
39
|
-
export type RemoteTrack = Omit<ReactClientRemoteTrack, 'stream'> & {
|
|
69
|
+
export type RemoteTrack = Omit<ReactClientRemoteTrack, 'stream' | 'track'> & {
|
|
40
70
|
stream: RNMediaStream | null;
|
|
71
|
+
track: RNMediaStreamTrack | null;
|
|
41
72
|
};
|
|
42
73
|
export type CustomSource<T extends string> = Omit<ReactClientCustomSource<T>, 'stream'> & {
|
|
43
74
|
stream?: RNMediaStream;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/overrides/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,uBAAuB,EACvC,uBAAuB,IAAI,kCAAkC,EAC7D,cAAc,IAAI,yBAAyB,EAC3C,WAAW,IAAI,sBAAsB,EACrC,KAAK,IAAI,gBAAgB,EACzB,SAAS,IAAI,oBAAoB,EACjC,eAAe,IAAI,0BAA0B,EAC7C,oBAAoB,IAAI,+BAA+B,EACvD,2BAA2B,IAAI,sCAAsC,EACrE,yBAAyB,IAAI,oCAAoC,EACjE,aAAa,IAAI,wBAAwB,EACzC,cAAc,IAAI,yBAAyB,EAC5C,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/overrides/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,uBAAuB,EACvC,WAAW,EACX,uBAAuB,IAAI,kCAAkC,EAC7D,cAAc,IAAI,yBAAyB,EAC3C,WAAW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param config - Configuration options for the foreground service.
|
|
43
43
|
*/
|
|
44
|
-
export declare const useForegroundService: ({ enableCamera, enableMicrophone, enableScreenSharing, channelId, channelName, notificationContent, notificationTitle, }: import("@fishjam-cloud/react-native-webrtc").ForegroundServiceConfig) => void;
|
|
44
|
+
export declare const useForegroundService: ({ enableCamera, enableMicrophone, enableScreenSharing, channelId, channelName, notificationContent, notificationTitle, importance, onlyAlertOnce, }: import("@fishjam-cloud/react-native-webrtc").ForegroundServiceConfig) => void;
|
|
45
45
|
//# sourceMappingURL=useForegroundService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForegroundService.d.ts","sourceRoot":"","sources":["../src/useForegroundService.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useForegroundService.d.ts","sourceRoot":"","sources":["../src/useForegroundService.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,qOAA+B,CAAC"}
|
package/dist/webrtc-polyfill.js
CHANGED
|
@@ -2,6 +2,7 @@ import 'fast-text-encoding';
|
|
|
2
2
|
import 'react-native-get-random-values';
|
|
3
3
|
import 'react-native-url-polyfill/auto';
|
|
4
4
|
import { EventTarget, registerGlobals } from '@fishjam-cloud/react-native-webrtc';
|
|
5
|
+
import { NativeModules } from 'react-native';
|
|
5
6
|
import { patchGetUserMediaWithPermissionWarnings } from './overrides/getUserMedia';
|
|
6
7
|
import { RTCPeerConnection } from './overrides/RTCPeerConnection';
|
|
7
8
|
import { LocalStoragePolyfill } from './polyfills/local-storage';
|
|
@@ -13,4 +14,34 @@ const registerGlobalsPolyfill = () => {
|
|
|
13
14
|
globalThis.RTCPeerConnection = RTCPeerConnection;
|
|
14
15
|
patchGetUserMediaWithPermissionWarnings();
|
|
15
16
|
};
|
|
17
|
+
const assertReactNativeWebRTCNativeModule = () => {
|
|
18
|
+
if (NativeModules.WebRTCModule)
|
|
19
|
+
return;
|
|
20
|
+
throw new Error('@fishjam-cloud/react-native-client: the native module for `@fishjam-cloud/react-native-webrtc` is not linked. ' +
|
|
21
|
+
'Install the package and rebuild your native app:\n' +
|
|
22
|
+
' 1. yarn add @fishjam-cloud/react-native-webrtc\n' +
|
|
23
|
+
' 2. cd ios && pod install (bare React Native)\n' +
|
|
24
|
+
' or: npx expo prebuild --clean && rebuild your dev client (Expo)');
|
|
25
|
+
};
|
|
26
|
+
const assertGetRandomValuesPolyfill = () => {
|
|
27
|
+
try {
|
|
28
|
+
if (typeof globalThis.crypto?.getRandomValues !== 'function') {
|
|
29
|
+
throw new Error('crypto.getRandomValues is undefined');
|
|
30
|
+
}
|
|
31
|
+
globalThis.crypto.getRandomValues(new Uint8Array(1));
|
|
32
|
+
}
|
|
33
|
+
catch (cause) {
|
|
34
|
+
const causeMessage = cause instanceof Error ? cause.message : String(cause);
|
|
35
|
+
throw new Error('@fishjam-cloud/react-native-client: `react-native-get-random-values` is not installed or its native module is not linked. ' +
|
|
36
|
+
'Install the package and rebuild your native app:\n' +
|
|
37
|
+
' 1. yarn add react-native-get-random-values\n' +
|
|
38
|
+
' 2. cd ios && pod install (bare React Native)\n' +
|
|
39
|
+
' or: npx expo prebuild --clean && rebuild your dev client (Expo)\n' +
|
|
40
|
+
`Underlying error: ${causeMessage}`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
if (__DEV__) {
|
|
44
|
+
assertReactNativeWebRTCNativeModule();
|
|
45
|
+
assertGetRandomValuesPolyfill();
|
|
46
|
+
}
|
|
16
47
|
registerGlobalsPolyfill();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/react-native-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "React Native client library for Fishjam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Fishjam Team",
|
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
28
|
"tsc": "tsc",
|
|
29
|
-
"build": "
|
|
29
|
+
"build:webrtc-workspace": "yarn workspace @fishjam-cloud/react-native-webrtc run prepare",
|
|
30
|
+
"build": "yarn build:webrtc-workspace && tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin",
|
|
30
31
|
"lint": "eslint . --ext .ts,.tsx --fix",
|
|
31
|
-
"prepare": "tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin",
|
|
32
|
-
"format": "prettier --write . --ignore-path ./.eslintignore"
|
|
32
|
+
"prepare": "yarn build:webrtc-workspace && tsc && EXPO_NONINTERACTIVE=1 expo-module build plugin",
|
|
33
|
+
"format": "prettier --write . --ignore-path ./.eslintignore",
|
|
34
|
+
"check:webrtc-published": "node ../../release-automation/check-webrtc-published.mjs"
|
|
33
35
|
},
|
|
34
36
|
"lint-staged": {
|
|
35
37
|
"*": [
|
|
@@ -40,15 +42,15 @@
|
|
|
40
42
|
]
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
43
|
-
"@fishjam-cloud/react-native-webrtc": "0.
|
|
45
|
+
"@fishjam-cloud/react-native-webrtc": "0.28.0",
|
|
44
46
|
"expo": "*",
|
|
45
47
|
"react": "*",
|
|
46
48
|
"react-native": "*",
|
|
47
49
|
"react-native-get-random-values": "1.11.0"
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
|
-
"@fishjam-cloud/react-client": "0.
|
|
51
|
-
"@fishjam-cloud/react-native-webrtc": "0.
|
|
52
|
+
"@fishjam-cloud/react-client": "0.28.1",
|
|
53
|
+
"@fishjam-cloud/react-native-webrtc": "0.28.0",
|
|
52
54
|
"fast-text-encoding": "1.0.6",
|
|
53
55
|
"react-native-get-random-values": "1.11.0",
|
|
54
56
|
"react-native-url-polyfill": "3.0.0"
|
|
@@ -60,5 +62,5 @@
|
|
|
60
62
|
"expo-module-scripts": "^55.0.2",
|
|
61
63
|
"typescript": "^5.8.3"
|
|
62
64
|
},
|
|
63
|
-
"packageManager": "yarn@4.
|
|
65
|
+
"packageManager": "yarn@4.16.0"
|
|
64
66
|
}
|
|
@@ -19,10 +19,13 @@ const withFishjamForegroundService = (config, props) => (0, config_plugins_1.wit
|
|
|
19
19
|
}
|
|
20
20
|
const mainApplication = (0, Manifest_1.getMainApplicationOrThrow)(configuration.modResults);
|
|
21
21
|
mainApplication.service = mainApplication.service || [];
|
|
22
|
+
const foregroundServiceType = props?.android?.enableScreensharing
|
|
23
|
+
? 'camera|microphone|mediaProjection'
|
|
24
|
+
: 'camera|microphone';
|
|
22
25
|
const webRTCForegroundService = {
|
|
23
26
|
$: {
|
|
24
27
|
'android:name': 'com.oney.WebRTCModule.foregroundService.WebRTCForegroundService',
|
|
25
|
-
'android:foregroundServiceType':
|
|
28
|
+
'android:foregroundServiceType': foregroundServiceType,
|
|
26
29
|
'android:stopWithTask': 'true',
|
|
27
30
|
},
|
|
28
31
|
};
|
|
@@ -33,22 +36,6 @@ const withFishjamForegroundService = (config, props) => (0, config_plugins_1.wit
|
|
|
33
36
|
else {
|
|
34
37
|
mainApplication.service.push(webRTCForegroundService);
|
|
35
38
|
}
|
|
36
|
-
if (props?.android?.enableScreensharing) {
|
|
37
|
-
const mediaProjectionService = {
|
|
38
|
-
$: {
|
|
39
|
-
'android:name': 'com.oney.WebRTCModule.MediaProjectionService',
|
|
40
|
-
'android:foregroundServiceType': 'mediaProjection',
|
|
41
|
-
'android:stopWithTask': 'true',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const existingMediaProjectionServiceIndex = mainApplication.service.findIndex((service) => service.$['android:name'] === mediaProjectionService.$['android:name']);
|
|
45
|
-
if (existingMediaProjectionServiceIndex !== -1) {
|
|
46
|
-
mainApplication.service[existingMediaProjectionServiceIndex] = mediaProjectionService;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
mainApplication.service.push(mediaProjectionService);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
39
|
return configuration;
|
|
53
40
|
});
|
|
54
41
|
const withFishjamForegroundServicePermission = (config, props) => (0, config_plugins_1.withAndroidManifest)(config, (configuration) => {
|