Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Widevine DRM playback on Chromecast

Ive been reading up on getting widevine playback to happen on the chromecast after a device has connected to it. Ive already got widevine working for movie titles in both android and ios and Im not sure where to begin as far as what I should pass as my custom data to the player. Ive had a brief look at the sample at

https://github.com/googlecast/CastMediaPlayerStreamingDRM

but I have yet to try to implement it as I dont want to be spinning my wheels trying to pass random keys and things into the receiver. Since I have all the necessary authentications taking place on the device already what would I need to send to the receiver.

like image 926
James andresakis Avatar asked Nov 24 '25 06:11

James andresakis


1 Answers

I know this is late, but for others that need help, all you really need to do is pass the license url in the custom data.

    JSONObject jsonObject = new JSONObject();
    try{
        jsonObject.put("licenseUrl", licenseUrl);
    } catch (JSONException e){
        Utils.log("Failed to add license to Json object.");
    }

    MediaInfo mediaInfo =
            new MediaInfo.Builder(videoUrl)
                    .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
                    .setContentType("video/mp4")
                    .setMetadata(movieMetadata)
                    .setStreamDuration(currentPosition)
                    .setCustomData(jsonObject)
                    .build();
    return new MediaQueueItem.Builder(mediaInfo).build();

For the receiver, be sure to create a CAF (not a Receiver v2) and refer to this guide for the Widevine setup. The server will need to read the license and allow it for Widevine playback using Javascript on the receiving end.

like image 70
6rchid Avatar answered Nov 25 '25 20:11

6rchid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!