2

i am creating YouTubePlayerSupportFragment. Playing in portrait mode works just fine. As soon as i click the fullscreen button of the player it forces an orientation change and recreates the activity i am in (the video stops playing and the fragment is recreated).

this is how i create the fragment:

fragment = (YouTubePlayerSupportFragment) getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
fragment.initialize(Config.YOUTUBE_API_KEY, this);

The only similar thing on StackOverflow I could find was this question: YouTubePlayerSupportFragment starts duplicate Activity

This guy has the same problem but no answer so far.

Community
  • 1
  • 1
elgubbo
  • 59
  • 1
  • 9

2 Answers2

7

I had the same issue and apparently it's defined behaviour. You can disable it like this (for example in onInitializationSucces):

@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean success) {
    player.setFullscreenControlFlags(0);

More info here.

Saragis
  • 1,782
  • 6
  • 21
  • 30
1

my problem was i did't call super.onSaveInstanceState(b) on my own onSaveInstanceState...

elgubbo
  • 59
  • 1
  • 9