MediaMelon Android Multiplayer Custom SDK Integration Document

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

Step 1: Prerequisites and Setup

Step 2: Instantiate and Register SDK

Step 3: Initialize Playback Session

Step 4: Report Custom Metadata

Step 5: Report Playback Events

Step 6: Report Stream and Track Related Events

Step 7: Report Request Status and Fallback Events

Step 8: Report Ad Events

Step 9: Report Custom Events

Release Notes

Step 1: Prerequisites and Setup

Step 1.1: Add Gradle Dependency:

  1. Add MediaMelon SDK Gradle dependency to app/build.gradle

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

Step 1.2: Provide Manifest Permissions

Add network permissions.

Step 1.3: Import Packages

Step 2: Instantiate and Register SDK

The player application must register the SDK and provide Player Information once the player is initialized. Please note that the values configured during this integration step persist across all subsequent video sessions for that SDK instance.

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: Create SDK instance

For every Player Instance create a new SDK 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 ID

Step 2.5: Report Player Information

Step 2.6: Report Base Player Information

Step 2.7: Report Application Information

Step 2.8: Report Device Information

chevron-rightDevice Info Object Descriptionhashtag

Parameter
Data Type

deviceMarketingName

String

brand

String

deviceModel

String

deviceId

String

os

String

osVersion

String

telecomOperator

String

screenWidth

String

screenHeight

String

Step 2.9: Report Sub Property Id

Step 2.10: Report App Session Id

Report Application Session ID

Step 3: Initialize Playback Session

The SDK must be initialized at the start of each video session. Initialization includes reporting Content Metadata and indicating the intent for playback with the SDK.

Step 3.1: Initialize Session with Content Metadata

Initialize the session with Content Metadata.

chevron-rightContent Metadata Object Descriptionhashtag

Parameter
Data Type
Description

assetId

String

Unique identifier for the video asset.

assetName

String

Human-readable name or title of the video asset.

videoId

String

Unique identifier for the video content. It can be the same as Asset ID or a different logical ID used in your system.

seriesTitle

String

Title of the series to which the episode belongs.

season

String

Name or number of the season (e.g., "Season 1", "S2").

genre

String

Genre of the content, such as "Drama", "Comedy", "Documentary", etc.

episodeNumber

String

Episode number within a season. Useful for TV series or episodic content.

contentType

String

The category or type of content, e.g., "Movie", "Episode", "Clip", "LiveStream".

drmProtection

String

DRM technology used (e.g., “Widevine”, “FairPlay”, “PlayReady”). Use “Unknown” if the content is protected, but the DRM type is unknown. Leave blank for clear (non-DRM) content.

Step 3.2: Report Experiment Name

Report the experiment name as a String.

Step 3.3: Report View Session Id

circle-info

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

Step 3.4: Report Preload

circle-info

Report the preload attribute after initializeSession and before reportUserInitiatedPlayback. The preload value is reset inside initializeSession, so reporting it before this method will be ignored. If you report it after reportUserInitiatedPlayback, the first event will not contain the preload field.

Step 3.5: Report Player Resolution

Step 3.6 Report User Initiated Playback

circle-info

This function indicates the intent for playback and must be reported after initializeSession .

Step 4: 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 5: Report Playback Events

Step 5.1: Report Player State

circle-info

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

chevron-rightMMPlayerStatehashtag

MMPlayerState

PLAYING

PAUSED

STOPPED

Step 5.2: Report Buffering Events

Step 5.3 Report Seek Events

Step 5.4: Report Errors

Step 5.5: Report Warnings

Step 5.6: Report Playback Position

Report Playback position in ms.

Step 6: Report Stream and Track Related Information

Step 6.1: Report Stream URL

Report stream url that is currently being used.

Step 6.2: Report Stream Information

Report Information related to stream

Step 6.3: Report Video Duration

Step 6.4 Report Network Info

circle-info

Use the reportNetworkInfo API to report the CDN along with other network information. If additional network information is not available, use reportCDN instead.

Step 6.5: Report CDN

Step 6.6: Report Track Related Information

Step 6.7: Report Rendition Changes

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

chevron-rightRendition Objecthashtag

Parameter
Data Type

bitrate

int

width

int

height

int

frameRate

double

aCodec

String

vCodec

String

Step 6.8: Update DRM Type

circle-exclamation

Step 6.9: Report Player Download Rate

Report Player download rate in bps

Step 6.10: Report Frame Loss

Step 6.11: Report Encoding Service

Step 7: Report Request Status and Fallback Events

Step 7.1: Report Request Status

chevron-rightRequest Status (Enum)hashtag

Request Status
Description

FAILED

Report on a failed request

CANCELLED

Report on a cancelled request

Step 7.2: Report Stream Fallback event

Report fallback events in case a fallback strategy is applied.

Step 7.3: Update DRM

Step 7.4: Update Content Metadata

Step 7.5: Update Subscriber Information

Step 8: Report Ad Events

Step 8.1: Report Ad Start and End

chevron-rightAdInfo Objecthashtag

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.

Step 8.2: Report Ad Buffering:

Use Ad Buffering APIs to report any buffering that occurs during ad playback. For any buffering event, either content buffering or ad buffering should be reported, but not both.

Step 9: Report Custom Events

The Custom Events API can be used to report events that are not covered by the default MediaMelon-supported events. Custom events must be reported within the SDK activity lifecycle. Events reported before SDK initialization or after session end will be ignored. Please refer to the guidelines and constraints below.

circle-info

Guidelines & Constraints

  • Event Name

    • Maximum length: 35 characters

    • Allowed characters: Alphanumeric and underscore (_) only

    • Special characters are not supported

    • Recommended format: UPPERCASE with underscores (e.g., DRM_CHANGE)

  • Event Limits

    • A maximum of 35 custom events per session is allowed.

Custom events that violate these constraints (invalid event name or exceeding the per-session limit) will be dropped. Event values exceeding 1000 characters will be truncated to 1000 characters.

Release Notes

chevron-rightCurrent Releasehashtag

v2.1.3

  • Added missing methods in the wrapper updateSubscriberInfo and updateContentMetadata .

v2.1.2

  • Initial release with Multi-Player support.

  • New Field playerID addition and API to report it via reportPlayerId .

  • New Field drmLevel addition in contentMetadata.

  • Deprecated updateDrmType API. Added new API called updateDRM to update DRM Protection and DRM Level.

  • New Field adUniversalId addition in AdInfo Object.

  • Added deviceMarketingName and deviceId in the DeviceInfo object.

Last updated