MediaMelon Android IMA Media3 SDK Integration Document
This guide provides detailed instructions on integrating the Android MediaMelon IMA SDK with the Media3 player
Step 1: Set up the build environment
Step 2: Register and Initialise SDK
Step 3: Report Custom Metadata
Step 4: Report Custom Errors
Step 5: Report Ended State
Step 6: Report Stream Info
Step 7: Enable IMA/DAI Ad tracking
Step 1: Set up the build environment
$MEDIA3PROJECT = {Media3 - v1.4.0}
The SDK files should be added to the build environment and the required network permissions should be enabled.
Step 1.1: Add Gradle Dependency:
Using Maven:
Add MediaMelon Media3 Maven dependency to
$MEDIA3PROJECT/demos/main/build.gradle
dependencies {
...
implementation 'com.github.MediamelonSDK:mm-android-sdk-media3-ima:2.2.5'
}Using AAR:
Copy
mmsmartstreaming.aarprovided in the release package for the Media3 project. Example$MEDIA3PROJECT/demos/main/mmsmartstreaming.aar.Add the following library to
$MEDIA3PROJECT/demos/main/build.gradle:-
Step 1.2 Provide Permissions
Add network permissions to $MEDIA3PROJECT/demos/main/src/main/AndroidManifest.xml
Step 1.3: Import Packages
$MEDIA3PROJECT/demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java
Step 2: Register and Initialise SDK
The player application must register the SDK and provide player information once the player is initialized. Please note that values provided in this integration step persist across video sessions.
The SDK must be initialized at the start of each video session. Initialization includes setting the application context, initializing the playback session, and indicating the intent for playback with the SDK.
Step 2.1: Set Context
Set the application context
Step 2.2: Register SDK
Step 2.3: Report Player Information
Step 2.4: Report Base Player Information
Step 2.5: Report Application Information
Step 2.6: Initialize session with Content Metadata
Step 2.7: Report Experiment Name
Step 2.8: Report View Session Id
Step 2.9: Report Sub Property Id
Step 2.10: Report App Session ID
Report Application Session ID
Step 2.11: Report Player Resolution
Step 3: Report Custom Metadata
Step 4: Report Custom Errors
Step 5: Report Ended State
Report ENDED state in PlayerActivity when playback ends.
Step 6: Report Stream Information
Step 6.1: Report Stream Info
Report key stream attributes that describe the encoding and delivery method.
Step 6.2: Report CDN
Report the name or identifier of the Content Delivery Network (CDN) used for streaming. This helps track performance and quality across different CDNs.
Step 6.3: Report Stream Fallback Event
Report fallback event in case the primary manifest URL fails and falls back on the secondary manifest.
Step 7: Enable IMA/DAI Ad tracking
Add the following steps to enable IMA/DAI Ad tracking
7.a: IMA Ad Tracking
7.b: DAI Ad Tracking
The function onAdsManagerLoaded is part of AdsLoader.AdsLoadedListener
Releases Notes
Last updated