Пример #1
0
        public void VideoBackGroundPlay(string Path)
        {
            if (videoBackGround != null)
            {
                if (videoBackGround.Playing)
                {
                    videoBackGround.Stop();
                    videoBackGround.Dispose();
                    videoBackGround = null;
                }
            }

            videoBackGround = new Video(Path);

            //控制播放视频窗口的大小(此项目是把视频放到一个panel中,panelView是一个panel)
            int width  = this.Width;
            int height = this.Height;

            videoBackGround.Owner          = this;//panelBackGround;
            videoBackGround.Owner.Width    = width;
            videoBackGround.Owner.Height   = height;
            SetFile.Default.NowVideoTimes  = GetMediaTimeLenSecond(Path);
            SetFile.Default.NowPlayingPath = Path;
            BackGroundVideoTimer.Interval  = SetFile.Default.NowVideoTimes * 1000;
            videoBackGround.Play();
            BackGroundVideoTimer.Start();
        }
Пример #2
0
 public void VideoBackGroundPause()
 {
     if (FormMain.backGroundPtr == Ptr)
     {
         if (videoBackGround != null)
         {
             if (videoBackGround.Playing)
             {
                 videoBackGround.Pause();
                 BackGroundVideoTimer.Stop();
             }
             else
             {
                 videoBackGround.Play();
                 BackGroundVideoTimer.Start();
             }
         }
     }
 }
Пример #3
0
        private void BackGroundVideoTimer_Tick(object sender, EventArgs e)
        {
            if (videoBackGround != null)
            {
                if (videoBackGround.Playing)
                {
                    videoBackGround.Stop();
                    BackGroundVideoTimer.Stop();
                    videoBackGround.Dispose();
                    videoBackGround = null;
                    videoBackGround = new Video(SetFile.Default.NowPlayingPath);

                    //控制播放视频窗口的大小(此项目是把视频放到一个panel中,panelView是一个panel)
                    int width  = this.Width;
                    int height = this.Height;
                    videoBackGround.Owner        = this;//panelBackGround;
                    videoBackGround.Owner.Width  = width;
                    videoBackGround.Owner.Height = height;
                    videoBackGround.Play();
                    BackGroundVideoTimer.Start();
                }
            }
        }