From 9117294d0aa6146e40f987e68bee24aaffa9df68 Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Mon, 19 Apr 2021 11:13:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9https=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/media/zlm/ZLMRunner.java | 7 +++++-- src/main/resources/application-dev.yml | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 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 6e0bc607..2ef4cf6a 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 @@ -61,6 +61,9 @@ public class ZLMRunner implements CommandLineRunner { @Value("${media.autoConfig}") private boolean autoConfig; + @Value("${server.ssl.enabled}") + private boolean sslEnabled; + @Autowired private ZLMRESTfulUtils zlmresTfulUtils; @@ -116,8 +119,8 @@ public class ZLMRunner implements CommandLineRunner { if (StringUtils.isEmpty(mediaHookIp)) { mediaHookIp = sipIP; } - - String hookPrex = String.format("http://%s:%s/index/hook", mediaHookIp, serverPort); + String protocol = sslEnabled ? "https" : "http"; + String hookPrex = String.format("%s://%s:%s/index/hook", protocol, mediaHookIp, serverPort); Map param = new HashMap<>(); 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"); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index fad47f9c..e1397d7a 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -31,6 +31,16 @@ spring: # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 server: port: 18080 + # [可选] HTTPS配置, 默认不开启 + ssl: + # [可选] 是否开启HTTPS访问 + enabled: false + # [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名 + key-store: classpath:xxx.jks + # [可选] 证书密码 + key-password: password + # [可选] 证书类型, 默认为jks,根据实际修改 + key-store-type: JKS # 作为28181服务器的配置 sip: