LiveKit LogoDocs
Real-timeEgress/IngressCloudReference

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

#
childrenReact.ReactNode

The template component to be used in the loop.

#
tracksTrackReference[] | TrackReferenceOrPlaceholder[]

Track references to loop over. You can the use useTracks() hook to get TrackReferences.

On this page

ImportUsageProperties

Previous

Chevron IconToast
LiveKit logo

Product

SFU

SDKs

Performance

Deployment

GitHub Logo