I am playing a video and it has got a fullscreen icon.On clicking on it i am forcefully rotating the device orientation to landscape mode.But then when i rotate the screen,the video is locked into landscape mode only.It is not coming back to potrait mode.I want the video rotation to happen similar to Youtube/Hotstar app,where change of rotation happens both on button click and device orientation change.Kindly suggest some way forward.
findViewById(R.id.landscape).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
}
});
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setAutoOrientationEnabled(this,false);
}
Question:
My simple requirement is after forcefully rotating the activity using setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); how can i again go back to potrait mode by rotating the device without calling setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_POTRAIT);