This indicates the participant ID of the user who is currently speaking. If no participant is actively speaking, the value is null.
The signalling base URL the room is connected through.
null on React Native, where the native SDKs own the transport.
This represents the current state of the HLS stream.
This represents the URLs associated with the ongoing HLS stream.
This represents whether the local participant’s webcam is enabled.
true while a livestream is running for the room.
The coarse form of liveStreamState; use that when you need the starting and stopping phases.
This represents whether the local participant’s microphone is enabled.
This represents whether the room is currently being recorded.
true once this participant has joined the room and the SDK is ready for room actions.
Gate anything that must not run before join on this rather than on roomId being set.
This represents whether the local participant’s screen share is enabled.
This represents the current state of the livestream.
This represents the local Participant (you) who joined the room.
Every data-channel message received so far, in arrival order.
Appended to on each onDataReceived, so a component that mounts late still sees the backlog. Cleared when the room is left.
This represents a map of all remote participants currently in the room.
This map does not include the local participant.
This represents a map of all participants currently pinned in the room.
cam) and/or screen share (share) is pinned.This indicates the participant ID of the user who is currently sharing their screen in the room. If no one is presenting, the value is null.
This represents the current state of the room recording.
This represents the underlying Room instance.
This represents the unique ID of the room that the participant has joined.
The camera the room is capturing from, as { deviceId }, or null when the SDK chose it or a custom track is in use.
The microphone the room is capturing from, as { deviceId }, or null when the SDK chose it or a custom track is in use.
This represents the current state of real-time transcription.
useTranslation's onTranslationStateChanged.Optionalobject: string | MediaStream
Either:
deviceId of the webcam to switch to, orMediaStream to be used as the video source.Omit it to move to the camera after the current one in
useMediaDevice's getCameras() list, wrapping around.
Optionalobject: string | MediaStream
Either:
deviceId string of the microphone to switch to, orMediaStream to be used as the audio input source.Omit it to move to the microphone after the current one in
useMediaDevice's getMics() list, wrapping around.
Events associated with changeMode():
Events associated with disableCam():
Events associated with disableScreenShare():
null as the presenter.Events associated with enableCam():
OptionalcustomVideoTrack: MediaStream
An optional custom video track to be used instead of the default one.
To learn more, checkout this reference
Events associated with enableScreenShare():
presenterId.OptionalcustomScreenShareTrack: MediaStream
An optional custom screen share track to be used instead of the default one.
To learn more checkout this reference
end() removes all participants, including the local participant, and permanently terminates the room.Events associated with end():
The participant presenting now, or null.
The participant speaking now, or null.
<RoomProvider>, if joinWithoutUserInteraction is set to true, participant will automatically join the room. If it is false explicity call for join() should be made.Events associated with join():
Events associated with leave():
Events associated with muteMic():
Optionalkind: "audio" | "video" | "share" | "all"
Specifies which type of media stream should be paused. If not provided, all media streams (audio, video, and screen share) will be paused.
Uninstalls the applied frame processor; idempotent.
The room ID to relay media to.
Optionalkinds?: ("audio" | "video" | "share")[]Optional array of media kinds to relay. Relays every kind when omitted; an empty array relays none.
Optionaltoken?: stringOptional token for the destination room.
ask_join enabled.The participantId of the participant whose entry request is being responded to.
"allow" to admit the participant, "deny" to reject.
Optionalkind: "audio" | "video" | "share" | "all"
Specifies which type of media stream should be resumed.If not provided, all media streams (audio, video, and screen share) will be resumed.
Optionalreliable: boolean
Retransmit until delivered, preserving order, at the cost of some latency.
false is faster but a frame may be dropped on a poor network. Defaults
to true.
Applies the native frame processor registered under processor.
A JS function cannot process frames: the processor is native code the host
app registers by name (Kotlin VideoProcessorRegistry.register, Swift
VideoProcessorRegistry.shared.register), and this selects it.
Optionalconfig: HLSConfig
Configuration used to control the HLS stream.
How an HLS stream looks, for useRoom's startHLS. A field left out takes the server's default.
Optionallayout?: ConfigLayoutOptionalmode?: "audio" | "video-and-audio"Whether video is streamed or audio only.
Optionalorientation?: "landscape" | "portrait"The output orientation.
Optionalquality?: "low" | "med" | "high"The output quality.
Optionalrecording?: { enabled: boolean }Whether the HLS stream is also recorded.
Optionaltheme?: "DEFAULT" | "DARK" | "LIGHT"The background theme.
Optionaltranscription: {Configuration for post-room transcription and summary generation.
Enables or disables transcription.
OptionalmodelId?: stringTranscription model to use; the server default when left out.
Optionalsummary?: { enabled: boolean; prompt?: string }Enables or disables summary generation.
Optionalprompt?: stringCustom prompt used for generating the summary.
const config = {
layout: {
type: "SPOTLIGHT",
priority: "PIN",
gridSize: 9,
},
theme: "DEFAULT",
recording = {
enabled: true,
};
};
const transcription = {
enabled: true,
summary: {
enabled: true,
},
};
const { startHLS } = useRoom();
async function beginHls() {
try {
await startHLS(config, transcription);
} catch (err) {
console.log("startHLS failed", err);
}
}
An array of RTMP output destinations where the livestream will be broadcast.
Optionalconfig: LivestreamConfig
Configuration options for the RTMP livestream.
How an RTMP livestream looks, for useRoom's startLivestream. A field left out takes the server's default.
Optionallayout?: ConfigLayoutOptionalrecording?: { enabled: boolean }Whether the livestream is also recorded.
Optionaltheme?: "DEFAULT" | "DARK" | "LIGHT"The background theme.
const outputs = [
{
url: "rtmp://a.rtmp.youtube.com/live2",
streamKey: "<STREAM_KEY>",
},
{
url: "rtmps://",
streamKey: "<STREAM_KEY>",
},
];
const config = {
layout: {
type: "SPOTLIGHT",
priority: "PIN",
gridSize: 9,
},
theme: "DEFAULT",
recording: {
enabled: true,
},
};
const { startLivestream } = useRoom();
async function beginLivestream() {
try {
await startLivestream(outputs, config, transcription);
} catch (err) {
console.log("startLivestream failed", err);
}
}
This method can be used to start recording the room.
All participants, including the local participant, will receive the RECORDING_STARTING event state in the onRecordingStateChanged event.
OptionalwebhookUrl: string
Webhook URL triggered when the recording state changes.
OptionalawsDirPath: string
Path to the directory in your S3 bucket where recordings are stored.
Optionalconfig: RecordingConfig
Recording configuration options.
How a cloud recording looks, for useRoom's startRecording. A field left out takes the server's default.
Optionallayout?: ConfigLayoutOptionalmode?: "audio" | "video-and-audio"Whether video is recorded or audio only.
Optionalorientation?: "landscape" | "portrait"The output orientation.
Optionalquality?: "low" | "med" | "high"The output quality.
Optionaltheme?: "DEFAULT" | "DARK" | "LIGHT"The background theme.
Optionaltranscription: {Configuration for post-recording transcription and summary generation.
Enables or disables transcription.
Optionallanguage?: stringOptionalmodelId?: stringTranscription model to use; the server default when left out.
Optionalsummary?: { enabled: boolean; prompt?: string }Enables or disables summary generation.
Optionalprompt?: stringCustom prompt used for generating transcription summaries.
const webhookUrl = "https://webhook.your-api-server.com";
const awsDirPath = "/room-recordings/";
const config = {
layout: {
type: "SPOTLIGHT",
priority: "PIN",
gridSize: 9,
},
theme: "DEFAULT",
};
const transcription = {
enabled: true,
summary: {
enabled: true,
},
};
const { startRecording } = useRoom();
async function beginRecording() {
try {
await startRecording(webhookUrl, awsDirPath, config, transcription);
} catch (err) {
console.log("startRecording failed", err);
}
}
The room ID to stop media relay to.
This method can be used to stop the ongoing room recording.
All participants, including the local participant, will receive the RECORDING_STOPPING event state in the onRecordingStateChanged event.
Optionaltoken: stringEvents associated with toggleCam():
OptionalcustomVideoTrack: MediaStream
An optional custom video track to be used instead of the default one.
To learn more, checkout this reference
This method can be used to toggle the local participant’s microphone
Events associated with toggleMic():
OptionalcustomAudioTrack: MediaStream
An optional custom audio track to be used instead of the default one.
To learn more, checkout this reference.
Events associated with toggleScreenShare():
OptionalcustomScreenShareTrack: MediaStream
An optional custom screen share track to be used instead of the default one.
To learn more checkout this reference.
Events associated with unmuteMic():
OptionalcustomAudioTrack: MediaStream
An optional custom audio track to be used instead of the default one.
To learn more, checkout this reference
Not emitted on React Native. The native modules have no event behind it, so a handler passed here never runs. Present for parity with the JS SDK.
Optionaldevicelabel?: stringLabel of the audio input device associated with the event, when available.
Indicates whether silence has just been "detected" on the audio input, or previously detected silence has been "resolved".
Time (in milliseconds since epoch) when the event occurred.
OptionalcausedBy?: ParticipantThe Participant instance of the participant whose joining triggered the codec change.
The new codec that the room switched to after the change.
The media type for which the codec changed.
The codec that was in use before the change.
The codec that the newly joined participant did not support, which triggered the switch.
Whether the frame was sent on the reliable channel.
Timestamp (in milliseconds since epoch) when the message was sent.
function onDataReceived({ senderId, text, data, isBinary, timestamp }){
if (isBinary) {
console.log(`Binary data from ${senderId}:`, data);
} else {
console.log(`Text message from ${senderId}: ${text}`);
}
console.log(`Received at: ${new Date(timestamp).toLocaleTimeString()}`);
};
const {
roomId
...
} = useRoom({
onDataReceived,
...
});
ask_join permission.allow_join permission.Call this function to allow the participant to join the room.
Call this function to deny the participant’s request.
Display name of the participant requesting to join.
Unique ID of the participant requesting to join the room.
function onEntryRequested(data) {
const { participantId, name, allow, deny } = data;
console.log(`${name} requested to join the room.`);
// If you want to allow the entry request
allow();
// if you want to deny the entry request
deny();
}
const {
roomId
...
} = useRoom({
onEntryRequested,
...
});
join() request is responded to with an allow or deny decision.This event is emitted to:
allow_join permission.ID of the participant who requested to join the room.
The final decision for the join request.
Possible values:
"allowed" – The participant was allowed to join."denied" – The participant was denied entry.Numeric error code representing the type of error.
Human-readable description of the error.
Live HLS without playback support
Live HLS with playback support
Possible values:
HLS_STARTING - Hls is in starting phase and hasn't started yet.HLS_STARTED- Hls has started successfully will return playbackHlsUrl and livestreamUrl.HLS_PLAYABLE - Hls has started and the playbackHlsUrl and livestreamUrl is now playable.HLS_STOPPING - Hls is in stopping phase and hasn't stopped yet.HLS_STOPPED- Hls has stopped successfully.import { Constants, useRoom } from "@videosdk.live/react-native-sdk";
function onHlsStateChanged(data) {
const { state } = data;
if (state === Constants.hlsEvents.HLS_STARTING) {
console.log("Room Hls is starting");
} else if (state === Constants.hlsEvents.HLS_STARTED) {
console.log("Room Hls is started");
} else if (state === Constants.hlsEvents.HLS_PLAYABLE) {
// on hlsStateChanged started you will receive playbaclHlsUrl and livestreamUrl.
const { playbackHlsUrl } = data.hlsUrl;
console.log("Room Hls is playable");
} else if (state === Constants.hlsEvents.HLS_STOPPING) {
console.log("Room Hls is stopping");
} else if (state === Constants.hlsEvents.HLS_STOPPED) {
console.log("Room Hls is stopped");
} else {
//
}
}
const {
roomId
...
} = useRoom({
onHlsStateChanged,
...
});
Triggered when the server confirms the livestream is running.
Prefer onLivestreamStateChanged for the full lifecycle.
Possible values:
LIVESTREAM_STARTING - Livestream is in starting phase and hasn't started yet.LIVESTREAM_STARTED - Livestream has started successfully.LIVESTREAM_STOPPING - Livestream is in stopping phase and hasn't stopped yet.LIVESTREAM_STOPPED - Livestream has stopped successfully.import { Constants, useRoom } from "@videosdk.live/react-native-sdk";
function onLivestreamStateChanged(data) {
const { state } = data;
if (state === Constants.livestreamEvents.LIVESTREAM_STARTING) {
console.log("Room livestream is starting");
} else if (state === Constants.livestreamEvents.LIVESTREAM_STARTED) {
console.log("Room livestream is started");
} else if (state === Constants.livestreamEvents.LIVESTREAM_STOPPING) {
console.log("Room livestream is stopping");
} else if (state === Constants.livestreamEvents.LIVESTREAM_STOPPED) {
console.log("Room livestream is stopped");
} else {
//
}
}
const {
roomId
...
} = useRoom({
onLivestreamStateChanged,
});
Triggered when the server confirms the livestream has stopped.
Prefer onLivestreamStateChanged for the full lifecycle.
Description of the error.
ID of the room where the error occurred.
Call this function to accept the media relay request.
Display name of the participant requesting the media relay.
ID of the participant who initiated the media relay request.
Call this function to reject the media relay request.
ID of the room from which the media relay request originated.
ID of the participant who decided the decision.
Decision taken for the request.
ID of the participant who responded to the media relay request.
ID of the room where the media relay has started.
Reason why the media relay stopped.
ID of the room where the media relay stopped.
B when any other participant A requests to enable mic of participant B.B will be enabled.Call this function to accept the request and enable your microphone.
ID of the participant who requested to enable your microphone.
Call this function to reject the request.
The Participant instance representing the newly joined participant.
reason object is provided that describes why the participant left.Possible reason codes:
| Reason | Code | Description |
|---|---|---|
| WEBSOCKET_DISCONNECTED | 1001 | Socket disconnected |
| REMOVE_PEER | 1002 | Participant was removed from the room |
| REMOVE_PEER_VIEWER_MODE_CHANGED | 1003 | Participant removed because viewer mode was changed |
| REMOVE_PEER_MEDIA_RELAY_STOP | 1004 | Participant removed because media relay was stopped |
| SWITCH_ROOM | 1005 | Participant switched to a different room |
| ROOM_CLOSE | 1006 | The room has been closed |
| UNKNOWN | 1007 | Participant disconnected due to an unknown reason |
| REMOVE_ALL | 1008 | Remove All from the room |
| MEETING_END_API | 1009 | Room Ended. |
| REMOVE_PEER_API | 1010 | Participant removed from the room |
| DUPLICATE_PARTICIPANT | 1011 | Leaving room, since this participantId joined from another device. |
| MANUAL_LEAVE_CALLED | 1101 | Participant manually called the leave() method to exit the room |
| WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED | 1102 | Room left after multiple failed websocket connection attempts. |
| JOIN_ROOM_FAILED | 1103 | Room left due to an error while joining the room. |
| SWITCH_ROOM_FAILED | 1104 | Room left due to an error while switching rooms. |
The Participant instance who left the room.
An object describing the reason and corresponding code.
The new mode of the participant. Possible values are defined in Mode.
ID of the participant whose mode has changed.
Indicates which media type was paused:
"audio" – Audio streams"video" – Video streams"share" – Screen-share video streamsID of the participant whose pin state changed.
ID of the participant who performed the pin or unpin action.
Current pin state (true if pinned, false if unpinned).
null.ID of the participant currently presenting, or null if no one is presenting.
This callback is triggered when a quality limitation is detected or resolved during the room.
Triggered when a quality limitation is detected or resolved during the room.
Indicates whether the limitation is currently active or resolved.
Time (in milliseconds since epoch) when the event occurred.
Specifies the type of limitation.
Triggered when the server confirms cloud recording is running.
Prefer onRecordingStateChanged, which reports the starting and stopping phases as well; this fires only on the confirmed transition.
The current recording state:
RECORDING_STARTING - Recording is in starting phase and hasn't started yet.RECORDING_STARTED - Recording has started successfully.RECORDING_STOPPING - Recording is in stopping phase and hasn't stopped yet.RECORDING_STOPPED - Recording has stopped successfully.import { Constants, useRoom } from "@videosdk.live/react-native-sdk";
function onRecordingStateChanged(data) {
const { state } = data;
if (state === Constants.recordingEvents.RECORDING_STARTING) {
console.log("Room recording is starting");
} else if (state === Constants.recordingEvents.RECORDING_STARTED) {
console.log("Room recording is started");
} else if (state === Constants.recordingEvents.RECORDING_STOPPING) {
console.log("Room recording is stopping");
} else if (state === Constants.recordingEvents.RECORDING_STOPPED) {
console.log("Room recording is stopped");
} else {
//
}
}
const {
roomId
...
} = useRoom({
onRecordingStateChanged,
...
});
Triggered when the server confirms cloud recording has stopped.
Prefer onRecordingStateChanged for the full lifecycle.
Indicates which media type was resumed:
"audio" – Audio streams"video" – Video streams"share" – Screen-share video streamsreason object is also provided that explains why the participant left the room.The table below lists the possible reason codes:
| Reason | Code | Description |
|---|---|---|
| WEBSOCKET_DISCONNECTED | 1001 | Socket disconnected |
| REMOVE_PEER | 1002 | Participant was removed from the room |
| REMOVE_PEER_VIEWER_MODE_CHANGED | 1003 | Participant removed due to viewer mode change |
| REMOVE_PEER_MEDIA_RELAY_STOP | 1004 | Participant removed because media relay was stopped |
| SWITCH_ROOM | 1005 | Participant switched to another room |
| ROOM_CLOSE | 1006 | The room was closed |
| UNKNOWN | 1007 | Participant disconnected due to an unknown reason |
| REMOVE_ALL | 1008 | All participants were removed |
| MEETING_END_API | 1009 | Room ended programmatically |
| REMOVE_PEER_API | 1010 | Participant removed via API |
| DUPLICATE_PARTICIPANT | 1011 | Participant joined from another device |
| MANUAL_LEAVE_CALLED | 1101 | Participant manually left the room |
| WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED | 1102 | WebSocket connection retries exhausted |
| JOIN_ROOM_FAILED | 1103 | Failed to join the room |
| SWITCH_ROOM_FAILED | 1104 | Failed to switch rooms |
Object containing the reason and corresponding code.
The current room state. Possible values:
CONNECTINGCONNECTEDRECONNECTINGDISCONNECTEDFAILEDfunction onRoomStateChanged(data) {
const { roomState } = data;
switch(roomState){
case 'CONNECTING':
console.log("Room is Connecting");
break;
case 'CONNECTED':
console.log("Room is Connected");
break;
case 'DISCONNECTED':
console.log("Room connection disconnected abruptly");
break;
case 'RECONNECTING':
console.log("Room is Reconnecting");
break;
case 'FAILED':
console.log("Room is in Failed State");
break;
default:
console.log("Unknown state:", roomState);
break;
}
}
const {
roomId
...
} = useRoom({
onRoomStateChanged,
...
});
null is returned.ID of the currently active speaker, or null if no one is speaking.
B when any other participant A requests to enable webcam of participant B.B will be enabled.Call this function to accept the request and enable your webcam.
ID of the participant who requested to enable your webcam.
Call this function to reject the request.
useRoomprovides reactive access to the room instance, participants, media state, events, and controls to manage the full room lifecycle.