From b4c44bea89c895fb38d90ed3aa7d8d68d3fe77bd Mon Sep 17 00:00:00 2001 From: wangguangyuan Date: Tue, 15 Apr 2025 16:07:15 +0800 Subject: [PATCH] =?UTF-8?q?webrtc=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=85=B6=E4=BB=96=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/inspect/ivs/config/ZlMediaConfig.java | 6 ++++-- .../src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java | 5 ++--- .../main/java/com/inspect/ivs/service/ZlMediaComponent.java | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java b/inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java index cf20f31..0e99fb8 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java @@ -17,18 +17,19 @@ public class ZlMediaConfig { private boolean enable; private String url; private String secret; + private String webrtcPrefix; @Override public boolean equals(Object object) { if (this == object) return true; if (object == null || getClass() != object.getClass()) return false; ZlMediaConfig that = (ZlMediaConfig) object; - return enable == that.enable && Objects.equals(url, that.url) && Objects.equals(secret, that.secret); + return enable == that.enable && Objects.equals(url, that.url) && Objects.equals(secret, that.secret) && Objects.equals(webrtcPrefix, that.webrtcPrefix); } @Override public int hashCode() { - return Objects.hash(enable, url, secret); + return Objects.hash(enable, url, secret, webrtcPrefix); } @Override @@ -37,6 +38,7 @@ public class ZlMediaConfig { "enable=" + enable + ", url='" + url + '\'' + ", secret='" + secret + '\'' + + ", webrtcPrefix='" + webrtcPrefix + '\'' + '}'; } } diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java b/inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java index b567b06..9a176a8 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java @@ -7,12 +7,11 @@ public class ZlmConvertUrl { private String webrtc; private String hls; - public ZlmConvertUrl(String baseAddress, String streamId) { + public ZlmConvertUrl(String baseAddress, String webrtcPrefix, String streamId) { this.flv = String.format("%s/live/%s.live.flv", new Object[]{baseAddress, streamId}); this.m3u8 = String.format("%s/live/%s.m3u8", new Object[]{baseAddress, streamId}); this.mp4 = String.format("%s/live/%s.live.mp4", new Object[]{baseAddress, streamId}); -// this.webrtc = String.format("%s/index/api/webrtc?app=live&stream=%s&type=play", new Object[]{baseAddress, streamId}); - this.webrtc = String.format("/wuhan/videoMonitor2/index/api/webrtc?app=live&stream=%s&type=play", new Object[]{streamId}); + this.webrtc = String.format("%s/index/api/webrtc?app=live&stream=%s&type=play", new Object[]{webrtcPrefix, streamId}); } public String getFlv() { diff --git a/inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java b/inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java index 0674a25..a693f06 100644 --- a/inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java +++ b/inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java @@ -40,7 +40,7 @@ public class ZlMediaComponent extends IvsCommonService { .block(); log.debug("[GAB] ZL-MEDIA Convert:"); log.debug("{}", block); - ZlmConvertUrl zlmConvertUrl = new ZlmConvertUrl(zlMediaConfig.getUrl(), streamId); + ZlmConvertUrl zlmConvertUrl = new ZlmConvertUrl(zlMediaConfig.getUrl(), zlMediaConfig.getWebrtcPrefix(), streamId); ivsVideoRtspView.setWebrtcURL(zlmConvertUrl.getWebrtc()); ivsVideoRtspView.setHlsURL(zlmConvertUrl.getM3u8()); ivsVideoRtspView.setFlvURL(zlmConvertUrl.getFlv());