How to capture photos/videos with iSight and Objective-C

Objective-C posted about 1 year ago by christian

There are plenty of resources online that explain how to access iSight:

This article explains how to use QuartzComposer for capturing images with iSight. The benefit of using QuartzComposer is that you don’t have to write a lot of code to capture an image. All you have to do is setup a QCView with IB and bind it to an outlet, then to get the snapshot you call this method:

   1  NSImage *screenshot = [isightView snapshotImage];

Alternatively, you could also use:

   1  - (id) createSnapshotImageOfType:(NSString*)type

The code in the article didn’t work for me:

   1  NSImage *currentImage = [qcView valueForOutputKey:@"ImageOutput"]; 

The article also forgot to mention that you have to import and link to the following frameworks:

   1  #import <QuartzCore/QuartzCore.h>
   2  #import <Quartz/Quartz.h>

Haven’t tried this one yet.

This example is not complete.

Have a look at one of the demos like StillMotion

Tagged cocoa, isight, objective-c, record