0

In my case,set the textview in above of the youtube player view.I am getting the error like unauthorized overlay.Is it possible to overlay the view in youtube player view?

below is my code

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <TextView
        android:id="@+id/txt_attach"
        android:layout_width="120dp"
        android:layout_height="35dp"
        android:gravity="center"
        android:textSize="15dp"
        android:textColor="#ffffff"
        android:layout_marginTop="100dp"


        android:visibility="visible"
        android:text="Attach"/>

  <fragment
      android:id="@+id/player_fragment"
      android:name="com.google.android.youtube.player.YouTubePlayerFragment"
      android:layout_width="wrap_content"
      android:layout_marginTop="50dp"
      android:layout_height="wrap_content"
     />


</FrameLayout>
Rajesh
  • 521
  • 5
  • 19

1 Answers1

1

try to add youtube player and and text view in framelayout.

<FrameLayout
   android:layout_width="wrap_content"
   android:layout_height="wrap_content">

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/text"
      android:padding="@dimen/four_dp"
      android:Text="text view" />

  <YouTubePlayer
      android:id="@+id/player"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

and in you activity get the view and call text.bringToFront() there maybe errors but i am sure can resolve them

hope that will help you

Mustanser Iqbal
  • 5,017
  • 4
  • 18
  • 36
  • Thanks for your reply but it is not working in my case.please see my edited question.i am getting the error liike YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by android.widget.TextView{1ba6139 V.ED.... ........ 0,200-240,270 #7f060002 app:id/txt_attach}. The view is inside the YouTubePlayerView, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 0, top: 100, right: 480, bottom: 235.. – Rajesh Apr 07 '16 at 04:35
  • you need to check @sebastiano answer here http://stackoverflow.com/a/31695617/3593066 hope this will help you. as i can not test these thing now but later on i will test and will let you know – Mustanser Iqbal Apr 07 '16 at 07:37