我有一堆 flv视频文件存储在媒体服务器上,我试图让它们在Flash播放器中启动。一直在寻找,但没有找到太多的帮助。我已将flv文件下载到临时存储中,并尝试使用intent
传递它。这是我的代码看起来像(从我在网上看到的):
try{
URL urlLink = new URL("http://206.188.19.131/p4p101.flv");
// Serve the file
InputStream in = urlLink.openStream();
FileOutputStream fos = new FileOutputStream("/sdcard/tempFlash.flv");
byte[] buf = new byte[4 * 1024]; // 4K buffer
int bytesRead;
while ((bytesRead = in.read(buf)) != -1) {
fos.write(buf, 0, bytesRead);
}
fos.close();
in.close();
}
catch(Exception e){}
try{
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File("/sdcard/tempFlash.flv");
intent.setDataAndType(Uri.fromFile(file), "flash/*");
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast toast = Toast.makeText(this, "No apps to launch activity", 1000);
toast.show();
}
答案 0 :(得分:0)
也许这可以帮助: http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications 使用webview中的flash播放器在Android上播放FLV
答案 1 :(得分:0)
可能会尝试更改您的mimetype: video / x-flv或flv-application / octet-stream