I am using SurfaceView with MediaPlayer. When a video is played, everything works as expected, it changes its size in accordance with the new orientation and continues to play. The problem is that it is paused. When the video is paused, it is visible, but then when I change the orientation, it turns black, everything else remains the same as my search bar and text view. this is how i handle orientation changes:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setVideoSize(mediaPlayer); surfaceView.setLayoutParams( new FrameLayout.LayoutParams(videoWidth,videoHeight)); ((FrameLayout.LayoutParams) surfaceView.getLayoutParams()).gravity = Gravity.CENTER; }
setVideoSize () sets the video width and video according to the screen resolution. How is it that when he plays, and when he is paused, is that not so?
Tomka source share