Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7308403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:33:09+00:00 2026-05-28T23:33:09+00:00

I am developing an app from which I want to upload Videos to Vimeo,

  • 0

I am developing an app from which I want to upload Videos to Vimeo, Facebook and Youtube. Facebook and Youtube have pretty straightforward apis, Vimeo has a good developer documentation, but no Objective C framework. I have seen a couple of Apps which use Vimeo, so I was wondering if there is some kind of Framework out there I’m not aware of.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T23:33:10+00:00Added an answer on May 28, 2026 at 11:33 pm

    OK everybody. If you’re still interested in how to upload a video to vimeo, here’s the code. First you need to register an App with vimeo and obtain your secret and consumer key. Then you need to get the GTMOAuth framework from Google and possibly the SBJson framework. At the moment I unfortunately don’t have the time to clean up the below code, but I thought this may be better than nothing for those, who need some help with vimeo. Essentially you authenticate with vimeo, get an upload ticket, upload the video with this ticket and then ad a title and some text.

    The code below won’t work out of the box, because there are a couple of view elements connected, but it should give you an understanding of what is happening.

    #define VIMEO_SECRET @"1234567890" 
    #define VIMEO_CONSUMER_KEY @"1234567890"
    #define VIMEO_BASE_URL @"http://vimeo.com/services/auth/"
    
    #define VIMEO_REQUEST_TOKEN_URL @"http://vimeo.com/oauth/request_token"
    #define VIMEO_AUTHORIZATION_URL @"http://vimeo.com/oauth/authorize?permission=write"
    #define VIMEO_ACCESS_TOKEN_URL @"http://vimeo.com/oauth/access_token"
    
    
    #import "MMVimeoUploaderVC.h"
    #import "GTMOAuthAuthentication.h"
    #import "GTMOAuthSignIn.h"
    #import "GTMOAuthViewControllerTouch.h"
    #import "JSON.h"
    
    
    @interface MMVimeoUploaderVC ()
    
    @property (retain) GTMOAuthAuthentication *signedAuth;
    @property (retain) NSString *currentTicketID;
    @property (retain) NSString *currentVideoID;
    @property (assign) BOOL isUploading;
    @property (retain) GTMHTTPFetcher *currentFetcher;
    
    @end
    
    @implementation MMVimeoUploaderVC
    
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
            first = YES;
            [GTMOAuthViewControllerTouch removeParamsFromKeychainForName:@"Vimeo"];
    
        }
        return self;
    }
    
    - (void)stopUpload {
        if ( self.isUploading || self.currentFetcher ) {
            [self.currentFetcher stopFetching];
        }
    }
    
    - (void) setProgress:(float) progress {
        // Connect to your views here
    }
    
    #pragma mark - handle error
    
    - (void) handleErrorWithText:(NSString *) text {
    
        //notify your views here
    
        self.currentFetcher = nil;
        self.isUploading = NO;
        self.progressBar.alpha = 0;
        self.uploadButton.alpha = 1;
    
    }
    
    #pragma mark - interface callbacks
    
    //step one, authorize
    - (void)startUpload {
    
        if ( self.signedAuth ) {
            //authentication present, start upload
    
        } else {
            //get vimeo authentication
            NSURL *requestURL = [NSURL URLWithString:VIMEO_REQUEST_TOKEN_URL];
            NSURL *accessURL = [NSURL URLWithString:VIMEO_ACCESS_TOKEN_URL];
            NSURL *authorizeURL = [NSURL URLWithString:VIMEO_AUTHORIZATION_URL];
            NSString *scope = @"";
    
            GTMOAuthAuthentication *auth = [self vimeoAuth];
    
            // set the callback URL to which the site should redirect, and for which
            // the OAuth controller should look to determine when sign-in has
            // finished or been canceled
            //
            // This URL does not need to be for an actual web page
            [auth setCallback:@"http://www.....com/OAuthCallback"];
    
            // Display the autentication view
            GTMOAuthViewControllerTouch *viewController;
            viewController = [[[GTMOAuthViewControllerTouch alloc] initWithScope:scope
                                                                        language:nil
                                                                 requestTokenURL:requestURL
                                                               authorizeTokenURL:authorizeURL
                                                                  accessTokenURL:accessURL
                                                                  authentication:auth
                                                                  appServiceName:@"Vimeo"
                                                                        delegate:self
                                                                finishedSelector:@selector(viewController:finishedWithAuth:error:)] autorelease];
    
            [[self navigationController] pushViewController:viewController
                                                   animated:YES];
        }
    
    }    
    
    
    //step two get upload ticket
    - (void)viewController:(GTMOAuthViewControllerTouch *)viewController
          finishedWithAuth:(GTMOAuthAuthentication *)auth
                     error:(NSError *)error {
        if (error != nil) {
            [self handleErrorWithText:nil];
        } else {
            self.signedAuth = auth;
            [self startUpload];
        }
    }
    
    - (void) startUpload {
        self.isUploading = YES;
        NSURL *url = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.getQuota"];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
        [self.signedAuth authorizeRequest:request];
        GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
        [myFetcher beginFetchWithDelegate:self
                        didFinishSelector:@selector(myFetcher:finishedWithData:error:)];
        self.currentFetcher = myFetcher;
    }
    
    - (void) myFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
            NSLog(@"error %@", error);
        } else {
    
            NSString *info = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
            NSDictionary *result = [info JSONValue];
    
            //quota
            int quota = [[result valueForKeyPath:@"user.upload_space.max"] intValue];
    
            //get video file size
            NSString *path;
            path = @"local video path";
            NSFileManager *manager = [NSFileManager defaultManager];
            NSDictionary *attrs = [manager attributesOfItemAtPath:path error: NULL];
            UInt32 size = [attrs fileSize];
    
            if ( size > quota ) {
                [self handleErrorWithText:@"Your Vimeo account quota is exceeded."];
                return;
            }
    
            //lets assume we have enough quota
            NSURL *url = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.getTicket&upload_method=streaming"];
            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [self.signedAuth authorizeRequest:request];
            GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
            [myFetcher beginFetchWithDelegate:self
                            didFinishSelector:@selector(myFetcher2:finishedWithData:error:)];
    
            self.currentFetcher = myFetcher;
        }
    }
    
    - (void) myFetcher2:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
            NSLog(@"error %@", error);
        } else {
    
            NSString *info = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
            NSDictionary *result = [info JSONValue];
    
            //fail here if neccessary TODO
            NSString *urlString = [result valueForKeyPath:@"ticket.endpoint"];
            self.currentTicketID = [result valueForKeyPath:@"ticket.id"];
    
            if ( [self.currentTicketID length] == 0 || [urlString length] == 0) {
                [self handleErrorWithText:nil];
                return;
            }
    
            //get video file
            // load the file data
            NSString *path;
            path = [MMMovieRenderer sharedRenderer].localVideoURL;
    
            //get video file size
            NSFileManager *manager = [NSFileManager defaultManager];
            NSDictionary *attrs = [manager attributesOfItemAtPath:path error: NULL];
            UInt32 size = [attrs fileSize];
    
            //insert endpoint here
            NSURL *url = [NSURL URLWithString:urlString];
            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [request setHTTPMethod:@"PUT"];
            [request setValue:[NSString stringWithFormat:@"%i", size] forHTTPHeaderField:@"Content-Length"];
            [request setValue:@"video/mp4" forHTTPHeaderField:@"Content-Type"];
            [request setHTTPBody:[NSData dataWithContentsOfFile:path]];
    
            [self.signedAuth authorizeRequest:request];
            GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
            myFetcher.sentDataSelector = @selector(myFetcher:didSendBytes:totalBytesSent:totalBytesExpectedToSend:);
    
            [myFetcher beginFetchWithDelegate:self
                            didFinishSelector:@selector(myFetcher3:finishedWithData:error:)];
    
            self.currentFetcher = myFetcher;
    
        }
    }
    
      - (void)myFetcher:(GTMHTTPFetcher *)fetcher
                 didSendBytes:(NSInteger)bytesSent
                totalBytesSent:(NSInteger)totalBytesSent
    totalBytesExpectedToSend:(NSInteger)totalBytesExpectedToSend {
          NSLog(@"%i / %i", totalBytesSent, totalBytesExpectedToSend);
          [self setProgress:(float)totalBytesSent / (float) totalBytesExpectedToSend];
          self.uploadLabel.text = @"Uploading to Vimeo...";
      }
    
    - (void) myFetcher3:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
        } else {
            NSString *info = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
    
            //finalize upload
            NSString *requestString = [NSString stringWithFormat:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.complete&ticket_id=%@&filename=%@", self.currentTicketID, @"movie.mov"];
    
            NSURL *url = [NSURL URLWithString:requestString];
            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [self.signedAuth authorizeRequest:request];
            GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
            [myFetcher beginFetchWithDelegate:self
                            didFinishSelector:@selector(myFetcher4:finishedWithData:error:)];
    
            self.currentFetcher = myFetcher;
        }
    }
    
    - (void) myFetcher4:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
        } else {
            //finish upload
            NSString *info = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
            NSDictionary *result = [info JSONValue];
    
            self.currentVideoID = [result valueForKeyPath:@"ticket.video_id"];
    
            if ( [self.currentVideoID length] == 0 ) {
                [self handleErrorWithText:nil];
                return;
            } 
    
            //set title 
            NSString *title = [MMMovieSettingsManager sharedManager].movieTitle;
            title = [title stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
            NSString *requestString = [NSString stringWithFormat:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.setTitle&video_id=%@&title=%@", self.currentVideoID, title];
    
            NSLog(@"%@", requestString);
    
            NSURL *url = [NSURL URLWithString:requestString];
            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [self.signedAuth authorizeRequest:request];
            GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
            [myFetcher beginFetchWithDelegate:self
                            didFinishSelector:@selector(myFetcher5:finishedWithData:error:)];
    
    
        }
    }
    
    - (void) myFetcher5:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
            NSLog(@"error %@", error);
        } else {
    
            //set description 
            NSString *desc = @"Video created with ... iPhone App.";
            desc = [desc stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
            NSString *requestString = [NSString stringWithFormat:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.setDescription&video_id=%@&description=%@", self.currentVideoID, desc];
    
            NSURL *url = [NSURL URLWithString:requestString];
            NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
            [self.signedAuth authorizeRequest:request];
            GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
            [myFetcher beginFetchWithDelegate:self
                            didFinishSelector:@selector(myFetcher6:finishedWithData:error:)];
    
        }
    }
    
    - (void) myFetcher6:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *) error {
        if (error != nil) {
            [self handleErrorWithText:nil];
            NSLog(@"error %@", error);
        } else {
    
            //done
            //alert your views that the upload has been completed 
        }
    }
    
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
        [self setProgress:0];
    }
    
    - (void) viewDidDisappear:(BOOL)animated  {
        [super viewDidDisappear:animated];
        [GTMOAuthViewControllerTouch removeParamsFromKeychainForName:@"Vimeo"];
    }
    
    #pragma mark - oauth stuff
    
    - (GTMOAuthAuthentication *)vimeoAuth {
        NSString *myConsumerKey = VIMEO_CONSUMER_KEY;    // pre-registered with service
        NSString *myConsumerSecret = VIMEO_SECRET; // pre-assigned by service
    
        GTMOAuthAuthentication *auth;
        auth = [[[GTMOAuthAuthentication alloc] initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
                                                            consumerKey:myConsumerKey
                                                             privateKey:myConsumerSecret] autorelease];
    
        // setting the service name lets us inspect the auth object later to know
        // what service it is for
        auth.serviceProvider = @"Vimeo";
    
        return auth;
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Facebook App in which I get some text from the
I'm developing an app in which I want to listen to notifications from an
i am developing an app in which i get data from server and display
I am developing an app in which i can get Image from URL and
I am developing an app, which display number of books fetched from the server
I am developing a BlackBerry app which needs to read from an xml file.
I am developing an web application which can upload/download a file from client to
I am developing web app using asp.net. I have plenty of javascript files which
I am developing an app which uses tabs. I want to customize tab look.I
I am developing a app in which I have to add custom contacts to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.