Thursday, July 22, 2010

A New Way To Embed YouTube Videos

An enhancement to our video embed capability is now available through a new embed code style. This new style uses <iframe> and looks like this:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>


Example:




If you use the new embed code style, your viewers will be able to view your embedded video in one of our Flash or HTML5 players, depending on their viewing environment and preferences. Environments that support the HTML5 video player are listed here on our HTML5 settings page. In instances where HTML5 isn't supported (e.g. our HTML5 player can't play videos with ads), we use Flash.


An additional benefit of the new embed style is that it will eventually allow embeds to work on mobile devices, which typically use a built-in player instead of Flash or HTML5.


Before we make this new embed code the standard for our general users, we wanted to give our developer community a preview. While there may be some limitations, please try it out and
let us know how it went.


Toliver Jue, Software Engineer
recently learned some dance moves from “
黄帝心仙人".

Tuesday, June 29, 2010

Flash and the HTML5 <video> tag

There's been a lot of discussion lately about whether or not the HTML5 <video> tag is going to replace Flash Player for video distribution on the web. We’ve been excited about the HTML5 effort and <video> tag for quite a while now, and most YouTube videos can now be played via our HTML5 player. This work has shown us that, while the <video> tag is a big step forward for open standards, the Adobe Flash Platform will continue to play a critical role in video distribution.

It's important to understand what a site like YouTube needs from the browser in order to provide a good experience for viewers as well as content creators. We need to do more than just point the browser at a video file like the image tag does - there’s a lot more to it than just retrieving and displaying a video. The <video> tag certainly addresses the basic requirements and is making good progress on meeting others, but the <video> tag does not currently meet all the needs of a site like YouTube:

Standard Video Format
First and foremost, we need all browsers to support a standard video format. Users upload 24 hours of video every minute to YouTube, so it's important to minimize the number of video formats we support. Especially when you consider that for each format, we also provide a variety of sizes (360p, 480p, 720p, 1080p). We have been encoding YouTube videos with the H.264 codec since early 2007, which we use for both Flash Player and mobile devices like the iPhone and Android phones. This let us quickly and easily launch HTML5 playback for most videos on browsers that support H.264, such as Chrome and Safari.

Concerns about patents and licensing have prevented some browsers from supporting H.264; this in turn has prevented the HTML5 spec from requiring support for a standard format. We believe the web needs an open video format option. One that not only helps address the licensing concerns, but is also optimized for the unique attributes of serving video on the web. To that end, we’re excited about the new WebM project. Google is open sourcing and contributing the VP8 codec to the WebM effort. Google, Mozilla, and Opera have all committed to support WebM, and we have already started making YouTube videos available in the WebM format. Adobe has also committed to support VP8, the video codec for WebM, in an upcoming Flash Player release.

Robust video streaming
Closely related to the need for a standard format is the need for an effective and reliable means of delivering the video to the browser. Simply pointing the browser at a URL is not good enough, as that doesn't allow users to easily get to the part of the video they want. As we’ve been expanding into serving full-length movies and live events, it also becomes important to have fine control over buffering and dynamic quality control. Flash Player addresses these needs by letting applications manage the downloading and playback of video via Actionscript in conjunction with either HTTP or the RTMP video streaming protocol. The HTML5 standard itself does not address video streaming protocols, but a number of vendors and organizations are working to improve the experience of delivering video over HTTP. We are beginning to contribute to these efforts and hope to see a single standard emerge.

Content Protection
YouTube doesn't own the videos that you watch - they're owned by their respective creators, who control how those videos are distributed through YouTube. For YouTube Rentals, video owners require us to use secure streaming technology, such as the Flash Platform's RTMPE protocol, to ensure their videos are not redistributed. Without content protection, we would not be able to offer videos like this.

Encapsulation + Embedding
Flash Player's ability to combine application code and resources into a secure, efficient package has been instrumental in allowing YouTube videos to be embedded in other web sites. Web site owners need to ensure that embedded content is not able to access private user information on the containing page, and we need to ensure that our video player logic travels with the video (for features like captions, annotations, and advertising). While HTML5 adds sandboxing and message-passing functionality, Flash is the only mechanism most web sites allow for embedded content from other sites.

Fullscreen Video
HD video begs to be watched in full screen, but that has not historically been possible with pure HTML. While most browsers have a fullscreen mode, they do not allow javascript to initiate it, nor do they allow a small part of the page (such as a video player) to fill the screen. Flash Player provides robust, secure controls for enabling hardware-accelerated fullscreen displays. While WebKit has recently taken some steps forward on fullscreen support, it's not yet sufficient for video usage (particularly the ability to continue displaying content on top of the video).

Camera and Microphone access
Video is not just a one-way medium. Every day, thousands of users record videos directly to YouTube from within their browser using webcams, which would not be possible without Flash technology. Camera access is also needed for features like video chat and live broadcasting - extremely important on mobile phones which practically all have a built-in camera. Flash Player has provided rich camera and microphone access for several years now, while HTML5 is just getting started.


We’re very happy to see such active and enthusiastic discussion about evolving web standards - YouTube is dependent on browser enhancement in order for us to improve the video experience for our users. While HTML5’s video support enables us to bring most of the content and features of YouTube to computers and other devices that don’t support Flash Player, it does not yet meet all of our needs. Today, Adobe Flash provides the best platform for YouTube’s video distribution requirements, which is why our primary video player is built with it.

John Harding, Software Engineer,

Tuesday, June 8, 2010

YouTube API @ Google I/O 2010

Kuan Yong, Gareth McSorley and I -- representing Product Management, Engineering, and Developer Relations, respectively -- were happy to present a YouTube API session at this year’s Google I/O developer conference. We got the chance to meet many members of the developer community there, but unfortunately not everyone is able to make it out to San Francisco in person. For the benefit of those who could not attend, a recording of our session is now available on YouTube, and embedded below.

The session was titled “YouTube API Uploads: Tips, Tricks, and Best Practices” and we covered all topics related to uploads from A (Android app uploads) to Z (zero-metadata uploads). We hit a few letters in between, too: B (browser-based uploads) I (iPhone app uploads), Q (upload quota questions), R (resumable uploads) and Y (YouTube Direct). There’s something for everyone in this session, so if your application uploads video to YouTube, be sure to check it out!



Cheers,
-Jeff Posnick, YouTube API Team
YouTube is hiring! ~ http://google.com/jobs/workyoutube

Monday, May 17, 2010

Java YouTube Developers: Update Your Libraries

If you access the YouTube API via Java using the official Google Data Client Library, we want to let you know about upcoming changes to the YouTube API that may affect your existing code. Developers who are using a client library in a language other than Java, or who use Java but access the YouTube API without using the Google Data Client Library will not be affected by this change.

Versions of the Java Google Data Client Library earlier than 1.41.2 (the most recent release as of this writing) are particularly picky about the data they receive back from the YouTube API and deserialize into Java objects. If our YouTube API servers are updated to start including an additional attribute for an existing element in their Atom XML responses, older versions of the Java client library will throw a deserialization exception complaining about this extra data. While this might be considered beneficial in some contexts, it unfortunately precludes our ability to extend the YouTube API’s functionality by returning back new data in its responses. We recently ran into this issue while trying to launch a new totalUploadViews attribute, for instance.

We removed the totalUploadViews attribute soon after adding it, but progress can’t be delayed forever. If you’re using the Java Google Data Client Library, we strongly recommend that you update your installation to the 1.41.2 (or newer) release. We plan on re-adding the totalUploadViews attribute in mid-July, and other new attributes may follow. If you haven’t updated to a compatible version of the Java client library by mid-July, your existing Java code will start throwing exceptions when you retrieve an Atom XML response containing the new attribute, such as a request for a user’s YouTube profile.

