Freewheel

The AmpFreewheel plugin offers a quick way to integrate AmpPlayer with the Freewheel SDK. This plugin will handle the interaction between the AmpPlayer with the plugin as well as the ads insertion.

If you desire to check out a 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 AmpFreewheel.xcframework and the AmpCore.xcframework to integrate this plugin.

You will also need the AdManager SDK which you can download it on the release page.

This plugin will only work on iOS.
The latest version of the AdManager SDK used by this plugin is 7.3.0 . Newer versions may be used, but you may run into unexpected errors until an update is released.

After aquiring 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 AmpFreewheel plugin, the Podfile should look like this:

target "ProjectName" do

  use_frameworks!

  pod 'AmpCore'
  pod 'AmpFreewheel'

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 AmpFreewheel plugin. In the most likely scenario you will need the AmpCore library.

import AmpCore
import AmpFreewheel

Creating a new instance

To use this plugin you should first initialize it. You need to specify the player being used as well as the Network ID for the ads. This should be provided by FreeWheel.

let freewheel = AmpFreewheel(ampPlayer: player, networkId: 42015)
While initializing the plugin will set the autoplay to false. You could expect unwanted behaviours if set to true.

Requesting Ads

To request ads for your videos just use this method with all the information provided by Freewheel.

freewheel.requestAds(serverUrl: "http://demo.v.fwmrm.net", profile: "42015:ios_allinone_profile", siteSectionId: "ios_allinone_demo_site_section", videoAssetId: VideoAssetId(id: "ios_allinone_demo_video", duration: 500))
You can also add the config block while calling this method where you’ll have access to the FWAdController for an extra layer of configuration before the ads are requested.

Integrating TrueX

To integrate Infillion’s TrueX ads with Freewheel you can follow their official guide. To integrate using Swift the other changes you must take into consideration are the following:

  1. Import the required headers with the help of the Bridging header file.

    #import <Foundation/NSString.h>
    #import <AdManager/FWSDK.h>
    #import <FWTXRenderer/FWTXRenderer.h>
    #import <FWTXRenderer/FWTXExtension.h>
    #import <FWTXRenderer/FWTXConstants.h>
    #import <FWTXRenderer/FWTXAdView.h>
  2. The linking on the AppDelegate while using swift is:

    FWLinkRenderer(FWTXRenderer.self)
  3. Load the extension on the configuration closure of the ad requesting method

    ampFreewheel.requestAds(serverUrl: "http://demo.v.fwmrm.net",
                            profile: "42015:ios_allinone_profile",
                            siteSectionId: "ios_allinone_demo_site_section",
                            videoAssetId: VideoAssetId(id: "ios_allinone_demo_video",duration: 500)){
                				adController in
                				adController.adContext?.loadExtension(String(describing: FWTXExtension.self))
                			}

Additional Information

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