我有一堆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();
}
也许这可以帮助:http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications在 Android 上使用 webview 中的 flash 播放器播放 FLV
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)