Ability to capture a video and uploading it into server in iphone sdk
As I am newbie to the Iphone Sdk I dont know how to Capture the video from o开发者_开发百科ur Iphone and upload the captured video to the Server.
Guys please suggest me how to go through this with sample code.
Thanks in advance, Monish.
This is a 2 step process: capture video and then uploading the video
1/ Capture video, you can use UIImagePickerController
This is a good tutorial for choosing photo/video from library or camera
2/ Upload Video, you need to take out the data and then upload it
After you capture a video, you will be returned a NSURL *url.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)mediaDict {
NSString *type = [mediaDict objectForKey:UIImagePickerControllerMediaType];
if ([type isEqualToString:(NSString *)kUTTypeVideo] ||
[type isEqualToString:(NSString *)kUTTypeMovie]) { // movie != video
NSURL *url = [mediaDict objectForKey:UIImagePickerControllerMediaURL];
NSData *data = [NSData dataWithContentsOfURL:videoURL];
// UPLOAD THIS DATA
}
return nil;
}
精彩评论