views:

80

answers:

1

Hi all ,

I want to upload a video from iPhone to a server somewhere.

I have found this useful question here for uploading a video on the server from iPhone.

The only problem here is picking the video. The code is using uiimagepickercontroller to pick up the video and I have a 3g phone which has not video in its photos app. I can't even put a video in it . I have a video only in iTunesU . Currently I am using following snippet for uiimagepickercontroller .

if ([UIImagePickerController isSourceTypeAvailable:
         UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
        UIImagePickerController *picker =
        [[UIImagePickerController alloc] init];
        picker.delegate = self;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        [self presentModalViewController:picker animated:YES];
        [picker release];
    }
    else {
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle:@"Error accessing photo library"
                              message:@"Device does not support a photo library"
                              delegate:nil
                              cancelButtonTitle:@"Drat!"
                              otherButtonTitles:nil];
        [alert show];
        [alert release];
    }

So I have to ask that is it necessary to pick a video from uiimagepickercontroller and if so how can I do so with my iPhone 3G .

Please tell me if the question is not readable.

Thanks .

+1  A: 

There is no video support for 3G that I am aware of.

In order to make it work (you could simulate it) you need to pass a mediaType of 'kutTypeMedia', which errors as not available on your device.

'If' you want to test, you can copy a video from the bundle, into your Camera Roll and test on the simulator.

Something like this to copy the video from the bundle to your camera roll:

Copy a video file from your bundle and save it to the album as below!

"Bundle Path : (Where APPLCIATIONGUID and user are dynamic and depend on the logged on user and the applicationGUID)

'/Users/user/Library/Application Support/iPhone Simulator/4.0/Applications/APPLICATIONGUID/Documents'

Where APPLICATIONGUID is the GUID associated with your particular project. You can confirm that you are in the right folder by looking for the appropraite .app file.

Note:// I don't believe that this will work with a MOV but have tried nothing but a .m4v.

NSString  *filePath = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/VID_0001.m4v"]];

NSString  *videoFilepath = [[NSBundle mainBundle] pathForResource:@"VID"  ofType:@"m4v"];
NSLog(@"Filepath is: %@", videoFilepath);

//test video can save to the photos album first - code missing

UISaveVideoAtPathToSavedPhotosAlbum(filePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);*

Once this has been done - videos are available in your photo album for selecting should you be setting up your UIImagePickerController with the correct media type.

This is the only option I see that you have to work with Video without a 3GS.

Lance