{"id":19224813,"url":"https://github.com/flipkart-incubator/madman-android","last_synced_at":"2025-04-21T00:31:29.142Z","repository":{"id":55538538,"uuid":"235603923","full_name":"flipkart-incubator/madman-android","owner":"flipkart-incubator","description":"Madman (Media ads manager) is a high performance alternative to Google's standard IMA android SDK. If you have your own VAST server and want to render video ads and have full control over the UI, then this library is for you.","archived":false,"fork":false,"pushed_at":"2020-12-23T05:22:18.000Z","size":3213,"stargazers_count":69,"open_issues_count":8,"forks_count":11,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-01T07:13:20.397Z","etag":null,"topics":["android","ima","madman","vast","video-ads","vmap"],"latest_commit_sha":null,"homepage":"https://tech.flipkart.com/madman-an-open-source-ads-framework-for-android-99b5e57fdd30","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flipkart-incubator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-22T15:34:33.000Z","updated_at":"2025-03-17T17:48:40.000Z","dependencies_parsed_at":"2022-08-15T02:50:26.348Z","dependency_job_id":null,"html_url":"https://github.com/flipkart-incubator/madman-android","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipkart-incubator%2Fmadman-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipkart-incubator%2Fmadman-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipkart-incubator%2Fmadman-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flipkart-incubator%2Fmadman-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flipkart-incubator","download_url":"https://codeload.github.com/flipkart-incubator/madman-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249979905,"owners_count":21355320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ima","madman","vast","video-ads","vmap"],"created_at":"2024-11-09T15:12:56.100Z","updated_at":"2025-04-21T00:31:28.540Z","avatar_url":"https://github.com/flipkart-incubator.png","language":"Kotlin","funding_links":[],"categories":["Media Tools"],"sub_categories":["Independent \u0026 Hobbyist Projects"],"readme":"# madman\n\n[![](https://jitpack.io/v/flipkart-incubator/madman-android.svg)](https://jitpack.io/#flipkart-incubator/madman-android)\n[![Build Status](https://travis-ci.org/flipkart-incubator/madman-android.svg?branch=master)](https://travis-ci.org/flipkart-incubator/madman-android) \n[![codecov.io](https://codecov.io/github/flipkart-incubator/madman-android/branch/master/graph/badge.svg)](https://codecov.io/github/flipkart-incubator/madman-android)\n\nThe 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.\n\nThe library is designed to \n\n* retrieve ads from VAST-compliant ad servers\n* help handle ad playback\n* collect and report metrics back to ad servers.\n\n### `Note: It is in alpha stage`\n\n## Why Madman ?\n\n### Performance\n\n  Madman uses native views to render ads view as compared to IMA which uses WebView, hence making it slower.\n  \n  Initial numbers have shown madman is ~700 ms faster in loading pre-roll ads compared to other libraries such as IMA.\n  Test env: API-29 emulator, wifi, similar ad response, 5 iterations:\n\n  * IMA: 2.04 seconds\n  * Madman: 1.35 seconds\n\n  The madman is approximately ~700 ms faster in loading the pre-roll ad as compared to IMA.\n\n   #### Load time comparison: \n\n  ![Comparsion](https://github.com/flipkart-incubator/madman-android/blob/master/files/comparison.gif)\n\n### Full control over the user interface\n\n   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.\n\n  * change skip ad UI\n  * change learn more UI\n  * change \"Ad starting in..\" UI\n  * custom UI layer\n  \n### Features and Extensibility\n\n   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..”.\n\n## Integration\n\nIf you need to integrate directly with the madman library, follow the below steps\n\n### 1. Get Madman\n\nAdd the jitpack dependency in your root build.gradle\n\n```kotlin\nallprojects {\n  repositories {\n    maven { url \"https://jitpack.io\" }\n  }\n}\n```\n\nAdd the madman dependency\n\n```kotlin\ndependencies {\n   // core madman library\n   implementation 'com.github.flipkart-incubator.madman-android:madman:$latest_version'\n   \n   // optional network layer module for fetching vmap/vast from server, sending tracking events etc\n   implementation 'com.github.flipkart-incubator.madman-android:madman-okhttp-extension:$latest_version'\n}\n```\n\n### 2. Initialise Madman\n\n```kotlin\nval madman = Madman.Builder()\n              .setAdLoadListener(this) // ad load callbacks\n              .setNetworkLayer(DefaultNetworkLayer(context)) // use the default network layer, override if necessary\n              .build(context)\n```\n\nRead the [doc](https://github.com/flipkart-incubator/madman-android/wiki/Madman) to understand the components in detail.\n\n### 3. Create AdRenderer\n\nAdRenderer 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. \n\n```kotlin\nval adRenderer = DefaultAdRenderer.Builder()\n\t\t  .setPlayer(this) // player interface\n\t\t  .setContainer(adViewGroup) // parent view to which the overlay gets added\n\t\t  .build(null) // passing null will fallback to default UI layout\n```\n\nTo override the default layout, create a new `AdViewBinder` and pass it while calling `build` on the AdRenderer\n\n```kotlin\nval adViewBinder = AdViewBinder.Builder()\n\t            .setLayoutId(R.layout.ad_overlay) // layout of custom ad overlay\n\t\t    .setSkipViewId(R.id.skip_button) // specify the skip view id\n\t\t    .setClickThroughViewId(R.id.click_throught_button) // specify the learn more view id\n\t\t    .build()\n\nval adRenderer = DefaultAdRenderer.Builder()\n\t\t  .setPlayer(this) // player interface\n\t\t  .setContainer(adViewGroup) // parent view to which the overlay gets added\n\t\t  .build(adViewBinder) // passing custom ad view binder\n```\n\n### 4. Request Ads\n\n* From network:\n\n```kotlin\nval request = NetworkAdRequest()\nrequest.setUrl(adTagUri.toString())\nmadman.requestAds(request, adRenderer)\n```\n\n* From local cache:\n\n```kotlin\nval request = StringAdRequest()\nrequest.setResponse(adResponse)\nmadman.requestAds(request, adRenderer)\n```\n\nThe `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.\n\nFor example:\n```kotlin\nadManager.addAdEventListener(eventListener) // to listen to add events\nadManager.addAdErrorListener(errorListener) // to listen to add errors\n```\n\n\n## Exo-Player Integration\n\nIf 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.\n\n```kotlin\ndependencies {\n   implementation 'com.github.flipkart-incubator.madman-android:madman-exoplayer-extension:$latest_version'\n}\n```\n\nCheckout the demo app and [MadmanPlayerManager](https://github.com/flipkart-incubator/madman-android/blob/master/app/src/main/java/com/flipkart/mediaads/demo/madman/MadmanPlayerManager.java) to understand the integration process in detail.\n\n\n## Demo\n\nThis is the demo video of loading a pre-roll ad using the madman library.\n\n![Demo](https://github.com/flipkart-incubator/madman-android/blob/master/files/madman-preroll.gif)\n\n\n## Documentation\n\nFor more information, read \u003cb\u003e[Wiki](https://github.com/flipkart-incubator/madman-android/wiki)\u003c/b\u003e\n\n\n## What's missing ?\n\nThe following features of VAST and VMAP are not available in the library yet:\n\n### VAST\n* Companion ads\n* Non-Linear ads\n* Executable media files\n* Ad Pods\n* Wrapper ads (for redirection)\n* Industry icon support\n\n### VMAP\n* Ad break time-offsets such as #1, x% etc. Only format supported for now is HH:MM:SS.mmm\n* Ad break tracking events\n* Increasing unit test coverage\n\n`Note: Google AdSense/AdManager Ads will not work with this library due to the absense of executable media files support`\n\n\n## License\n\n    The Apache License\n    \n    Copyright (c) 2020 Flipkart Internet Pvt. Ltd.\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\"); \n    you may not use this file except in compliance with the License.\n    \n    You may obtain a copy of the License at\n\n       https://www.apache.org/licenses/LICENSE-2.0 \n       \n    Unless required by applicable law or agreed to in writing, software \n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    \n    See the License for the specific language governing permissions and \n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipkart-incubator%2Fmadman-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflipkart-incubator%2Fmadman-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflipkart-incubator%2Fmadman-android/lists"}