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: