Search code examples
iosuiimagepickercontrollerquickblox

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 i.e. 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];

Solution

  • 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.