Select platform: [HTML5](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/architecture "View this page for the HTML5 platform docs.") [Android](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/android/architecture "View this page for the Android platform docs.")

<br />

This guide provides an overview of the SDK lifecycle and the interactions
between your video stream player, the IMA DAI SDK, and an ad server.

## Basic interactions

The following diagram illustrates and annotates the interactions between
your video player, the IMA DAI SDK, and Ad Manager 360.

[Dynamic Ad Insertion architecture](https://developers.google.com/static/interactive-media-ads/images/dai-architecture-diagram.png)

1. The web page or app loads the IMA DAI SDK via:

   - an embedded script tag for HTML5
   - a native app for Android, Google Cast, iOS, tvOS, or Roku
2. The IMA DAI SDK requests either a VOD stream or live stream from Google Ad
   Manager 360.

3. Ad Manager 360 responds with the video stream that includes inserted ad
   breaks.

4. The IMA DAI SDK parses the response, determines the correct media type based
   on environment, and delivers the video stream (and
   companion ads if needed) to the web page or app.

5. The video player negotiates the playback details with the IMA DAI SDK and
   plays the ads.

6. The IMA SDK fires an impression ping and tracking events, as needed.

## Lifecycle

This diagram shows the full lifecycle of the IMA DAI SDK. Constructor and method
calls are highlighted in blue, events are highlighted in red, and error
conditions are shown with red connectors and red text.

![](https://developers.google.com/static/interactive-media-ads/images/dai-lifecycle.png)