【问题标题】:Android: Playing .avi video file using default player [duplicate]Android:使用默认播放器播放 .avi 视频文件 [重复]
【发布时间】:2012-12-06 17:47:03
【问题描述】:

可能重复:
Android intent for playing video?

如何使用默认播放器播放 .avi 视频文件。

Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
File file = new File(arrGetVideoList.get(position));
intent.setDataAndType(Uri.fromFile(file), " video/*");
startActivity(intent);

arrGetVideoList 是一个包含视频文件路径的数组列表。

谁能帮帮我。

【问题讨论】:

  • arrGetVideoList.get(position) 返回示例?是字符串吗?
  • 请记住,您的设备应支持 .avi 文件扩展名视频。

标签: android video


【解决方案1】:

您无法使用 Android 上的默认播放器播放 .avi 文件。

您可以查看http://developer.android.com/guide/appendix/media-formats.html 以了解 Android 支持哪些格式

如果你真的需要播放除 Android 支持之外的其他格式,你应该看看 FFMpeg。

这里有一些关于android上JavaCV/ffmpeg的有用链接:

http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javacv/ http://stackoverflow.com/questions/13770376/playing-a-video-with-javacv-and-ffmpeg

希望我能帮上忙:)

【讨论】:

  • 感谢您的回复让我检查一下
  • 如果任何答案有用,请将其投票为正确答案:)
【解决方案2】:

这对我有用。

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse(Environment.getExternalStorageDirectory()
    .getPath()
    + "/Test.avi");
intent.setDataAndType(data, "video/avi");
startActivity(intent);

【讨论】:

  • 工作正常。谢谢巴拉吉
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多