Engineering and Developers Blog
What's happening with engineering and developers at YouTube
Build Compelling Experiences Using YouTube Embeds With The IFrame Player API
Friday, July 27, 2012
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
Know What’s Loaded?
Tuesday, July 24, 2012
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
Let’s Hear It From Your Users!
Thursday, July 19, 2012
Over the past few years we’ve heard two specific pieces of feedback from the YouTube API community:
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
.
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
YouTube @ the Google Developers Academy
Thursday, July 12, 2012
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
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
Dec
Nov
Oct
May
Apr
Mar
Jan
2014
Oct
Sep
Aug
May
Mar
2013
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2012
Dec
Nov
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2010
Dec
Nov
Oct
Sep
Jul
Jun
May
Apr
Mar
Feb
Jan
2009
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2008
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2007
Dec
Nov
Aug
Jun
May
Feed
YouTube
on
Follow @youtubedev