From f70b1140b3fe796e03fd3f9f51019c3e8ec64fb1 Mon Sep 17 00:00:00 2001 From: duzeng Date: Mon, 17 Oct 2022 11:55:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=82=B9=E6=92=AD=E5=90=8E=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E7=9A=84=E6=88=AA=E5=9B=BE=E4=BB=BB=E5=8A=A1=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=86=85=E7=BD=91IP(http)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: duzeng --- .../genersoft/iot/vmp/common/StreamInfo.java | 22 +++++++++++++++---- .../vmp/service/impl/MediaServiceImpl.java | 1 + .../iot/vmp/service/impl/PlayServiceImpl.java | 5 +---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java index 5d2fd3759..dafa69ba2 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java @@ -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()); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java index b180b2c68..e119bd3bb 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java @@ -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) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 1c8689baa..08d673bd6 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -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);