私はlibmedia libを使用して暗号化されたビデオを再生できる基本的なアプリを持っています。Android Media Encrypted Video with libmedia:java.io.FileNotFoundException:コンテンツプロバイダなし:
ビデオ暗号化方式が正しく機能しています。
しかし、ビデオを再生しているとき、それは
このエラーメッセージを示しパスヌル setDataSourceにIOExceptionが起こっている:java.io.FileNotFoundException:いいえ、コンテンツプロバイダ: http://127.0.0.1:36316/http://127.0.0.1:36316/storage/emulated/0/AB/b.mp4
ここでは私の暗号化方式であります
public static void encrypt() throws Exception {
final byte[] buf = new byte[8192];
final Cipher c = Cipher.getInstance("AES/CTR/NoPadding");
c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec("123456789".getBytes(), "AES"), new IvParameterSpec(new byte[16]));
final InputStream is = new FileInputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/AB/"+"a.mp4");
final OutputStream os = new CipherOutputStream(new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/AB/"+"b.mp4"), c);
while (true) {
int n = is.read(buf);
if (n == -1) break;
os.write(buf, 0, n);
}
os.close(); is.close();
}
ここは自分の再生ボタンです
PlayBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/AB/b.mp4");
try {
mServer = new LocalSingleHttpServer();
} catch (IOException e) {
e.printStackTrace();
}
String path = mServer.getURL(file.getPath());
try {
mServer.setCipher(myGetCipher());
mServer.start();
path = mServer.getURL(path);
videoView.setVideoPath(path);
videoView.start();
}catch (Exception e){
e.printStackTrace();
}
}
});
GetCyper
compileSdkVersion 23
buildToolsVersion "23.0.3"
エラーメッセージでコンパイル()メソッド
private Cipher myGetCipher() throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException {
// avoid the default security provider "AndroidOpenSSL" in Android 4.3+ (http://libeasy.alwaysdata.net/network/#provider)
Cipher c = Cipher.getInstance("ARC4", "BC");
c.init(Cipher.DECRYPT_MODE, new SecretKeySpec("BrianIsInTheKitchen".getBytes(), "ARC4"));
return c;
}
setDataSource IOException happend :
java.io.FileNotFoundException: No content provider: http://127.0.0.1:40208/storage/emulated/0/AB/b.mp4
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1053)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:907)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:834)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:979)
at android.widget.VideoView.openVideo(VideoView.java:338)
at android.widget.VideoView.setVideoURI(VideoView.java:248)
at android.widget.VideoView.setVideoURI(VideoView.java:238)
at android.widget.VideoView.setVideoPath(VideoView.java:234)
at encrypt.amg.com.encryptiont2.MainActivity$2$override.onClick(MainActivity.java:89)
ありがとうございます。それでもなおエラーは – san88
と同じですか?エラーメッセージを表示してください。 – sky