LiveKitRoom
The LiveKitRoom
component provides the room context to all its child components. It is generally the starting point of your LiveKit app and the root of the LiveKit component tree. It provides the room state as a React context to all child components, so you don't have to pass it yourself.
Import
import { LiveKitRoom } from "@livekit/components-react";
Usage
<LiveKitRoom token="<livekit-token>" serverUrl="<url-to-livekit-server>" connect={true}>...</LiveKitRoom>
Properties
string | undefined
URL to the LiveKit server. For example: wss://<domain>.livekit.cloud
To simplify the implementation, undefined
is also accepted as an intermediate value, but only with a valid string url can the connection be established.
string | undefined
A user specific access token for a client to authenticate to the room. This token is necessary to establish a connection to the room. To simplify the implementation, undefined
is also accepted as an intermediate value, but only with a valid string token can the connection be established.
AudioCaptureOptions | boolean
(Optional) Publish audio immediately after connecting to your LiveKit room.
boolean
(Optional) If set to true a connection to LiveKit room is initiated.
RoomConnectOptions
(Optional) Define options how to connect to the LiveKit server.
() => void
(Optional)
(reason?: DisconnectReason) => void
(Optional)
(error: Error) => void
(Optional)
(error: Error) => void
(Optional)
(failure?: MediaDeviceFailure) => void
(Optional)
RoomOptions
(Optional) Options for when creating a new room. When you pass your own room instance to this component, these options have no effect. Instead, set the options directly in the room instance.
Room
(Optional) Optional room instance. By passing your own room instance you overwrite the options
parameter, make sure to set the options directly on the room instance itself.
ScreenShareCaptureOptions | boolean
(Optional) Publish screen share immediately after connecting to your LiveKit room.
number | undefined
(Optional)
VideoCaptureOptions | boolean
(Optional) Publish video immediately after connecting to your LiveKit room.