Suggestions

close search

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

Visit the Vonage API Developer Portal

otc_subscriber_callbacks Struct Reference

#include <subscriber.h>

Data Fields

void(* on_connected )(otc_subscriber *subscriber, void *user_data, const otc_stream *stream)
void(* on_disconnected )(otc_subscriber *subscriber, void *user_data)
void(* on_reconnected )(otc_subscriber *subscriber, void *user_data)
void(* on_render_frame )(otc_subscriber *subscriber, void *user_data, const otc_video_frame *frame)
void(* on_video_disabled )(otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason)
void(* on_video_enabled )(otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason)
void(* on_audio_disabled )(otc_subscriber *subscriber, void *user_data)
void(* on_audio_enabled )(otc_subscriber *subscriber, void *user_data)
void(* on_video_data_received )(otc_subscriber *subscriber, void *user_data)
void(* on_video_disable_warning )(otc_subscriber *subscriber, void *user_data)
void(* on_video_disable_warning_lifted )(otc_subscriber *subscriber, void *user_data)
void(* on_audio_stats )(otc_subscriber *subscriber, void *user_data, struct otc_subscriber_audio_stats audio_stats)
void(* on_video_stats )(otc_subscriber *subscriber, void *user_data, struct otc_subscriber_video_stats video_stats)
void(* on_audio_level_updated )(otc_subscriber *subscriber, void *user_data, float audio_level)
void(* on_error )(otc_subscriber *subscriber, void *user_data, const char *error_string, enum otc_subscriber_error_code error)
void * user_data
void * reserved

Detailed Description

Subscriber callback functions.

This struct is a set of function pointers to functions that can be invoked for events related to an OpenTok subscriber.

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.

Field Documentation

◆ on_audio_disabled

void(* on_audio_disabled) (otc_subscriber *subscriber, void *user_data)

Called when the subscribe's audio is disabled.

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

◆ on_audio_enabled

void(* on_audio_enabled) (otc_subscriber *subscriber, void *user_data)

Called when the subscriber's audio is enabled.

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

◆ on_audio_level_updated

void(* on_audio_level_updated) (otc_subscriber *subscriber, void *user_data, float audio_level)

Called periodically to report the audio level of the subscriber.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
audio_levelThe audio level value, from 0 to 1.0.

◆ on_audio_stats

void(* on_audio_stats) (otc_subscriber *subscriber, void *user_data, struct otc_subscriber_audio_stats audio_stats)

Called periodically to report audio statistics for the subscriber.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
audio_statsA pointer to the audio stats struct.

◆ on_connected

void(* on_connected) (otc_subscriber *subscriber, void *user_data, const otc_stream *stream)

Called when the instance has successfully connected to the stream and begins playing media.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
streamThe stream associated with this event.

◆ on_disconnected

void(* on_disconnected) (otc_subscriber *subscriber, void *user_data)

Called when the subscriber's stream has been interrupted.

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

◆ on_error

void(* on_error) (otc_subscriber *subscriber, void *user_data, const char *error_string, enum otc_subscriber_error_code error)

Called when the subscriber fails.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
error_stringA string containing the error message.
error_codeError code enum value.

◆ on_reconnected

void(* on_reconnected) (otc_subscriber *subscriber, void *user_data)

Called when the subscriber's stream has resumed.

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

◆ on_render_frame

void(* on_render_frame) (otc_subscriber *subscriber, void *user_data, const otc_video_frame *frame)

Called when a new video frame for the subscriber is ready to be rendered.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
frameThe video frame.

◆ on_video_data_received

void(* on_video_data_received) (otc_subscriber *subscriber, void *user_data)

Called when an subscriber initially receives video data.

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

◆ on_video_disable_warning

void(* on_video_disable_warning) (otc_subscriber *subscriber, void *user_data)

Called when the OpenTok Media Router determines that the stream quality has degraded and the video will be disabled if the quality degrades further.

Parameters
subscriberThe 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_subscriber *subscriber, void *user_data)

Called when the OpenTok Media Router determines that the stream quality has improved to the point at which the video being disabled is not an immediate risk.

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

◆ on_video_disabled

void(* on_video_disabled) (otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason)

Called when the subscriber's video is disabled.

Parameters
subscriberThe 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_subscriber *subscriber, void *user_data, enum otc_video_reason reason)

Called when the subscriber's video is enabled.

Parameters
subscriberThe 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_subscriber *subscriber, void *user_data, struct otc_subscriber_video_stats video_stats)

Called periodically to report video statistics for the subscriber.

Parameters
subscriberThe instance invoking this call.
user_dataPointer to user custom data bound to this struct.
video_statsA pointer to the video stats struct.

◆ reserved

void* reserved

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

◆ user_data

void* user_data

This struct member can point to data related to the subscriber which the developer might need.