Upload Videos to YouTube with iPhone custom App

Fri, Oct 15, 2010 2-minute read

EDIT: This is an old post, and apparently things have changed quite a bit. Unfortunately I haven’t had the time to update this and I’m not sure what the process to upload videos to YouTube is anymore.

With the 4.0 iOS and its new AVCaptureSession we now have access to video data, so that developers can edit this info and create cool apps such as SketchWiz, Predator Vision or iRetroscope.

However it’s not clear how these videos can be shared through the net. So in this post I’ll explain how we can upload videos to YouTube with a custom app and provide some sample code to test it.

We will need the Google Data API Client for Objective-C, and install it into our application. Here are the steps to do so:

– Download the GData Client for Objective-C from here
– Open the GData project with XCode
– Drag and drop the group GData Source from the GData project into your project (reference it or copy it into your project directory, up to you)
– Optional: In your project delete all groups inside GData Source but YouTube and Commons. This will make the compilation process much faster. You will have to comment the imports in your GData.h
– Add the Security.framework into your frameworks
– In the properties of your target, add the -ObjC to your Other Linker Flags setting
– In the properties of your target, add the /usr/include/libxml2 path to your Header Search Path setting
– Make sure your C Language Dialect is c99 in your target properties

You should now be able to compile the API within your own app.

Next step is to go here to get a Developer Key from Google. Your Developer Key and Client ID are required in order to use the GData API.

Once you have them, take a look at the simple YouTube upload test sample code based on the Mac OSX Example inside the GData Client Objective-C code and add them there in the YouTubeTestViewController.m.

Sample Code

For more information and other type of installations for the API, please read the API documentation.

I hope it helps. Any feedback is welcome as always.