Engineering and Developers Blog
What's happening with engineering and developers at YouTube
YouTube Captions Uploader Web App
Thursday, January 27, 2011
Captions can greatly enhance the experience of viewing a YouTube video, and the YouTube API has offered developers ways to
upload
and
retrieve
caption data in authorized requests for a while now. However, the various YouTube API
client libraries
don’t natively support interacting with captions at this time, and writing your own code for uploading or retrieving captions can be challenging.
With that in mind, we're happy to announce the
YouTube Captions Uploader
open source project on Google Code, which provides real-world code for uploading captions to YouTube. The code is written for the Java App Engine environment, and it uses some nifty new App Engine features like the
Channel API
, the
Blobstore Service
, and
Task Queues
. And even if you're not an App Engine developer, we hope that the
code
that interacts with the YouTube API's captions service will provide a good starting point for writing your own code.
In addition to open sourcing the code for this project, we’re also running the code itself on a public App Engine instance,
http://yt-captions-uploader.appspot.com/
. So, even if you're not a developer, you can still use the application to upload captions for videos in your YouTube account.
Please share your comments or feedback via the project’s
issue tracker
. We hope that you find it useful both as a standalone web application and as a starting point for writing your own code!
Cheers,
—Jeff Posnick, YouTube API Team
Introducing JavaScript Player API for iframe embeds
Thursday, January 20, 2011
Update (July 2012):
The
onYouTubePlayerAPIReady
callback has been superseded by
onYouTubeIframeAPIReady
and the URL for loading the IFrame Player API code has changed to
http(s)://www.youtube.com/iframe_api.
The API is now fully supported.
If you have been enjoying our
<iframe>
embed
announced
back in July we have some good news for you. Starting today, the
<iframe>
embed code is the default way to
share videos
on YouTube.com. We are also introducing
an initial beta version of
the
<iframe>
embed JavaScript Player API, making it a viable alternative for developers who previously used the API exposed by the ActionScript players. Let’s look at an example of the API usage:
<!DOCTYPE HTML>
<html>
<body>
<div id="player"></div>
<script>
//Load player api asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var done = false;
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'JW5meKfy3fY',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(evt) {
evt.target.playVideo();
}
function onPlayerStateChange(evt) {
if (evt.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function stopVideo() {
player.stopVideo();
}
</script>
</body>
</html>
This example will play a video for several seconds and then stop playback. An instance of
YT.Player
is used to control the player, defined by script loaded from
http(s)://www.youtube.com/iframe_api
. For more information about the API usage, as always, please consult our Player API
documentation
and let us know what you think on our
Developer Forum
.
Cheers,
-Jarek Wilkiewicz, on behalf of the YouTube Player Team
A Chrome Extension for YouTube Activity Feeds
Wednesday, December 22, 2010
Slave Jovanovski, an engineer at YouTube, has put together a
Google Chrome extension
that should be of interest to the YouTube API community. It’s called
YouTube Feed
, and after installing and authenticating with your YouTube account, it automatically will fetch your YouTube social activity stream (both subscriptions and friends’ actions) while you use Google Chrome. When a new event, like a YouTube friend uploading or commenting on a video, takes place, the extension will notify you and provide details on the activity, as well as links to view the actual video. You have control over which types of activities you’d like to be notified about, as well as how frequently you’d like the extension to check for updates.
While you’ll hopefully find the extension useful on its own merits, the fact that the source code has been released as part of an
open source project
means that the extension’s code can serve as inspiration (or a jumping off point) for writing your own JavaScript code that interacts with the YouTube API. Curious as to how to use OAuth to authenticate YouTube accounts from a Chrome Extension? Or request JSON data with a JavaScript callback? The answers await you in the
source code
!
Cheers,
–Jeff Posnick, YouTube API Team
Accelerating YouTube Playback
Wednesday, December 1, 2010
The YouTube Players team’s goal is to make sure that watching videos online is as enjoyable an experience as possible. As a viewer, maximizing enjoyment usually involves some tradeoffs: sure, you can watch a 1080p high definition version of the newest movie trailer, but that might mean choppy playback as your computer strains to keep up with the more demanding processing required. We wanted to let you know about some changes we’re making to help minimize those tradeoffs, so that you can watch smoother, higher-quality video from your existing devices.
Adobe’s
recently announced
Flash Player 10.2 release supports a new, more efficient video display mechanism known as the Stage Video API. The full details of how and why Stage Video speeds up video display can be found in Adobe’s
technical documentation
. The Players Team will be gradually experimenting with Stage Video playbacks on YouTube.com in the coming weeks, but as a developer using the ActionScript 3 Player APIs, you can enable Stage Video playback for your embedded video right away; simply add the
wmode=direct
parameter to the player URL that you’re using to reference the YouTube video. You’ll need the
Flash Player 10.2 installed
to take advantage of the accelerated playback, but playbacks will work for users with older Flash Player versions as well.
The Players Team knows that Stage Video for Flash playbacks is just one path to take toward improving video playback performance across the web. For example, YouTube playbacks using the
new <iframe> embeds
will automatically benefit as
more
and
more
(and
more
) modern browsers add hardware acceleration for the native HTML5 <video> element.
Cheers,
-Jeff Posnick, on behalf of the YouTube Players team
(Updated 2011-02-09 to reflect the production release of Flash Player 10.2.)
More Channels to Feed On
Wednesday, November 10, 2010
The YouTube API’s standard feeds are a great way to expose your users to the best of what YouTube has to offer. To compliment the existing
standard video feeds
, which contain lists of individual videos that meet certain criteria (the top rated videos in the United States for the current day,
for instance
), we’re happy to introduce a new set of
standard channel feeds
.
While standard video feeds contain lists of videos,
standard channel feeds
contain lists of channels, or user accounts. The two types of standard channel feeds are
most_viewed
and
most_subscribed
, and just like with video feeds you can narrow down your results even further with time, region, and
category
or
user type
parameters. For example, the URL for requesting the most viewed channels with videos related to music in Great Britain for the past week is
http://gdata.youtube.com/feeds/api/channelstandardfeeds/GB/most_viewed/-/Music?v=2&time=this_week
. Each entry in a standard channel feed provides detailed information about a specific YouTube channel, including a
element with info on how many comments, videos, and views that channel has received.
Once you have these lists of channels, a natural next step would be to allow your logged-in users to
subscribe
to a given channel or view a list of videos
uploaded
in that channel.
Standard channel feeds are only available in version 2 of the YouTube API, which will
soon be the default version
in the production environment. In the meantime, be sure to
explicitly specify
that you want to use version 2 when making your YouTube API requests.
Cheers,
Jeff Posnick, YouTube API Team
Update to the ClientLogin URL
Thursday, November 4, 2010
We want to let the developer community know about a change to the officially supported URL for YouTube API
ClientLogin
requests. Previously, developers who wanted to obtain authentication credentials via a username and password had to send their ClientLogin request to
https://www.google.com/youtube/accounts/ClientLogin
. The new URL that we encourage all developers to use is
https://www.google.com/accounts/ClientLogin
. This new URL has been functional for a while, and is the same URL that other Google APIs use for ClientLogin requests. Switching YouTube API ClientLogin traffic to the standard URL ensures that developers across all of Google’s APIs will see standard behavior when logging users in.
All of the details regarding this switch as well as best practices for performing ClientLogin requests can be found in our YouTube API
documentation
. There is one specific change in behavior that is worth calling out: responses from the new ClientLogin URL will not include the YouTube username of the authenticated user, which the old URL’s responses did provide. We encourage developers to take advantage of the username
default
when constructing YouTube API request URLs, which always refers to the currently logged in user.
We have no immediate plans to disable the old ClientLogin URL, but we do encourage developers to update their code at their earliest convenience to point to the new URL. We will post again with further details if and when the legacy URL is turned off.
Cheers,
-Jeff Posnick, YouTube API Team
The ActionScript 2 Chromeless Player and Monetized Videos
Monday, October 25, 2010
The
ActionScript 3 Player APIs
, both in the chromeless and embedded variety, have been available for use since
last October
. When we released the ActionScript 3 APIs, we announced the deprecation of the ActionScript 2 equivalents. As per our deprecation policy, we will keep the ActionScript 2 Player APIs running through October of 2012; however, we wanted to announce a change in the videos available for playback that will affect those still using the ActionScript 2
chromeless
player.
As of early January, 2011, some videos that YouTube and our content partners would like to monetize will not be playable using the ActionScript 2 chromeless player because it does not have the ability to show ads. If you attempt to play back such a video, an
onError
event will be fired, as
documented
in the ActionScript 2 Player APIs reference guide. As a developer, you can handle this event and play an alternate video, or display an explanatory message to your users.
Please note that this change only affects playback in the ActionScript 2 chromeless player. If you are using the ActionScript 2 embedded player (i.e. the official YouTube player with built-in controls) or if you’ve already upgraded to one of the ActionScript 3 players, you can continue to play the same video content you can play today. Also note that you might be using the the ActionScript 2 chromeless player indirectly if you’re using a third-party custom video player to play back YouTube content. Please reach out to the provider of your custom video player if you’re not sure whether this change will affect you.
Cheers,
-Jeff Posnick, YouTube API Team
Labels
.net
acceleration
access control
accessibility
actionscript
activities
activity
android
announcements
apis
app engine
appengine
apps script
as2
as3
atom
authentication
authorization
authsub
best practices
blackops
bootcamp
captions
categories
channels
charts
chrome
chromeless
client library
clientlibraries
clientlogin
code
color
comments
compositing
create
curation
custom player
decommission
default
deprecation
devs
direct
discovery
docs
Documentation RSS
dotnet
education
embed
embedding
events
extension
feeds
flash
format
friendactivity
friends
fun
gears
google developers live
google group
googlegamedev
googleio
html5
https
iframe
insight
io12
io2011
ios
iphone
irc
issue tracker
java
javascript
json
json-c
jsonc
knight
legacy
Live Streaming API
LiveBroadcasts API
logo
mashups
media:keywords keywords tags metadata
metadata
mobile
mozilla
news
oauth
oauth2
office hours
open source
partial
partial response
partial update
partners
patch
php
player
playlists
policy
previews
pubsubhubbub
push
python
quota
rails
releases
rendering
reports
responses
resumable
ruby
samples
sandbox
shortform
ssl https certificate staging stage
stack overflow
stage video
staging
standard feeds
storify
storyful
subscription
sup
survey
tdd
theme
tos
tutorials
updates
uploads
v2
v3
video
voting
watch history
watchlater
webvtt
youtube
youtube api
youtube developers live
youtube direct
ytd
Archive
2015
December
Chat it up, streamers! New Live Chat, Fan Funding ...
November
October
May
April
March
January
2014
October
September
August
May
March
2013
December
October
September
August
July
June
May
April
March
February
2012
December
November
September
August
July
June
May
April
March
February
January
2011
December
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
July
June
May
April
March
February
January
2009
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
2007
December
November
August
June
May
Feed
YouTube
on
Follow @youtubedev