In order to show ads you need to configure the player to do so. There are two alternatives: Either configure them in the platform or configure them manually for the player.
FPFlowplayerViewController was prepared with a valid
FPFlowplayerMedia 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 you wish to prepare
FPFlowplayerViewController with an
FPExternalMedia you need to add ads manually. You will also need to create a
FPAdSchedule and pass the latter as an argument in the constructor of your
There are two ways to create a
FPAdSchedule - either by using a VMAP file or defining ad breaks by hand.
FPAdSchedule with a URL to an ad playlist, such as VMAP
let adSchedule = FPAdSchedule(adScheduleUrl: "https://link.to.a.vmap.file") let externalMedia = FPExternalMedia(mediaUrl: URL(string: "https://link.to.a.media.file")!, adSchedule: adSchedule)
FPAdSchedule with a list of
FPAdBreak objects, where each
FPAdBreak 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.
let preRollBreak = FPAdBreak(adTag: "https://link.to.a.vast.file", roll: .pre) let postRollBreak = FPAdBreak(adTag: "https://link.to.a.vast.file", roll: .post) let midRolls = ["https://link.to.a.vast.file", "https://link.to.a.vast.file"] let midRollBreak = FPAdBreak(adTags: midRolls, offset: 15) let adSchedule = FPAdSchedule( adScheduleWaterfall: [preRollBreak, midRollBreak, postRollBreak] ) let externalMedia = FPExternalMedia( mediaUrl: URL(string: "https://link.to.a.media.file")!, adSchedule: adSchedule )