修正返回的 url
This commit is contained in:
parent
c456d2e1ea
commit
1a1fe4e89b
@ -135,11 +135,21 @@ public class Gb28181DownloadService {
|
||||
MessageFormat.format("attachment; filename=\"{0}.mp4\"",fileName));
|
||||
}
|
||||
|
||||
private String videoUrl(String streamId) {
|
||||
private String videoRtmpUrl(String streamId) {
|
||||
String rtmpSchema = "rtmp://" + zlmMediaConfig.getIp() + ":" + mediaRtmpConfig.getRtmpPort();
|
||||
return StringUtils.joinWith("/", rtmpSchema, "rtp", streamId);
|
||||
}
|
||||
|
||||
private String videoWsUrl(String rtmpUrl){
|
||||
String rtmpSchema = "rtmp://" + zlmMediaConfig.getIp() + ":" + mediaRtmpConfig.getRtmpPort();
|
||||
if(StringUtils.isNotBlank(proxySipConfig.getProxyMediaUrl())){
|
||||
return StringUtils.replace(rtmpUrl, rtmpSchema, proxySipConfig.getProxyMediaUrl());
|
||||
} else {
|
||||
String wsSchema = StringUtils.replace(zlmMediaConfig.getUrl(), "http://", "ws://");
|
||||
return StringUtils.replace(rtmpUrl + ".live.flv", rtmpSchema, wsSchema);
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void writeErrorToResponse(HttpServletResponse response, JsonResponse<?> json) {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
@ -275,9 +285,7 @@ public class Gb28181DownloadService {
|
||||
.build());
|
||||
}, time, TimeUnit.MILLISECONDS);
|
||||
|
||||
String url = StringUtils.isNotBlank(proxySipConfig.getProxyMediaUrl()) ?
|
||||
StringUtils.replace(videoInfo.getUrl(), zlmMediaConfig.getUrl(), proxySipConfig.getProxyMediaUrl()):
|
||||
videoInfo.getUrl();
|
||||
String url = videoWsUrl(videoInfo.getUrl());
|
||||
result.setResult(JsonResponse.success(url));
|
||||
});
|
||||
}, 200, TimeUnit.MILLISECONDS);
|
||||
@ -317,9 +325,7 @@ public class Gb28181DownloadService {
|
||||
|
||||
// 原始链接转换为前端可用的链接
|
||||
RedisUtil.StringOps.set(CacheUtil.getKey(GB28181SDPBuilder.Action.PLAY.getAction(), videoInfo.getCallId()), JsonUtils.toJson(videoInfo));
|
||||
String url = StringUtils.isNotBlank(proxySipConfig.getProxyMediaUrl()) ?
|
||||
StringUtils.replace(videoInfo.getUrl(), zlmMediaConfig.getUrl(), proxySipConfig.getProxyMediaUrl()):
|
||||
videoInfo.getUrl();
|
||||
String url = videoWsUrl(videoInfo.getUrl());
|
||||
videoInfo.setUrl(url);
|
||||
|
||||
realtimeManager.addPlaying(deviceCode, videoInfo);
|
||||
@ -564,7 +570,7 @@ public class Gb28181DownloadService {
|
||||
subscribe.getInviteSubscribe().addSubscribe(subscribeKey, subscriber);
|
||||
RedisUtil.StringOps.set(cacheKey, callId.getCallId());
|
||||
// 用以 提前 启动 ffmpeg 预备录制
|
||||
result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId.getCallId(), device), executor);
|
||||
result.completeAsync(() -> new VideoInfo(streamId, videoRtmpUrl(streamId), callId.getCallId(), device), executor);
|
||||
return SipRequestBuilder.createInviteRequest(ip, port, docking, device.getGbDeviceChannelId(), description.toString(), SipUtil.generateViaTag(), SipUtil.generateFromTag(), null, ssrc, callId);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user