|
| 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(* | on_network_condition_changed )(otc_publisher *publisher, void *user_data, const struct otc_publisher_media_link_stats *stats, enum otc_network_reason reason) |
| void(* | on_media_link_stats )(otc_publisher *publisher, void *user_data, struct otc_publisher_media_link_stats media_link_stats[], size_t number_of_stats) |
| void * | user_data |
| void * | reserved |
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.
This callback is invoked whenever there is a change in the quality state of the publisher's video stream. It provides information about the event, updated statistics and a reason code indicating why the event occurred.
The reason parameter indicates the cause of the event and is considered with the following priority order: bandwidth degradation, CPU degradation, other quality degradation reasons, codec changes, resolution or layer changes.
This event differs from on_video_disabled and on_video_enabled callbacks in that it reports video quality relevant changes. on_video_disabled and `on_video_enabled only indicate that the subscriber’s video track has been turned on or off (for example, due to a stream property update or audio-fallback). In contrast, this event provides diagnostic information about quality degradation causes—such as CPU or bandwidth limitations—and is also triggered when the video remains enabled.
Applications can use this callback to monitor quality changes and react accordingly, such as adjusting UI elements or triggering alerts.
- Parameters
-
| publisher | The instance invoking this call. |
| stats | Updated statistics including details about resolution or video layers change |
| user_data | Optional user data pointer passed when registering the callback. |
| reason | The reason code for the quality event, based on otc_video_reason enum. */ void (on_video_quality_changed)(struct otc_publisher publisher, void* user_data, const struct otc_publisher_video_stats* stats, enum otc_video_reason reason); |
/** This callback is invoked when a network condition change is detected for the publisher.
The reason parameter indicates the cause of the event and is currently always OTC_NETWORK_REASON_NETWORK_CONDITION_CHANGE.
This event differs from on_video_disabled and on_video_enabled callbacks in that it reports network health changes rather than changes in the publisher’s video track state. Applications can use this callback to respond to network issues, such as updating UI, logging telemetry, or triggering adaptive behavior.
- Parameters
-
| publisher | The publisher instance triggering the event. |
| user_data | Optional user data pointer passed when registering the callback. |
| stats | A pointer to the media link statistics for the publisher. |
| reason | The reason for the network condition change. |