Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

otc_publisher_callbacks Struct Reference

#include <publisher.h>

Data Fields

void(* on_stream_created )(otc_publisher *publisher, void *user_data, const otc_stream *stream)
void(* on_stream_destroyed )(otc_publisher *publisher, void *user_data, const otc_stream *stream)
void(* on_render_frame )(otc_publisher *publisher, void *user_data, const otc_video_frame *frame)
void(* on_audio_level_updated )(otc_publisher *publisher, void *user_data, float audio_level)
void(* on_publisher_mute_forced )(otc_publisher *publisher, void *user_data)
void(* on_audio_stats )(otc_publisher *publisher, void *user_data, struct otc_publisher_audio_stats audio_stats[], size_t number_of_stats)
void(* on_video_stats )(otc_publisher *publisher, void *user_data, struct otc_publisher_video_stats video_stats[], size_t number_of_stats)
void(* on_error )(otc_publisher *publisher, void *user_data, const char *error_string, enum otc_publisher_error_code error_code)
void(* on_video_disabled )(otc_publisher *publisher, void *user_data, enum otc_video_reason reason)
void(* on_video_enabled )(otc_publisher *publisher, void *user_data, enum otc_video_reason reason)
void(* on_video_disable_warning )(otc_publisher *publisher, void *user_data)
void(* on_video_disable_warning_lifted )(otc_publisher *publisher, void *user_data)
void * user_data
void * reserved

Detailed Description

Publisher callback functions.

This structure is a set of function pointers to callback functions that can be called in response to events related to an OpenTok publisher.

All callbacks will not be made on the application or main thread but on an internal thread. The application should return the callback as quickly as possible to avoid blocking the internal thread.

Data passed into a callback function (other than publisher and user_data) will be released after the callback is called. Make a copy of the data if you need to retain it.

Field Documentation

◆ on_audio_level_updated

void(* on_audio_level_updated) (otc_publisher *publisher, void *user_data, float audio_level)

Called periodically to report the audio level of the publisher.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
audio_levelThe audio level value, from 0 to 1.0.

◆ on_audio_stats

void(* on_audio_stats) (otc_publisher *publisher, void *user_data, struct otc_publisher_audio_stats audio_stats[], size_t number_of_stats)

Called periodically to report audio statistics for the publisher.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
audio_statsAn array of publisher audio stats.
number_of_statsThe number of audio stats in the array.

◆ on_error

void(* on_error) (otc_publisher *publisher, void *user_data, const char *error_string, enum otc_publisher_error_code error_code)

Called when the publisher fails.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
error_stringA string containing the error message.
error_codeAn error code enum value.

◆ on_publisher_mute_forced

void(* on_publisher_mute_forced) (otc_publisher *publisher, void *user_data)

Called when a moderator has forced this publisher to mute audio.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.

◆ on_render_frame

void(* on_render_frame) (otc_publisher *publisher, void *user_data, const otc_video_frame *frame)

Called when there is a new frame ready to be rendered by the publisher.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
frameA pointer to the new video frame.

◆ on_stream_created

void(* on_stream_created) (otc_publisher *publisher, void *user_data, const otc_stream *stream)

Called when the publisher's stream is created.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
streamA pointer to the stream.

◆ on_stream_destroyed

void(* on_stream_destroyed) (otc_publisher *publisher, void *user_data, const otc_stream *stream)

Called when the publisher's stream is destroyed.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
streamA pointer to the stream.

◆ on_video_disable_warning

void(* on_video_disable_warning) (otc_publisher *publisher, void *user_data)

Called when the publisher determines that the network congestion level has degraded and the video will be disabled if the quality degrades further.

Parameters
publisherThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.

◆ on_video_disable_warning_lifted

void(* on_video_disable_warning_lifted) (otc_publisher *publisher, void *user_data)

Called when the publisher determines that the network congestion level has improved to the point at which the video being disabled is not an immediate risk.

Parameters
publisherThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.

◆ on_video_disabled

void(* on_video_disabled) (otc_publisher *publisher, void *user_data, enum otc_video_reason reason)

Called when the publisher's video is disabled.

Parameters
publisherThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
reasonGives more details about why the video has been disabled.

◆ on_video_enabled

void(* on_video_enabled) (otc_publisher *publisher, void *user_data, enum otc_video_reason reason)

Called when the publisher's video is enabled.

Parameters
publisherThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
reasonGives more details about why the video has been enabled.

◆ on_video_stats

void(* on_video_stats) (otc_publisher *publisher, void *user_data, struct otc_publisher_video_stats video_stats[], size_t number_of_stats)

Called periodically to report video statistics for the publisher.

Parameters
publisherA pointer to the publisher.
user_dataA pointer to the user_data you set for the publisher.
video_statsAn array of publisher video stats.
number_of_statsThe number of video stats in the array.

◆ reserved

void* reserved

A void pointer to a memory area holding reserved resources used for the internal implementation.

◆ user_data

void* user_data

A pointer to data you set related to the publisher.