Exemplo n.º 1
0
        private void CloseVideoSource()
        {
            if (!bOpsStopped)
            {
                videoPlayer.SignalToStop();

                if (videoPlayer.IsRunning)
                {
                    videoPlayer.WaitForStop();
                    Thread.Sleep(150);
                    videoPlayer.Stop();
                }

                if (motionDetector != null)
                {
                    motionDetector.Reset();
                }

                bOpsStopped = true;

                this.lblInfotext.Text.ToUpper();
                this.lblInfotext.Text = "You can safely exit the App now.";
                this.lblInfotext.Text.ToLower();
            }
        }
Exemplo n.º 2
0
        private void CloseCurrentVideoSource()
        {
            if (VideoSourcePlayer.VideoSource != null)
            {
                VideoSourcePlayer.SignalToStop();

                // wait ~ 3 seconds
                for (int i = 0; i < 30; i++)
                {
                    if (!VideoSourcePlayer.IsRunning)
                    {
                        break;
                    }

                    Thread.Sleep(100);
                }

                if (VideoSourcePlayer.IsRunning)
                {
                    VideoSourcePlayer.Stop();
                }

                VideoSourcePlayer.VideoSource = null;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 打开/关闭视频事件
 /// </summary>
 private static void video_event_func()
 {
     if (NCVM_Form.isopen)
     {
         try
         {
             videoSource = new VideoCaptureDevice(videoDevices[capset / 100].MonikerString);
             videoSource.DesiredFrameSize = videoSource.VideoCapabilities[capset % 100].FrameSize;
             videoSource.NewFrame        += show_video;
             videoSource.Start();
             videoSourcePlayer.VideoSource = videoSource;
             videoSourcePlayer.Start();
             timer_rec.Start();
         }
         catch (Exception ex)
         {
             MessageBox.Show("错误:" + ex.Message);
         }
     }
     else
     {
         stop_flag = true;
         videoSource.Stop();
         videoSourcePlayer.Stop();
     }
 }
Exemplo n.º 4
0
 public static VideoSourcePlayer stop(this VideoSourcePlayer videoPlayer)
 {
     videoPlayer.invokeOnThread(
         () => {
         videoPlayer.Stop();
     });
     return(videoPlayer);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 关闭摄像头设备
 /// </summary>
 public static void CloseDevice()
 {
     if (div != null && div.IsRunning)
     {
         sourcePlayer.Stop();
         div.SignalToStop();
         div           = null;
         CameraDevices = null;
     }
 }
Exemplo n.º 6
0
 private void buttonItem1_Click(object sender, EventArgs e)
 {
     try
     {
         currentplayer.Stop();
     }
     catch
     {
     }
 }
Exemplo n.º 7
0
        private void OpenVideoSource(VideoCaptureDevice device)
        {
            // Close Old Video Source and writer
            if (videoSourcePlayer.IsRunning)
            {
                videoSourcePlayer.Stop();
            }
            CloseVideoSource();

            // Close the writer if it is already open so it can be re-opened with the new source
            if (vwriter != null && vwriter.IsOpen)
            {
                vwriter.Close();
            }

            // Open New Video Source
            videoSourcePlayer.VideoSource = device;
            videoSourcePlayer.Start();

            // Create new video file
            // Video file is .avi file. Title has "M-Fly Flight Video" followed by date and time
            vwriter = new VideoFileWriter();
            vwriter.Open("M-Fly Flight Video " + DateTime.Now.ToString("yyyy MMMM dd hh mm") + ".avi", device.VideoResolution.FrameSize.Width, device.VideoResolution.FrameSize.Height, device.VideoResolution.AverageFrameRate);
        }
Exemplo n.º 8
0
        private void CloseVideoSource()
        {
            videoPlayer.SignalToStop();

            if (videoPlayer.IsRunning)
            {
                videoPlayer.WaitForStop();
                Thread.Sleep(150);
                videoPlayer.Stop();

                this.txtBoxInfo.Text = "You can exit Splash now.";
            }

            //if (motionDetector != null)
            //    motionDetector.Reset();
        }
Exemplo n.º 9
0
        //void fileSource_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
        //{
        //    pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
        //}

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                if (pla.IsRunning)
                {
                    pla.Stop();
                }
            }
            catch { }

            try
            {
                if (FinalVideoSource.IsRunning)
                {
                    FinalVideoSource.Stop();
                }
            }
            catch { }
        }
Exemplo n.º 10
0
        // Close video source if it is running
        private void CloseCurrentVideoSource(VideoSourcePlayer player)
        {
            if (player.VideoSource != null)
            {
                player.SignalToStop();

                // wait ~ 3 seconds
                for (int i = 0; i < 30; i++)
                {
                    if (!player.IsRunning)
                    {
                        break;
                    }
                    System.Threading.Thread.Sleep(100);
                }

                if (player.IsRunning)
                {
                    player.Stop();
                }

                player.VideoSource = null;
            }
        }
Exemplo n.º 11
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     videoSourcePlayer.Stop();
 }
Exemplo n.º 12
0
 public void Shutdown()
 {
     VideoSourcePlayer.Stop();
 }
Exemplo n.º 13
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     player.Stop();
     player.Dispose();
 }
Exemplo n.º 14
0
 /// <summary> 关闭摄像头
 /// </summary>
 /// <param name="vSource">摄像头显示控件</param>
 public void Stop(VideoSourcePlayer vSource)
 {
     vSource.Stop();//关闭摄像头
 }