如何在Android中播放加密的视频文件
我搜索了很多关于SO的问题,但找不到答案,这就是为什么我问以下问题:
Android应用程序应该能够播放加密的视频文件(存储在SD卡上并从网络服务器检索) 。 该文件必须存储在 SD 卡上,以便应用程序可以在没有有效互联网连接的情况下播放视频文件。 由于视频文件可能无法复制,因此计划在将文件上传到网络服务器时在服务器端对其进行加密。
最好的选择是什么?
1) 我看到了运行本地网络服务器来解密文件的建议(以及如何执行此操作?)
2) 或者我们应该解密文件,将其另存为临时文件并将该临时文件设置为视频播放器的源?
3)完全不同的东西?
I searched through a lot of questions on SO but I can't find the answer, that's why I ask the following question:
An Android app should be able to play an encrypted video file (stored on the SD card and retrieved from a webserver).
The file has to be stored on the SD card so that the app can play the video file without having an active internet connection.
Because the video files may not be copied, the plan is to encrypt them server side when uploading the files to a webserver.
What is the best option?
1) I have seen suggestions for running a local webserver which decrypts the file (and how to do this?)
2) or should we decrypt the file, save it as a temporary file and set this temporary file as the source for the videoplayer?
3) something completely different?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您正在尝试实施一种 DRM 方案,而且这是一种幼稚的方案。研究 DRM 方案并报告您是否无法实现不可能的任务。您所希望的只是混淆,并且有很多方法可以做到这一点(当然,没有一种方法是安全的)。
You are trying to implement a DRM scheme, and a naive one at that. Look into DRM schemes and report back if you cannot implement the impossible. All you can hope for is obfuscation, and there are plenty of ways of doing that (none of them are secure of course).
您需要的是 DRM。数字版权管理 (DRM) 控制对视频等数字内容的访问。首先,您需要使用 AES-128 等加密视频对视频进行加密。然后在exoplayer中使用DRM播放。 Exoplayer 有 DRM 支持。你可以在这里查看。 https://exoplayer.dev/drm.html
What you need is DRM. Digital Rights Management (DRM) controls the access to your digital content such as video. Firstly, you need to encrypt the video with an encryption video like AES-128. Then with the use of DRM play in exoplayer. Exoplayer has DRM support. you can check here. https://exoplayer.dev/drm.html
如果您选择事先解密整个大视频,您将使用户等待一段时间。就安全性而言,您可以猜测将文件内容清晰地保存在文件中是一个糟糕的主意,即使是临时文件。本地网络服务器是更好的选择,因为它是一种流式传输方法,因此没有文件存储。 SDK 中没有用于 http 服务器的类,您必须实现自己的类,否则请寻找类似于 LocalSingleHttpServer 的现有库。
You will expose the user to a waiting time if you choose to decrypt a entire big video beforehand. As of the security, you can guess it's a poor idea to have the contents in clear in a file, even temporary. The local webserver is a better choice because it's a streaming method, so without file storage. There is no class for an http server in the SDK, you have to implement your own one, otherwise look for an existing library similar to LocalSingleHttpServer.