TrackLoop
The TrackLoop component loops over tracks. It is for example a easy way to loop over all participant camera and screen share tracks. TrackLoop creates a TrackContext for each track that you can use to e.g. render the track.
Import
import { TrackLoop } from '@livekit/components-react';
Usage
const tracks = useTracks([Track.Source.Camera]);<TrackLoop tracks={tracks} ><TrackContext.Consumer>{(track) => track && <VideoTrack {...track}/>}</TrackContext.Consumer><TrackLoop />
Properties
The template component to be used in the loop.
Track references to loop over. You can the use useTracks()
hook to get TrackReferences.