Publish Audio - IoT SDK
The Audio publishing feature allows IoT devices to stream audio content into meetings, enabling real-time audio communication and integration with your VideoSDK-powered applications.
startPublishAudio()
- Initiates publishing audio data from your IoT device into the active meeting session.
This function requires one parameter:
- publisherId: Your unique
publish
identifier. This can be set toNULL
or anempty
string, in which case the SDK will generate a random publish ID for you.
-
You must call the
init()
method before invokingstartPublishAudio()
. If not, the function will return anINIT_NOT_CALLED
result code. -
Only one publish task can run at a time. If another publsih task is already active, calling this function again will result in a
TASK_ALREADY_STARTED
result code.
The subscriberId and publisherId must be unique for each participant in the meeting. If a duplicate ID is detected, the SDK will return a DUPLICATE_ID result code. To resolve this please recheck your (subscriberId and publisherId).
Example
#include "videosdk.h"
#include "esp_log.h"
char *subscriberId;
void app_main(){
// Call the function from videosdk.c and pass publisherId if required
result_t publish_result = startPublishAudio("your publisherId");
ESP_LOGI("Publish Result: %d", publish_result);
}
stopPublishAudio
- The
stopPublishAudio()
function stops audio publishing and removes the peer from the active meeting session. - When invoked, it halts all ongoing audio publishing processes and ensures that the peer associated with the audio stream is cleanly disconnected from the meeting.
Example
#include "videosdk.h"
#include "esp_log.h"
void app_main(){
// simply call the function present in videosdk.c file
result_t stop_publish_result = stopPublishAudio();
ESP_LOGI("Stop Publish Result: %d", stop_publish_result);
}
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord