I am trying to play a video i have saved in my project. I have download this (an .mp4 test video) then created a folder within my project called vid on the root of the project. I have then used this code:
public void PlayLocalVideo(View view)
{
VideoView video=(VideoView) findViewById(R.id.video1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(video);
video.setMediaController(mediaController);
video.setKeepScreenOn(true);
video.setVideoPath("android.resource://uk.co.SplashActivity/vid/big_buck_bunny.mp4");
video.start();
video.requestFocus();
}
my xml looks like this:
<VideoView
android:id="@+id/video1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
PlayLocalVideo is a method i have then used on the onclick event on a button. but when i press play nothing happens :(