MediaMelon
  • MediaMelon SDK Integration
  • MediaMelon SDK Events
  • MediaMelon Player SDK Integration
    • React Native
      • React Native Video v5.2.0 with Mediamelon SDK
      • React Native Video v6.4.2 with Mediamelon SDK
    • Web SDK
      • VideoJS Web with Mediamelon Analytics
      • VideoJS Web with Google DAI
      • Shaka Player Web v4
      • MediaMelon Web Kaltura Player Plugin Integration Document
      • NexPlayer Web v4
      • THEOPlayer Web
      • JWPlayer Web
      • Radiant Player Web
      • ChromeCast Player
      • HLSJS Player Web
      • HbbTV SDK
      • Comcast PDK 6
      • Bitmovin Web Player
      • HTML5 Player Web
      • Flow Player Web
      • DashJS Player Web
      • Castlabs Player Web
      • Cordova Plugin Toast (Smart TV)
      • Custom Player Web SDK
      • Plyr Player Web with MediaMelon Analytics
      • React Player SDK with IMA
    • Android SDK
      • App Analytics SDK
      • Bitmovin Android v3.73 with Content Provider Metrics
      • Exoplayer v2.13.2 integration with MediaMelon SDK
      • Exoplayer v2.17.1 with Mediamelon SDK
      • Exoplayer v2.12.2 integration with MediaMelon SDK
      • EXOPlayer-Android(V2.14.2) MediaMelon SDK with Google IMA DAI
      • EXOPlayer-Android(V2.17.1) MediaMelon SDK with Google IMA DAI
      • Exoplayer v2.11
      • Exoplayer v2.18.1 with Mediamelon SDK
      • Theoplayer v6.0.0 with Mediamelon SDK
      • Theoplayer v4.12.6 with Mediamelon SDK
      • Theoplayer v7.5.0 with Mediamelon SDK
      • Exoplayer v2.13.3 integration with MediaMelon SDK
      • Kaltura Android Player Integration with Mediamelon SDK
      • Media3 v1.3.0 and ExoPlayer 2.19.1 with MediaMelon SDK
      • Media3 v1.3.1 with MediaMelon SDK
      • MediaMelon Android Media3 v1.1.1 SDK Integration Document
      • Media3Player-Android(V1.3.0) MediaMelon SDK with Google IMA
    • Roku SDK
      • Roku SDK
      • Roku with RAF SDK
      • Roku with IMA SDK
    • iOS SDK
      • AVPlayer (Cocoapods)
      • AVPlayer with Google DAI SDK ( Framework )
      • AVPlayer Quality Of Experience SDK
      • AVPlayer Generic Framework
      • AVPlayer with Google DAI (Cocoapods)
      • Bitmovin iOS v3.44 with Content Provider Metrics
      • THEOPlayer XCFramework
      • THEOplayer (Cocoapods)
      • MediaMelon iOS Kaltura Player Plugin Integration Document
    • tvOS SDK
      • AVPlayer tvOS XCFramework
      • THEOPlayer tvOS XCFramework
    • Toast SDK
    • Custom Player C++ SDK
    • C++ SDK QoE Ads
    • Ad Integrations
      • Google IMA
      • FreeWheel
      • ServerSide.AI
  • SmartSight Analytics
    • Product Features
    • QBR Streaming
  • SmartSight API's
    • API Overview
      • Metric and Dimensions Dictionary
      • General Guidelines
      • Video Experience
      • Ad Experience
      • Smartquery Insights
      • Errors
      • Alerts
    • Use-case dictionary
Powered by GitBook
On this page
  • Step 1: Prerequisites
  • Step 2: Set up the build environment
  • Step 3: Import Packages
  • Step 4: Register and Initialise SDK
  • Step 5: Report Ended State
  • Step 6: Variables and Description

Was this helpful?

  1. MediaMelon Player SDK Integration
  2. Android SDK

MediaMelon Android Media3 v1.1.1 SDK Integration Document

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

PreviousMedia3 v1.3.1 with MediaMelon SDKNextMedia3Player-Android(V1.3.0) MediaMelon SDK with Google IMA

Last updated 6 months ago

Was this helpful?

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Step 6:

Step 1: Prerequisites

  • Meida3 - v1.1.1 sample application.

  • MediaMelon SmartSight SDK Maven dependencies or the provided smartstreaming_release.aar AAR file is necessary.

Step 2: Set up the build environment

$MEDIA3PROJECT = {Media3 - v1.1.1}

The SDK files should be added to the build environment and the required network permissions should be enabled.

Using Maven:

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

    dependencies {
       ...
      implementation 'com.github.MediamelonSDK:mm-sdk-media3-v1.1.1-android:1.0.0'
    }

Using AAR:

  1. Copy smartstreaming-release.aar provided in the release package to the Media3 project. Example $MEDIA3PROJECT/demos/main/smartstreaming-release.aar

  2. Add the following library to $MEDIA3PROJECT/demos/main/build.gradle :-

dependencies {
  ...
  api files ('smartstreaming-release.aar')
}

Add network permissions to $MEDIA3PROJECT/demos/main/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Step 3: Import Packages

$MEDIA3PROJECT/demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java

import com.mediamelon.qubit.ep.ContentMetadata;
import com.mediamelon.smartstreaming.media3.MMSmartStreamingMedia3;

