Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Upload video to youtube app using GData framework

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.

like image 517
coder1010 Avatar asked Mar 19 '12 05:03

coder1010


People also ask

Can you upload videos on YouTube app iPhone?

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.

Can you upload a video to YouTube studio from an iPad?

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.


2 Answers

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

like image 69
Tornado Avatar answered Dec 18 '22 09:12

Tornado


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];

}
like image 23
mahmud Avatar answered Dec 18 '22 10:12

mahmud