Publish Video - IoT SDK
The Video publishing feature lets an IoT device capture frames from its on-board camera and stream them into a room, enabling real-time video alongside audio in your VideoSDK-powered applications.
startPublishVideo()
- The
startPublishVideo()function initiates publishing video captured from your IoT device camera into the active room session. - This function takes no parameters.
-
You must call the
init()method before invokingstartPublishVideo(). If not, the function returns anINIT_NOT_CALLEDresult code. -
Set
.videoCodec = VIDEO_CODEC_JPEGininit(). -
Video can only be published once. Calling this function again while video is already publishing returns a
TASK_ALREADY_STARTEDresult code. -
Both supported boards can send video. If the camera fails to initialize (ribbon unseated, or the wrong board selected in
menuconfig), it returnsINIT_BOARD_FAILED, notDEVICE_NOT_SUPPORTED. See Supported Microcontrollers. -
To stop only this stream without leaving, call
stopPublishVideo();startPublishVideo()resumes it.leave()tears down all publishing and subscribing when you exit the room.
Example
#include "videosdk.h"
#include "esp_log.h"
void app_main(){
result_t publish_video_result = startPublishVideo();
ESP_LOGI("IOT-SDK", "Publish Video Result: %d", publish_video_result);
}
stopPublishVideo()
- The
stopPublishVideo()function stops publishing camera video without leaving the room. CallstartPublishVideo()to resume. It is safe to call when video is not being published.
Example
#include "videosdk.h"
#include "esp_log.h"
void app_main(){
result_t stop_result = stopPublishVideo();
ESP_LOGI("IOT-SDK", "Stop Publish Video Result: %d", stop_result);
}
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord

