Merge branch 'frx' into dev

This commit is contained in:
furongxin 2024-06-17 15:43:02 +08:00
commit 8e7aff39cc
3 changed files with 42 additions and 1 deletions

View File

@ -39,7 +39,7 @@ public class HikController {
@Operation(summary = "视频播放->查询播放地址(微信用)")
public CommonResult<String> getMCameraUrl(String cameraCode) {
String url = hikService.getPreviewUrlsApi(cameraCode, 0);
String url = hikService.getPreviewUrlsApiHttps(cameraCode);
String fullUrl = String.format("https://api.znkj.ispt.com.cn/demo/mobile_play.html?url=%s",url );
return CommonResult.success(fullUrl);
}

View File

@ -20,6 +20,14 @@ public interface HikService {
*/
String getPreviewUrlsApi(String cameraCode, Integer streamType);
/**
* 查询播放地址 https
*
* @param cameraCode
* @return
*/
String getPreviewUrlsApiHttps(String cameraCode);
/**
* 获取回放流
*

View File

@ -66,6 +66,39 @@ public class HikServiceImpl implements HikService {
return null;
}
@Override
public String getPreviewUrlsApiHttps(String cameraIndexCode) {
final String previewUrlsApi = ArtemisApiConstant.previewUrlsApi;
Map<String, String> path = new HashMap<String, String>(1) {
{
put("https://", previewUrlsApi);
}
};
JSONObject body = new JSONObject();
body.put("cameraIndexCode", cameraIndexCode);
body.put("streamType", 0);
body.put("protocol", "wss");
body.put("transmode", 1);
body.put("expand", "streamform=ps");
try {
String result = ArtemisHttpUtil
.doPostStringArtemis(path, JSONUtil.toJsonStr(body), null, null, "application/json");
log.info("{}监控查看预览地址返回:{}", JSONUtil.toJsonStr(body), result);
if (StringUtils.isEmpty(result)) {
System.out.println("监控查看预览地址返回为空");
}
JSONObject json = JSONUtil.parseObj(result);
String url = "";
if (json.getJSONObject("data") != null) {
url = json.getJSONObject("data").getStr("url");
}
return url;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public JSONObject getReplayUrl(CameraReplayDTO replayDTO) {
final String replayUrlApi = ArtemisApiConstant.replayUrlApi;