public static CaptureSession Create(SelfView parent) { // create a device input and attach it to the session var captureDevice = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video).FirstOrDefault(d => d.Position == AVCaptureDevicePosition.Front); if (captureDevice == null) { return(null); } var input = AVCaptureDeviceInput.FromDevice(captureDevice); if (input == null) { return(null); } var output = new AVCaptureMetadataOutput(); var cs = new CaptureSession(parent, input, output); // This must be set after the output is added to the sesssion output.MetadataObjectTypes = AVMetadataObjectType.Face; return(cs); }
public override async void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); // Only start video if we're not in the designer SelfView.Start(); // Give a second and then hide adornments await Task.Delay(TimeSpan.FromSeconds(1.5)); OnTapped(null); }
private CaptureSession(SelfView parent, AVCaptureDeviceInput input, AVCaptureMetadataOutput output) { this.parent = parent; this.queue = new DispatchQueue("myQueue"); this.session = new AVCaptureSession { SessionPreset = AVCaptureSession.PresetMedium }; session.AddInput(input); output.SetDelegate(this, queue); session.AddOutput(output); }
void ReleaseDesignerOutlets() { if (CallButton != null) { CallButton.Dispose(); CallButton = null; } if (CallView != null) { CallView.Dispose(); CallView = null; } if (NavBar != null) { NavBar.Dispose(); NavBar = null; } if (NoveltyBottomConstraint != null) { NoveltyBottomConstraint.Dispose(); NoveltyBottomConstraint = null; } if (NoveltyLeadingConstraint != null) { NoveltyLeadingConstraint.Dispose(); NoveltyLeadingConstraint = null; } if (NoveltyList != null) { NoveltyList.Dispose(); NoveltyList = null; } if (SelfView != null) { SelfView.Dispose(); SelfView = null; } if (TapRecognizer != null) { TapRecognizer.Dispose(); TapRecognizer = null; } }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); SelfView.Stop(); }