MediaPlayerState

@objc(AASDKMediaPlayerState)
public protocol MediaPlayerState : NSObjectProtocol

Protocol for a media player to conform to.

  • Reflects the current playback time in seconds for the content. This property is key-value observable from the SDK. NOTE: Please update this at 1sec intervals if possible. Make sure this returns the correct playbacktime, even when it is called between 2 updates. (e.g.: if currentPlayhead was set to 1 sec and then at 1.2 sec you call it again, it should return 1.2) In order to notify at 1 sec intervals and still return the correct playtime when randomly called, use ‘keyPathsForValuesAffectingValue’.

    Declaration

    Swift

    @objc
    dynamic var currentPlayhead: TimeInterval { get }
  • The media item total duration.

    Declaration

    Swift

    @objc
    var currentDuration: TimeInterval { get }
  • Reflects the current status for a player. This property is key-value observable from the SDK.

    Declaration

    Swift

    @objc
    dynamic var playerStatus: MediaPlayerStatus { get }
  • Reflects the last metadata from the player. This property is key-value observable from the SDK.

    Declaration

    Swift

    @objc
    dynamic var metadataItem: [AVMetadataItem]? { get }
  • Mark if buffering completed. This is optional.

    Declaration

    Swift

    @objc
    optional var bufferingCompleted: Bool { get }
  • Tells if the player continues buffering after it was paused.

    Declaration

    Swift

    @objc
    var isBufferingWhilePaused: Bool { get }
  • Reports the volume for the player. This value should be between [0..1]. A value of 0.0 indicates silence; a value of 1.0 (the default) indicates full audio volume for the player instance.

    Declaration

    Swift

    @objc
    dynamic var volume: Float { get }
  • Used for targetability purposes. If the player failed to play the content this can report the last error, otherwise, this should be nil.

    Declaration

    Swift

    @objc
    var lastError: Error? { get }
  • Used for targetability purposes. A list of player capabilities.

    Declaration

    Swift

    @objc
    var capabilities: Set<MediaPlayerCapability>? { get }
  • Used for targetability purposes. A list of player states as described by the IAB, which will help achieve better targetability.

    Declaration

    Swift

    @objc
    var stateInfo: Set<MediaPlayerCapability.State>? { get }