diff --git a/src/main/java/com/zilber/boot/dahua/controller/DahuaController.java b/src/main/java/com/zilber/boot/dahua/controller/DahuaController.java index b643d69..8c49f68 100644 --- a/src/main/java/com/zilber/boot/dahua/controller/DahuaController.java +++ b/src/main/java/com/zilber/boot/dahua/controller/DahuaController.java @@ -14,6 +14,8 @@ import com.zilber.boot.dahua.attendance.GetResultPageResponse; import com.zilber.boot.dahua.config.OauthConfigUtil; import com.zilber.boot.dahua.device.DevicePageRequest; import com.zilber.boot.dahua.device.DevicePageResponse; +import com.zilber.boot.dahua.video.RtspUrlRequest; +import com.zilber.boot.dahua.video.RtspUrlResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -107,7 +109,7 @@ public class DahuaController { * @return * 参考API :https://open-icc.dahuatech.com/#/home?url=%3Fnav%3Dwiki%2Fevo-brm%2Fdevice.html&version=enterprisebase/5.0.17&blank=true */ - @ApiOperation(value = "门禁记录数量查询",notes = "门禁记录数量查询") + @ApiOperation(value = "设备分页查询",notes = "设备分页查询") @PostMapping("/brm/getDevicePage") public DevicePageResponse getDevicePage(DevicePageRequest devicePageRequest){ OauthConfigUserPwdInfo config = OauthConfigUtil.getOauthConfig(); @@ -125,4 +127,29 @@ public class DahuaController { return response; } + /** + * rtsp实时预览 + * @param rtspUrlRequest + * @return + * 参考API :https://open-icc.dahuatech.com/#/home?url=%3Fnav%3Dwiki%2Fevo-brm%2Fdevice.html&version=enterprisebase/5.0.17&blank=true + */ + @ApiOperation(value = " rtsp实时预览",notes = " rtsp实时预览") + @PostMapping("/video/getRtspUrl") + public RtspUrlResponse getRtspUrl(RtspUrlRequest rtspUrlRequest){ + RtspUrlResponse response=null; + OauthConfigUserPwdInfo config = OauthConfigUtil.getOauthConfig(); + try { + //log.info("RealTimePreviewDemo,getRtspUrl,request:{}", JSONUtil.toJsonStr(rtspUrlRequest)); + response = HttpUtils.executeJson("/evo-apigw/admin/API/MTS/Video/StartVideo", rtspUrlRequest,null, Method.POST , config, RtspUrlResponse.class); + //log.info("RealTimePreviewDemo,getRtspUrl,response:{}", JSONUtil.toJsonStr(response)); + } catch (ClientException e) { + log.error(e.getErrMsg(), e); + } + if(!response.getCode().equals("1000")) { + log.info("获取rtsp流地址失败:{}",response.getErrMsg()); + } + return response; + } + + } diff --git a/src/main/java/com/zilber/boot/dahua/video/RtspUrlRequest.java b/src/main/java/com/zilber/boot/dahua/video/RtspUrlRequest.java new file mode 100644 index 0000000..751bf84 --- /dev/null +++ b/src/main/java/com/zilber/boot/dahua/video/RtspUrlRequest.java @@ -0,0 +1,24 @@ +package com.zilber.boot.dahua.video; + +import lombok.Data; + +/** + *实时拉流request + */ +@Data +public class RtspUrlRequest { + + private Data data; + + @lombok.Data + public static class Data{ + + private String channelId; + + private String dataType; + + private String streamType; + } + + +} diff --git a/src/main/java/com/zilber/boot/dahua/video/RtspUrlResponse.java b/src/main/java/com/zilber/boot/dahua/video/RtspUrlResponse.java new file mode 100644 index 0000000..6eb14c1 --- /dev/null +++ b/src/main/java/com/zilber/boot/dahua/video/RtspUrlResponse.java @@ -0,0 +1,40 @@ +package com.zilber.boot.dahua.video; + +import com.dahuatech.icc.oauth.http.IccResponse; +import lombok.Data; + +/** + * 实时拉流返回 + */ +@Data +public class RtspUrlResponse extends IccResponse { + + private RtspData data; + + @Data + public static class RtspData { + + private String minRate; + + private String protocol; + + private String ip; + + private String port; + + private String stunEnable; + + private String stunPort; + + private String url; + + private String connectType; + + private String session; + + private String token; + + private String trackId; + + } +}