本文整理汇总了Java中com.google.api.services.youtube.model.VideoStatus类的典型用法代码示例。如果您正苦于以下问题:Java VideoStatus类的具体用法?Java VideoStatus怎么用?Java VideoStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoStatus类属于com.google.api.services.youtube.model包,在下文中一共展示了VideoStatus类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: schedule
import com.google.api.services.youtube.model.VideoStatus; //导入依赖的package包/类
@Override
public void schedule(final DateTime dateTime, final String videoid, final Account account) throws ScheduleIOException {
try {
final YouTube youTube = youTubeProvider.setAccount(account).get();
final YouTube.Videos.List listVideosRequest = youTube.videos().list("status").setId(videoid);
final VideoListResponse listResponse = listVideosRequest.execute();
final List<Video> videoList = listResponse.getItems();
if (videoList.isEmpty()) {
LOGGER.info("Can't find a video with ID: " + videoid);
return;
}
final Video video = videoList.get(0);
final VideoStatus status = video.getStatus();
status.setPublishAt(dateTime);
youTube.videos().update("status", video).execute();
} catch (final Exception e) {
throw new ScheduleIOException(e);
}
}
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:25,代码来源:ScheduleServiceImpl.java
示例2: createVideoInsert
import com.google.api.services.youtube.model.VideoStatus; //导入依赖的package包/类
private YouTube.Videos.Insert createVideoInsert(YouTube youtube, AbstractInputStreamContent mediaContent,
String title, String description) throws IOException {
// Add extra information to the video before uploading.
Video videoObjectDefiningMetadata = new Video();
/**
* Set the video to public, so it is available to everyone (what most people want). This is
* actually the default, but I wanted you to see what it looked like in case you need to set
* it to "unlisted" or "private" via API.
*/
VideoStatus status = new VideoStatus();
status.setPrivacyStatus("public");
videoObjectDefiningMetadata.setStatus(status);
// We set a majority of the metadata with the VideoSnippet object.
VideoSnippet snippet = new VideoSnippet();
snippet.setTitle(title);
snippet.setDescription(description);
// Set completed snippet to the video object.
videoObjectDefiningMetadata.setSnippet(snippet);
/**
* The upload command includes: 1. Information we want returned after file is successfully
* uploaded. 2. Metadata we want associated with the uploaded video. 3. Video file itself.
*/
YouTube.Videos.Insert videoInsert = youtube.videos()
.insert("snippet,statistics,status", videoObjectDefiningMetadata, mediaContent);
// Set the upload type and add event listener.
MediaHttpUploader uploader = videoInsert.getMediaHttpUploader();
/**
* Sets whether direct media upload is enabled or disabled. True = whole media content is
* uploaded in a single request. False (default) = resumable media upload protocol to upload
* in data chunks.
*/
uploader.setDirectUploadEnabled(false);
return videoInsert;
}
开发者ID:labhackercd,项目名称:edm,代码行数:43,代码来源:YouTubeUploader.java
示例3: YoutubeUpload
import com.google.api.services.youtube.model.VideoStatus; //导入依赖的package包/类
YoutubeUpload(File file, String token, String title, String description) throws IOException {
Credential credential = Auth.authorize(token);
youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, credential).setApplicationName("ttyrec2video.youtube").build();
Video metadata = new Video();
VideoStatus status = new VideoStatus();
status.setPrivacyStatus("public");
metadata.setStatus(status);
VideoSnippet snippet = new VideoSnippet();
snippet.setTitle(title);
snippet.setDescription(description);
metadata.setSnippet(snippet);
InputStreamContent content = new InputStreamContent("video/*", file.getAbsoluteFile().toURL().openStream());
YouTube.Videos.Insert videoinsert = youtube.videos().insert("snippet,statistics,status", metadata, content);
MediaHttpUploader uploader = videoinsert.getMediaHttpUploader();
uploader.setDirectUploadEnabled(false);
Video returnedVideo = videoinsert.execute();
System.out.println("https://youtu.be/" + returnedVideo.getId());
System.exit(0);
}
开发者ID:Elronnd,项目名称:ttyrec2video,代码行数:30,代码来源:YoutubeUpload.java
注:本文中的com.google.api.services.youtube.model.VideoStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论