Exemplo n.º 1
0
 void videoPlayback1_PlayPause(object sender)
 {
     if (_mStream != null)
     {
         if (_mStream.IsRunning)
         {
             if (_mStream.IsPaused)
             {
                 _mStream.Play();
                 videoPlayback1.CurrentState = VideoPlayback.PlaybackState.Playing;
             }
             else
             {
                 _mStream.Pause();
                 videoPlayback1.CurrentState = VideoPlayback.PlaybackState.Paused;
             }
         }
         else
         {
             _mStream.Start();
             _mStream.Play();
             videoPlayback1.CurrentState = VideoPlayback.PlaybackState.Playing;
         }
     }
 }
Exemplo n.º 2
0
        public void Play(string filename)
        {
            if (InvokeRequired)
            {
                Invoke(new PlayDelegate(Play), filename);
            }
            else
            {
                if (_mStream != null)
                {
                    _mStream.Stop();
                }

                if (WaveOut != null)
                {
                    WaveOut.Stop();
                    WaveOut.Dispose();
                    WaveOut = null;
                }

                _mStream                  = new FFMPEGStream(filename);
                _mStream.NewFrame        += MStreamNewFrame;
                _mStream.DataAvailable   += _mStream_DataAvailable;
                _mStream.LevelChanged    += _mStream_LevelChanged;
                _mStream.PlayingFinished += _mStream_PlayingFinished;
                _mStream.RecordingFormat  = null;

                _firstFrame = true;

                _filename = filename;
                _mStream.Start();
                _mStream.Play();

                string[]  parts = filename.Split('\\');
                string    fn    = parts[parts.Length - 1];
                FilesFile ff    =
                    ((MainForm)Owner).GetCameraWindow(ObjectID).FileList.FirstOrDefault(p => p.Filename.EndsWith(fn));
                videoPlayback1.Init(ff);


                videoPlayback1.CurrentState = VideoPlayback.PlaybackState.Playing;
            }
        }