{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Ads in Wowza Flowplayer (iOS)","description":"Learn how to configure ads in Wowza Flowplayer on iOS.","siteUrl":"https://developer.wowza.com","keywords":"wowza video developer portal, api reference docs","lang":"en-US","image":"https://www.wowza.com/wp-content/uploads/Graphics-Social-Profile-Images-Docs-Resources-1024x512-1.jpg","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"advertisement","__idx":0},"children":["Advertisement"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To show ads, you must configure the player to do so."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configure-ads","__idx":1},"children":["Configure ads"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To prepare ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPFlowplayerViewController"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPExternalMedia"]},", you must add ads manually. You will also need to create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdSchedule"]}," and pass the latter as an argument in the constructor of your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPExternalMedia"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There are ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["two ways"]}," to create an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdSchedule"]},":"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["By using a VMAP file, or,"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["defining ad breaks by hand."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"using-vmap","__idx":2},"children":["Using VMAP"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdSchedule"]}," with a URL to an ad playlist, such as VMAP:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let adSchedule = FPAdSchedule(adScheduleUrl: \"https://link.to.a.vmap.file\")\nlet externalMedia = FPExternalMedia(mediaUrl: URL(string: \"https://link.to.a.media.file\")!, adSchedule: adSchedule)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"defining-ad-breaks-manually","__idx":3},"children":["Defining ad breaks manually"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdSchedule"]}," with a list of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdBreak"]}," objects, where each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FPAdBreak"]}," consists of one or more ad tag URLs (such as VAST) and an offset that indicates the time when the break should start."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following example creates an ad schedule that consists of:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A pre-roll break with a single ad"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A mid-roll break with three ads that starts 15 seconds into the playback"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A post-roll break with a single ad"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let preRollBreak = FPAdBreak(adTag: \"https://link.to.a.vast.file\", roll: .pre)\nlet postRollBreak = FPAdBreak(adTag: \"https://link.to.a.vast.file\", roll: .post)\n\nlet midRolls = [\"https://link.to.a.vast.file\", \"https://link.to.a.vast.file\"]\nlet midRollBreak = FPAdBreak(adTags: midRolls, offset: 15)\n\nlet adSchedule = FPAdSchedule(\n    adScheduleWaterfall: [preRollBreak, midRollBreak, postRollBreak]\n)\n\nlet externalMedia = FPExternalMedia(\n    mediaUrl: URL(string: \"https://link.to.a.media.file\")!,\n    adSchedule: adSchedule\n)\n","lang":"swift"},"children":[]}]},"headings":[{"value":"Advertisement","id":"advertisement","depth":1},{"value":"Configure ads","id":"configure-ads","depth":2},{"value":"Using VMAP","id":"using-vmap","depth":3},{"value":"Defining ad breaks manually","id":"defining-ad-breaks-manually","depth":3}],"frontmatter":{"seo":{"title":"Ads in Wowza Flowplayer (iOS)","description":"Learn how to configure ads in Wowza Flowplayer on iOS."}},"lastModified":"2023-07-11T22:23:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/wowza-flowplayer/apple-sdk/ios-legacy/ads","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}