public final class

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

Overview

Builder for building an ImaServerSideAdInsertionMediaSource.AdsLoader.

Summary

Constructors
publicBuilder(Context context, AdViewProvider adViewProvider)

Creates an instance.

Methods
public ImaServerSideAdInsertionMediaSource.AdsLoaderbuild()

Returns a new ImaServerSideAdInsertionMediaSource.AdsLoader.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetAdErrorListener(AdErrorEvent.AdErrorListener adErrorListener)

Sets the optional that will be passed to when the stream manager becomes available.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetAdEventListener(AdEventListener adEventListener)

Sets the optional that will be passed to when the stream manager becomes available.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetAdsLoaderState(ImaServerSideAdInsertionMediaSource.AdsLoader.State state)

Sets the optional state to resume with.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetCompanionAdSlots(java.util.Collection<CompanionAdSlot> companionAdSlots)

Sets the slots to use for companion ads, if they are present in the loaded ad.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable)

Sets whether to focus the skip button (when available) on Android TV devices.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetImaSdkSettings(ImaSdkSettings imaSdkSettings)

Sets the IMA SDK settings.

public ImaServerSideAdInsertionMediaSource.AdsLoader.BuildersetStreamEventListener(ImaServerSideAdInsertionMediaSource.StreamEventListener streamEventListener)

Sets the optional ImaServerSideAdInsertionMediaSource.StreamEventListener that will be called for stream events.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context, AdViewProvider adViewProvider)

Creates an instance.

Parameters:

context: A context.
adViewProvider: A provider for ViewGroup instances.

Methods

public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings)

Sets the IMA SDK settings.

If this method is not called, the will be used with the language set to the preferred system language.

Parameters:

imaSdkSettings: The .

Returns:

This builder, for convenience.

Sets the optional ImaServerSideAdInsertionMediaSource.StreamEventListener that will be called for stream events.

Parameters:

streamEventListener: The stream event listener.

Returns:

This builder, for convenience.

public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdEventListener(AdEventListener adEventListener)

Sets the optional that will be passed to when the stream manager becomes available.

Note: This method can be considered a stable API as long as the is provided by the IMA library. We can't declare this method stable because we don't have the same guarantee from the library we depend on.

Parameters:

adEventListener: The ad event listener.

Returns:

This builder, for convenience.

public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdErrorListener(AdErrorEvent.AdErrorListener adErrorListener)

Sets the optional that will be passed to when the stream manager becomes available.

Note: This method can be considered a stable API as long as the is provided by the IMA library. We can't declare this method stable because we don't have the same guarantee from the library we depend on.

Parameters:

adErrorListener: The .

Returns:

This builder, for convenience.

public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setCompanionAdSlots(java.util.Collection<CompanionAdSlot> companionAdSlots)

Sets the slots to use for companion ads, if they are present in the loaded ad.

Parameters:

companionAdSlots: The slots to use for companion ads.

Returns:

This builder, for convenience.

See also:

Sets the optional state to resume with.

The state can be received when releasing the ImaServerSideAdInsertionMediaSource.AdsLoader.

Parameters:

state: The state to resume with.

Returns:

This builder, for convenience.

public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable)

Sets whether to focus the skip button (when available) on Android TV devices. The default setting is true.

Parameters:

focusSkipButtonWhenAvailable: Whether to focus the skip button (when available) on Android TV devices.

Returns:

This builder, for convenience.

See also:

Returns a new ImaServerSideAdInsertionMediaSource.AdsLoader.