Adding a high-quality video experience to your Android application just got a whole lot easier. Starting today, you can embed and play YouTube videos in your app using the new YouTube Android Player API.
The API, which was pre-announced at Google I/O 2012, offers these benefits:
- High-quality video playback supported on Android 2.2 (Froyo) or newer
- Easy integration with your Android application (no WebView required)
- Fullscreen and orientation change support
- Closed captions display
- Support for YouTube ads
- Programmatic access, similar to existing Player APIs, to most aspects of the YouTube video playback experience
- Integration with the Android YouTube app using a standard set of YouTube Intents
We are launching the API as experimental, though we do not expect major interface changes going forward.
The Only Limit Now is Your Imagination (and ToS)
These instructions explain how to include the YouTubeAndroidPlayerApi.jar client library in your Android application. The library is supported on Android devices running version 4.2.16 or newer of the Android YouTube app.
You can use the YouTubeApiServiceUtil class’ isYouTubeApiServiceAvailable method to confirm that a device is compatible.
For a simple embed, use the YouTubeStandalonePlayer. To build a more sophisticated user interface, try the YouTubePlayerView or the YouTubePlayerFragment. Fragments can help create an engaging experience as shown in the Video Wall app example.
Play With These Apps
Here are a few interesting apps available for you to explore:
- See everything on Flipboard, all your news and life’s great moments in one place. Now you can watch YouTube videos from wherever you are in Flipboard without leaving the application, providing a more integrated and seamless experience.
- BuzzFeed delivers original reporting, scoops, and the hottest social content on the web. Android users can now view their favorite BuzzFeed content featuring YouTube videos in the BuzzFeed app and share with their friends.
- 9×9.tv enables users to discover and watch curated, topical videos that are organized into TV-like channels. Their blog describes their experience developing with the API.
- SoundTracking lets people use their mobile phone or tablet to share their music moments and favorite jams with friends and family. Users can now discover and play YouTube music videos of the songs within their music timeline.
- Fitness Flow by Skimble helps you get in shape with high-quality exercise videos led by professional trainers. Skimble uses YouTube to stream workout content on your Android phone and tablets.
Check out a few screen shots below or download the apps from Google Play today!
|
|
|
Flipboard |
BuzzFeed |
Fitness Flow by Skimble |
Learn More
If you would like to learn more about the YouTube Android Player API, the documentation is a great place to start. In addition, we have curated useful videos in this playlist. Please subscribe to the YouTube for Developers’ channel to keep up on the latest.
Check Out The Sample Code
We’ve prepared several code examples to make it easy for you to get started with the new API. You will find them on code.google.com. The description of the examples is available in our documentation. If you need additional help with the API feel free to use our support resources.
Cheers,
– Ross McIlroy, Anton Hansson, and Horia Ciurdar, YouTube Mobile Team