AMP player

Adobe Heartbeat

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


Let’s first import the required frameworks:

import AmpCore
import AmpAdobeHeartbeat

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

var ampPlayer: AmpPlayer!
var ampHeartbeat: AmpAdobeHeartbeat!

And its 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.ampFreewheel = AmpFreewheel(ampPlayer: self.ampPlayer!, networkId: networkId, serverUrl: serverUrl)

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

// Heartbeat setup
let videoMetadata = [
    AmpMetaDataKey.season: "Season 1", "Best Show Ever",
    AmpMetaDataKey.episode: "Episode 4"

let heartbeatConfig: [String : AnyObject] = [
    "trackingServer": "" as AnyObject,
    "jobId": "job" as AnyObject,
    "channel": "My Channel" as AnyObject,
    "publisher": "publisher" as AnyObject,
    "ovp": "ovp" as AnyObject,
    "sdk": "sdk" as AnyObject,
    "videoId": "Video ID" as AnyObject,
    "videoName": "Video Name" as AnyObject,

self.ampHeartbeat = AmpAdobeHeartbeat(ampPlayer: self.ampPlayer!, configuration: heartbeatConfig, videoMetadata: videoMetadata) YOUR_VIDEO_URL)

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