From 2444a665c4e6d83a5965de35147ab9a8135fa3bf Mon Sep 17 00:00:00 2001 From: Kamil Stasiak Date: Thu, 4 Apr 2024 19:12:17 +0200 Subject: [PATCH] Update react-client --- assets/package-lock.json | 6 +++--- assets/package.json | 2 +- assets/src/jellyfish.types.ts | 33 +++++++++++++++++---------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/assets/package-lock.json b/assets/package-lock.json index f100bb99..82fe3929 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "@jellyfish-dev/react-client-sdk": "^0.2.1", + "@jellyfish-dev/react-client-sdk": "github:jellyfish-dev/react-client-sdk#ignore-not-webrc-endpoints", "@mediapipe/tasks-vision": "^0.10.12", "axios": "^1.6.7", "chartist": "^1.3.0", @@ -1087,8 +1087,8 @@ }, "node_modules/@jellyfish-dev/react-client-sdk": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@jellyfish-dev/react-client-sdk/-/react-client-sdk-0.2.1.tgz", - "integrity": "sha512-OEnmRi3r3ZNr1XjCk4K3DdbpDPletY7+I7UUu/XWiQnY/3LcfQttfe9koeme8Ksy9M8OXjAVctCal+5R5+b7ag==", + "resolved": "git+ssh://git@github.com/jellyfish-dev/react-client-sdk.git#9c25dd2849b084be78e93d53efca83b82fc82b29", + "license": "Apache-2.0", "dependencies": { "@jellyfish-dev/ts-client-sdk": "^0.3.1", "events": "3.3.0", diff --git a/assets/package.json b/assets/package.json index 47567a4d..01c996f6 100644 --- a/assets/package.json +++ b/assets/package.json @@ -11,7 +11,7 @@ "preview": "vite preview" }, "dependencies": { - "@jellyfish-dev/react-client-sdk": "^0.2.1", + "@jellyfish-dev/react-client-sdk": "github:jellyfish-dev/react-client-sdk#ignore-not-webrc-endpoints", "@mediapipe/tasks-vision": "^0.10.12", "axios": "^1.6.7", "chartist": "^1.3.0", diff --git a/assets/src/jellyfish.types.ts b/assets/src/jellyfish.types.ts index afb88d77..ff0202a1 100644 --- a/assets/src/jellyfish.types.ts +++ b/assets/src/jellyfish.types.ts @@ -63,23 +63,24 @@ export const toLocalTrackSelector = (state: State, })[0] || null; export const toRemotePeerSelector = (state: State): RemotePeer[] => { - return toPairs(state?.remote || {}).filter(([, peer]) => (peer as unknown as { type: string}).type === "webrtc").map(([peerId, peer]) => { - const tracks: ApiTrack[] = toPairs(peer.tracks || {}).map(([trackId, track]) => { + return toPairs(state?.remote || {}) + .map(([peerId, peer]) => { + const tracks: ApiTrack[] = toPairs(peer.tracks || {}).map(([trackId, track]) => { + return { + trackId, + metadata: track.metadata || undefined, + isSpeaking: track.vadStatus === "speech", + encoding: track.encoding || undefined, + mediaStream: track.stream || undefined, + mediaStreamTrack: track.track || undefined + }; + }); + return { - trackId, - metadata: track.metadata || undefined, - isSpeaking: track.vadStatus === "speech", - encoding: track.encoding || undefined, - mediaStream: track.stream || undefined, - mediaStreamTrack: track.track || undefined + id: peerId, + displayName: peer?.metadata?.name || "", + source: "remote", + tracks }; }); - - return { - id: peerId, - displayName: peer?.metadata?.name || "", - source: "remote", - tracks - }; - }); };