public override void DidOutputSampleBuffer(AVCaptureOutput captureOutput, CMSampleBuffer sampleBuffer, AVCaptureConnection connection) { try { // render the image into the debug preview pane UIImage image = getImageFromSampleBuffer(sampleBuffer); // event the capture up OnImageCaptured(image); // make sure AVFoundation does not run out of buffers sampleBuffer.Dispose(); } catch (Exception ex) { string exceptionText = ErrorHandling.GetExceptionDetailedText(ex); string errorMessage = $"Failed to process image capture: {exceptionText}"; OnCaptureError(errorMessage); } }
void StartStopCapture() { if (isCapturing == false) { try { Capture(); if (isCapturing) { buttonStartStop.Title = "Stop"; } } catch (Exception ex) { LogMessage(string.Format("Failed to start capture: {0}", ErrorHandling.GetExceptionDetailedText(ex))); } } else { StopCapture(); buttonStartStop.Title = "Start"; } }
public override void FinishedRecording ( AVCaptureFileOutput captureOutput, NSUrl outputFileUrl, NSObject[] connections, NSError nsError ) { try { finishedRecordingInternal(captureOutput, outputFileUrl, connections, nsError); } catch (Exception ex) { string errorMessage = string.Format("Exception during movie recording finish handler: {0}", ErrorHandling.GetExceptionDetailedText(ex)); onCaptureError(errorMessage); } }
private void handleMediaFileSelected(object sender, FileSelectedEventArgs args) { NavigationController.PopToViewController(this, true); try { MPMoviePlayerController player = new MPMoviePlayerController(); player = new MPMoviePlayerController(NSUrl.FromFilename(args.File)); player.AllowsAirPlay = true; this.View.AddSubview(player.View); player.SetFullscreen(true, true); player.PrepareToPlay(); player.Play(); } catch (Exception ex) { string message = string.Format("Error during playback of {0}: {1}", Path.GetFileName(args.File), ErrorHandling.GetExceptionDetailedText(ex)); logMessage(message); } }