追加 小程序 获取视频流接口
This commit is contained in:
parent
c5e6bd8db5
commit
14f9e25b4a
@ -39,7 +39,7 @@ public class HikController {
|
|||||||
@Operation(summary = "视频播放->查询播放地址(微信用)")
|
@Operation(summary = "视频播放->查询播放地址(微信用)")
|
||||||
public CommonResult<String> getMCameraUrl(String cameraCode) {
|
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 );
|
String fullUrl = String.format("https://api.znkj.ispt.com.cn/demo/mobile_play.html?url=%s",url );
|
||||||
return CommonResult.success(fullUrl);
|
return CommonResult.success(fullUrl);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,14 @@ public interface HikService {
|
|||||||
*/
|
*/
|
||||||
String getPreviewUrlsApi(String cameraCode, Integer streamType);
|
String getPreviewUrlsApi(String cameraCode, Integer streamType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询播放地址 https
|
||||||
|
*
|
||||||
|
* @param cameraCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getPreviewUrlsApiHttps(String cameraCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取回放流
|
* 获取回放流
|
||||||
*
|
*
|
||||||
|
@ -66,6 +66,39 @@ public class HikServiceImpl implements HikService {
|
|||||||
return null;
|
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
|
@Override
|
||||||
public JSONObject getReplayUrl(CameraReplayDTO replayDTO) {
|
public JSONObject getReplayUrl(CameraReplayDTO replayDTO) {
|
||||||
final String replayUrlApi = ArtemisApiConstant.replayUrlApi;
|
final String replayUrlApi = ArtemisApiConstant.replayUrlApi;
|
||||||
|
Loading…
Reference in New Issue
Block a user