/device/video.mp4 添加偏移量配置

This commit is contained in:
shikong 2023-10-10 09:27:50 +08:00
parent a9eab491d5
commit 0bf1eb6615

View File

@ -26,7 +26,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.time.temporal.ChronoUnit;
import java.util.Date;
@Slf4j
@ -65,8 +64,8 @@ public class VideoController {
@GetMapping(value = "/device/video.mp4",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@ResponseBody
public void video(HttpServletRequest request, HttpServletResponse response, @ParameterObject VideoMp4Req req) {
long forward = gb28181DeviceVideoApiConfig.getOffset().getForward().get(ChronoUnit.MILLIS);
long back = gb28181DeviceVideoApiConfig.getOffset().getBack().get(ChronoUnit.MILLIS);
long forward = gb28181DeviceVideoApiConfig.getOffset().getForward().toMillis();
long back = gb28181DeviceVideoApiConfig.getOffset().getBack().toMillis();
DateTime reqStartTime = DateUtil.date(req.getStartTime());
DateTime reqEndTime = DateUtil.date(req.getEndTime());
Date startTime = DateUtil.offsetMillisecond(reqStartTime, (int) -forward);