MediaMelon Android ExoPlayer SDK Integration Document

This guide provides detailed instructions on integrating the Android MediaMelon SDK with the ExoPlayer.

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

Release Notes

Step 1: Set up the build environment

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:

  1. Add MediaMelon ExoPlayer Maven dependency to /build.gradle

dependencies {
   ...
   implementation 'com.github.MediamelonSDK:mm-android-sdk-exoplayer:v2.19.1-2.3.5'
}

Using AAR:

  1. Copy mmsmartstreaming.aar provided in the release package. Example $project/main/mmsmartstreaming.aar .

  1. Add the following library to build.gradle :-

Step 1.2 Provide Permissions

Add network permissions to AndroidManifest.xml

Step 1.3: Import Packages

Import dependencies in 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 Get Adapter Instance

Step 2.2: Set Context

Set the application context

Step 2.3: Register SDK

circle-info

CUSTOMER_ID is your MediaMelon assigned Customer ID. If you do not know your Customer ID contact MediaMelon at [email protected].

Step 2.4: Report Player Information

Step 2.5: Report Base Player Information

Step 2.6: Report Application Information

Step 2.7: Initialize Session

circle-info

The enableLogTrace() feature should be enabled for testing during the integration process. Set this to False before releasing the player to production.

Step 2.8: Report Experiment Name

Step 2.9: Report View Session Id

circle-info

Report the View Session Id attribute after initializeSession and before reportUserInitiatedPlayback.

Step 2.10: Report Sub Property Id

circle-info

Report the Sub Property ID attribute after initializeSession and before reportUserInitiatedPlayback.

Step 2.11: 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 2.12: Report App Session ID

Step 3: Report Custom Metadata

Check the custom tags configuration in your dashboardarrow-up-right and report accordingly. If the custom tags are not configured, please configure and use them accordingly.

Step 4: Report Ended State

Report ENDED state in PlayerActivity when playback ends.

circle-info

If not reported at the end of the playback, it may reflect a longer playtime.

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.

circle-info

⚠️ Note: Errors that occur before are not captured automatically by the SDK, as they fall outside the player’s event lifecycle. Use the error and warning APIs below to manually report such issues.

🚫 Disabling Auto Error Capture:

If you prefer to handle error reporting manually, you can disable this automatic behavior by calling:

circle-info

⚠️ When disabled, the SDK will not listen for any player-generated errors. You will be responsible for reporting all errors & warnings manually using the APIs described below.

🛠️ 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 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.

circle-info

Note

  • This API must be called for updating asset info for the live streams only

  • This API must be called after the Player has started the playback of the live stream

Release Notes

chevron-rightCurrent Releasehashtag

v2.3.5

  • Support for Seek Duration

  • Internal updates


chevron-rightPrevious Releaseshashtag

Last updated