This package contains all the interfaces and classes of the YouTube Android Player API. This API enables you to easily play YouTube videos and display thumbnails of YouTube videos in your Android application.
There are two ways to play videos. The first option is to place a
YouTubePlayerFragment
or YouTubePlayerView
in your View hierarchy and then use the
YouTubePlayer
to control video playback in the View.
This gives a fine control of the experience. For example, you can decide the size of the video,
listen to events from the player and control the playback.
The second option is to use the YouTubeStandalonePlayer
which will start video playback in a separate activity. This is simpler to use, however it gives
you less flexibility and control over video playback. The StandalonePlayer
supports two
modes, either fullscreen or lightbox. In lightbox mode, the activity launching the
player is still visible behind the player, slightly dimmed.
To display YouTube thumbnails, place a YouTubeThumbnailView
in your view
hierarchy and then
use the YouTubeThumbnailLoader
to load a single video
thumbnail or a whole playlist.
The API is distributed together with a set of samples that give some examples of how to use specific parts, see the 'sample' directory in the distributed zip file.
Interfaces
YouTubePlayer | A YouTubePlayer provides methods for loading, playing and controlling YouTube video playback. |
YouTubePlayer.OnFullscreenListener | Interface definition for callbacks that are invoked when the player toggles between fullscreen
on or off, either due to the user clicking the fullscreen button or a call to
setFullscreen(boolean) . |
YouTubePlayer.OnInitializedListener | Interface definition for callbacks that are invoked when player initialization succeeds or fails. |
YouTubePlayer.PlaybackEventListener | Interface definition for callbacks that are invoked when video playback events occur. |
YouTubePlayer.PlayerStateChangeListener | Interface definition for callbacks that are invoked when the high-level player state changes. |
YouTubePlayer.PlaylistEventListener | Interface definition for callbacks that are invoked when events related to playlists occur. |
YouTubePlayer.Provider | A class that implements this interface can provide a YouTubePlayer instance. |
YouTubeThumbnailLoader | A YouTubeThumbnailLoader provides methods for loading YouTube thumbnails into a
YouTubeThumbnailView . |
YouTubeThumbnailLoader.OnThumbnailLoadedListener | Interface definition for a listener that is invoked when a thumbnail has been loaded. |
YouTubeThumbnailView.OnInitializedListener | An interface with definitions of callbacks invoked when thumbnail view initialization succeeds or fails. |
Classes
YouTubeApiServiceUtil | Utility class for verifying that the YouTube Player API service is available and up-to-date on this device. |
YouTubeBaseActivity | Any activity that wants to directly incorporate YouTubePlayerView views in its UI
must extend this activity. |
YouTubeIntents | A selection of static methods that create intents which navigate to specific activities within the main YouTube application. |
YouTubePlayerFragment | A fragment that contains a YouTubePlayerView . |
YouTubePlayerSupportFragment | The support fragment version of YouTubePlayerFragment . |
YouTubePlayerView | A view for displaying YouTube videos. |
YouTubeStandalonePlayer | This class creates intents that will play YouTube videos in a standalone player activity. |
YouTubeThumbnailView | A view which can be used to display YouTube thumbnails, either for a specific YouTube video or a YouTube playlist. |
Enums
YouTubeInitializationResult | Provides the result of initializing the YouTube API Service. |
YouTubePlayer.ErrorReason | Describes the reason for an error in a YouTubePlayer . |
YouTubePlayer.PlayerStyle | The different styles available for the player. |
YouTubeThumbnailLoader.ErrorReason | Describes the reasons for an error in a YouTubeThumbnailView . |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-06-11 UTC.