/// <summary> /// 远程 /// </summary> /// <param name="para"></param> /// <returns></returns> public bool StopRemoteBackplayByTime() { SDK_Hik.NET_DVR_StopPlayBack(m_lPlayHandle); m_lPlayHandle = -1; SDK_Hik.NET_DVR_Logout_V30(m_lUserID); m_lUserID = -1; PicPlayMain.Refresh(); return(false); }
/// <summary> /// 远程 /// </summary> /// <param name="para"></param> /// <returns></returns> public bool StartRemoteBackplayByTime(VideoRemotePlayByTimePara para) { VideoInfo vInfo = para.CameraInfo.VideoInfo; CurrentVideoInfo = vInfo; CameraInfo cInfo = para.CameraInfo; CurrentCameraInfo = cInfo; if (m_lPlayHandle >= 0) { // 先停止播放 StopRemoteBackplayByTime(); } if (para.StartPlayTime > para.EndPlayTime) { return(false); } SDK_Hik.NET_DVR_DEVICEINFO_V30 DeviceInfo = new SDK_Hik.NET_DVR_DEVICEINFO_V30(); m_lUserID = SDK_Hik.NET_DVR_Login_V30(vInfo.DVSAddress, vInfo.DVSConnectPort, vInfo.UserName, vInfo.Password, ref DeviceInfo); uint uuu = SDK_Hik.NET_DVR_GetLastError(); if (m_lUserID < 0) { return(false); } int[] iChannelNum = SDK_Hik.GetChannel(m_lUserID, DeviceInfo); Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "登陆成功"); SDK_Hik.NET_DVR_TIME Stime = SDK_Hik.ConvertToNetTime(para.StartPlayTime); SDK_Hik.NET_DVR_TIME Etime = SDK_Hik.ConvertToNetTime(para.EndPlayTime); int intChannel = Convert.ToInt32(cInfo.Channel); SDK_Hik.NET_DVR_VOD_PARA struVodPara = new SDK_Hik.NET_DVR_VOD_PARA(); struVodPara.dwSize = (uint)Marshal.SizeOf(struVodPara); struVodPara.struIDInfo.dwChannel = Convert.ToUInt32(iChannelNum[CurrentCameraInfo.Channel - 1]); //通道号 Channel number struVodPara.hWnd = IntPtrPlayMain;//回放窗口句柄 //设置回放的开始时间 Set the starting time to search video files struVodPara.struBeginTime = Stime; //设置回放的结束时间 Set the stopping time to search video files struVodPara.struEndTime = Etime; struVodPara.byStreamType = 1; m_lPlayHandle = SDK_Hik.NET_DVR_PlayBackByTime_V40(m_lUserID, ref struVodPara); if (m_lPlayHandle == -1) { return(false); } if (!SDK_Hik.NET_DVR_PlayBackControl(m_lPlayHandle, SDK_Hik.PlayBackControlCode.NET_DVR_PLAYSTART, 0, ref lpOutValue)) { return(false); } SDK_Hik.NET_DVR_PlayBackControl(m_lPlayHandle, SDK_Hik.PlayBackControlCode.NET_DVR_PLAYSTARTAUDIO, 0, ref lpOutValue); SDK_Hik.NET_DVR_PlayBackControl(m_lPlayHandle, SDK_Hik.PlayBackControlCode.NET_DVR_PLAYAUDIOVOLUME, 0XFFFF, ref lpOutValue); SDK_Hik.NET_DVR_PlayBackControl(m_lPlayHandle, SDK_Hik.PlayBackControlCode.NET_DVR_GETTOTALTIME, 0, ref totalTime); BackplayStatus = VideoRemoteBackplayStatus.RemoteBackplayByTimeStarted; return(true); }