public void StartDownloadAsync(DateTime beginTime, DateTime endTime, string fileName) { NetDvrTime begin = new NetDvrTime { Year = (uint)beginTime.Year, Month = (uint)beginTime.Month, Day = (uint)beginTime.Day, Hour = (uint)beginTime.Hour, Minute = (uint)beginTime.Minute }; NetDvrTime end = new NetDvrTime { Year = (uint)endTime.Year, Month = (uint)endTime.Month, Day = (uint)endTime.Day, Hour = (uint)endTime.Hour, Minute = (uint)endTime.Minute }; NetDvrPlayCondition condition = new NetDvrPlayCondition(); condition.Channel = 33; condition.StartTime = begin; condition.StopTime = end; _fileHandle = OfficalAPI.NET_DVR_GetFileByTime_V40(_userId, fileName, ref condition); PlayBackControl(NetDvrPlayBackControlCode.NET_DVR_PLAYSTART); }
public void StartPlayBack(DateTime beginTime, DateTime endTime, IntPtr hwnd) { NetDvrTime begin = new NetDvrTime { Year = (uint)beginTime.Year, Month = (uint)beginTime.Month, Day = (uint)beginTime.Day, Hour = (uint)beginTime.Hour, Minute = (uint)beginTime.Minute }; NetDvrTime end = new NetDvrTime { Year = (uint)endTime.Year, Month = (uint)endTime.Month, Day = (uint)endTime.Day, Hour = (uint)endTime.Hour, Minute = (uint)endTime.Minute }; //按时间播放 NetDvrVodPara vod = new NetDvrVodPara(); vod.Size = (uint)Marshal.SizeOf(vod); //vod.struIDInfo.dwSize = Marshal.SizeOf(NET_DVR_STREAM_INFO); vod.struIDInfo.Channel = 33; //按录像机网口32+i计算 vod.HWnd = hwnd; vod.BeginTime = begin; vod.EndTime = end; _playHandle = OfficalAPI.NET_DVR_PlayBackByTime(_userId, 33, ref begin, ref end, hwnd); //playHandle = OfficalAPI.NET_DVR_PlayBackByTime_V40(_userId, ref vod); Trace.WriteLine($"playHandle {_playHandle}"); var error = OfficalAPI.NET_DVR_GetLastError(); Trace.WriteLine($"error {error}"); }