예제 #1
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     Task.Run(async() => await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await CleanupCameraAsync();
     }));
 }
예제 #2
0
 private async void CaptureMedia_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await sender.StopRecordAsync();
     });
 }
예제 #3
0
        /// <summary>
        /// Callback function for any failures in MediaCapture operations
        /// </summary>
        /// <param name="currentCaptureObject"></param>
        /// <param name="currentFailure"></param>
        private async void mediaCapture_Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                try
                {
                    //status.Text = "MediaCaptureFailed: " + currentFailure.Message;

                    if (isRecording)
                    {
                        await mediaCapture.StopRecordAsync();
                        //status.Text += "\n Recording Stopped";
                    }
                }
                catch (Exception)
                {
                }
                //finally
                //{
                //    SetInitButtonVisibility(Action.DISABLE);
                //    //status.Text += "\nCheck if camera is diconnected. Try re-launching the app";
                //}
            });

            //face_init.IsEnabled = true;
            //identify_init.IsEnabled = false;
            //traingroup.IsEnabled = false;
            //detect_init.IsEnabled = false; //generate the person group
            //traingroup.IsEnabled = false;
            //cleanup.IsEnabled = true;
        }
예제 #4
0
        /// <summary>
        /// Callback function for any failures in MediaCapture operations
        /// </summary>
        /// <param name="currentCaptureObject"></param>
        /// <param name="currentFailure"></param>
        private async void mediaCapture_Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                try
                {
                    status.Text = "MediaCaptureFailed: " + currentFailure.Message;

                    if (isRecording)
                    {
                        await mediaCapture.StopRecordAsync();
                        status.Text += "\n Recording Stopped";
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    SetInitButtonVisibility(Action.DISABLE);
                    SetVideoButtonVisibility(Action.DISABLE);
                    SetAudioButtonVisibility(Action.DISABLE);
                    status.Text += "\nCheck if camera is diconnected. Try re-launching the app";
                }
            });
        }
예제 #5
0
        private void Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
        {
            CatastrophicFailure = true;
            FailureException    = new Exception(string.Format("Code: {0}. {1}", currentFailure.Code, currentFailure.Message));

            base.Stop();
        }
예제 #6
0
 /// <summary>
 ///  Handler for the wrapped MediaCapture object's Failed event. It just wraps and forward's MediaCapture's
 ///  Failed event as own CaptureFailed event
 /// </summary>
 private void mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     if (CaptureFailed != null && forwardEvents)
     {
         CaptureFailed(this, errorEventArgs);
     }
 }
 async void Device_CaptureFailed(object sender, MediaCaptureFailedEventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
     {
         rootPage.NotifyUser(e.Message, NotifyType.ErrorMessage);
     }));
 }
예제 #8
0
 private void OnMediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     var ignore = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await DisposeCaptureAsync();
     });
 }
 private void OnCameraFailed(object sender, MediaCaptureFailedEventArgs e)
 {
     if (CameraFailed != null)
     {
         CameraFailed(sender, e);
     }
 }
 private void mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     var action = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         //  progressText.Text = "MediaCapture failed: " + errorEventArgs.Message;
     });
 }
예제 #11
0
 private async void mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         DisableButtons();
     });
 }
예제 #12
0
 private async void Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ShowStatusMessage("Fatal error" + currentFailure.Message);
     });
 }
예제 #13
0
        private async void _mediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);
            await CleanupCameraAsync();

            tip.Stop();
        }
예제 #14
0
        private async void cameraCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            // It's safest to return this back onto the UI thread to show the message dialog.
            MessageDialog dialog = new MessageDialog(errorEventArgs.Message);

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                           async() => { await dialog.ShowAsync(); });
        }
예제 #15
0
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

            await CleanupCameraAsync();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => GetPreviewFrameButton.IsEnabled = _isPreviewing);
        }
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

            await CleanupCameraAsync();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateCaptureControls());
        }
예제 #17
0
 private async void MediaCaptureOnFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
     {
         var warningMessage = new MessageDialog(String.Format("The audio capture failed: {0}", errorEventArgs.Message), "Capture Failed");
         await warningMessage.ShowAsync();
     });
 }
