feat: 点播后开始的截图任务使用内网IP(http)

Signed-off-by: duzeng <duzengrass@163.com>
pull/644/head
duzeng 2022-10-17 11:55:47 +08:00
parent d34abab2c7
commit f70b1140b3
3 changed files with 20 additions and 8 deletions

View File

@ -11,6 +11,10 @@ public class StreamInfo {
private String channelId;
private String ip;
private String intranetIp;
private String mediaServerId;
private Object tracks;
private String startTime;
@ -18,7 +22,6 @@ public class StreamInfo {
private double progress;
private boolean pause;
private Integer rtmpPort;
private Integer rtmpSslPort;
private Integer rtspPort;
@ -26,8 +29,6 @@ public class StreamInfo {
private Integer httpPort;
private Integer httpSSLPort;
private String callId;
public static class TransactionInfo {
@ -138,6 +139,15 @@ public class StreamInfo {
return this;
}
public String getIntranetIp() {
return intranetIp;
}
public StreamInfo setIntranetIp(String intranetIp) {
this.intranetIp = intranetIp;
return this;
}
public boolean isPause() {
return pause;
}
@ -186,7 +196,7 @@ public class StreamInfo {
}
public StreamInfo setCallId(String callId) {
this.callId=callId;
this.callId = callId;
return this;
}
@ -238,6 +248,10 @@ public class StreamInfo {
return String.format("http://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
}
public String getFmp4ByIntranet() {
return String.format("http://%s:%s/%s/%s.live.mp4%s", this.intranetIp, this.httpPort, this.app, this.stream, this.getCallIdParam());
}
public String getWs_fmp4() {
return String.format("ws://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
}

View File

@ -86,6 +86,7 @@ public class MediaServiceImpl implements IMediaService {
return new StreamInfo()
.setStream(stream)
.setApp(app)
.setIntranetIp(mediaInfo.getIp())
.setIp(addr == null ? mediaInfo.getStreamIp() : addr)
.setMediaServerId(mediaInfo.getId())
.setCallId(callId)

View File

@ -113,9 +113,6 @@ public class PlayServiceImpl implements IPlayService {
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Value("${server.ssl.enabled}")
private boolean sslEnabled;
@Override
public PlayResult play(MediaServerItem mediaServerItem, String deviceId, String channelId,
ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent,
@ -149,7 +146,7 @@ public class PlayServiceImpl implements IPlayService {
if (Objects.requireNonNull(wvpResult).getCode() == 0) {
StreamInfo streamInfoForSuccess = (StreamInfo) wvpResult.getData();
MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId());
String streamUrl = sslEnabled ? streamInfoForSuccess.getHttps_fmp4() : streamInfoForSuccess.getFmp4();
String streamUrl = streamInfoForSuccess.getFmp4ByIntranet(); //streamInfoForSuccess.getFmp4();
// 请求截图
logger.info("[请求截图]: " + fileName);