Download extension with dependencies using Maven & Gradle
Copied to your clipboard- implementation 'com.adobe.marketing.mobile:core:2.+'- implementation 'com.adobe.marketing.mobile:identity:2.+'- implementation 'com.adobe.marketing.mobile:analytics:2.+'- implementation 'com.adobe.marketing.mobile:media:3.+'+ implementation platform('com.adobe.marketing.mobile:sdk-bom:2.+')+ implementation 'com.adobe.marketing.mobile:core'+ implementation 'com.adobe.marketing.mobile:edge'+ implementation 'com.adobe.marketing.mobile:edgeidentity'+ implementation 'com.adobe.marketing.mobile:edgemedia'
Download extension with dependencies
1. Using Cocoapods
Copied to your clipboardpod 'AEPCore'- pod 'AEPAnalytics'- pod 'AEPMedia'+ pod 'AEPEdge'+ pod 'AEPEdgeIdentity'+ pod 'AEPEdgeMedia'
2. Using SPM
Import the package:
a. Using repository URL
Copied to your clipboard- https://github.com/adobe/aepsdk-media-ios.git+ https://github.com/adobe/aepsdk-edgemedia-ios.git
b. Using Package.swift
file
Make changes to your dependencies as shown below:
Copied to your clipboarddependencies: [.package(url: "https://github.com/adobe/aepsdk-core-ios.git", .upToNextMajor(from: "4.0.0")),- .package(url: "https://github.com/adobe/aepsdk-analytics-ios.git", .upToNextMajor(from: "4.0.0")),- .package(url: "https://github.com/adobe/aepsdk-media-ios.git", .upToNextMajor(from: "4.0.0"))+ .package(url: "https://github.com/adobe/aepsdk-edge-ios.git", .upToNextMajor(from: "4.0.0")),+ .package(url: "https://github.com/adobe/aepsdk-edgeidentity-ios.git", .upToNextMajor(from: "4.0.0")),+ .package(url: "https://github.com/adobe/aepsdk-edgemedia-ios.git", .upToNextMajor(from: "4.0.0"))]
- Import extensions
Copied to your clipboardimport com.adobe.marketing.mobile.MobileCore;- import com.adobe.marketing.mobile.Identity;- import com.adobe.marketing.mobile.Analytics;- import com.adobe.marketing.mobile.Media;+ import com.adobe.marketing.mobile.Edge;+ import com.adobe.marketing.mobile.edge.identity.Identity;+ import com.adobe.marketing.mobile.edge.media.Media;
- Register extensions
Copied to your clipboardpublic class MainApp extends Application {private final String ENVIRONMENT_FILE_ID = "YOUR_APP_ENVIRONMENT_ID";@Overridepublic void onCreate() {super.onCreate();MobileCore.setApplication(this);MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID);- List<Class<? extends Extension>> extensions = Arrays.asList(- Media.EXTENSION, Analytics.EXTENSION, Identity.EXTENSION);+ List<Class<? extends Extension>> extensions = Arrays.asList(+ Media.EXTENSION, Edge.EXTENSION, Identity.EXTENSION);MobileCore.registerExtensions(extensions, o -> {Log.d(LOG_TAG, "AEP Mobile SDK is initialized");});}}
- Import extensions
Copied to your clipboard// AppDelegate.swiftimport AEPCore- import AEPIdentity- import AEPAnalytics- import AEPMedia+ import AEPEdge+ import AEPEdgeIdentity+ import AEPEdgeMedia
- Register extensions
Copied to your clipboard// AppDelegate.swiftfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {- MobileCore.registerExtensions([Identity.self, Analytics.self, Media.self], {+ MobileCore.registerExtensions([Edge.self, Identity.self, Media.self], {MobileCore.configureWith(appId: "yourEnvironmentID")})...}
package name
The Media for Edge Network extension uses the same class names as the Media Analytics extension. The Java package, however, is changed to com.adobe.marketing.mobile.edge.media
.
Copied to your clipboard- import com.adobe.marketing.mobile.Media;- import com.adobe.marketing.mobile.MediaConstants;- import com.adobe.marketing.mobile.MediaTracker;+ import com.adobe.marketing.mobile.edge.media.Media;+ import com.adobe.marketing.mobile.edge.media.MediaConstants;+ import com.adobe.marketing.mobile.edge.media.MediaTracker;
createMediaObject
Copied to your clipboard- public static HashMap<String, Object> createMediaObject(String name,- String id,- double length,- String streamType,- MediaType mediaType);+ public static HashMap<String, Object> createMediaObject(String name,+ String id,+ int length,+ String streamType,+ MediaType mediaType);
createAdBreakObject
Copied to your clipboard- public static HashMap<String, Object> createAdBreakObject(String name, long position, double startTime);+ public static HashMap<String, Object> createAdBreakObject(String name, int position, int startTime);
createAdObject
Copied to your clipboard- public static HashMap<String, Object> createAdObject(String name, String id, long position, double length);+ public static HashMap<String, Object> createAdObject(String name, String id, int position, int length);
createChapterObject
Copied to your clipboard- public static HashMap<String, Object> createChapterObject(String name,- long position,- double length,- double startTime);+ public static HashMap<String, Object> createChapterObject(String name,+ int position,+ int length,+ int startTime);
createQoeObject
Copied to your clipboard- public static HashMap<String, Object> createQoEObject(long bitrate,- double startupTime,- double fps,- long droppedFrames);+ public static HashMap<String, Object> createQoEObject(int bitrate,+ int startupTime,+ int fps,+ int droppedFrames);
updateCurrentPlayhead
Copied to your clipboard- public void updateCurrentPlayhead(double time);+ public void updateCurrentPlayhead(int time);
createMediaObjectWith
Copied to your clipboard- static func createMediaObjectWith(name: String, id: String, length: Double, streamType: String, mediaType: MediaType) -> [String: Any]?+ static func createMediaObjectWith(name: String, id: String, length: Int, streamType: String, mediaType: MediaType) -> [String: Any]?
createAdBreakObjectWith
Copied to your clipboard- static func createAdBreakObjectWith(name: String, position: Int, startTime: Double) -> [String: Any]?+ static func createAdBreakObjectWith(name: String, position: Int, startTime: Int) -> [String: Any]?
createAdbjectWith
Copied to your clipboard- static func createAdObjectWith(name: String, id: String, position: Int, length: Double) -> [String: Any]?+ static func createAdObjectWith(name: String, id: String, position: Int, length: Int) -> [String: Any]?
createChapterObjectWith
Copied to your clipboard- static func createChapterObjectWith(name: String, position: Int, length: Double, startTime: Double) -> [String: Any]?+ static func createChapterObjectWith(name: String, position: Int, length: Int, startTime: Int) -> [String: Any]?
createQoEObjectWith
Copied to your clipboard- static func createQoEObjectWith(bitrate: Double, startupTime: Double, fps: Double, droppedFrames: Double) -> [String: Any]?+ static func createQoEObjectWith(bitrate: Int, startupTime: Int, fps: Int, droppedFrames: Int) -> [String: Any]?
updateCurrentPlayhead
Copied to your clipboard- func updateCurrentPlayhead(time: Double)+ func updateCurrentPlayhead(time: Int)
Java
Copied to your clipboard+ HashMap<String, Object> trackerConfig = new HashMap<>();+ trackerConfig.put(MediaConstants.Config.AD_PING_INTERVAL, 1);- MediaTracker tracker = Media.createTracker()+ MediaTracker tracker = Media.createTrackerWith(trackerConfig);HashMap<String, Object> mediaObject = Media.createMediaObject("name", "id", 30, "vod", Media.MediaType.Video);- mediaObject.put(MediaConstants.MediaObjectKey.GRANULAR_AD_TRACKING, true)HashMap<String, String> videoMetadata = new HashMap<String, String>();videoMetadata.put(MediaConstants.VideoMetadataKeys.EPISODE, "Sample Episode");videoMetadata.put(MediaConstants.VideoMetadataKeys.SHOW, "Sample Show");tracker.trackSessionStart(mediaObject, videoMetadata)
Swift
Copied to your clipboard+ var trackerConfig: [String: Any] = [:]+ trackerConfig[MediaConstants.TrackerConfig.AD_PING_INTERVAL] = 1- let tracker = Media.createTracker()+ let tracker = Media.createTrackerWith(config: trackerConfig)guard var mediaObject = Media.createMediaObjectWith(name: "name", id: "id", length: 30, streamType: "vod", mediaType: MediaType.Video) else {return}- mediaObject[MediaConstants.MediaObjectKey.GRANULAR_AD_TRACKING] = truetracker.trackSessionStart(info: mediaObject, metadata: videoMetadata)