In the last paragraph, there is
public void onSaveInstanceState(Bundle var1) {
super.onSaveInstanceState(var1);
Bundle var2 = this.c != null ? this.c.e() : this.b;
...
}
so you can do
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); final Bundle playerState = YouTubePlayerViewUtils.getPlayerState(mYouTubePlayerView);
if (playerState != null) {
state.putBundle(KEY_PLAYER_VIEW_STATE, playerState);
}
}
And modify the creation
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); mPlayerState = savedInstanceState != null ? savedInstanceState.getBundle(KEY_PLAYER_VIEW_STATE) : null;
}@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mYouTubePlayerView = YouTubePlayerViewUtils.createYouTubePlayerView(getActivity(), mOnYoutubePlayerInitListener, mPlayerState);
}