使用UIImagePickerController录制视频但不是声音

时间:2015-05-26 11:39:21

标签: ios uiimagepickercontroller

录制视频时遇到问题。录制视频后,我没有视频声。我的编码如下。

 - (void)StartVideo

 {

    self.imagePickerController = [[UIImagePickerController alloc] init];

    _imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;


     _imagePickerController.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, nil];

    _imagePickerController.videoQuality = UIImagePickerControllerQualityTypeMedium;

    _imagePickerController.videoMaximumDuration = 10;

    _imagePickerController.allowsEditing = NO;

    _imagePickerController.showsCameraControls  = NO;

    _imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;

    _imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;

   if(!self.CameraLvingVCLayer)

   {

      self.CameraLvingVCLayer = [[CameraFaceLivingCreditViewController alloc] init];

      self.CameraLvingVCLayer.delegate = self;
   }

  _imagePickerController.cameraOverlayView = self.CameraLvingVCLayer.view;

  _imagePickerController.navigationBarHidden = YES;

  _imagePickerController.toolbarHidden = YES;

  _imagePickerController.delegate = self;

  [self presentViewController:_imagePickerController animated:YES completion:nil]; }


 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

   {

     NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    if ([mediaType isEqualToString:@"public.movie"])

    {

        NSURL* mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];

       if(mediaURL)

       {

          NSString *moviePath = [mediaURL path];

          if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) 

          {

            UISaveVideoAtPathToSavedPhotosAlbum (moviePath, nil, nil, nil);

          }

        }
    }
}

我的录制视频中没有声音,为什么?请仔细检查我的编码并为此提供解决方案。 请帮帮我

0 个答案:

没有答案