MediaPlayerDelegate

public protocol MediaPlayerDelegate : AnyObject

A set of methods which allow to respond to media player events.

  • playerReady(_:) Default implementation

    Tells the delegate that the media player is ready to play assets.

    Default Implementation

    Declaration

    Swift

    func playerReady(_ player: MediaPlayer)

    Parameters

    player

    The player object

  • Tells the delegate that the internal playback state of the media player has changed.

    Default Implementation

    Declaration

    Swift

    func player(
        _ player: MediaPlayer,
        didChangePlaybackStateFrom oldState: Richi.PlaybackState,
        to newState: Richi.PlaybackState
    )

    Parameters

    player

    The player object

    oldState

    The previous state the player transitioned from

    newState

    The new state the player transitioned to

  • Tells the delegate that the internal buffering state of the media player has changed.

    Default Implementation

    Declaration

    Swift

    func player(
        _ player: MediaPlayer,
        didChangeBufferingStateFrom oldState: Richi.BufferingState,
        to newState: Richi.BufferingState
    )

    Parameters

    player

    The player object

    oldState

    The previous state the player transitioned from

    newState

    The new state the player transitioned to

  • player(_:didChangeBufferTime:) Default implementation

    Tells the delegate that the buffering time has changed.

    Default Implementation

    Declaration

    Swift

    func player(_ player: MediaPlayer, didChangeBufferTime bufferTime: Double)

    Parameters

    player

    The player object

    bufferTime

    The time in seconds that the media has been buffered.

  • player(_:didFailWithError:) Default implementation

    Tells the delegate that the player did fail with the given error.

    Default Implementation

    Declaration

    Swift

    func player(_ player: MediaPlayer, didFailWithError error: Richi.Error)

    Parameters

    player

    The player object

    error

    The underlying error

  • player(_:didLoadAsset:) Default implementation

    Tells the delegate that the player has loaded the asset.

    Default Implementation

    Declaration

    Swift

    func player(_ player: MediaPlayer, didLoadAsset asset: Richi.Asset)

    Parameters

    player

    The player object

    asset

    The media asset which has been loaded

  • playerDidEnd(_:) Default implementation

    Tells the delegate that the playback of the current item did end.

    Default Implementation

    Declaration

    Swift

    func playerDidEnd(_ player: MediaPlayer)

    Parameters

    player

    The player object

  • playerDidPlayToEnd(_:) Default implementation

    Tells the delegate that the playback did play to end time.

    Default Implementation

    Declaration

    Swift

    func playerDidPlayToEnd(_ player: MediaPlayer)

    Parameters

    player

    The player object

  • playerWillLoop(_:) Default implementation

    Tells the delegate that the playback of the current item is about to loop.

    Default Implementation

    Declaration

    Swift

    func playerWillLoop(_ player: MediaPlayer)

    Parameters

    player

    The player object

  • playerDidLoop(_:) Default implementation

    Tells the delegate that the playback of the current item did loop.

    Default Implementation

    Declaration

    Swift

    func playerDidLoop(_ player: MediaPlayer)

    Parameters

    player

    The player object