Widevine DRM on Android 4.X

Atatakai Neko picture Atatakai Neko · Oct 19, 2012 · Viewed 8.3k times · Source

As I know that starting from 4.X Android have built-in support for Widevine DRM. I'm making an application that streams a video content from Widevine protected server. However I can't find any documentation on how work with it. For example I have response from server that contains following:

"uri": "http://*******.com/prog_index.m3u8",
"type": "widevine",
"parameters": {
   "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXX",
   "media_type": "stream",
   "media_id": "3580",
   "time": "1350642931"
}

What steps should I perform to play it in MediaPlayer?

Maybe someone can provide more information on how to use android.drm package?

Answer

Joe Steele picture Joe Steele · Apr 12, 2013

You should start with the Android DRM Framework. This page describes the android.drm framework which supports Widevine along with other DRM engines (like OMA).

Here is the sequence of calls (from the above page) to acquire the rights:

  1. Register the device with an online DRM service. You can do this by first using the acquireDrmInfo() method to acquire the registration information, and then using the processDrmInfo() method to process the registration information.
  2. Acquire the license that's associated with the rights-protected content. You can do this by first using the acquireDrmInfo() method to acquire the license information, and then using the processDrmInfo() method to process the license information. You can also use the acquireRights() method.
  3. Extract constraint information from the license. You can use the getConstraints() method to do this.
  4. Associate the rights-protected content with its license. You can use the saveRights() method to do this.

Then just play the content via MediaPlayer. It should be able to pickup the license information.