Ads
Configure ads in the platform
If you need to prepare FlowplayerView
with an ExternalVideo
and you need to add ads for this video, then there are two options - Use an external VMAP file (see next section below) or create ad breaks manually.
Using an external VMAP file
Create an ExternalMedia
with a URL to an ad playlist, such as VMAP:
val externalMedia = ExternalMedia("https://link.to.a.media.file", "https://link.to.a.vmap.file")
Creating ad breaks manually
Create an ExternalMedia
with a list of AdBreak
objects, where each AdBreak
consists of one or more ad tag URLs (such as VAST), and an offset which indicates the time when the break should start.
The following example creates an ad schedule that consists of:
- A pre-roll break with a single ad
- A mid-roll break with three ads which starts 15 seconds into the playback
- A post-roll break with a single ad
val preRollBreak = AdBreak("https://link.to.a.vast.file", AdBreak.Roll.PRE)
val midRolls = arrayListOf("https://link.to.a.vast.file", "https://link.to.a.vast.file", "https://link.to.a.vast.file")
val midRollBreak = AdBreak(midRolls, 15)
val postRollBreak = AdBreak("https://link.to.a.vast.file", AdBreak.Roll.POST)
val adSchedule = arrayListOf(preRollBreak, midRollBreak, postRollBreak)
val externalMedia = ExternalMedia("https://url.to.a.media.file", adSchedule)