The Madman library (Media Ads Manager) enables you to advertise video contents with video ads.

Overview

madman

Build Status codecov.io

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

Madman uses native views to render ads view as compared to IMA which uses WebView, hence making it slower.

Initial numbers have shown madman is ~700 ms faster in loading pre-roll ads compared to other libraries such as IMA. 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:

Comparsion

Full control over the user interface

The library allows you to have full control over the user interface for the ads view. You can create your own custom layout, or use the library’s default layout to render overlays.

  • change skip ad UI
  • change learn more UI
  • change "Ad starting in.." UI
  • custom UI layer

Features and Extensibility

The library allows you to have your own custom implementation of components such as network layer, xml parser layer. It even allows you to add callbacks for listening to ad events such as “Ad starting in..”.

Integration

If you need to integrate directly with the madman library, follow the below steps

1. Get Madman

Add the jitpack dependency in your root build.gradle

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

Add the madman dependency

dependencies {
   // core madman library
   implementation 'com.github.flipkart-incubator.madman-android:madman:$latest_version'
   
   // optional network layer module for fetching vmap/vast from server, sending tracking events etc
   implementation 'com.github.flipkart-incubator.madman-android:madman-okhttp-extension:$latest_version'
}

2. Initialise Madman

val madman = Madman.Builder()
              .setAdLoadListener(this) // ad load callbacks
              .setNetworkLayer(DefaultNetworkLayer(context)) // use the default network layer, override if necessary
              .build(context)

Read the doc to understand the components in detail.

3. Create AdRenderer

AdRenderer houses the logic for rendering the UI components on the top of the ad. The library provides a default layout for the ad overlay, which can be overriden if required.

val adRenderer = DefaultAdRenderer.Builder()
		  .setPlayer(this) // player interface
		  .setContainer(adViewGroup) // parent view to which the overlay gets added
		  .build(null) // passing null will fallback to default UI layout

To override the default layout, create a new AdViewBinder and pass it while calling build on the AdRenderer

val adViewBinder = AdViewBinder.Builder()
	            .setLayoutId(R.layout.ad_overlay) // layout of custom ad overlay
		    .setSkipViewId(R.id.skip_button) // specify the skip view id
		    .setClickThroughViewId(R.id.click_throught_button) // specify the learn more view id
		    .build()

val adRenderer = DefaultAdRenderer.Builder()
		  .setPlayer(this) // player interface
		  .setContainer(adViewGroup) // parent view to which the overlay gets added
		  .build(adViewBinder) // passing custom ad view binder

4. Request Ads

  • From network:
val request = NetworkAdRequest()
request.setUrl(adTagUri.toString())
madman.requestAds(request, adRenderer)
  • From local cache:
val request = StringAdRequest()
request.setResponse(adResponse)
madman.requestAds(request, adRenderer)

The AdLoadListener#onAdManagerLoaded is called when the AdManager is initialised. The AdManager which is available as a parameter of the callback should be used to interact with the library.

For example:

adManager.addAdEventListener(eventListener) // to listen to add events
adManager.addAdErrorListener(errorListener) // to listen to add errors

Exo-Player Integration

If you are using exo-player, you can directly use the MadmanAdLoader plugin which acts as a glue between the madman library and exo-player instance.

dependencies {
   implementation 'com.github.flipkart-incubator.madman-android:madman-exoplayer-extension:$latest_version'
}

Checkout the demo app and MadmanPlayerManager to understand the integration process in detail.

Demo

This is the demo video of loading a pre-roll ad using the madman library.

Demo

Documentation

For more information, read Wiki

What's missing ?

The following features of VAST and VMAP 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
  • Ad break tracking events
  • Increasing unit test coverage

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

License

The Apache License

Copyright (c) 2020 Flipkart Internet Pvt. Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License.

