我想在兩個UIView中彼此相鄰顯示iPad2的前置攝像頭和後置攝像頭的流。 要流一個設備的所述圖像I使用以下代碼運行多個AVCaptureSessions或添加多個輸入
AVCaptureDeviceInput *captureInputFront = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] error:nil];
AVCaptureSession *session = [[AVCaptureSession alloc] init];
session addInput:captureInputFront];
session setSessionPreset:AVCaptureSessionPresetMedium];
session startRunning];
AVCaptureVideoPreviewLayer *prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
prevLayer.frame = self.view.frame;
[self.view.layer addSublayer:prevLayer];
這對於任一照相機正常工作。 要並行顯示流,我嘗試創建另一個會話,但第二個會話建立後,第一個會凍結。
然後我試着將兩個AVCaptureDeviceInput添加到會話中,但似乎目前最多隻支持一個輸入。
任何有用的想法如何從兩個相機流?
可能的重複[如何讓自動對焦在第二個AVCaptureSession中工作而不重新創建會話?](http://stackoverflow.com/questions/5427561/how-can-i-get-autofocus-to-work -in-a-second-avcapturesession-without-recreating) –