Skip to content

High Level Architecture

Anirudh Ramanan edited this page Jan 22, 2020 · 1 revision

High Level Flow

  1. Madman is the entry point of the library. It follows the builder pattern which allows the client to set parsers, network layer, and ad display container and event / error callback implementations. The library will provide default implementation for all of these, the client can override if they want.

  2. Madman instance will be used to call request ads which internally will call the AdsLoader to request ads. We have two variations of AdLoader ie StringAdLoader and NetworkAdLoader.

    • StringAdLoader - We already have a string response for the ads (VMAP or VAST).

    • NetworkAdLoader - This interacts with the network layer to fetch ad from the network.

  3. Once the response is fetched, it is delegated to the parser which converts it into concrete data models consumed by the SDK. After parsing, the validator validates the data models ensuring all the required fields are present, else throwing the appropriate error back to the client.

  4. Once validated, AdLoadedEvent gets triggered. The Plugin which implements the listener for the same gets the AdManager as the parameter. AdManager is the class used to perform operations on ads (such as start, stop, requesting next ad break etc).

  5. The AdManager also takes in AdRenderingSettings which can be used to enable/disable preloading, set timeouts, and bitrates etc.

  6. MediaProgressProvider and AdsProgressProvider are used to fetch current media progress, and current ads progress from the exo-player. This is called every x seconds and the AdManager uses this to request for the next ads break (if any) and also handling pre-loading. The value of "x" seconds will be managed intelligently. For eg if we know that the next ad break is after let's say 20 minutes, instead of calling the provider every 1 second, the timer can be tuned accordingly.

Clone this wiki locally