Skip to main content
Version: 2.x.x

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");
}
}
tip

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.

NameValueDescription
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().

NameValue
SEND_AND_RECV"SEND_AND_RECV"
RECV_ONLY"RECV_ONLY"
SIGNALLING_ONLY"SIGNALLING_ONLY"

permission​

The permissions checkPermission() and requestPermission() take.

NameValue
AUDIO"audio"
VIDEO"video"
AUDIO_AND_VIDEO"audio_video"

leaveReason​

The code that onRoomLeft() and onParticipantLeft() report.

NameValue
WEBSOCKET_DISCONNECTED1001
REMOVE_PEER1002
REMOVE_PEER_VIEWER_MODE_CHANGED1003
REMOVE_PEER_MEDIA_RELAY_STOP1004
SWITCH_ROOM1005
ROOM_CLOSE1006
UNKNOWN1007
REMOVE_ALL1008
MEETING_END_API1009
REMOVE_PEER_API1010
DUPLICATE_PARTICIPANT1011
MANUAL_LEAVE_CALLED1101
WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED1102
JOIN_ROOM_FAILED1103
SWITCH_ROOM_FAILED1104

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().

NameValueDescription
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().

NameValue
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().

NameValue
QUEUE"queue"
DROP"drop"

AgentState​

The states of an AI agent, reported by useAgentParticipant().

NameValue
IDLE"IDLE"
LISTENING"LISTENING"
THINKING"THINKING"
SPEAKING"SPEAKING"

FacingMode​

The facingMode of createCameraVideoTrack() and the defaultCamera of RoomProvider.

NameValue
FRONT"front"
BACK"back"

MaxResolution​

The maxResolution of RoomProvider.

NameValue
HD"hd"
SD"sd"

PinType​

The pinType of pin() and unpin().

NameValue
SHARE_AND_CAM"SHARE_AND_CAM"
CAM"CAM"
SHARE"SHARE"

VideoQuality​

The quality of setQuality(), and the participant's videoQuality.

NameValue
HIGH"high"
MEDIUM"med"
LOW"low"

MediaType​

The kind of a stream.

NameValue
AUDIO"audio"
VIDEO"video"
SHARE"share"
SHARE_AUDIO"shareAudio"

CaptureFlash​

The flash option of captureImage().

NameValueDescription
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().

NameValue
AUDIO"audio"
VIDEO"video"
SHARE"share"

RelayDecision​

How a media relay request was answered, reported as decision by onMediaRelayRequestResponse().

NameValue
ACCEPTED"ACCEPTED"
REJECTED"REJECTED"

EntryDecision​

How a participant waiting to join was answered. respondEntry() takes it, and onEntryResponded() reports it as decision.

NameValue
ALLOWED"allowed"
DENIED"denied"

TranslationType​

The type of the text onTranslationText() reports.

NameValueDescription
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.

NameValue
INCOMING"incoming"
OUTGOING"outgoing"

ConfigQuality​

The quality of the config of startRecording() and startHLS().

NameValue
HIGH"high"
MED"med"
LOW"low"

ConfigMode​

The mode of the config of startRecording() and startHLS(): video and audio, or audio only.

NameValue
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.

NameValueDescription
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.

NameValue
MAX_LAYER_22
MAX_LAYER_33

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().

GroupValues
PipelineLEGACY, GRAPH
StylePresetOFF, POSTERIZE, VIVID
LutOFF, 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