MediaMelon Android Custom SDK Integration Document

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

Step 1: Set Up Build Environment

Step 2: Register and Initialize the SDK

Step 3: Report Custom Metadata

Step 4: Report Playback Events

Step 5: Report Stream and Network Related Information

Step 6: Report Request Status and Fallback Events

Step 7: Report Ad Events

Release Notes

Step 1: Set up the build environment

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:1.2.9'
}

Step 1.2 Provide Permissions

Add network permissions to AndroidManifest.xml

Step 1.3: Import Packages

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);

Step 2.1: Set Context

Set the application context

Step 2.2: 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.3: Report Player Information

Step 2.4: Report Base Player Information

Step 2.5: Report Application Information

Step 2.6: Report Device Information

chevron-rightDevice Info Object Descriptionhashtag
Parameter
Data Type
Description

brand

String

Company or Brand to which the device belongs. Ex: Samsung

deviceModel

String

Model Identifier of the device. Ex: SM-1921

deviceType

String

The type of device. Ex: Smart TV

os

String

Operatin system name. Ex: Android, iOS, etc

osVersion

String

Operating system verion. Ex: 14, 18.2.0

telecomOperator

String

Telecom operator currently used.

screenWidth

String

Screen width of the device

screenHeight

String

Screen height of the device

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

Report Application Session ID

Step 2.13: Report Device ID

Step 2.14 Report Device Marketing Name

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 Playback Events

Step 4.1: Report Player State

Report the player state using the following function.

chevron-rightMMPlayerStatehashtag
MMPlayerState
Description

PLAYING

Report when video starts playing froma paused state or on first frame rendered

PAUSED

Report when video paused

STOPPED

Report when user exits the video playback

Step 4.2: Report Buffering Events

Step 4.3: Report Seek Events

Step 4.4: Report Errors

Step 4.5: Report Warnings

Step 4.6: Report Playback Position

Step 5.1: Report Stream URL

Report stream url that is currently being used.

Step 5.2: Report Video Duration

Step 5.3: Report Stream Information

Report Information related to the stream

Step 5.4: Report Network Information

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 5.5: Report CDN

Step 5.6: Report Track Information

Step 5.7: Report Rendition

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

chevron-rightRendition Objecthashtag
Parameter
Data Type
Description

bitrate

int

Current bitrate at which the video is playing

width

int

current width of the video

height

int

current height of the video

frameRate

double

current frame rate of the video

aCodec

String

current Audio Codec of video

vCodec

String

current Video Codec of video

Step 5.7: Update DRM Type

Step 5.8: Report Player Download Rate

Report Player download rate in bps

Step 5.9: Report Frame Loss

Step 6: Report Request Status and Fallback Events

Step 6.1: Report Request Status

chevron-rightRequestStatus (Enum)hashtag
Request Status
Description

FAILED

Report on a failed request

CANCELLED

Report on a cancelled request

Step 6.2: Report Fallback event

Report fallback events in case a fallback strategy is applied.

Step 6.3: Update Content Metadata

Step 6.4: Update Subscriber Info

Step 7: Report Ad Events

chevron-rightAdInfo Objecthashtag
Parameter
Data Type
Description

adClient

String

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

adId

String

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

adDuration

Double

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

adPosition

String

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

adCreativeType

String

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

adServer

String

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

adResolution

String

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

adPodIndex

int

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

adPositionInPod

int

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

isBumper

Boolean

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).

adCreativeId

String

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

adUrl

String

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

adTitle

String

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

adBitRate

int

Bitrate at which the ad is playing

adTimeStamp

Long

Timestamp of ad as received

Release Notes

chevron-rightCurrent Releasehashtag

v1.2.9

  • Added an additional API to report CDN alone.

  • Added CDN_CHANGE event.

  • Added Internal functionality to report seek duration.


chevron-rightPrevious Releaseshashtag

v1.2.8

  • Added Api to report frame loss

  • Added Api to report Device ID

  • Added Api to report Device Marketing Name

  • Internal Improvements for Device Info and Network Info

  • Improved bitrate reporting for weighted average bitrate calculation

  • Updated internal SDK version format

v1.2.7

  • Preload field addition

  • App Session Id field addition

  • Fix to consider Exit in Buffering

  • New metrics to enable upscale and downscale %s for bitrate and resolution

  • Improved failed and offline payloads queueing

v1.2.6

  • CPU optimisation

  • fix: ENDED event in case of EBVS

Last updated