I’m trying to display video in a defined VideoView in the .xml file, but the way I followed represented in the below code, doesnt work.
Please check the code and guide me.
code:
final String VIDEO_FILE_PATH = "C:\\Users\\Amr\\Downloads\\3aeshen ElLa7za.avi";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vv =
(VideoView) findViewById(R.id.video_view);
mp = new MediaPlayer();
try {
mp.setDataSource(VIDEO_FILE_PATH);
mp.prepare();
mp.start();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
vv.setVideoPath(MEDIA_FILE_PATH);
vv.start();
}
Your video file path should be on a SD CARD: