开发者

How to set youtube data to android widgets?

开发者 https://www.devze.com 2023-03-25 11:25 出处:网络
This is the code i am using to retreive a list of searched videos using the youtube data api. if(detailed) {

This is the code i am using to retreive a list of searched videos using the youtube data api.

 if(detailed) {

YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();

System.out.println("Uploaded by: " + mediaGroup.getUploader());

System.out.println("Video ID: " + mediaGroup.getVideoId());
System.out.println("Description: " + 
  mediaGroup.getDescription().getPlainTextContent());

MediaPlayer mediaPlayer = mediaGroup.getPlayer();
System.out.println("Web Player URL: " + mediaPlayer.getUrl());
MediaKeywords keywords = mediaGroup.getKeywords();
System.out.print("Keywords: ");
for(String keyword : keywords.getKeywords()) {
  System.out.print(keyword + ",");
}

GeoRssWhere location = videoEntry.getGeoCoordinates();
if(location != null) {
  System.out.println("Latitude: " + location.getLatitude());
  System.out.println("Longitude: " + location.getLongitude());
}

Rating rating = videoEntry.getRating();
if(rating != null) {
  System.out.println("Average rating: " + rating.getAverage());
}

YtStatisti开发者_开发知识库cs stats = videoEntry.getStatistics();
if(stats != null ) {
  System.out.println("View count: " + stats.getViewCount());
}
System.out.println();

System.out.println("\tThumbnails:");
for(MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
  System.out.println("\t\tThumbnail URL: " + mediaThumbnail.getUrl());
  System.out.println("\t\tThumbnail Time Index: " +
  mediaThumbnail.getTime());
  System.out.println();
}

How could i convert this information to the use of a text view for the title, a ImageView for the thumbnail??

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号