Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Update react-client
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-stasiak committed Apr 4, 2024
1 parent 5b0d4ff commit 2444a66
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
33 changes: 17 additions & 16 deletions assets/src/jellyfish.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,24 @@ export const toLocalTrackSelector = (state: State<PeerMetadata, TrackMetadata>,
})[0] || null;

export const toRemotePeerSelector = (state: State<PeerMetadata, TrackMetadata>): 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
};
});
};

0 comments on commit 2444a66

Please sign in to comment.