I\'m using the YouTube Android Player API and want to overlay a view on top of a YouTubePlayerFragment
in order to display contextual information and controls a
It is not possible to add buttons as overlays above the player as specified by Google, otherwise the player will stop:
https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerView
Note that while videos are playing, this View has a minimum size of 200x110 dp. If you make the view any smaller, videos will automatically stop playing. Also, it is not permitted to overlay the view with other views while a video is playing.
This view does not support padding. To achieve the same effect, wrap the view in another ViewGroup or give it margins.
Padding is also not supported on YouTubePlayer.
To overlay your view on video, I will recommend you to use ExoPlayer, It is not part of the android sdk, but it's recommended by google and included in android developer documentation :
http://google.github.io/ExoPlayer/
It's also good to mention that Exoplayer is used in youtube application.
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.
You can set the player theme to YouTubePlayer.PlayerStyle.CHROMELESS and then implement your own controls below.
I am having an issue where I can not find a good resource on how to re-implement the seek bar with a custom layout.
Volla !! I have got one scenario where this issue was coming in devices lollipop and above and it was because of the status bar . I hide the status bar problem solved. Just wrote it as an answer in case if its helps others :)
Youtube Player don't allow any view overlay it. Just using setVisibility(View.GONE) for all view overlay it.