I have an app that I want to just show a preview of the iSight camera. I am trying to use QTCaptureView
to accomplish this. I have the QTCaptureView
window linked in interface builder to the correct variables in my class. I can see the green light on my iSight camera turn on, but I get just a black screen in the app. I have a friend who knows AppleScript that can use the same lines of code converted to AppleScript Objective-C, and it will display the iSight preview within the app.
Here is the code:
self.iSightSession = [[QTCaptureSession alloc]init];
QTCaptureDevice *iSight = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
[iSight open:nil];
QTCaptureDeviceInput *iSightInput = [QTCaptureDeviceInput deviceInputWithDevice:iSight];
[self.iSightSession addInput:iSightInput error:nil];
QTCaptureDecompressedVideoOutput *iSightOutput = [[QTCaptureDecompressedVideoOutput alloc]init];
[self.iSightSession addOutput:iSightOutput error:nil];
[self.iSightCaptureView setCaptureSession:self.iSightSession];
[self.iSightSession startRunning];