海康摄像头对接,通过海康综合安防管理平台对接 1. 海康综合安防管理平台介绍 1.1 官网介绍 1.2 个人理解 综合安防管理平台部署之后,有2个系统,一个是综合安防管理平台:是用户端系统,一个是运营中心:是综合安防平台的后台管理系统,可
综合安防管理平台部署之后,有2个系统,一个是综合安防管理平台:是用户端系统,一个是运营中心:是综合安防平台的后台管理系统,可提供api与业务平台对接,实现实时预览、录播回放、语音对讲、报警订阅等功能。
通过对接综合安防平台API实现摄像头的实时预览,录播回放,语音对讲,安全帽监测
说明: 该秘钥是获取api权限的秘钥
controller
@Apioperation(value = "分页获取监控点资源") @GetMapping(value = "/GetResource") public String postGetResource() { return cameraService.callPostApiGetResources(); }
sereviceImpl
@Override public String callPostApiGetResources() { ArtemisConfig config = new ArtemisConfig(); config.setHost(artemisHost); // 代理API网关Nginx服务器ip端口 config.setAppKey(artemisAppKey); // 秘钥appkey config.setAppSecret(artemisAppSecret);// 秘钥appSecret String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/cameras"; Map paramMap = new HashMap();// post请求FORM表单参数 paramMap.put("pageNo", "1"); paramMap.put("pageSize", "20"); String body = JSON.tojsON(paramMap).toString(); Map path = new HashMap(2) { { put("https://", getCamsApi); } }; String result = null; try { result = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json"); log.info(MessageFormat.format("分页获取监控点资源{0}", result)); } catch (Exception e) { e.printStackTrace(); } return result; }
返回值
{ "code": "0", "msg": "success", "data": { "total": 1, "pageNo": 1, "pageSize": 100, "list": [ { "cameraIndexCode": "a8f74dcf14f846bb95c8dff6684f897e", "cameraName": "193GB_IPCamera 01", "cameraType": 0, "cameraTypeName": "1", "capabilitySet": "645f0a62-05ff-4396-a687-944c3f0406d6", "capabilitySetName": "0", "intelligentSet": "0", "intelligentSetName": "null", "channelNo": "1", "channelType": "analog", "channelTypeName": "null", "createTime": "null", "encodeDevIndexCode": "73c2e4903a4547f8812a26d329802cd0", "encodeDevResourceType": "null", "encodeDevResourceTypeName": "null", "gbIndexCode": "null", "installLocation": "29", "keyBoardCode": "ga_h264", "latitude": "null", "longitude": "null", "pixel": 1, "ptz": 1, "ptzController": 1, "ptzControllerName": "123", "ptzName": "1234", "recordLocation": "0", "recordLocationName": "0", "regionIndexCode": "123", "status": 1, "statusName": "123", "transType": 0, "transTypeName": "1", "treatyType": "1", "treatyTypeName": "1", "viewshed": "123", "updateTime": "1234567489" } ] }}
拿到对应的摄像头的主键cameraIndexCode,保存到数据库,后面调用实时预览接口,对应哪一个摄像头设备,用到这个cameraIndexCode
controller
@ApiOperation(value = "获取当前监控点的预览url") @GetMapping(value = "/getOnePreviewUrl") public ajaxResult getOnePreviewUrl(@RequestParam(value = "cameraIndexCode") String cameraIndexCode) { String url = cameraService.callPostApiPreviewUrl(cameraIndexCode, "rtmp"); return AjaxResult.successData(url); }
serviceImpl
@Override public String callPostApiPreviewUrl(String cameraIndexCode, String protocol) { ArtemisConfig config = new ArtemisConfig(); config.setHost(artemisHost); // 代理API网关nginx服务器ip端口 config.setAppKey(artemisAppKey); // 秘钥appkey config.setAppSecret(artemisAppSecret);// 秘钥appSecret String getCamsApi = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs"; Map paramMap = new HashMap();// post请求Form表单参数 paramMap.put("cameraIndexCode", cameraIndexCode); paramMap.put("streamType", 0); paramMap.put("protocol", protocol); String body = JSON.toJSON(paramMap).toString(); Map path = new HashMap(2) { { put("https://", getCamsApi); } }; String result = null; try { result = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json"); log.info(MessageFormat.format("获取监控点预览取流URL{0}", result)); JSONObject jsonObject = JSON.parseObject(result); String code = jsonObject.getString("code"); if("0".equals(code)){ String data = jsonObject.getString("data"); return data; } } catch (Exception e) { e.printStackTrace(); } return result; }
返回值
{ "code": "0", "msg": "success", "data": { "url": "rtsp://10.2.145.66:655/EUrl/CLJ52BW" }}
根据返回值中的url,放到vlc播放器中可测试是否正确(点击媒体-打开网络串流)
测试正确,播放正常,把该yrl返回给前端,让前端调用h5播放器,播放该url即可。
来源地址:https://blog.csdn.net/liupantao/article/details/129950713
--结束END--
本文标题: 海康 综合安防管理平台 对接
本文链接: https://lsjlt.com/news/372011.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-04-01
2024-04-03
2024-04-03
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0