Esempio n. 1
0
 /// <summary>
 /// 开始播放
 /// </summary>
 private void lb_play_Click(object sender, EventArgs e)
 {
     //获取player状态
     Constant.PLAY_STATE state = (Constant.PLAY_STATE) this.player.GetState();
     //如果为播放
     if (state == Constant.PLAY_STATE.PS_PLAY)
     {
         this.player.SetConfig(602, "1");  //激活视频叠图加功能, 1-激活, 0-不激活
         this.player.SetConfig(621, "1");  //获取或设置 EVRCP 是否使用线形插值叠图,0-不是用,1-使用,默认0
         this.player.SetConfig(612, "暂停"); //设置一段文本作为叠加图像,值为文本内容
         ClearTip.Clear(player, 1000);
         this.player.Pause();
         this.lb_play.DM_Key = DMSkin.Controls.DMLabelKey.播放;
     }
     //如果为暂停
     else if (state == Constant.PLAY_STATE.PS_PAUSED)
     {
         this.player.SetConfig(602, "1");
         this.player.SetConfig(621, "1");
         this.player.SetConfig(612, "播放");
         ClearTip.Clear(player, 1000);
         this.player.Play();
         this.lb_play.DM_Key = DMSkin.Controls.DMLabelKey.暂停;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 主计时器,每50ms自动根据播放器的状态来控制播放器的动作和重绘视图
        /// </summary>>
        private void time_Tick(Object sender, EventArgs e)
        {
            //获取player状态
            Constant.PLAY_STATE state = (Constant.PLAY_STATE) this.player.GetState();
            switch (state)
            {
            case Constant.PLAY_STATE.PS_PLAY:
            case Constant.PLAY_STATE.PS_PAUSED:     //暂停状态
                this.position = this.player.GetPosition();
                this.duration = this.player.GetDuration();
                //设置视频进度条值
                this.pgb_time.DM_Value = this.position / Convert.ToDouble(this.duration) * 100.0;
                if (position > 7000 && position / 1000 % 7 == 0)
                {
                    int time = Convert.ToInt32((position / 1000 / 7));
                    if (captionDic.ContainsKey(time))
                    {
                        //player.SetConfig(511, time + " \r\n" + "00:00:" + time * 7 + ",500" + " --> 00:00:" + (time + 1) * 7 + ",000" + " \r\n" + captionDic[time]);
                        label2.Text = captionDic[time];
                        //Console.WriteLine(time + " \r\n" + "00:00:" + time * 7 + ",500" + " --> 00:00:" + (time + 1) * 7 + ",000" + " \r\n" + captionDic[time]);
                    }
                    else
                    {
                        label2.Text = "";
                    }
                    //isTest = true;
                }
                //    CaptionThread.position = Convert.ToInt32(position);
                //设置 当前播放时间/视频总共时间
                this.lb_time.Text = PlayHelper.GetTime(this.position) + " / " + PlayHelper.GetTime(this.duration);
                this.pgb_time.Invalidate();
                UpdateVol();
                break;
            }

            if (this.Full)
            {
                if ((this.LastCursorX == Cursor.Position.X) && (this.LastCursorY == Cursor.Position.Y))
                {
                    this.CursorStayTime++;
                }
                else
                {
                    this.CursorStayTime = 0;
                }
                if (Cursor.Position.Y >= (Screen.PrimaryScreen.Bounds.Height - this.menuPanel.Height))
                {
                    this.menuPanel.BringToFront();
                }
                else if (this.CursorStayTime >= this.CursorStayMaxTime)
                {
                    this.player.BringToFront();
                }
                this.LastCursorX = Cursor.Position.X;
                this.LastCursorY = Cursor.Position.Y;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 主计时器,每50ms自动根据播放器的状态来控制播放器的动作和重绘视图
        /// </summary>>
        private void time_Tick(Object sender, EventArgs e)
        {
            //获取player状态
            Constant.PLAY_STATE state = (Constant.PLAY_STATE) this.player.GetState();
            switch (state)
            {
            case Constant.PLAY_STATE.PS_PLAY:
            case Constant.PLAY_STATE.PS_PAUSED:     //暂停状态
                this.position = this.player.GetPosition();
                this.duration = this.player.GetDuration();
                //设置视频进度条值
                this.pgb_time.DM_Value = this.position / Convert.ToDouble(this.duration) * 100.0;
                //设置 当前播放时间/视频总共时间
                this.lb_time.Text = PlayHelper.GetTime(this.position) + " / " + PlayHelper.GetTime(this.duration);
                this.pgb_time.Invalidate();
                UpdateVol();
                break;
            }

            if (this.Full)
            {
                if ((this.LastCursorX == Cursor.Position.X) && (this.LastCursorY == Cursor.Position.Y))
                {
                    this.CursorStayTime++;
                }
                else
                {
                    this.CursorStayTime = 0;
                }
                if (Cursor.Position.Y >= (Screen.PrimaryScreen.Bounds.Height - this.menuPanel.Height))
                {
                    this.menuPanel.BringToFront();
                }
                else if (this.CursorStayTime >= this.CursorStayMaxTime)
                {
                    this.player.BringToFront();
                }
                this.LastCursorX = Cursor.Position.X;
                this.LastCursorY = Cursor.Position.Y;
            }
        }