示例#1
0
 public void PlayAll(Control[] hosts)
 {
     if (hosts.Length == 0)
     {
         return;
     }
     if (liveCameras.Count > hosts.Length)
     {
         return;
     }
     for (var i = 0; i < hosts.Length; i++)
     {
         if (i < liveCameras.Count)
         {
             liveCameras[i].Play(hosts[i]);
         }
     }
     CosnoleUtil.HideConsole();
 }
示例#2
0
        public void Replay(DateTime checkInTime, bool blockUntiVideoExit = false)
        {
            if (isDisposed)
            {
                this.player = new VlcControl {
                    Name = string.Format("{0}.{1}", addr.Line, addr.MachineAddr), Dock = DockStyle.Fill
                };
                this.Prepare();
                isDisposed = false;
            }

            CosnoleUtil.HideConsole();

            var startPos = Convert.ToInt64(Path.GetFileNameWithoutExtension(recPath));

            if (TimeUtil.ToTimestamp(checkInTime) < startPos)
            {
                new MediaPlayer(this, recPath, -1, REPLAY_DURATION).ShowDialog();
            }
            else
            {
                //rec is 1.5 secs slower than live movie
                new MediaPlayer(this, recPath, TimeUtil.ToTimestamp(checkInTime.AddSeconds(1.5)) - startPos, REPLAY_DURATION).ShowDialog();
            }


            //var proc = new Process();
            //proc.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + @"lib\vlc\vlc.exe";
            //var startPos = Convert.ToInt64(Path.GetFileNameWithoutExtension(recPath));
            //if (TimeUtil.ToTimestamp(checkInTime) < startPos)
            //    proc.StartInfo.Arguments = string.Format(" {0} --run-time=10 --play-and-exit", recPath);
            //else
            //    proc.StartInfo.Arguments = string.Format(" {0} --start-time={1} --run-time={2} --play-and-exit", recPath, TimeUtil.ToTimestamp(checkInTime) - startPos, REPLAY_DURATION);
            //proc.StartInfo.CreateNoWindow = true;
            //proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            //proc.Start();
            //if (blockUntiVideoExit) proc.WaitForExit();
        }