# OTPublisherKitNetworkStatsDelegate Protocol Reference

Conforms to | NSObject
Declared in | OTPublisherKit.h

## Overview

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

### `– publisher:videoNetworkStatsUpdated:`

Sent periodically to report video statistics for the publisher.

`- (void)publisher:(nonnull OTPublisherKit *)publisher videoNetworkStatsUpdated:(nonnull NSArray<OTPublisherKitVideoNetworkStats*> *)stats`

#### Parameters

`publisher` | The publisher these statistic apply to.
`stats` | 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. The OTPublisherKitVideoNetworkStats object includes properties. properties for the video bytes received, video packets lost, and video packets sent for the publisher.

#### Declared In

`OTPublisherKit.h`

### `– publisher:audioNetworkStatsUpdated:`

Sent periodically to report audio statistics for the publisher.

`- (void)publisher:(nonnull OTPublisherKit *)publisher audioNetworkStatsUpdated:(nonnull NSArray<OTPublisherKitAudioNetworkStats*> *)stats`

#### Parameters

`publisher` | The publisher these statistic apply to.
`stats` | 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. The OTPublisherKitAudioNetworkStats object includes properties. properties for the audio bytes received, audio packets lost, and audio packets sent for the publisher.

#### Declared In

`OTPublisherKit.h`

### `– publisher:videoQualityChanged:reason:`

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

`- (void)publisher:(nonnull OTPublisherKit *)publisher videoQualityChanged:(nonnull OTPublisherKitVideoNetworkStats *)stats reason:(OTPublisherVideoEventReason)reason`

#### Parameters

`publisher` | The publisher whose video stream quality has changed.
`stats` | Updated video statistics, including details about resolution or video layer changes.
`reason` | The reason code for the quality change, based on the `OTVideoReason` enum.

#### Discussion

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.

#### Declared In

`OTPublisherKit.h`

### `– publisher:networkConditionChanged:reason:`

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

`- (void)publisher:(nonnull OTPublisherKit *)publisher networkConditionChanged:(nonnull OTPublisherKitMediaLinkStats *)mediaLinkStats reason:(OTNetworkReason)reason`

#### Parameters

`publisher` | The publisher whose network condition has changed.
`mediaLinkStats` | The media link statistics.
`reason` | The reason code for the network condition change.

#### Discussion

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.

#### Declared In

`OTPublisherKit.h`

### `– publisher:mediaLinkStatsUpdated:`

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

`- (void)publisher:(nonnull OTPublisherKit *)publisher mediaLinkStatsUpdated:(nonnull NSArray<OTPublisherKitMediaLinkStats*> *)mediaLinkStats`

#### Parameters

`publisher` | The publisher instance.
`mediaLinkStats` | The media link statistics.

#### Declared In

`OTPublisherKit.h`