GoogleInteractiveMediaAds Framework Reference

  • IMAAVPlayerVideoDisplay is an implementation of the IMAVideoDisplay protocol, designed to initialize with and reuse the content player for ad playback.

  • It offers a playerVideoDisplayDelegate property for receiving IMAAVPlayerVideoDisplay-specific events.

  • Subtitles for the stream are accessible via the subtitles property but are only available after the stream begins playing.

  • The streamAssetOptions property allows customization of AVURLAsset initialization for streams, impacting only stream playback and not client-side ads.

  • Initialization requires an AVPlayer instance passed during creation using the initWithAVPlayer: method.

IMAAVPlayerVideoDisplay

@interface IMAAVPlayerVideoDisplay : NSObject <IMAVideoDisplay>

An implementation of the IMAVideoDisplay protocol. This object is intended to be initialized with the content player, and will reuse the player for playing ads.

  • Allows the publisher to receive IMAAVPlayerVideoDisplay specific events.

    Declaration

    Swift

    weak var playerVideoDisplayDelegate: (any IMAAVPlayerVideoDisplayDelegate)? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) id<IMAAVPlayerVideoDisplayDelegate> playerVideoDisplayDelegate;
  • The subtitles for the current stream. Will be nil until the stream starts playing.

    Declaration

    Swift

    var subtitles: [Any]? { get }

    Objective-C

    @property (nonatomic, readonly, nullable) NSArray *subtitles;
  • A dictionary that contains options used to customize the initialization of an AVURLAsset for stream playback. Has no effect on client-side ads.

    Declaration

    Swift

    var streamAssetOptions: [String : Any]? { get set }

    Objective-C

    @property (nonatomic, copy, nullable) NSDictionary<NSString *, id> *streamAssetOptions;
  • Creates an IMAAVPlayerVideoDisplay that will play ads in the passed in content player.

    Declaration

    Swift

    init(avPlayer player: AVPlayer)

    Objective-C

    - (nonnull instancetype)initWithAVPlayer:(nonnull AVPlayer *)player;

    Parameters

    player

    the AVPlayer instance used for playing content

    Return Value

    an IMAAVPlayerVideoDisplay instance