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();