Exemplo n.º 1
0
        /// <summary>
        /// 播放
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPlay_Click(object sender, EventArgs e)
        {
            //设置按钮状态
            btnPlay.Enabled  = false;
            btnPause.Enabled = true;
            btnStop.Enabled  = true;
            btnLast.Enabled  = true;
            btnNext.Enabled  = true;

            if (!media_is_open)
            {
                VlcPlayerCore.PlayFile(MediaUrl);
            }
            trPlayerProgress.SetRange(0, (int)VlcPlayerCore.Duration());
            VlcPlayerCore.SetPlayTime(trPlayerProgress.Value);
            VlcPlayerCore.Play();
            trPlayerProgress.Value = (int)VlcPlayerCore.GetPlayTime();

            tmrProgress.Start();

            is_playinig   = true;
            media_is_open = true;

            lblVideoName.Text = Path.GetFileNameWithoutExtension(MediaUrl);
            lblVideoName.Show();
            lblVideoName.BringToFront();

            if (StartEvent != null)
            {
                StartEvent(this, new EventArgs());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 播放进度滑块
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void trPlayerProgress_Scroll(object sender, EventArgs e)
 {
     if (is_playinig)
     {
         VlcPlayerCore.SetPlayTime(trPlayerProgress.Value);
         trPlayerProgress.Value = (int)VlcPlayerCore.GetPlayTime();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 前进
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNext_Click(object sender, EventArgs e)
        {
            //设置按钮状态
            btnPlay.Enabled  = false;
            btnPause.Enabled = true;
            btnStop.Enabled  = true;
            btnLast.Enabled  = true;
            btnNext.Enabled  = true;

            VlcPlayerCore.Pause();
            int time = (int)VlcPlayerCore.GetPlayTime() + 5;

            if (time < trPlayerProgress.Maximum)
            {
                VlcPlayerCore.SetPlayTime(time);
            }
            else
            {
                VlcPlayerCore.SetPlayTime(trPlayerProgress.Maximum);
            }
            VlcPlayerCore.Play();
            trPlayerProgress.Value = (int)VlcPlayerCore.GetPlayTime();
        }