예제 #18
0
 private async void CaptureMedia_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
     {
         var warningMessage = new MessageDialog("The media recording Failed " + errorEventArgs.Message, "Capture Failed");
         await warningMessage.ShowAsync();
     });
 }
 void capture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     // Dispatch call to the UI thread since the event may get fired on some other thread
     var ignore = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await DisposeCaptureAsync();
     });
 }
예제 #20
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs e)
 {
     var task = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         IsRecording  = false;
         IsPreviewing = false;
         await CleanupCameraAsync();
     });
 }
        private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

            await CleanupAsync();

            IsFailed = true;
            //TODO: Inform Exception;
        }
        private void OnTestedControlCameraFailed(object sender, MediaCaptureFailedEventArgs e)
        {
            if (this.IsInVisualTree())
            {
#pragma warning disable 4014
                new MessageDialog(e != null ? e.Message : "Camera Capture Failed", "Error").ShowAsync();
#pragma warning restore 4014
            }
        }
예제 #23
0
 /// <summary>
 /// Callback function for any failures in MediaCapture operations
 /// </summary>
 /// <param name="currentCaptureObject"></param>
 /// <param name="currentFailure"></param>
 private async void mediaCapture_Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         SetInitButtonVisibility(Action.DISABLE);
         SetVideoButtonVisibility(Action.DISABLE);
         WriteLog("Check if camera is diconnected. Try re-launching the app");
     });
 }
예제 #24
0
        private void mediaCaptureFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
        {
            if (parent != null)
            {
                parent.StartWritingOutputExtended("Record Webcam Failed : " + errorEventArgs.Message, 1);
            }

            mediaCapture.Dispose();
            mediaCapture = null;
        }
예제 #25
0
        /// <summary>
        /// Callback function for any failures in MediaCapture operations
        /// </summary>
        /// <param name="currentCaptureObject"></param>
        /// <param name="currentFailure"></param>
        private async void mediaCapture_Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
        {
            await SendResponse("MediaCaptureFailed: " + currentFailure.Message).ConfigureAwait(false);

            if (isRecording)
            {
                await mediaCapture.StopRecordAsync();
                await SendResponse("Recording Stopped").ConfigureAwait(false);
            }
        }
예제 #26
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs e)
 {
     var task = _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         MainPage.Current.LogMessage("Preview stopped: " + e.Message);
         IsRecording  = false;
         IsPreviewing = false;
         await CleanupCameraAsync();
     });
 }
예제 #27
0
 private async void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     if (_state == StreamingState.Streaming)
     {
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             ChangeStateAsync(StreamingState.Idle);
         });
     }
 }
예제 #28
0
 private void CaptureFailedEventHandler(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     if (isRecording)
     {
         capture.RecordLimitationExceeded -= RecordLimitExceedEventHandler;
         capture.Failed -= CaptureFailedEventHandler;
         isRecording     = false;
         Close();
     }
 }
예제 #29
0
 private void MediaCapture_Failed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
 {
     Task.Run(async() => await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await CleanupCameraAsync();
         if (this._frameProcessingTimer != null)
         {
             this._frameProcessingTimer.Cancel();
         }
     }));
 }
        //private static async Task<DeviceInformation> FindBestCameraAsync()
        //{
        //    var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

        //    Debug.WriteLine($"{devices.Count} devices found");

        //    // If there are no cameras connected to the device
        //    if (devices.Count == 0)
        //        return null;

        //    // If there is only one camera, return that one
        //    if (devices.Count == 1)
        //        return devices.FirstOrDefault();

        //    //check if the preferred device is available
        //    var frontCamera = devices.FirstOrDefault(x => x.EnclosureLocation != null && x.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Front);

        //    //if front camera is available return it, otherwise pick the first available camera
        //    return frontCamera ?? devices.FirstOrDefault();
        //}

        private async void Failed(MediaCapture currentCaptureObject, MediaCaptureFailedEventArgs currentFailure)
        {
            await TaskUtilities.RunOnDispatcherThreadAsync(async() =>
            {
                await new MessageDialog(currentFailure.Message, "MediaCaptureFailed Fired").ShowAsync();

                await DisposeMediaCaptureAsync();

                ReloadVideoStreamButton.Visibility = Visibility.Visible;
            });
        }