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.
Installation
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 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)
// Heartbeat setup
let videoMetadata = [
AmpMetaDataKey.season: "Season 1",
AmpMetaDataKey.show: "Best Show Ever",
AmpMetaDataKey.episode: "Episode 4"
]
let heartbeatConfig: [String : AnyObject] = [
"trackingServer": "http://mychannel.com" 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)
self.ampPlayer.play(url: YOUR_VIDEO_URL)
And that’s basically it, with just those few steps, you have a working integration between AMP and Freewheel.