これは私のアプリをフリーズさせる私のコードです
AVCaptureConnection *videoConnection = [videoOutput connectionWithMediaType:AVMediaTypeVideo];
if ([videoConnection isVideoOrientationSupported] )
{
[videoConnection setVideoOrientation:AVCaptureVideoOrientationPortrait];
}
これは私のvideoOutput初期化です
// Setup video capture
videoInput = [[AVCaptureDeviceInput deviceInputWithDevice: front? frontVideoDevice: rearVideoDevice error: &error] retain];
videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setAlwaysDiscardsLateVideoFrames: YES];
// Set the video output to store frame in BGRA (It is supposed to be faster)
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[videoOutput setVideoSettings:videoSettings];
2 回目にセッションを初期化するとアプリが応答しなくなりますが、avcaptureconnection のコードを削除すればすべて問題ありません
?