/// <summary> /// 查询单个录像播放的进度 /// </summary> /// <param name="replayStatus"></param> private void QueryReplayStatus(RelayStatusModel replayStatus) { if (replayStatus == null) { return; } //非播放状态下的录像回放无需进行进度查询 if (!IsNeedQueryReplayPosition(replayStatus)) { return; } //查询失败或得到错误的结果时不做任何处理 DateTime replayDateTime = ReplayAdapter.GetReplayPositon(replayStatus.PlayingHandle); if (replayDateTime == DateTime.MinValue) { return; } //如果播放时间进度已经超过录像文件的最大时间,则通知消息订阅者停止播放 if (VideoRecordCache.IsTimeBeyondTimeRangeOfVideoFiles(replayStatus.Camera.ChannelID, replayDateTime)) { ReplayPositionChangedEvent?.Invoke(replayStatus.PlayingScreenHandle, DateTime.MaxValue); return; } ReplayPositionChangedEvent?.Invoke(replayStatus.PlayingScreenHandle, replayDateTime); }
public bool SetReplayPosition(IntPtr screenHandle, DateTime replayTime) { RelayStatusModel replayStatus; if (!TryGetReplayStatusByScreenHandle(screenHandle, out replayStatus)) { return(false); } if (!VideoRecordCache.HasTimeSpecificRecordFile(replayStatus.Camera.ChannelID, replayTime)) { ReplayPositionChangedEvent?.Invoke(screenHandle, DateTime.MaxValue); return(false); } if (replayStatus.StartPlayDateTime < replayTime)//跳放的时间点在录像播放起始时间点后,则直接跳放 { return(DirectlySetReplayPosition(replayStatus, replayTime)); } else//跳放的时间点在录像播放起始点前,则需要重新播放 { return(RestartReplay(screenHandle, replayTime)); } }