2

Possible Duplicate:
Android intent for playing video?

How to play .avi video file using default player.

Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
File file = new File(arrGetVideoList.get(position));
intent.setDataAndType(Uri.fromFile(file), " video/*");
startActivity(intent);

arrGetVideoList is a arraylist contains videofile path.

Can anyone help me.

Community
  • 1
  • 1
Maddy
  • 253
  • 1
  • 5
  • 15

2 Answers2

4

this works for me.

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse(Environment.getExternalStorageDirectory()
    .getPath()
    + "/Test.avi");
intent.setDataAndType(data, "video/avi");
startActivity(intent);
Balaji.K
  • 8,745
  • 5
  • 30
  • 39
1

You can't play .avi files using the default player on Android.

You may take a look at http://developer.android.com/guide/appendix/media-formats.html to see what formats are supported on Android

If you really need to play other formats than the supporteds by Android, you should take a look at FFMpeg.

Here are some usefull links about JavaCV/ffmpeg on android:

http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javacv/ http://stackoverflow.com/questions/13770376/playing-a-video-with-javacv-and-ffmpeg

Hope I could help :)

Joao Guilherme
  • 387
  • 2
  • 10