Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android decrypt and play mp4 at runtime

I'm working on an app which shows a series of mp4 files. To make sure people don't just copy them from the sdcard where they are stored, we want to encrypt them (using DES at the moment). Most of the encrypted files like images and xml can be easily decrypted at runtime to be used, but I'm having problems with the video. It should all be done in memory, since decrypting it to the sdcard first before using it makes the whole idea useless.

Anyone got any ideas on how I should be able to do this? The files are pretty large as well, so keep memory limitations in mind, and it should be Android 2.3.3 minimum.

like image 330
Andy Avatar asked Oct 24 '22 05:10

Andy


1 Answers

Streaming is another way of what you call "all be done in memory". You can feed VideoView with a path to a file, or an Uri for a stream. libmedia is a library I developed to precisely address this feature.

Something like:

mServer = new LocalSingleHttpServer();
mServer.setCipher(myGetCipher());
mServer.start();
path = mServer.getURL(path);
mVideoView.setVideoPath(path);
mVideoView.start();

Be aware that the local http server is not so simple, as it has to deal with jumps because of possible VideoView.seekTo().

like image 175
libeasy Avatar answered Oct 29 '22 18:10

libeasy