|
@@ -889,10 +889,8 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
//对象转换json字符串
|
|
|
String body = JSONObject.toJSONString(playbackVo);
|
|
|
//调用天网接口
|
|
|
- String playbackURLs = null;
|
|
|
- try {
|
|
|
- playbackURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
- } catch (Exception e) {
|
|
|
+ String playbackURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
+ if (StringUtils.isEmpty(playbackURLs)) {
|
|
|
return "调用天网接口失败";
|
|
|
}
|
|
|
JSONObject outJson = (JSONObject) JSONObject.parse(playbackURLs);
|
|
@@ -1119,7 +1117,12 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
/**
|
|
|
* STEP6:调用接口
|
|
|
*/
|
|
|
- String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);// post请求application/json类型参数
|
|
|
+ String result = null;// post请求application/json类型参数
|
|
|
+ try {
|
|
|
+ result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("天网异常信息----->" + e.getMessage());
|
|
|
+ }
|
|
|
log.info("GetCameraPreviewURL----->" + result);
|
|
|
long end = System.currentTimeMillis();
|
|
|
log.info("接受天网接口相应时间: " + sdf.format(new Date(end)));
|
|
@@ -1149,20 +1152,20 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
camerasVo.setTransmode(1);
|
|
|
camerasVo.setExpand("streamform=rtp");
|
|
|
String body = JSONObject.toJSONString(camerasVo);
|
|
|
- String previewURLs = null;
|
|
|
- try {
|
|
|
- previewURLs = getPreviewURLs("/api/video/v1/cameras/previewURLs", body);
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("-------异常--------"+e.getMessage());
|
|
|
- }
|
|
|
+ String previewURLs = getPreviewURLs("/api/video/v1/cameras/previewURLs", body);
|
|
|
log.info("-------------------------------->>>>>previewURLs" + previewURLs);
|
|
|
- long end = System.currentTimeMillis();
|
|
|
- JSONObject outJson = JSONObject.parse(previewURLs);
|
|
|
- stringBuilder.append("测试结果:" + ("0".equals(outJson.getString("code")) ? "成功" : "失败"));
|
|
|
- stringBuilder.append("调用时间:"+sdf.format(new Date(begin)));
|
|
|
- stringBuilder.append("数据返回时间:"+sdf.format(new Date(end)));
|
|
|
- stringBuilder.append("延迟:"+(end - begin) + "毫秒");
|
|
|
- return stringBuilder.toString();
|
|
|
+ if (StringUtils.isEmpty(previewURLs)){
|
|
|
+ log.info("天网接口异常");
|
|
|
+ return "天网接口异常";
|
|
|
+ }else {
|
|
|
+ long end = System.currentTimeMillis();
|
|
|
+ JSONObject outJson = JSONObject.parse(previewURLs);
|
|
|
+ stringBuilder.append("测试结果:" + ("0".equals(outJson.getString("code")) ? "成功" : "失败"));
|
|
|
+ stringBuilder.append("调用时间:" + sdf.format(new Date(begin)));
|
|
|
+ stringBuilder.append("数据返回时间:" + sdf.format(new Date(end)));
|
|
|
+ stringBuilder.append("延迟:" + (end - begin) + "毫秒");
|
|
|
+ return stringBuilder.toString();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public String stopStream(String cameraIndexCode, String channel) {
|
|
@@ -1210,10 +1213,8 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
camerasVo.setTransmode(1);
|
|
|
camerasVo.setExpand("streamform=rtp");
|
|
|
String body = JSONObject.toJSONString(camerasVo);
|
|
|
- String previewURLs = null;
|
|
|
- try {
|
|
|
- previewURLs = getPreviewURLs("/api/video/v1/cameras/previewURLs", body);
|
|
|
- } catch (Exception e) {
|
|
|
+ String previewURLs = getPreviewURLs("/api/video/v1/cameras/previewURLs", body);
|
|
|
+ if (StringUtils.isEmpty(previewURLs)) {
|
|
|
return "天网无视频-" + camerasVo.getCameraIndexCode();
|
|
|
}
|
|
|
log.info("-------------------------------->>>>>previewURLs" + previewURLs);
|
|
@@ -1284,10 +1285,8 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
//调用天网接口
|
|
|
log.info("body----->" + body);
|
|
|
//获取回放视频的url
|
|
|
- String playbackURLs = null;
|
|
|
- try {
|
|
|
- playbackURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
- } catch (Exception e) {
|
|
|
+ String playbackURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
+ if (StringUtils.isEmpty(playbackURLs)) {
|
|
|
return "天网无视频-" + code;
|
|
|
}
|
|
|
log.info("playbackURLs----->" + playbackURLs);
|