Table of contents
FlowplayerView was prepared with a valid
FlowplayerMedia then a Flowplayer config will be fetched and all the ads that are included in this config will automatically play at their specified time offsets.
If, however, you wish to prepare
FlowplayerView with an
ExternalMedia and you need to add ads for this video, then there are two options:
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")
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)