Play encrypted video in exo player android?

I want a play encrypted video which is on my server . i want to play it on exo player . in a sample provided by google on https://github.com/google/ExoPlayer is play only you tube videos. i had tried using change the uri in https://github.com/google/ExoPlayer/blob/master/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java file . but it is not worked may be beacuse my video is encrypted . So how can i play my encrypted video.

Upvotes: 4

Views: 5176

Answers (1)

theJango
theJango

Reputation: 1108

It's an old question but I hope this answer will help.

encrypted video

There are a number of ways a video/media file can be encrypted. It can be a simple AES 128 encryption or a more standard DRM protection can be provided.Last but not least Your own custom encryption can also be done. Let's cater all one by one.

AES 128 : AES is a old standard for encryption and good thing is that Exo Player supports that out of the box. Your manifest/master file must have the ContentProtection tag rest ExoPlayer will take care. It will hit your server where You have hosted the key for decryption of the content.

DRM : DRM is all about content protection. There are multiple companies which provide DRM license. Like Google's Widevine, Apples' FairPlay or Microsoft's PlayReady. ExoPlayer supports widevine out of the box. You need to provide the license url to ExoPlayer and rest it will take care.

Check out this sample for Widevine Online/Offline content playback using ExoPlayer

Your own encryption : This is a little bit trick and should be avoided. The reason being in this case mostly You have to decrypt the video on the device first then it will be played by the media player like any local video/media file. You have to write the logic to retrieve the decryption key, decrypt the content and then play it like any local video.

Upvotes: 7

Related Questions