Friday, July 27, 2012

Build Compelling Experiences Using YouTube Embeds With The IFrame Player API

If you've hesitated to use the <iframe> player in your app due to the IFrame Player API's experimental status, then wait no more. We've removed that API's 'experimental' tag, which means the API is production-ready and is covered by YouTube's deprecation policy. Since the <iframe> embed is the default way of sharing YouTube videos on the Web, the IFrame Player API is now the recommended mechanism to control video playback behavior in your Web applications.

To provide a consistent developer experience with the YouTube Upload Widget, we’ve changed the the URL for loading the IFrame Player API code to https://www.youtube.com/iframe_api. The old URL (http://www.youtube.com/player_api) is now deprecated, though it will continue to work. Similarly, the iframe API initialization callback name has been changed to onYouTubeIframeAPIReady from onYouTubePlayerAPIReady, also for consistency with the YouTube Upload Widget. The old callback name, onYouTubePlayerAPIReady, is now deprecated as well. If your app uses both the YouTube Upload Widget as well as the IFrame Player API, you only need to include the script once and handle a single initialization callback.

Going forward, we'll continue making improvements to the IFrame API and make it work better with mobile platforms. As before, you can find the details about the API in our documentation and ask questions about it on our developer forum.

Cheers,
--Jarek Wilkiewicz, YouTube API Team

Tuesday, July 24, 2012

Know What’s Loaded?

If you’ve ever developed a custom playback experience based on our Player API, you’ve probably used the getVideoBytesLoaded() and getVideoBytesTotal() methods to determine how much the current video is locally buffered and the size of the entire video. After obtaining this information, the next logical step is to divide the number of bytes loaded by the total number of bytes to obtain the fraction of the video that’s been buffered, which you can then display in your custom user interface.

Instead of taking this two-step approach to calculate how much of a video has buffered, we encourage you to use the new getVideoLoadedFraction() method. It will return a numerical value between 0.0 and 1.0 that represents the same fraction obtained by dividing getVideoBytesLoaded() by getVideoBytesTotal(). While those two legacy methods still work today, they are now officially deprecated, as per the terms of our deprecation policy.

getVideoLoadedFraction() allows us to expose more accurate information to your code about the state of the video that’s currently playing across a wider range of playback scenarios. When HTML5 <video> playback was used in the <iframe> Player, for instance, we previously had to return “fake” values for getVideoBytesLoaded() and getVideoBytesTotal(), as the true byte counts weren’t directly exposed via the <video> element. The value returned by getVideoLoadedFraction() should be correct for that and other playback scenarios that we roll out in the future.

If you have any questions about the new method or anything else related to the YouTube APIs, please let us know in the developer forum.

Cheers,
Jeffrey Posnick, YouTube API Team

Thursday, July 19, 2012

Let’s Hear It From Your Users!

Over the past few years we’ve heard two specific pieces of feedback from the YouTube API community:

  1. Developers have clamored for years for a way of embedding a webcam YouTube upload widget on their web pages, similar to the webcam upload tool available at youtube.com/my_webcam.
  2. Developers who have used YouTube Direct in the past have asked for a simpler solution that doesn’t require the same level of technical expertise to set up and manage.

Knowing about this demand made us particularly excited for our Google I/O announcements of the YouTube Upload Widget that supports webcam uploads, and YouTube Direct Lite, both of which are now available for public use.

YouTube Upload Widget
Using the YouTube Upload Widget on your site is as simple as adding an <iframe> to your HTML, like so:

<iframe id="widget" type="text/html" width="640" height="390" src="https://www.youtube.com/upload_embed" frameborder="0">

Developers who want more control over the uploads experience can use a full JavaScript API to initiate the widget, and listen for events related to the upload.

YouTube Direct Lite
YouTube Direct Lite is a complete rewrite of the existing YouTube Direct platform. The goal of the project remains the same: make it possible to solicit videos from your users and then moderate those submissions into standard YouTube playlists for display. The difference is that YouTube Direct Lite is implemented purely in client-side HTML, JavaScript, and CSS, and unlike with YouTube Direct, no Java App Engine deployment is needed. You can download the YouTube Direct Lite code, customize it, and deploy it on your own web server along with the rest of your site’s content. To make things even easier, we’re hosting a canonical deployment of YouTube Direct Lite that you could include on your pages without having to deploy anything at all—just add the appropriate <iframe> tag to your page.

