gpt4 book ai didi

ios - 错误域=AVFoundationErrorDomain 代码=-11814 "Cannot Record"

转载 作者:可可西里 更新时间:2023-11-01 03:46:05 26 4
gpt4 key购买 nike

它一直给我错误:

Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record"

我不确定是什么问题?我正在尝试在拍摄照片后计数器达到 1 时立即录制声音。

static int counter;
//counter will always be zero it think unless it is assigned.


if (counter == 0){

dispatch_async([self sessionQueue], ^{
// Update the orientation on the still image output video connection before capturing.
[[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]];

// Flash set to Auto for Still Capture
[AVCamViewController setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]];

// Capture a still image.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {

if (imageDataSampleBuffer)
{//[AVCaptureSession snapStillImage];
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
[[[ALAssetsLibrary alloc] init] writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:nil];
}
NSLog(@"i");
}];
});

if (!_audioRecorder.recording)
{
//start recording as part of still image

_playButton.enabled = NO;
_stopButton.enabled = YES;
[_audioRecorder record];

for(int i=0;i<1000;i++)
{
//do nothing just counting
}

//stop the recording
}

}

else if (counter == 1)

{
[self recordForDuration:5];
}


}

最佳答案

这个错误是因为你使用了模拟器,你需要使用设备

问候

关于ios - 错误域=AVFoundationErrorDomain 代码=-11814 "Cannot Record",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24176738/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com