Skip to content
Pierfrancesco Soffritti edited this page Nov 20, 2017 · 5 revisions

The PlayerUIController has a dedicated menu button.

You can use this methods to control the button's behavior:

void showMenuButton(boolean show);
void setCustomMenuButtonClickListener(@NonNull View.OnClickListener customMenuButtonClickListener);

The default OnClickListener calls the method show() of the YouTubePlayerMenu.

YouTubePlayerMenu

Internally the menu is represented by a YouTubePlayerMenu. You can see its contract here.

You can get a reference of the YouTubePlayerMenu from the PlayerUIController, using the method PlayerUIController.getMenu(). You can add your own implementation of YouTubePlayerMenu using PlayerUIController.setMenu(YouTubePlayerMenu youTubePlayerMenu).

The default YouTubePlayerMenu shows a popup window when the method show() is called. The popup window contains a list of MenuItems. You can see the default implementation here.

Unless you want to provide a different UX to your users you can safely use the default implementation.

MenuItem

MenuItems are the entries in the YouTubePlayerMenu. They are POJOs with a String of text, an icon and an OnClickListener. Here is the implementation.

Initially the menu doesn't contain any MenuItem. You need to add them, using the method YouTubePlayerMenu.addItem(MenuItem menuItem).

Clone this wiki locally