Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube Player Full screen control not working in android

i used YoutubePlayerFragment for playing videos , but when i click on Full screen control option , the screen rotates to landscape mode and it gives view not found exception.

enter image description here

 **i am using the following logic:**


    Fragment fragment = new YouTubePlayerFragment();
    FragmentManager fm = getActivity().getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.youtubeplayerview, fragment);
    ft.commit(); 
    YouTubePlayerFragment youtubeFrag = (YouTubePlayerFragment) fragment;
    youtubeFrag.initialize(API_KEY, this);


@Override
public void onInitializationFailure(Provider arg0,
        YouTubeInitializationResult arg1) {
    // TODO Auto-generated method stub

}


@Override
public void onInitializationSuccess(Provider arg0, YouTubePlayer player,
        boolean wasRestored) {
      if (!wasRestored) {

          this.playe=player;
          playe.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);
          playe.loadVideo(videoid,starttime);

          }
     }

So, please guide me how to achieve this. Thank you

like image 980
koti Avatar asked Jan 21 '14 14:01

koti


People also ask

How do I fix YouTube full screen on Android?

Tap your profile icon in the top-right corner. Select “Settings” from the menu. Now go to the “General” section. Toggle the switch on for “Zoom to Fill Screen.”

Why is my YouTube fullscreen not working?

Sometimes a YouTube page will load incorrectly, causing graphical issues in the process. If this is the reason you're encountering a full-screen error, pressing the F5 key or clicking the "Refresh" button will reload the YouTube page and fix the problem. Try using full-screen mode while Chrome isn't maximized.

How do I enable full screen on YouTube?

Go to the video you'd like to watch. At the bottom-right of the video player, click full screen .


1 Answers

You can do manual configChanges in AndroidManifest.xml for youtube activity, something like this:

android:configChanges="orientation|keyboardHidden|screenSize"
like image 85
alexandrius Avatar answered Oct 16 '22 23:10

alexandrius