updateOTT (Browser)

From Engineering Client Portal

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png Browser SDK API Reference breadcrumbArrow.png updateOTT (Browser)
Use the ggPM function to pass updateOTT as event parameter in order to notify Browser SDK that the remote OTT device (like Google ChromeCast, Roku, Amazon FireTV, etc.) is connected / disconnected (change of OTT status).

  • When OTT device is connected, call ggPM("updateOTT", {"ottStatus": "1",…}) and a set of OTT device related parameters in the same JSON object.
  • When OTT device is disconnected, call ggPM("updateOTT",{"ottStatus": "0"}).


ggPM("updateOTT", {"ottStatus": "1',}); // Except VA users

Input Parameters

Parameter Description
ottInfo A JSON string with the following parameters:

OTT device is connected:

   "ottStatus": "1",
   "ottType": "ottTypeStatus",
   "ottDevice": "ottchromecast",
   "ottDeviceName": ottDeviceNChromeCast",
   "ottDeviceID": "xxxx-xxxx-xxxx",
   "ottDeviceManufacturer": "ottDeviceMan",
   "ottDeviceModel": "ottChromeCast",
   "ottDeviceVersion": "1.0.0"

OTT device is disconnected:

    "ottStatus": "0"

Output Parameters

Parameter Description
event stop
playheadposition The exact position of playhead when streaming was paused.

Output Parameters

Output Parameters (Return value) Description


  • The player needs to report all the possible OTT types (casting, screen mirroring, etc.) to the Browser SDK.

Communicating with the Chromecast Receiver App

When acting as a sender device, Browser SDK cannot communicate directly with the Receiver App running on the Chromecast as it needs access to the Google Casting framework. Thus, Browser SDK requires the sender application to pass certain required data to the Receiver App.

The application should:

  • Retrieve the Opt-Out status on the device (using getOptOutStatus()) and its Demographic ID (using getDemographicId())
  • Relay the retrieved details / values to the Receiver App, as additional parameters in MediaMetadata payload.
  • Create the metadata information for this purpose, using MediaMetadata.

The two custom parameters to be included in MediaMetadata are:

  • kGCKMetadataNlsKeyDeviceID for device ID.
  • kGCKMetadataNlsKeyOptout for Opt-out status (true or false).

Below is a sample code snippet on how the application should retrieve and relay the information from App SDK to Receiver App.

MediaMetadata mediaMetadata = new MediaMetadata( MediaMetadata.MEDIA_TYPE_MOVIE );
mediaMetadata.putString( MediaMetadata.KEY_TITLE, channelName.getText().toString());

//Custom parameters
mediaMetadata.putString( MEDIA_METADATA_KEY_DEVICE_ID, mAppSdk.getDemographicId() );
mediaMetadata.putString( MEDIA_METADATA_KEY_OPTOUT_STATE, mAppSdk.getOptOutStatus());

MediaInfo mediaInfo = new MediaInfo.Builder(mNowPlayingUrl)
            .setContentType( getString( R.string.content_type_mp4 ) )
            .setStreamType( MediaInfo.STREAM_TYPE_BUFFERED )
            .setMetadata( mediaMetadata )

Receiver App Implementation

When Browser SDK is run on a casting device acting as a receiver, the Browser SDK should get initialized on load of the receiver app. On loading the video player, content metadata should be passed using the loadMetadata event. Once loadMetadata has been called, the receiver app should send an updateOTT event to the Browser SDk receiver instance to relay the sender ottmetadata ( kGCKMetadataNlsKeyDeviceID and kGCKMetadataNlsKeyOptout) received from sender app.

Below is a sample code snippet on how the receiver app should retrieve the ottMetadata received from sender apps and relay the information to receiver BSDK instance.

sampleplayer.CastPlayer.prototype.onLoad_ = function(event) {

var senderMetadata = event.data.media.metadata,
sessionId =senderMetadata.kGCKMetadataNlsKeyDeviceID;

  this.cancelDeferredPlay_('new media is loaded');
  this.load(new cast.receiver.MediaManager.LoadInfo( (event.data),  event.senderId));
	var contentMetadata = {
         	   "type": "content",
          	  "dataSrc": "cms",
           	 "assetid": "vid-123",
          	  "assetName": "Test video",
           	 "program": "Test program",
          	  "title": "Clickbaby",
          	  "segA": "CustomSegmentValueA",
          	  "segB": "CustomSegmentValueB",
          	  "segC": "CustomSegmentValueC"

      window.nolSDKInstance.ggPM(3, contentMetadata);
	   var ottMetadataObject ={
			ottStatus: "1",
			ottType: "casting",
			ottDevice: "chromecast",
			ottDeviceName: "Google Chromecast",
			ottDeviceID: sessionId,
			ottDeviceManufacturer: "Google",
			ottDeviceModel: "ChromeCastModel",
			ottDeviceVersion: "1.0.0", 
			kGCKMetadataNlsKeyOptout : senderMetadata.kGCKMetadataNlsKeyOptout,
		              kGCKMetadataNlsKeyDeviceID : sessionId	

window.nolSDKInstance.ggPM('updateOTT', ottMetadataObject);};