Migrating from the standalone Media SDK to Adobe Launch - iOS
Configuration
Standalone Media SDK
In the standalone Media SDK, you configure the tracking configuration in the app,
and pass it to the SDK when you create the tracker.
ADBMediaHeartbeatConfig *config =
[[ADBMediaHeartbeatConfig alloc] init];
config.trackingServer = @"namespace.hb.omtrdc.net";
config.channel = @"sample-channel";
config.appVersion = @"v2.0.0";
config.ovp = @"video-provider";
config.playerName = @"native-player";
config.ssl = YES;
config.debugLogging = YES;
ADBMediaHeartbeat* tracker =
[[ADBMediaHeartbeat alloc] initWithDelegate:self config:config];
Launch Extension
-
In Experience Platform Launch, click the Extensions tab for your mobile property
-
On the Catalog tab, locate the Adobe Media Analytics for Audio and Video extension, and click Install.
-
In the extension settings page, configure the tracking parameters.
The Media extension will use the configured parameters for tracking.
Configure the Media Analytics extension
Tracker Creation
Standalone Media SDK
In the standalone Media SDK you manually create the ADBMediaHeartbeatConfig
object
and configure the tracking parameters. Implement the delegate interface exposing thegetQoSObject()
and getCurrentPlaybackTime()functions.
Create a MediaHeartbeat instance for tracking:
@interface PlayerDelegate : NSObject<ADBMediaHeartbeatDelegate>
@end
@implementation PlayerDelegate {
}
- (NSTimeInterval) getCurrentPlaybackTime {
// When called should return the current player time in seconds.
return playhead_;
}
- (nonnull ADBMediaObject*) getQoSObject {
// When called should return the latest qos values.
return qosObject_;
}
@end
ADBMediaHeartbeatConfig *config = [[ADBMediaHeartbeatConfig alloc] init];
config.trackingServer = @"namespace.hb.omtrdc.net";
config.channel = @"sample-channel";
config.appVersion = @"app-version";
config.ovp = @"video-provider";
config.playerName = @"native-player";
config.ssl = YES;
config.debugLogging = YES;
ADBMediaHeartbeatDelegate* delegate = [[PlayerDelegate alloc] init];
ADBMediaHeartbeat* tracker =
[[ADBMediaHeartbeat alloc] initWithDelegate:delegate config:config];
Launch Extension
Media API reference - Create Media Tracker
Before creating the tracker, register the media extension and dependent extensions with the mobile core.
// Register the extension once during app launch
#import <ACPCore.h>
#import <ACPAnalytics.h>
#import <ACPMedia.h>
#import <ACPIdentity.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPCore setLogLevel:ACPMobileLogLevelDebug];
[ACPCore configureWithAppId:@"your-launch-app-id"];
[ACPMedia registerExtension];
[ACPAnalytics registerExtension];
[ACPIdentity registerExtension];
[ACPCore start:nil];
return YES;
}
Once the media extension is registered, tracker can be created using the following API.
The tracker automatically picks the configuration from the configured launch property.
[ACPMedia createTracker:^(ACPMediaTracker * _Nullable mediaTracker) {
// Use the instance for tracking media.
}];
Updating Playhead and Quality of Experience values.
Standalone Media SDK
In the standalone Media SDK, a delegate object that implements theADBMediaHeartbeartDelegate
protocol is passed during tracker creation.
The implementation should return the latest QoE and playhead whenever the
tracker calls the getQoSObject()
and getCurrentPlaybackTime()
interface
methods.
Launch Extension
The implementation should update the current player playhead by called theupdateCurrentPlayhead
method exposed by the tracker. For accurate tracking
you should call this method at least once per second.
Media API reference - Update Current Playhead
The implementation should update the QoE information by calling theupdateQoEObject
method exposed by the tracker. You should call this method
whenever there is a change in the quality metrics.
Media API reference - Update QoE Object
Passing standard media / ad metadata
Standalone Media SDK
-
Standard Media Metadata:
code language-objective-c ADBMediaObject *mediaObject = [ADBMediaHeartbeat createMediaObjectWithName:@"media-name" mediaId:@"media-id" length:60 streamType:ADBMediaHeartbeatStreamTypeVod mediaType:ADBMediaTypeVideo]; // Standard metadata keys provided by adobe. NSMutableDictionary *standardMetadata = [[NSMutableDictionary alloc] init]; [standardMetadata setObject:@"Sample show" forKey:ADBVideoMetadataKeySHOW]; [standardMetadata setObject:@"Sample season" forKey:ADBVideoMetadataKeySEASON]; [mediaObject setValue:standardMetadata forKey:ADBMediaObjectKeyStandardMediaMetadata]; //Attaching custom metadata NSMutableDictionary *videoMetadata = [[NSMutableDictionary alloc] init]; [mediaMetadata setObject:@"false" forKey:@"isUserLoggedIn"]; [mediaMetadata setObject:@"Sample TV station" forKey:@"tvStation"]; [tracker trackSessionStart:mediaObject data:mediaMetadata];
-
Standard Ad Metadata:
code language-objective-c ADBMediaObject* adObject = [ADBMediaHeartbeat createAdObjectWithName:[adData objectForKey:@"name"] adId:[adData objectForKey:@"id"] position:[[adData objectForKey:@"position"] doubleValue] length:[[adData objectForKey:@"length"] doubleValue]]; // Standard metadata keys provided by adobe. NSMutableDictionary *standardMetadata = [[NSMutableDictionary alloc] init]; [standardMetadata setObject:@"Sample Advertiser" forKey:ADBAdMetadataKeyADVERTISER]; [standardMetadata setObject:@"Sample Campaign" forKey:ADBAdMetadataKeyCAMPAIGN_ID]; [adObject setValue:standardMetadata forKey:ADBMediaObjectKeyStandardAdMetadata]; //Attaching custom metadata NSMutableDictionary *adDictionary = [[NSMutableDictionary alloc] init]; [adDictionary setObject:@"Sample affiliate" forKey:@"affiliate"]; [tracker trackEvent:ADBMediaHeartbeatEventAdStart mediaObject:adObject data:adDictionary];
Launch Extension
-
Standard Media Metadata:
code language-objective-c NSDictionary *mediaObject = [ACPMedia createMediaObjectWithName:@"media-name" mediaId:@"media-id" length:60 streamType:ACPMediaStreamTypeVod mediaType:ACPMediaTypeVideo]; NSMutableDictionary *mediaMetadata = [[NSMutableDictionary alloc] init]; // Standard metadata keys provided by adobe. [mediaMetadata setObject:@"Sample show" forKey:ACPVideoMetadataKeyShow]; [mediaMetadata setObject:@"Sample season" forKey:ACPVideoMetadataKeySeason]; // Custom metadata keys [mediaMetadata setObject:@"false" forKey:@"isUserLoggedIn"]; [mediaMetadata setObject:@"Sample TV station" forKey:@"tvStation"]; [_tracker trackSessionStart:mediaObject data:mediaMetadata];
-
Standard Ad Metadata:
code language-objective-c NSDictionary* adObject = [ACPMedia createAdObjectWithName:@"ad-name" adId:@"ad-id" position:1 length:15]; NSMutableDictionary* adMetadata = [[NSMutableDictionary alloc] init]; // Standard metadata keys provided by adobe. [adMetadata setObject:@"Sample Advertiser" forKey:ACPAdMetadataKeyAdvertiser]; [adMetadata setObject:@"Sample Campaign" forKey:ACPAdMetadataKeyCampaignId]; // Custom metadata keys [adMetadata setObject:@"Sample affiliate" forKey:@"affiliate"]; [tracker trackEvent:ACPMediaEventAdStart mediaObject:adObject data:adMetadata];