IVSPlayerDelegate

@protocol IVSPlayerDelegate <NSObject>

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

  • Duration of the media changed.

    See

    IVSPlayer.duration, which supports Key-Value Observation as an alternative to this delegate method.

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player didChangeDuration:(CMTime)duration;

    Swift

    optional func player(_ player: IVSPlayer, didChangeDuration duration: CMTime)

    Parameters

    player

    The player instance managing the media that changed duration.

    duration

    The new duration.

  • State of the player changed.

    See

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

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player didChangeState:(IVSPlayerState)state;

    Swift

    optional func player(_ player: IVSPlayer, didChangeState state: Any!)

    Parameters

    player

    The player instance that changed state.

    state

    The new state.

  • The player encountered a fatal error.

    See

    IVSPlayer.error, which supports Key-Value Observation as an alternative to this delegate method.

    Declaration

    Objective-C

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

    Swift

    optional func player(_ player: IVSPlayer, didFailWithError error: Error)

    Parameters

    player

    The player instance that encountered an error.

    error

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

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

    See

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

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player
        didChangeQuality:(nullable IVSQuality *)quality;

    Swift

    optional func player(_ player: IVSPlayer, didChangeQuality quality: IVSQuality?)

    Parameters

    player

    The player instance that switched quality.

    quality

    The new quality.

  • The player encountered a timed cue such as subtitles, captions, or other metadata in the stream.

    See

    IVSCue

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player
        didOutputCue:(nonnull __kindof IVSCue *)cue;

    Swift

    optional func player(_ player: IVSPlayer, didOutputCue cue: IVSCue)

    Parameters

    player

    The player instance managing the stream.

    cue

    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 IVSPlayer *)player;

    Swift

    optional func playerWillRebuffer(_ player: IVSPlayer)

    Parameters

    player

    The player instance that will rebuffer.

  • A seek operation completed.

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player didSeekToTime:(CMTime)time;

    Swift

    optional func player(_ player: IVSPlayer, didSeekTo time: CMTime)

    Parameters

    player

    The player that finished seeking.

    time

    The resulting time of the seek.

  • The native video size for the media changed.

    See

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

    Declaration

    Objective-C

    - (void)player:(nonnull IVSPlayer *)player didChangeVideoSize:(CGSize)videoSize;

    Swift

    optional func player(_ player: IVSPlayer, didChangeVideoSize videoSize: CGSize)

    Parameters

    player

    The player instance managing the media that changed.

    videoSize

    The new size in pixels.