'offline drm. using exoplayer for offline secure content

Can I Download a video with DRM protection on SD card and play it only with my app that using Exoplayer or in someway that video saved securely. I don't want user can copy my video to another device and I want save it on SD card because of sizes and number of videos user may download



Solution 1:[1]

You can use Exoplayer for offline viewing. But you will have to extend your own class from DrmSessionManager. The Key here is to use MediaDrm.KEY_TYPE_OFFLINE as a keyType in mediaDrm.getKeyRequest.

In the mediaDrm.provideKeyResponse you need to get the KeySetId and used later when another request for the same video is made mediaDrm.restoreKeys

Also don't forget to set the state of the player with STATE_OPENED_WITH_KEYS after restoring the keys.

You can find more informations about this here: http://developer.android.com/reference/android/media/MediaDrm.html#KEY_TYPE_OFFLINE https://developer.android.com/reference/android/media/MediaDrm.html#restoreKeys(byte[],byte[])

Solution 2:[2]

For now I decide to use Facebook conceal library. fast and easy way for encryption. I download my content and pass it to conceal library and when I want to play the video use byte stream for and read video sectional.

but if you find better and easier way let me know.

you can find an example here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hakem Zaied
Solution 2 Community