Incompatibility of YouTube API and Android libraries


Using the Android Support Library is required to use classes such as DrawerLayout. This requires your base activity to extend FragmentActivity.

If you need multiple YouTubePlayers in your layout, you must use YouTubePlayerView. This requires your base activity to extend YouTubeBaseActivity.

Obviously, you cannot extend a class from multiple superclasses.

Potential solutions:

A) Make versions of DrawerLayout library and don't maintain them.

B) Create class YouTubeBaseFragmentActivity.

(Perhaps Google Android and / or YouTube engineers have seen this issue and are working on something?)

General comments:

A design spec for a recent project specified a navigation drawer for navigating the app, while some app screens required multiple YouTube players to be displayed. This highlighted the underlying problem of incompatibility. I see this problem is becoming more common.

Does someone have an effective job to achieve this? (Apart from not using drawer navigation and multiple onscreen YouTubePlayers in one app!)


source to share

1 answer

YouTubePlayerSupportFragment is specifically designed to work with the support library FragmentActivity


Also note that it DrawerLayout

doesn't require a use FragmentActivity

- any operation will work very well with it (since this is just a layout).



All Articles