You can find a live example of YouTube Direct Lite integration, including the use of the YouTube Upload Widget, on this sample page. Feel free to use that page to submit a video letting us know how you plan on using the new tools.

Bringing the YouTube Upload Widget and YouTube Direct Lite to web developers and community maintainers will give you new tools to hear from (and see!) your community, and who knows what great things will come from that!



Cheers,
—Eric Lundberg, Jeff Posnick and Vladimir Vuskovic, YouTube API Team

Thursday, July 12, 2012

YouTube @ the Google Developers Academy

Whether you’re a fledgling developer looking to get started with an API or a skilled developer who wants to learn some new tricks, you’ll find engaging material at the Google Developers Academy. Of particular interest to readers of this blog is the YouTube section, which hosts courses specific to the YouTube APIs.

The first course walks JavaScript developers through the steps needed to embed an <iframe> Player on their page along with a list of chapter titles. It’s perfect when you want to embed a lengthy video that consists of multiple sub-sections, since jumping from section to section is as easy as clicking on predefined links. Check out the live demo of a page with videos from last year’s Google I/O conference to see the player in action.

We will be gradually adding to the YouTube section of the Google Developers Academy, and we’ll announce the new courses on this blog and our YouTube for Developers Google+ page. Stay tuned for more great resources!

Cheers,
Jeff Posnick, YouTube API Team

Friday, June 29, 2012

All Good Things Must Come to an end=

If you enjoy the ability to easily start video playback at a specific time using the start parameter, you may also like being able to stop it early. Here’s an example:

<iframe width="420" height="315" src="http://www.youtube.com/embed/Nc9xq-TVyHI?start=110&end=119" frameborder="0" allowfullscreen></iframe>

The end parameter is a positive integer, and it represents the number of seconds from the beginning of the video. If your friends are not into merengue dancing canines, you can now tease them with short clips of videos like the one below:


Cheers,
--Jarek Wilkiewicz, YouTube API Team

Wednesday, June 27, 2012

Build awesome YouTube experiences with new APIs and tools

When we introduced the first YouTube API in 2005, we knew that it would be developers who would help us grow YouTube as a platform for connecting the world through video. At this year’s Google I/O, we’re continuing on with that mission through an entire track dedicated to YouTube, where we’re announcing new APIs and developer tools, as
well as a showcase of some of the most innovative apps built with YouTube.

Make mobile video shine
With mobile video now making up as much as half of all mobile traffic, your mobile experience needs video that’s high quality, fast and sleek. We want to give you the best tools to build these experiences, so we’re previewing the new YouTube Android Player API for high-quality and fluid video playback.

Engage with your communities through video
The next generation of YouTube Direct allows you to engage with your community by having them submit videos which you can then feature in playlists. YouTube Direct Lite is implemented in client-side JavaScript using CORS, and does not require any server-side deployments—adding it to your site is as simple as adding an







MMMmmm...data!Retrieving analytics data for your videos used to mean downloading an archive of CSV files that you then had to process. Now, you can use our new YouTube Analytics API to build custom tools for your data. It's a RESTful web service that gives you the freedom to request customized reports containing only the data you care about. We’re also giving the YouTube Data API a facelift with new features like universal search and updated client libraries in 8 different languages.

Play, watch and learn from developers like you at Google I/O

We’ll be talking about these new features and other developer tools at Google I/O this week, so check out our sessions and codelabs, download the official Google I/O app, and follow online at developers.google.com/io. At I/O you can also visit with Developer Sandbox companies like Flipboard, Dude Perfect and SONY PlayStation @ Home who are building awesome experiences with YouTube APIs. We’ll also share our sessions on the Google Developers YouTube Channel, and you can always find us on Google+ and our developer forum.

Cheers,
—Amanda Surya, YouTube API Team

Tuesday, June 26, 2012

Google I/O 101: YouTube for Your Business

In preparation for Google I/O, we've created a presentation for people who've never integrated with YouTube before. This video tutorial is an introduction to YouTube and its APIs with an emphasis on how you can use them for your business. It includes examples for technical and nontechnical audiences.



Cheers,
—Shannon -jj Behrens, YouTube API Team