Beispiel #1
0
        public bool StartPlay(string cameraId)
        {
            if (_currSelectedBox != null)
            {
                PlayObject obj = _currSelectedBox.Tag as PlayObject;
                OnClosePlayBox(obj);
                IntPtr hwnd      = _currSelectedBox.Handle;
                IntPtr sessionId = HkApi.AllocSession();
                HkApi.StartPlay(hwnd, cameraId, sessionId);

                obj.IsPlaying = true;
                obj.SessionId = sessionId;
                obj.CameraId  = cameraId;
                OnPlayingBox(_currSelectedBox);
                _currSelectedBox = null;
            }
            else
            {
                PictureBox box = GetIdleBox();
                if (box != null)
                {
                    PlayObject obj       = box.Tag as PlayObject;
                    IntPtr     hwnd      = box.Handle;
                    IntPtr     sessionId = HkApi.AllocSession();
                    HkApi.StartPlay(hwnd, cameraId, sessionId);

                    obj.IsPlaying = true;
                    obj.SessionId = sessionId;
                    obj.CameraId  = cameraId;
                    OnPlayingBox(box);
                }
            }
            return(false);
        }
Beispiel #2
0
 private void OnClosePlayBox(PlayObject obj)
 {
     if (obj.IsPlaying)
     {
         HkApi.StopPlay(obj.SessionId);
         obj.SessionId = IntPtr.Zero;
         obj.CameraId  = string.Empty;
         obj.IsPlaying = false;
     }
 }
Beispiel #3
0
 protected override void OnLoad(EventArgs e)
 {
     btn1.Click  += Btn_Click;
     btn4.Click  += Btn_Click;
     btn9.Click  += Btn_Click;
     btn16.Click += Btn_Click;
     Btn_Click(btn4, EventArgs.Empty);//调用InitPlayBox,初始化界面,默认是4个播放页面;
     //PlayBoxClick(_listPlayBox[0], EventArgs.Empty); //默认选择第一个box;
     HkApi.Init();
 }
Beispiel #4
0
 /// <summary>
 /// 释放视频
 /// </summary>
 public void DisposeCamera()
 {
     try
     {
         foreach (PictureBox box in _listPlayBox)
         {
             PlayObject obj = box.Tag as PlayObject;
             OnClosePlayBox(obj);
         }
         HkApi.Close();
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
     }
 }
Beispiel #5
0
 public HkApi.GetDevListResult GetCameraList()
 {
     return(HkApi.GetCameraList());
 }
Beispiel #6
0
 public string  GetCameraList4JsonString()
 {
     return(HkApi.GetCameraList4Json());
 }
Beispiel #7
0
 public bool LoginByMid()
 {
     return(HkApi.Login());
 }
Beispiel #8
0
        //public PictureBox GetCurrSelectedBox
        //{
        //    get
        //    {
        //        return _currSelectedBox;
        //    }
        //}

        public bool LoginImmediately()
        {
            return(HkApi.LoginImmediately());
        }