# OTSubscriberKitNetworkStatsDelegate Protocol Reference

Conforms to | NSObject
Declared in | OTSubscriberKit.h

## Overview

Used to monitor audio and video statistics for the subscriber. See [OTSubscriberKit networkStatsDelegate].

### `– subscriber:videoNetworkStatsUpdated:`

Sent periodically to report audio statistics for the subscriber.

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber videoNetworkStatsUpdated:(nonnull OTSubscriberKitVideoNetworkStats *)stats`

#### Parameters

`subscriber` | The subscriber these statistic apply to.
`stats` | An OTSubscriberKitVideoNetworkStats object, which has properties for the video bytes received, video packets lost, and video packets received for the subscriber.

#### Declared In

`OTSubscriberKit.h`

### `– subscriber:audioNetworkStatsUpdated:`

Sent periodically to report video statistics for the subscriber.

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber audioNetworkStatsUpdated:(nonnull OTSubscriberKitAudioNetworkStats *)stats`

#### Parameters

`subscriber` | The subscriber these statistic apply to.
`stats` | An OTSubscriberKitAudioNetworkStats object, which has properties for the audio bytes received, audio packets lost, and audio packets received for the subscriber.

#### Declared In

`OTSubscriberKit.h`

### `– subscriber:videoQualityChanged:reason:`

Called when a quality-related video event occurs for the subscriber.

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber videoQualityChanged:(nonnull OTSubscriberKitVideoNetworkStats *)stats reason:(OTSubscriberVideoEventReason)reason`

#### Parameters

`subscriber` | The subscriber instance whose video stream triggered this event.
`stats` | The latest subscriber video statistics at the time of the event.
`reason` | The reason for the quality event, based on `OTSubscriberVideoEventReason`.

#### Discussion

This delegate method is triggered when a significant disruption is detected in the subscriber’s video stream. Currently, it only triggers for video interruptions (pauses) lasting 5 seconds or longer, codec changes or resolution changes. Short freezes are tracked internally and reflected in the subscriber statistics, but no callback is triggered for each freeze due to their short duration and high frequency.

The `reason` parameter indicates the cause of the event and is considered in the following priority order: `OTSubscriberVideoEventVideoInterrupt`, `OTSubscriberVideoEventCodecChange`.

Unlike the [OTSubscriberKitDelegate subscriberVideoDisabled:reason:] and [OTSubscriberKitDelegate subscriberVideoEnabled:reason:] messages, which indicate that the subscriber’s video track has been turned off or on (for example, due to audio fallback or stream property updates), this callback reports quality-related changes. Applications can use this to update the UI, log telemetry, or notify users about video interruptions.

#### Declared In

`OTSubscriberKit.h`

### `– subscriber:networkConditionChanged:reason:`

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

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber networkConditionChanged:(nonnull OTSubscriberKitMediaLinkStats *)mediaLinkStats reason:(OTNetworkReason)reason`

#### Parameters

`subscriber` | The subscriber 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 subscriber’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

`OTSubscriberKit.h`

### `– subscriber:mediaLinkStatsUpdated:`

Called periodically to report media link statistics for the subscriber. It provides transport-level metrics for both the local subscriber and the remote publisher.

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber mediaLinkStatsUpdated:(nonnull OTSubscriberKitMediaLinkStats *)mediaLinkStats`

#### Parameters

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

#### Declared In

`OTSubscriberKit.h`