Media3 v1.3.0 and ExoPlayer 2.19.1 with MediaMelon SDK

This guide is for integrating MediaMelon SDK with Media3 v1.3.0 and Exoplayer v2.19.1

Prerequisites

Step 1: Set up the build environment

$MEDIA3PROJETC = {Media3 - v1.3.0}

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 $MEDIA3PROJETC/demos/main/build.gradle

    dependencies {
       ...
      //<!-- <MMSmartStreaming 1b> -->
      implementation 'com.github.MediamelonSDK:mm-sdk-media3-android:1.0.0'
      implementation 'com.google.android.exoplayer:exoplayer-core:2.19.1'
      implementation 'androidx.media3:media3-exoplayer:1.3.0'
      //<!-- </MMSmartStreaming 1b> --> 
    }

Using AAR:

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

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

To use MediaMelon SDK you have to implement both media3 and Exoplayer dependencies.

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

Step 2: Register SDK

The player application must register the SDK and provide player information once when the application launches. Please note that values provided in this integration step persist across video sessions. This is typically done when the player itself is initialized.

Step 2a: Import packages

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

Step 2b: Setup MediaMelon Adapter Object

Setup MediaMelon Adapter Object before onCreate() method in $MEDIA3PROJETC/demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java

Step 3: Registration, Initialize Session & Report User Intent to Playback

The player application must register the SDK and provide player information once after 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.

  • Set the isLive variable in initializeSession() call , set true for live stream else false.

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 4: Report ended state when the player instance is released

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

Last updated