Browse Source

webrtc地址修改兼容其他站

master
wangguangyuan 8 months ago
parent
commit
b4c44bea89
3 changed files with 7 additions and 6 deletions
  1. +4
    -2
      inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java
  2. +2
    -3
      inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java
  3. +1
    -1
      inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java

+ 4
- 2
inspect-ivs/src/main/java/com/inspect/ivs/config/ZlMediaConfig.java View File

@ -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 + '\'' +
'}';
}
}

+ 2
- 3
inspect-ivs/src/main/java/com/inspect/ivs/domain/ZlmConvertUrl.java View File

@ -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() {


+ 1
- 1
inspect-ivs/src/main/java/com/inspect/ivs/service/ZlMediaComponent.java View File

@ -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());


Loading…
Cancel
Save