#include <subscriber.h>
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.
void(* on_audio_data) (otc_subscriber *subscriber, void *user_data, const struct otc_audio_data *audio_data) |
Called periodically to report the audio data of the subscriber.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
audio_data | The audio data. |
void(* on_audio_disabled) (otc_subscriber *subscriber, void *user_data) |
Called when the subscribe's audio is disabled.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
void(* on_audio_enabled) (otc_subscriber *subscriber, void *user_data) |
Called when the subscriber's audio is enabled.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
void(* on_audio_level_updated) (otc_subscriber *subscriber, void *user_data, float audio_level) |
Called periodically to report the audio level of the subscriber.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
audio_level | The audio level value, from 0 to 1.0. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
audio_stats | A pointer to the audio stats struct. |
void(* on_caption_text) (otc_subscriber *subscriber, void *user_data, const char *text, otc_bool is_final) |
Called when caption text for the subscriber's stream is available.
subscriber | The subscriber instance. |
user_data | Pointer to user custom data bound to this struct. |
text | Pointer to the caption text. |
is_final | Indicates whether a caption is finished. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
stream | The stream associated with this event. |
void(* on_disconnected) (otc_subscriber *subscriber, void *user_data) |
Called when the subscriber's stream has been interrupted.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
void(* on_error) (otc_subscriber *subscriber, void *user_data, const char *error_string, enum otc_subscriber_error_code error) |
Called when the subscriber fails.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
error_string | A string containing the error message. |
error | Error code enum value. |
void(* on_reconnected) (otc_subscriber *subscriber, void *user_data) |
Called when the subscriber's stream has resumed.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
frame | The video frame. |
void(* on_video_data_received) (otc_subscriber *subscriber, void *user_data) |
Called when an subscriber initially receives video data.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
void(* on_video_disabled) (otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason) |
Called when the subscriber's video is disabled.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
reason | Gives more details about why the video has been disabled. |
void(* on_video_enabled) (otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason) |
Called when the subscriber's video is enabled.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
reason | Gives more details about why the video has been enabled. |
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.
subscriber | The instance invoking this call. |
user_data | Pointer to user custom data bound to this struct. |
video_stats | A pointer to the video stats struct. |
void* reserved |
A void pointer to a memory area holding reserved resources used for the internal implementation.
void* user_data |
This struct member can point to data related to the subscriber which the developer might need.