Chromecast receiver application cannot play widevine drm protected content from Android sender application
Asked Answered
D

2

8

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. :)

Demona answered 3/8, 2017 at 6:0 Comment(0)
D
3

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! :)

Demona answered 22/8, 2017 at 13:36 Comment(0)
D
1

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:

Deutoplasm answered 3/8, 2017 at 16:42 Comment(3)
Thank you for a response to my problem sir. I've done everything they've told to do in documentations. I've been reading and implementing them for over more than a week. I guess everything is set e.g; dependencies, sdk etc.Demona
the receiver I'm using is working fine when the request is from a browser sender. The problem occurs when I try to play from android sender.Demona
Can you please provide me code that is setting customData of widevine content. Or any other way to set license url and token in android?Demona

© 2022 - 2024 — McMap. All rights reserved.