I'm trying to add two inputs to a QTCaptureSession in the following:
mainSession = [[QTCaptureSession alloc] init];
BOOL success;
NSError* error;
QTCaptureDevice *videoDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:@"QTMediaTypeVideo"];
success = [videoDevice open:&error];
QTCaptureDevice *audioDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:@"QTMediaTypeSound"];
success = [audioDevice open:&error];
//video = [[QTCaptureDeviceInput alloc] initWithDevice:videoDevice];
//success = [mainSession addInput:video error:&error];
//audio = [[QTCaptureDeviceInput alloc] initWithDevice:audioDevice];
//success = [mainSession addInput:audio error:&error];
output = [[QTCaptureMovieFileOutput alloc] init];
success = [mainSession addOutput:output error:&error];
[output setDelegate:self];
[movieView setCaptureSession:mainSession];
[mainWindow makeKeyAndOrderFront:NSApp];
[mainSession startRunning];
I've determined that the commented out part is the sources of the error:
[QTCaptureDeviceInput initWithDevice:]-
cannot intialize device input with device that is not open.
I've probed my "success" variable after the open methods and it is yes. So why does the method think the device isn't open?