I have built a native android app using YoutubeApi. Sometimes when I backpress from another activity to the activity with the youtubePlayer fragment (YouTubePlayerSupportFr
Youtube api documantation seem to cover the soloution: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerFragment
"The YouTubePlayer associated with this fragment will be released whenever its onDestroyView() method is called. You will therefore have to re-call initialize(String, YouTubePlayer.OnInitializedListener) whenever the activity associated with this fragment is recreated, even if the fragment instance is retained across activity re-creation by setting setRetainInstance(boolean)."
Adding this line helped:
frag.setRetainInstance(true);
frag is the youtube fragment I used for the api.