I am using YoutubePlayerSupportFragment
in my application. I am adding YouTubePlayer.FULLSCREEN_FLAG_CUSTOM_LAYOUT
flag. From the documentation I know my player won't rebuffer after exiting from full screen, but now I have to handle Action Bar and Navigation Bar. But the documentation doesn't say or point to how I can handle these cases.
Now the problem I am facing is so far only occurring in Asus Nexus 7 OS 5.1.1. I also have an LG G2 D802 OS 4.4.2, Samsung Galaxy TAB GT P5113 OS 4.4.2 and Samsung Galaxy Tab SM-T310 OS 4.2.2 and they do not throw Overlay Error. In the Log cat I get the following Message.
03-09 15:54:39.760 11203-11203/com.jadoo.jadooplus W/YouTubeAndroidPlayerAPI﹕
YouTube video playback stopped due to unauthorized overlay on top of player.
The YouTubePlayerView is obscured by android.view.View{c067400 V.ED.... ........ 0,736-1280,800 #1020030 android:id/navigationBarBackground}.
Top edge 24 px above YouTubePlayerView's bottom edge. .
So I know the problem is in the Navigation Bar. Navigation Bar is overlaying on top of the Player.
My Questions are these
- Why am I not getting the same Error on other devices?
- How Can I handle System Navigation Bar, so that when I am in fullscreen I can still get Navigation Bar if/when I want to stop the player (on back press) without overlaying it on the player.
I tried Listening for Click Events But in Full Screen Mode I can't get any so I tried Overriding
dispatchTouchEvent()
in the Activity and get a Click event my self but even that doesn't help me get rid of Navigation Bar in Time (before time actually).
I also tried listening for System UI change via OnSystemUiVisibilityChangeListener
and hiding navigation bar there (but again perhaps too early to hide navigation bar).
I have set android:theme="@style/Theme.AppCompat.NoActionBar"
in android manifest file so I don't really need to hide the action/status bar just the navigation bar.
Also if anyone can confirm it is device specific issue, it'll be a great help.