QPAdsLoader

Singleton entry point for the Client-Side Ad Insertion (CSAI) Pre-Roll prefetch flow.

Owns the single, shared native IMA AdsLoader instance used to prefetch a Pre-Roll ad ahead of content selection (e.g. on app startup), and hands off the resulting AdsManager to a per-playback-session QPAdsManager once the user actually starts content playback.

Mid-Roll/Post-Roll ads are not handled by this class — they are played entirely through the ExoPlayer IMA Extension (see com.quickplay.vstb7.player.ima.internal.exo.IMAAdsPlayer), which owns its own, independent ImaAdsLoader/AdsMediaSource scoped to the content ExoPlayer instance. This keeps Pre-Roll prefetching (this class) and Mid/Post-Roll ad insertion as two decoupled subsystems.

Functions

Link copied to clipboard

Releases the shared IMA loader and the dedicated Pre-Roll player.

Link copied to clipboard
fun initAdsLoader(context: Context, adRequest: AdRequest?)

Creates the shared native IMA loader (wrapped by QPIMAAdsLoader) if it does not exist and, if adRequest is provided and no prefetch slot exists yet, immediately starts prefetching it via a fresh QPPrefetchAdsManager. An existing slot is kept as is; call deinitAdsLoader first to replace it.