public void PauseCaptureSession() { if (captureSession.Running) { captureSession.StopRunning(); } }
public Task StopStreamingAsync() { if (session != null && session.Running) { session.StopRunning(); } return(Task.FromResult <object>(null)); }
void StopCaptureSession() { m_queue.DispatchAsync(delegate() { m_session.StopRunning(); }); }
void DisableCameraView() { captureSession?.StopRunning(); ReleaseCaptureSession(); ReleaseCaptureDevice(); ReleasePreviewLayer(); }
void UserKnocked() { _state.didKnock = true; if (_state.CountDown > 0 && _state.CountDown < 5 && _state.PublishToTwitter == false) { _state.PublishToTwitter = true; session.StopRunning(); session.Dispose(); session = null; outputRecorder.Dispose(); outputRecorder = null; queue.Dispose(); queue = null; //Stop Both Timers AudioLoop.Invalidate(); timer.Invalidate(); //Stop Recording StopRecording(); //Start up Resording NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(10), AudioReset); NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(1), PostToTwitter); _state.PublishToTwitter = true; _state.TopLabel.Text = ""; _state.BottomLabel.Text = "Posted to Twitter!"; imgYouRock.Hidden = false; } }
protected override void Dispose(bool disposing) { if (captureDeviceInput != null && captureSession != null) { captureSession.RemoveInput(captureDeviceInput); } if (captureDeviceInput != null) { captureDeviceInput.Dispose(); captureDeviceInput = null; } if (captureSession != null) { captureSession.StopRunning(); captureSession.Dispose(); captureSession = null; } if (stillImageOutput != null) { stillImageOutput.Dispose(); stillImageOutput = null; } base.Dispose(disposing); }
public void stopCaptureSession() { if (captureSession != null) { captureSession.StopRunning(); } }
public void StopScan() { if (null != session) { session.StopRunning(); } }
public void StopScanning() { if (stopped) return; Console.WriteLine("Stopping..."); //Try removing all existing outputs prior to closing the session try { while (session.Outputs.Length > 0) session.RemoveOutput (session.Outputs [0]); } catch { } //Try to remove all existing inputs prior to closing the session try { while (session.Inputs.Length > 0) session.RemoveInput (session.Inputs [0]); } catch { } if (session.Running) session.StopRunning(); stopped = true; }
public void StopPreview() { if (captureSession.Running) { captureSession.StopRunning(); } IsPreviewing = false; }
public void stopCaptureSession() { if (captureSession != null) { captureSession.StopRunning(); } _stopFollowingDeviceOrientation(); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); if (_captureSession != null) { _captureSession.StopRunning(); } }
private void EndSession() { captureSession.StopRunning(); foreach (var i in captureSession.Inputs) { captureSession.RemoveInput(i); } }
public override void ViewWillDisappear(bool animated) { if (_captureSession != null && _captureSession.Running) { _captureSession.StopRunning(); } NavigationController.SetNavigationBarHidden(false, false); base.ViewWillDisappear(animated); }
private void StopRecording() { timer.Invalidate(); timer.Dispose(); timer = null; output.StopRecording(); weAreRecording = false; nfloat width = this.View.Frame.Size.Width; nfloat height = this.View.Frame.Size.Height; session.StopRunning(); btnStartRecording.RemoveFromSuperview(); btnCancelPage.RemoveFromSuperview(); this.View.AddSubview(activityIndicator); activityIndicator.StartAnimating(); }
public void StopCapture() { if (session != null) { StopHandlingFrames(); session.StopRunning(); session.Dispose(); } isCapturing = false; }
public override void ViewDidDisappear(bool animated) { sessionQueue.DispatchAsync(() => { if (setupResult == AVCamSetupResult.Success) { session.StopRunning(); sessionRunning = session.Running; RemoveObservers(); } }); base.ViewDidDisappear(animated); }
public override void ViewWillDisappear(bool animated) { session.StopRunning(); this.btnStartRecording.TouchUpInside -= startStopPushed; foreach (var view in this.View.Subviews) { view.RemoveFromSuperview(); } base.ViewWillDisappear(animated); }
public void StopScanning() { if (overlayView != null) { if (overlayView is ZXingDefaultOverlayView) { (overlayView as ZXingDefaultOverlayView).Destroy(); } overlayView = null; } if (stopped) { return; } Console.WriteLine("Stopping..."); if (outputRecorder != null) { outputRecorder.CancelTokenSource.Cancel(); } //Try removing all existing outputs prior to closing the session try { while (session.Outputs.Length > 0) { session.RemoveOutput(session.Outputs [0]); } } catch { } //Try to remove all existing inputs prior to closing the session try { while (session.Inputs.Length > 0) { session.RemoveInput(session.Inputs [0]); } } catch { } if (session.Running) { session.StopRunning(); } stopped = true; }
private void IsScannerActive(PropertyChangedEventArgs e) { if (e.PropertyName == nameof(barcodeScanner.IsScannerActive)) { if (barcodeScanner.IsScannerActive) { session.StartRunning(); } else { session.StopRunning(); } } }
public void StopPreviewing(object sender, EventArgs e) { if (XamRecorder.IsRecording) { throw new Exception("You can't stop previewing while you're recording."); } if (XamRecorder.IsPreviewing) { session.StopRunning(); XamRecorder.IsPreviewing = false; } }
void Initialize() { Configuration.IsScanning = true; SizeChange(); CaptureSession = new AVCaptureSession(); CaptureSession.BeginConfiguration(); this.Frame = new CGRect(0f, 0f, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Width); previewLayer = new AVCaptureVideoPreviewLayer(CaptureSession) { Frame = new CGRect(0f, 0f, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Width), VideoGravity = AVLayerVideoGravity.ResizeAspectFill, }; setPreviewOrientation(); var videoDevices = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video); var cameraPosition = AVCaptureDevicePosition.Back; //var cameraPosition = (cameraOptions == CameraOptions.Front) ? AVCaptureDevicePosition.Front : AVCaptureDevicePosition.Back; var device = videoDevices.FirstOrDefault(d => d.Position == cameraPosition); if (device == null) { return; } NSError error; var input = new AVCaptureDeviceInput(device, out error); CaptureSession.AddInput(input); CaptureSession.SessionPreset = AVFoundation.AVCaptureSession.Preset640x480; Layer.AddSublayer(previewLayer); CaptureSession.CommitConfiguration(); CaptureSession.StartRunning(); VideoDataOutput = new AVCaptureVideoDataOutput(); VideoDataOutput.AlwaysDiscardsLateVideoFrames = true; VideoDataOutput.WeakVideoSettings = new CVPixelBufferAttributes { PixelFormatType = CVPixelFormatType.CV32BGRA }.Dictionary; captureVideoDelegate = new CaptureVideoDelegate(); captureVideoDelegate.OnDetected += (list) => { this.OnDetected?.Invoke(list); CaptureSession.StopRunning(); }; VideoDataOutput.SetSampleBufferDelegateQueue(captureVideoDelegate, CoreFoundation.DispatchQueue.MainQueue); CaptureSession.AddOutput(VideoDataOutput); }
/// <summary> /// Stops the and dispose. /// </summary> public void StopAndDispose() { if (_device != null) { // if flash is on turn off if (_device.TorchMode == AVCaptureTorchMode.On) { SwitchFlash(false); } } _captureSession.StopRunning(); // dispose output elements _input.Dispose(); _output.Dispose(); }
public void StopScanning() { if (stopped) { return; } Console.WriteLine("Stopping..."); if (session.Running) { session.StopRunning(); } stopped = true; }
// This function captures a photo public async void CapturePhoto() { var videoConnection = stillImageOutput.ConnectionFromMediaType(AVMediaType.Video); var sampleBuffer = await stillImageOutput.CaptureStillImageTaskAsync(videoConnection); var jpegImageAsNsData = AVCaptureStillImageOutput.JpegStillToNSData(sampleBuffer); var image = new UIImage(jpegImageAsNsData); this.image = image; captureSession.StopRunning(); retakePictureClick = true; var normalAttributedTitle = new NSAttributedString("Retake Picture", foregroundColor: UIColor.White); takePhotoButton.SetAttributedTitle(normalAttributedTitle, UIControlState.Normal); }
private void StartSession(bool start) { try { if (start) { _AVSession?.StartRunning(); } else { _AVSession?.StopRunning(); } } catch (Exception ex) { Console.WriteLine("IOS_SCAN | error StartCamera to " + start, ex); } }
public void StopScanning() { if (_stopped) { return; } Console.WriteLine("Stopping..."); _outputRecorder?.CancelTokenSource.Cancel(); //Try removing all existing outputs prior to closing the session try { while (_session.Outputs.Length > 0) { _session.RemoveOutput(_session.Outputs[0]); } } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); } //Try to remove all existing inputs prior to closing the session try { while (_session.Inputs.Length > 0) { _session.RemoveInput(_session.Inputs[0]); } } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); } if (_session.Running) { _session.StopRunning(); } _stopped = true; }
void HideCameraPreview() { if (captureSession != null) { captureSession.StopRunning(); captureSession.RemoveOutput(stillImageOutput); captureSession.Dispose(); captureSession = null; } if (stillImageOutput != null) { stillImageOutput.Dispose(); stillImageOutput = null; } captureButton.Hidden = true; cancelButton.Hidden = true; }
public void StopCapture() { if (isCapturing == false) { return; } isCapturing = false; // stop recording if (shouldRecord) { stopMovieWriter(); } // stop the capture session session.StopRunning(); unsubscribeDelegateEvents(); }
protected override void Dispose(bool disposing) { if (disposing) { RemoveObservers(); if (_session != null) { if (_session.Running) { _session.StopRunning(); } PreviewLayer.Session = null; if (_videoDeviceInput != null) { _session.RemoveInput(_videoDeviceInput); _videoDeviceInput.Dispose(); _videoDeviceInput = null; } if (_movieFileOutput != null) { _session.RemoveOutput(_movieFileOutput); _movieFileOutput.Dispose(); _movieFileOutput = null; } if (_stillImageOutput != null) { _session.RemoveOutput(_stillImageOutput); _stillImageOutput.Dispose(); _stillImageOutput = null; } _session.Dispose(); } } base.Dispose(disposing); }
public override void ViewDidLoad () { base.ViewDidLoad (); session = new AVCaptureSession (); var camera = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video); var input = AVCaptureDeviceInput.FromDevice(camera); session.AddInput(input); output = new AVCaptureMetadataOutput(); var metadataDelegate = new MetadataOutputDelegate(); output.SetDelegate(metadataDelegate, DispatchQueue.MainQueue); session.AddOutput(output); output.MetadataObjectTypes = new NSString[] { AVMetadataObject.TypeQRCode, AVMetadataObject.TypeEAN13Code }; var previewLayer = new AVCaptureVideoPreviewLayer(session); //var view = new ContentView(UIColor.LightGray, previewLayer, metadataDelegate); previewLayer.MasksToBounds = true; previewLayer.VideoGravity = AVCaptureVideoPreviewLayer.GravityResizeAspectFill; previewLayer.Frame = UIScreen.MainScreen.Bounds; this.View.Layer.AddSublayer(previewLayer); metadataDelegate.MetadataFound += (s, e) => { session.StopRunning(); new UIAlertView("Scanned!",e.StringValue, null ,"OK",null).Show(); }; session.StartRunning(); }