0
我想上傳視頻到youtube channel.i試用下面的Code.the波紋管代碼工作上傳視頻,但問題是,我不能附加它的信息(視頻標題,說明&標籤)。上傳後只顯示視頻標題爲「未知」,沒有標籤或說明。
我見過CodingTofu,Dev7Dev Blog- iOS Sample Code和許多其他Q & A但我不明白我在哪裏犯錯。
iOS上傳帶視頻信息的視頻GTLServiceYoutube
NSString* title = video.title;
NSString* description = video.videoDescription;
NSData* data = video.data;
NSMutableArray* tags = video.tags.mutableCopy;
GTLYouTubeVideo *yVideo = [GTLYouTubeVideo object];
GTLYouTubeVideoSnippet *snippet = [GTLYouTubeVideoSnippet alloc];
snippet.title = title;
snippet.descriptionProperty = description;
[tags addObject:DEFAULT_KEYWORD];
NSString* tag = [UploadController generateKeywordFromPlaylistId:UPLOAD_PLAYLIST];
[tags addObject:tag];
snippet.tags = tags;
GTLYouTubeVideoStatus *status = [GTLYouTubeVideoStatus alloc];
status.privacyStatus = @"public";
GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:data MIMEType:@"video/*"];
GTLQueryYouTube *query = [GTLQueryYouTube queryForVideosInsertWithObject:yVideo part:@"snippet,status" uploadParameters:uploadParameters];
service.uploadProgressBlock = ^(GTLServiceTicket* ticket, unsigned long long totalBytesUploaded, unsigned long long totalBytesExpectedToUpload){
CGFloat percentage = totalBytesUploaded/totalBytesExpectedToUpload;
NSLog(@"\nUploaded percentage %%(%0.2f)",percentage);
};
[service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLYouTubeVideo *insertedVideo, NSError *error) {
//[waitIndicator dismissWithClickedButtonIndex:0 animated:YES];
if (error == nil)
{
NSLog(@"File ID: %@", insertedVideo.identifier);
return;
}
else
{
NSLog(@"An error occurred: %@", error);
return;
}
}];
告訴我,如果你需要任何進一步的細節
謝謝。
對不起我的英文不好。
嗨@Vatsal Shukla,你能告訴我這個任務需要哪個莢庫嗎? –