1

In my android application I'm working on YouTube player where I'm playing YouTube video from my channel. My player activity has this configuration

<activity android:name=".videos.videoplayer.VideoPlayerActivity"
        android:screenOrientation="sensor"
        android:configChanges="keyboardHidden|orientation|screenSize"/>

My activity layout is here

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/coordinatorLayout"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="?actionBarSize"
    android:id="@+id/appbarLayout"
    android:background="@color/appbar_color">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/toolbar"
        app:layout_scrollFlags="scroll|enterAlways">
        <include layout="@layout/custom_share_appbar"/>
    </RelativeLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/refresh_layout"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:orientation="vertical">
    <com.google.android.youtube.player.YouTubePlayerView
        android:id="@+id/youtube_player"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#000"/>
    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:id="@+id/feeds_content">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <com.beebom.app.beebom.customizeviews.Lato_Bold_TextView
                tools:context=".home.HomeActivity"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/video_title"
                android:text=""
                android:textColor="@color/black"
                android:textSize="@dimen/size_twenty_two_sp"
                android:lineSpacingExtra="@dimen/size_two_sp"
                android:layout_marginLeft="@dimen/size_sixteen_dp"
                android:layout_marginTop="@dimen/size_twenty_dp"
                android:layout_marginRight="@dimen/size_sixteen_dp"
                android:layout_marginBottom="@dimen/size_nine_dp"/>
            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_below="@+id/video_title"
                android:id="@+id/author_details"
                android:layout_marginTop="@dimen/size_ten_dp"
                android:layout_marginLeft="@dimen/size_sixteen_dp"
                android:layout_marginBottom="@dimen/size_twelve_dp">
                <com.beebom.app.beebom.customizeviews.Lato_Regular_TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/video_published_date"
                    android:textColor="@color/black"
                    android:textSize="@dimen/size_forteen_sp"
                    android:textStyle="bold"
                    android:layout_marginRight="@dimen/size_eight_dp"
                    android:text=""/>
                <com.beebom.app.beebom.customizeviews.Lato_Bold_TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=""
                    android:textSize="@dimen/size_twelve_sp"
                    android:textColor="@color/timecolor"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="@dimen/size_sixteen_dp"
                    android:layout_alignParentRight="true"
                    android:id="@+id/video_views"
                    />
            </RelativeLayout>
            <WebView
                android:id="@+id/webView"
                android:layout_below="@+id/author_details"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="@dimen/size_four_dp"
                android:layout_marginRight="@dimen/size_sixteen_dp"
                android:layout_marginLeft="@dimen/size_sixteen_dp"/>
            <ProgressBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:visibility="gone"
                android:layout_margin="@dimen/size_fifteen_dp"
                android:id="@+id/progressBar" />
        </RelativeLayout>
    </android.support.v4.widget.NestedScrollView>
</LinearLayout>

And I'm following sample example from youtube downloaded from youtube developer site.

But my app not working as expected like demo show in the sample. What problem I'm facing is that when I switch to fullscreen view it working perfectly till when I touch the screen and both status bar and navigation bar hover above the player and stop the player after a while saying this error :

W/YouTubeAndroidPlayerAPI: YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by android.view.View{461d366 V.ED..... ........ 1794,0-1920,1080 #1020030 android:id/navigationBarBackground}. The view is inside the YouTubePlayerView, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 1794, top: 0, right: 0, bottom: 0..

How to solve this issue and what is causing this problem.

baldraider
  • 1,049
  • 2
  • 18
  • 48
  • Check these SO question [Android YouTubePlayer with unauthorized overlay on top of player](http://stackoverflow.com/questions/16067783) and [The YouTubePlayerView is obscured by com.lbe.security.service.core.client.a.f](http://stackoverflow.com/questions/27834351/) if it can help you. – KENdi Apr 19 '17 at 15:47

1 Answers1

-1

I had the same problem and the solution was to resize the window in which the video is shown

  • How would you resize a window on a mobile phone? If you are talking about resize in code please write the corresponding command. – Kami Kaze Mar 27 '18 at 16:04