Exoplayer v2.12.2 integration with MediaMelon SDK

This guide is for integrating MediaMelon SDK with Exoplayer v2.12.2

Prerequisites

  1. MediaMelon SmartSight SDK smartstreaming.aar

Step 1: Set up the build environment

Note $EXOPROJECT = {ExoPlayer-r2.12.2}

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

  1. Copy smartstreaming-release.aar provided with the release package to the exoplayer project, Example $EXOPROJECT/demos/main/smartstreaming-release.aar

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

dependencies {
  .
  .
  .
   //<!-- <MMSmartStreaming 1b> -->
    api files ('smartstreaming-release.aar')
  //<!-- </MMSmartStreaming 1b> -->
  
}

Add network permissions to $EXOPROJECT/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.

You can check SDK registration status with getRegistrationStatus(). If the registration is not complete, use the registerMMSmartStreaming() to complete the registration.

Step 2a: Import packages

$EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java

Step 2b: Registration

Perform registration tasks by modifying the onCreate() method in $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java

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

Step 3: Initialize Session & Report User Intent to Playback

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.

Provide application context to SDK by modifying the createTopLevelMediaSource() method in $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java

Step 4: Report User Intent to Playback

When the user presses the play button for the first time to start the playback, or in autoplay mode when a player is fed with a content URL to load the session, reportUserInitiatedPlayback() should be called. In the demo application, autoplay is “on”, so let's call this API just before player.prepare()

In $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java

Step 5: Report ended state when the player instance is released

In $EXOPROJECT/demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java

Last updated