Possible Duplicate:
How to continue video play while orientation change in android
I'm just playing an rtsp video on android default player.Halfly, when i change orientation into landscape,it starts streaming from beginning.How could i do continue playing.I gave androidconfig="orientation" on manifest file.But still happens same.What else i need to do for that?
My code:
private String vSource="http://commonsware.com/misc/test2.3gp";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
// sets the Bundle
super.onCreate(savedInstanceState);
// sets the context
setContentView(R.layout.main);
myVideoView= (VideoView)findViewById(R.id.vview);
myVideoView.setVideoURI(Uri.parse(vSource));
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
public void onSaveInstanceState(Bundle outState){
mStartTime = myVideoView.getCurrentPosition();
outState.putInt("restartTime", mStartTime);
super.onSaveInstanceState(outState);
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
myInt = savedInstanceState.getInt("restartTime");
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
myVideoView.seekTo(myInt);
myVideoView.start();
}
Thanks.