MediaMelon Android Media3 SDK Integration Document
This guide provides detailed instructions on integrating the Android MediaMelon 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 Ended State
Step 5: Report Errors and Warnings
Step 6: Report Stream Level Information
Step 7: Update Asset Information
Step 1: Set up the build environment
$MEDIA3PROJECT = {Media3 - v1.x.x}
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
main/build.gradle
dependencies {
...
implementation 'com.github.MediamelonSDK:mm-android-sdk-media3:v1.7.1-2.4.0'
}dependencies {
...
implementation 'com.github.MediamelonSDK:mm-android-sdk-media3:v1.4.1-2.4.0'
}dependencies {
...
implementation 'com.github.MediamelonSDK:mm-android-sdk-media3:1.2.1'
}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: Add 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.8: Report Experiment Name
Step 2.9: Report View Session Id
Step 2.10: Report Sub Property Id
Step 2.12: Report App Session ID
Report Application Session ID
Step 2.13: Report Player Resolution
Report the width and height of the player (in pixels). This is useful to understand playback size and user experience across different screen sizes or platforms.
Step 3: Report Custom Metadata
Check the custom tags configuration in your dashboard and report accordingly. If the custom tags are not configured, please configure and use them accordingly.
Step 4: Report Ended State
In $MEDIA3PROJECT/demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java
Step 5: Report Errors and Warnings
The SDK provides two ways to report errors: automatic error capture and manual error reporting via API.
⚙️ Default Behavior (Auto Error Capture):
By default, the SDK automatically listens to and captures player errors that occur during a playback session.
🚫 Disabling Auto Error Capture:
If you prefer to handle error reporting manually, you can disable this automatic behavior by calling:
🛠️ Manual Error Reporting APIs:
Use these APIs to custom report errors and warnings to the SDK—especially for errors that occur before, or when auto-capture is disabled.
🔴 Report Fatal Error:
All errors reported via reportError are treated as fatal.
🟠 Report Warning (Non-Fatal):
All warnings reported via reportWarning are treated as non-fatal and will be tracked accordingly.
Step 6: Report Stream Level 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 6.4: Report Video Duration
Report Video duration in case of live content. Video Duration should be reported after every session initialization and asset update.
Step 7: Update Asset Information
If Asset Information needs to be updated dynamically during the live session without re-initializing the player, then the updateAssetInfo API can be used to update the new AssetInfo.
Release Notes
Last updated