Commit 66234dc2883bff22725f5ca4d5773630934f6c8a
1 parent
df9f6a89
优化点播后截图以及截图的展示
Showing
4 changed files
with
13 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
| @@ -238,7 +238,9 @@ public class StreamInfo implements Serializable, Cloneable{ | @@ -238,7 +238,9 @@ public class StreamInfo implements Serializable, Cloneable{ | ||
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) { | 240 | public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) { |
| 241 | - callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&"); | 241 | + if (callIdParam != null) { |
| 242 | + callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&"); | ||
| 243 | + } | ||
| 242 | String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); | 244 | String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); |
| 243 | if (port > 0) { | 245 | if (port > 0) { |
| 244 | this.rtc = new StreamURL("http", host, port, file); | 246 | this.rtc = new StreamURL("http", host, port, file); |
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
| @@ -86,6 +86,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -86,6 +86,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 86 | matchers.add("/swagger-resources/**"); | 86 | matchers.add("/swagger-resources/**"); |
| 87 | matchers.add("/v3/api-docs/**"); | 87 | matchers.add("/v3/api-docs/**"); |
| 88 | matchers.add("/js/**"); | 88 | matchers.add("/js/**"); |
| 89 | + matchers.add("/api/device/query/snap/**"); | ||
| 89 | matchers.addAll(userSetting.getInterfaceAuthenticationExcludes()); | 90 | matchers.addAll(userSetting.getInterfaceAuthenticationExcludes()); |
| 90 | // 可以直接访问的静态数据 | 91 | // 可以直接访问的静态数据 |
| 91 | web.ignoring().antMatchers(matchers.toArray(new String[0])); | 92 | web.ignoring().antMatchers(matchers.toArray(new String[0])); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -267,7 +267,7 @@ public class SIPCommander implements ISIPCommander { | @@ -267,7 +267,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 267 | return; | 267 | return; |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | - logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | 270 | + logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getSdpIp(), ssrcInfo.getPort()); |
| 271 | HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtsp", mediaServerItem.getId()); | 271 | HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", stream, true, "rtsp", mediaServerItem.getId()); |
| 272 | subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json) -> { | 272 | subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json) -> { |
| 273 | if (event != null) { | 273 | if (event != null) { |
| @@ -368,7 +368,7 @@ public class SIPCommander implements ISIPCommander { | @@ -368,7 +368,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 368 | SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { | 368 | SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { |
| 369 | 369 | ||
| 370 | 370 | ||
| 371 | - logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | 371 | + logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getSdpIp(), mediaServerItem.getIp(), ssrcInfo.getPort()); |
| 372 | String sdpIp; | 372 | String sdpIp; |
| 373 | if (!ObjectUtils.isEmpty(device.getSdpIp())) { | 373 | if (!ObjectUtils.isEmpty(device.getSdpIp())) { |
| 374 | sdpIp = device.getSdpIp(); | 374 | sdpIp = device.getSdpIp(); |
| @@ -474,7 +474,7 @@ public class SIPCommander implements ISIPCommander { | @@ -474,7 +474,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 474 | InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent, | 474 | InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent, |
| 475 | SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException { | 475 | SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException { |
| 476 | 476 | ||
| 477 | - logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | 477 | + logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getSdpIp(), mediaServerItem.getIp(), ssrcInfo.getPort()); |
| 478 | String sdpIp; | 478 | String sdpIp; |
| 479 | if (!ObjectUtils.isEmpty(device.getSdpIp())) { | 479 | if (!ObjectUtils.isEmpty(device.getSdpIp())) { |
| 480 | sdpIp = device.getSdpIp(); | 480 | sdpIp = device.getSdpIp(); |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -266,7 +266,12 @@ public class PlayServiceImpl implements IPlayService { | @@ -266,7 +266,12 @@ public class PlayServiceImpl implements IPlayService { | ||
| 266 | onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId); | 266 | onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId); |
| 267 | hookEvent.response(mediaServerItemInuse, response); | 267 | hookEvent.response(mediaServerItemInuse, response); |
| 268 | logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId); | 268 | logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId); |
| 269 | - String streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream()); | 269 | + String streamUrl; |
| 270 | + if (mediaServerItemInuse.getRtspPort() != 0) { | ||
| 271 | + streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream()); | ||
| 272 | + }else { | ||
| 273 | + streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.mp4", mediaServerItemInuse.getHttpPort(), "rtp", ssrcInfo.getStream()); | ||
| 274 | + } | ||
| 270 | String path = "snap"; | 275 | String path = "snap"; |
| 271 | String fileName = device.getDeviceId() + "_" + channelId + ".jpg"; | 276 | String fileName = device.getDeviceId() + "_" + channelId + ".jpg"; |
| 272 | // 请求截图 | 277 | // 请求截图 |