private void PlayBackVideo(object sender, System.Timers.ElapsedEventArgs e)
 {
     try
     {
         if (IsPlayBack == false)
         {
             IsPlayBack = true;
             uint playtime = PlayCtrl.PlayM4_GetPlayedTime(m_PlayBackPort);
             if (playtime == 0xffffffff)
             {//获取时间失败
                 return;
             }
             cursecond += playtime;
             double dprogress = Math.Round((1.0 * cursecond / PlayBackTotalSecond), 2);
             int    iprogress = (int)(dprogress * 100);
             if (iprogress > 100)
             {
                 //StopPlay();
                 StopPlayBack();
             }
             else
             {
                 trackBarPlaybackProgress.Value = iprogress;
             }
         }
     }
     catch (Exception ex)
     { }
     finally
     {
         IsPlayBack = false;
     }
 }
Example #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (!play || m_bPause)
     {
         return;
     }
     progressBar1.Value = (int)(PlayCtrl.PlayM4_GetPlayPos(0) * 100);
     label4.Text        = GetTime(PlayCtrl.PlayM4_GetPlayedTime(0));
     Console.WriteLine(PlayCtrl.PlayM4_GetPlayedTime(0));
     Console.WriteLine(PlayCtrl.PlayM4_GetPlayedTimeEx(0));
     Console.WriteLine(PlayCtrl.PlayM4_GetFileTime(0));
     if (PlayCtrl.PlayM4_GetPlayedTimeEx(0) >= PlayCtrl.PlayM4_GetFileTime(0) * 1000)
     {
         progressBar1.Value = 100;
         play     = false;
         m_bPause = false;
         button2_Click(null, null);
     }
 }