如何向 Flash Player 10.1 发出启动 flv 或 swf 的意图?

发布于 2024-10-08 20:13:13 字数 951 浏览 10 评论 0原文

我在媒体服务器上存储了一堆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();
}

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舟遥客 2024-10-15 20:13:13

也许这可以帮助:
http://www.synesthesia.it/playing-flash-flv -android 应用程序中的视频
在 Android 上使用 webview 中的 flash 播放器播放 FLV

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

Saygoodbye 2024-10-15 20:13:13

可能会尝试更改您的 mimetype:
视频/x-flv 或 flv-application/octet-stream

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文