From 0acf13445a2e3120f3d3599238401c9f2885d711 Mon Sep 17 00:00:00 2001
From: lawrencehj <1934378145@qq.com>
Date: 星期三, 23 六月 2021 16:21:12 +0800
Subject: [PATCH] 改为fmp4截图

---
 src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index 320cc26..535c790 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -96,15 +96,16 @@
             try {
                 String classPath = ResourceUtils.getURL("classpath:").getPath();
                 // System.out.println(classPath);
-                String path = classPath + "static/static/snap/";
+                // 鍏煎鎵撳寘涓簀ar鐨刢lass璺緞
                 if(classPath.contains("jar")) {
                     classPath = classPath.substring(0, classPath.lastIndexOf("."));
-                    classPath = classPath.substring(0, classPath.lastIndexOf("/"));
-                    path = classPath + "/snap/";
+                    classPath = classPath.substring(0, classPath.lastIndexOf("/") + 1);
                 }
-                if (path.startsWith("file:")) {
-                    path = path.substring(path.indexOf(":") + 1, path.length());
+                if (classPath.startsWith("file:")) {
+                    classPath = classPath.substring(classPath.indexOf(":") + 1, classPath.length());
                 }
+                String path = classPath + "static/static/snap/";
+                // 鍏煎Windows绯荤粺璺緞锛堝幓闄ゅ墠闈㈢殑鈥�/鈥濓級
                 if(System.getProperty("os.name").contains("indows")) {
                     path = path.substring(1, path.length());
                 }
@@ -114,9 +115,9 @@
                     WVPResult wvpResult = (WVPResult)responseEntity.getBody();
                     if (wvpResult.getCode() == 0) {
                         StreamInfo streamInfoForSuccess = (StreamInfo)wvpResult.getData();
-                        String flvUrl = streamInfoForSuccess.getFlv();
+                        String streamUrl = streamInfoForSuccess.getFmp4();
                         // 璇锋眰鎴浘
-                        zlmresTfulUtils.getSnap(flvUrl, 5, 1, path, fileName);
+                        zlmresTfulUtils.getSnap(streamUrl, 15, 1, path, fileName);
                     }
                 }
                 System.out.println(path);

--
Gitblit v1.8.0