Datazoom is a high-availability real-time data collection solution. This document summarizes how to integrate the Akamai Adaptive Media Player for iOS with the Datazoom platform.
- Login to Datazoom here: https://app.datazoom.io
- Add a Collector as indicated here: How to add a Collector
- Copy the
config key
that was created at the end of the process
Click the icon indicated below to copy the Configuration Key
You will see this message:
4. Replace the <configuration id from Datazoom>
in Datazoom's DZAkamai.framework
file with the Key you copied above.
5. Replace the <url given by Datazoom>
with <
https://platform.datazoom.io/beacon/v1/
>
6. Replace the <AMPPlayer object>
with your playerInstance
identifier
Prerequisites
- macOS Catalina version 10.15.2 or later
- Xcode 12.x with Swift 5.1 (The AMP Core supports Swift 5.1 only)
- CocoaPods (https://guides.cocoapods.org/using/getting-started.html)
Installation
Open the terminal and check if Cocoapods is installed in your machine.
pod --version
If the above command returns no version number, then you'll need to install CocoaPods.
sudo gem install cocoapods
After installation, navigate to the Xcode project directory and create a
Podfile
configuration file if not present.pod init
Run the command:
open Podfile
Add the
DZAkamai
framework afteruse_frameworks!
in thePodfile
pod 'DZAkamai', '1.23.0', :source => 'https://gitlab.com/datazoom/pod-specs.git'
Add the
AmpCore
framework in thePodfile
pod 'AmpCore'
Pull and update the latest Cocoapods pod specs
pod repo update
Install the pods
pod install
- Be sure to close any current Xcode sessions and use `your_project_name.xcworkspace` for this project from now on.
Implementation Steps for Swift Language-based Applications
- Open the ViewController/View file, where the AMPPlayer(Akamai Player) is included.
Import the framework using the following command:
import DZAkamaiCollector
Initialize the framework by passing along the "Configuration ID", and player instance:
DZAmpCollector.dzSharedManager.initAkamaiPlayerWith(configID: <configuration id from Datazoom>, url: <url given by Datazoom>, playerInstance: <AMPPlayer object>)
Implementation Steps for Objective-C Language-based Applications
- Create a bridging header file, to allow interoperability of languages.
- Open the ViewController/View file, where the AMPPlayer(akamai player) is included.
Import the following:
#import <AVKit/AVKit.h> #import <AVFoundation/AVFoundation.h> #import <DZAkamaiCollector.h>
Initialize the swift class in the .h file:
DZAkamaiCollector *akamaiObject;
In the .m file, allocate using:
akamaiObject = [[DZAkamaiCollector alloc]init]; [akamaiObject initNativePlayerWithConfigId: <configuration id from Datazoom>, url: <url given by Datazoom>, playerInstance: <AMPPlayer Object>];
Customers Using Google IMA Ads
In order to collect the Google IMA data points, customers should add this plugin library along with the core collector SDK.
Run the command:
open Podfile
Add the DZAkamaiIMA framework after DzAkamai framework in the Podfile
pod 'DZAkamaiIMA', '1.23.0', :source => 'https://gitlab.com/datazoom/pod-specs.git'
- Install the pods
pod update pod install
- Open the ViewController/View file, where the AMPPlayer(Akamai Player) is included.
Import the framework using the following command:
import DZAkamaiIMACollector
Initialise the framework :
var ima: AmpIMAManager! ima = AmpIMAManager(ampPlayer: player, videoView: player.playerView!) DZAkamaiIMACollectorInstance.shared.connect(DZAmpCollector.dzSharedManager, ima)
Customers Using Freewheel Ads
In order to collect the Freewheel data points, customers should add this plugin library along with the core collector SDK.
Run the command:
open Podfile
Add the DZAkamaiFreewheelCollector framework after DzAkamai framework in the Podfile
pod 'DZAkamaiIosFreewheel', '1.23.0', :source => 'https://gitlab.com/datazoom/pod-specs.git'
- Install the pods
pod update pod install
- Open the ViewController/View file, where the AMPPlayer(Akamai Player) is included.
Import the framework using the following command:
import DZAkamaiFreewheelCollector
Initialise the framework: (After DZAmpCollector.dzSharedManager.initAkamaiPlayerWith)
DZAkamaiFreewheelCollectorInstance.shared.connect(DZAmpCollector.dzSharedManager)
Custom Events & Metadata
Datazoom allows customers to collect custom events and metadata that aren't emitted from the video player.
Custom Metadata
Create an NSDictionary with necessary metadata
let metaData = ["customMetadata":"MetadataValue"]
Add the metadata to DZEventCollector
DZAmpCollector.dzSharedManager.customMetaData(metaData)
Example:func sendCustomMetadata(){ DZAmpCollector.dzSharedManager.customMetaData(["customPlayerName" : "iOS Native Player","customDomain":domain]) }
Custom Events
Send Events like below:
DZAmpCollector.dzSharedManager.customEvents("custom_event_name", metadata: nil)
Example:@objc func buttonPushTouched() { DZAmpCollector.dzSharedManager.customEvents("buttonClick", metadata:["customPlayerName":"AkamaiPlayer","customDomainName":"datazoom.io"]) }
Demo Application
- A demo application that shows the usage of this framework is available here:
https://gitlab.com/datazoom/apple-ios-mobile/mobile-ios-akamai-demo/-/tree/develop - This application can be used to test the DZAkamai framework implementation.
Comments
0 comments
Article is closed for comments.