Commit d829cd7a authored by fengyasheng's avatar fengyasheng

海康历史视频接口

parent f397516b
package net.wanji.opt.controllerv2.hikvideo;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import java.util.*;
public class GetCameraPreviewURL {
public static String GetCameraPreviewURL(String cameraIndexCode,String beginTime,String endTime,String recordLocation) {
/**
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
*/
ArtemisConfig.host = "37.10.253.17:443"; // 平台的ip端口
ArtemisConfig.appKey = "26868396"; // 密钥appkey
ArtemisConfig.appSecret = "HYD9kdmg8pxy96xfZB7T";// 密钥appSecret
/**
* STEP2:设置OpenAPI接口的上下文
*/
final String ARTEMIS_PATH = "/artemis";
/**
* STEP3:设置接口的URI地址
*/
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/cameras/playbackURLs";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
/**
* STEP4:设置参数提交方式
*/
String contentType = "application/json";
/**
* STEP5:组装请求参数
*/
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("beginTime", beginTime);
jsonBody.put("endTime", endTime);
jsonBody.put("recordLocation", recordLocation);
jsonBody.put("protocol", "rtsp");
jsonBody.put("needReturnClipInfo", true);
jsonBody.put("uuid", "");
jsonBody.put("expand", "transCode=0");
String body = jsonBody.toJSONString();
/**
* STEP6:调用接口
*/
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
return result;
}
public static void main(String[] args) {
String result = GetCameraPreviewURL("3ceaf62b4bfc471da75c9c18efaec009","2025-03-20T00:00:00.000+08:00","2025-03-20T00:00:05.000+08:00","0");
System.out.println("result结果示例: " + result);
}
}
package net.wanji.opt.controllerv2.hikvideo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HikVideoController {
@RequestMapping("/test")
public void getHikVideo(String crossId){
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment