Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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.

like image 836
Marcelo Pereira Avatar asked Jul 04 '13 19:07

Marcelo Pereira


2 Answers

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?

How to play a video (.mp4) from assets or raw folder with the video intent?

like image 135
Julian Mancera Avatar answered Nov 12 '22 04:11

Julian Mancera


Please try this, Here strMyVideo is my filepath,

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(strMyVideo));
intent.setDataAndType(Uri.parse(strMyVideo), "video/mp4");
activity.startActivity(intent);
like image 34
Parth Bhayani Avatar answered Nov 12 '22 04:11

Parth Bhayani