1

I have used an mp4 video with a 400x760 resolution at 30fps and integrated it into an app using VideoView and MediaController

 MediaController mediac;
 VideoView video1;
 mediac = new MediaController(this);
 mediac.setAnchorView(video1);
 video1 = (VideoView) findViewById(R.id.videoView1);
 video1.setMediaController(mediac);
 video1.setVideoPath("android.resource://video.test/raw/vid");

It plays fine on my ZTE Blade but on an Evo, GS2 and a Galaxy S , it says soryy, cannot play this video

1 Answers1

0

Try with

video_view.setVideoURI(Uri.parse(path));

Sometimes passing directly as a string path doesn't work on some devices. The code which is working fine for me :

path = Environment.getExternalStorageDirectory() + "/file_name";

// Add controls to a MediaPlayer like play, pause.
MediaController mc = new MediaController(this);
video_view.setMediaController(mc);

// Set the path of Video or URI.
video_view.setVideoURI(Uri.parse(path));

// Set the focus.
video_view.requestFocus();

video_view.start();
Daud Arfin
  • 2,499
  • 1
  • 18
  • 37