PublisherKit.VideoStatsListener

public abstract static interface VideoStatsListener

Enclosing class: PublisherKit

Defines the listener object for getting publisher video statistics.

Methods

Name Description
onVideoQualityChanged(publisher, stats, reason) Called whenever there is a change in the quality state of the publisher’s video stream.
onVideoStats(publisher, stats) Called periodically to report video statistics for the publisher.

onVideoQualityChanged(publisher, stats, reason)

Called whenever there is a change in the quality state of the publisher’s video stream.

This method provides diagnostic information about video quality changes, including updated statistics and the reason why the event occurred.

The reason parameter indicates the cause of the event and follows this priority order: bandwidth degradation, CPU degradation, other quality degradation reasons, codec changes, and resolution or video layer changes.

Unlike PublisherKit.VideoListener#onVideoEnabled(PublisherKit, String) and PublisherKit.VideoListener#onVideoDisabled(PublisherKit, String), which indicate that the video track has been turned on or off (for example, due to a stream property update or audio fallback), this callback reports quality-related changes even when video remains enabled.

Applications can use this delegate to monitor quality changes and react accordingly — for example, by adjusting UI elements or triggering alerts.

Parameters:
Name Type Description
publisher PublisherKit The PublisherKit whose video stream quality has changed.
stats PublisherKit.PublisherVideoStats Updated PublisherVideoStats with details about resolution or video layer changes.
reason String The reason for the quality change

onVideoStats(publisher, stats)

Called periodically to report video statistics for the publisher.

Parameters:
Name Type Description
publisher PublisherKit The publisher.
stats PublisherKit.PublisherVideoStats[] An array of PublisherVideoStats objects. For a publisher in a routed session (one that uses the OpenTok Media Router), this array includes one object, defining the statistics for the single video-media stream that is sent to the OpenTok Media Router. In a relayed session, the array includes an object for each subscriber to the published stream. The PublisherVideoStats object includes properties. properties for the video bytes received, video packets lost, and video packets received for the publisher.