Adaptive Media Player

AmpFBAudienceNetwork Docs

AmpFBAudienceNetwork

Home / AmpFBAudienceNetwork


The AmpFBAudienceNetwork plugin, handles the integration between Facebook’s AdManager and AmpPlayer for iOS.

Installation

Just import the AmpFBAudienceNetwork.framework in your project. For more information check out the AmpCore’s documentation.

Note: Make sure to add the frameworks as Embedded Binaries or you’ll get an error about a missing image.

How to Use

Let’s first import the required frameworks:

import AmpCore
import AmpFBAudienceNetwork

To link a new instance to play the Facebook ads on you can use this function. You just need to specify the player, the placement ID which you can generate on this link, and an array with all the breaks you want to display the user.

let audienceNetwork = AmpFBAudienceNetwork(player: AmpPlayer, placementID: String, adBreaksAtSeconds: [Double])

How to play prerolls and postrolls?

If you want to enable or disable this types of ads you can do so by calling this functions.

audienceNetwork.enablePreroll(enabled: true)
audienceNetwork.enablePostroll(enabled: true)