madman

The Madman library (Media Ads Manager) enables you to advertise video contents with video ads. If you have your own VAST server and want to render video ads on Android and have full control over the UI, then this library is for you.

The library is designed to

  • retrieve ads from VAST-compliant ad servers
  • help handle ad playback
  • collect and report metrics back to ad servers.

Note: It is in alpha stage

Why Madman ?

  • Performance: Initial numbers have shown madman is ~700 ms faster in loading pre-roll ads compared to other libraries such as IMA.

  • UI Customisability:

    • change skip ad UI
    • change learn more UI
    • change "Ad starting in.." UI
    • custom UI layer
  • Features and Extensibility:

    • Ad starting countdown timer saying ad starting in 5,4 etc
    • Change backoff strategy for network layer
    • Change AdBreak finder strategy: It is used to determine which ad break to play given the current position of the player.

Performance

Initial numbers for playing pre-roll ads (Test env: API-29 emulator, wifi, similar ad response, 5 iterations):

  • IMA: 2.04 seconds
  • Madman: 1.35 seconds

The madman is approximately ~700 ms faster in loading the pre-roll ad as compared to IMA.

Load time comparison:

comparison

Get Madman

Add it in your root build.gradle at the end of repositories :

allprojects {
  repositories {
    maven { url "https://jitpack.io" }
  }
}

Add the dependencies :

  • Library :
dependencies {
  implementation 'com.github.flipkart-incubator.madman:madman:1.0.0'
}
  • Network Module :
dependencies {
  implementation 'com.github.flipkart-incubator.madman:madman-okhttp:1.0.0'
}

How to use ?

Initiliase the Madman instance

val madman = Madman.Builder()
             .setAdErrorListener(this)
             .setAdLoadListener(this)
             .setNetworkLayer(DefaultNetworkLayer(context))
             .setAdEventListener(this)
             .build(context)

Create AdRenderer

val adRenderer = DefaultAdRenderer.Builder().setPlayer(this).setContainer(adViewGroup).build(null)

Request Ads

  1. From Network
val request = NetworkAdRequest()
request.setUrl(adTagUri.toString())
madman.requestAds(request, adRenderer)
  1. From Local
val request = StringAdRequest()
request.setResponse("")
madman.requestAds(request, adRenderer)

Documentation

For more information, read Wiki

What's missing ?

The following features of VAST are not available in the library yet.

VAST

  • Companion ads
  • Non-Linear ads
  • Executable media files
  • Ad Pods
  • Wrapper ads (for redirection)
  • Industry icon support

VMAP

  • Ad break time-offsets such as #1, x% etc. Only format supported for now is HH:MM:SS.mmm
  • Increasing unit test coverage

Note: Google AdSense/AdManager Ads will not work with this library due to the absense of executable media files support

GitHub