Tôi có video trong dự án của mình. và để bảo mật, tôi mã hóa các tệp video đang hoạt động khá tốt. nhưng vấn đề làTôi làm cách nào để phát video từ byte trong android
**videoView.setVideoPath("/mnt/sdcard/intro_video.3gp");**
Trong phương pháp này, tôi phải vượt qua các tập tin. (Được giải mã) vì vậy tôi đang tạo ra tập tin giải mã trên sdcard cho con đường của tập tin là có thể vượt qua byte (trong đó có được giải mã) trực tiếp trong chế độ xem video. Tôi đang sử dụng Cipher để mã hóa.
Đây là mã của tôi cho
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();
}
Xin chào @Youddh, tôi đang tìm giải pháp tương tự. Bạn có thể chia sẻ mã hoạt động không? – user1444172
@ user1444172 xin lỗi như kiến thức của tôi là nó không thể, vì vậy tôi tạo tập tin trong sdcard (với sự thay đổi của một số byte) sau đó tôi nạp tiền vào byte gốc để chơi nó. (Nghe là câu trả lời http://stackoverflow.com/questions/ 4576388/change-a-specific-byte-in-a-file) – Youddh