开发者

Ability to capture a video and uploading it into server in iphone sdk

开发者 https://www.devze.com 2023-01-16 09:11 出处:网络
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.

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;
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号