Kaltura Android Player Integration with Mediamelon SDK

This document provides a step by step guide to integrate the Mediamelon SDK with the Kaltura Player 4.2.59

Prerequisites

Step 1: Set up the build environment

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

  1. Copy mediamelonplugin-release.aar provided with the release package to the libs folder ( create one if its not already there ) in the BasicPluginsSetup project

  2. Add the following library to IMADAISample/app/build.gradle :-

dependencies {
  .
  .
  .
  //<!-- <MMSmartStreaming 1b> -->
   implementation 'com.github.MediamelonSDK:mm-KalturaPlayer:1.1.1'
  //<!-- </MMSmartStreaming 1b> -->
  
}

Add network permissions to IMADAISample/app/manifests/AndroidManifest.xml

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

<!-- <MMSmartStreaming 1c> -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- </MMSmartStreaming 1c> -->

Step 2: Include and Configure the MediaMelon Plugin

The MediaMelon plugin needs to be configured . The following steps need to be executed.

Step 2a: Import packages

The MediaMelon plugin package needs to be imported in the following file

IMADAISample/app/com/kaltura/playkit/samples/imadaisample/MainActivity.java

// <MMSmartStreaming 2a>
import com.kaltura.playkit.plugins.mediamelon.*;
// </MMSmartStreaming 2a>

Step 2b: Configure the Plugin

Add the following function createPluginConfigs in the file IMADAISample/app/com/kaltura/playkit/samples/imadaisample/MainActivity.java

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Initialize media config object.
        createMediaConfig();

        //Create plugin configurations.
        PKPluginConfigs pluginConfigs = createIMADAIPlugin();
        pluginConfigs = createMMPluginConfigs(pluginConfigs);

        //Create instance of the player with plugin configurations.
        player = PlayKitManager.loadPlayer(this, pluginConfigs);
.....
}

private PKPluginConfigs createMMPluginConfigs(PKPluginConfigs pkPluginConfigs) {
        //First register your SamplePlugin.
        PlayKitManager.registerPlugins(this, MediamelonPlugin.factory);

        //Initialize plugin configuration object.

        if(pkPluginConfigs == null) {
            //Initialize plugin configuration object.
            pkPluginConfigs = new PKPluginConfigs();
        }

        //Set jsonObject to the main pluginConfigs object.
        pkPluginConfigs.setPluginConfig(MediamelonPlugin.factory.getName(),  createJson() );

        //Return created and populated object.
        return pkPluginConfigs;
    }

// Json parameters for configuring plugin
private JsonObject createJson() {
        JsonObject optJson = new JsonObject();

        // Main config goes here.
        optJson.addProperty("customerId", "18410666590");
        optJson.addProperty("domainName", "EladDomain");
        optJson.addProperty("subscriberId", "SubscriberId");
        optJson.addProperty("subscriberType", "SubscriberType");
        optJson.addProperty("subscriberTag", "SubscriberTag");
        optJson.addProperty("doHash", false);
        optJson.addProperty("playerName", "KALTURA PLAYER");

        optJson.addProperty("playerVersion", PlayKitManager.VERSION_STRING);

        // Set ContentMetadata for every asset played.
        optJson.addProperty("assetId", "1234");
        optJson.addProperty("assetName", "My IMA Asset");
        optJson.addProperty("videoId", "5678");
        optJson.addProperty("seriesTitle", "Test Series");
        optJson.addProperty("episodeNumber", "1");
        optJson.addProperty("season", "2");
        optJson.addProperty("contentType", "Episode");
        optJson.addProperty("drmProtection", "WideVine");
        optJson.addProperty("genre", "Romance,Horror");

        // Set Application data.
        optJson.addProperty("appName", "KalturaApp");
        optJson.addProperty("appVersion", "v1.0.0");

        // Set metadata for device.
        optJson.addProperty("deviceMarketingName", "Oneplus6");
        optJson.addProperty("videoQuality", "4K-HDR");
        optJson.addProperty("deviceId", "abcd-efgh-ijkl-mnop");
        optJson.addProperty("isDisableManifestFetch", false);

        // Set CustomTags.
        JsonObject optCustomJson = new JsonObject();

        optCustomJson.addProperty("param1", "12345");
        optCustomJson.addProperty("param2", "Sandbox Watch");
        optCustomJson.addProperty("param3", "12345");
        optCustomJson.addProperty("param4", "54321");
        optCustomJson.addProperty("param5", "1_nd547djd");
        optCustomJson.addProperty("householdId", "12345");
        optCustomJson.addProperty("properties", "{'key':'value'}");
        optCustomJson.addProperty("playerStartupTime", "12345");
        optCustomJson.addProperty("username", "123456789");
        optCustomJson.addProperty("seriesId", "123454321");
        
        optJson.addProperty("customTags", optCustomJson.toString() );
        

        return optJson;
    }

Variables to be configured are as follows

VariableDescription

playerName

String containing the Player Name.

customerId

String containing your MediaMelon-assigned Customer ID.

subscriberId

String containing your Subscriber’s ID. If you do not use subscriber IDs, enter null

domainName

String containing your section of your subscriber or assets.

subscriberType

String containing the Subscriber Type (e.g. “Free”, “Paid”). If you do not use subscriber types, enter null

subscriberTag

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.

assetId

String containing Asset Id.

assetName

String containing Asset Name.

videoID

String containing your video’s ID. If you do not use videos IDs, enter null.

contentType

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

genre

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

drmProtection

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

episodeNumber

String containing sequence number of the Episode.

season

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

seriesTitle

String containing Title of the Series.

playerBrand

String containing Player Brand.

playerModel

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.

playerVersion

String containing Player Version.

appName

String containing the name of the application

appVersion

String containing the version of the application

deviceMarketingName

String containing the marketing name associated with the device

deviceId

String containing the device id

videoQuality

String containing the video quality supported by the device

Any variable not part of the list above will need to be set as a custom tag

Any variable which is not part of the above list will need to be set as a custom tag by the plugin library

Last updated