Kaltura SDK Integration Document

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

Step 1: Prerequisites

Step 2: Set up the build environment

Step 3: Include and Configure the MediaMelon Plugin

Step 1: Prerequisites

Step 2: 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"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Step 3: Include and Configure the MediaMelon Plugin

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

Step 3a: Import packages

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

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

import com.kaltura.playkit.plugins.mediamelon.*;

Step 3b: 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;
    }

Last updated