Adaptive Media Player

AmpCore Docs

PlayerEventObserver

@objc
public protocol PlayerEventObserver

Protocol used to receive player events.

  • Callback triggered when the player is about to handle a new URL

    Declaration

    Swift

    @objc
    optional func willHandleUrl(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    Instance of the player sending the event

  • Callback triggered when a pluging handles the initial connection to the stream.

    Declaration

    Swift

    @objc
    optional func willRequestStream()
  • Callback triggered when the internal player is created successfully

    Declaration

    Swift

    @objc
    optional func onAVPlayerCreation(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    Instance of the player sending the event

  • Callback triggered when external playback delegate has changed

    Declaration

    Swift

    @objc
    optional func onExternalPlaybackChange(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    Instance of the player sending the event

  • Callback called when the player experiences an error.

    Declaration

    Swift

    @objc
    optional func onAmpError(_ ampPlayer: AmpPlayer, error: PlayerError, code: Int, message: String)

    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 bitrate of the player changes.

    Declaration

    Swift

    @objc
    optional func onBitrateChanged(_ ampPlayer: AmpPlayer, bitrate: Double)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the audio bitrate of the player changes.

    Declaration

    Swift

    @objc
    optional func onAudioTrackChanged(_ ampPlayer: AmpPlayer, name: String)

    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 triggered when the player handled the AVPlayerItemPlaybackStalled notification.

    Declaration

    Swift

    @objc
    optional func onPlaybackStalled(_ 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 player handled the AVPlayerItemNewAccessLogEntry notification.

    Declaration

    Swift

    @objc
    optional func onHandleAVPlayerAccess(_ 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 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(_ time: TimeInterval)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when seek is triggered

    Declaration

    Swift

    @objc
    optional func onSeek(_ currentTime: Double, _ time: TimeInterval)

    Parameters

    time

    The timeInterval

  • Callback called when player jumps to live

    Declaration

    Swift

    @objc
    optional func onGoLive()
  • Callback called on stream forward/backword

    Declaration

    Swift

    @objc
    optional func onJumpToTime()
  • Callback called when the player is about to cancel current playback.

    Declaration

    Swift

    @objc
    optional func willCancelPlayback(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the stream is ready to play.

    Declaration

    Swift

    @objc
    optional func streamReadyToPlay(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the playback information changed.

    Declaration

    Swift

    @objc
    optional func onPlaybackInformationChanged(_ tracks: [AVAssetTrack], player: AmpPlayer)

    Parameters

    ampPlayer

    The instance of the player that sends the event.

  • Callback called when the player view is tapped.

    Declaration

    Swift

    @objc
    optional func onTap(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the top bar or bottom bar is visible.

    Declaration

    Swift

    @objc
    optional func onBarShown(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the top bar or bottom bar is visible.

    Declaration

    Swift

    @objc
    optional func onHiddenBar(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the player view is double tapped.

    Declaration

    Swift

    @objc
    optional func onDoubleTap(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the player enters fullscreen.

    Declaration

    Swift

    @objc
    optional func onEnterFullscreen(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the player exits fullscreen.

    Declaration

    Swift

    @objc
    optional func onExitFullscreen(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the player exits fullscreen.

    Declaration

    Swift

    @objc
    optional func onToggleClosedCaption(_ isCaptionOn: Bool, lang: String?)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

  • Callback called when the player is going to enter fullscreen, before animation starts.

    Declaration

    Swift

    @objc
    optional func willEnterFullscreen(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

    newFrame

    The new frame that the player is going to reach.

  • Callback called when the player is going to exit fullscreen, before animation starts.

    Declaration

    Swift

    @objc
    optional func willExitFullscreen(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

    newFrame

    The new frame that the player is going to reach.

  • Callback called when the player rotates.

    Declaration

    Swift

    @objc
    optional func onRotate(_ ampPlayer: AmpPlayer)

    Parameters

    ampPlayerManager

    The instance of the player that sends the event.

    orientation

    The current orientation.

  • Callback called when DAI IMA ad started.

    Only available for live streaming.

    Declaration

    Swift

    @objc
    optional func onAdPeriodStarted()
  • Callback called when DAI IMA ad ended.

    Only available for live streaming.

    Declaration

    Swift

    @objc
    optional func onAdPeriodEnded()
  • Callback called when ad pod break is started.

    Declaration

    Swift

    @objc
    optional func onAdError(error: NSObject)
  • Callback called when ad pod break is started.

    Declaration

    Swift

    @objc
    optional func onAdBreakStarted(break: AdBreakInfo?)
  • Callback called when an ad pod break is ended.

    Declaration

    Swift

    @objc
    optional func onAdBreakEnded(break: AdBreakInfo?)
  • Callback called when an ad is requested in a ad pod.

    Declaration

    Swift

    @objc
    optional func onAdRequested()
  • Callback called when an ad is requested in a ad pod.

    Declaration

    Swift

    @objc
    optional func onAdRequestCompleted()
  • Callback called when each Ad is started in an ad pod.

    Declaration

    Swift

    @objc
    optional func onAdStarted(ad: AdInfo?)
  • Callback called when each Ad is ended in an ad pod.

    Declaration

    Swift

    @objc
    optional func onAdEnded(ad: AdInfo?)
  • Callback called when each Ad is resumed in an ad pod.

    Declaration

    Swift

    @objc
    optional func onAdResumed(ad: AdInfo?)
  • Callback called when each Ad is paused in an ad pod.

    Declaration

    Swift

    @objc
    optional func onAdPaused(ad: AdInfo?)
  • Callback called when an Ad is skipped.

    Declaration

    Swift

    @objc
    optional func onAdSkipped()
  • Callback called when Ad time changed.

    Declaration

    Swift

    @objc
    optional func onAdProceed(time: Double)
  • Callback called when player change the mute property.

    Declaration

    Swift

    @objc
    optional func onMuteStateChange(isMuted: Bool)
  • Callback called when player starts a external playback

    Declaration

    Swift

    @objc
    optional func onExternalPlaybackStart(_ device: OTTDevice?)
  • Callback called when player ends a external playback.

    Declaration

    Swift

    @objc
    optional func onExternalPlaybackEnd(_ device: OTTDevice?)
  • Callback called when plugin is connecting to receiver.

    Declaration

    Swift

    @objc
    optional func onReadyToSendMetadata(_ deviceId: String, status: String)
  • Callback triggered when an ad playing on a separate view starts

    Declaration

    Swift

    @objc
    optional func onExternalAdStarted(_ ampPlayer: AmpPlayer)
  • Callback triggered when an ad playing on a separate view ends

    Declaration

    Swift

    @objc
    optional func onExternalAdEnded(_ ampPlayer: AmpPlayer)
  • Callback triggered on volume changes

    Declaration

    Swift

    @objc
    optional func onVolumeChanged(_ ampPlayer: AmpPlayer, volumeLevel: Float)
  • Callback triggered on avplayeritem switch

    Declaration

    Swift

    @objc
    optional func onPlayerItemChanged(_ ampPlayer: AmpPlayer)