本文整理了Java中com.google.gdata.data.youtube.YouTubeMediaGroup
类的一些代码示例,展示了YouTubeMediaGroup
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTubeMediaGroup
类的具体详情如下:
包路径:com.google.gdata.data.youtube.YouTubeMediaGroup
类名称:YouTubeMediaGroup
[英]Subset of . See description on http://search.yahoo.com/mrss.
[中]的子集。请参阅http://search.yahoo.com/mrss的说明。
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* Adds a {@code media:content} tag.
*
* @param content
*/
public void addContent(YouTubeMediaContent content) {
addRepeatingExtension(content);
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/** Checks the yt:private flag. */
public boolean isPrivate() {
YtPrivate privacyLevel = getExtension(YtPrivate.class);
return privacyLevel != null;
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* Gets a modifiable list of {@link YouTubeMediaContent}.
*
* @return list of {@code MediaContent}.
*/
public List<YouTubeMediaContent> getYouTubeContents() {
return getRepeatingExtension(YouTubeMediaContent.class);
}
代码示例来源: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: com.google.gdata/gdata-java-client
@Override
public void declareExtensions(ExtensionProfile extProfile) {
super.declareExtensions(extProfile);
extProfile.declareFeedExtension(YtPrivate.class);
extProfile.declareFeedExtension(YouTubeMediaGroup.class);
extProfile.declare(PlaylistFeed.class, YtPlaylistId.class);
new YouTubeMediaGroup().declareExtensions(extProfile);
BatchUtils.declareExtensions(extProfile);
}
代码示例来源: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: com.google.gdata/gdata-java-client
/**
* Sets the YouTube user who uploaded the video.
*
* @param uploader YouTube user name or {@code null}
* @since 2.0
*/
public void setUploader(String uploader) {
for (Iterator<YouTubeMediaCredit> iterator = getYouTubeCredits().iterator();
iterator.hasNext(); ) {
MediaCredit credit = iterator.next();
if (UPLOADER_ROLE.equals(credit.getRole())
&& YouTubeNamespace.CREDIT_SCHEME.equals(credit.getScheme())) {
iterator.remove();
}
}
if (uploader != null) {
YouTubeMediaCredit credit = new YouTubeMediaCredit();
credit.setScheme(YouTubeNamespace.CREDIT_SCHEME);
credit.setRole(UPLOADER_ROLE);
credit.setContent(uploader);
addCredit(credit);
}
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/**
* Checks whether the uploader is a partner.
*
* @return uploader type
*/
public YouTubeMediaCredit.Type getUploaderType() {
YouTubeMediaCredit uploader = getUploaderTag();
return uploader == null ? null : uploader.getType();
}
代码示例来源:origin: com.google.gdata/gdata-java-client
public YouTubeMediaGroup getOrCreateMediaGroup() {
YouTubeMediaGroup group = getMediaGroup();
if (group == null) {
group = new YouTubeMediaGroup();
setExtension(group);
}
return group;
}
}
代码示例来源:origin: com.google.gdata/gdata-java-client
Set<MediaCategory> found = getCategoriesWithScheme(YouTubeNamespace.CATEGORY_SCHEME);
if (found.size() == 1) {
return found.iterator().next();
Set<MediaCategory> withNoScheme = getCategoriesWithScheme(null);
if (withNoScheme.size() == 1) {
return withNoScheme.iterator().next();
代码示例来源: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);
代码示例来源:origin: com.mulesoft.google/google-api-gdata
@Override
public void declareExtensions(ExtensionProfile extProfile) {
super.declareExtensions(extProfile);
extProfile.declareFeedExtension(YtPrivate.class);
extProfile.declareFeedExtension(YouTubeMediaGroup.class);
extProfile.declare(PlaylistFeed.class, YtPlaylistId.class);
new YouTubeMediaGroup().declareExtensions(extProfile);
BatchUtils.declareExtensions(extProfile);
}
代码示例来源: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.mulesoft.google/google-api-gdata
/**
* Sets the YouTube user who uploaded the video.
*
* @param uploader YouTube user name or {@code null}
* @since 2.0
*/
public void setUploader(String uploader) {
for (Iterator<YouTubeMediaCredit> iterator = getYouTubeCredits().iterator();
iterator.hasNext(); ) {
MediaCredit credit = iterator.next();
if (UPLOADER_ROLE.equals(credit.getRole())
&& YouTubeNamespace.CREDIT_SCHEME.equals(credit.getScheme())) {
iterator.remove();
}
}
if (uploader != null) {
YouTubeMediaCredit credit = new YouTubeMediaCredit();
credit.setScheme(YouTubeNamespace.CREDIT_SCHEME);
credit.setRole(UPLOADER_ROLE);
credit.setContent(uploader);
addCredit(credit);
}
}
代码示例来源:origin: com.google.gdata/gdata-java-client
/**
* Gets the YouTube user who uploaded the video.
*
* @return YouTube user name or {@code null}
* @since 2.0
*/
public String getUploader() {
YouTubeMediaCredit uploader = getUploaderTag();
return uploader == null ? null : uploader.getContent();
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
public YouTubeMediaGroup getOrCreateMediaGroup() {
YouTubeMediaGroup group = getMediaGroup();
if (group == null) {
group = new YouTubeMediaGroup();
setExtension(group);
}
return group;
}
代码示例来源:origin: com.mulesoft.google/google-api-gdata
Set<MediaCategory> found = getCategoriesWithScheme(YouTubeNamespace.CATEGORY_SCHEME);
if (found.size() == 1) {
return found.iterator().next();
Set<MediaCategory> withNoScheme = getCategoriesWithScheme(null);
if (withNoScheme.size() == 1) {
return withNoScheme.iterator().next();
代码示例来源: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: com.google.gdata/gdata-java-client
new YouTubeMediaGroup().declareExtensions(extProfile);
extProfile.declareAdditionalNamespace(MediaRssNamespace.NS);
代码示例来源:origin: com.mulesoft.google/google-api-gdata
/** Checks the yt:private flag. */
public boolean isPrivate() {
YtPrivate privacyLevel = getExtension(YtPrivate.class);
return privacyLevel != null;
}
内容来源于网络,如有侵权,请联系作者删除!