Migrating to AEPMedia reference
This document is a reference comparison of AEPMedia (3.x) APIs against their equivalent ACPMedia (2.x) APIs.
The AEPMedia extension is implemented purely in Swift and is compatible with the AEPCore Swift SDK. To ensure a smooth transition from the ACPMedia SDK, there are no major changes on the API names or definition. For more details, follow the migration guide below for your Swift or Objective-C mobile application. If explanation beyond showing API differences is necessary, it will be captured as an info hint within that API's section.
Type | AEP 3.x (Swift) | AEP 3.x (Objective-C) | ACP 2.x (Objective-C) |
---|---|---|---|
Primary Class | Media | AEPMobileMedia | ACPMedia |
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static var extensionVersion: String
+ (nonnull NSString*) extensionVersion;
+ (nonnull NSString*) extensionVersion;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createTracker()
+ (id<AEPMediaTracker> _Nonnull) createTracker;
+(ACPMediaTracker* _Nullable) createTracker;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createTrackerWith(config: [String: Any]?)
+ (id<AEPMobileMediaTracker> _Nonnull) createTrackerWithConfig:(NSDictionary<NSString *,id) * _Nullable) config;
+ (ACPMediaTracker* _Nullable) createTrackerWithConfig: (NSDictionary* _Nullable) config;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createMediaObjectWith(name: String, id: String, length: Double, streamType: String, mediaType: MediaType) -> [String: Any]?
+ (NSDictionary*<NSString *,id> *_Nullable) createMediaObjectWith: (NSString *, _Nonnull) name
id: (NSString * _Nonnull) id
length: (double) length
streamType: (NSString * _Nonnull) streamType
mediaType: (enum AEPMediaType) mediaType;
+ (NSDictionary* _Nonnull) createMediaObjectWithName: (NSString* _Nonnull) name
mediaId: (NSString* _Nonnull) mediaId
length: (double) length
streamType: (NSString* _Nonnull) streamType
mediaType: (ACPMediaType) mediaType;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createAdBreakObjectWith(name: String, position: Int, startTime: Double) -> [String: Any]?
+ (NSDictionary<NSString * ,id> * _Nullable) createAdBreakObjectWith: (NSString * _Nonnull) name
position: (NSInteger) position
startTime: (double) startTime,
+ (NSDictionary* _Nonnull) createAdBreakObjectWithName: (NSString* _Nonnull) name
position: (double) position
startTime: (double) startTime;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createAdObjectWith(name: String, id: String, position: Int, length: Double) -> [String: Any]?
+ (NSDictionary<NSString * ,id>) * _Nullable) createAdObjectWith: (NSString * _Nonnull) name
id: (NSString * _Nonnull) id
position: (NSInteger) position
length: (double) length;
+ (NSDictionary* _Nonnull) createAdObjectWithName: (NSString* _Nonnull) name
adId: (NSString* _Nonnull) adId
position: (double) position
length: (double) length;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createChapterObjectWith(name: String, position: Int, length: Double, startTime: Double) -> [String: Any]?
+ (NSDictionary<NSString * ,id>) * _Nullable) createChapterObjectWith: (NSString * _Nonnull) name
position: (NSInteger) position
length: (double) length
startTime: (double) startTime;
+ (NSDictionary* _Nonnull) createChapterObjectWithName: (NSString* _Nonnull) name
position: (double) position
length: (double) length
startTime: (double) startTime;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createQoEObjectWith(bitrate: Double, startupTime: Double, fps: Double, droppedFrames: Double) -> [String: Any]?
+ (NSDictionary<NSString * ,id>) * _Nullable) createQoEObjectWith: (double) bitrate
startTime: (double) startTime
fps: (double) fps
droppedFrames: (double) droppedFrames;
+ (NSDictionary* _Nonnull) createQoEObjectWithBitrate: (double) bitrate
startupTime: (double) startupTime
fps: (double) fps
droppedFrames: (double) droppedFrames;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
static func createStateObjectWith(stateName: String) -> [String: Any]
+ (NSDictionary<NSString * ,id>) * _Nullable) createStateObjectWith: (NSString * _Nonnull) stateName;
+ (NSDictionary* _Nonnull) createStateObjectWithName: (NSString* _Nonnull) stateName;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackEvent(event: MediaEvent, info: [String: Any]?, metadata: [String: String]?)
- (void) trackEvent: (enum AEPMediaEvent) event
info: (NSDictionary* <NSString *,id> * _Nullable) info
data: (NSDictionary* <NSString *,NSString> * _Nullable) data;
- (void) trackEvent: (ACPMediaEvent) event
info: (NSDictionary* _Nullable) info
data: (NSDictionary* _Nullable) data;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public func trackSessionStart(info: [String: Any], metadata: [String: String]? = nil)
- (void) trackSessionStart:(NSDictionary<NSString *,id> * _Nonnull) mediaInfo metadata:(NSDictionary<NSString *,NSString *> * _Nullable) data;
- (void) trackSessionStart: (NSDictionary* _Nonnull) mediaInfo data: (NSDictionary* _Nullable) contextData;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackPlay()
- (void) trackPlay;
- (void) trackPlay;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackPause()
- (void) trackPause;
- (void) trackPause;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackComplete()
- (void) trackComplete;
- (void) trackComplete;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackSessionEnd()
- (void) trackSessionEnd;
- (void) trackSessionEnd;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func trackError(errorId: String)
- (void) trackError: (NSString* _Nonnull) errorId;
- (void) trackError: (NSString* _Nonnull) errorId;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func updateCurrentPlayhead(time: Double)
- (void) updateCurrentPlayhead: (double) time;
- (void) updateCurrentPlayhead: (double) time;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
func updateQoEObject(qoe: [String: Any])
- (void) updateQoEObject: (NSDictionary*<NSString *,id> _Nonnull) qoeObject;
- (void) updateQoEObject: (NSDictionary* _Nonnull) qoeObject;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public enum MediaType: Int, RawRepresentable {
//Constant defining media type for Video streams
case Audio
//Constant defining media type for Audio streams
case Video
}
@objc(AEPMediaType)
public enum MediaType: Int, RawRepresentable {
//Constant defining media type for Video streams
case Audio
//Constant defining media type for Audio streams
case Video
}
typedef NS_ENUM(NSInteger, ACPMediaType) {
/**
* Constant defining media type for Video streams
*/
ACPMediaTypeVideo,
/**
* Constant defining media type for Audio streams
*/
ACPMediaTypeAudio
};
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class StreamType: NSObject {
// Constant defining stream type for VOD streams.
public static let VOD = "vod"
}
public class MediaConstants: NSObject {
@objc(AEPMediaStreamType)
public class StreamType: NSObject {
// Constant defining stream type for VOD streams.
public static let VOD = "vod"
}
}
/**
* Constant defining stream type for VOD streams
*/
FOUNDATION_EXPORT NSString* _Nonnull const ACPMediaStreamTypeVod;
For the full list of constant type, refer to [Media API reference]((media-api-reference#stream-type)).
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class VideoMetadataKeys: NSObject {
public static let SHOW = "a.media.show"
}
public class MediaConstants: NSObject {
@objc(AEPVideoMetadataKeys)
public class VideoMetadataKeys: NSObject {
public static let SHOW = "a.media.show"
}
}
FOUNDATION_EXPORT NSString* _Nonnull const ACPVideoMetadataKeyShow;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class AudioMetadataKeys: NSObject {
public static let ARTIST = "a.media.artist"
}
public class MediaConstants: NSObject {
@objc(AEPAudioMetadataKeys)
public class AudioMetadataKeys: NSObject {
public static let ARTIST = "a.media.artist"
}
}
FOUNDATION_EXPORT NSString* _Nonnull const ACPAudioMetadataKeyArtist;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class AdMetadataKeys: NSObject {
public static let ADVERTISER = "a.media.ad.advertiser"
}
public class MediaConstants: NSObject {
@objc(AEPAdMetadataKeys)
public class AdMetadataKeys: NSObject {
public static let ADVERTISER = "a.media.ad.advertiser"
}
}
FOUNDATION_EXPORT NSString* _Nonnull const ACPAdMetadataKeyAdvertiser;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class PlayerState: NSObject {
public static let FULLSCREEN = "fullscreen"
}
public class MediaConstants: NSObject {
@objc(AEPMediaPlayerState)
public class PlayerState: NSObject {
public static let FULLSCREEN = "fullscreen"
}
}
FOUNDATION_EXPORT NSString* _Nonnull const ACPMediaPlayerStateFullScreen;
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public enum MediaEvent: Int, RawRepresentable {
// event type for AdBreak start
case AdBreakStart
}
@objc(AEPMediaEvent)
public enum MediaEvent: Int, RawRepresentable {
// event type for AdBreak start
case AdBreakStart
}
typedef NS_ENUM(NSInteger, ACPMediaEvent) {
/**
* Constant defining event type for AdBreak start
*/
ACPMediaEventAdBreakStart,
}
AEP 3.x (Swift)
AEP 3.x (Objective-C)
ACP 2.x (Objective-C)
public class MediaObjectKey: NSObject {
public static let RESUMED = "media.resumed"
}
}
public class MediaConstants: NSObject {
@objc(AEPMediaObjectKey)
public class MediaObjectKey: NSObject {
public static let RESUMED = "media.resumed"
}
}
FOUNDATION_EXPORT NSString* _Nonnull const ACPMediaKeyMediaResumed;