How to use the android.drm framework

I am developing a DRM based android app. The application is designed to encrypt (audio, video) files after downloading and gain control over access to files (audio, video), preventing copying and pasting of the file (audio, video) and expiration of documents so that they are no longer viewed. for this i use android.drm

I searched a lot but didn't get any result

So please share some sample code which explains how to use the DRM api framework.

Refered:

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

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

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

+4


source to share


1 answer


In most DRM scenarios, the Android device will be a client in terms of DRM, not a server.

In other words, an Android device is usually a playback device that must ask the DRM system for a key to view the content.

In theory, there is no reason why Android devices could not act as a wrapper or encrypt content, but that is not the norm, so not how an Android DRM environment or example would be created.

If you want to learn how to play DRM protected content on a 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/google/android/exoplayerava2/

Update



Example workflow for protected content:

  1. Content is uploaded to the server (i.e. uploaded or posted on a streaming server in some way)
  2. Content is registered with DRM license server and encryption key is requested
  3. When a user requests a video file, the file is packaged into the appropriate streaming protocol for the device (usually MPEG DASH for Android), and the video file is encrypted using the key obtained from the DRM server.
  4. The device that requested the stream (i.e. the Android device in your case) receives the stream and determines that it is encrypted. It requests a license key from the license server. On an Android device using Widevine DRM, the license server URL must be specified in the player configuration.
  5. The DRM server securely sends the key to the Android device, which plays the content. Neither the key nor the unencrypted content is visible to either the application or even the OS, since it is played using the DRM system and the protected media path of the devices.

Streaming servers and DRM servers tend to be quite complex systems, and you probably won't want to build them yourself.

There are open source examples for the streaming server that you can look at and use - for example: https://gstreamer.freedesktop.org

If you want to experiment with DRM, you can use DRM clearkey with MPEG DASH, which Exoplayer will support. It's not as secure as regular DRM schemes, but it's free, so it's worth checking to see if it suits your needs.

Some coding services allow you to experiment with clearkey setting - see an example here: https://bitmovin.com/tutorials/mpeg-cenc-clearkey-drm-encryption/

+7


source







All Articles