大华视频监控对接
几种不同方案的兼容性表:
https://open-icc.dahuatech.com/#/videoDoc/integration_web
推荐使用:
WSPlayer无插件播放器
wsplayer播放器demo下载地址:
https://open-icc.dahuatech.com/#/download?currentTab=4
下载压缩包里面有一个对接文档,按对接文档的说明,因为跨域的问题,因此需要弄后台接口代理代理大华接口服务。
下面是API文档的网页地址:
关于后台接口的转发代理,不用自己写,大华给了java示例代码(c++的也有),可以直接调用:
将示例java代码移植到项目后台中去,然后配置大华平台服务的ip、端口、key等信息即可。
只有调用部分是自己写的,代码如下:
packageorg.jeecg.modules.pollute.controller;importcom.alibaba.fastjson.JSONObject;importcom.dahuatech.icc.demo.brm.device.DeviceDemo;importcom.dahuatech.icc.demo.video.ptzControl.PtzControlDemo;importcom.dahuatech.icc.demo.video.realTimePreview.RealTimePreviewDemo;importcom.dahuatech.icc.demo.video.videoReplay.VideoReplayDemo;importcom.dahuatech.icc.model.brm.device.ChannelPageRequest;importcom.dahuatech.icc.model.brm.device.ChannelPageResponse;importcom.dahuatech.icc.model.brm.device.DeviceTreeRequest;importcom.dahuatech.icc.model.brm.device.DeviceTreeResponse;importcom.dahuatech.icc.model.video.ptzControl.OperateCameraRequest;importcom.dahuatech.icc.model.video.ptzControl.OperateCameraResponse;importcom.dahuatech.icc.model.video.ptzControl.OperateDirectRequest;importcom.dahuatech.icc.model.video.ptzControl.OperateDirectResponse;importcom.dahuatech.icc.model.video.realTimePreview.RtspUrlRequest;importcom.dahuatech.icc.model.video.realTimePreview.RtspUrlResponse;importcom.dahuatech.icc.model.video.videoReplay.PlayBackByTimeResponse;importcom.dahuatech.icc.model.video.videoReplay.PlaybackByTimeRequest;importcom.dahuatech.icc.model.video.videoReplay.RegularVideoRecordRequest;importcom.dahuatech.icc.model.video.videoReplay.RegularVideoRecordResponse;importio.swagger.annotations.Api;importio.swagger.annotations.ApiOperation;importlombok.extern.slf4j.Slf4j;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.web.bind.annotation.RequestBody;importorg.springframework.web.bind.annotation.RequestMapping;importorg.springframework.web.bind.annotation.RequestMethod;importorg.springframework.web.bind.annotation.RestController;importjavax.servlet.http.HttpServletRequest;importjava.util.Arrays;/*** 鉴权的获取公钥和认证这2个接口不用显示调用,会自动执行。无需关心token有效时间,保活等
*
* @Author dengjie
*@since2020-01-20*/@Slf4j
@Api(tags="大华视频接口")
@RestController
@RequestMapping("/pollute/dahuatech")public classDahuatechController
{
@AutowiredprivateHttpServletRequest request;
@ApiOperation(value="设备树查询", notes="设备树查询")
@RequestMapping(value= "/getDeviceTree", method =RequestMethod.POST)publicDeviceTreeResponse getDeviceTree(@RequestBody DeviceTreeRequest obj)
{returnDeviceDemo.getDeviceTree(obj);
}
@ApiOperation(value="设备通道分页查询", notes="设备通道分页查询")
@RequestMapping(value= "/getChannelPage", method =RequestMethod.POST)publicChannelPageResponse getChannelPage(@RequestBody ChannelPageRequest obj)
{returnDeviceDemo.getChannelPage(obj);
}
@ApiOperation(value="实时-获取视频流", notes="实时-获取视频流")
@RequestMapping(value= "/StartVideo", method =RequestMethod.POST)publicRtspUrlResponse StartVideo(@RequestBody RtspUrlRequest obj)
{returnRealTimePreviewDemo.getRtspUrl(obj);
}
@ApiOperation(value="回放-获取录像文件", notes="回放-获取录像文件")
@RequestMapping(value= "/QueryRecords", method =RequestMethod.POST)publicRegularVideoRecordResponse QueryRecords(@RequestBody RegularVideoRecordRequest obj)
{returnVideoReplayDemo.getRegularVideoRecords(obj);
}
@ApiOperation(value="回放-获取视频流", notes="回放-获取视频流")
@RequestMapping(value= "/StartPlaybackByTime", method =RequestMethod.POST)publicPlayBackByTimeResponse StartPlaybackByTime(@RequestBody PlaybackByTimeRequest obj)
{returnVideoReplayDemo.getPlaybackByTimeRtspUrl(obj);
}
@ApiOperation(value="云台-方向控制", notes="云台-方向控制")
@RequestMapping(value= "/OperateDirect", method =RequestMethod.POST)publicOperateDirectResponse OperateDirect(@RequestBody OperateDirectRequest obj)
{returnPtzControlDemo.operateDirect(obj);
}
@ApiOperation(value="云台-镜头控制", notes="云台-镜头控制")
@RequestMapping(value= "/OperateCamera", method =RequestMethod.POST)publicOperateCameraResponse OperateCamera(@RequestBody OperateCameraRequest obj)
{returnPtzControlDemo.operateCamera(obj);
}
}
总结一下和海康平台的区别:
海康:需要插件、不需要后台服务代理
大华:不需要插件,需要后台服务代理
最后申请
clientId和
clientSecret
凭证的方法和步骤详见下面页面说明: