Commit 456f90cd25edf82b11f5c6cbc855aaa1dd8828b3

Authored by lawrencehj
1 parent 11e8fad2

修正打包jar后截图路径,优化截图Timeout参数

src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -96,15 +96,16 @@ public class PlayServiceImpl implements IPlayService {
96 96 try {
97 97 String classPath = ResourceUtils.getURL("classpath:").getPath();
98 98 // System.out.println(classPath);
99   - String path = classPath + "static/static/snap/";
  99 + // 兼容打包为jar的class路径
100 100 if(classPath.contains("jar")) {
101 101 classPath = classPath.substring(0, classPath.lastIndexOf("."));
102   - classPath = classPath.substring(0, classPath.lastIndexOf("/"));
103   - path = classPath + "/snap/";
  102 + classPath = classPath.substring(0, classPath.lastIndexOf("/") + 1);
104 103 }
105   - if (path.startsWith("file:")) {
106   - path = path.substring(path.indexOf(":") + 1, path.length());
  104 + if (classPath.startsWith("file:")) {
  105 + classPath = classPath.substring(classPath.indexOf(":") + 1, classPath.length());
107 106 }
  107 + String path = classPath + "static/static/snap/";
  108 + // 兼容Windows系统路径(去除前面的“/”)
108 109 if(System.getProperty("os.name").contains("indows")) {
109 110 path = path.substring(1, path.length());
110 111 }
... ... @@ -116,7 +117,7 @@ public class PlayServiceImpl implements IPlayService {
116 117 StreamInfo streamInfoForSuccess = (StreamInfo)wvpResult.getData();
117 118 String flvUrl = streamInfoForSuccess.getFlv();
118 119 // 请求截图
119   - zlmresTfulUtils.getSnap(flvUrl, 5, 1, path, fileName);
  120 + zlmresTfulUtils.getSnap(flvUrl, 15, 1, path, fileName);
120 121 }
121 122 }
122 123 System.out.println(path);
... ...