Reputation: 311
I am loading video in YouTubePlayerView(in android device). Initially it plays for 2 seconds and stops by showing play button on it. If again I press play button , video plays for 2 sec and get paused.
Upvotes: 2
Views: 1444
Reputation: 35
Add margins to the wrapper view around the youtube view,I did this and added margin both vertically and horizontally and the error was fixed.
Upvotes: 0
Reputation: 3507
I was getting the same behavior and the error "UNAUTHORIZED_OVERLAY," but this actually had nothing to do with the solution I eventually found. I wasn't overlaying the video with anything, and had the padding was 0. My problem was that the targetSdkVersion was set to 26. I reduced it to 19 and it works now. This took forever to track down, so hopefully this will save someone else some time.
tl;dr: Reduce the targetSdkVersion in your app's build.gradle to 19
Upvotes: 1
Reputation: 13348
Make sure the size of the YoutubePlayer view is atleast 200x110 dp like descriped in the Youtube API documentation. Sounds like it doesn't meet those requirements when in landscape mode.
Youtube API documentation
Upvotes: 0