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
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:
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/