Player

@objc
public protocol Player : BasicPlayer

Undocumented

  • The player’s delegate.

    Declaration

    Swift

    @objc
    weak var delegate: PlayerDelegate? { get set }
  • The player’s associated media entry.

    Declaration

    Swift

    @objc
    weak var mediaEntry: PKMediaEntry? { get }
  • The player’s settings.

    Declaration

    Swift

    @objc
    var settings: PKPlayerSettings { get }
  • The current media format.

    Declaration

    Swift

    @objc
    var mediaFormat: PKMediaSource.MediaFormat { get }
  • The player’s session id. the sessionId is initialized when the player loads.

    Declaration

    Swift

    @objc
    var sessionId: String { get }
  • Add Observation to relevant event.

    Declaration

    Swift

    @objc
    func addObserver(_ observer: AnyObject, event: PKEvent.Type, block: @escaping (PKEvent) -> Void)
  • Add Observation to relevant events.

    Declaration

    Swift

    @objc
    func addObserver(_ observer: AnyObject, events: [PKEvent.Type], block: @escaping (PKEvent) -> Void)
  • Remove Observer for single event.

    Declaration

    Swift

    @objc
    func removeObserver(_ observer: AnyObject, event: PKEvent.Type)
  • Remove Observer for several events.

    Declaration

    Swift

    @objc
    func removeObserver(_ observer: AnyObject, events: [PKEvent.Type])
  • Update Plugin Config.

    Declaration

    Swift

    @objc
    func updatePluginConfig(pluginName: String, config: Any)
  • Indicates if current media is Live.

    Declaration

    Swift

    @objc
    func isLive() -> Bool

    Return Value

    returns true if it’s live.

  • Getter for playkit controllers.

    Declaration

    Swift

    @objc
    func getController(type: PKController.Type) -> PKController?

    Parameters

    type

    Required class type.

    Return Value

    Relevant controller if exist.

  • Declaration

    Swift

    @objc
    func addPeriodicObserver(interval: TimeInterval, observeOn dispatchQueue: DispatchQueue?, using block: @escaping (TimeInterval) -> Void) -> UUID
  • Adds a boundary time observer for the selected boundaries in time (25%, 50%, 30s etc.)

    Attention

    if a boundary is crossed while seeking the observation won’t be triggered.

    Declaration

    Swift

    @objc
    func addBoundaryObserver(boundaries: [PKBoundary], observeOn dispatchQueue: DispatchQueue?, using block: @escaping (TimeInterval, Double) -> Void) -> UUID

    Parameters

    boundaries

    boundary objects.

    dispatchQueue

    dispatch queue to observe changes on (nil value will use main).

    block

    block to handle the observation with the observed boundary, block returns (time, boundary percentage).

    Return Value

    A uuid token to represent the observation, used to later remove a single observation.

  • removes a single periodic observer using the uuid provided when added the observation.

    Declaration

    Swift

    @objc
    func removePeriodicObserver(_ token: UUID)
  • removes a single boundary observer using the uuid provided when added the observation.

    Declaration

    Swift

    @objc
    func removeBoundaryObserver(_ token: UUID)
  • getController(ofType:) Extension method

    Getter for playkit controllers.

    Declaration

    Swift

    public func getController<T>(ofType type: T.Type) -> T? where T : PKController

    Parameters

    type

    Required class type.

    Return Value

    Relevant controller if exist.