Views overlayed above YouTubePlayerFragment or YouTubePlayerView in the layout hierarchy cause playback to pause immediately
Jeff - this works as designed. Overlays on top of any of our YouTube players (including the YouTube Android Player) are not supported. When an overlay is detected, playback stops and the log contains information helpful in debugging the issue.
We do support Action Bar overlays, take a look at this demo to learn more: https://developers.google.com/youtube/android/player/sample-applications#Overlay_ActionBar_Demo.
Android YouTubePlayer with unauthorized overlay on top of player
I faced the same problem today, and for me the error in the logs was:
W/YouTubeAndroidPlayerAPI﹕ YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is not contained inside its ancestor com.google.android.youtube.player.YouTubePlayerView{42686bc8 V.E..... ........ 0,0-1200,675 #7f0a00a0 app:id/video_player}. The distances between the ancestor's edges and that of the YouTubePlayerView is: left: -10, top: -10, right: -10, bottom: -10 (these should all be positive).
I fixed this by removing the padding in the YouTubePlayerView in the layout. So my layout looks like this:
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/video_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000" />
Youtube api UNAUTHORIZED_OVERLAY error
As of youtube api:
YouTubePlayer.ErrorReason.UNAUTHORIZED_OVERLAY: Playback has been stopped due to a view overlaying the player.
Which can be found in here
its might also happen by adding padding, margin or other views created by your activity..
I Can also suggest you creating fresh activity and fragment which contains only youtube view and testing it..
Also maby this links will help you understand more of this issue:
link1
link 2
Related Topics
How to Read Contacts in Android Using Realm
Android Check Permission for Locationmanager
Menuitem Tinting on Appcompat Toolbar
React-Native, Android, Genymotion: Adb Server Didn't Ack
How to Import Eclipse Project to Android Studio
Can't Get File Uri from Intent Onactivityresult
Gridlayout and Row/Column Span Woe
Making a Https Request Using Android Volley
Android Mediarecorder - "Start Failed: -19"
Most Memory Efficient Way to Resize Bitmaps on Android
Android How to Implement Bottom Sheet from Material Design Docs
Circular Reveal Transition for New Activity
How to Instantiate Application Com.Android.Tools.Fd.Runtime.Bootstrapapplication Android