增加对https的支持

This commit is contained in:
panlinlin
2021-04-19 11:13:39 +08:00
parent 41ca4e938d
commit fe98e57fc4
2 changed files with 15 additions and 2 deletions

View File

@@ -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<String, Object> 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");