/ Published in: Java
URL: http://www.javalobby.org/java/forums/t103917.html
Requires "Guava lib", as well as the main dependencies listed in the above link:
- gdata-youtube-2.0.jar
- gdata-core-2.0.jar
- gdata-media-2.0.jar
- gdata-client-2.0.jar
- mail.jar
Then configure your API_KEY and APP configs: https://code.google.com/apis/youtube/dashboard/gwt/index.html#product/
Then you should be able to search YouTube from a Native cross-platform JAVA desktop app; after this, next steps are to:
- Test searches and ensure its working well.
- Integrate Tidy HTML parsing and generate YouTuve tags.
- Setup lightweight HTML file to accept video IDs as parameter and render a player: http://jsfiddle.net/bcmoney/yBP4J/
- Integrate WebRenderer: http://webrenderer.com/ (or other embedded J2EE broswer)
- Test playback of video in Embedded Browser, Mobile support, (see BB demos) etc..
- Integrate with BlogOfBug's JCarousel: http://web.archive.org/web/20070203112659/http://www.blogofbug.com/page3/page3.html
- Find inspiration to finish OpenRecommender!!!!!!!
Expand |
Embed | Plain Text
package net.bcmoney; import com.google.gdata.client.youtube.YouTubeService; import com.google.gdata.data.Person; import com.google.gdata.data.TextConstruct; import com.google.gdata.data.youtube.VideoEntry; import com.google.gdata.data.youtube.VideoFeed; import com.google.gdata.util.ServiceException; import java.io.IOException; import java.net.URL; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author bcbcope */ public class YouTubePlayer { public YouTubePlayer() { } private static void printVideoFeed(YouTubeService service, String feedUrl) throws IOException, ServiceException { List<VideoEntry> allVideos = videoFeed.getEntries(); Iterator<VideoEntry> itAllVideos = allVideos.iterator(); while (itAllVideos.hasNext()){ VideoEntry oneVideo = itAllVideos.next(); TextConstruct oneVideoTitle = oneVideo.getTitle(); //Print titles of all videos: List<Person> allAuthors = oneVideo.getAuthors(); Iterator<Person> itAllAuthors = allAuthors.iterator(); while (itAllAuthors.hasNext()){ Person oneAuthor = itAllAuthors.next(); //Print authors of current title: } } } try { YouTubeService myService = new YouTubeService("mycompany-myapp-1"); String myFeed = "http://gdata.youtube.com/feeds/videos?start-index=1&max-results=25&vq=lizards&oi=spell"; printVideoFeed(myService, myFeed); Logger.getLogger(YouTubePlayer.class.getName()).log(Level.SEVERE, null, ex); } catch (ServiceException ex) { Logger.getLogger(YouTubePlayer.class.getName()).log(Level.SEVERE, null, ex); } } }
You need to login to post a comment.
