Example #1
0
        public void startRecording()
        {
            try
            {
                // Connect fileSink to captureSource.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Started)
                {
                    captureSource.Stop();
                    fileSink.CaptureSource           = captureSource;
                    fileSink.IsolatedStorageFileName = isoVideoFileName.ToString() + ".mp4";
                    System.Diagnostics.Debug.WriteLine(isoVideoFileName.ToString() + ".mp4");
                }

                // Begin recording.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Stopped)
                {
                    captureSource.Start();
                    _isRecording = true;
                    System.Diagnostics.Debug.WriteLine("Recording");
                }
            }
            catch
            { return; }
        }
Example #2
0
        // Set recording state: start recording.
        private void StartVideoRecording()
        {
            try
            {
                // Connect fileSink to captureSource.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Started)
                {
                    captureSource.Stop();

                    // Connect the input and output of fileSink.
                    fileSink.CaptureSource           = captureSource;
                    fileSink.IsolatedStorageFileName = isoVideoFileName;
                }

                // Begin recording.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Stopped)
                {
                    captureSource.Start();
                }

                // Set the button states and the message.
                UpdateUI(ButtonState.Recording, "Recording...");
            }

            // If recording fails, display an error.
            catch (Exception e)
            {
                this.Dispatcher.BeginInvoke(delegate()
                {
                    txtDebug.Text = "ERROR: " + e.Message.ToString();
                });
            }
        }
        // Set the recording state: display the video on the viewfinder.
        private void StartVideoPreview()
        {
            ThreadPool.QueueUserWorkItem(state =>
            {
                Thread.Sleep(100);
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    try
                    {
                        // Display the video on the viewfinder.
                        if (_captureSource.VideoCaptureDevice != null &&
                            _captureSource.State == CaptureState.Stopped)
                        {
                            // Add _captureSource to videoBrush.
                            //ViewfinderBrush = new VideoBrush();
                            //ViewfinderBrush.Transform = new CompositeTransform { CenterX = 0.5, CenterY = 0.5 };
                            ViewfinderBrush.SetSource(_captureSource);

                            // Add videoBrush to the visual tree.
                            //Viewfinder.Fill = ViewfinderBrush;

                            _captureSource.Start();

                            // Set the button states and the message.
                            UpdateUI(ButtonState.Ready, AppResources.ReadyToRecord);
                        }
                    }
                    // If preview fails, display an error.
                    catch (Exception e)
                    {
                        DebugText.Text = AppResources.Error.ToUpperInvariant() + ": " + e.Message;
                    }
                });
            });
        }
Example #4
0
        public void StartWebCam()
        {
            _captureSource = new CaptureSource();
            _captureSource.CaptureImageCompleted += new EventHandler <CaptureImageCompletedEventArgs>(_captureSource_CaptureImageCompleted);
            _captureSource.VideoCaptureDevice     = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

            try
            {
                // Start capturing
                if (_captureSource.State != CaptureState.Started)
                {
                    // Create video brush and fill the WebcamVideo rectangle with it
                    var vidBrush = new VideoBrush();
                    vidBrush.Stretch = Stretch.Uniform;
                    vidBrush.SetSource(_captureSource);
                    WebcamVideo.Fill = vidBrush;

                    // Ask user for permission and start the capturing
                    if (CaptureDeviceConfiguration.RequestDeviceAccess())
                    {
                        _captureSource.Start();
                    }
                }
            }
            catch (InvalidOperationException)
            {
                InfoTextBox.Text = "Web Cam already started - if not, I can't find it...";
            }
            catch (Exception)
            {
                InfoTextBox.Text = "Could not start web cam, do you have one?";
            }
        }
Example #5
0
        private void InitializeCaptureSource()
        {
            if (captureSource != null)
            {
                captureSource.Stop();
            }
            captureSource = new CaptureSource();
            captureSource.AudioCaptureDevice = (AudioCaptureDevice)listBoxAudioSources.SelectedItem;

            MediaDeviceConfig.SelectBestAudioFormat(captureSource.AudioCaptureDevice);

            captureSource.AudioCaptureDevice.DesiredFormat = captureSource.AudioCaptureDevice.SupportedFormats
                                                             .First(format => format.BitsPerSample == AudioConstants.BitsPerSample &&
                                                                    format.WaveFormat == WaveFormatType.Pcm &&
                                                                    format.Channels == 1 &&
                                                                    format.SamplesPerSecond == sampleRate);
            captureSource.AudioCaptureDevice.AudioFrameSize = AudioFormat.Default.MillisecondsPerFrame;             // 20 milliseconds

            audioSink = new TestAudioSinkAdapter(captureSource, new NullAudioController());
            audioSink.RawFrameAvailable       += audioSink_RawFrameAvailable;
            audioSink.ProcessedFrameAvailable += audioSink_FrameArrived;

            ClientLogger.Debug("Checking device access.");
            if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                savedFramesForDebug = new List <byte[]>();
                captureSource.Start();
                ClientLogger.Debug("CaptureSource started.");
            }
        }
