ImaServerSideAdInsertionMediaSource.AdsLoader.Builder


class ImaServerSideAdInsertionMediaSource.AdsLoader.Builder


Builder for building an AdsLoader.

Summary

Public constructors

Builder(context: Context!, adViewProvider: AdViewProvider!)

Creates an instance.

Public functions

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!

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

Builder(context: Context!, adViewProvider: AdViewProvider!)

Creates an instance.

Parameters
context: Context!

A context.

adViewProvider: AdViewProvider!

A provider for ViewGroup instances.

Public functions

setAdErrorListener

@UnstableApi
@CanIgnoreReturnValue
fun setAdErrorListener(adErrorListener: AdErrorEvent.AdErrorListener!): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

Sets the optional AdErrorEvent.AdErrorListener that will be passed to addAdErrorListener 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: AdErrorEvent.AdErrorListener!

The AdErrorEvent.AdErrorListener.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.

setAdEventListener

@UnstableApi
@CanIgnoreReturnValue
fun setAdEventListener(adEventListener: AdEvent.AdEventListener!): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

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

Note: This method can be considered a stable API as long as the AdEventListener 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: AdEvent.AdEventListener!

The ad event listener.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.

setAdsLoaderState

@CanIgnoreReturnValue
fun setAdsLoaderState(
    state: ImaServerSideAdInsertionMediaSource.AdsLoader.State!
): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

Sets the optional state to resume with.

The state can be received when releasing the AdsLoader.

Parameters
state: ImaServerSideAdInsertionMediaSource.AdsLoader.State!

The state to resume with.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.

setCompanionAdSlots

@UnstableApi
@CanIgnoreReturnValue
fun setCompanionAdSlots(
    companionAdSlots: (Mutable)Collection<CompanionAdSlot!>!
): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

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

Parameters
companionAdSlots: (Mutable)Collection<CompanionAdSlot!>!

The slots to use for companion ads.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.

setFocusSkipButtonWhenAvailable

@UnstableApi
@CanIgnoreReturnValue
fun setFocusSkipButtonWhenAvailable(focusSkipButtonWhenAvailable: Boolean): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

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

Parameters
focusSkipButtonWhenAvailable: Boolean

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

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.

setImaSdkSettings

@UnstableApi
@CanIgnoreReturnValue
fun setImaSdkSettings(imaSdkSettings: ImaSdkSettings!): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

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

@UnstableApi
@CanIgnoreReturnValue
fun setStreamEventListener(
    streamEventListener: ImaServerSideAdInsertionMediaSource.StreamEventListener!
): ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

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

Parameters
streamEventListener: ImaServerSideAdInsertionMediaSource.StreamEventListener!

The stream event listener.

Returns
ImaServerSideAdInsertionMediaSource.AdsLoader.Builder!

This builder, for convenience.