Resolved: Baffled by AVCaptureVideoPreviewLayer
Resolved: Baffled by AVCaptureVideoPreviewLayer
- Subject: Resolved: Baffled by AVCaptureVideoPreviewLayer
- From: "email@hidden" <email@hidden>
- Date: Thu, 02 Aug 2012 13:32:56 -0400
Found the problem
movieLayer = [[self mMovieView] layer];
must be preceeded by
[[self mMovieView] setWantsLayer:Yes]
Joseph
On Aug 1, 2012, at 6:05 PM, email@hidden <email@hidden> wrote:
> I'm having trouble getting AVCaptureVideoPreviewLayer to work in OSX 10.8, XCode 4.4 . I'm trying to use the NSView mMovieView as the port.
>
> @property (nonatomic, strong) IBOutlet NSView *mMovieView;
> @property (nonatomic, strong) IBOutlet CALayer *movieLayer;
>
> movieLayer = [[self mMovieView] layer];
> [movieLayer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
> AVCaptureVideoPreviewLayer *newPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]];
> [newPreviewLayer setFrame:[movieLayer bounds]];
> [movieLayer addSublayer:newPreviewLayer];
>
> DLog(@"captureSession inputs are %@",captureSession.inputs);
> DLog(@"captureSession outputs are %@",captureSession.outputs);
>
> [captureSession startRunning];
>
> DLog(@"AVCapture Session Started");
>
> At the console, I see:
> 2012-08-01 17:32:53.919 Roboplasm[15629:303] -[MovieController setupAVCapture] captureSession inputs are (
> "<AVCaptureDeviceInput: 0x10e889390 [FaceTime HD Camera (Built-in)]>",
> "<AVCaptureDeviceInput: 0x101af69b0 [Built-in Input]>"
> )
> 2012-08-01 17:32:53.920 Roboplasm[15629:303] -[MovieController setupAVCapture] captureSession outputs are (
> )
> 2012-08-01 17:33:04.973 Roboplasm[15629:303] __37-[MovieController captureSessionInit]_block_invoke_085 did start running
> 2012-08-01 17:33:04.974 Roboplasm[15629:303] -[MovieController setupAVCapture] AVCapture Session Started
>
> But no video preview. Any idea what's up.
>
> Thanks,
> Joseph Ayers
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden