Tip:
Highlight text to annotate it
X
JAREK WILKIEWICZ: Hello, and welcome to
YouTube Developers Live.
We have an exciting show for you today.
We'll talk about developer experience and getting started
with the YouTube API.
But first, let me introduce my esteemed guests today.
In the studio, I have Fred Sauer.
How you doing, Fred?
FRED SAUER: Hi, how are you, Jarek?
Thanks for having me today.
JAREK WILKIEWICZ: Doing good.
Today's my birthday, so this is a very special show for me.
FRED SAUER: Excellent.
JAREK WILKIEWICZ: And then Daryl Chang,
how you doing, Daryl?
DARYL CHANG: Hi, good, how are you?
JAREK WILKIEWICZ: I'm doing good.
Daryl, as you might remember, has guest starred in one of
our shows a few weeks ago, live from New York.
He's our intern, going back to Stanford very soon.
But before we let you go, Daryl, we need to talk about
your awesome project.
So my name is Jarek Wilkiewicz.
I work for YouTube Developer Relations.
Let's talk about the motivation of this project,
maybe starting with you Fred, I know you've been busy
working on Cloud Playground.
Tell us what it is and what problem are
you trying to solve?
FRED SAUER: So I've been a developer advocate on the
Cloud Platform for many years now.
And consistently, the feedback I get from developers who have
been on the platform building applications, that they're
very happy with the features and the capability and just
how easy it is to manage their applications at scale.
But it turns out when developers first get started,
there's an initial hurdle of just getting Hello World up
and running.
When all the tools are unfamiliar, when you're
working on a new platform, that's when
it's really the hardest.
And if you liken it to a relationship, it seemed like
we were asking developers to invest heavily first, download
an SDK, download a runtime, get your laptop set up, and
then you can try it out and fall in love.
And I thought, maybe let's turn it around.
Let's go on a date first.
Let's try it out, get a chance to fall in love, and then do
the rest of the stuff.
So the Cloud Playground is a way to start building
applications, small Hello World, guestbook-type
applications right from your web browser--
zero downloads, zero installs, just get going.
JAREK WILKIEWICZ: And fall in love at the first sight.
[LAUGHTER]
FRED SAUER: Absolutely.
JAREK WILKIEWICZ: This is great.
Well, Daryl, I know you've been working with that.
And I was thinking perhaps instead of talking about the
project, maybe you could give us a quick
demo of what it does.
DARYL CHANG: Yeah, sure.
So this summer, I've been working on the Cloud
Playground embed for the developer's site.
So why don't we go to the developer's site right now?
So in the developer's site, we have static code examples that
demonstrate how to use different APIs.
And with the Cloud Playground embed, now we can interact
with these different code samples and run and modify the
code within your browser.
For example, right now, we're on the YouTube Data API for
Python for App Engine.
And you can see that this code sample for Search by Keyword
has a button in the top right corner.
If you click this Run/Modify button, you'll be able to
interact with this sample code.
It loads the Cloud Playground embed.
And you can see that there's a code editor
and an output container.
Now, in order to need to correct output, you need to
set up a project and get your API access key.
So click this link here and follow the instructions.
Why don't we roll the video to see how to do that?
[VIDEO PLAYBACK]
-In this segment, we'll be talking about how to obtain a
developer key to make YouTube API calls and
run the sample code.
To do this, we'll need a registered Google account.
The first thing we want to is browse at
a Google API console.
We can find this at code.google.com/apis/console.
Or we can just search for Google API console in our
favorite search engine.
We'll need to create a project the first
time we open the site.
Projects are groupings of APIs, and it may make sense
for us to create different projects for every new
application that we write.
For running the sample code, we only need one project and
one set of API keys.
After we enable our project, we'll need
to enable some services.
Let's click through to the Services menu if we're not
already on this page and scroll down.
We'll want to enable the YouTube Data API and the
YouTube Analytics API first.
Let's toggle the YouTube Data API from Off to On.
The very first time we do this, we'll be presented with
the Terms of Service.
We'll want to read the Terms of Service and Accept if we
want to be able to use the API.
Now, when we scroll down, we'll see that the YouTube
Data API has been accepted and enabled.
We'll click On to also enable the YouTube Analytics API.
The Search by Topic code sample requires the use of
Freebase API, so we'll need to enable that, as well.
There's a separate Terms of Service that we'll need to
read and accept.
Once this is done, we'll need to access our API keys.
We can do this by clicking API Access in the navigation menu.
There are two types of API access--
simple and authorized.
If all we want to do is search for videos, channels, and
playlists, all we need is simple API access.
The key is already provided to us in our project.
[END VIDEO PLAYBACK]
DARYL CHANG: All right, so going back now to the Cloud
Playground embed, all we need to do is to Copy and Paste the
API access key to where it says Replace Me.
Now that we've done that, we can make the API call.
And all we have to do is click the Run
button to see the output.
JAREK WILKIEWICZ: So what's happening right now is the
code that you modified, luckily within the editor,
gets sent over to the app engine, executed, and then you
see the results, right?
And this is happening against the API key that you have
configured in the previous step.
DARYL CHANG: Right, exactly.
So you can see the output here, which is in iframe of
the deployed App Engine site.
And we can see that we get results for the query term
"dog" using the Search by Keyword API.
Now, let's say that you want to make a
modification to the code.
All we have to do is make the
modification in the code editor.
So Jarek, let's say you want to change the query term "dog"
to "cat" instead.
All we have to--
JAREK WILKIEWICZ: Sounds fun to me.
DARYL CHANG: --do is make the modification and press the
Play button.
And again, this is redeploying the site.
And now we should see the results for the keyword "cat"
instead of "dog." And as you can see here, videos for cat.
Let's say that you don't like the modifications you made,
and you want to go back to the original sample code that we
had on the site.
All we have to do is click the Reset Project button.
And it'll reset the project to the original sample code.
JAREK WILKIEWICZ: So if I made a mistake, because I don't
know Python well, I could easily
recover by hitting Reset.
DARYL CHANG: Exactly.
So any mistakes you've made, anything you don't like, just
hit the Reset Project button, and you'll be fine.
JAREK WILKIEWICZ: Great.
DARYL CHANG: And let's say you do like the modifications you
made, and you want to continue developing locally.
All we have to do is click the Zip button to download the
project as a zip file.
So as you we see here, I've gotten the project as a file,
and I can continue developing locally.
But you have to remember that you have to download the App
Engine SDK and any other necessary files in
order to run it.
So that's a quick demo of what the Cloud Playground can do on
the dev site.
And I hope that helps developers get started with
API calls more easily.
JAREK WILKIEWICZ: Absolutely.
Well, thank you very much running the demo.
I would like to talk a little bit more about
what's under the hood.
And Fred, I know you've been working a lot on this project.
Tell us a little more of what happens.
How does this all work?
FRED SAUER: Well, the Cloud Playground, as Daryl was
showing us, consists of two parts.
The top half of the Cloud Playground is a sort of a mini
development environment.
You can edit text files.
There's actually a way to manipulate projects.
And there's nothing really special about this
application.
It's just a way of maintaining files in the cloud.
They actually are maintained in the App Engine Data Store,
and every project has a unique set of files, which are the
source code, the sample code, that you're looking at.
What's really interesting is the bottom half of the user
interface, which is an iframe that's embedded into the main
user interface.
And when you press the blue Play button, what we do is we
go out to App Engine, and based on the URL, there's a
project ID in the URL.
And we use that to grab all the files that you've been
modifying and keeping up to date.
And we eval them at run time.
And the server figures out the results.
In this case, the sample code is calling a YouTube API.
So we call the actual production YouTube APIs, and
we get the results sent back, and we send
them back to the client.
And so what we have is sort of an App Engine app running on
top of an App Engine app.
JAREK WILKIEWICZ: Mm-hm.
FRED SAUER: It's a little bit, maybe, recursive and sometimes
messes with your mind a little bit.
JAREK WILKIEWICZ: [INAUDIBLE].
FRED SAUER: But luckily, when you use the Cloud Playground,
you don't have to think about this.
You can think about it as you're just writing some code
on App Engine that runs.
And then when you're ready to go to the full experience,
when you think, this date went pretty well, and now I want to
take this relationship with App Engine a step further, you
can download the SDK and the Python runtime, if you don't
have one installed.
You can run this locally, and then you can deploy it to
production, and you have a real production app.
And then whenever you like, you can come back to the
playground and maybe try something else out.
JAREK WILKIEWICZ: Great, well, this is really exciting.
So Daryl, I know you need to go back to school, but I was
going to ask you, what are the types of things you think will
be worthwhile to add?
What are the potential enhancements that we could
make to this project?
DARYL CHANG: Yeah, so one of the things we were going to
work on is to add a wizard to the dev site page.
JAREK WILKIEWICZ: Mm-hm.
DARYL CHANG: So, for example, in the example I just showed,
you had to go to the API console and set up your
project there.
But we want developers to be able to set up their projects
within the page, itself.
So what I want to do is set up some sort of wizard in the
site to reduce the amount of navigation
developers have to do.
JAREK WILKIEWICZ: Cool.
Anything, Fred, on your side that you're willing to share
with our audience?
I know we typically don't talk about roadmap.
But what are the types of things that keep you awake at
night as far as new enhancements that you could
add and you are not right now?
FRED SAUER: That's a good question.
So there's a lot of things I'd love to do.
A lot of people ask for various features.
The good news is the Cloud Playground is
an open source project.
JAREK WILKIEWICZ: Mm-hm.
FRED SAUER: So if you log into the Cloud Playground at
cloud-playground.appspot.com, and you scroll down to the
bottom right, there's a little link to the Git repo.
You can clone a copy and add features yourself or
contribute them back, obviously.
That's what open source is about.
I think maybe the biggest feature on the roadmap for me
would be somehow add support for other languages.
We started out with Python 2.7, just because it was easy.
You can do eval on the server.
Maybe you want to do Java or Go or PHP.
Java and Go, they require a compile step.
So you have to take your source, compile it, and then
execute it.
So that adds a little bit of complexity.
JAREK WILKIEWICZ: A little bit of complexity.
FRED SAUER: Just a little bit.
So maybe we could take Compute Engine instances and combine
them with the App Engine front end user interface and provide
support for N languages, and then just keep
the cranking N up.
But ultimately, I want to see a very smooth transition from,
hey, we just met.
Let's go on a date.
Let's have a little bit longer relationship.
And hopefully, this is a long-lasting relationship with
the platform.
But on each step, hopefully it's a very smooth,
incremental, and you can wade into the waters as gradually
or as quickly as you would like.
And when you're ready, you can always take the next.
That's where we're headed.
JAREK WILKIEWICZ: Great, that all sounds very exciting.
Well, thank you very much for joining our show today.
I think this is a really great addition to our developer
documentation.
It's going to make the five-minute user experience on
our site much better.
I would like to invite you all that are watching to send us
your feedback.
If there is features or any other feedback you have about
this functionality, please reach out to us.
We're on Google+ and Twitter.
And then, last but not least, if you would like to help us
take this to the next level, we are hiring.
Check out developers.google.com/jobs for
information about the positions that we have open.
Well, until then, see you next time live on YouTube
Developers Live.
Thank you very much, Bye.
FRED SAUER: And happy birthday, Jarek.
JAREK WILKIEWICZ: Thank you.
[LAUGHTER]
[SWISHING]