Example #6
0
        public void start()
        {
            if (captureSource == null)
            {
                // Create the VideoRecorder objects.
                captureSource = new CaptureSource();
                fileSink      = new FileSink();

                videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

                // Add eventhandlers for captureSource.
                captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);

                // Initialize the camera if it exists on the device.
                if (videoCaptureDevice != null)
                {
                    // Create the VideoBrush for the viewfinder.
                    videoRecorderBrush = new VideoBrush();
                    videoRecorderBrush.SetSource(captureSource);
                    videoRecorderBrush.RelativeTransform = new CompositeTransform()
                    {
                        CenterX = 0.5, CenterY = 0.5, Rotation = 90
                    };
                    viewfinderRectangle.Fill = videoRecorderBrush;

                    // Start video capture and display it on the viewfinder.
                    captureSource.Start();
                    System.Diagnostics.Debug.WriteLine("Started");
                    _isRunning = true;
                }
            }
        }
        private void DoStartPlay(object obj)
        {
            CaptureDeviceConfiguration.RequestDeviceAccess();
            if (captureSource != null)
            {
                captureSource.Stop();
                captureSource = null;
            }
            // Desired format is 16kHz 16bit
            var queriedAudioFormats = from format in SelectedAudioDevice.SupportedFormats
                                      where format.SamplesPerSecond == 8000 && format.BitsPerSample == 16 && format.Channels == 1
                                      select format;

            SelectedAudioDevice.DesiredFormat  = queriedAudioFormats.FirstOrDefault();
            SelectedAudioDevice.AudioFrameSize = 40;

            captureSource = new CaptureSource
            {
                AudioCaptureDevice = SelectedAudioDevice
            };

            audioSink = new SpeexEncoderAudioSink(new Uri(@"http://" + ListenAddress))
            {
                CaptureSource = captureSource
            };

            captureSource.Start();
        }
        private void cmdStartCapture_Click(object sender, RoutedEventArgs e)
        {
            if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                // Permission has been granted.

                // It's always safe to call this Stop(), even if no capture is running.
                // However, calling Start() while a capture is already running causes an error.
                capture.Stop();

                // Get the default webcam.
                capture.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
                if (capture.VideoCaptureDevice == null)
                {
                    MessageBox.Show("Your computer does not have a video capture device.");
                }
                else
                {
                    // Start a new capture.
                    capture.Start();

                    // Map the live video to a VideoBrush.
                    VideoBrush videoBrush = new VideoBrush();
                    videoBrush.Stretch = Stretch.Uniform;
                    videoBrush.SetSource(capture);

                    // Use the VideoBrush to paint the fill of a Rectangle.
                    rectWebcamDisplay.Fill = videoBrush;
                }
            }
        }
Example #9
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (CaptureDeviceConfiguration.RequestDeviceAccess())
     {
         captureSource.Start();
     }
 }
Example #10
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     Client = Connect.Client;
     changlanguage();
     threadInvite = new Thread(Invite);                            //实例化线程
     threadShare  = new Thread(new ThreadStart(GetPreview));
     if (captureSource == null)
     {
         // 创建摄像机对象。
         captureSource      = new CaptureSource();
         videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
         // eventhandlers capturesource添加为。
         captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);
         // 初始化相机如果存在手机上。
         if (videoCaptureDevice != null)
         {
             TheVideoBrush.SetSource(captureSource);
             captureSource.Start();
         }
         else
         {
             MessageBox.Show("您的摄像头设备不支持");
         }
     }
 }
