简体   繁体   English

如何使用Android应用程序的意图播放视频mp4?这个有可能?

[英]How to play video mp4 using intent from my android app? This is possible?

I need to play a mp4 video in my app, bat I want to use intent. 我需要在我的应用程序中播放mp4视频,我想使用意图。 Is this possible? 这可能吗?

private void startTrailer(){

            Uri contentUri = Uri.parse("android.resource://" + pkgName + "/" +R.raw.v01_homem_ferro_3);
    Intent intent = new Intent( Intent.ACTION_VIEW );
    intent.setDataAndType( contentUri, "video/mp4" );
    context.startActivity( intent );
}

Exception: No Activity found to handle Intent. 例外:找不到处理Intent的Activity。

Somebody had this issue before. 之前有人遇到过这个问题。 Check these links and see if they give you a good starting point to solve the problem: 检查这些链接,看看它们是否为您提供了解决问题的良好起点:

Android intent for playing video? Android打视频的意图?

How to play a video (.mp4) from assets or raw folder with the video intent? 如何使用视频意图从资源或原始文件夹播放视频(.mp4)?

Please try this, Here strMyVideo is my filepath, 请试试这个,这里strMyVideo是我的文件路径,

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(strMyVideo));
intent.setDataAndType(Uri.parse(strMyVideo), "video/mp4");
activity.startActivity(intent);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM