Cordova Plugin Toast (Smart TV)

This guide is for integrating the MediaMelon Player SDK for the javascript based Cordova Plugin Toast (Tizen, WebOS, Orsay)

Step 1: Add the MediaMelon Player SDK

Include the following line to the web page in the start

<script type="text/javascript" src="https://PATH_TO_SMARTSTREAMING_SDK"></script>

Step 2: Register and Initialize the MediaMelon Player SDK

<customer_id> is your MediaMelon-assigned Customer ID. If you do not know your Customer ID contact MediaMelon at [email protected]

→js/media.js:

After the player instance has been created, create a new Plugin object, register, and report player information as shown below:

function playMedia() {
    .....
    .....
    document.body.appendChild(bgContainer);

    // MediaMelon Start
    toastMMPlugin = new ToastJsMMSSIntgr();
    if(toastMMPlugin.getRegistrationStatus() === false){
        toastMMPlugin.registerMMSmartStreaming("PLAYER_NAME", "CUSTOMER_ID", "SUBSCRIBER_ID", "DOMAIN_NAME", "SUBSCRIBER_TYPE" , "SUBSCRIBER_TAG");
        toastMMPlugin.reportPlayerInfo("PLAYER_BRAND", "PLAYER_MODEL", "PLAYER_VERSION");
    }
    var mediaSourceURL = 'http://media.w3.org/2010/05/sintel/trailer.mp4'';
    // MediaMelon End
    
    media = toast.Media.getInstance();
    media.open(mediaSourceURL);

You can also provide the Content Metadata like assetID, assetName, videoID, and custom tags as shown below while setting source information. Please use the mmVideoAssetInfo structure to provide this information.

And then initialize as shown below:

Add the call for reporting error to the Toast Plugin and just before media.play(), call the reportUserInitiatedPlayback()api.

Step 3: Toast Level Changes for Bitrate Support

→ toast.js:

Please make the following changes toast.js for supporting bitrate change notifications. (Applicable for sectv-tizen platform only.)

Add the Media Events:

Add the respective Media Event handling in Media.mediaEvent() function:

Add the following code in the getMediaEventValue() function:

Add the following code in the open: function(successCallback, errorCallback, args) function:

This concludes the changes needed to integrate MediaMelon’s SDK into Samsung and LG SmartTVs using the Cordova Toast plugin.

Last updated