从独立 Media SDK 迁移到 Adobe Launch - iOS

NOTE
Adobe Experience Platform Launch 已更名为 Experience Platform 中的一套数据收集技术。因此,产品文档中的术语有一些改动。有关术语更改的综合参考,请参阅以下文档

配置

独立 Media SDK

在独立 Media SDK 中,您可以在该应用程序中配置跟踪配置,
并在创建跟踪器时将该配置传递给 SDK。

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 扩展

  1. 在 Experience Platform Launch 中,单击适用于您的移动属性的扩展选项卡

  2. 在目录选项卡上,找到 Adobe Media Analytics for Audio and Video 扩展,然后单击安装。

  3. 在扩展设置页面中,配置跟踪参数。
    Media 扩展将使用已配置的参数进行跟踪。

配置 Media Analytics 扩展

创建跟踪器

独立 Media SDK

在独立 Media SDK 中,您可以手动创建 ADBMediaHeartbeatConfig 对象并配置跟踪参数。实施公开 getQoSObject()getCurrentPlaybackTime()functions. 的委派接口。

创建用于跟踪的 MediaHeartbeat 实例:

@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 扩展

媒体 API 引用 — 创建媒体跟踪器

在创建跟踪器之前,请先使用移动核心注册媒体扩展和从属扩展。

// 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;
}

注册媒体扩展后,可以使用以下 API 创建跟踪器。
该跟踪器会自动从已配置的 Launch 属性中选取配置。

[ACPMedia createTracker:^(ACPMediaTracker * _Nullable mediaTracker) {
    // Use the instance for tracking media.
}];

更新“播放头”和“体验质量”值。

独立 Media SDK

在独立 Media SDK 中,在创建跟踪器期间传递实施 ADBMediaHeartbeartDelegate 协议的委派对象。
每当跟踪器调用 getQoSObject()getCurrentPlaybackTime() 接口方法时,该实施应返回最新的 QoE 和播放头。

Launch 扩展

该实施应通过调用跟踪器公开的 updateCurrentPlayhead 方法来更新当前播放器的播放头。要进行准确跟踪,您应至少每秒调用一次此方法。

媒体 API 引用 — 更新当前播放头

该实施应通过调用跟踪器公开的 updateQoEObject 方法来更新 QoE 信息。只要质量量度发生变化,您就应调用此方法。

媒体 API 引用 — 更新 QoE 对象

传递标准媒体/广告元数据

独立 Media SDK

  • 标准媒体元数据:

    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];
    
  • 标准广告元数据:

    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 扩展

  • 标准媒体元数据:

    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];
    
  • 标准广告元数据:

    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];
    
recommendation-more-help
c8eee520-cef5-4f8c-a38a-d4952cfae4eb