com.google.gdata.data.youtube.YouTubeMediaGroup.addCategory()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.google.gdata.data.youtube.YouTubeMediaGroup.addCategory()方法的一些代码示例,展示了YouTubeMediaGroup.addCategory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTubeMediaGroup.addCategory()方法的具体详情如下:
包路径:com.google.gdata.data.youtube.YouTubeMediaGroup
类名称:YouTubeMediaGroup
方法名:addCategory

YouTubeMediaGroup.addCategory介绍

暂无

代码示例

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
 * Sets or changes the previously set YouTube category.
 * 
 * @param name the new category name to set.
 */
public void setYouTubeCategory(String name) {
 for (Iterator<MediaCategory> iterator = getCategories().iterator(); iterator.hasNext();) {
  MediaCategory category = iterator.next();
  if (YouTubeNamespace.CATEGORY_SCHEME.equals(category.getScheme())) {
   iterator.remove();
  }
 }
 
 addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, name));
}

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * Sets or changes the previously set YouTube category.
 * 
 * @param name the new category name to set.
 */
public void setYouTubeCategory(String name) {
 for (Iterator<MediaCategory> iterator = getCategories().iterator(); iterator.hasNext();) {
  MediaCategory category = iterator.next();
  if (YouTubeNamespace.CATEGORY_SCHEME.equals(category.getScheme())) {
   iterator.remove();
  }
 }
 
 addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, name));
}

代码示例来源:origin: stackoverflow.com

YouTubeService service = new YouTubeService("project id on console.developer.google.com","androidkey");
 service.setUserCredentials("yourYouTubeAccount@gmail.com", "yourPassword");
 VideoEntry newEntry = new VideoEntry();
 YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
 mg.setTitle(new MediaTitle());
 mg.getTitle().setPlainTextContent("Video Title");
 mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Tech"));
 mg.setKeywords(new MediaKeywords());
 mg.getKeywords().addKeyword("anyKeyword");
 mg.setDescription(new MediaDescription());
 mg.getDescription().setPlainTextContent("VIDEO DESCRIPTION");
 mg.setPrivate(false);
 mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
 mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));
 MediaFileSource ms = new MediaFileSource(videoFileToUpload, "video/quicktime");
 newEntry.setMediaSource(ms);
 VideoEntry createdEntry = service.insert(new URL(Constant.YOUTUBE_UPLOAD_URL), newEntry);
 Log.v("TAG", "VIDEO INSERTED ID : " + createdEntry.getId());

代码示例来源:origin: stackoverflow.com

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("Title goes here");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("keyword-here");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));

newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0));
// alternatively, one could specify just a descriptive string
// newEntry.setLocation("Mountain View, CA");

MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime");
newEntry.setMediaSource(ms);

String uploadUrl =
"http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);

代码示例来源:origin: stackoverflow.com

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("My Test Movie");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("cars");
mg.getKeywords().addKeyword("funny");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));

newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0));
// alternatively, one could specify just a descriptive string
// newEntry.setLocation("Mountain View, CA");

MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime");
newEntry.setMediaSource(ms);

String uploadUrl =
 "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);

相关文章