Constants - React Native
Constants holds the values that the SDK's methods take and its callbacks report. Import it from @videosdk.live/react-native-sdk.
import { Constants } from "@videosdk.live/react-native-sdk";
function onRoomStateChanged({ roomState }) {
if (roomState === Constants.RoomState.RECONNECTING) {
console.log("Reconnecting to the room");
}
}
In TypeScript, most values in Constants are typed as plain strings and numbers. Where a parameter accepts only certain strings, such as the mode of changeMode() or the level of setLogLevel(), pass the string itself, for example changeMode("RECV_ONLY").
VideoSDKError
The error codes the SDK reports, such as Constants.VideoSDKError.INVALID_TOKEN (4002). onError() reports one as code, and its key as name. See Error Codes for every code.
RoomState
The states onRoomStateChanged() reports. room.roomState holds the last one reported.
| Name | Value | Description |
|---|---|---|
CONNECTING | "CONNECTING" | A join is in progress. Not reported again while reconnecting. |
CONNECTED | "CONNECTED" | The join completed. Reported again when the connection recovers without a rejoin. |
RECONNECTING | "RECONNECTING" | The connection dropped and the SDK is retrying. Room actions fail with ERROR_ROOM_RECONNECTING until it recovers. |
DISCONNECTED | "DISCONNECTED" | The session is over. Reported once, right before onRoomLeft(). |
FAILED | "FAILED" | The connection failed and will not be retried. |
Mode
The participant modes, used by the mode of RoomProvider and by changeMode().
| Name | Value |
|---|---|
SEND_AND_RECV | "SEND_AND_RECV" |
RECV_ONLY | "RECV_ONLY" |
SIGNALLING_ONLY | "SIGNALLING_ONLY" |
permission
The permissions checkPermission() and requestPermission() take.
| Name | Value |
|---|---|
AUDIO | "audio" |
VIDEO | "video" |
AUDIO_AND_VIDEO | "audio_video" |
leaveReason
The code that onRoomLeft() and onParticipantLeft() report.
| Name | Value |
|---|---|
WEBSOCKET_DISCONNECTED | 1001 |
REMOVE_PEER | 1002 |
REMOVE_PEER_VIEWER_MODE_CHANGED | 1003 |
REMOVE_PEER_MEDIA_RELAY_STOP | 1004 |
SWITCH_ROOM | 1005 |
ROOM_CLOSE | 1006 |
UNKNOWN | 1007 |
REMOVE_ALL | 1008 |
MEETING_END_API | 1009 |
REMOVE_PEER_API | 1010 |
DUPLICATE_PARTICIPANT | 1011 |
MANUAL_LEAVE_CALLED | 1101 |
WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED | 1102 |
JOIN_ROOM_FAILED | 1103 |
SWITCH_ROOM_FAILED | 1104 |
recordingEvents
The states onRecordingStateChanged() reports: RECORDING_STARTING, RECORDING_STARTED, RECORDING_STOPPING and RECORDING_STOPPED. Each value is the same as its name.
livestreamEvents
The states onLivestreamStateChanged() reports: LIVESTREAM_STARTING, LIVESTREAM_STARTED, LIVESTREAM_STOPPING and LIVESTREAM_STOPPED. Each value is the same as its name.
hlsEvents
The states onHlsStateChanged() reports: HLS_STARTING, HLS_STARTED, HLS_PLAYABLE, HLS_STOPPING and HLS_STOPPED. Each value is the same as its name.
transcriptionEvents
The states onTranscriptionStateChanged() reports: TRANSCRIPTION_STARTING, TRANSCRIPTION_STARTED, TRANSCRIPTION_STOPPING and TRANSCRIPTION_STOPPED. Each value is the same as its name.
translationEvents
The states onTranslationStateChanged() reports: TRANSLATION_STARTING, TRANSLATION_STARTED, TRANSLATION_STOPPING and TRANSLATION_STOPPED. Each value is the same as its name.
BitrateMode
The bitrateMode of createCameraVideoTrack().
| Name | Value | Description |
|---|---|---|
HIGH_QUALITY | "HIGH_QUALITY" | Puts video quality ahead of bandwidth. |
BALANCED | "BALANCED" | Balances video quality and bandwidth. |
BANDWIDTH_OPTIMIZED | "BANDWIDTH_OPTIMIZED" | Uses as little bandwidth as it can. |
VideoCodec
The codec of createCameraVideoTrack().
| Name | Value |
|---|---|
VP8 | "VP8" |
VP9 | "VP9" |
AV1 | "AV1" |
H264 | "H264" |
LogLevel
The levels of setLogLevel() and getLogLevel(): NONE, ERROR, WARN, INFO, DEBUG and ALL. Each value is the same as its name.
RealtimeOverflow
The realtimeOverflow option of usePubSub().
| Name | Value |
|---|---|
QUEUE | "queue" |
DROP | "drop" |
AgentState
The states of an AI agent, reported by useAgentParticipant().
| Name | Value |
|---|---|
IDLE | "IDLE" |
LISTENING | "LISTENING" |
THINKING | "THINKING" |
SPEAKING | "SPEAKING" |
FacingMode
The facingMode of createCameraVideoTrack() and the defaultCamera of RoomProvider.
| Name | Value |
|---|---|
FRONT | "front" |
BACK | "back" |
MaxResolution
The maxResolution of RoomProvider.
| Name | Value |
|---|---|
HD | "hd" |
SD | "sd" |
PinType
The pinType of pin() and unpin().
| Name | Value |
|---|---|
SHARE_AND_CAM | "SHARE_AND_CAM" |
CAM | "CAM" |
SHARE | "SHARE" |
VideoQuality
The quality of setQuality(), and the participant's videoQuality.
| Name | Value |
|---|---|
HIGH | "high" |
MEDIUM | "med" |
LOW | "low" |
MediaType
The kind of a stream.
| Name | Value |
|---|---|
AUDIO | "audio" |
VIDEO | "video" |
SHARE | "share" |
SHARE_AUDIO | "shareAudio" |
CaptureFlash
The flash option of captureImage().
| Name | Value | Description |
|---|---|---|
OFF | "OFF" | Captures with no extra light. The default. |
ON | "ON" | Lights the scene for the capture: the lens torch where there is one, or the screen on a front camera. Adds about half a second. |
StreamKind
The kinds a media relay applies to, used by the kinds of requestMediaRelay().
| Name | Value |
|---|---|
AUDIO | "audio" |
VIDEO | "video" |
SHARE | "share" |
RelayDecision
How a media relay request was answered, reported as decision by onMediaRelayRequestResponse().
| Name | Value |
|---|---|
ACCEPTED | "ACCEPTED" |
REJECTED | "REJECTED" |
EntryDecision
How a participant waiting to join was answered. respondEntry() takes it, and onEntryResponded() reports it as decision.
| Name | Value |
|---|---|
ALLOWED | "allowed" |
DENIED | "denied" |
TranslationType
The type of the text onTranslationText() reports.
| Name | Value | Description |
|---|---|---|
PARTIAL | "PARTIAL" | The line is still being revised. The next PARTIAL line replaces it. |
FULL | "FULL" | The line is final. |
CallType
The direction of a phone call, reported as callType by onExternalCallRinging() and the other onExternalCall callbacks.
| Name | Value |
|---|---|
INCOMING | "incoming" |
OUTGOING | "outgoing" |
ConfigQuality
The quality of the config of startRecording() and startHLS().
| Name | Value |
|---|---|
HIGH | "high" |
MED | "med" |
LOW | "low" |
ConfigMode
The mode of the config of startRecording() and startHLS(): video and audio, or audio only.
| Name | Value |
|---|---|
VIDEO_AND_AUDIO | "video-and-audio" |
AUDIO | "audio" |
reliabilityMode
The delivery modes of a data message. send() takes the mode as its boolean reliable argument.
| Name | Value | Description |
|---|---|---|
RELIABLE | "RELIABLE" | Delivery is guaranteed. |
UNRELIABLE | "UNRELIABLE" | Delivery is faster but not guaranteed. |
EncodingLayer
The maxLayer of createCameraVideoTrack(). For a single layer, set multiStream: false.
| Name | Value |
|---|---|
MAX_LAYER_2 | 2 |
MAX_LAYER_3 | 3 |
CustomCameraTrackConfig
The encoderConfig values of createCameraVideoTrack(). Each name is the value in uppercase, for example Constants.CustomCameraTrackConfig.H720P_W1280P is "h720p_w1280p".
CustomMicrophoneTrackConfig
The encoderConfig values of createMicrophoneAudioTrack(). Each name is the value in uppercase, for example Constants.CustomMicrophoneTrackConfig.SPEECH_STANDARD is "speech_standard".
VideoEffectsConfig
Values for setVideoEffects().
| Group | Values |
|---|---|
Pipeline | LEGACY, GRAPH |
StylePreset | OFF, POSTERIZE, VIVID |
Lut | OFF, WARM, COOL, MONO |
Each value is the same as its name, for example Constants.VideoEffectsConfig.Pipeline.GRAPH is "GRAPH".
Got a Question? Ask us on discord

