Преглед на файлове

Merge branch 'master' into dev/播放页面云台功能页面优化

648540858 преди 11 месеца
родител
ревизия
e2c59eed88

+ 29 - 3
src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java

@@ -28,7 +28,10 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.sip.message.Response;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.List;
 
 
@@ -200,16 +203,39 @@ public class CommonChannelController {
 
     @Operation(summary = "播放通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
     @GetMapping("/play")
-    public DeferredResult<WVPResult<StreamContent>> deleteChannelToGroupByGbDevice(Integer channelId){
+    public DeferredResult<WVPResult<StreamContent>> deleteChannelToGroupByGbDevice(HttpServletRequest request,  Integer channelId){
         Assert.notNull(channelId,"参数异常");
         CommonGBChannel channel = channelService.getOne(channelId);
         Assert.notNull(channel, "通道不存在");
 
         DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
 
-        ErrorCallback<StreamInfo> callback = (code, msg, data) -> {
+        ErrorCallback<StreamInfo> callback = (code, msg, streamInfo) -> {
             if (code == InviteErrorCode.SUCCESS.getCode()) {
-                result.setResult(WVPResult.success(new StreamContent(data)));
+                WVPResult<StreamContent> wvpResult = WVPResult.success();
+                if (streamInfo != null) {
+                    if (userSetting.getUseSourceIpAsStreamIp()) {
+                        streamInfo=streamInfo.clone();//深拷贝
+                        String host;
+                        try {
+                            URL url=new URL(request.getRequestURL().toString());
+                            host=url.getHost();
+                        } catch (MalformedURLException e) {
+                            host=request.getLocalAddr();
+                        }
+                        streamInfo.channgeStreamIp(host);
+                    }
+                    if (!ObjectUtils.isEmpty(streamInfo.getMediaServer().getTranscodeSuffix())
+                            && !"null".equalsIgnoreCase(streamInfo.getMediaServer().getTranscodeSuffix())) {
+                        streamInfo.setStream(streamInfo.getStream() + "_" + streamInfo.getMediaServer().getTranscodeSuffix());
+                    }
+                    wvpResult.setData(new StreamContent(streamInfo));
+                }else {
+                    wvpResult.setCode(code);
+                    wvpResult.setMsg(msg);
+                }
+
+                result.setResult(wvpResult);
             }else {
                 result.setResult(WVPResult.fail(code, msg));
             }

+ 1 - 0
web_src/src/components/dialog/channelCode.vue

@@ -4,6 +4,7 @@
     width="65rem"
     top="2rem"
     center
+    :append-to-body="true"
     :close-on-click-modal="false"
     :visible.sync="showVideoDialog"
     :destroy-on-close="false"

+ 1 - 0
web_src/src/components/dialog/chooseGroup.vue

@@ -4,6 +4,7 @@
       title="选择虚拟组织"
       width="30%"
       top="5rem"
+      :append-to-body="true"
       :close-on-click-modal="false"
       :visible.sync="showDialog"
       :destroy-on-close="true"