Your SlideShare is downloading. ×
YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autónoma de México
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autónoma de México


Published on

YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autónoma de México

YouTube APIs presentation at Facultad de Ciencias, Universidad Nacional Autónoma de México

Published in: Technology

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Building Video Apps with YouTube APIs UNAM Mexico City Jarek Wilkiewicz 04/01/2011
  • 2. Agenda• Intro• Life of a video• APIs• Back-end (Google Data API)• Front-end (Player)• App Examples• Q&A
  • 3. Quiz *Number of YouTube views per day ?> your answer hereNumber of mobile YouTube views per day?> your answer hereHow much video is uploaded each minute?> your answer here%-tage of views coming from outside of US?> your answer here *As of Oct 2010
  • 4. Life of a video • Uploading • Sharing • Searching • PlaybackVideo : Evolution of Dance by Judson Laipply
  • 5. Life of a video : Uploading• Via uploader• Standard (POST)• Advanced (Java)• Mobile (• Using the API• Browser-based• Direct• Direct resumable (great for mobile)• Metadata (category, keyword, etc.)
  • 6. Life of a video : Sharing • Autoshare • Embed • Publish to activity feed
  • 7. Life of a video : Searching <?xml version=1.0 encoding=UTF-8?> <feed xmlns= xmlns:openSearch= […] <entry gd:etag=W/&quot;C0AMRn47eCp7ImA9WxRQGUw.&quot;> <id>tag:youtube,2008:video:ZTUVgYoeN_b</id> <published>2008-07-05T19:56:35.000-07:00</published> <updated>2008-07-18T07:21:59.000-07:00</updated> <category scheme= term=> […] </entry> [...] </feed>
  • 8. Life of a video : Playback On On other sites Custom Player Embedded Player Chromeless Player On your mobile On other devices
  • 9. APIs
  • 10. APIs Google Data APIs Player APIs
  • 11. Google Data APIs Protocol REST-based ATOM syndication format (RFC 4287) ATOM publishing protocol (RFC 5023) support for XML-based ATOM (default), JSON, JSON-C, RSS Feeds Standard feeds (Top Rated, Most Viewed, ...) Users playlists, subscriptions, uploads feeds Users comments, profile, contacts feed YouTube applications interact with the feeds using the Google Data APIs
  • 12. Feed example : Top Rated<?xml version=1.0 encoding=UTF-8?><feed xmlns= […] > <updated>2008-07-18T05:00:49.000-07:00</updated> <title>Top Rated</title> <openSearch:totalResults>100</openSearch:totalResults> <entry gd:etag=W/&quot;C0AMRw.&quot;> <media:group> <media:title type=plain>Shopping for Coats</media:title> <yt:videoid>ZTUVgYoeN_b</yt:videoid> <media:content url= type=application/x-shockwave-flash medium=video [...] duration=215 yt:format=5/> <media:thumbnail url= height=97 width=130 time=00:00:03.500/> </media:group> </entry> <entry> […] </entry></feed>
  • 13. Feed access example in Javaimport;import;import;YouTubeService service = new YouTubeService(clientID,developer_key);VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);printVideoFeed(videoFeed, true);public static void printVideoFeed(VideoFeed videoFeed, boolean detailed) { for(VideoEntry videoEntry : videoFeed.getEntries() ) {printVideoEntry(videoEntry, detailed); }}
  • 14. Other useful things one can do with the APIs Upload Search Rate a video (Like/Dislike) Comment Add a playlist Retrieve activity feed (SUP or PubSubHubbub) Retrieve Insight video statistics Get a better grade on your exam! And more!If your application obtains OAuth/AuthSub authorization from auser, all of these can be done on users behalf.
  • 15. Performing video search in Pythonimport PrintVideoFeed(feed): for entry in feed.entry: PrintEntryDetails(entry)yt_service = = Falsequery = = search_termsquery.orderby = viewCountfeed = yt_service.YouTubeQuery(query)PrintVideoFeed(feed)
  • 16. Direct upload in C#using Google.GData.Client;using Google.GData.Extensions;using Google.GData.YouTube;using Google.GData.Extensions.MediaRss;YouTubeService service = new YouTubeService("exampleCo-exampleApp-1", clientID, developerKey);service.setUserCredentials(username, password);YouTubeEntry newEntry = new YouTubeEntry();newEntry.Media = new MediaGroup();newEntry.Media.Title = new MediaTitle("My Test Movie");newEntry.Media.Categories.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));newEntry.Media.Keywords = new MediaKeywords("cars, funny");newEntry.Media.Description = new MediaDescription("My description");newEntry.Private = false;newEntry.Location = new GeoRssWhere(37, -122);newEntry.MediaSource = new MediaFileSource("", "video/quicktime");YouTubeEntry createdEntry = service.Upload(newEntry);
  • 17. Player APIs Control the Player from your Web front-end URI parameters JavaScript API ActionScript API (Flash)
  • 18. Player Parameters<object width="425" height="344"><param name="movie" value=""</param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="425" height="344"></embed></object><iframe class="youtube-player" type="text/html" width="640" height="385" src="" frameborder="0"></iframe>
  • 19. Player JavaScript API : play for 6 seconds<script> const timeoutMs = 6000; var done = false; var player1 = new YT.Player(player1, {events: {onReady: onPlayerReady, onStateChange: onPlayerStateChange }}); function onPlayerReady(evt) {; } function onPlayerStateChange(newState) { if (newState == 1 && !done) { setTimeout(stopPlayer, timeoutMs); done = true; } } function stopPlayer() { player1.stopVideo(); }</script>
  • 20. What about mobile ?Video: David After Dentist by booba1234
  • 21. Mobile : Recording JavaIntent i = new Intent();i.setAction(MediaStore.VIDEO_CAPTURE);startActivityForResult(i, CAPTURE_RETURN); Objective-CIImagePickerController *imagePicker = [[[UIImagePickerController alloc] init]autorelease];imagePicker.delegate = self;imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];[self presentModalViewController:imagePicker animated:YES];
  • 22. Mobile : Uploading ACTION_SEND intent Use Google Data protocol to upload Libraries available for leading mobile platforms; you can use direct REST/HTTP on others
  • 23. App Examples
  • 24. Apps : Gaming
  • 25. Apps : Non-profit / social change Content curated from around the world Semantic analysis of video metadata Player integration
  • 26. Apps : Shortform Curation platform for video DJs (VJs) Player integration Custom embed player
  • 27. Apps : Storify Social curation / publishing platform Multiple data sources (Twitter, Facebook, YouTube) Google Data API integration
  • 28. Apps : Memolane Curation app for your digital memories Integrates multiple sources
  • 29. Apps : The History of Jazz “Coffee table” iPad application Videos help educate and discover new music Paid app, integrated with YouTube and iTunes
  • 30. YouTube Direct
  • 31. YouTube Direct : Mobile Easy authentication with AccountMananger Submission idea sync (JSON) Notification upon new assignments Video recording and upload to a specific submission idea Upload of a video selected from the gallery Geolocation tagging Massage and psychic readings
  • 32. One last thing ... Read the Terms of Service Monetization Guide Branding Guide [1][1] Photo by sub_lime79 / Misty
  • 33. ToS [1]YouTube API Terms of Service Guide Guide[1] Photo by sub_lime79 / Misty
  • 34. ResourcesGet the YouTube API developer key and start hacking! (docs) (blog) (forum) (me)
  • 35. Q&A Jarek Wilkiewicz