4
이 내 머리를하고있다가로 앱에서 화면에 비디오를 녹화하는 방법은 무엇입니까?
내가이 샘플 프로젝트에서 일하고있다 :. https://github.com/jj0b/AROverlayExample
이 완벽하게 작동합니다. 유일한 문제는 초상화 응용 프로그램입니다. 따라서 장치를 가로 방향으로 회전 시키면 비디오가 계속 표시되지만 내 레이블과 UI는 모두 옆으로 향하게됩니다.
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
assert(self.autoresizesSubviews);
CGPoint layerRectCenter = CGPointMake(CGRectGetMidX(frame),
CGRectGetMidY(frame));
// Initialization code
self.captureSession = [[[AVCaptureSession alloc] init] autorelease];
// addVideoInput
{
AVCaptureDevice* videoDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo];
if (videoDevice)
{
NSError *error;
AVCaptureDeviceInput* videoIn = [AVCaptureDeviceInput deviceInputWithDevice: videoDevice error:&error];
if (! error)
{
if ([self.captureSession canAddInput:videoIn])
[self.captureSession addInput:videoIn];
else
NSLog(@"Couldn't add video input");
}
else
NSLog(@"Couldn't create video input");
}
else
NSLog(@"Couldn't create video capture device");
}
// addVideoPreviewLayer
{
self.previewLayer = [[[AVCaptureVideoPreviewLayer alloc] initWithSession: self.captureSession] autorelease];
self.previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
self.previewLayer.frame = CGRectMake(0, 0, 480, 300);
self.previewLayer.orientation = AVCaptureVideoOrientationLandscapeRight;
//self.previewLayer.frame = frame;
[self.layer addSublayer: self.previewLayer];
}
// run!
[self.captureSession startRunning];
}
return self;
}
: 여기
내 코드입니다 :
는
문제는 이것이다 나는 단지의 Info.plist에 풍경을 설정하고있어이 문제를 해결하려면
이유를 알 수 없습니다. 비디오는 가로로 표시되며 특별히 가로 프레임 CGRectMake (0, 0, 480, 300)로 레이어 프레임을 설정 함에도 불구하고 다른 방향으로 나옵니다.
이 AVcapturePreviewlayer이 스크린 샷에 기록? –
은 화면 캡처 비디오에 기록 된 AVcapturePreviewlayer입니다. –
나는 곤경에 처해있다! –