List other peers
In order to see other streaming peers, you can use usePeers
. It will return all
other peers, together with the tracks that they are streaming.
Example code that show all videos
import
React from "react"; import {View } from "react-native"; import {usePeers ,VideoRendererView , } from "@fishjam-cloud/react-native-client"; export functionShowAllPeers () { const {remotePeers ,localPeer } =usePeers (); constvideoTracks =remotePeers .flatMap ( (peer ) =>peer .tracks .filter ((track ) =>track .type === "Video" &&track .isActive ), ); constlocalTrack =localPeer ?.tracks .find ((t ) =>t .type === "Video"); return ( <View > {localTrack && ( <VideoRendererView key ={localTrack .id }trackId ={localTrack .id }videoLayout ="FIT" /> )} {videoTracks .map ((track ) => ( <VideoRendererView key ={track .id }trackId ={track .id }videoLayout ="FIT" /> ))} </View > ); }