How to play mp4 video using the intent of my android app? Is it possible?

I need to play mp4 video in my application, bat. I want to use intention. Is it 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 actions were found to work with Intent.

+6
source share
2 answers

Someone had this problem before. Check out these links and see if they provide a good starting point to solve the problem:

Android goal to play video?

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

+2
source

Please try this, here strMyVideo is my file path,

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

Source: https://habr.com/ru/post/948738/


All Articles