Subscribe Audio - IoT SDK
The Audio subscribing feature allows IoT devices to receive and render audio streams from other participants in a room. This enables real-time playback of audio from remote peers in your VideoSDK-powered applications.
Playback needs a board with a speaker; without one, startSubscribeAudio() returns DEVICE_NOT_SUPPORTED. See Supported Microcontrollers for which boards support this.
startSubscribeAudio()
-
The
startSubscribeAudio()function lets your device receive and play audio from the other participants in the room. -
This function takes no parameters. The participant identity comes from the
participantIdyou set once ininit().
-
You must call the
init()method before invokingstartSubscribeAudio(). If not, the function will return anINIT_NOT_CALLEDresult code. -
To stop only this stream without leaving, call
stopSubscribeAudio();startSubscribeAudio()resumes it.leave()tears down all publishing and subscribing when you exit the room.
The participantId must be unique for each participant in the room. If you leave it as NULL or an empty string in init(), the SDK generates a unique one for you.
Example
#include "videosdk.h"
#include "esp_log.h"
void app_main() {
// Ensure init() is called before this
result_t subscribe_result = startSubscribeAudio();
ESP_LOGI("IOT-SDK", "Subscribe Result: %d", subscribe_result);
}
stopSubscribeAudio()
- The
stopSubscribeAudio()function stops playing remote audio without leaving the room. CallstartSubscribeAudio()to resume. It is safe to call when audio is not being subscribed.
Example
#include "videosdk.h"
#include "esp_log.h"
void app_main(){
result_t stop_result = stopSubscribeAudio();
ESP_LOGI("IOT-SDK", "Stop Subscribe 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

