ImaServerSideAdInsertionMediaSource.AdsLoader.Builder


public final class ImaServerSideAdInsertionMediaSource.AdsLoader.Builder


Builder for building an AdsLoader.

Summary

Public constructors

Builder(Context context, AdViewProvider adViewProvider)

Creates an instance.

Public methods

ImaServerSideAdInsertionMediaSource.AdsLoader

Returns a new AdsLoader.

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

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

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

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

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

Sets the optional state to resume with.

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

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

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder
@CanIgnoreReturnValue
setFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable)

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

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

Sets the IMA SDK settings.

ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

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

Public constructors

Builder

public Builder(Context context, AdViewProvider adViewProvider)

Creates an instance.

Parameters
Context context

A context.

AdViewProvider adViewProvider

A provider for ViewGroup instances.

Public methods

setAdErrorListener

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

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

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setAdEventListener

@CanIgnoreReturnValue
public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdEventListener(AdEvent.AdEventListener adEventListener)

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

Parameters
AdEvent.AdEventListener adEventListener

The ad event listener.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setAdsLoaderState

@CanIgnoreReturnValue
public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdsLoaderState(
    ImaServerSideAdInsertionMediaSource.AdsLoader.State state
)

Sets the optional state to resume with.

The state can be received when releasing the AdsLoader.

Parameters
ImaServerSideAdInsertionMediaSource.AdsLoader.State state

The state to resume with.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setCompanionAdSlots

@CanIgnoreReturnValue
public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setCompanionAdSlots(Collection<CompanionAdSlot> companionAdSlots)

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

Parameters
Collection<CompanionAdSlot> companionAdSlots

The slots to use for companion ads.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setFocusSkipButtonWhenAvailable

@CanIgnoreReturnValue
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
boolean focusSkipButtonWhenAvailable

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

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setImaSdkSettings

@CanIgnoreReturnValue
public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings)

Sets the IMA SDK settings.

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

Parameters
ImaSdkSettings imaSdkSettings

The ImaSdkSettings.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.

setStreamEventListener

@CanIgnoreReturnValue
public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setStreamEventListener(
    ImaServerSideAdInsertionMediaSource.StreamEventListener streamEventListener
)

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

Parameters
ImaServerSideAdInsertionMediaSource.StreamEventListener streamEventListener

The stream event listener.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

This builder, for convenience.