简体   繁体   中英

UIImagePickerController capturing image instead of video

I'm using the code below to capture image and video using UIImagePickerController . The code works perfectly, until I initiate a Video Chat using Quickblox. After I initiate and end the Video Chat session, the UIImagePickerController code to capture the video stops working ie instead of capturing video, it presents the controller for taking Picture. Any thoughts?

Capture Image

UIImagePickerController *controller = [[UIImagePickerController alloc] init];
controller.delegate = self;
controller.allowsEditing = NO;
controller.sourceType = UIImagePickerControllerSourceTypeCamera;
controller.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeImage, nil];
[self presentViewController:controller animated:YES completion:nil];

Capture Video

UIImagePickerController *controller = [[UIImagePickerController alloc] init];
controller.sourceType = UIImagePickerControllerSourceTypeCamera;
controller.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
controller.videoQuality = UIImagePickerControllerQualityTypeLow;
controller.videoMaximumDuration = 90;
controller.delegate = self;
[self presentViewController:controller animated:YES completion:nil];

The UIImagePickerController also has a cameraCaptureMode property. Set that to the desired mode.

enum {
   UIImagePickerControllerCameraCaptureModePhoto ,
   UIImagePickerControllerCameraCaptureModeVideo 
};
typedef NSUInteger  UIImagePickerControllerCameraCaptureMode;

This appears to be a bug with Quickblox. As per Quickblox support, we should setup and use a custom video capture session -- which might fix this issue. I've yet to try it out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM