| | |
| | | @Value("${media.wanIp}") |
| | | private String mediaWanIp; |
| | | |
| | | @Value("${media.hookIp}") |
| | | private String mediaHookIp; |
| | | |
| | | @Value("${media.port}") |
| | | private int mediaPort; |
| | | |
| | |
| | | @Value("${server.port}") |
| | | private String serverPort; |
| | | |
| | | @Value("${media.autoConfig}") |
| | | private boolean autoConfig; |
| | | |
| | | @Autowired |
| | | private ZLMRESTfulUtils zlmresTfulUtils; |
| | | |
| | |
| | | MediaServerConfig mediaServerConfig = getMediaServerConfig(); |
| | | if (mediaServerConfig != null) { |
| | | logger.info("zlm接入成功..."); |
| | | logger.info("设置zlm..."); |
| | | saveZLMConfig(); |
| | | if (autoConfig) saveZLMConfig(); |
| | | mediaServerConfig = getMediaServerConfig(); |
| | | storager.updateMediaInfo(mediaServerConfig); |
| | | } |
| | |
| | | } |
| | | |
| | | private void saveZLMConfig() { |
| | | String hookIP = sipIP; |
| | | if (mediaIp.equals(sipIP)) { |
| | | hookIP = "127.0.0.1"; |
| | | logger.info("设置zlm..."); |
| | | if (StringUtils.isEmpty(mediaHookIp)) { |
| | | mediaHookIp = sipIP; |
| | | } |
| | | |
| | | String hookPrex = String.format("http://%s:%s/index/hook", hookIP, serverPort); |
| | | String hookPrex = String.format("http://%s:%s/index/hook", 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"); |