In the source code at https://github.com/gradha/Android-video-stream-rotation. you added the comment:
Since we specified in the
AndroidManifest.xml that we want to handle our own orientation
changes, we resize the screen in function of being portrait or
landscape.
From the source code AndroidManifest.xml
android:configChanges="orientation|screenSize"
So, if you add this attribute to the activity element in the manifest, I would interpret that as the activity will handle all the orientation changes? not you?
From Android Developers
To declare that your activity handles a configuration change, edit the
appropriate activity element in your manifest file to include the
android:configChanges attribute... more
So you should not need to:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
I created a test project to check if this was the case:
Rotating Video Stream Example: https://github.com/TouchBoarder/RotatingVideoStream
My conclusion:
I did not need to overide the "onConfigurationChanged" in the activity to display the video correct in both portrait and landscape, and the video keeps playing on rotation changes.
Feel free to improve and use the code:)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…