Class ImaServerSideAdInsertionUriBuilder
- java.lang.Object
-
- com.google.android.exoplayer2.ext.ima.ImaServerSideAdInsertionUriBuilder
-
public final class ImaServerSideAdInsertionUriBuilder extends Object
Builder for URI for IMA DAI streams. The resulting URI can be used to build amedia itemthat can be played by theImaServerSideAdInsertionMediaSource.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_LOAD_VIDEO_TIMEOUT_MSThe default timeout for loading the video URI, in milliseconds.@com.google.android.exoplayer2.C.ContentType intformat
-
Constructor Summary
Constructors Constructor Description ImaServerSideAdInsertionUriBuilder()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Uribuild()Builds a URI with the builder's current values.ImaServerSideAdInsertionUriBuildersetAdsId(String adsId)ImaServerSideAdInsertionUriBuildersetAdTagParameters(Map<String,String> adTagParameters)Sets the overridable ad tag parameters on the stream request.ImaServerSideAdInsertionUriBuildersetApiKey(String apiKey)The stream request API key.ImaServerSideAdInsertionUriBuildersetAssetKey(String assetKey)The stream request asset key used for live streams.ImaServerSideAdInsertionUriBuildersetAuthToken(String authToken)Sets the stream request authorization token.ImaServerSideAdInsertionUriBuildersetContentSourceId(String contentSourceId)The stream request content source ID used for on-demand streams.ImaServerSideAdInsertionUriBuildersetContentUrl(String contentUrl)Specifies the deep link to the content's screen.ImaServerSideAdInsertionUriBuildersetFormat(@com.google.android.exoplayer2.C.ContentType int format)Sets the format of the stream request.ImaServerSideAdInsertionUriBuildersetLoadVideoTimeoutMs(int loadVideoTimeoutMs)Sets the duration after which resolving the video URI should time out, in milliseconds.ImaServerSideAdInsertionUriBuildersetManifestSuffix(String manifestSuffix)Sets the optional stream manifest's suffix, which will be appended to the stream manifest's URL.ImaServerSideAdInsertionUriBuildersetStreamActivityMonitorId(String streamActivityMonitorId)Sets the ID to be used to debug the stream with the stream activity monitor.ImaServerSideAdInsertionUriBuildersetVideoId(String videoId)The stream request video ID used for on-demand streams.
-
-
-
Field Detail
-
DEFAULT_LOAD_VIDEO_TIMEOUT_MS
public static final int DEFAULT_LOAD_VIDEO_TIMEOUT_MS
The default timeout for loading the video URI, in milliseconds.- See Also:
- Constant Field Values
-
format
@ContentType public @com.google.android.exoplayer2.C.ContentType int format
-
-
Method Detail
-
setAdsId
public ImaServerSideAdInsertionUriBuilder setAdsId(String adsId)
An opaque identifier for associated ad playback state, ornullif theasset key(for live) orvideo id(for VOD) should be used as the ads identifier.- Parameters:
adsId- The ads identifier.- Returns:
- This instance, for convenience.
-
setAssetKey
public ImaServerSideAdInsertionUriBuilder setAssetKey(@Nullable String assetKey)
The stream request asset key used for live streams.- Parameters:
assetKey- Live stream asset key.- Returns:
- This instance, for convenience.
-
setAuthToken
public ImaServerSideAdInsertionUriBuilder setAuthToken(@Nullable String authToken)
Sets the stream request authorization token. Used in place ofthe API keyfor stricter content authorization. The publisher can control individual content streams authorizations based on this token.- Parameters:
authToken- Live stream authorization token.- Returns:
- This instance, for convenience.
-
setContentSourceId
public ImaServerSideAdInsertionUriBuilder setContentSourceId(@Nullable String contentSourceId)
The stream request content source ID used for on-demand streams.- Parameters:
contentSourceId- VOD stream content source id.- Returns:
- This instance, for convenience.
-
setVideoId
public ImaServerSideAdInsertionUriBuilder setVideoId(@Nullable String videoId)
The stream request video ID used for on-demand streams.- Parameters:
videoId- VOD stream video id.- Returns:
- This instance, for convenience.
-
setFormat
public ImaServerSideAdInsertionUriBuilder setFormat(@ContentType @com.google.android.exoplayer2.C.ContentType int format)
Sets the format of the stream request.- Parameters:
format- VOD or live stream type.- Returns:
- This instance, for convenience.
-
setApiKey
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:
apiKey- Stream api key.- Returns:
- This instance, for convenience.
-
setStreamActivityMonitorId
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:
streamActivityMonitorId- ID for debugging the stream with the stream activity monitor.- Returns:
- This instance, for convenience.
-
setAdTagParameters
public ImaServerSideAdInsertionUriBuilder setAdTagParameters(Map<String,String> 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:
adTagParameters- A map of extra parameters to pass to the ad server.- Returns:
- This instance, for convenience.
-
setManifestSuffix
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:
manifestSuffix- Stream manifest's suffix.- Returns:
- This instance, for convenience.
-
setContentUrl
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:
contentUrl- Deep link to the content's screen.- Returns:
- This instance, for convenience.
-
setLoadVideoTimeoutMs
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_MSmilliseconds.- Parameters:
loadVideoTimeoutMs- The timeout after which to give up resolving the video URI.- Returns:
- This instance, for convenience.
-
build
public Uri build()
Builds a URI with the builder's current values.- Returns:
- The build
Uri. - Throws:
IllegalStateException- If the builder has missing or invalid inputs.
-
-