I've got a simple videoview that plays a video. I'm trying to get it to play smoothly and not rebuffer or restart the Activity upon orientation change from portrait to landscape. Here's the video code:
uriStr = ("http://video.com/video/" + yyyyMdd_Str + "/" + yyyyMdd_Str + ".mp4");
testMediaCon1_MC = new MediaController(this);
testMediaCon1_MC.setAnchorView(testVideo1_VV);
testVideo1_VV.setMediaController(testMediaCon1_MC);
testVideo1_VV.setKeepScreenOn(true);
testVideo1_VV.setVideoPath(uriStr);
testVideo1_VV.requestFocus();
testVideo1_VV.start();
And I think to make the video play smoothly on orientation change I have to get the video's current position, then load that current position when the orientation change happens. So I have the code to get the video position:
@Override
protected void onSaveInstanceState(Bundle out) {
// TODO Auto-generated method stub
super.onSaveInstanceState(out);
if (testVideo1_VV.isPlaying()) out.putInt("pos", testVideo1_VV.getCurrentPosition());
}
But now I can't figure out what the code would be to load the video position here:
@Override
protected void onRestoreInstanceState(Bundle in) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(in);
//load video position here
}
Any ideas? Or am I doing this totally wrong?