ImaSdkFactory

public class ImaSdkFactory extends Object

Factory class for creating SDK objects.

Public Method Summary

AdDisplayContainer
createAdDisplayContainer()
This method is deprecated. Please use createAdDisplayContainer(ViewGroup container, VideoAdPlayer player) instead.
static AdDisplayContainer
createAdDisplayContainer(ViewGroup container, VideoAdPlayer player)
Creates an AdDisplayContainer to hold the player for video ads, a container for non-linear ads, and slots for companion ads.
AdsLoader
createAdsLoader(Context context, ImaSdkSettings settings, AdDisplayContainer container)
Creates an AdsLoader for requesting ads using the specified settings object.
AdsLoader
createAdsLoader(Context context, ImaSdkSettings settings, StreamDisplayContainer container)
Creates an AdsLoader for requesting server-side ad insertion ads using the specified settings object.
AdsRenderingSettings
createAdsRenderingSettings()
Creates an AdsRenderingSettings object to give the AdsManager parameters that control the rendering of ads.
AdsRequest
createAdsRequest()
Creates an AdsRequest object to contain the data used to request ads.
static AdDisplayContainer
createAudioAdDisplayContainer(Context context, VideoAdPlayer player)
Creates an AdDisplayContainer for audio ads.
AdDisplayContainer
createAudioAdDisplayContainer(Context context)
This method is deprecated. Please use createAudioAdDisplayContainer(ViewGroup container, VideoAdPlayer player) instead.
CompanionAdSlot
createCompanionAdSlot()
Creates a CompanionAdSlot for the SDK to fill with companion ads.
FriendlyObstruction
createFriendlyObstruction(View view, FriendlyObstructionPurpose purpose, String detailedReason)
Creates a FriendlyObstruction object to describe an obstruction considered "friendly" for viewability measurement purposes.
ImaSdkSettings
createImaSdkSettings()
Creates an ImaSdkSettings object for configuring the IMA SDK.
StreamRequest
createLiveStreamRequest(String assetKey, String apiKey)
Creates a StreamRequest object to contain the data used to request a server-side ad insertion live stream.
static VideoAdPlayer
createSdkOwnedPlayer(Context context, ViewGroup container)
This method is deprecated. This method is provided as a bridge for developers, until they begin using their own implementation of VideoAdPlayer. For those who do not wish to write their own player, they should use the ExoPlayer IMA Extension.
StreamDisplayContainer
createStreamDisplayContainer()
This method is deprecated. Please use createStreamDisplayContainer(ViewGroup container, VideoStreamPlayer player) instead.
static StreamDisplayContainer
createStreamDisplayContainer(ViewGroup container, VideoStreamPlayer player)
Creates a StreamDisplayContainer to hold the player for server-side ad insertion streams and slots for companion ads.
StreamRequest
createVodStreamRequest(String contentSourceId, String videoId, String apiKey)
Creates a StreamRequest object to contain the data used to request a server-side ad insertion video on demand stream.
static ImaSdkFactory
getInstance()
Returns the global ImaSdkFactory object.

Inherited Method Summary

Public Methods

public AdDisplayContainer createAdDisplayContainer ()

This method is deprecated.
Please use createAdDisplayContainer(ViewGroup container, VideoAdPlayer player) instead.

Creates an AdDisplayContainer to hold the player for video ads, a container for non-linear ads, and slots for companion ads.

public static AdDisplayContainer createAdDisplayContainer (ViewGroup container, VideoAdPlayer player)

Creates an AdDisplayContainer to hold the player for video ads, a container for non-linear ads, and slots for companion ads.

Parameters
container
player

public AdsLoader createAdsLoader (Context context, ImaSdkSettings settings, AdDisplayContainer container)

Creates an AdsLoader for requesting ads using the specified settings object. This is the ONLY way to specify a non-default language for the Ad UI.

Parameters
context
settings
container

public AdsLoader createAdsLoader (Context context, ImaSdkSettings settings, StreamDisplayContainer container)

Creates an AdsLoader for requesting server-side ad insertion ads using the specified settings object. This is the ONLY way to specify a non-default language for the Ad UI.

Parameters
context
settings
container

public AdsRenderingSettings createAdsRenderingSettings ()

Creates an AdsRenderingSettings object to give the AdsManager parameters that control the rendering of ads.

public AdsRequest createAdsRequest ()

Creates an AdsRequest object to contain the data used to request ads.

public static AdDisplayContainer createAudioAdDisplayContainer (Context context, VideoAdPlayer player)

Creates an AdDisplayContainer for audio ads. In order to properly handle companion ads this should be created in the same process as your main Activity.

Parameters
context
player

public AdDisplayContainer createAudioAdDisplayContainer (Context context)

This method is deprecated.
Please use createAudioAdDisplayContainer(ViewGroup container, VideoAdPlayer player) instead.

Creates an AdDisplayContainer for audio ads. In order to properly handle companion ads this should be created in the same process as your main Activity.

Parameters
context

public CompanionAdSlot createCompanionAdSlot ()

Creates a CompanionAdSlot for the SDK to fill with companion ads.

public FriendlyObstruction createFriendlyObstruction (View view, FriendlyObstructionPurpose purpose, String detailedReason)

Creates a FriendlyObstruction object to describe an obstruction considered "friendly" for viewability measurement purposes.

Parameters
view
purpose
detailedReason

public ImaSdkSettings createImaSdkSettings ()

Creates an ImaSdkSettings object for configuring the IMA SDK.

public StreamRequest createLiveStreamRequest (String assetKey, String apiKey)

Creates a StreamRequest object to contain the data used to request a server-side ad insertion live stream.

Parameters
assetKey This is used to determine which stream should be played. The live stream request asset key is an identifier which can be found in the DFP UI.
apiKey

public static VideoAdPlayer createSdkOwnedPlayer (Context context, ViewGroup container)

This method is deprecated.
This method is provided as a bridge for developers, until they begin using their own implementation of VideoAdPlayer. For those who do not wish to write their own player, they should use the ExoPlayer IMA Extension.

Creates a VideoAdPlayer. This implementation can support video and audio ads and implements the ERROR(/ResizablePlayer) interface.

This player is only supported on Android 4.1 or higher.

Parameters
context The application Context.
container The ViewGroup to use for displaying the Video Ad UI. This should be the same instance that is used for your AdDisplayContainer.

public StreamDisplayContainer createStreamDisplayContainer ()

This method is deprecated.
Please use createStreamDisplayContainer(ViewGroup container, VideoStreamPlayer player) instead.

Creates a StreamDisplayContainer to hold the player for server-side ad insertion streams and slots for companion ads.

public static StreamDisplayContainer createStreamDisplayContainer (ViewGroup container, VideoStreamPlayer player)

Creates a StreamDisplayContainer to hold the player for server-side ad insertion streams and slots for companion ads.

Parameters
container
player

public StreamRequest createVodStreamRequest (String contentSourceId, String videoId, String apiKey)

Creates a StreamRequest object to contain the data used to request a server-side ad insertion video on demand stream.

Parameters
contentSourceId
videoId
apiKey

public static ImaSdkFactory getInstance ()

Returns the global ImaSdkFactory object.