Example #11
0
        public void InitializeVideoRecorder()
        {
            if (captureSource == null)
            {
                // Create the VideoRecorder objects.
                captureSource      = new CaptureSource();
                fileSink           = new FileSink();
                videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

                captureSource.CaptureImageCompleted += captureSource_CaptureImageCompleted;
                // Add eventhandlers for captureSource.
                captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);
                // Initialize the camera if it exists on the device.
                if (videoCaptureDevice != null)
                {
                    // Create the VideoBrush for the viewfinder.
                    videoRecorderBrush = new VideoBrush();
                    videoRecorderBrush.SetSource(captureSource);

                    // Display the viewfinder image on the rectangle.
                    viewfinderRectangle.Fill = videoRecorderBrush;

                    // Start video capture and display it on the viewfinder.
                    captureSource.Start();

                    // Set the button state and the message.
                    UpdateUI(ButtonState.Initialized, "Tap record to start recording...");
                }
                else
                {
                    // Disable buttons when the camera is not supported by the device.
                    UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this device.");
                }
            }
        }
        private void btCapture_Click(object sender, RoutedEventArgs e)
        {
            if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                VideoCaptureDevice webcam = cboWebcams.SelectedItem as VideoCaptureDevice;

                if (webcam == null)
                {
                    CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
                }

                if (webcam != null)
                {
                    capture.Stop();
                    capture.VideoCaptureDevice = webcam;
                    capture.Start();


                    VideoBrush brush = new VideoBrush();
                    brush.SetSource(capture);
                    brush.Stretch    = Stretch.Uniform;
                    captureRect.Fill = brush;
                }
                else
                {
                    MessageBox.Show("Nessuna webcam disponibile");
                }
            }
        }
Example #13
0
        private void ButtonStart_Click(object sender, RoutedEventArgs eargs)
        {
            try
            {
                // Start capturing
                if (_captureSource.State != CaptureState.Started)
                {
                    // Create video brush and fill the WebcamVideo rectangle with it
                    var vidBrush = new VideoBrush();
                    vidBrush.Stretch = Stretch.Uniform;
                    vidBrush.SetSource(_captureSource);
                    WebcamVideo.Fill = vidBrush;

                    // Ask user for permission and start the capturing
                    if (CaptureDeviceConfiguration.RequestDeviceAccess())
                    {
                        _captureSource.Start();
                    }
                }
            }
            catch (InvalidOperationException ex)
            {
                TextBoxInfo.Text = "Web Cam already started - if not, I can't find it...";
            }
            catch (Exception)
            {
                TextBoxInfo.Text = "Could not start web cam, do you have one?";
            }
        }
Example #14
0
        void InitializeVideoRecorder(Rectangle viewfinderRectangle)
        {
            if (captureSource == null)
            {
                // Create the VideoRecorder objects.
                captureSource = new CaptureSource();
                fileSink      = new FileSink();

                videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

                // Add eventhandlers for captureSource.
                captureSource.CaptureFailed += new EventHandler <ExceptionRoutedEventArgs>(OnCaptureFailed);

                // Initialize the camera if it exists on the device.
                if (videoCaptureDevice != null)
                {
                    // Create the VideoBrush for the viewfinder.
                    videoRecorderBrush = new VideoBrush();
                    videoRecorderBrush.SetSource(captureSource);

                    // Display the viewfinder image on the rectangle.
                    viewfinderRectangle.Fill = videoRecorderBrush;

                    // Start video capture and display it on the viewfinder.
                    captureSource.Start();
                }
                else
                {
                    // A camera is not supported on this device
                }
            }
        }
Example #15
0
 private void StartButton_Click(object sender, RoutedEventArgs e)
 {
     if ((CaptureDeviceConfiguration.AllowedDeviceAccess ||
          CaptureDeviceConfiguration.RequestDeviceAccess()) && myCaptureSource.VideoCaptureDevice != null)
     {
         myCaptureSource.Start();
     }
 }
        // Set recording state: start recording.
        private void StartVideoRecording()
        {
            try
            {
                // Connect fileSink to captureSource.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Started)
                {
                    captureSource.Stop();

                    DateTime dNow = DateTime.Now;

                    string sVidName = dNow.Year.ToString() + RscUtils.pad60(dNow.Month)
                                      + RscUtils.pad60(dNow.Day) + "_" + RscUtils.pad60(dNow.Hour) + RscUtils.pad60(dNow.Minute)
                                      + RscUtils.pad60(dNow.Second);

                    // Connect the input and output of fileSink.
                    fileSink.CaptureSource           = captureSource;
                    fileSink.IsolatedStorageFileName = (RscKnownFolders.GetMediaPath("DCVID") + "\\" + sVidName + ".mp4").Substring(3);
                }

                // Begin recording.
                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Stopped)
                {
                    captureSource.Start();
                }

                // Set the button states and the message.
                UpdateUI(ButtonState.Recording, "Recording...");

                BtnBk.Fill = new SolidColorBrush(Colors.Green);
            }

            // If recording fails, display an error.
            catch (Exception /*e*/)
            {
                this.Dispatcher.BeginInvoke(delegate()
                {
                    //txtDebug.Text = "ERROR: " + e.Message.ToString();

                    BtnBk.Fill = new SolidColorBrush(Colors.Red);
                });
            }
        }
 void cameraButton_Click(object sender, RoutedEventArgs e)
 {
     if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
         CaptureDeviceConfiguration.RequestDeviceAccess())
     {
         snapshot.Visibility = Visibility.Collapsed;
         src.Start();
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     // Request webcam access and start the capturing
     if (CaptureDeviceConfiguration.RequestDeviceAccess())
     {
         captureSource.Start();
         InitializeDetector();
     }
 }
 private void BtnCaptureClick(object sender, RoutedEventArgs e)
 {
     // Request webcam access and start the capturing
     if (CaptureDeviceConfiguration.RequestDeviceAccess())
     {
         captureSource.Start();
         Camera.Position.Y = 0;
     }
 }
