> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kontext.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Loading several ads at once

> To have several formats ready at once, ask for them and load them concurrently.

To have several formats ready at once, ask for them and load them concurrently. Each format is requested and rendered in parallel, and one format without an ad leaves the others untouched:

```kotlin theme={null}
suspend fun prepare(format: AdFormat): VideoAd? = try {
    ads.format(format).also {
        it.load()
        it.listener = this
    }
} catch (e: VideoAdException) {
    null                                   // no fill for this format this time
}

lifecycleScope.launch {
    val overlay = async { prepare(AdFormat.OVERLAY) }
    val pause = async { prepare(AdFormat.PAUSE) }
    val linear = async { prepare(AdFormat.LINEAR) }
    overlayAd = overlay.await()
    pauseAd = pause.await()
    linearAd = linear.await()
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.