Currently working on android application which uses youtube api to show video. In this application I\'m showing video in fragment using youtubeplayerfragment. When I click o
for saving video state use
android:configChanges="keyboardHidden|orientation|screenSize"
in your
activity tag where your fragment is appearing eg:
<activity android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
in your onFullscreen method check if player fullscreen set or not
@Override
public void onFullscreen(boolean b) {
Log.e("onFullscreen",""+b);
if(b)
fullscreen=1;
else fullscreen=2;
}
in your backpress bethod check if full screen is set then set to false
@Override
public void onBackPressed() {
if(fullscreen==1)
{
if(this.player!=null)
youTubePlayer.setFullscreen(false);
}
else
super.onBackPressed();
}
i hope it helps you, sorry for my bad english