Freewheel Module for AMP iOS

This module’s goal is to ease the integration Freewheel and the Akamai AMP Player for iOS. With just some simple steps a few steps we can achieve this integration, let’s see how.

Installation

Just import the AmpFreewheel.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 AmpFreewheel

Then, let’s add the related variables in our UIViewController:

    var ampPlayer: AmpPlayer!
    var imaManager: AmpIMAManager!

And it’s time to instantiate them now, in your viewDidLoad function:

    // Instantiate player

    self.ampPlayer = AmpPlayer(parentView: self.view)

    // Register yourself as an observer if required
    self.ampPlayer.registerObserver(self)

    self.ampPlayer.setLicense(license)

    self.ampFreewheel = AmpFreewheel(ampPlayer: self.ampPlayer!, networkId: networkId, serverUrl: serverUrl)

    let videoAssetId = VideoAssetId(id: id, duration: duration)

    self.ampFreewheel?.requestAds(profile: profile, siteSectionId: siteSectionId, videoAssetId: videoAssetId) { adController in
            adController.addPrerollSlot("pre1")
            adController.addOverlaySlot("over1", timePosition: 5)
            adController.addMidrollSlot("mid1", timePosition: 10)
            adController.addOverlaySlot("over2", timePosition: 15)
            adController.addPostrollSlot("post1")
        }

    self.ampPlayer.handleUrl(url)

And that’s basically it, with just those few steps, you have a working integration between AMP and Freewheel.

Need help?

If you need help trying to integrate the player on your project, or you want to report issues or problems you can send a email to amp-sdk-support@akamai.com