0
비디오 업로드를 위해 ResumableGDataFileUploader를 구성 할 때 내 프로그램 업로드가 완료된 후에도 끝나지 않습니다. 나는 그것을 죽일 수있는 방법을 찾아 내려고 노력했지만 지금까지는 행운이 없다. 어떻게해야합니까?업로드가 완료된 후 ResumableGDataFileUploader가 종료되지 않습니다.
private String postYoutubeVideo() throws IOException, ServiceException, GeneralSecurityException, InterruptedException, ExecutionException, TimeoutException {
String resumableVideoUploadURL = "http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads";
// constants
UploadProgressListener progressListener = new UploadProgressListener();
YouTubeService service = getYouTubeService();
File file = getFile();
String mimeType = new MimetypesFileTypeMap().getContentType(file);
MediaFileSource mediaFile = new MediaFileSource(file, mimeType);
VideoEntry newEntry = new VideoEntry();
YouTubeMediaGroup mediaGroup = newEntry.getOrCreateMediaGroup();
mediaGroup.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, category));
mediaGroup.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, devtag));
mediaGroup.setTitle(new MediaTitle());
mediaGroup.getTitle().setPlainTextContent(title);
mediaGroup.setKeywords(new MediaKeywords());
mediaGroup.getKeywords().addKeyword(keyword);
mediaGroup.setDescription(new MediaDescription());
mediaGroup.getDescription().setPlainTextContent(description);
mediaGroup.setPrivate(false);
newEntry.setMediaSource(mediaFile);
ResumableGDataFileUploader resumableUploader = new ResumableGDataFileUploader.Builder(service, new URL(
resumableVideoUploadURL), mediaFile, newEntry)
.title(title)
.chunkSize(chunkSize)
.build();
resumableUploader.start();
while (!resumableUploader.isDone())
{
Thread.sleep(progressInterval);
}
ResponseMessage response = resumableUploader.getResponse();
VideoEntry newVideo = new VideoEntry();
newVideo.parseAtom(new ExtensionProfile(), response.getInputStream());
extMsgId = newVideo.getHtmlLink().getHref();
return extMsgId;
}
내가 데이터 API의 v3에서 같은 일을 시도 추천 거라고 : https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video의 GData 클라이언트 라이브러리는 아주 잘 지원되지 않습니다 더 이상. –
감사합니다. Jeff,하지만 해결했습니다. – Chiranjib