title: YouTubePlayerSupportFragment stops inside VerticalViewPager
body: <p>I am developing an app with YouTubeVideoPlayer and Images inside VerticalViewPager. When I swipe to video fragment player throws below error.</p>
  
  <p><code>YouTube video playback stopped due to unauthorized overlay on top of player. 
  The YouTubePlayerView is obscured by android.widget.</code></p>
  
  <p>For example let's say I have Video on 2nd page. If I swipe from 1st to 2nd it will work, but when I swipe from 3rd to 2nd it gives above error. I know YouTubePlayer doesn't support any view over it or padding. In my layout there is nothing which is on top of player.</p>
  
  <p>In the FrameLayout @+id/frame,YouTubePlayerSupportFragment is added. In error log it shows root layout(RelativeLayout) overlaps the player. </p>
  
  <p>Here is my xml code</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:id="@+id/card"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          app:cardBackgroundColor="@color/bg"
          app:cardCornerRadius="@dimen/margin_5"
          app:cardUseCompatPadding="true"&gt;
  
          &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:background="@android:color/white"
              android:orientation="vertical"&gt;
  
              &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:app="http://schemas.android.com/apk/res-auto"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/linear_main"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical"&gt;
  
                      &lt;FrameLayout
                          android:id="@+id/frame"
                          android:layout_width="match_parent"
                          android:layout_height="@dimen/margin_200" /&gt;
  
                      &lt;RelativeLayout
                          android:id="@+id/rel_control"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:background="@android:color/black"
                          android:padding="@dimen/margin_5"&gt;
  
                          &lt;ImageView
                              android:layout_marginLeft="@dimen/margin_5"
                              android:id="@+id/img_mute"
                              android:padding="@dimen/margin_5"
                              android:layout_width="@dimen/margin_23"
                              android:layout_height="@dimen/margin_23"
                              android:src="@drawable/mute" /&gt;
                          &lt;ImageView
                              android:layout_marginRight="@dimen/margin_5"
                              android:id="@+id/img_fullscreen"
                              android:padding="@dimen/margin_5"
                              android:layout_width="@dimen/margin_22"
                              android:layout_height="@dimen/margin_22"
                              android:layout_alignParentRight="true"
                              android:src="@drawable/fullscreen" /&gt;
                      &lt;/RelativeLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical"
                          android:padding="@dimen/margin_10"&gt;
  
                          &lt;android.support.v7.widget.AppCompatTextView
                              android:id="@+id/txt_title"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:fontFamily="@font/dejavuserif"
                              android:lineSpacingExtra="@dimen/margin_5"
                              android:maxLines="2"
                              android:text="How to be happy? Ideas from the world's happiest Man!"
                              android:textColor="#292929"
                              android:textSize="@dimen/font_15"
                              android:textStyle="bold" /&gt;
  
                          &lt;android.support.v7.widget.AppCompatTextView
                              android:id="@+id/txt_desc"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="@dimen/margin_10"
                              android:fontFamily="@font/dejavusans_condensed"
                              android:lineSpacingExtra="@dimen/margin_5"
                              android:text="Buddhist monk, Matthieu Ricard has been called the World's happiest man. It was found that while meditating, Ricard's mind remained at an unusually clam state. Here he shares formula of his happiness."
                              android:textColor="#808080"
                              android:textSize="@dimen/font_14" /&gt;
  
                          &lt;android.support.v7.widget.AppCompatTextView
                              android:id="@+id/txt_web"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_marginTop="@dimen/margin_10"
                              android:fontFamily="@font/dejavusans_extralight"
                              android:text="By:Sample Website"
                              android:textColor="#808080"
                              android:textSize="@dimen/font_10"
                              android:visibility="gone" /&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;ImageView
                      android:id="@+id/img_more"
                      android:layout_width="@dimen/margin_50"
                      android:layout_height="@dimen/margin_50"
                      android:layout_alignParentBottom="true"
                      android:layout_alignParentRight="true"
                      android:padding="@dimen/margin_5"
                      android:layout_margin="@dimen/margin_5"
                      android:src="@drawable/more_arrow"
                      android:visibility="gone" /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/linear"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"&gt;
  
                  &lt;View
                      android:layout_width="match_parent"
                      android:layout_height="@dimen/margin_1"
                      android:background="@color/blue_DEDEDF"
                      android:visibility="gone" /&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:padding="@dimen/margin_5"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_weight="1"
                          android:gravity="center"&gt;
  
                          &lt;ImageView
                              android:id="@+id/img_like"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:padding="@dimen/margin_10"
                              android:src="@drawable/sel_heart" /&gt;
                      &lt;/LinearLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_weight="1"
                          android:gravity="center"&gt;
  
                          &lt;ImageView
                              android:id="@+id/img_bookmark"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:padding="@dimen/margin_10"
                              android:src="@drawable/sel_bookmark" /&gt;
                      &lt;/LinearLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center_vertical"
                          android:layout_weight="1"
                          android:gravity="center"&gt;
  
                          &lt;ImageView
                              android:id="@+id/img_share"
                              android:layout_width="wrap_content"
                              android:layout_height="match_parent"
                              android:background="@drawable/anim_share"
                              android:padding="@dimen/margin_11" /&gt;
                      &lt;/LinearLayout&gt;
  
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Edit</strong> Fragment code</p>
  
  <pre><code>@Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      mYouTubePlayerSupportFragment = YouTubePlayerSupportFragment.newInstance();
      if (getUserVisibleHint()) {
          FragmentTransaction transaction = getFragmentManager().beginTransaction();
          transaction.replace(R.id.frame, mYouTubePlayerSupportFragment).commit();
          mYouTubePlayerSupportFragment.initialize(Constant.DEVELOPER_KEY, this);
      }
  }
  
  @Override
  public void setUserVisibleHint(boolean isVisibleToUser) {
      super.setUserVisibleHint(isVisibleToUser);
  
      if (!isVisibleToUser &amp;&amp; mYoutubePlayer != null) {
          mYoutubePlayer.pause();
          mYoutubePlayer.release();
  
      }
      if (isVisibleToUser &amp;&amp; mYouTubePlayerSupportFragment != null) {
  
          FragmentTransaction transaction = getFragmentManager().beginTransaction();
          transaction.replace(R.id.frame, mYouTubePlayerSupportFragment).commit();
          mYouTubePlayerSupportFragment.initialize(Constant.DEVELOPER_KEY, this);
  
      }
  }
  </code></pre>