# Ads To show ads, you need to configure the player by configuring them manually. ## Configure ads manually If you wish to use `FPFlowplayer` with an `FPExternalMedia`, then you need to add ads manually. You will need to create an `FPAdSchedule` and pass the latter as an argument in the constructor of your `FPExternalMedia`. There are two ways to create an `FPAdSchedule` - either by using a VMAP file or defining ad breaks by hand. ### Using VMAP Create an `FPAdSchedule` with a URL to an ad playlist, such as VMAP. For example: ```swift let adSchedule = FPAdSchedule(adScheduleUrl: "https://link.to.a.vmap.file") let externalMedia = FPExternalMedia(mediaUrl: URL(string: "https://link.to.a.media.file")!, adSchedule: adSchedule) ``` ### Defining ad breaks manually Create an `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 #### Example ```swift 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 ) ```