简体   繁体   English

如何在android中加密和解密视频文件

[英]How to encrypt and decrypt a video file in android

I have a question that I want to encrypt the video file when finished playing and after that when user again want to play the same I have to decrypt that. 我有一个问题,我想在完成播放时加密视频文件,之后当用户再次想要播放时我必须解密它。 Means I have to encrypt the file at onCompletion of the video and decrypt the video file when want to be playing. 意味着我必须在视频的onCompletion上加密文件,并在想要播放时解密视频文件。

This is for only security reasons that user can not transmit it to another place. 这仅出于安全原因,用户无法将其传输到其他地方。

Thanks in advance. 提前致谢。

You need not decrypt the video. 您无需解密视频。 Here is a third party library to play encrypted videos on the fly. 这是第三方库,可以即时播放加密视频。

http://libeasy.alwaysdata.net/network/#encoding http://libeasy.alwaysdata.net/network/#encoding

It make the local server and serve the frames of video in chunks to the Videoview.From your app only it can play 它使本地服务器以视频帧的形式提供给Videoview.From您的应用程序只有它可以播放

Instead of encrypt it after completion I would suggest you to encrypt it during download and when you need to play it, you will decrypt it, and play. 我建议你在下载过程中对它进行加密,而不是在完成后加密它,当你需要播放它时,你会解密它并播放它。 Once user leaves your application, you can delete temporary decrypted file and you will have saved encrypted file already. 用户离开您的应用程序后,您可以删除临时解密文件,并且您已经保存了加密文件。

In case you worry too much about exposing decrypted file, you might want to take a look at other implementation with DRM. 如果您过于担心暴露解密文件,您可能需要查看DRM的其他实现。

For basic encryption/decryption code these is already being given answer: Encryption of video files? 对于基本的加密/解密代码,这些已经给出了答案: 视频文件的加密?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM