iPhone Upload video to youtube app using GData framework

后端 未结 4 845
太阳男子
太阳男子 2021-01-02 19:10

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 tryin

相关标签:
4条回答
  • 2021-01-02 19:33

    Solved my problem. The error info in your case is not enough. But if you print out the HTTPURLResponse from the server , it will help to spot the error. In my case keywords length was too long.

    0 讨论(0)
  • 2021-01-02 19:44

    I faced the same error. But I did find a solution through trial and error :)

    Actually as Youtube itself states

    enter image description here

    You don't need to provide Client_Id anymore. Please remove it.

    But the actual problem was with the login credentials. API was returning error response when i login as "xyz@gmail.com". It started working when i provided just the username without domain "xyz".

    Hope this helps!

    0 讨论(0)
  • 2021-01-02 19:46

    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

    0 讨论(0)
  • 2021-01-02 19:48

    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];
    
    }
    
    0 讨论(0)
提交回复
热议问题