Meta Audience Network

The AmpFBAudienceNetwork plugin offers a quick way to integrate AmpPlayer with Meta Audience Network SDK. This plugin enables the display of ads in your playback.

You can check out our basic implementation, please refer to our application samples:

Adding the Plugin to the Xcode project

Manual Installation

To manually install the plugin you’ll need to download our latest distribution. You will be using AmpFBAudienceNetwork.xcframework and the AmpCore.xcframework to integrate this plugin.

You will also need the Meta Audience Network which you can download it on the release page.

This plugin will only work on iOS.
The latest version of the Meta Audience Network used by this plugin is 6.15.1 , newer versions may be used, but you may run into unexpected errors until an update is released.

After acquiring the frameworks you can just drag them to you Xcode project directory.

manual installation 1

The last step, is to mark every imported framework for Embed & Sign in the project’s general tab.

manual installation 2

CocoaPods

If you don’t have CocoaPods installed, refer to the CocoaPods documentation. To use CocoaPods, first create a Podfile in the directory containing the Xcode project. For the AmpFBAudienceNetwork plugin, the Podfile should look like this:

target "ProjectName" do

  use_frameworks!

  pod 'AmpCore'
  pod 'AmpFBAudienceNetwork'
  pod 'FBAudienceNetwork'

end

Once you have added the Podfile just run the command pod install --repo-update in the directory it’s located. Once the command has been completed you should se a new .xcworkspace file in your folder. Now you can start integrating the library.

Implementation

You need a working implementation of the AmpPlayer before using this plugin. If you need the implementation guide for AmpPlayer please refer to our documentation.

Import

The first step is to import the AmpCore and AmpFBAudienceNetwork.

import AmpCore
import AmpFBAudienceNetwork

Creating a new instance

After importing the libraries to the file, the next step is to create an instance of AmpFBAudienceNetworkManager. You will have to provide the placement ID and the timestamps where the ads will be shown

let fbAds = AmpFBAudienceNetworkManager(player: ampPlayer, placementID:PLACEMENT_ID, adBreaksAtSeconds:[10,20,30])
If you don’t have a placement ID or need additional information about it please check the official documentation.

Add Preroll and Postroll

If you need to add a preroll or postroll to complete the playback expierience you want, please use the following methods:

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

Additional Information

This guide was written on 7/26/2024 and it’s last revision was made on 7/26/2024. If you need any additional support please contact us through our offical support email.