public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { var result = new VideoCaptureResult(); if (IsRecording) { result.resultType = CaptureResultType.UnknownError; onStartedRecordingVideoCallback?.Invoke(result); } else { try { var behaviour = m_CaptureContext.GetBehaviour(); ((NRRecordBehaviour)behaviour).SetOutPutPath(filename); m_CaptureContext.StartCapture(); IsRecording = true; result.resultType = CaptureResultType.Success; onStartedRecordingVideoCallback?.Invoke(result); } catch (Exception) { result.resultType = CaptureResultType.UnknownError; onStartedRecordingVideoCallback?.Invoke(result); throw; } } }
//----------------------------------------------------------------- public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { if (onStartedRecordingVideoCallback == null) { throw new ArgumentNullException("onStartedRecordingVideoCallback"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename"); } string directory = System.IO.Path.GetDirectoryName(filename); if (!string.IsNullOrEmpty(directory) && !System.IO.Directory.Exists(directory)) { throw new ArgumentException("The specified directory does not exist.", "filename"); } System.IO.FileInfo fileInfo = new System.IO.FileInfo(filename); if (fileInfo.Exists && fileInfo.IsReadOnly) { throw new ArgumentException("Cannot write to the file because it is read-only.", "filename"); } // WinRT requires the full file path; so pass in the FullName in case filename isn't an absolute path // This also takes care of switching '/' separators to '\' StartRecordingVideoToDisk_Internal(fileInfo.FullName, onStartedRecordingVideoCallback); }
//----------------------------------------------------------------- public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { if (onStartedRecordingVideoCallback == null) { throw new ArgumentNullException("onStartedRecordingVideoCallback"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename"); } // Make sure we don't have any forward slashes. // WinRT Apis do not like forward slashes. filename = filename.Replace("/", @"\"); string directory = System.IO.Path.GetDirectoryName(filename); if (!string.IsNullOrEmpty(directory) && !System.IO.Directory.Exists(directory)) { throw new ArgumentException("The specified directory does not exist.", "filename"); } System.IO.FileInfo fileInfo = new System.IO.FileInfo(filename); if (fileInfo.Exists && fileInfo.IsReadOnly) { throw new ArgumentException("Cannot write to the file because it is read-only.", "filename"); } StartRecordingVideoToDisk_Internal(filename, onStartedRecordingVideoCallback); }
public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { if (IsRecording) { if (onStartedRecordingVideoCallback != null) { var result = new VideoCaptureResult(); result.resultType = CaptureResultType.UnknownError; onStartedRecordingVideoCallback(result); } return; } m_RecordBehaviour.SetOutPutPath(filename); m_RecordBehaviour.StartRecord(); if (onStartedRecordingVideoCallback != null) { var result = new VideoCaptureResult(); result.resultType = CaptureResultType.Success; onStartedRecordingVideoCallback(result); } IsRecording = true; }
public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { if (this.m_NativePtr == IntPtr.Zero) { throw new InvalidOperationException("You must create a Video Capture Object before recording video."); } if (onStartedRecordingVideoCallback == null) { throw new ArgumentNullException("onStartedRecordingVideoCallback"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename"); } filename = filename.Replace("/", @"\"); string directoryName = Path.GetDirectoryName(filename); if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName)) { throw new ArgumentException("The specified directory does not exist.", "filename"); } this.StartRecordingVideoToDisk_Internal(this.m_NativePtr, filename, onStartedRecordingVideoCallback); }
private static void InvokeOnStartedRecordingVideoToDiskDelegate(OnStartedRecordingVideoCallback callback, long hResult) { callback(MakeCaptureResult(hResult)); }
private extern void StartRecordingVideoToDisk_Internal(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback);
private extern void StartRecordingVideoToDisk_Internal(IntPtr videoCaptureObj, string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback);
public void StartRecordingAsync(string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback) { if (this.m_NativePtr == IntPtr.Zero) { throw new InvalidOperationException("You must create a Video Capture Object before recording video."); } if (onStartedRecordingVideoCallback == null) { throw new ArgumentNullException("onStartedRecordingVideoCallback"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename"); } filename = filename.Replace("/", @"\"); string directoryName = Path.GetDirectoryName(filename); if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName)) { throw new ArgumentException("The specified directory does not exist.", "filename"); } this.StartRecordingVideoToDisk_Internal(this.m_NativePtr, filename, onStartedRecordingVideoCallback); }
private static void InvokeOnStartedRecordingVideoToDiskDelegate(OnStartedRecordingVideoCallback callback, long hResult) { callback(MakeCaptureResult(hResult)); }
private extern void StartRecordingVideoToDisk_Internal(IntPtr videoCaptureObj, string filename, OnStartedRecordingVideoCallback onStartedRecordingVideoCallback);