Friday, December 21, 2012

No WebView required, with native YouTube Player API for Android

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:
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.
  • 9x9.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 Skimble Workout Trainer
FlipboardBuzzFeedFitness 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