# OTSubscriberKitDelegate Protocol Reference

Conforms to | NSObject
Declared in | OTSubscriberKit.h

## Overview

Used to send messages for an OTSubscriber instance. When you send the [OTSubscriberKit initWithStream:delegate:] message, you specify an OTSubscriberKitDelegate object.

## Using subscribers

### `– subscriberDidConnectToStream:` required method

Sent when the subscriber successfully connects to the stream.

`- (void)subscriberDidConnectToStream:(nonnull OTSubscriberKit *)subscriber`

#### Parameters

`subscriber` | The subscriber that generated this event.

#### Declared In

`OTSubscriberKit.h`

### `– subscriber:didFailWithError:` required method

Sent if the subscriber fails to connect to its stream.

`- (void)subscriber:(nonnull OTSubscriberKit *)subscriber didFailWithError:(nonnull OTError *)error`

#### Parameters

`subscriber` | The subscriber that generated this event.
`error` | The error (an OTError object) that describes this connection error. The `OTSubscriberErrorCode` enum (defined in the OTError class) defines values for the `code` property of this object.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberVideoDisabled:reason:`

This message is sent when the subscriber stops receiving video. Check the reason parameter for the reason why the video stopped.

`- (void)subscriberVideoDisabled:(nonnull OTSubscriberKit *)subscriber reason:(OTSubscriberVideoEventReason)reason`

#### Parameters

`subscriber` | The OTSubscriber that will no longer receive video.
`reason` | The reason that the video track was disabled. See OTSubscriberVideoEventReason.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberVideoEnabled:reason:`

This message is sent when the subscriber’s video stream starts (when there previously was no video) or resumes (after video was disabled). Check the reason parameter for the reason why the video started (or resumed).

`- (void)subscriberVideoEnabled:(nonnull OTSubscriberKit *)subscriber reason:(OTSubscriberVideoEventReason)reason`

#### Parameters

`subscriber` | The OTSubscriber that will receive video.
`reason` | The reason that the video track was enabled. See OTSubscriberVideoEventReason.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberVideoDisableWarning:`

This message is sent when the OpenTok Media Router determines that the stream quality has degraded and the video will be disabled if the quality degrades further. If the quality degrades further, the subscriber disables the video and the [OTSubscriberKitDelegate subscriberVideoDisabled:reason:] message is sent. If the stream quality improves, the [OTSubscriberKitDelegate subscriberVideoDisableWarningLifted:] message is sent.

`- (void)subscriberVideoDisableWarning:(nonnull OTSubscriberKit *)subscriber`

#### Parameters

`subscriber` | The OTSubscriber that may stop receiving video soon.

#### Discussion

This feature is only available in sessions that use the OpenTok Media Router (sessions with the media mode set to routed), not in sessions with the media mode set to relayed.

This message is mainly sent when connection quality degrades.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberVideoDisableWarningLifted:`

This message is sent when the OpenTok Media Router determines that the stream quality has improved to the point at which the video being disabled is not an immediate risk. This message is sent after the [OTSubscriberKitDelegate subscriberVideoDisableWarning:] message is sent.

`- (void)subscriberVideoDisableWarningLifted:(nonnull OTSubscriberKit *)subscriber`

#### Parameters

`subscriber` | The OTSubscriber instance.

#### Discussion

This feature is only available in sessions that use the OpenTok Media Router (sessions with the media mode set to routed), not in sessions with the media mode set to relayed.

This message is mainly sent when connection quality improves.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberDidDisconnectFromStream:`

Called when the subscriber’s stream has been interrupted.

`- (void)subscriberDidDisconnectFromStream:(nonnull OTSubscriberKit *)subscriber`

#### Parameters

`subscriber` | The subscriber that generated this event.

#### Discussion

In response to this message being sent, you may want to provide a user interface notification, to let the user know that the audio-video stream is temporarily disconnected and the app is trying to reconnect to the stream.

If the client reconnects to the stream, the [OTSubscriberKitDelegate subscriberDidReconnectToStream:] message is sent.

#### Declared In

`OTSubscriberKit.h`

### `– subscriberDidReconnectToStream:`

Sent when the subscriber’s stream has resumed, after the [OTSubscriberKitDelegate subscriberDidDisconnectFromStream:] message is sent.

`- (void)subscriberDidReconnectToStream:(nonnull OTSubscriberKit *)subscriber`

#### Parameters

`subscriber` | The subscriber that generated this event. See [OTSessionDelegate sessionDidReconnect:].

#### Declared In

`OTSubscriberKit.h`