1

I am incorporating YoutubePlayerView in my app. It works perfectly fine in portrait mode but doesn't work in landscape mode. I am attaching the XML as well as java code for it. Please provide a valid solution for the same.

xml code :

<com.google.android.youtube.player.YouTubePlayerView
    android:id="@+id/pipyoutubevideoview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:visibility="gone"
    />

java code :

youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
                youTubePlayer.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_ORIENTATION);
                youTubePlayer.loadVideo(youtubeUrl);
                youTubePlayer.play();
Jimale Abdi
  • 2,574
  • 5
  • 26
  • 33

1 Answers1

0

Try adding this to manifest :

android:configChanges="keyboardHidden|orientation|screenSize"
Aref
  • 746
  • 10
  • 27