Player

The primary player interface

  • Undocumented

    Declaration

    Swift

    var delegate: PlayerDelegate? { get set }
  • API to add a block to be executed before player load.

    If the block is async and fails to return before player load which is also a async operation, it is possible that this block might be executed after player load. It is entirely the responsibility of a block to be sync so that it is executed before player load.

    Declaration

    Swift

    func addPreloadBlock(block: @escaping (Player) -> Void)

    Parameters

    block

    A closure accepting Player as input

  • API to add a block to be executed on player state change.

    Declaration

    Swift

    func addStateChangeBlock(block: @escaping (Player) -> Void)

    Parameters

    block

    A closure accepting Player as input

  • API to add a block to be executed on heart beat or playback progress every second.

    Declaration

    Swift

    func addHeartBeatBlock(block: @escaping (Player) -> Void)

    Parameters

    block

    A closure accepting Player as input

  • API to add multiple delegates to listen playback events

    Declaration

    Swift

    func addDelegate(_ delegate: PlayerDelegate)
  • API to remove delegates that were added using addDelegate function

    Declaration

    Swift

    func removeDelegate(_ delegate: PlayerDelegate)
  • API to invoke when the application received AVPlayerViewControllerDelegate callbacks for playback.

  • Updating player current positions to the MPRemoteCommandCenter

    Declaration

    Swift

    func updatePlayPostionInControlCenter(duration: Double, rate: Float, currentTime: Double, isLive: Bool)

    Parameters

    duration

    Total duration of the player content

    rate

    Player rate position play/pause (1 or 0)

    currentTime

    Player current time position