How do I fire an intent to start a flv or swf to Flash Player 10.1?

无人久伴 提交于 2019-12-09 19:05:10

问题


I have a bunch of flv video files stored on a media server, and I am trying to get them to launch in the flash player. Have been looking around but haven't found much help. I have downloaded the flv file into temporary storage, and try passing it using an intent. This is what my code looks like (from what I have seen on the net):

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();
}

回答1:


maybe this can help: http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications playing FLV on Android using flash player inside a webview




回答2:


may be try to change your mimetype: video/x-flv or flv-application/octet-stream



来源:https://stackoverflow.com/questions/4504088/how-do-i-fire-an-intent-to-start-a-flv-or-swf-to-flash-player-10-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!