Play() 공개 메소드

Load and start playing a video.
public Play ( string filePath ) : void
filePath string
리턴 void
        protected void OnButtonPlayClicked(object sender, System.EventArgs e)
        {
            if (_play != null)
            {
                _play.Stop();
            }

            int handle = (int)this.drawingareaVideo.Handle;

            if (System.IO.File.Exists(VideoPath) == false)
            {
                throw new System.IO.FileNotFoundException("File not found", VideoPath);
            }

            _play = new MPlayer(handle, MplayerBackends.GL, MPlayerPath);
            _play.Play(VideoPath);
        }
예제 #2
0
        public void Play(string file)
        {
            if (!_canPlay)
            {
                return;
            }

            Console.WriteLine("=======================");
            Console.WriteLine($"播放{file}");
            _mPlayer.Play(file);
            Console.WriteLine("=======================");
            Console.WriteLine($"音量{_config.Volume}");
            _mPlayer.Volume(_config.Volume);
            Console.WriteLine("=======================");
            Console.WriteLine($"位置{_config.CurrentPosition}");
            _mPlayer.MovePosition(_config.CurrentPosition);
            Console.WriteLine("=======================");
            Console.WriteLine("全屏");
            _mPlayer.FullScreen = true;
        }
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            if (_play != null)
            {
                _play.Stop();
            }

            int handle = (int)this.panelVideo.Handle;

            if (System.IO.File.Exists(MPlayerPath) == false)
            {
                throw new System.IO.FileNotFoundException("File not found", MPlayerPath);
            }

            if (System.IO.File.Exists(VideoPath) == false && VideoPath.StartsWith("http") == false)
            {
                throw new System.IO.FileNotFoundException("File not found", VideoPath);
            }

            _play = new MPlayer(handle, MplayerBackends.Direct3D, MPlayerPath);
            _play.Play(VideoPath);
        }
        private void buttonPlay_Click(object sender, RoutedEventArgs e)
        {
            if (_play != null)
            {
                _play.Stop();
            }

            int handle = (int)this.windowsFormsHost1.Handle;

            if (System.IO.File.Exists(MPlayerPath) == false)
            {
                throw new System.IO.FileNotFoundException("File not found", MPlayerPath);
            }

            if (System.IO.File.Exists(VideoPath) == false)
            {
                throw new System.IO.FileNotFoundException("File not found", VideoPath);
            }

            _play = new MPlayer(handle, MplayerBackends.Direct3D, MPlayerPath);
            _play.Play(VideoPath);

        }