Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use android.drm framework

I am developing an android app based on DRM. Application is intended to encrypt the (audio,video) files after downloading and getting control access on the files(audio,video)preventing the file(audio,Video) copy and paste and expire documents so they can no longer be viewed. for this i am using android.drm

I have searched a lot but didn't get any result

So please share some sample code that explain how to use DRM framework api.

Refered:

https://www.widevine.com/wv_drm.html

https://source.android.com/devices/drm

https://developer.android.com/reference/android/drm/package-summary.html

like image 911
KomalG Avatar asked May 17 '17 10:05

KomalG


1 Answers

In most DRM scenarios, the Android device would be the client from a DRM point of view, rather than the sever.

In other words the Android device would typically be the playback device which needs to ask a DRM system for a key to view the content.

There is no reason in theory why an Android devices couldn't act as a packager or encrypted for content, but it is not the norm so its not how the DRM framework or example in Android will be set up.

If you do want to see how to play back DRM protected content on the device, then the Exoplayer demo has good working examples.

Take a look at the DefaultDRMSessionManager as a starting point: https://github.com/google/ExoPlayer/blob/d979469659861f7fe1d39d153b90bdff1ab479cc/library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.java

Update

An example workflow for protected content:

  1. Content is ingested on the server (i.e. loaded or placed on the streaming server somehow)
  2. The content is registered with a DRM license server and a an encryption key requested
  3. When a user requests the video file, the file is packaged into the appropriate streaming protocol for the device (typically MPEG DASH for Android) and the video file is encrypted with the key received from the DRM server.
  4. The device which requested the stream (i.e. the Android device in your case) receives the stream and identifies that it is encrypted. It requests the license key from the license server. On an Android device using Widevine DRM, it must have the URL of the license server included in the player configuration.
  5. The DRM server sends the key securely to the Android device which plays back the content. Neither the key nor the unencrypted content is visible to the app, or even to the OS, as it is played using the DRM system and the devices secure media path.

Streaming servers and DRM servers are generally quite complicated systems and it is unlikely you would want to build either yourself.

For streaming server there are open source examples you can look at and use - e.g.: https://gstreamer.freedesktop.org

If you want to experiment with DRM then you can use clearkey DRM with MPEG DASH which Exoplayer will support. It is not as secure as the regular DRM schemes but it is free so it is worth checking if it meets your needs.

Some encoding services allow you experiment with clearkey set up - see an example here: https://bitmovin.com/tutorials/mpeg-cenc-clearkey-drm-encryption/

like image 61
Mick Avatar answered Oct 04 '22 21:10

Mick