Example #20
0
        private void StartVideoRecording()
        {
            try
            {
                if (captureSource.VideoCaptureDevice != null && captureSource.State == CaptureState.Started)
                {
                    captureSource.Stop();
                    fileSink.CaptureSource           = captureSource;
                    fileSink.IsolatedStorageFileName = isoVideoFileName;
                }

                if (captureSource.VideoCaptureDevice != null && captureSource.State == CaptureState.Stopped)
                {
                    captureSource.Start();
                }
            }
            catch
            {
            }
        }
Example #21
0
        public void ActivarWebCam()
        {
            VideoCaptureDevice videoCap = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

            capSource.VideoCaptureDevice = videoCap;
            if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                capSource.Start();
                videoSource.SetSource(capSource);
            }
        }
Example #22
0
        private void BtnCapture_Click(object sender, RoutedEventArgs e)
        {
            try
            {   // 开始捕捉
                if (captureSource.State != CaptureState.Started)
                {
                    captureSource.Stop();
                    // 创建 video brush 并填充到 rectangle
                    VideoBrush vidBrush = new VideoBrush();
                    vidBrush.Stretch = Stretch.UniformToFill;
                    vidBrush.SetSource(captureSource);
                    focusRectangle.Viewport.Fill = vidBrush;


                    // 询问是否接入
                    if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
                    {
                        focusRectangle.Viewport.MaxHeight = focusRectangle.Viewport.MaxWidth = ZoomInOut.Maximum = 400;
                        ZoomInOut.Value         = 270;
                        ZoomInOut.Minimum       = 16;
                        ZoomInOut.ValueChanged += new RoutedPropertyChangedEventHandler <double>(focusRectangle.ViewportSlider_ValueChanged);
                        captureSource.Start();

                        BtnCapture.Text          = "打开摄像头";
                        BtnUploadImage.IsEnabled = BtnAdvanceMode.IsEnabled = true;
                    }
                }
                else
                {
                    captureSource.Stop();
                    BtnCapture.Text          = "关闭摄像头";
                    BtnUploadImage.IsEnabled = BtnAdvanceMode.IsEnabled = false;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowMessageBox("Error using webcam", ex.Message);
            }
        }
        /// <summary>
        /// Sets recording state: start recording
        /// </summary>
        private void StartVideoRecording()
        {
            try
            {
                if ((captureSource.VideoCaptureDevice != null) && (captureSource.State == CaptureState.Started))
                {
                    captureSource.Stop();
                    fileSink.CaptureSource = captureSource;
                    filePath = System.IO.Path.Combine("/" + LocalFolderName + "/", defaultFileName);

                    using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        if (!isoFile.DirectoryExists(LocalFolderName))
                        {
                            isoFile.CreateDirectory(LocalFolderName);
                        }

                        if (isoFile.FileExists(filePath))
                        {
                            isoFile.DeleteFile(filePath);
                        }
                    }

                    fileSink.IsolatedStorageFileName = filePath;
                }

                if (captureSource.VideoCaptureDevice != null &&
                    captureSource.State == CaptureState.Stopped)
                {
                    captureSource.Start();
                }
                this.UpdateUI(VideoState.Recording);
            }
            catch (Exception)
            {
                this.result = new VideoResult(TaskResult.None);
                this.NavigateBack();
            }
        }
