I’m using an AVCaptureView on OS X 10.10 to read a QR code from the camera 
(i.e. the built-in one on my MacBook Pro.) Everything’s working — my delegate 
receives frames, and using a CIDetector it can read a QR code held up to the 
camera — except that the view doesn’t show the video from the camera. Instead 
it just shows an icon of a camera with a line through it and the message “No 
camera selected.” Which is clearly bogus because the camera _is_ selected, its 
LED is on, and video _is_ being captured by the session and sent to my delegate.

Below is my code that sets up the view. What am I missing?

(Feel free to tell me to take this to another list, but 

    AVCaptureSession* session = [[AVCaptureSession alloc] init];
    AVCaptureDevice* video = [AVCaptureDevice defaultDeviceWithMediaType: 
AVMediaTypeVideo];
    AVCaptureDeviceInput* input = [AVCaptureDeviceInput deviceInputWithDevice: 
video error: NULL];
    [session addInput: input];

    AVCaptureVideoDataOutput* output = [[AVCaptureVideoDataOutput alloc] init];
    [output setSampleBufferDelegate: self queue: dispatch_get_main_queue()];
    output.alwaysDiscardsLateVideoFrames = YES;
    [session addOutput: output];

    [session startRunning];

    [captureView setSession: session showVideoPreview: YES showAudioPreview: 
NO];

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to