AdsRequest

public interface AdsRequest extends BaseRequest


An object containing the data used to request ads from the server.

Summary

Public methods

abstract String

Returns the URL from which ads will be requested.

abstract ContentProgressProvider

Returns the progress provider that will be used to schedule ad breaks.

abstract String

This method is deprecated.

Extra parameters are not used by the SDK.

abstract Map<StringString>

This method is deprecated.

Extra parameters are not used by the SDK.

abstract void
setAdTagUrl(String adTagUrl)

Sets the URL from which ads will be requested.

abstract void
setAdWillAutoPlay(boolean willAutoPlay)

Notifies the SDK whether the player intends to start the content and ad in response to a user action or whether it will be automatically played.

abstract void
setAdWillPlayMuted(boolean willPlayMuted)

Notifies the SDK whether the player intends to start the content and ad while muted.

abstract void
setAdsResponse(String cannedAdResponse)

Specifies a VAST, VMAP, or ad rules response to be used instead of making a request through an ad tag URL.

abstract void
setContentDuration(float duration)

Specifies the duration of the content in seconds to be shown.

abstract void

Specifies the keywords used to describe the content to be shown.

abstract void
setContentProgressProvider(
    ContentProgressProvider contentProgressProvider
)

Attaches a ContentProgressProvider instance to allow scheduling ad breaks based on content progress (cue points).

abstract void

Specifies the title of the content to be shown.

abstract void
setContinuousPlayback(boolean continuousPlayback)

Notifies the SDK whether the player intends to continuously play the content videos one after another similar to TV broadcast.

abstract void

This method is deprecated.

Extra parameters are not used by the SDK.

abstract void
setLiveStreamPrefetchSeconds(float prefetchTime)

Specifies the maximum amount of time to wait in seconds, after calling requestAds, before requesting the ad tag URL.

abstract void
setVastLoadTimeout(float timeout)

Specifies the VAST load timeout in milliseconds for a single wrapper.

Inherited methods

From com.google.ads.interactivemedia.v3.api.BaseRequest
abstract String

Returns the deep link to the content's screen provided in setContentUrl()

abstract @Nullable SecureSignals

Returns the Secure Signals with custom data

abstract Object

Returns the user-provided object that is associated with the request.

abstract void

Specifies the deep link to the content's screen.

abstract void

Specifies the Secure Signals with custom data for this request.

abstract void
setUserRequestContext(Object userRequestContext)

Sets the user-provided object that is associated with the request.

Public methods

getAdTagUrl

abstract String getAdTagUrl()

Returns the URL from which ads will be requested.

getContentProgressProvider

abstract ContentProgressProvider getContentProgressProvider()

Returns the progress provider that will be used to schedule ad breaks.

getExtraParameter

abstract String getExtraParameter(String key)

Returns null, this is a no-op.

getExtraParameters

abstract Map<StringStringgetExtraParameters()

Returns null, this is a no-op.

setAdTagUrl

abstract void setAdTagUrl(String adTagUrl)

Sets the URL from which ads will be requested. For details on constructing the ad tag url, see Create a main ad video tag manually. Either this or an ads response is required.

setAdWillAutoPlay

abstract void setAdWillAutoPlay(boolean willAutoPlay)

Notifies the SDK whether the player intends to start the content and ad in response to a user action or whether it will be automatically played. Not calling this function leaves the setting as unknown. Note: Changing this setting will have no impact on ad playback.

Parameters
boolean willAutoPlay

Set to true if the ad will be autoplayed by the player, or false if playback is triggered by a user response.

setAdWillPlayMuted

abstract void setAdWillPlayMuted(boolean willPlayMuted)

Notifies the SDK whether the player intends to start the content and ad while muted. Not calling this function leaves the setting as unknown. Note: Changing this setting will have no impact on ad playback.

Parameters
boolean willPlayMuted

Set to true if the ad will be played while muted, or false if the ad will have volume greater than 0.

setAdsResponse

abstract void setAdsResponse(String cannedAdResponse)

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. Either this or an ad tag URL is required.

setContentDuration

abstract void setContentDuration(float duration)

Specifies the duration of the content in seconds to be shown. This optional parameter is used by AdX requests. It is recommended for AdX users.

setContentKeywords

abstract void setContentKeywords(List<String> keywords)

Specifies the keywords used to describe the content to be shown. This optional parameter is used by AdX requests and is recommended for AdX users.

setContentProgressProvider

abstract void setContentProgressProvider(
    ContentProgressProvider contentProgressProvider
)

Attaches a ContentProgressProvider instance to allow scheduling ad breaks based on content progress (cue points).

setContentTitle

abstract void setContentTitle(String title)

Specifies the title of the content to be shown. Used in AdX requests. This optional parameter is used by AdX requests and is recommended for AdX users.

setContinuousPlayback

abstract void setContinuousPlayback(boolean continuousPlayback)

Notifies the SDK 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.

Parameters
boolean continuousPlayback

Set to true if the content video is played one after another continuously.

setExtraParameter

abstract void setExtraParameter(String key, String value)

No-op.

setLiveStreamPrefetchSeconds

abstract void setLiveStreamPrefetchSeconds(float prefetchTime)

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.

setVastLoadTimeout

abstract void setVastLoadTimeout(float timeout)

Specifies the VAST load timeout in milliseconds for a single wrapper. This parameter is optional and will override the default timeout, currently set to 5000ms.