PlayerEventObserver

@objc public protocol PlayerEventObserver

Protocol used to receive player events.

  • Callback called when the player is going to handle the url.

    Declaration

    Swift

    @objc optional func willHandleUrl(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the internal player is created successfully.

    Declaration

    Swift

    @objc optional func onAVPlayerCreation(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player experiences an error.

    Declaration

    Swift

    @objc optional func onAmpError(_ ampPlayer: AmpPlayer, error: PlayerError)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

    error

    The error sent.

  • Callback called when the playback state of the player changes.

    Declaration

    Swift

    @objc optional func onPlaybackStateChanged(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the buffering state of the player changes.

    Declaration

    Swift

    @objc optional func onBufferingStateChanged(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the position of the player changes.

    Declaration

    Swift

    @objc optional func onPositionChange(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the seconds of the player changes.

    Declaration

    Swift

    @objc optional func onTimeChange(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the position of the player changes.

    Declaration

    Swift

    @objc optional func onCuepointReached(_ ampPlayer: AmpPlayer, atTime: Double)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

    atTime

    The time of the cuepoint reached.

  • Callback called when the playback of the player ends.

    Declaration

    Swift

    @objc optional func onPlaybackEnded(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player is going to be replayed.

    Declaration

    Swift

    @objc optional func onReplay(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player handled the UIApplicationWillResignActiveNotification notification.

    Declaration

    Swift

    @objc optional func onHandledResignActive(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player handled the UIApplicationDidBecomeActiveNotification notification.

    Declaration

    Swift

    @objc optional func onHandledDidBecomeActive(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the streams information changes.

    Declaration

    Swift

    @objc optional func onStreamInformationChanged(_ ampPlayer: AmpPlayer, streamInfo: StreamInfo)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

    streamInfo

    The struct representing the Stream’s Information.

  • Callback called when the playback has stalled.

    Declaration

    Swift

    @objc optional func onPlaybackStalled(ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player is going to be stopped.

    Declaration

    Swift

    @objc optional func willStop(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player logs are enabled.

    Declaration

    Swift

    @objc optional func onEnableLogs(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player logs are disabled.

    Declaration

    Swift

    @objc optional func onDisableLogs(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when a time metadata (ID3Tag) is reached.

    Declaration

    Swift

    @objc optional func onTimedMetadata(_ ampPlayer: AmpPlayer, metadata:[AVMetadataItem])

    Parameters

    ampPlayer

    The instance of the player that sends the event.

    metadata

    The array of metadata reached

  • Callback called when seek begin

    Declaration

    Swift

    @objc optional func onSeekBegan()

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when seek end

    Declaration

    Swift

    @objc optional func onSeekEnd()

    Parameters

    ampPlayer

    The instance of the player that sends the event.