GoogleInteractiveMediaAds Framework Reference

IMAAdsRequest

@interface IMAAdsRequest : NSObject

Data class describing the ad request.

  • Specifies the full URL to use for ads loading from an ad server. Required for any adsRequest. For details on constructing the ad tag url, see Create a master video tag manually.

    Declaration

    Swift

    var adTagUrl: String! { get }

    Objective-C

    @property (readonly, copy, nonatomic) NSString *adTagUrl;
  • Specifies a VAST, VMAP, or ad rules response to be used instead of making a request via an ad tag URL. This can be useful for debugging and other situations in which an ad response is already available.

    Declaration

    Swift

    var adsResponse: String! { get }

    Objective-C

    @property (readonly, copy, nonatomic) NSString *adsResponse;
  • The ad display container.

    Declaration

    Swift

    var adDisplayContainer: IMAAdDisplayContainer! { get }

    Objective-C

    @property (readonly, strong, nonatomic)
        IMAAdDisplayContainer *adDisplayContainer;
  • The user context.

    Declaration

    Swift

    var userContext: Any! { get }

    Objective-C

    @property (readonly, strong, nonatomic) id userContext;
  • Specifies whether the player intends to start the content and ad in response to a user action or whether they will be automatically played. Changing this setting will have no impact on ad playback.

    Declaration

    Swift

    var adWillAutoPlay: Bool { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL adWillAutoPlay;
  • Specifies whether the player intends to start the content and ad with no volume. Changing this setting will have no impact on ad playback.

    Declaration

    Swift

    var adWillPlayMuted: Bool { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL adWillPlayMuted;
  • Specifies whether the player intends to continuously play the content videos one after another similar to TV broadcast. Not calling this function leaves the setting as unknown. Note: Changing this setting will have no impact on ad playback.

    Declaration

    Swift

    var continuousPlayback: Bool { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL continuousPlayback;
  • Specifies the duration of the content in seconds to be shown. Used in AdX requests. This parameter is optional.

    Declaration

    Swift

    var contentDuration: Float { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) float contentDuration;
  • Specifies the keywords used to describe the content to be shown. Used in AdX requests. This parameter is optional.

    Declaration

    Swift

    var contentKeywords: [String]! { get set }

    Objective-C

    @property (readwrite, copy, nonatomic) NSArray<NSString *> *contentKeywords;
  • Specifies the title of the content to be shown. Used in AdX requests. This parameter is optional.

    Declaration

    Swift

    var contentTitle: String! { get set }

    Objective-C

    @property (readwrite, copy, nonatomic) NSString *contentTitle;
  • Specifies the VAST load timeout in milliseconds for the initial request and any subsequent wrappers. This parameter is optional and will override the default timeout.

    Declaration

    Swift

    var vastLoadTimeout: Float { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) float vastLoadTimeout;
  • Specifies the maximum amount of time to wait in seconds, after calling requestAds, before requesting the ad tag URL. This can be used to stagger requests during a live-stream event, in order to mitigate spikes in the number of requests.

    Declaration

    Swift

    var liveStreamPrefetchSeconds: Float { get set }

    Objective-C

    @property (assign, readwrite, nonatomic) float liveStreamPrefetchSeconds;
  • Initializes an ads request instance with the given canned ads response and ad display container with Picture-in-Picture support. Serial ad requests may reuse the same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its current adsManager. Concurrent requests must use different ad containers.

    Declaration

    Swift

    convenience init!(adsResponse: String!, adDisplayContainer: IMAAdDisplayContainer!, avPlayerVideoDisplay: IMAAVPlayerVideoDisplay!, pictureInPictureProxy: IMAPictureInPictureProxy!, userContext: Any!)

    Objective-C

    - (instancetype)
          initWithAdsResponse:(NSString *)adsResponse
           adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer
         avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay
        pictureInPictureProxy:(IMAPictureInPictureProxy *)pictureInPictureProxy
                  userContext:(id)userContext;

    Parameters

    adsResponse

    the canned ads response

    adDisplayContainer

    the IMAAdDisplayContainer for rendering the ad UI

    avPlayerVideoDisplay

    the IMAAVPlayerVideoDisplay for rendering ads

    pictureInPictureProxy

    the IMAPictureInPictureProxy for tracking PIP events

    userContext

    the user context for tracking requests (optional)

    Return Value

    the IMAAdsRequest instance

  • Initializes an ads request instance with the given canned ads response and ad display container. Serial ad requests may reuse the same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its current adsManager. Concurrent requests must use different ad containers. Does not support Picture-in-Picture.

    Declaration

    Objective-C

    - (instancetype)initWithAdsResponse:(NSString *)adsResponse
                     adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer
                        contentPlayhead:
                            (NSObject<IMAContentPlayhead> *)contentPlayhead
                            userContext:(id)userContext;

    Parameters

    adsResponse

    the canned ads response

    adDisplayContainer

    the IMAAdDisplayContainer for rendering the ad UI

    contentPlayhead

    the IMAContentPlayhead for the content player (optional)

    userContext

    the user context for tracking requests (optional)

    Return Value

    the IMAAdsRequest instance

  • Initializes an ads request instance with the given ad tag URL and ad display container with Picture-in-Picture support. Serial ad requests may reuse the same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its current adsManager. Concurrent requests must use different ad containers.

    Declaration

    Swift

    convenience init!(adTagUrl: String!, adDisplayContainer: IMAAdDisplayContainer!, avPlayerVideoDisplay: IMAAVPlayerVideoDisplay!, pictureInPictureProxy: IMAPictureInPictureProxy!, userContext: Any!)

    Objective-C

    - (instancetype)initWithAdTagUrl:(NSString *)adTagUrl
                  adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer
                avPlayerVideoDisplay:(IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay
               pictureInPictureProxy:
                   (IMAPictureInPictureProxy *)pictureInPictureProxy
                         userContext:(id)userContext;

    Parameters

    adTagUrl

    the ad tag URL

    adDisplayContainer

    the IMAAdDisplayContainer for rendering the ad UI

    avPlayerVideoDisplay

    the IMAAVPlayerVideoDisplay for rendering ads

    pictureInPictureProxy

    the IMAPictureInPictureProxy for tracking PIP events

    userContext

    the user context for tracking requests (optional)

    Return Value

    the IMAAdsRequest instance

  • Initializes an ads request instance with the given ad tag URL and ad display container. Serial ad requests may reuse the same IMAAdDisplayContainer by first calling [IMAAdsManager destroy] on its current adsManager. Concurrent requests must use different ad containers. Does not support Picture-in-Picture.

    Declaration

    Objective-C

    - (instancetype)initWithAdTagUrl:(NSString *)adTagUrl
                  adDisplayContainer:(IMAAdDisplayContainer *)adDisplayContainer
                     contentPlayhead:(NSObject<IMAContentPlayhead> *)contentPlayhead
                         userContext:(id)userContext;

    Parameters

    adTagUrl

    the ad tag URL

    adDisplayContainer

    the IMAAdDisplayContainer for rendering the ad UI

    contentPlayhead

    the IMAContentPlayhead for the content player (optional)

    userContext

    the user context for tracking requests (optional)

    Return Value

    the IMAAdsRequest instance