一、海康威视NVR SDK下载
SDK下载地址 根据你的设备或者运行环境选择相应的版本(文章用的是win64版)
二、引入海康SDK
1.将海康提供的jar包导入到本地Maven库
【传送门】导入步骤 百度网盘Maven导入JAR 提取码:q4w3 Maven导入方式
<!-- 海康JNA jar包 -->
<dependency>
<groupId>com.sun.jna</groupId>
<artifactId>jna</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- 海康examples jar包 -->
<dependency>
<groupId>com.sun.jna.examples</groupId>
<artifactId>examples</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
2.将SDK放在项目中
将DLL文件库放到静态资源目录下,一面打JAR包时找不到文件库
3.配置文件读取
获取静态资源文件夹路径
public class CommonKit {
public static String getWebPath(){
String path = CommonKit.class.getClassLoader().getResource("").getPath().substring(1);
return path+"dll\\";
}
}
修改SDK中DLL库读取
public interface HCNetSDK extends StdCallLibrary {
HCNetSDK INSTANCE = (HCNetSDK) Native.loadLibrary(CommonKit.getWebPath()+"HCNetSDK.dll", HCNetSDK.class);
}
同理PlayCtrl也一样
public interface PlayCtrl extends StdCallLibrary {
PlayCtrl INSTANCE = (PlayCtrl) Native.loadLibrary(CommonKit.getWebPath()+"PlayCtrl.dll", PlayCtrl.class);
}
三、写常用的接口
3.1根据时间获取文件
Controller:
package com.hikvision.nvr.controller;
import com.hikvision.nvr.common.AjaxResult;
import com.hikvision.nvr.domain.RequestVo;
import com.hikvision.nvr.service.FindVideoFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping(value = "/nvr")
@Api(value = "调用NVR接口", description = "调用NVR接口", tags = {"调用NVR接口"})
public class NvrControcller {
@Autowired
private FindVideoFileService downloadVideoService;
@RequestMapping(value = "/playback")
@ApiOperation(value = "根据时间获取文件", httpMethod = "POST", notes = "根据时间获取文件")
public AjaxResult playback(@RequestBody RequestVo requestVo) throws InterruptedException {
return AjaxResult.success(downloadVideoService.playback(requestVo));
}
@RequestMapping(value = "/downloadByFileNmae")
@ApiOperation(value = "根据文件名下载", httpMethod = "POST", notes = "根据文件名下载")
public AjaxResult downloadByFileNmae(@RequestParam String fileName, @RequestBody RequestVo requestVo) {
return AjaxResult.success(downloadVideoService.downloadByFileNmae(fileName, requestVo));
}
@RequestMapping(value = "/downloadByFileTime")
@ApiOperation(value = "根据时间下载", httpMethod = "POST", notes = "根据时间下载")
public AjaxResult downloadByFileTime(@RequestBody RequestVo requestVo) {
return AjaxResult.success(downloadVideoService.downloadByFileTime(requestVo));
}
@RequestMapping(value = "/getDeviceInformation")
@ApiOperation(value = "获取设备信息", httpMethod = "POST", notes = "获取设备信息")
public AjaxResult getDeviceInformation(@RequestBody RequestVo requestVo) {
return AjaxResult.success(downloadVideoService.getDeviceInformation(requestVo));
}
@RequestMapping(value = "/getBackUrl")
@ApiOperation(value = "获取回放视频流", httpMethod = "POST", notes = "获取回放视频流")
public AjaxResult getBackUrl(@RequestBody RequestVo requestVo) {
requestVo.getPlayBack().setUrlType(1);
Map map = downloadVideoService.getBackUrl(requestVo);
String value = (String) map.get("msg");
if (value.startsWith("rtsp:")) {
return AjaxResult.success(map);
}
return AjaxResult.error();
}
@RequestMapping(value = "/getLiveUrl")
@ApiOperation(value = "获取实时视频流", httpMethod = "POST", notes = "获取实时视频流")
public AjaxResult getLiveUrl(@RequestBody RequestVo requestVo){
requestVo.getPlayBack().setUrlType(0);
Map map = downloadVideoService.getBackUrl(requestVo);
String value = (String) map.get("msg");
if (value.startsWith("rtsp:")) {
return AjaxResult.success(map);
}
return AjaxResult.error();
}
}
Service:
package com.hikvision.nvr.service;
import com.hikvision.nvr.domain.RequestVo;
import com.hikvision.nvr.domain.SignIn;
import com.hikvision.nvr.domain.VideoFile;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public interface FindVideoFileService {
List<VideoFile> playback(RequestVo requestVo) throws InterruptedException;
boolean downloadByFileNmae(String fileName,RequestVo requestVo);
boolean downloadByFileTime(RequestVo requestVo);
List<SignIn> getDeviceInformation(RequestVo requestVo);
Map getBackUrl(RequestVo requestVo);
}
ServiceImpl:
package com.hikvision.nvr.service.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hikvision.nvr.domain.NvrTime;
import com.hikvision.nvr.domain.PlayBack;
import com.hikvision.nvr.domain.RequestVo;
import com.hikvision.nvr.domain.SignIn;
import com.hikvision.nvr.domain.VideoFile;
import com.hikvision.nvr.service.FindVideoFileService;
import com.hikvision.nvr.service.hk.HCNetSDK;
import com.hikvision.nvr.util.*;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Slf4j
@Service
public class FindVideoFileServiceImpl implements FindVideoFileService {
public static final int NET_DVR_GET_IPPARACFG = 1048;
public static final int MAX_IP_CHANNEL = 32;
public static final int NET_DVR_FILE_SUCCESS = 1000;
public static final int NET_DVR_ISFINDING = 1002;
public static final int NET_DVR_FILE_NOFIND = 1001;
public static final int NET_DVR_PLAYSTART = 1;
public static final int NET_DVR_PLAYGETPOS = 13;
NativeLong lUserID;
NativeLong m_lDownloadHandle;
NET_DVR_DEVICEINFO_V30 m_strDeviceInfo;
HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private DataUtil dataUtil;
@Override
public List<VideoFile> playback(RequestVo requestVo) throws InterruptedException {
SignIn signIn = requestVo.getSignIn();
PlayBack playBack = requestVo.getPlayBack();
NativeLong m_lUserID = userId(signIn);
NvrTime startTime = dataUtil.dateToNum(playBack.getStartTime());
NvrTime endTime = dataUtil.dateToNum(playBack.getEndTime());
NET_DVR_TIME struStartTime;
NET_DVR_TIME struStopTime;
NET_DVR_FILECOND m_strFilecond = new NET_DVR_FILECOND();
m_strFilecond.struStartTime = new NET_DVR_TIME();
m_strFilecond.struStopTime = new NET_DVR_TIME();
m_strFilecond.struStartTime.dwYear = startTime.getDwYear();
m_strFilecond.struStartTime.dwMonth = startTime.getDwMonth();
m_strFilecond.struStartTime.dwDay = startTime.getDwDay();
m_strFilecond.struStartTime.dwHour = startTime.getDwHour();
m_strFilecond.struStartTime.dwMinute = startTime.getDwMinute();
m_strFilecond.struStartTime.dwSecond = startTime.getDwSecond();
m_strFilecond.struStopTime.dwYear = endTime.getDwYear();
m_strFilecond.struStopTime.dwMonth = endTime.getDwMonth();
m_strFilecond.struStopTime.dwDay = endTime.getDwDay();
m_strFilecond.struStopTime.dwHour = endTime.getDwHour();
m_strFilecond.struStopTime.dwMinute = endTime.getDwMinute();
m_strFilecond.struStopTime.dwSecond = endTime.getDwSecond();
m_strFilecond.dwFileType = 0;
m_strFilecond.dwIsLocked = 0xff;
m_strFilecond.dwUseCardNo = 0;
m_strFilecond.lChannel = new NativeLong(playBack.getChannelNumber());
NativeLong lFindFile = hCNetSDK.NET_DVR_FindFile_V30(m_lUserID, m_strFilecond);
NET_DVR_FINDDATA_V30 strFile = new NET_DVR_FINDDATA_V30();
long findFile = lFindFile.longValue();
if (findFile > -1) {
log.info("file:{}" + findFile);
}
NativeLong lnext;
strFile = new NET_DVR_FINDDATA_V30();
List<VideoFile> videoFiles = new ArrayList<>();
while (true) {
lnext = hCNetSDK.NET_DVR_FindNextFile_V30(lFindFile, strFile);
if (lnext.longValue() == NET_DVR_FILE_SUCCESS) {
log.info("搜索成功");
String[] s = new String[2];
s = new String(strFile.sFileName).split("\0", 2);
VideoFile videoFile = new VideoFile();
int iTemp;
String MyString;
if (strFile.dwFileSize < 1024 * 1024) {
iTemp = (strFile.dwFileSize) / (1024);
MyString = iTemp + "K";
} else {
iTemp = (strFile.dwFileSize) / (1024 * 1024);
MyString = iTemp + "M ";
iTemp = ((strFile.dwFileSize) % (1024 * 1024)) / (1204);
MyString = MyString + iTemp + "K";
}
videoFile.setFileNme(new String(s[0]));
videoFile.setFileSize(MyString);
videoFile.setStartTime(strFile.struStartTime.toStringTime());
videoFile.setEndTime(strFile.struStopTime.toStringTime());
videoFiles.add(videoFile);
} else {
if (lnext.longValue() == NET_DVR_ISFINDING) {
log.info("搜索中");
continue;
} else {
if (lnext.longValue() == NET_DVR_FILE_NOFIND) {
log.info("没有搜到文件");
return videoFiles;
} else {
log.info("搜索文件结束");
boolean flag = hCNetSDK.NET_DVR_FindClose_V30(lFindFile);
if (flag == false) {
log.info("结束搜索失败");
}
return videoFiles;
}
}
}
}
}
@Override
public boolean downloadByFileNmae(String fileName, RequestVo requestVo) {
NativeLong nativeLong = userId(requestVo.getSignIn());
m_lDownloadHandle = new NativeLong(-1);
if (m_lDownloadHandle.intValue() == -1) {
m_lDownloadHandle = hCNetSDK.NET_DVR_GetFileByName(nativeLong, fileName, "D:\\fileNme.3GP");
if (m_lDownloadHandle.intValue() >= 0) {
boolean downloadFlag = hCNetSDK.NET_DVR_PlayBackControl(m_lDownloadHandle, NET_DVR_PLAYSTART, 0, null);
int tmp = -1;
IntByReference pos = new IntByReference();
while (true) {
boolean backFlag = hCNetSDK.NET_DVR_PlayBackControl(m_lDownloadHandle, NET_DVR_PLAYGETPOS, 0, pos);
if (!backFlag) {
return downloadFlag;
}
int produce = pos.getValue();
if ((produce % 10) == 0 && tmp != produce) {
tmp = produce;
log.info("视频下载进度:{}", produce + "%");
}
if (produce == 100) {
hCNetSDK.NET_DVR_StopGetFile(m_lDownloadHandle);
m_lDownloadHandle.setValue(-1);
hCNetSDK.NET_DVR_Logout(lUserID);
log.info("退出状态:{}", hCNetSDK.NET_DVR_GetLastError());
return true;
}
if (produce > 100) {
hCNetSDK.NET_DVR_StopGetFile(m_lDownloadHandle);
m_lDownloadHandle.setValue(-1);
log.warn("由于网络原因或NVR较忙,下载异常终止!错误原因:{}", hCNetSDK.NET_DVR_GetLastError());
hCNetSDK.NET_DVR_Logout(lUserID);
return false;
}
}
} else {
log.info("视频下载失败!失败原因:{}", hCNetSDK.NET_DVR_GetLastError());
return false;
}
}
return true;
}
@Override
public boolean downloadByFileTime(RequestVo requestVo) {
PlayBack playBack = requestVo.getPlayBack();
NativeLong nativeLong = userId(requestVo.getSignIn());
if (nativeLong.intValue() == -1) {
return false;
}
m_lDownloadHandle = new NativeLong(-1);
if (m_lDownloadHandle.intValue() == -1) {
m_lDownloadHandle = hCNetSDK.NET_DVR_GetFileByTime(nativeLong, new NativeLong(playBack.getChannelNumber().longValue())
, dataUtil.getHkTime(playBack.getStartTime()), dataUtil.getHkTime(playBack.getEndTime()), "D:\\fileNme.mp4");
if (m_lDownloadHandle.intValue() >= 0) {
boolean downloadFlag = hCNetSDK.NET_DVR_PlayBackControl(m_lDownloadHandle, NET_DVR_PLAYSTART, 0, null);
int tmp = -1;
IntByReference pos = new IntByReference();
while (true) {
boolean backFlag = hCNetSDK.NET_DVR_PlayBackControl(m_lDownloadHandle, NET_DVR_PLAYGETPOS, 0, pos);
if (!backFlag) {
return downloadFlag;
}
int produce = pos.getValue();
if ((produce % 10) == 0 && tmp != produce) {
tmp = produce;
log.info("视频下载进度:{}", produce + "%");
}
if (produce == 100) {
hCNetSDK.NET_DVR_StopGetFile(m_lDownloadHandle);
m_lDownloadHandle.setValue(-1);
hCNetSDK.NET_DVR_Logout(lUserID);
log.info("退出状态:{}", hCNetSDK.NET_DVR_GetLastError());
return true;
}
if (produce > 100) {
hCNetSDK.NET_DVR_StopGetFile(m_lDownloadHandle);
m_lDownloadHandle.setValue(-1);
log.warn("由于网络原因或NVR较忙,下载异常终止!错误原因:{}", hCNetSDK.NET_DVR_GetLastError());
hCNetSDK.NET_DVR_Logout(lUserID);
return false;
}
}
} else {
log.info("视频下载失败!失败原因:{}", hCNetSDK.NET_DVR_GetLastError());
return false;
}
}
return true;
}
public NativeLong userId(SignIn signIn) {
boolean initSuc = hCNetSDK.NET_DVR_Init();
if (initSuc != true) {
log.info("初始化失败");
}
if (lUserID != null && lUserID.longValue() > -1) {
hCNetSDK.NET_DVR_Logout_V30(lUserID);
lUserID = new NativeLong(-1);
}
lUserID = hCNetSDK.NET_DVR_Login_V30(signIn.getIp(),
(short) signIn.getPort(), signIn.getUserName(), signIn.getPassword(), m_strDeviceInfo);
return lUserID;
}
@Override
public List<SignIn> getDeviceInformation(RequestVo requestVo) {
SignIn sign = requestVo.getSignIn();
NET_DVR_IPPARACFG m_strIpparaCfg;
List<SignIn> signIns = new ArrayList<>();
m_strDeviceInfo = new NET_DVR_DEVICEINFO_V30();
NativeLong lUserID = userId(sign);
long userID = lUserID.longValue();
if (userID == -1) {
log.info("注册失败");
return signIns;
} else {
log.info("注册成功");
int m_iTreeNodeNum = 0;
IntByReference ibrBytesReturned = new IntByReference(0);
m_strIpparaCfg = new NET_DVR_IPPARACFG();
m_strIpparaCfg.write();
Pointer lpIpParaConfig = m_strIpparaCfg.getPointer();
boolean bRet = hCNetSDK.NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_IPPARACFG, new NativeLong(0),
lpIpParaConfig, m_strIpparaCfg.size(), ibrBytesReturned);
m_strIpparaCfg.read();
if (!bRet) {
for (int iChannum = 0; iChannum < m_strDeviceInfo.byChanNum; iChannum++) {
SignIn s = new SignIn();
s.setDeviceId("Camera" + (iChannum + m_strDeviceInfo.byStartChan));
signIns.add(s);
}
} else {
for (int iChannum = 0; iChannum < m_strDeviceInfo.byChanNum; iChannum++) {
if (m_strIpparaCfg.byAnalogChanEnable[iChannum] == 1) {
SignIn s = new SignIn();
s.setDeviceId("Camera" + (iChannum + m_strDeviceInfo.byStartChan));
signIns.add(s);
m_iTreeNodeNum++;
}
}
for (int iChannum = 0; iChannum < MAX_IP_CHANNEL; iChannum++) {
if (m_strIpparaCfg.struIPChanInfo[iChannum].byChannel == 1) {
SignIn s = new SignIn();
NET_DVR_IPDEVINFO dev = m_strIpparaCfg.struIPDevInfo[iChannum];
s.setIp(new String(dev.struIP.sIpV4).trim());
s.setUserName(new String(dev.sUserName).trim());
s.setPort(dev.wDVRPort);
s.setIsLine(String.valueOf(m_strIpparaCfg.struIPChanInfo[iChannum].byEnable));
s.setDeviceId("IPCamera" + (iChannum + m_strDeviceInfo.byStartChan));
Integer channelNumber = getChannelNumber(s.getDeviceId());
s.setChannelNumber(channelNumber);
signIns.add(s);
}
}
}
log.info("摄像头资源:{}", signIns);
}
return signIns;
}
@Override
public Map getBackUrl(RequestVo requestVo) {
Map map = new HashMap();
SignIn sign = requestVo.getSignIn();
PlayBack playBack = requestVo.getPlayBack();
NativeLong nativeLong = userId(sign);
if (nativeLong.intValue() == -1) {
log.info("回放推流用户初始化失败");
map.put("msg", "回放推流用户初始化失败");
return map;
}
String url = sign.getAppId() + "/" + sign.getDeviceId();
List<SignIn> signIns = getDeviceInformation(requestVo);
int channelNum = 0;
for (SignIn signIn : signIns) {
if (signIn.getIp().equals(sign.getDeviceIp())) {
channelNum = signIn.getChannelNumber();
}
}
if (channelNum == 0) {
log.info("获取设备通道失败");
map.put("msg", "获取设备通道失败!");
return map;
}
String backUrl = "";
if (playBack.getUrlType() == 1) {
backUrl = "rtsp://admin:" + sign.getPassword() + "@" + sign.getIp() + ":554/Streaming/tracks/" + (channelNum - 32) + "01/?" +
"starttime=" + dataUtil.backTimeAssemble(playBack.getStartTime()) + "&endtime=" + dataUtil.backTimeAssemble(playBack.getEndTime());
} else {
backUrl = "rtsp://admin:" + sign.getPassword() + "@" + sign.getDeviceIp() + ":554/Streaming/tracks/" + (channelNum - 32) + "02/?" +
"transportmode=multicast";
}
map.put("msg", backUrl);
return map;
}
public int getChannelNumber(String sChannelName) {
int iChannelNum = -1;
if (sChannelName.charAt(0) == 'C') {
iChannelNum = Integer.parseInt(sChannelName.substring(6));
} else {
if (sChannelName.charAt(0) == 'I') {
iChannelNum = Integer.parseInt(sChannelName.substring(8)) + 32;
} else {
return -1;
}
}
return iChannelNum;
}
}
HCNetSDK:
package com.hikvision.nvr.service.hk;
import com.hikvision.nvr.util.*;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
public interface HCNetSDK extends StdCallLibrary {
HCNetSDK INSTANCE = (HCNetSDK) Native.loadLibrary(CommonKit.getWebPath()+"HCNetSDK.dll", HCNetSDK.class);
boolean NET_DVR_Init();
NativeLong NET_DVR_Login_V30(String sDVRIP, short wDVRPort, String sUserName, String sPassword, NET_DVR_DEVICEINFO_V30 lpDeviceInfo);
boolean NET_DVR_GetDVRConfig(NativeLong lUserID, int dwCommand, NativeLong lChannel, Pointer lpOutBuffer, int dwOutBufferSize, IntByReference lpBytesReturned);
NativeLong NET_DVR_FindFile_V30(NativeLong lUserID, NET_DVR_FILECOND pFindCond);
NativeLong NET_DVR_FindNextFile_V30(NativeLong lFindHandle, NET_DVR_FINDDATA_V30 lpFindData);
boolean NET_DVR_FindClose_V30(NativeLong lFindHandle);
boolean NET_DVR_Logout_V30(NativeLong lUserID);
NativeLong NET_DVR_GetFileByName(NativeLong lUserID, String sDVRFileName, String sSavedFileName);
boolean NET_DVR_PlayBackControl(NativeLong lPlayHandle, int dwControlCode, int dwInValue, IntByReference LPOutValue);
boolean NET_DVR_StopGetFile(NativeLong lFileHandle);
boolean NET_DVR_Logout(NativeLong lUserID);
int NET_DVR_GetLastError();
NativeLong NET_DVR_GetFileByTime(NativeLong lUserID, NativeLong lChannel, NET_DVR_TIME lpStartTime, NET_DVR_TIME lpStopTime, String sSavedFileName);
}
以及HCNetSDK中其他实体类:
四、接口请求参数
创建一个NVR.postman_collection.json的文件,将以下文本放入导入到PostMan中即可请求
{
"info": {
"_postman_id": "bb70a6f1-e3a6-45cf-b914-76e3a7622628",
"name": "NVR",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "根据时间获取文件信息",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "ip",
"value": "192.168.18.133",
"type": "text",
"disabled": true
},
{
"key": "port",
"value": "8000",
"type": "text",
"disabled": true
},
{
"key": "userName",
"value": "admin",
"type": "text",
"disabled": true
},
{
"key": "password",
"value": "a12345678",
"type": "text",
"disabled": true
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 34,\r\n \"endTime\": \"2021-11-04 18:00:00\",\r\n \"startTime\": \"2021-11-04 15:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/playback",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"playback"
]
}
},
"response": []
},
{
"name": "获取链接设备信息",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 34,\r\n \"endTime\": \"2021-11-04 18:00:00\",\r\n \"startTime\": \"2021-11-04 15:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/getDeviceInformation",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"getDeviceInformation"
]
}
},
"response": []
},
{
"name": "根据文件名下载视频",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 34,\r\n \"endTime\": \"2021-11-04 18:00:00\",\r\n \"startTime\": \"2021-11-04 15:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/downloadByFileNmae?fileName=ch0002_00010000096000000",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"downloadByFileNmae"
],
"query": [
{
"key": "fileName",
"value": "ch0002_00010000096000000"
}
]
}
},
"response": []
},
{
"name": "根据时间下载视频",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 33,\r\n \"endTime\": \"2021-11-05 18:00:00\",\r\n \"startTime\": \"2021-11-05 16:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/downloadByFileTime",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"downloadByFileTime"
]
}
},
"response": []
},
{
"name": "获取回放流地址",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 34,\r\n \"endTime\": \"2021-11-08 15:00:00\",\r\n \"startTime\": \"2021-11-08 13:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\",\r\n \"deviceIp\":\"192.168.18.183\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/getBackUrl",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"getBackUrl"
]
}
},
"response": []
},
{
"name": "获取实时视频流",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"playBack\": {\r\n \"channelNumber\": 34,\r\n \"endTime\": \"2021-11-08 15:00:00\",\r\n \"startTime\": \"2021-11-08 13:00:00\"\r\n },\r\n \"signIn\": {\r\n \"ip\": \"192.168.18.133\",\r\n \"password\": \"a12345678\",\r\n \"port\": 8000,\r\n \"userName\": \"admin\",\r\n \"deviceIp\":\"192.168.18.180\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8081/nvr/getLiveUrl",
"protocol": "http",
"host": [
"localhost"
],
"port": "8081",
"path": [
"nvr",
"getLiveUrl"
]
}
},
"response": []
}
]
}
五、项目地址
避免文件使用积分问题本项目已上传至百度网盘 百度网盘Maven导入JAR 提取码:s75w
六、总结
这是第一次对接硬件,还有很多不完善的地方希望大家谅解。有写的不好的地方请大家指出,日后考虑放到gitee以便大家一起维护。在此感谢! 原创不易,欢迎来喷…
|