Bram Yeh
1 min readSep 25, 2018

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);
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Bram Yeh
Bram Yeh

Written by Bram Yeh

Lead Android & iOS Mobile Engineer at Yahoo (Verizon Media) Taiwan https://www.linkedin.com/in/hanruyeh/

No responses yet

Write a response