【问题标题】:How to play 3gp video file with intent in android?如何在android中播放3gp视频文件?
【发布时间】:2012-11-04 10:41:40
【问题描述】:

我想在我的安卓平板电脑上播放 .3gp 视频文件。我尝试了下面的代码,但它会引发错误消息。如何在 android 中使用默认视频播放器播放?

String movieurl = root + "/" + fileNameTextView.getText().toString();           
Intent intent = new Intent(android.content.Intent.ACTION_VIEW); 
Uri data = Uri.parse(movieurl); 
intent.setDataAndType(data,"video/3gpp"); 
startActivity(intent); 

这是错误信息:

11-15 13:47:11.060: E/AndroidRuntime(23061): android.content.ActivityNotFoundException:找不到要处理的活动 意图{act=android.intent.action.VIEW dat=/mnt/sdcard/DCIM/Camera/VID_20121002_174209.3gp typ=video/3gpp }

【问题讨论】:

  • 你可以试试video/*
  • 我试过了。仍然给出相同的错误信息。但是,如果我浏览到该文件并单击它,Gallery 播放器就会启动并正常播放该文件。
  • 我刚刚发现它适用于三星 Galaxy 平板电脑,但不适用于摩托罗拉 Xoom。有什么问题?
  • 而且他们的安卓版本都是4.0.4
  • 摩托罗拉 Xoom 将视频文件保存为 3gp 格式,但三星 Galaxy 将它们保存为 mp4 格式。两者都有相同的操作系统。

标签: android android-intent 3gp


【解决方案1】:

我已经通过在开头添加“file:///”来更改字符串movieurl:

String movieurl = "file:///" + root + "/" + fileNameTextView.getText().toString();

这就解决了问题。

【讨论】:

    猜你喜欢
    • 2014-11-02
    • 2011-11-22
    • 1970-01-01
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-21
    • 2011-08-08
    相关资源
    最近更新 更多