2

I want to play Widevine Modular - DASH video in my app and I want to use VideoView or ExoPlayer for it.

Is there any sample how I can setup it? Or can you provide me any sample code how to acquire the licence? I have URL of the video and also the Widevine server URL.

Before we were using Widevine classic and the request for licence looks like this:

private void prepareDrmInfoRequest()
{
        mDrmInfoRequest = new DrmInfoRequest(DrmInfoRequest.TYPE_RIGHTS_ACQUISITION_INFO, "application/mp4");
        mDrmInfoRequest.put("WVVideoUrlKey", "http://some_url.com/dash/1.mpd");
        mDrmInfoRequest.put("WVDRMServerKey", "http://some_url.com/video/widevine_modular/?auth_token=haslůkfjlksjfljnvlakhnsufn");
        mDrmInfoRequest.put("WVCAUserDataKey", "LJKHlklkhkljhKJLHuzgztfZTFZTUFzutf");
        mDrmInfoRequest.put("WVPortalKey", "provider");
}

and then

  public int processDrm()
  {
        DrmInfo df = mDrmManagerClient.acquireDrmInfo(mDrmInfoRequest);
        if(df != null)
        {
            return mDrmManagerClient.processDrmInfo(df);
        }
  }

After that the video was playing on VideoView or ExoPlayer.

Stepan Sanda
  • 2,322
  • 7
  • 31
  • 55

2 Answers2

2

I realise this is an old question but if anyone is still looking for this the standard ExoPlayer demo includes widevine example manifests also.

The demo player is available here:

And the widevine manifest examples can be seen in the config at the following location:

ExoPlayer/playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashTest.java

To see it in use search for 'DefaultDrmSessionManager' in the repository.

Mick
  • 24,231
  • 1
  • 54
  • 120
1

After download the exoplayer demo, In the demo exoplayer you just need to change the media.exolist.json in asset

like this yo:

[

  {
    "name": "Widevine DASH DRM Tests",
    "samples": [

      {
        "name": "tes DRM -acquire license",
        "uri": "https://YOURlinkto.mpd",
        "drm_scheme": "widevine",
        "drm_license_url": "https://drm-widevine-licensing.axtest.net/AcquireLicense",
        "extension": "mpd",
        "drm_key_request_properties": {
          "X-AxDRM-Message": "YOUR-xrdm-value"
        }

        }

    ]
  }

]