Play Android Oriented Video

Avoiding reloading the video with a change in orientation to make the video resume from the same.

I tried below but it fails

vd = (VideoView) findViewById(R.id.vplayer); ....... public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putInt("Position",vd.getCurrentPosition()); } public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); int position= savedInstanceState.getInt("Position"); vd.seekTo(position); } 
+4
source share
1 answer

What you can do is stop your activity in order to recreate it when you change orientation. You can do this by adding an activity tag to your AndroidManifest.xml file

 android:configChanges="keyboardHidden|orientation" 
+7
source

All Articles