I'm using receiver application from Expressplay's site for chromecast. https://www.expressplay.com/developer/test-apps/#ccplayer.
I've tested it from the browser by passing license URL along with the widevine stream path. It played the video, means that the receiver is working fine.
The problem appears when I try to play content from an android sender application. I'm passing the license URL in a json object.
My android sender code is as follows.
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/?ExpressPlatToken=****");
}catch (JSONException e){
Log.e(null,"Failed to add description to the json object", e);
}
return new MediaInfo.Builder("stream path.mpd")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("video/mp4")
.setMetadata(movieMetadata)
.setCustomData(jsonObj)
//.setStreamDuration(player.getDuration())
.build();
}
I'm guessing that the problem maybe with recevier's code for the case of playing from android in setting the licenseUrl.
My receiver code setting license URL is as following.
if (event.data.customData && event.data.customData.licenseUrl) {
console.log('setting license URL');
host.licenseUrl = event.data.customData.licenseUrl;
}
event.data.customData.licenseUrl
license URL is not getting set in case of android.
Result while playing from android sender is Black screen.
When playing from browser sender is plays the video.
CORS is enabled on the S3 server which is hosting the video contents.
Can Anyone tell what am I doing wrong?
Does the JSON object passed from android not setting license URL ? If yes then how to resolve it?
Thank you in advance for your kind interest and worthy time to my problem. :)
I figured out that in my Receiver app event.data.customData
was undefined while connecting from android sender application.
So I used event.data.media.customData
And accessed the key as follow:
if(event.data.media.customData['licenseUrl'] !== null){
console.log('setting license URL from mobile');
host.licenseUrl = event.data.media.customData.licenseUrl;
}
That was it! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With