InstreamAdPlayer

@objc(YMAInstreamAdPlayer)
public protocol InstreamAdPlayer

This protocol is used for playing instream ads.

  1. delegate
  2. isPlaying
  3. duration
  4. position
  5. prepareAd(with:)
  6. playAd()
  7. pauseAd()
  8. resumeAd()
  9. stopAd()
  10. setVolume(_:)

delegate

Delegate object. For each event that happend during the playback, the corresponding callback must be called on this object.

Declaration

Swift

weak var delegate: InstreamAdPlayerDelegate? { get set }

isPlaying

Indicates whether the player is playing an ad.

Declaration

Swift

var isPlaying: Bool { get }

duration

Ad video duration in seconds.

Declaration

Swift

var duration: TimeInterval { get }

position

Ad video position in seconds.

Declaration

Swift

var position: TimeInterval { get }

prepareAd(with:)

Prepares player to play passed media file.

Declaration

Swift

func prepareAd(with videoAd: VideoAd)

Parameters

videoAd

Object providing information about current advertising. This object should be passed back in all callbacks to InstreamAdPlayerDelegate.

videoAd

Object providing information about current advertising. This object should be passed back in all callbacks to InstreamAdPlayerDelegate.

playAd()

Starts the ad.

Declaration

Swift

func playAd()

pauseAd()

Pauses the ad.

Declaration

Swift

func pauseAd()

resumeAd()

Resumes the ad.

Declaration

Swift

func resumeAd()

stopAd()

Stops the ad.

Declaration

Swift

func stopAd()

setVolume(_:)

Sets ad player volume to the passed value.

Declaration

Swift

func setVolume(_ level: Double)

Parameters

level

level of volume to set. The value should be between 0 and 1.

level

level of volume to set. The value should be between 0 and 1.