I am trying to add the Front Camera as a subView to my existing View Controller. I would like to set a frame for it, and be able to emulate the way a FaceTime call would look, with the Front Camera showing in the corner. Here is what I have tried so far.
AVCaptureSession *captureSession = [AVCaptureDeviceInput
deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]
error:nil];;
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
UIView *aView = self.view;
previewLayer.frame = aView.bounds;
[aView.layer addSublayer:previewLayer];
But, this crashes with:
[AVCaptureDeviceInput setVideoPreviewLayer:]: unrecognized selector sent to instance
Any thoughts? I don't need to actually record, just need to see the Front Camera on a smaller screen within the viewcontroller.