OTPublisherKitNetworkStatsDelegate

Used to monitor audio and video statistics for the publisher. See [OTPublisherKit networkStatsDelegate].

Methods

Name Description
publisher:videoNetworkStatsUpdated:(publisher, stats) Sent periodically to report video statistics for the publisher.
publisher:audioNetworkStatsUpdated:(publisher, stats) Sent periodically to report audio statistics for the publisher.
publisher:videoQualityChanged:reason:(publisher, stats, reason) Called whenever there is a change in the quality state of the publisher’s video stream.
publisher:networkConditionChanged:reason:(publisher, mediaLinkStats, reason) Called whenever a network condition change is detected for the publisher.
publisher:mediaLinkStatsUpdated:(publisher, mediaLinkStats) Called periodically to report media link statistics for the publisher.

publisher:videoNetworkStatsUpdated:(publisher, stats)

Sent periodically to report video statistics for the publisher.

The OTPublisherKitVideoNetworkStats object includes properties. properties for the video bytes received, video packets lost, and video packets sent for the publisher.

Parameters:
Name Type Description
publisher OTPublisherKit * The publisher these statistic apply to.
stats NSArray<OTPublisherKitVideoNetworkStats *> * An array of OTPublisherKitVideoNetworkStats 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.

publisher:audioNetworkStatsUpdated:(publisher, stats)

Sent periodically to report audio statistics for the publisher.

The OTPublisherKitAudioNetworkStats object includes properties. properties for the audio bytes received, audio packets lost, and audio packets sent for the publisher.

Parameters:
Name Type Description
publisher OTPublisherKit * The publisher these statistic apply to.
stats NSArray<OTPublisherKitAudioNetworkStats *> * An array of OTPublisherKitAudioNetworkStats 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 audio 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.

publisher:videoQualityChanged:reason:(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 is considered with the following priority order: bandwidth degradation, CPU degradation, other quality degradation reasons, codec changes, and resolution or video layer changes.

Unlike the publisher:videoEnabled: and publisher:videoDisabled: delegate methods, 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 OTPublisherKit * The publisher whose video stream quality has changed.
stats OTPublisherKitVideoNetworkStats * Updated video statistics, including details about resolution or video layer changes.
reason OTPublisherVideoEventReason The reason code for the quality change, based on the OTVideoReason enum.

publisher:networkConditionChanged:reason:(publisher, mediaLinkStats, reason)

Called whenever a network condition change is detected for the publisher.

This callback reports changes in overall network health rather than changes in the publisher’s video track state. It differs from video enabled/disabled callbacks in that it provides diagnostic information about network conditions.

Both video and audio statistics are provided to give a complete view of media and network quality. Since audio and video share the same underlying transport, they also share the same local transport and remote participant statistics.

The reason parameter indicates the cause of the network condition change and is currently reported as OTNetworkReasonNetworkConditionChange.

Applications can use this callback to react to network issues, such as updating UI indicators, logging telemetry, or triggering adaptive behavior.

Parameters:
Name Type Description
publisher OTPublisherKit * The publisher whose network condition has changed.
mediaLinkStats OTPublisherKitMediaLinkStats * The media link statistics.
reason OTNetworkReason The reason code for the network condition change.

publisher:mediaLinkStatsUpdated:(publisher, mediaLinkStats)

Called periodically to report media link statistics for the publisher. It provides transport-level metrics.

Parameters:
Name Type Description
publisher OTPublisherKit * The publisher instance.
mediaLinkStats NSArray<OTPublisherKitMediaLinkStats *> * The media link statistics.