Step 4: Register and Initialise SDK

The player application must register the SDK and provide player information once after player is initialised. Please note that values provided in this integration step persist across video sessions.

The SDK must be initialised at the start of each video session. Initialisation includes setting the application context, initialising the playback session, and indicating the intent for playback with the SDK.

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

CUSTOMER_ID is your MediaMelon assigned Customer ID. If you do not know your Customer ID contact MediaMelon at customer-support@mediamelon.com.

protected boolean initializePlayer() {
   if (player == null) {
   Intent intent = getIntent();
   ...
   // after player is initialised and not null anymore
   initializeMediaMelon();
   ...
 }

void initializeMediaMelon(){
     MMSmartStreamingMedia3.enableLogTrace(true);
    if (MMSmartStreamingMedia3.getRegistrationStatus() == false)
    {
      MMSmartStreamingMedia3.setContext(getApplicationContext()); //Please make sure to provide the application's context here, and not the activity's context
      boolean hashSubscriberId = true;
      MMSmartStreamingMedia3.registerMMSmartStreaming("PLAYER_NAME", "CUSTOMER_ID", "SUBSCRIBER_ID", "DOMAIN_NAME", "SUBSCRIBER_TYPE", "SUBSCRIBER_TAG", hashSubscriberId);
      MMSmartStreamingMedia3.reportPlayerInfo("PLAYER_BRAND", "PLAYER_MODEL", "PLAYER_VERSION");
      MMSmartStreamingMedia3.reportAppInfo("APP_NAME","APP_VERSION");
      MMSmartStreamingMedia3.setDeviceInfo("DEVICE_MARKETING_NAME");
    }
    
    String streamURL = String.valueOf(mediaItems.get(0).localConfiguration.uri); //getting the mediaURL from the application

    ContentMetadata cm  = new ContentMetadata();
    cm.assetName="ASSET_NAME";
    cm.assetId="ASSET_ID";
    cm.videoId="VIDEO_ID";
    cm.seriesTitle="SERIES_TITLE";
    cm.season="SEASON";
    cm.genre="GENRE";
    cm.episodeNumber="EPISODE_NUMBER";
    cm.drmProtection="DRM_PROTECTION";
    cm.contentType="CONTENT_TYPE";
    JSONObject contentMetadata = cm.getJSONObject();

    MMSmartStreamingMedia3.reportCustomMetadata("KEY1","VALUE1");
    MMSmartStreamingMedia3.reportCustomMetadata("KEY2","VALUE2");
    
    boolean isLive = false;
    MMSmartStreamingMedia3.initializeSession(player, streamURL, contentMetadata, isLive);
    MMSmartStreamingMedia3.reportUserInitiatedPlayback();
 }

Step 5: Report Ended State

In $MEDIA3PROJECT/demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java

private void releasePlayer() {
    if (player != null) {
      player.release();
      player = null;
      
      MMSmartStreamingMedia3.reportPlayerState(false, Player.STATE_ENDED);
    }
  }

Step 6: Variables and Description

Variable
Description
Requirement

PLAYER_NAME

String containing the Player Name.

Mandatory

CUSTOMER_ID

String containing your MediaMelon-assigned Customer ID.

Mandatory

SUBSCRIBER_ID

String containing your Subscriber’s ID.

Mandatory

DOMAIN_NAME

String containing your section of your subscriber or assets.

Mandatory

SUBSCRIBER_TYPE

String containing the Subscriber Type (e.g. “Free”, “Paid”).

Optional

SUBSCRIBER_TAG

String containing an additional subscriber-specific information. This is sent in clear (not hashed) to SmartSight and it is advised to not send sensitive information in this field.

Optional

ASSET_ID

String containing Asset Id.

Mandatory

ASSET_NAME

String containing Asset Name.

Mandatory

VIDEO_ID

String containing your video’s ID.

Mandatory

CONTENT_TYPE

String containing type of the Content. For example - "Movie", "Special", "Clip", "Scene" "Episode".

Mandatory

GENRE

String containing Genre of the content. For example - "Comedy", "Horror".

Optional

DRM_PROTECTION

Widevine, Fairplay, Playready etc. Unknown means content is protected, but protection type is unknown. For clear contents, do not set this field

Optional

EPISODE_NUMBER

String containing sequence number of the Episode.

Optional

SEASON

String containing the Season. For example - "Season1".

Optional

SERIES_TITLE

String containing Title of the Series.

Optional

VIDEO_TYPE

String containing Video Type. For example - "LIVE", "VOD".

Optional

PLAYER_BRAND

String containing Player Brand (e.g. “Exo Player”).

Mandatory

PLAYER_MODEL

String containing Player Model. For example - This could be a variant of player. Say name of third party player used by organisation. Or any human readable name of the player.

Mandatory

PLAYER_VERSION

String containing Player Version.

Mandatory

CUSTOM_METADATA

Extra custom metadata can be added here if required.

Optional

hashSubscriberId

To hash the subscriber Id set this boolean variable to true, else set it to false.

Optional

player

Player Object.

Mandatory

streamURL

Current playing content stream URL.

Mandatory

isLive

Set this boolean variable to true if the content is Live else set it to false for VOD content.

Optional

Prerequisites
Set up the build environment
Import Packages
Register and Initialise SDK
Report Ended State
Variables and Description