I am using the following cast receiver
When I connect my android sender to chromecast device, it show a black screen and never plays video.
https://github.com/googlecast/CastReferencePlayer
I'm setting licenseUrl for widevine in receiver as follow:
sampleplayer.CastPlayer.prototype.preloadVideo_ = function(mediaInformation) {
this.log_('preloadVideo_');
var self = this;
var url = mediaInformation.contentId;
var protocolFunc = sampleplayer.getProtocolFunction_(mediaInformation);
if (!protocolFunc) {
this.log_('No protocol found for preload');
return false;
}
var host = new cast.player.api.Host({
'url': url,
'mediaElement': self.mediaElement_
});
host.onError = function() {
self.preloadPlayer_.unload();
self.preloadPlayer_ = null;
self.showPreviewModeMetadata(false);
self.displayPreviewMode_ = false;
self.log_('Error during preload');
};
host.licenseUrl = event.data.customData.licenseUrl;
self.preloadPlayer_ = new cast.player.api.Player(host);
self.preloadPlayer_.preload(protocolFunc(host));
return true;
};
host.licenseUrl = event.data.customData.licenseUrl;
I've hosted it on a https server which is registered on developers console.
I'm passing custom data as licenseUrl in a json object.
The code of my android sender setting media info is below.
private MediaInfo buildMediaInfo() {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, "Subtitle");
movieMetadata.putString(MediaMetadata.KEY_TITLE, "Title");
jsonObj = new JSONObject();
try{
jsonObj.put("licenseUrl","https://wv.test.expressplay.com/hms/wv/rights/?ExpressPlayToken=token-value");
}catch (JSONException e){
Log.e(null,"Failed to add description to the json object", e);
}
/*drmModel.getData().getStreamURL()*/
return new MediaInfo.Builder("https://pathOfMystream.mpd")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("application/dash+xml")
.setMetadata(movieMetadata)
.setCustomData(jsonObj)
.setStreamDuration(player.getDuration()*1000)
.build();
}
What changes are further required ?
Do I need to edit receiver? If yes, then what edits are needed?
Is the string name in customData "licenseUrl" needs to be
changed?- CORS is enabled on the S3 server which is hosting the video contents.
Please help! I'm stuck here for more than a week.
Thank you.