Select platform: [Android](https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/manual_ad_playback.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/manual_ad_playback.md.txt "View this page for the iOS platform docs.")

<br />

This guide provides instructions on overriding the default ad break schedule and
configuring your own ad break playback timings. When manual ad break playback is
implemented, the SDK fires an `AD_BREAK_READY` event when an ad break has
loaded, and waits on you to start the break's playback.

## Prerequisites

- An Android application with the IMA SDK implemented.

## Configuring manual ad break playback

To configure manual ad break playback:

1. Tell the SDK you want to control ad break playback.
2. Listen for the AD_BREAK_READY event.
3. Tell the SDK to play ads when you're ready.

The snippet below shows the modifications required to the
[Advanced Example](https://github.com/googleads/googleads-ima-android/tree/main/AdvancedExample)
to implement manual ad break playback.

> [!IMPORTANT]
> **Key Point:** The [Basic Example](https://github.com/googleads/googleads-ima-android/tree/main/basicexample) implements the [Exoplayer-IMA extension](https://github.com/google/ExoPlayer/tree/release-v2/extensions/ima) which handles the setup of ImaSdkSettings and AdEvents. Because of this, the Basic Example is not able to be used as a starting point for this guide.

```
public VideoPlayerController(
      Context context,
      VideoPlayerWithAdPlayback videoPlayerWithAdPlayback,
      View playButton,
      View playPauseToggle,
      String language,
      ViewGroup companionViewGroup,
      Logger log) {
  ...
  
  sdkFactory = ImaSdkFactory.getInstance();
  ImaSdkSettings imaSdkSettings = sdkFactory.createImaSdkSettings();
  imaSdkSettings.setLanguage(language);
  // Tell the SDK you want to control ad break playback.
  imaSdkSettings.setAutoPlayAdBreaks(false);
  
  ...
}
...
@Override
public void onAdEvent(AdEvent adEvent) {
    ...
    switch (adEvent.getType()) {
      // Listen for the AD_BREAK_READY event.
      case AD_BREAK_READY:
        // Tell the SDK to play ads when you're ready. To skip this ad break,
        // simply return from this handler without calling adsManager.start().
        adsManager.start();
        break;
      ...
}
```

## FAQ

Is manual ad playback required for an IMA SDK implementation?
:   No. manual ad playback is an optional feature for publishers who
    don't want the IMA SDK to automatically play ad breaks as scheduled by an ad
    rule or VMAP response.