diff --git a/fastbee-server/sip-server/src/main/java/com/fastbee/sip/service/impl/ZmlHookServiceImpl.java b/fastbee-server/sip-server/src/main/java/com/fastbee/sip/service/impl/ZmlHookServiceImpl.java index 719c0fa9..c0f1403d 100644 --- a/fastbee-server/sip-server/src/main/java/com/fastbee/sip/service/impl/ZmlHookServiceImpl.java +++ b/fastbee-server/sip-server/src/main/java/com/fastbee/sip/service/impl/ZmlHookServiceImpl.java @@ -394,10 +394,28 @@ public class ZmlHookServiceImpl implements IZmlHookService { return streamUrl; } + /** + * 构建 HTTP 主机地址(ip:port),当端口为标准端口(80)时省略端口号 + */ + private String buildHttpHost(MediaServer mediaInfo) { + if (mediaInfo.getPortHttp() != null && mediaInfo.getPortHttp() == 80) { + return mediaInfo.getIp(); + } + return String.format("%s:%s", mediaInfo.getIp(), mediaInfo.getPortHttp()); + } + + /** + * 构建 HTTPS 主机地址。使用 HTTPS 协议时,流媒体请求通过 Nginx 反向代理(443端口)转发, + * 因此 HTTPS URL 只使用域名,不拼接 ZLMediaKit 的 portHttps,避免跨域问题。 + */ + private String buildHttpsHost(MediaServer mediaInfo) { + return mediaInfo.getDomain(); + } + public void setFlv(String app, Stream streamUrl, MediaServer mediaInfo, String streamId, String secret) { String file = String.format("%s/%s.live.flv", app, streamId); - String host = String.format("%s:%s", mediaInfo.getIp(), mediaInfo.getPortHttp()); - String hosts = String.format("%s:%s", mediaInfo.getDomain(), mediaInfo.getPortHttps()); + String host = buildHttpHost(mediaInfo); + String hosts = buildHttpsHost(mediaInfo); streamUrl.setFlv(String.format("http://%s/%s?secret=%s", host, file, secret)); streamUrl.setWs_flv(String.format("ws://%s/%s?secret=%s", host, file, secret)); streamUrl.setHttps_flv(String.format("https://%s/%s?secret=%s", hosts, file, secret)); @@ -406,8 +424,8 @@ public class ZmlHookServiceImpl implements IZmlHookService { public void setFmp4(String app, Stream streamUrl, MediaServer mediaInfo, String streamId, String secret) { String file = String.format("%s/%s.live.mp4", app, streamId); - String host = String.format("%s:%s", mediaInfo.getIp(), mediaInfo.getPortHttp()); - String hosts = String.format("%s:%s", mediaInfo.getDomain(), mediaInfo.getPortHttps()); + String host = buildHttpHost(mediaInfo); + String hosts = buildHttpsHost(mediaInfo); streamUrl.setFmp4(String.format("http://%s/%s?secret=%s", host, file, secret)); streamUrl.setWs_fmp4(String.format("ws://%s/%s?secret=%s", host, file, secret)); streamUrl.setHttps_fmp4(String.format("https://%s/%s?secret=%s", hosts, file, secret)); @@ -416,8 +434,8 @@ public class ZmlHookServiceImpl implements IZmlHookService { public void setHls(String app, Stream streamUrl, MediaServer mediaInfo, String streamId, String secret) { String file = String.format("%s/%s/hls.m3u8", app, streamId); - String host = String.format("%s:%s", mediaInfo.getIp(), mediaInfo.getPortHttp()); - String hosts = String.format("%s:%s", mediaInfo.getDomain(), mediaInfo.getPortHttps()); + String host = buildHttpHost(mediaInfo); + String hosts = buildHttpsHost(mediaInfo); streamUrl.setHls(String.format("http://%s/%s?secret=%s", host, file, secret)); streamUrl.setWs_hls(String.format("ws://%s/%s?secret=%s", host, file, secret)); streamUrl.setHttps_hls(String.format("https://%s/%s?secret=%s", hosts, file, secret)); @@ -426,8 +444,8 @@ public class ZmlHookServiceImpl implements IZmlHookService { public void setRtc(String app, Stream streamUrl, MediaServer mediaInfo, String streamId, boolean isPlay) { String file = String.format("index/api/webrtc?app=%s&stream=%s&type=%s", app, streamId, isPlay ? "play" : "push"); - String host = String.format("%s:%s", mediaInfo.getIp(), mediaInfo.getPortHttp()); - String hosts = String.format("%s:%s", mediaInfo.getDomain(), mediaInfo.getPortHttps()); + String host = buildHttpHost(mediaInfo); + String hosts = buildHttpsHost(mediaInfo); streamUrl.setRtc(String.format("http://%s/%s", host, file)); streamUrl.setRtcs(String.format("https://%s/%s", hosts, file)); } diff --git a/vue/src/views/dataCenter/dataRepair.vue b/vue/src/views/dataCenter/dataRepair.vue index dae3509a..05e10874 100644 --- a/vue/src/views/dataCenter/dataRepair.vue +++ b/vue/src/views/dataCenter/dataRepair.vue @@ -567,7 +567,7 @@ export default { type: 'warning' }); const res = await removeAutoCalibrationConfig({ - deviceId: config.deviceId, + serialNumber: config.serialNumber, identifier: config.identifier }); if (res.code === 200) {