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 main ad video tag manually.

    Declaration

    Swift

    var adTagUrl: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *adTagUrl;
  • Specifies a VAST, VMAP, or ad rules response to be used instead of making a request through 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 (nonatomic, copy, readonly, nullable) NSString *adsResponse;
  • The ad display container.

    Declaration

    Swift

    var adDisplayContainer: IMAAdDisplayContainer { get }

    Objective-C

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

    Declaration

    Swift

    var userContext: Any? { get }

    Objective-C

    @property (nonatomic, readonly, nullable) 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 (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 (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 (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 (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 (nonatomic, copy, nullable) 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 (nonatomic, copy, nullable) NSString *contentTitle;
  • Specifies the Secure Signal with custom data for this ads request. Secure Signal with custom data is an encrypted blob containing signals collected by the publisher and previously agreed upon by the publisher and bidder. The Secure Signal with custom data can be cleared out by passing null to this function.

    Declaration

    Swift

    var secureSignals: IMASecureSignals? { get set }

    Objective-C

    @property (nonatomic, strong, nullable) IMASecureSignals *secureSignals;
  • Specifies the universal link to the content’s screen. If provided, this parameter is passed to the OM SDK. See Apple documentation for more information.

    Declaration

    Swift

    var contentURL: URL? { get set }

    Objective-C

    @property (nonatomic, copy, nullable) NSURL *contentURL;
  • 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 (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 (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

    - (nonnull instancetype)
          initWithAdsResponse:(nonnull NSString *)adsResponse
           adDisplayContainer:(nonnull IMAAdDisplayContainer *)adDisplayContainer
         avPlayerVideoDisplay:
             (nonnull IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay
        pictureInPictureProxy:
            (nonnull IMAPictureInPictureProxy *)pictureInPictureProxy
                  userContext:(nullable 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

    Swift

    init(adsResponse: String, adDisplayContainer: IMAAdDisplayContainer, contentPlayhead: (any NSObjectProtocol & IMAContentPlayhead)?, userContext: Any?)

    Objective-C

    - (nonnull instancetype)
        initWithAdsResponse:(nonnull NSString *)adsResponse
         adDisplayContainer:(nonnull IMAAdDisplayContainer *)adDisplayContainer
            contentPlayhead:(nullable NSObject<IMAContentPlayhead> *)contentPlayhead
                userContext:(nullable 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

    - (nonnull instancetype)initWithAdTagUrl:(nonnull NSString *)adTagUrl
                          adDisplayContainer:
                              (nonnull IMAAdDisplayContainer *)adDisplayContainer
                        avPlayerVideoDisplay:
                            (nonnull IMAAVPlayerVideoDisplay *)avPlayerVideoDisplay
                       pictureInPictureProxy:
                           (nonnull IMAPictureInPictureProxy *)pictureInPictureProxy
                                 userContext:(nullable 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

    Swift

    init(adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, contentPlayhead: (any NSObjectProtocol & IMAContentPlayhead)?, userContext: Any?)

    Objective-C

    - (nonnull instancetype)
          initWithAdTagUrl:(nonnull NSString *)adTagUrl
        adDisplayContainer:(nonnull IMAAdDisplayContainer *)adDisplayContainer
           contentPlayhead:(nullable NSObject<IMAContentPlayhead> *)contentPlayhead
               userContext:(nullable 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