ImaServerSideAdInsertionUriBuilder


@UnstableApi
public final class ImaServerSideAdInsertionUriBuilder


Builder for URI for IMA DAI streams. The resulting URI can be used to build a media item that can be played by the .

Summary

Constants

static final int

The default timeout for loading the video URI, in milliseconds.

Public fields

int

Public constructors

Creates a new instance.

Public methods

Uri

Builds a URI with the builder's current values.

ImaServerSideAdInsertionUriBuilder

Sets the overridable ad tag parameters on the stream request.

ImaServerSideAdInsertionUriBuilder

An opaque identifier for associated ad playback state, or null if the asset key (for live) or video id (for VOD) should be used as the ads identifier.

ImaServerSideAdInsertionUriBuilder

The stream request API key.

ImaServerSideAdInsertionUriBuilder

The stream request asset key used for live streams.

ImaServerSideAdInsertionUriBuilder

Sets the stream request authorization token.

ImaServerSideAdInsertionUriBuilder

The stream request content source ID used for on-demand streams.

ImaServerSideAdInsertionUriBuilder

Specifies the deep link to the content's screen.

ImaServerSideAdInsertionUriBuilder

Sets the format of the stream request.

ImaServerSideAdInsertionUriBuilder

Sets the duration after which resolving the video URI should time out, in milliseconds.

ImaServerSideAdInsertionUriBuilder

Sets the optional stream manifest's suffix, which will be appended to the stream manifest's URL.

ImaServerSideAdInsertionUriBuilder

Sets the ID to be used to debug the stream with the stream activity monitor.

ImaServerSideAdInsertionUriBuilder

The stream request video ID used for on-demand streams.

Constants

DEFAULT_LOAD_VIDEO_TIMEOUT_MS

public static final int DEFAULT_LOAD_VIDEO_TIMEOUT_MS = 10000

The default timeout for loading the video URI, in milliseconds.

Public fields

format

@C.ContentType
public int format

Public constructors

ImaServerSideAdInsertionUriBuilder

public ImaServerSideAdInsertionUriBuilder()

Creates a new instance.

Public methods

build

public Uri build()

Builds a URI with the builder's current values.

Returns
Uri

The build Uri.

Throws
java.lang.IllegalStateException

If the builder has missing or invalid inputs.

setAdTagParameters

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAdTagParameters(Map<StringString> adTagParameters)

Sets the overridable ad tag parameters on the stream request. Supply targeting parameters to your stream provides more information.

You can use the dai-ot and dai-ov parameters for stream variant preference. See Override Stream Variant Parameters for more information.

Parameters
Map<StringString> adTagParameters

A map of extra parameters to pass to the ad server.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setAdsId

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAdsId(String adsId)

An opaque identifier for associated ad playback state, or null if the asset key (for live) or video id (for VOD) should be used as the ads identifier.

Parameters
String adsId

The ads identifier.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setApiKey

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setApiKey(@Nullable String apiKey)

The stream request API key. This is used for content authentication. The API key is provided to the publisher to unlock their content. It's a security measure used to verify the applications that are attempting to access the content.

Parameters
@Nullable String apiKey

Stream api key.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setAssetKey

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAssetKey(@Nullable String assetKey)

The stream request asset key used for live streams.

Parameters
@Nullable String assetKey

Live stream asset key.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setAuthToken

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAuthToken(@Nullable String authToken)

Sets the stream request authorization token. Used in place of the API key for stricter content authorization. The publisher can control individual content streams authorizations based on this token.

Parameters
@Nullable String authToken

Live stream authorization token.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setContentSourceId

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setContentSourceId(@Nullable String contentSourceId)

The stream request content source ID used for on-demand streams.

Parameters
@Nullable String contentSourceId

VOD stream content source id.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setContentUrl

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setContentUrl(@Nullable String contentUrl)

Specifies the deep link to the content's screen. If provided, this parameter is passed to the OM SDK. See Android documentation for more information.

Parameters
@Nullable String contentUrl

Deep link to the content's screen.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setFormat

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setFormat(@C.ContentType int format)

Sets the format of the stream request.

Parameters
@C.ContentType int format

TYPE_DASH or TYPE_HLS.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setLoadVideoTimeoutMs

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setLoadVideoTimeoutMs(int loadVideoTimeoutMs)

Sets the duration after which resolving the video URI should time out, in milliseconds.

The default is DEFAULT_LOAD_VIDEO_TIMEOUT_MS milliseconds.

Parameters
int loadVideoTimeoutMs

The timeout after which to give up resolving the video URI.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setManifestSuffix

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setManifestSuffix(@Nullable String manifestSuffix)

Sets the optional stream manifest's suffix, which will be appended to the stream manifest's URL. The provided string must be URL-encoded and must not include a leading question mark.

Parameters
@Nullable String manifestSuffix

Stream manifest's suffix.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setStreamActivityMonitorId

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setStreamActivityMonitorId(@Nullable String streamActivityMonitorId)

Sets the ID to be used to debug the stream with the stream activity monitor. This is used to provide a convenient way to allow publishers to find a stream log in the stream activity monitor tool.

Parameters
@Nullable String streamActivityMonitorId

ID for debugging the stream with the stream activity monitor.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.

setVideoId

@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setVideoId(@Nullable String videoId)

The stream request video ID used for on-demand streams.

Parameters
@Nullable String videoId

VOD stream video id.

Returns
ImaServerSideAdInsertionUriBuilder

This instance, for convenience.