Hi Folks,
I am currently developing a small app which has an option to play a few videos. However, i have tried to use a number of different conversion tools but none of the videos seem to play.
Tried converting to mp4 (.h264), wmv, 3pg(.h264)
The code i am using is below
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoPlayer);
playVideo();
}
private void playVideo() {
doCleanUp();
try {
VideoView video = (VideoView) this.findViewById(R.id.trailerView);
Uri uri = Uri.parse("android.resource://com.mytest.player/" + R.raw.test);
video.setVideoURI(uri);
video.setMediaController(new MediaController(this));
video.requestFocus();
video.setOnCompletionListener(this);
video.start();
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
}
}
Is there something fundamental i am doing wrong here or is it simply done to the videos i am using.
Regards,
Stephen
I am currently developing a small app which has an option to play a few videos. However, i have tried to use a number of different conversion tools but none of the videos seem to play.
Tried converting to mp4 (.h264), wmv, 3pg(.h264)
The code i am using is below
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoPlayer);
playVideo();
}
private void playVideo() {
doCleanUp();
try {
VideoView video = (VideoView) this.findViewById(R.id.trailerView);
Uri uri = Uri.parse("android.resource://com.mytest.player/" + R.raw.test);
video.setVideoURI(uri);
video.setMediaController(new MediaController(this));
video.requestFocus();
video.setOnCompletionListener(this);
video.start();
} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
}
}
Is there something fundamental i am doing wrong here or is it simply done to the videos i am using.
Regards,
Stephen