According to the Google Custom Receiver documentation, if our app performs authentication we can load the customData in json format in our sender application. In my case, I did something similar to the following,
MediaInfo mediaInfo = new MediaInfo.Builder(
"url")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setCustomData(jsonCustomData)
.build();
Then loaded the mediaInfo like the following,
mRemoteMediaPlayer.load(mApiClient, mediaInfo, true).setResultCallback(....);
In my receiver application, I tried to retrieve the jsonCustomData like the following,
var customData = window.mediaManager.LoadRequestData.customData;
However, it doesn't seem like it's working. I've noticed that in some sample apps, some people use the Cast.CastApi.sendMessage method, and use window.message.onMessage=function(event) where event.data would contain the message. Could someone explain the difference between these two methods? what am I doing wrong?
Notice my receiver code is not wrapped a window.onload function, do I need to?
Thanks for the help!