Exoplayer: How to Encrypt and Decrypt Widevine DRM Video stream in Android Exoplayer

Created on 20 Mar 2017  路  9Comments  路  Source: google/ExoPlayer

* ISSUES THAT IGNORE THIS TEMPLATE WILL BE CLOSED WITHOUT INVESTIGATION *

Before filing an issue:

  • Search existing issues, including issues that are closed.
  • Consult our FAQs, supported devices and supported formats pages. These can be
    found at https://google.github.io/ExoPlayer/.
  • Rule out issues in your own code. A good way to do this is to try and
    reproduce the issue in the ExoPlayer demo app.
  • This issue tracker is intended for bugs, feature requests and ExoPlayer
    specific questions. If you're asking a general Android development question,
    please do so on Stack Overflow.

When reporting a bug:

Fill out the sections below, leaving the headers but replacing the content. If
you're unable to provide certain information, please explain why in the relevant
section. We may close issues if they do not include sufficient information.

Issue description

Describe the issue in detail, including observed and expected behavior.

Reproduction steps

Describe how the issue can be reproduced, ideally using the ExoPlayer demo app.

Link to test content

Provide a link to media that reproduces the issue. If you don't wish to post it
publicly, please submit the issue, then email the link to
dev.[email protected] including the issue number in the subject line.

Version of ExoPlayer being used

Specify the absolute version number. Avoid using terms such as "latest".

Device(s) and version(s) of Android being used

Specify the devices and versions of Android on which the issue can be
reproduced, and how easily it reproduces. If possible, please test on multiple
devices and Android versions.

A full bug report captured from the device

Capture a full bug report using "adb bugreport". Output from "adb logcat" or a
log snippet is NOT sufficient. Please attach the captured bug report as a file.
If you don't wish to post it publicly, please submit the issue, then email the
bug report to dev.[email protected] including the issue number in the subject
line.

question

All 9 comments

you need to setup the StreamingDrmSessionManager object and pass it to the MediaCodecRenderer, inside StreamingDrmSessionManager you need to setup a HttpMediaDrmCallback which define your license url as well as other headers.

How to prepare/encrypt content (on the server-side) is out of scope of this issue tracker. ExoPlayer is only responsible for client side playback. The ExoPlayer demo app demonstrates playback of Widevine protected content, so that and @richardissuperman 's response above should serve as a good starting point.

We are using Test Exoplayer Github code. We edited in media.exolist.json file.
"name": "URL Test 3",
"uri": "https://s3.amazonaws.com/sprngpod/drm/513698_a1dbea8ad80f047a45a4b805d8b8cbb8/mpds/513698.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://license.uat.widevine.com/cenc/getlicense/鈥媥periolabs/proxy?video_id=746573745f69645f463946504330908&provider=xperiolabs"
"

but
Video is not playing, it displaying video length only. Please help to find out the error.

We are using Test Exoplayer Github code. We edited in media.exolist.json file.
"name": "URL Test 3",
"uri": "https://s3.amazonaws.com/sprngpod/drm/513698_a1dbea8ad80f047a45a4b805d8b8cbb8/mpds/513698.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://license.uat.widevine.com/cenc/getlicense/鈥媥periolabs/proxy?video_id=746573745f69645f463946504330908&provider=xperiolabs"
"

Video is not playing, it displaying video length only. Please help to find out the error. Please help to find out the error. @richardissuperman @ojw28

that means you loaded the dash manifest(which is normal) , but cant decode or decrypt the data, if the content has been encrypted you have to check the StreamingDrmSessionManager.java, try debug the methods for requesting key and also the callback from MediaDrm.
Noted that you cant just post the drm license url , make sure you/exoplayer include the drmInit Data.

You should also test your content using Shaka Player. Select "custom asset" from the bottom of the asset drop down. If you content doesn't play there either, then something is wrong with your content or license server. This is beyond the scope of this issue tracker. If you have content that plays successfully in Shaka Player but not in ExoPlayer, please let us know.

Hi Richard,

We have downloaded Sample Exo-Player from git-hub
[https://github.com/google/ExoPlayer]

As mentioned in your previous mail we have checked StreamingDrmSessionManager.jav, MediaDrm, httpMediaDrmCallback. In all these methods the below URL, provider getting passed correctly. But video is not playing, only length is getting displayed.

media.exolist.json in the asset folder we have made the below changes. We have doubt whether we are passing the drm license URL is passed correctly. Please check and let us know is the this correct way to send drm license URL as clear stream is playing correctly.

{
"name": "segmented-unencrypted",
"uri": "https://s3.amazonaws.com/sprngpod/drm/511996_06276e1bd3a6227634cb148115ddd33a/mpds/unenc/segmented/unecn_mdash.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://proxy.uat.widevine.com/proxy?video_id=154785865002&provider=xxxx"
},
{
"name": "unsegemented-unencrypted",
"uri": "https://s3.amazonaws.com/sprngpod/drm/511996_06276e1bd3a6227634cb148115ddd33a/mpds/unenc/unsegmented/unecn_unsegmentdmdash.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://proxy.uat.widevine.com/proxy?video_id=154785865002&provider=xxxx"
},
{
"name": "Segmented-encrypted",
"uri": "https://s3.amazonaws.com/sprngpod/drm/511996_06276e1bd3a6227634cb148115ddd33a/mpds/encrypted/segmented/ecn_mdash.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://proxy.uat.widevine.com/proxy?video_id=154785865002&provider=xxxx"
},
{
"name": "unsegemented-encrypted ",
"uri": "https://s3.amazonaws.com/sprngpod/drm/511996_06276e1bd3a6227634cb148115ddd33a/mpds/encrypted/segmented/ecn_mdash.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://proxy.uat.widevine.com/proxy?video_id=154785865002&provider=xxxx"
},

@richardissuperman @ojw28

Please don't file identical issues. As per my response above:

You should also test your content using Shaka Player. Select "custom asset" from the bottom of the asset drop down. If you content doesn't play there either, then something is wrong with your content or license server. This is beyond the scope of this issue tracker. If you have content that plays successfully in Shaka Player but not in ExoPlayer, please let us know.

can you debug the onKeyResponse() method , see if the key response is valid?

Was this page helpful?
0 / 5 - 0 ratings