MediaMelon Android Custom Multi Player SDK Integration Document

This guide provides detailed instructions on integrating the Android MediaMelon Custom SDK with the Media3 player.

Step 1: Prerequisites and Setup

Step 2: Register and Initialize SDK

Step 3: Report Session Level Details

Step 4: Report Player Events

Step 5: Report Stream and Track Related Events

Step 6: Report Network Related Information

Step 7: Report Errors and Fallbacks

Step 8: Report Ad Events

Step 1: Prerequisites and Setup

  • MediaMelon Media3 SDK Maven dependencies or the provided AAR file is necessary.

Step 1.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.

  1. Add MediaMelon Media3 Maven dependency to $MEDIA3PROJECT/demos/main/build.gradle

  2. Copy mmsmartstreaming.aar provided in the release package for the Media3 project. Example $MEDIA3PROJECT/demos/main/mmsmartstreaming.aar .

dependencies {
   ...
  implementation 'com.github.MediamelonSDK:mm-java-custom-sdk:2.0.1'
}

Step 1.2: Provide Manifest 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.

circle-info

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

MMSmartStreamingMedia3.enableLogTrace(false);

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.1: Get SDK instance

For every new player instance create a new sdk instance.

Step 2.2: Initialize session with SDK instance

Device Info

Parameter
Data Type

brand

String

deviceModel

String

os

String

osVersion

String

telecomOperator

String

screenWidth

String

screenHeight

String

Step 3: Report Session level details

Step 3.1 Report Experiment Name

Report the experiment names as a list of String.

Step 3.2: Report View Session Id

Step 3.3: Report Sub Property Id

Step 3.4: Report Time Shift Enabled / DVR enabled

Step 3.5: Report Page Type

Step 3.6: Report PiP Mode

Report the PiP status of the player. If the player goes into PiP mode throughout the session report true.

Step 3.7: Report Device Orientation

Report current orientation of device as string.

Step 3.8: Report Custom Metadata

Report additional custom metadata

Step 4: Report Player Events

Step 4.1: Report Player State

circle-info

Make sure to report MMPlayerState.STOPPED at the end of playback completion to mark session as ended.

MMPlayerState

PLAYING

PAUSED

STOPPED

Step 4.2: Report Buffering Events

Step 4.3 Report Seek Events

Step 4.4: Report Playback Position

Report Playback position in ms.

Step 5: Report Stream and Track Related Information

Step 5.1: Report Stream URL

Report stream url that is currently being used.

Step 5.2: Report Stream Information

Report Information related to stream

Step 5.3: Report Video Duration

Step 5.4: Report Track Related Information

Step 5.5: Report Rendition Changes

Report changes in the rendition of current stream wrapped in the Rendition object.

Rendition Object

Parameter
Data Type

bitrate

int

width

int

height

int

frameRate

double

aCodec

String

vCodec

String

Step 6: Report Network Related Information

Step 6.1 Report Network Info

Step 6.2: Report Request Status

RequestStatus

FAILED

CANCELLED

Step 6.3: Report Player Download rate

Step 7: Report Errors & Fallbacks

Step 7.1: Report Fatal Errors

Step 7.2: Report Warnings

Step 7.3: Report Stream Fallback event

Report fallback events in case a fallback strategy is applied.

Step 7.4: Update DRM Type

Step 7.5: Update Content Metadata

Step 8: Report Ad Events

Step 8.1: Report Ad Breaks

Step 8.2: Report Ad Start and End

Step 8.3 Report Ad Quartile Events

Step 8.4 Report Ad Request/Response (Optional)

AdInfo Object

adInfo.adTitle

The title or name of the ad, usually provided in the VAST metadata or by the ad server.

adInfo.adId

A unique identifier for the ad creative, often defined by the ad server or DSP.

adInfo.adCreativeId

The creative ID associated with the specific ad asset (video, image, etc.). Helps in tracking and reporting creative-level performance.

adInfo.adCreativeType

The format or type of the ad creative. For example, video/mp4, image/jpeg, etc., or linear, non-linear.

adInfo.adClient

The SDK or client library responsible for requesting and playing the ad. Example: Google IMA, Freewheel, SpotX.

adInfo.adPosition

The timing of the ad in relation to the main content: "pre" (before), "mid" (during), or "post" (after).

adInfo.adServer

The ad server or source that delivered the ad. Example: Google Ad Manager, Freewheel, etc.

adInfo.adResolution

The resolution of the ad video (e.g., 1920x1080), useful for reporting and quality monitoring.

adInfo.adUrl

The URL from which the ad video is fetched. Typically a media file or stream URL.

adInfo.adDuration

The total duration of the ad, in milliseconds. Example: 30000 = 30 seconds.

adInfo.adPodIndex

The index of the ad pod within the stream. Ad pods are groups of ads played together (like a commercial break).

adInfo.adPositionInPod

The position of the ad within its pod (e.g., 1st ad, 2nd ad in the group).

adInfo.adPodLendth

The total number of ads in the current pod. Useful for showing “Ad 2 of 5” type of UI.

adInfo.isBumper

A boolean (true/false) indicating whether the ad is a bumper ad (short ad, usually <6s, played at the start or end of ad breaks).

adInfo.adUniversalId

A String value to report Ad Universal ID.

Last updated