You*_*ddh 6 encryption android android-videoview
我的项目中有视频.为了安全起见,我加密了运行良好的视频文件.但问题在于
**videoView.setVideoPath("/mnt/sdcard/intro_video.3gp");**
Run Code Online (Sandbox Code Playgroud)
在这个方法中,我必须传递文件.(这是解密的)所以我在sdcard上创建解密文件的文件路径是可以直接在视频视图中传递字节(解密).我正在使用Cipher进行加密.
这是我的代码
private void decryption()throws Exception {
// TODO Auto-generated method stub
String filePath2 = path + "en/encVideo";
String filePath3 = path + "de/decVideo";
File decfile = new File(filePath3);
if(!decfile.exists())
decfile.createNewFile();
File outfile = new File(filePath2);
int read;
FileInputStream encfis = new FileInputStream(outfile);
Cipher decipher = Cipher.getInstance("AES");
decipher.init(Cipher.DECRYPT_MODE, skey);
FileOutputStream decfos = new FileOutputStream(decfile);
CipherOutputStream cos = new CipherOutputStream(decfos,decipher);
while((read=encfis.read()) != -1)
{
cos.write(read);
cos.flush();
}
cos.close();
}
Run Code Online (Sandbox Code Playgroud)
我怀疑你能做到。由于您使用的是 VideoView,因此它需要特定的标头和尾端来表明哪种格式以及如何编码等。如果您能弄清楚我仍然怀疑它可以获取原始文件。最好的选择是创建随机文件名,同时保存并将其传递给播放器。
| 归档时间: |
|
| 查看次数: |
2390 次 |
| 最近记录: |