Skip to main content
Version: Next

C++ SDK Methods

Meeting

The Meeting constructor creates a new meeting instance. A MeetingConfig struct is passed into it to configure the meeting.


MeetingConfig

The MeetingConfig struct holds the meeting ID, authentication token, and the local participant's display name.

Properties

PropertyTypeDescription
meetingIdstd::stringThe meeting/room ID to connect to.
tokenstd::stringThe authentication token from VideoSDK dashboard.
namestd::stringThe display name for the local participant.

Example

videosdk::MeetingConfig config;
config.meetingId = "MEETING_ID";
config.token = "TOKEN";
config.name = "Raspberry Pi";

videosdk::Meeting meeting(config);

join()

The join method connects the local participant to the meeting session.

Parameters

  • void

Example

meeting.join(); // Connect the local participant to the meeting session

leave()

The leave method disconnects the local participant from the meeting and releases the session.

Parameters

  • void

Example

meeting.leave(); // Leave the meeting and end the session

sendData()

The sendData method sends a payload to the other participants in the meeting over the data channel. It is the single entry point for all data types — data/len is an opaque byte range, so you can send a std::string, a std::vector<std::byte>, a raw buffer, a struct, a scalar, and so on. It returns false if the payload exceeds the 15 KiB limit or the data channel is not ready.

bool sendData(const void* data, size_t len, bool binary = true);

Parameters

  • data
    • type: const void*
    • REQUIRED
    • Pointer to the bytes to send.
  • len
    • type: size_t
    • REQUIRED
    • Number of bytes to send.
  • binary
    • type: bool
    • OPTIONAL (default: true)
    • Selects the SCTP frame type — false sends a UTF-8 text frame, true sends arbitrary bytes.

Example

// Send a UTF-8 text message
std::string msg = "Hello from Raspberry Pi";
meeting.sendData(msg.data(), msg.size(), /*binary=*/false);

// Send arbitrary binary bytes
uint8_t blob[] = {0x01, 0x02, 0x03};
meeting.sendData(blob, sizeof(blob), /*binary=*/true);

enableMic()

The enableMic method starts capturing audio from the device microphone (via PulseAudio) and sends the audio stream to other participants.

Parameters

  • source_name
    • type: std::string
    • OPTIONAL (default: "default")
    • The PulseAudio source to capture audio from.

Example

meeting.enableMic(); // Start capturing and sending microphone audio

disableMic()

The disableMic method stops capturing audio from the microphone and stops sending the audio stream to other participants.

Parameters

  • void

Example

meeting.disableMic(); // Stop capturing and sending microphone audio

enableCamera()

The enableCamera method starts capturing video from a V4L2 camera device and sends the video stream to other participants.

Parameters

  • device_path
    • type: std::string
    • OPTIONAL (default: "/dev/video0")
    • The V4L2 camera device to capture from.
  • width
    • type: int
    • OPTIONAL (default: 640)
    • Capture width in pixels.
  • height
    • type: int
    • OPTIONAL (default: 480)
    • Capture height in pixels.
  • fps
    • type: int
    • OPTIONAL (default: 30)
    • Capture frame rate (frames per second).

Example

meeting.enableCamera(); // Start capturing and sending camera video

disableCamera()

The disableCamera method stops capturing video from the camera and stops sending the video stream to other participants.

Parameters

  • void

Example

meeting.disableCamera(); // Stop capturing and sending camera video

setSimulcastLayers()

The setSimulcastLayers method configures 1–3 VP8 simulcast layers for the outgoing camera video, letting the SDK send the stream at multiple resolutions and bitrates at the same time (multistream). It must be called before join(). Layers are ordered smallest → largest, and the top (largest) layer's resolution should match the enableCamera() capture size.

SimulcastLayer

PropertyTypeDescription
widthuint32_tThe layer's target width in pixels.
heightuint32_tThe layer's target height in pixels.
maxBitrateKbpsuint32_tMaximum bitrate for the layer in kbps (0 = no explicit cap).
maxFpsuint32_tMaximum frame rate for the layer (0 = no explicit cap).
activeboolWhether the layer is enabled. Defaults to true.

Parameters

  • layers
    • type: std::vector<videosdk::SimulcastLayer>
    • REQUIRED
    • 1–3 layers ordered from smallest to largest.

Example

meeting.setSimulcastLayers({
{.width = 320, .height = 180, .maxBitrateKbps = 300, .maxFps = 15},
{.width = 640, .height = 360, .maxBitrateKbps = 1500, .maxFps = 20},
{.width = 1280, .height = 720, .maxBitrateKbps = 3000, .maxFps = 30},
});

enableSpeaker()

The enableSpeaker method enables audio playback, allowing the device to play received audio streams from other participants.

Parameters

  • void

Example

meeting.enableSpeaker(); // Start playing back audio received from other participants

disableSpeaker()

The disableSpeaker method disables audio playback so received audio streams are no longer played on the device.

Parameters

  • void

Example

meeting.disableSpeaker(); // Stop playing back received audio

enableVideoDisplay()

The enableVideoDisplay method enables video rendering via SDL2, allowing the device to display received video streams from other participants.

Parameters

  • width_hint
    • type: int
    • OPTIONAL (default: 1280)
    • Suggested width of the display window in pixels.
  • height_hint
    • type: int
    • OPTIONAL (default: 720)
    • Suggested height of the display window in pixels.
  • force_fullscreen
    • type: bool
    • OPTIONAL (default: false)
    • Open the display window in fullscreen mode.

Example

meeting.enableVideoDisplay(); // Start rendering video received from other participants

disableVideoDisplay()

The disableVideoDisplay method stops rendering received video streams and closes the SDL2 display window.

Parameters

  • void

Example

meeting.disableVideoDisplay(); // Stop rendering received video

enableVideoSubscriber()

The enableVideoSubscriber method starts receiving the video of remote participants. Each decoded frame is delivered to the provided callback as a VideoFrame (I420 / YUV planes), letting you render or process incoming video yourself instead of using enableVideoDisplay(). It returns true if the subscriber was enabled successfully.

VideoFrame

PropertyTypeDescription
widthintFrame width in pixels.
heightintFrame height in pixels.
y_plane / y_strideconst uint8_t* / intY (luma) plane pointer and its stride.
u_plane / u_strideconst uint8_t* / intU (chroma) plane pointer and its stride.
v_plane / v_strideconst uint8_t* / intV (chroma) plane pointer and its stride.

Parameters

  • callback
    • type: std::function<void(const videosdk::VideoFrame& frame)>
    • REQUIRED
    • Invoked for each received video frame. The frame data is valid only for the duration of the callback — copy it out if you need to keep it.

Example

meeting.enableVideoSubscriber([](const videosdk::VideoFrame& frame) {
// Render or process the I420 frame (frame.width x frame.height)
});

disableVideoSubscriber()

The disableVideoSubscriber method stops receiving remote video frames and tears down the video subscriber.

Parameters

  • void

Example

meeting.disableVideoSubscriber(); // Stop receiving remote video frames

Got a Question? Ask us on discord