Ejemplo n.º 1
0
        private void AcPlayItem_Load(object sender, EventArgs e)
        {
            txtFile.Text = v.FileName;
            //TimeSpan ts = new TimeSpan(0, 0, 0, 0, v.Length > 1 ? v.Length : 1);
            TimeSpan ts;

            //获取视频时长
            try
            {
                ts = FlvInfoHelper.GetVideoDuration(v.FileName,
                                                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                                 "Kaedei" + Path.DirectorySeparatorChar + "FlvCombine" + Path.DirectorySeparatorChar + "ffmpeg.exe"));
            }
            catch
            {
                ts = new TimeSpan(0, 0, 0, 0, 1);
            }

            udMin.Value   = ts.Hours * 60 + ts.Minutes;
            udSec.Value   = ts.Seconds;
            udMilli.Value = ts.Milliseconds;
        }
Ejemplo n.º 2
0
        private void AcPlayItem_Load(object sender, EventArgs e)
        {
            txtFile.Text = v.FileName;
            TimeSpan ts = new TimeSpan(0, 0, 0, 0, v.Length > 1 ? v.Length : 1);

            //获取视频时长
            try
            {
                if (ts.TotalMilliseconds <= 0)
                {
                    FlvInfo fi = FlvInfoHelper.Read(v.FileName);
                    if (fi.Time.TotalMilliseconds > 0)
                    {
                        ts = fi.Time;
                    }
                }
            }
            catch { }

            udMin.Value   = ts.Hours * 60 + ts.Minutes;
            udSec.Value   = ts.Seconds;
            udMilli.Value = ts.Milliseconds;
        }