Reputation: 1862
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
Upvotes: 2
Views: 5670
Reputation: 1108
With the latest release of ExoPlayer 2.2.0 , it provides this facility inbuilt in ExoPlayer. ExoPlayer has a helper class to download and refresh offline license keys
OfflineLicenseHelper.java
/**
* Helper class to download, renew and release offline licenses. It utilizes {@link
* DefaultDrmSessionManager}.
*/
public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
You can access the latest code from the ExoPlayer repo
For more inspiration you can look at this closed issue.
I created a sample application for Offline playback of DRM content.You can access it from here
Upvotes: 4
Reputation: 14239
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[])
Upvotes: 3
Reputation: 1862
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
Upvotes: 1