@fishjam-cloud/react-client 0.18.0 → 0.19.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/dist/FishjamProvider.js +2 -2
- package/dist/devices/constraints.d.ts +0 -1
- package/dist/devices/constraints.d.ts.map +1 -1
- package/dist/devices/constraints.js +0 -3
- package/dist/hooks/internal/devices/useMediaDevices.js +2 -2
- package/dist/hooks/useLivestream.d.ts +2 -0
- package/dist/hooks/useLivestream.d.ts.map +1 -1
- package/dist/hooks/useLivestream.js +15 -5
- package/dist/hooks/useVAD.d.ts +1 -0
- package/dist/hooks/useVAD.d.ts.map +1 -1
- package/dist/hooks/useVAD.js +1 -0
- package/package.json +3 -3
package/dist/FishjamProvider.js
CHANGED
|
@@ -9,7 +9,7 @@ import { InitDevicesContext } from "./contexts/initDevices";
|
|
|
9
9
|
import { MicrophoneContext } from "./contexts/microphone";
|
|
10
10
|
import { PeerStatusContext } from "./contexts/peerStatus";
|
|
11
11
|
import { ScreenshareContext } from "./contexts/screenshare";
|
|
12
|
-
import {
|
|
12
|
+
import { VIDEO_TRACK_CONSTRAINTS } from "./devices/constraints";
|
|
13
13
|
import { useMediaDevices } from "./hooks/internal/devices/useMediaDevices";
|
|
14
14
|
import { useCustomSourceManager } from "./hooks/internal/useCustomSourceManager";
|
|
15
15
|
import { useFishjamClientState } from "./hooks/internal/useFishjamClientState";
|
|
@@ -33,7 +33,7 @@ export function FishjamProvider(props) {
|
|
|
33
33
|
}, [props.persistLastDevice]);
|
|
34
34
|
const { cameraManager, microphoneManager, initializeDevices } = useMediaDevices({
|
|
35
35
|
videoConstraints: props.constraints?.video ?? VIDEO_TRACK_CONSTRAINTS,
|
|
36
|
-
audioConstraints: props.constraints?.audio ??
|
|
36
|
+
audioConstraints: props.constraints?.audio ?? true,
|
|
37
37
|
persistHandlers,
|
|
38
38
|
});
|
|
39
39
|
const peerStatus = usePeerStatus(fishjamClientRef.current);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const AUDIO_TRACK_CONSTRAINTS: MediaTrackConstraints;
|
|
2
1
|
export declare const VIDEO_TRACK_CONSTRAINTS: MediaTrackConstraints;
|
|
3
2
|
export declare const SCREEN_SHARING_MEDIA_CONSTRAINTS: MediaStreamConstraints;
|
|
4
3
|
export declare const prepareMediaTrackConstraints: (deviceId: string | undefined, constraints: MediaTrackConstraints | undefined | boolean) => MediaTrackConstraints | boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../src/devices/constraints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../src/devices/constraints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,EAAE,qBAerC,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,sBAM9C,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,GAAG,SAAS,EAC5B,aAAa,qBAAqB,GAAG,SAAS,GAAG,OAAO,KACvD,qBAAqB,GAAG,OAM1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,MAAM,GAAG,SAAS,EACnC,aAAa,qBAAqB,GAAG,SAAS,GAAG,OAAO,KACvD,qBAAqB,GAAG,SAAS,GAAG,OAUtC,CAAC"}
|
|
@@ -39,8 +39,8 @@ export const useMediaDevices = ({ videoConstraints, audioConstraints, persistHan
|
|
|
39
39
|
media = await correctDevicesOnSafari(media.stream, media.errors, fetchedDevices, constraints, lastUsed);
|
|
40
40
|
}
|
|
41
41
|
const { stream, errors } = media;
|
|
42
|
-
const videoDeviceId = stream?.getVideoTracks()[0]
|
|
43
|
-
const audioDeviceId = stream?.getAudioTracks()[0]
|
|
42
|
+
const videoDeviceId = stream?.getVideoTracks()[0]?.getSettings().deviceId;
|
|
43
|
+
const audioDeviceId = stream?.getAudioTracks()[0]?.getSettings().deviceId;
|
|
44
44
|
const videoDevice = fetchedDevices.find((device) => device.deviceId === videoDeviceId);
|
|
45
45
|
const audioDevice = fetchedDevices.find((device) => device.deviceId === audioDeviceId);
|
|
46
46
|
if (videoDevice) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { LivestreamError } from "@fishjam-cloud/ts-client";
|
|
1
2
|
export interface UseLivestreamResult {
|
|
2
3
|
stream: MediaStream | null;
|
|
3
4
|
connect: (url: string, token: string) => Promise<void>;
|
|
4
5
|
disconnect: () => void;
|
|
6
|
+
error: LivestreamError | null;
|
|
5
7
|
}
|
|
6
8
|
export declare const useLivestream: () => UseLivestreamResult;
|
|
7
9
|
//# sourceMappingURL=useLivestream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLivestream.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLivestream.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivestream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmD,MAAM,0BAA0B,CAAC;AAG5G,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B;AAKD,eAAO,MAAM,aAAa,QAAO,mBAyBhC,CAAC"}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { receiveLivestream } from "@fishjam-cloud/ts-client";
|
|
1
|
+
import { LivestreamError, receiveLivestream } from "@fishjam-cloud/ts-client";
|
|
2
2
|
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
const isLivestreamError = (err) => Object.values(LivestreamError).includes(err);
|
|
3
4
|
export const useLivestream = () => {
|
|
4
5
|
const [stream, setStream] = useState(null);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
5
7
|
const resultRef = useRef(null);
|
|
6
8
|
const connect = useCallback(async (url, token) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
try {
|
|
10
|
+
const result = await receiveLivestream(url, token);
|
|
11
|
+
resultRef.current = result;
|
|
12
|
+
setError(null);
|
|
13
|
+
setStream(result.stream);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (isLivestreamError(e)) {
|
|
17
|
+
setError(e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
}, []);
|
|
11
21
|
const disconnect = useCallback(() => {
|
|
12
22
|
setStream(null);
|
|
13
23
|
resultRef.current?.stop();
|
|
14
24
|
resultRef.current = null;
|
|
15
25
|
}, []);
|
|
16
|
-
return { stream, connect, disconnect };
|
|
26
|
+
return { stream, connect, disconnect, error };
|
|
17
27
|
};
|
package/dist/hooks/useVAD.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { PeerId } from "../types/public";
|
|
|
4
4
|
*
|
|
5
5
|
* Example usage:
|
|
6
6
|
* ```tsx
|
|
7
|
+
* import { useVAD, type PeerId } from "@fishjam-cloud/react-client";
|
|
7
8
|
* function WhoIsTalkingComponent({ peerIds }: { peerIds: PeerId[] }) {
|
|
8
9
|
* const peersInfo = useVAD({peerIds});
|
|
9
10
|
* const activePeers = (Object.keys(peersInfo) as PeerId[]).filter((peerId) => peersInfo[peerId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVAD.d.ts","sourceRoot":"","sources":["../../src/hooks/useVAD.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"useVAD.d.ts","sourceRoot":"","sources":["../../src/hooks/useVAD.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAW,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,GAAI,aAAa;IAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAgE9F,CAAC"}
|
package/dist/hooks/useVAD.js
CHANGED
|
@@ -5,6 +5,7 @@ import { FishjamClientStateContext } from "../contexts/fishjamState";
|
|
|
5
5
|
*
|
|
6
6
|
* Example usage:
|
|
7
7
|
* ```tsx
|
|
8
|
+
* import { useVAD, type PeerId } from "@fishjam-cloud/react-client";
|
|
8
9
|
* function WhoIsTalkingComponent({ peerIds }: { peerIds: PeerId[] }) {
|
|
9
10
|
* const peersInfo = useVAD({peerIds});
|
|
10
11
|
* const activePeers = (Object.keys(peersInfo) as PeerId[]).filter((peerId) => peersInfo[peerId]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/react-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "React client library for Fishjam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Fishjam Team",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"vitest": "^3.1.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@fishjam-cloud/ts-client": "0.
|
|
63
|
+
"@fishjam-cloud/ts-client": "0.19.0",
|
|
64
64
|
"events": "3.3.0",
|
|
65
65
|
"lodash.isequal": "4.5.0"
|
|
66
66
|
},
|
|
67
67
|
"directories": {
|
|
68
68
|
"example": "examples"
|
|
69
69
|
},
|
|
70
|
-
"packageManager": "yarn@4.
|
|
70
|
+
"packageManager": "yarn@4.9.2+sha256.ca4310f8ba997b4643a000ce512d9772e01c1485df35511114b325315960acb7"
|
|
71
71
|
}
|