A special note to developers using YouTube Direct: because YouTube Direct is built on top of the Java client library, it also needs to be updated to use a compatible release. The latest archived downloads of the source code for both the 1.0 and 2.0 releases, as well as the SVN source, have been updated for compatibility. Please take the time to update your YouTube Direct deployment in App Engine before mid-July.

Cheers,
—Jeff Posnick, YouTube API Team
YouTube is hiring! ~ http://google.com/jobs/workyoutube

Monday, April 26, 2010

New features in YouTube Direct v2.0

We're happy to announce the release of YouTube Direct v2.0. This release includes substantial upgrades that will make it easier for developers to test and customize the platform. In addition to the backend changes, we've also fixed a number of reported bugs and added these brand new features:

  • Support for secure AuthSub.
  • Support for viewing and editing YouTube captions for any video submitted. All caption languages are supported.
  • Support for multiple YouTube Direct uploader embeds (for different assignments) on a single page.
  • Pre- and post-submission text is now configurable on a per-assignment basis.
  • Users can now select from a pre-populated list of the most recent 50 videos in their account when uploading an existing video.

If you're currently using v1.0, we encourage you to download the latest release and upgrade your deployment. Please read detailed release notes and documentation on the new features as well.

We've seen YouTube Direct used in many interesting applications so far and we hope that this new release will enable more creative and engaging campaign around videos through your sites. If you have feedback on YouTube Direct, please visit our YouTube APIs Developer Forum and drop us a line. To receive announcements in the future, please subscribe to the YouTube API Annoucement list.

Amanda Surya, YouTube API Team

Monday, March 22, 2010

Partial Responses and Updates with the YouTube API

We wanted to share some big news that was just announced on the Google Code blog: the YouTube API now supports partial responses and partial update requests. Both these features allow you to drastically cut down on the amount of data you send and receive via the API, which means simpler, faster API operations and happier users.

The announcement post on the Google Code blog goes into much more detail, so take a look at that first. When you’re ready to start writing code, check out the partial response and partial update sections of the YouTube API Developer’s Guide.

Cheers,
-Jeff Posnick, YouTube API Team
YouTube is hiring! ~ http://google.com/jobs/workyoutube

Tuesday, March 9, 2010

YouTube Direct for Mobile, and Other Updates

Since launching YouTube Direct last November, our team has been hard at work adding new functionalities, fixing bugs, and answering developer's questions. We wanted to take a momentary break from all that to share some updates.

Separate from but related to the main YouTube Direct project are two other Google Code projects: video capture and YouTube Direct upload applications for the Android and iPhone operating systems. These two projects are basic implementations that we hope will inspire organizations to add video capture and YouTube Direct upload functionality to their Android or iPhone applications.

We've been gradually, and quietly, checking in various bug fixes and enhancements to the current release's Subversion repository on Google Code. One recent change is especially important, as it adds support for the new video page URLs that will start becoming more common. Periodically, we package the current release into a new "tagged" release, and generate release notes summarizing what's new. If you haven't updated your YouTube Direct codebase recently, we strongly suggest that you read the release notes and perform a sync with our code repository. Starting with the next YouTube Direct release, we will send email announcements to the low-traffic, announce-only Google Group. We recommend that all developers using YouTube Direct sign up to the group — actually, all YouTube API users should sign up to receive periodic important notifications.

Many organizations, in addition to our launch partners, have deployed YouTube Direct on their websites since our launch, and we wanted to highlight a few here.

Gannett rolled out a company-wide initiative in honor of Black History month, in which they ask people to interview civil rights heroes via video. Al-Jazeera invited the community to share their thoughts and experiences around Hajj, the annual Muslim pilgrammage to Mecca. And if you have news videos around any of the big stories of the day, ITN News wants them. Even Tufts University is using YouTube Direct to solicit personal videos from the community called "You, in One Minute".

As always, the best resource for developers looking to embed YouTube Direct functionality on their website is our Getting Started Guide. If you have any technical questions about YouTube Direct, our YouTube API Developer's Google Group is the place to turn.

Cheers,
-Jeff Posnick on behalf of the YouTube Direct Team