elgubbo
elgubbo

Reputation: 49

YouTubePlayerSupportFragment fullscreen button forces orientation change and does not enter fullscreen

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.

Upvotes: 1

Views: 3087

Answers (2)

Saragis
Saragis

Reputation: 1792

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.

Upvotes: 6

elgubbo
elgubbo

Reputation: 49

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

Upvotes: 1

Related Questions