简体   繁体   中英

UIImagepicker display Image capturing instead of Video recording

I am using UIImagepickerController to capture video in my app. Sometimes it behaves strangely - that image capturing is coming. Mostly it comes when a new user is registered and try to capture a video or a new ipa file is installed and tested. Eventhough it appears randomly.

When I prompt UIImagepickerController it display take photo button (White button) instead of video record button (Red button)

Here is my code -

 UIImagePickerController *imagePicker=[[UIImagePickerController alloc]init];
 imagePicker.delegate=self;
 if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
   {
    imagePicker.allowsEditing = YES;
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
  }
[self presentViewController:imagePicker animated:YES completion:NULL];

Just try replacing your code with this.

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
   // picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMoviekUTTypeImage];
    picker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,nil];
    //picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self presentViewController:picker animated:YES completion:NULL];

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