【问题标题】:play mov file format in android studio using intent使用意图在android studio中播放mov文件格式
【发布时间】:2020-04-06 10:20:45
【问题描述】:

在我的 android 应用程序中,我无法有意播放 mov 文件格式的视频文件,它在应用程序和 logcat 中显示(无法播放视频),它显示发生异常:

java.lang.IllegalArgumentException: .mov 文件格式的未知 URI

【问题讨论】:

  • 在此处发布您的代码
  • 意图 videoIntent = new Intent(Intent.ACTION_VIEW); videoIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); videoIntent.setDataAndType(Uri.parse(finalToLoad), "video/*"); context.startActivity(videoIntent);
  • Android 不支持mov 文件格式(嗯,你知道,它是一种Apple 媒体格式)。 developer.android.com/guide/topics/media/media-formats.html

标签: android android-intent


【解决方案1】:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(videoPath));
intent.setDataAndType(Uri.parse(videoPath), "video/*");
startActivity(intent);

请确保您的路径正确

【讨论】:

  • 是的,我的路径是正确的,我可以播放 .mp4 文件,除了 .mov 文件。有没有其他方法可以使用 Intent 播放 .mov 格式的文件?
  • 那么我认为您的设备不包含任何可以播放 .mov 格式的应用程序
  • 是的,我的设备是三星 s6 edge,android 7+。有人建议我将 .mov 转码为 .mp4 。但我在 android studio 中找不到将 .mov url 转换为 .mp4 url​​ 的任何代码或库。
【解决方案2】:

首先从意图中获取 .mov(快速时间)文件

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(videoPath));
intent.setDataAndType(Uri.parse(videoPath), "video/*");
startActivity(intent);

并使用

implementation 'com.devbrackets.android:exomedia:4.3.0'

而不是 Android 的 Default VideoView。这个videoview的使用方法和默认的android videoview一样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多