I want to upload video from my app to the youtube. I am using the example YoutubeTest for this purpose. I have set the developer key and client Id for my app. Now when trying to upload the video using example source code, it shows an error which is:
2012-03-19 10:51:07.947 YouTubeTest[539:f803] serviceBase: objectFetcher: failedWithStatus:400 data: 2012-03-19 10:51:07.985 YouTubeTest[539:f803] Error: Error Domain=com.google.GDataServiceDomain Code=400 "The operation couldn’t be completed. (com.google.GDataServiceDomain error 400.)" UserInfo=0x6c49e50 {}
Has anyone successfully implemented the GData to upload videos to youtube from the iphone app. Can anyone give me the example source code.
Use the YouTube iPhone and iPad app to upload videos by recording a new video or selecting an existing one. Open the YouTube app . Upload a video. Select the file you'd like to upload and tap NEXT.
It is easy to upload a video to YouTube from an iPad. However, you should first download and install the YouTube iOS app. You can record new videos directly from the app and upload them. Alternatively, you can upload the videos saved on your iPad that you had recorded earlier using the device's Camera app.
Yes ofcourse many had successfully implemented it ... hmmm try this link http://urinieto.com/category/google/ follow instructions line by line.
Not Sure y you are getting this error. Follow above instructions if problem still persists i will help you out .
Cheers
I am having the same issue with YouTubeTest app. here is the code for request:
(IBAction)uploadPressed:(id)sender {
NSString *devKey = [mDeveloperKeyField text];
GDataServiceGoogleYouTube *service = [self youTubeService];
[service setYouTubeDeveloperKey:devKey];
NSString *username = [mUsernameField text];
NSString *clientID = [mClientIDField text];
NSURL *url = [GDataServiceGoogleYouTube youTubeUploadURLForUserID:username
clientID:clientID];
// load the file data
NSString *path = [[NSBundle mainBundle] pathForResource:@"YouTubeTest" ofType:@"m4v"];
NSData *data = [NSData dataWithContentsOfFile:path];
NSString *filename = [path lastPathComponent];
// gather all the metadata needed for the mediaGroup
NSString *titleStr = [mTitleField text];
GDataMediaTitle *title = [GDataMediaTitle textConstructWithString:titleStr];
NSString *categoryStr = [mCategoryField text];
GDataMediaCategory *category = [GDataMediaCategory mediaCategoryWithString:categoryStr];
[category setScheme:kGDataSchemeYouTubeCategory];
NSString *descStr = [mDescriptionField text];
GDataMediaDescription *desc = [GDataMediaDescription textConstructWithString:descStr];
NSString *keywordsStr = [mKeywordsField text];
GDataMediaKeywords *keywords = [GDataMediaKeywords keywordsWithString:keywordsStr];
BOOL isPrivate = mIsPrivate;
GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
[mediaGroup setMediaTitle:title];
[mediaGroup setMediaDescription:desc];
[mediaGroup addMediaCategory:category];
[mediaGroup setMediaKeywords:keywords];
[mediaGroup setIsPrivate:isPrivate];
NSString *mimeType = [GDataUtilities MIMETypeForFileAtPath:path
defaultMIMEType:@"video/mp4"];
// create the upload entry with the mediaGroup and the file data
GDataEntryYouTubeUpload *entry;
entry = [GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup
data:data
MIMEType:mimeType
slug:filename];
SEL progressSel = @selector(ticket:hasDeliveredByteCount:ofTotalByteCount:);
[service setServiceUploadProgressSelector:progressSel];
GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:entry
forFeedURL:url
delegate:self
didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];
[self setUploadTicket:ticket];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With