You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0 
   
Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and 
limitations under the License.
Comments
  • Multiple feature supports and some bug fixes

    Multiple feature supports and some bug fixes

    Change Logs

    1. Support for multiple ad breaks for a same cue point (https://github.com/flipkart-incubator/madman-android/issues/7)
    2. Same handler to fetch progress for both ad and content
    3. Other event fixes
    4. Additional unit test cases
    5. Support for adding multiple event listeners.
    6. Tracking fixes
    7. Support for Ad CountDown timer
    enhancement 
    opened by anirudhramanan 1
  • AdBreak not playing when there is only a post roll ad break in VMAP

    AdBreak not playing when there is only a post roll ad break in VMAP

    Describe the bug When the VMAP only contains a post roll ad break, the ad is not playing

    To Reproduce Steps to reproduce the behavior:

    1. Scrub to the end of the player.
    2. Ad break not playing. Looking at the logs, Madman is triggering the correct events with the AdElement to be played. The MadmanAdLoader for some reason is triggering the onEnded callback even before the ad has ended due to which the library stops the ad.

    Expected behavior Post roll ad should be played.

    opened by anirudhramanan 0
  • Installation Issues

    Installation Issues

    Describe the bug Not able to download the gradle dependencies Seeing the error:

    Failed to resolve: com.github.flipkart-incubator.madman-android:madman:v1.0.9
    

    To Reproduce Steps to reproduce the behavior: Followed the readme to include jitpack.io and added the following dependencies:

    implementation 'com.github.flipkart-incubator.madman-android:madman:v1.0.9'
    implementation 'com.github.flipkart-incubator.madman-android:madman-okhttp-extension:v1.0.9'
    
    
    opened by shyamvala 0
  • Send Extra tags via XML

    Send Extra tags via XML

    I need to customize Learn More button UI by adding an image or other data to it.

    I want to add tags in my VAST URL for these data. Then Madman read these tags and send them to UI.

    An alternative way is to create an API to get these data besides XML. But it is not a good approach.

    opened by behrooz-fard 0
  • How to customize the Skip AD button

    How to customize the Skip AD button

    I implemented the madman sdk to play ads in between the content in my application. Everything is working fine but the problem is that the before the ad gets loaded the skip ad is comes to visible state. Is there any document reference about how to customize it.

    opened by vinoddirishala 2
  • Web support

    Web support

    we are looking for an IMA alternative. Our app is web based so I wonder, is there any plan for a web version ? Open source Media Ads Manager seem so scarce

    opened by mihaiav 1
Releases(v1.0.9)
  • v1.0.9(Jul 2, 2020)

  • v1.0.8(Jul 1, 2020)

    Change Logs:

    1. Fix ad playback issue where the VMAP only contains the post roll ad break
    2. Fire network callbacks on the main thread
    3. Renamed okhttp module to okhttp-extension
    Source code(tar.gz)
    Source code(zip)
  • v1.0.6(Jun 9, 2020)

    Change Logs:

    1. Support to add multiple AdLoadListener listeners to the Madman instance. https://github.com/flipkart-incubator/madman-android/pull/14
    Source code(tar.gz)
    Source code(zip)
  • v1.0.5(May 29, 2020)

    Change Logs:

    1. Downgraded okhttp version to 3.14.4 since the new version has API breaking changes. The client using this library is dependent to the older okhttp version.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.4(May 25, 2020)

    Change Logs:

    1. Support for multiple ad breaks for a same cue point (#7)
    2. Single handler to fetch progress for both ad and content
    3. Additional unit test cases
    4. Support for adding multiple event and error listeners. (API breaking change)
    5. Tracking fixes
    6. Other bug fixes
    Source code(tar.gz)
    Source code(zip)
  • v1.0.3(Jan 23, 2020)

    Fixes:

    1. Fatal Exception: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.next + 860(ArrayList.java:860) at com.flipkart.madman.f.e.a$b.handleMessage + 40(:40)

    2. Fatal Exception: c.w: lateinit property contentProgressProvider has not been initialized at com.flipkart.madman.f.b.access$getContentProgressProvider$p(BaseAdManager.kt)

    3. Fatal Exception: java.lang.IllegalStateException: Check failed. at com.flipkart.madman.g.b.a.skip + 45(:45)

    Source code(tar.gz)
    Source code(zip)
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀

Android p2p cdn sdk to distribute load and reduce costs(https://peervadoo.com) Vadootv is a p2p sdk integration to reduce your video streaming costs b

Vadootv 40 Oct 5, 2022
Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer.

Yet Another Video Player Yet Another Video Player (or YAVP) is a Video Player for Android that is based on Googles ExoPlayer. Who Is YAVP For? First o

null 62 Dec 29, 2022
Video Transcoder is an application which uses the open source program FFmpeg to transcode video files from one format to another.

Video Transcoder Do you want to encode videos on your phone into different formats, trim videos, or extract audio? Are you looking for a free solution

Branden Archer 358 Dec 30, 2022
Compose-video-player - Video player for Android Compose powered by ExoPlayer

Compose Video Player Video player for Android Compose powered by ExoPlayer. Addi

Juan Pablo Herrera 22 Dec 13, 2022
An extensible media player for Android

ExoPlayer ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and vi

Google 20.2k Jan 1, 2023
A better Android VideoView with more Media Controller customization. 一个更好用的Android VideoView

Android UniversalVideoView 中文版说明请点击这里 UniversalVideoView is a Android widget helps playing video easier, which is similar with the Android system nati

Linsea 978 Nov 30, 2022
Sandbox project for practice: Media Streaming with Exoplayer (via Android Development tutorial)

Media streaming with ExoPlayer The code in this repository accompanies the Media streaming with ExoPlayer codelab. If you are looking to get started w

Jeannille Hiciano 1 Nov 29, 2021
ExoPlayer - an application level media player for Android

ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks.

Halil Özel 6 Oct 31, 2022
LNSocial is a social media app dedicated to short-form videos created for and consumed by users.

LNSocial is a social media app dedicated to short-form videos created for and consumed by users. The length of videos is between 15-30 second

null 10 Jan 5, 2023
A clean music player with a customizable widget, stylish interface and no ads.

Simple Music Player A clean music player with a customizable widget. A music player easily controllable from the status bar, home screen widget or by

Simple Mobile Tools 965 Jan 4, 2023
An easy way of recording any discussion or sounds without ads or internet access

Simple Voice Recorder Ever wished you remember what the other person said? Or the task they gave you at a meeting? Wish no more. With this simple reco

Simple Mobile Tools 291 Jan 7, 2023
Detailed listing of multimedia codecs on your Android device - with no ads!

Codec Info Detailed listing of multimedia codecs on your Android device - with no ads! Codec Info is a simple tool that provides detailed listing of m

Krzysztof Nawrot 46 Dec 18, 2022
An easy to use Instagram Video Downloader library for android apps.

Instagram-Video-Downloader-Library An easy to use library for directly download videos from ig reels, igtv. Implementation Step 1. Add the JitPack rep

Abhay 16 Dec 7, 2022
Library for Instagram Image/Video Downloader for Android

Insta Downloader Simple Instagram Image Video Downloader Library for Android Implementation Step 1. Add the JitPack repository to your build file Add

kannikesh Prabhu 2 Mar 12, 2022
The official Android client library for api.video

api.video Android client api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing

api.video 7 Dec 3, 2022
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.

ijkplayer Platform Build Status Android iOS Video player based on ffplay Download Android: Gradle # required allprojects { repositories {

bilibili 31k Jan 3, 2023
Custom Android view with video player, loader and placeholder image

VideoPlayerView Custom Android view with video player, loader and placeholder image. To stay up-to-date with news about the library Usage Here is an e

Marcin Moskała 89 Nov 18, 2022
On device extracting images from videos - creating video from images.

AndroidVideoTranscoder Surprisingly fast on device video transcoding. Features extracting images from video either ffmpeg or mediacodec creating video

null 29 Dec 20, 2022