public async Task PreviewStart() { if (!cameraCapture.IsInitialized) { await cameraCapture.Initialize(captureElement); } if (!cameraCapture.IsPreviewActive) { await cameraCapture.Start(); } IsPreviewActive = cameraCapture.IsPreviewActive; UpdateProcessing(); }
private async void ButtonPreview_Click(object sender, RoutedEventArgs e) { await _cameraCapture.Initialize(CaptureElementPreview); await InitializeFaceDetection(); if (_cameraCapture.IsInitialized) { await UpdatePreviewState(); UpdateUi(); } else { Debug.WriteLine("Video capture device could not be initialized"); } }
private async Task UpdatePreviewState() { await cameraCapture.Initialize(CaptureElementPreview); if (cameraCapture.IsInitialized) { if (!cameraCapture.IsPreviewActive) { await cameraCapture.Start(); BeginProcessing(); } else { await cameraCapture.Stop(); } } }