AVCamManual.AVCamManualCameraViewController.OnRecordClicked C# (CSharp) Метод

OnRecordClicked() приватный Метод

private OnRecordClicked ( NSObject sender ) : void
sender NSObject
Результат void
		public void OnRecordClicked (NSObject sender)
		{
			// Disable the Camera button until recording finishes, and disable the Record button until recording starts or finishes (see the AVCaptureFileOutputRecordingDelegate methods)
			CameraButton.Enabled = false;
			RecordButton.Enabled = false;
			CaptureModeControl.Enabled = false;

			// Retrieve the video preview layer's video orientation on the main queue before entering the session queue. We do this to ensure UI
			// elements are accessed on the main thread and session configuration is done on the session queue.
			var previewLayer = (AVCaptureVideoPreviewLayer)PreviewView.Layer;
			AVCaptureVideoOrientation previewLayerVideoOrientation = previewLayer.Connection.VideoOrientation;

			sessionQueue.DispatchAsync (() => {
				if (!movieFileOutput.Recording) {
					// tODO: fix comment
					// Setup background task. This is needed because the -[captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error:]
					// callback is not received until AVCamManual returns to the foreground unless you request background execution time.
					// This also ensures that there will be time to write the file to the photo library when AVCamManual is backgrounded.
					// To conclude this background execution, -endBackgroundTask is called in
					// -[captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error:] after the recorded file has been saved.
					if (UIDevice.CurrentDevice.IsMultitaskingSupported)
						backgroundRecordingID = UIApplication.SharedApplication.BeginBackgroundTask (null);

					var connection = movieFileOutput.ConnectionFromMediaType (AVMediaType.Video);
					connection.VideoOrientation = PreviewLayer.Connection.VideoOrientation;

					// Start recording to a temporary file.
					string movFile = Path.ChangeExtension (Path.GetRandomFileName (), "mov");
					string outputFilePath = Path.Combine (Path.GetTempPath (), movFile);
					movieFileOutput.StartRecordingToOutputFile (NSUrl.FromFilename (outputFilePath), this);
				} else {
					movieFileOutput.StopRecording ();
				}
			});
		}