Reputation: 594
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. :)
Upvotes: 8
Views: 4594
Reputation: 594
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! :)
Upvotes: 3
Reputation: 8112
If you haven't done so, check DRM support wherein it was stated that,
To fully support content protected with Digital Rights Management (DRM), you need to implement a Custom Receiver. With a Custom Receiver, you can set up authentication and tailor your application according to your DRM requirements.
Note that, your receiver app accesses the Receiver API with the following reference:
//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js
Also, to develop a custom receiver application, you will need to register your app with the Google Cast SDK Developer Console.
Then, for the Android Sender App, check the following:
Upvotes: 1