# Advertisement To show ads, you must configure the player to do so. ## Configure ads To prepare `FPFlowplayerViewController` with `FPExternalMedia`, you must add ads manually. You will also need to create a `FPAdSchedule` and pass the latter as an argument in the constructor of your `FPExternalMedia`. There are **two ways** to create an `FPAdSchedule`: 1. By using a VMAP file, or, 2. defining ad breaks by hand. ### Using VMAP Create an `FPAdSchedule` with a URL to an ad playlist, such as VMAP: ```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 that 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 that starts 15 seconds into the playback * A post-roll break with a single ad ```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 ) ```