From ecaf8750dd9c537e581ae05c65be9a26db5e67a7 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 24 十一月 2020 16:41:00 +0800
Subject: [PATCH] 完成向上级联->注册

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
index 7d7edf4..66f8e61 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
@@ -13,6 +13,7 @@
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -31,6 +32,9 @@
 
     @Value("${media.ip}")
     private String mediaIp;
+
+    @Value("${media.wanIp}")
+    private String mediaWanIp;
 
     @Value("${media.port}")
     private int mediaPort;
@@ -61,11 +65,8 @@
             saveZLMConfig();
             mediaServerConfig = getMediaServerConfig();
             storager.updateMediaInfo(mediaServerConfig);
-
         }
     }
-
-
 
     public MediaServerConfig getMediaServerConfig() {
         JSONObject responseJSON = zlmresTfulUtils.getMediaServerConfig();
@@ -75,6 +76,7 @@
             if (data != null && data.size() > 0) {
                 mediaServerConfig = JSON.parseObject(JSON.toJSONString(data.get(0)), MediaServerConfig.class);
                 mediaServerConfig.setLocalIP(mediaIp);
+                mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp);
             }
         } else {
             logger.error("getMediaServerConfig澶辫触, 1s鍚庨噸璇�");
@@ -96,9 +98,11 @@
 
         String hookPrex = String.format("http://%s:%s/index/hook", hookIP, serverPort);
         Map<String, Object> param = new HashMap<>();
-        param.put("secret",mediaSecret);
+        param.put("api.secret",mediaSecret); // -profile:v Baseline
+        param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264  -f flv %s");
         param.put("hook.enable","1");
         param.put("hook.on_flow_report","");
+        param.put("hook.on_play","");
         param.put("hook.on_http_access","");
         param.put("hook.on_publish",String.format("%s/on_publish", hookPrex));
         param.put("hook.on_record_mp4","");
@@ -107,6 +111,7 @@
         param.put("hook.on_rtsp_realm","");
         param.put("hook.on_server_started",String.format("%s/on_server_started", hookPrex));
         param.put("hook.on_shell_login",String.format("%s/on_shell_login", hookPrex));
+        param.put("hook.on_stream_changed",String.format("%s/on_stream_changed", hookPrex));
         param.put("hook.on_stream_none_reader",String.format("%s/on_stream_none_reader", hookPrex));
         param.put("hook.on_stream_not_found",String.format("%s/on_stream_not_found", hookPrex));
         param.put("hook.timeoutSec","20");

--
Gitblit v1.8.0