With the advent of video players that support streaming media formats such as
HLS and DASH, publishers can now easily support these formats with the IMA SDK
for Android. Here is a list of steps to make this work:
Use a video player that can play streaming video, such as ExoPlayer.
Inform the SDK of your video player's capabilities.
The latter is done via the SDK's AdsRenderingSettings API. Create a
new instance of AdsRenderingSettings
and then create a list of MIME
types you plan to support:
AdsRenderingSettings adsRenderingSettings =
ImaSdkFactory.getInstance().createAdsRenderingSettings();
ArrayList arrayList = new ArrayList();
arrayList.add("application/x-mpegURL"); //HLS
arrayList.add("application/dash+xml"); //DASH
adsRenderingSettings.setMimeTypes(arrayList);
Then initialize the AdsManager using these AdsRenderingSettings
:
adsManager.init(adsRenderingSettings);
This will allow the SDK to choose streaming ad media to play in your video
player. Make sure to add any additional MIME types you plan to support, such as
MP4, as this approach assumes that any MIME types not passed in are not
supported.
FAQ
How do I play HLS ads using the IMA SDK for iOS?
The default video player used by the iOS IMA SDK supports HLS, so it is not
necessary to set that in AdsRenderingSettings
.
Will this work with the SDK-owned player?
No, currently you must use custom playback by implementing the VideoAdPlayer
interface. For an example of how to do this, check out our guide
on custom playback or AdvancedExample .
If you have any questions, feel free to contact us via the support
forum .
- Yury Pavlotsky , IMA SDK Team