Example #24
0
        void ToggleDevice(object sender, RoutedEventArgs e)
        {
            if (on)
            {
                on = false;
                source.Stop();
                toggleButton.Content   = "Turn On";
                this.videoSurface.Fill = new SolidColorBrush(Colors.White);
            }
            else
            {
                if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
                    CaptureDeviceConfiguration.RequestDeviceAccess())
                {
                    if (this.container.Child is TextBox)
                    {
                        this.container.Child = this.videoSurface;
                    }

                    try
                    {
                        source.Start();
                        var brush = new VideoBrush();
                        brush.SetSource(source);
                        this.videoSurface.Fill = brush;
                        //toggleButton.Content = "Turn Off";

                        var canvas = new Canvas();
                        canvas.Width  = 70;
                        canvas.Height = 50;

                        var text = new TextBlock();
                        text.Text = "Turn Off";
                        canvas.Children.Add(text);
                        text.SetValue(Canvas.LeftProperty, 5d);
                        text.SetValue(Canvas.TopProperty, 5d);

                        canvas.Background = brush;

                        toggleButton.Content = canvas;


                        on = true;
                    }
                    catch (InvalidOperationException ex)
                    {
                        this.HandleDeviceInUseError(ex);
                    }
                }
            }
        }
        private void BtnCaptureClick(object sender, RoutedEventArgs e)
        {
            // Request webcam access and start the capturing
            if (CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                captureSource.Start();
                Earth.Scale        = Sun.Scale = 50;
                Sun.IsVisible      = true;
                ArCtrls.Visibility = Visibility.Visible;

                // Capture periodically
                CompositionTarget.Rendering += (s, e2) => captureSource.CaptureImageAsync();
            }
        }
Example #26
0
        private void InitializeCaptureSource()
        {
            ClientLogger.Debug("AudioLoopbackTest:InitializeCaptureSource()");
            if (_captureSource != null)
            {
                _captureSource.Stop();
            }
            _captureSource = new CaptureSource();
            _captureSource.AudioCaptureDevice = (AudioCaptureDevice)lstAudioInputDevices.SelectedItem;
            _captureSource.VideoCaptureDevice = (VideoCaptureDevice)lstVideoInputDevices.SelectedItem;
            _mediaElement      = new MediaElement();
            _audioStreamSource = new TestAudioStreamSource(this);


            // Set the audio properties.
            if (_captureSource.AudioCaptureDevice != null)
            {
                MediaDeviceConfig.SelectBestAudioFormat(_captureSource.AudioCaptureDevice);
                if (_captureSource.AudioCaptureDevice.DesiredFormat != null)
                {
                    _captureSource.AudioCaptureDevice.AudioFrameSize = _audioFormat.MillisecondsPerFrame;                     // 20 milliseconds
                    _audioSink = new TestAudioSinkAdapter(_captureSource, new NullAudioController());
                    _audioSink.RawFrameAvailable       += audioSink_RawFrameAvailable;
                    _audioSink.ProcessedFrameAvailable += audioSink_FrameArrived;
                    ClientLogger.Debug("CaptureSource initialized.");
                }
                else
                {
                    ClientLogger.Debug("No suitable audio format was found.");
                }

                ClientLogger.Debug("Checking device access.");
                if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
                {
                    ClientLogger.Debug("AudioLoopbackTest CaptureSource starting with audio device {0}, video device {1}.",
                                       _captureSource.AudioCaptureDevice.FriendlyName, _captureSource.VideoCaptureDevice.FriendlyName);
                    _captureSource.Start();
                    ClientLogger.Debug("CaptureSource started; setting media element source.");
                    _mediaElement.SetSource(_audioStreamSource);
                    ClientLogger.Debug("MediaElement source set; telling media element to play.");
                    _mediaElement.Play();
                }
            }
            else
            {
                // Do something more here eventually, once we figure out what the user experience should be.
                ClientLogger.Debug("No audio capture device was found.");
            }
        }
Example #27
0
 private void StartWebCam()
 {
     if (_captureSource == null)
     {
         _captureSource = new CaptureSource();
     }
     if (_captureSource.State == CaptureState.Stopped)
     {
         _captureSource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
         VideoBrush PreviewBrush = new VideoBrush();
         PreviewBrush.SetSource(_captureSource);
         rectCam.Fill = PreviewBrush;
         _captureSource.Start();
     }
 }
Example #28
0
        public override void Start()
        {
            InitMicrophone();

            _source.Dispatcher.BeginInvoke(
                () =>
            {
                _audio.ResetAudioData();
                _source.Start();
                _startTime = DateTime.Now;

                base.Start();
            }
                );
        }
Example #29
0
 private void btnRecord_Click(object sender, RoutedEventArgs e)
 {
     if (btnRecord.Content.ToString() == "Start")
     {
         btnPlay.IsEnabled = false;
         btnRecord.Content = "Stop";
         recordedAudio.Clear();
         captureSource.Start();
     }
     else
     {
         captureSource.Stop();
         btnRecord.Content = "Start";
         btnPlay.IsEnabled = true;
     }
 }
Example #30
0
 private void CaptureSelectedInputDevices()
 {
     try
     {
         if (mCaptureSource != null && mCaptureSource.State != CaptureState.Started)
         {
             if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
             {
                 mCaptureSource.Start();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }