TPLPlayerDelegate

@protocol TPLPlayerDelegate <NSObject>

This delegate receives state changes and events relevant to playback on TPLPlayer. All are invoked on the main queue.

  • State of the player changed.

    See

    TPLPlayer.state, which supports Key-Value Observation as an alternative to this delegate method.

    Declaration

    Objective-C

    - (void)player:(nonnull TPLPlayer *)player
        didChangePlayerState:(TPLPlayerState)state;

    Parameters

    player

    The player instance that changed state.

    state

    The new player state.

  • The playback quality changed. This may be due to user action or an internal adaptive-quality switch.

    See

    TPLPlayer.quality, which supports Key-Value Observation as an alternative to this delegate method.

    Declaration

    Objective-C

    - (void)player:(nonnull TPLPlayer *)player
        didChangeQuality:(nullable TPLPlayerQuality *)quality;

    Parameters

    player

    The player instance that switched quality.

    quality

    The new quality.

  • The player encountered a fatal error.

    Declaration

    Objective-C

    - (void)player:(nonnull TPLPlayer *)player
        didFailWithError:(nonnull NSError *)error;

    Parameters

    player

    The player instance that encountered an error.

    error

    The error. See TPLErrors.h for expected userInfo keys.

  • The player encountered a timed metadata.

    Declaration

    Objective-C

    - (void)player:(nonnull TPLPlayer *)player
        didReceiveTimedMetadata:(nonnull TPLTimedMetadata *)metadata;

    Parameters

    player

    The player instance managing the stream.

    metadata

    An object with timing information and other details varying by type.

  • The player exhausted its internal buffers while playing. This is not invoked for user actions such as seeking or starting/resuming playback.

    Declaration

    Objective-C

    - (void)playerWillRebuffer:(nonnull TPLPlayer *)player;

    Parameters

    player

    The player instance that will rebuffer.

  • The native video size for the media changed.

    See

    TPLPlayer.videoSize, which supports Key-Value Observation as an alternative to this delegate method.

    Declaration

    Objective-C

    - (void)player:(nonnull TPLPlayer *)player videoSizeChanged:(CGSize)videoSize;

    Parameters

    player

    The player instance managing the media that changed.

    videoSize

    The new size in pixels.

  • The network lost while playing a stream. If the network outage is detected while playing a stream, SDK will pause the stream and invoke this callback. The SDK will resume the playback if the network becomes available before timeout.

    Declaration

    Objective-C

    - (void)playerNetworkDidBecomeUnavailable:(nonnull TPLPlayer *)player;

    Parameters

    player

    The player instance affected by the network outage.