Removing elements from within the YouTubePlayerView in Android

╄→尐↘猪︶ㄣ 提交于 2019-12-25 17:18:38

问题


My YouTube video shows an overflow menu, full screen, open in YouTube buttons from within the YouTubePlayerView or the YouTubePlayerFragment.

Is there any way to remove those items? I can't find anything in the docs.

Thanks.


回答1:


Add the style YouTubePlayer.PlayerStyle.CHROMELESS in initialization to completely remove all available controls.

In onInitializationSuccess add ytPlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);.

Check here for more details.

Edit : You can add your own controls using either a DialogFragment or Dialog on top of the YoutubePlayer. This will allow you to control playback completely using your own buttons and seekbar. And it does the trick of removing Youtube App Button from player.




回答2:


Yes You can disable full screen from default player,You need to just use below code with your player object.

//To disable full screen mode.
player.setShowFullscreenButton(false);

Use above line to hide full screen button from your default youtube player.Hope this will work for you.



来源:https://stackoverflow.com/questions/35980341/removing-elements-from-within-the-youtubeplayerview-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!