Commit 8ea6e192d9f986045adbaeab54ea062938e9693e

Authored by 648540858
1 parent 14699711

优化拉流代理表单以及逻辑

sql/mysql.sql
... ... @@ -446,7 +446,7 @@ CREATE TABLE `stream_proxy` (
446 446 `ffmpeg_cmd_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
447 447 `rtp_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
448 448 `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
449   - `enable_hls` bit(1) DEFAULT NULL,
  449 + `enable_audio` bit(1) DEFAULT NULL,
450 450 `enable_mp4` bit(1) DEFAULT NULL,
451 451 `enable` bit(1) NOT NULL,
452 452 `status` bit(1) NOT NULL,
... ...
sql/update.sql
... ... @@ -36,3 +36,8 @@ alter table device
36 36  
37 37 alter table device
38 38 modify hostAddress varchar(50) null;
  39 +
  40 +alter table stream_proxy
  41 + change enable_hls enable_audio bit null;
  42 +
  43 +
... ...
src/main/java/com/genersoft/iot/vmp/conf/GlobalExceptionHandler.java
1 1 package com.genersoft.iot.vmp.conf;
2 2  
3 3 import com.genersoft.iot.vmp.conf.exception.ControllerException;
4   -import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
5 4 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
6 5 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
7 6 import org.slf4j.Logger;
8 7 import org.slf4j.LoggerFactory;
9 8 import org.springframework.http.HttpStatus;
  9 +import org.springframework.http.ResponseEntity;
10 10 import org.springframework.security.authentication.BadCredentialsException;
11 11 import org.springframework.web.bind.annotation.ExceptionHandler;
12 12 import org.springframework.web.bind.annotation.ResponseStatus;
... ... @@ -40,8 +40,8 @@ public class GlobalExceptionHandler {
40 40 */
41 41 @ExceptionHandler(ControllerException.class)
42 42 @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
43   - public WVPResult<String> exceptionHandler(ControllerException e) {
44   - return WVPResult.fail(e.getCode(), e.getMsg());
  43 + public ResponseEntity<WVPResult<String>> exceptionHandler(ControllerException e) {
  44 + return new ResponseEntity<>(WVPResult.fail(e.getCode(), e.getMsg()), HttpStatus.OK);
45 45 }
46 46  
47 47 /**
... ... @@ -51,7 +51,7 @@ public class GlobalExceptionHandler {
51 51 */
52 52 @ExceptionHandler(BadCredentialsException.class)
53 53 @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
54   - public WVPResult<String> exceptionHandler(BadCredentialsException e) {
55   - return WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage());
  54 + public ResponseEntity<WVPResult<String>> exceptionHandler(BadCredentialsException e) {
  55 + return new ResponseEntity<>(WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage()), HttpStatus.OK);
56 56 }
57 57 }
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -505,6 +505,7 @@ public class ZLMHttpHookListener {
505 505 // 修改数据
506 506 streamProxyService.stop(param.getApp(), param.getStream());
507 507 }else {
  508 + // 无人观看不做处理
508 509 ret.put("close", false);
509 510 }
510 511 return ret;
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
... ... @@ -236,14 +236,13 @@ public class ZLMRESTfulUtils {
236 236 }
237 237  
238 238 public JSONObject addFFmpegSource(MediaServerItem mediaServerItem, String src_url, String dst_url, String timeout_ms,
239   - boolean enable_hls, boolean enable_mp4, String ffmpeg_cmd_key){
  239 + boolean enable_audio, boolean enable_mp4, String ffmpeg_cmd_key){
240 240 logger.info(src_url);
241 241 logger.info(dst_url);
242 242 Map<String, Object> param = new HashMap<>();
243 243 param.put("src_url", src_url);
244 244 param.put("dst_url", dst_url);
245 245 param.put("timeout_ms", timeout_ms);
246   - param.put("enable_hls", enable_hls);
247 246 param.put("enable_mp4", enable_mp4);
248 247 param.put("ffmpeg_cmd_key", ffmpeg_cmd_key);
249 248 return sendPost(mediaServerItem, "addFFmpegSource",param, null);
... ... @@ -287,19 +286,14 @@ public class ZLMRESTfulUtils {
287 286 return sendPost(mediaServerItem, "restartServer",null, null);
288 287 }
289 288  
290   - public JSONObject addStreamProxy(MediaServerItem mediaServerItem, String app, String stream, String url, boolean enable_hls, boolean enable_mp4, String rtp_type) {
  289 + public JSONObject addStreamProxy(MediaServerItem mediaServerItem, String app, String stream, String url, boolean enable_audio, boolean enable_mp4, String rtp_type) {
291 290 Map<String, Object> param = new HashMap<>();
292 291 param.put("vhost", "__defaultVhost__");
293 292 param.put("app", app);
294 293 param.put("stream", stream);
295 294 param.put("url", url);
296   - param.put("enable_hls", enable_hls?1:0);
297 295 param.put("enable_mp4", enable_mp4?1:0);
298   - param.put("enable_rtmp", 1);
299   - param.put("enable_fmp4", 1);
300   - param.put("enable_audio", 1);
301   - param.put("enable_rtsp", 1);
302   - param.put("add_mute_audio", 1);
  296 + param.put("enable_audio", enable_audio?1:0);
303 297 param.put("rtp_type", rtp_type);
304 298 return sendPost(mediaServerItem, "addStreamProxy",param, null);
305 299 }
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java
... ... @@ -31,8 +31,8 @@ public class StreamProxyItem extends GbStream {
31 31 private String rtp_type;
32 32 @Schema(description = "是否启用")
33 33 private boolean enable;
34   - @Schema(description = "是否启用HLS")
35   - private boolean enable_hls;
  34 + @Schema(description = "是否启用音频")
  35 + private boolean enable_audio;
36 36 @Schema(description = "是否启用MP4")
37 37 private boolean enable_mp4;
38 38 @Schema(description = "是否 无人观看时删除")
... ... @@ -40,8 +40,6 @@ public class StreamProxyItem extends GbStream {
40 40  
41 41 @Schema(description = "是否 无人观看时自动停用")
42 42 private boolean enable_disable_none_reader;
43   - @Schema(description = "上级平台国标ID")
44   - private String platformGbId;
45 43 @Schema(description = "创建时间")
46 44 private String createTime;
47 45  
... ... @@ -139,14 +137,6 @@ public class StreamProxyItem extends GbStream {
139 137 this.enable = enable;
140 138 }
141 139  
142   - public boolean isEnable_hls() {
143   - return enable_hls;
144   - }
145   -
146   - public void setEnable_hls(boolean enable_hls) {
147   - this.enable_hls = enable_hls;
148   - }
149   -
150 140 public boolean isEnable_mp4() {
151 141 return enable_mp4;
152 142 }
... ... @@ -155,19 +145,12 @@ public class StreamProxyItem extends GbStream {
155 145 this.enable_mp4 = enable_mp4;
156 146 }
157 147  
158   -
159   - public String getPlatformGbId() {
160   - return platformGbId;
161   - }
162   -
163   - public void setPlatformGbId(String platformGbId) {
164   - this.platformGbId = platformGbId;
165   - }
166   -
  148 + @Override
167 149 public String getCreateTime() {
168 150 return createTime;
169 151 }
170 152  
  153 + @Override
171 154 public void setCreateTime(String createTime) {
172 155 this.createTime = createTime;
173 156 }
... ... @@ -187,4 +170,12 @@ public class StreamProxyItem extends GbStream {
187 170 public void setEnable_disable_none_reader(boolean enable_disable_none_reader) {
188 171 this.enable_disable_none_reader = enable_disable_none_reader;
189 172 }
  173 +
  174 + public boolean isEnable_audio() {
  175 + return enable_audio;
  176 + }
  177 +
  178 + public void setEnable_audio(boolean enable_audio) {
  179 + this.enable_audio = enable_audio;
  180 + }
190 181 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
... ... @@ -5,23 +5,22 @@ import com.alibaba.fastjson2.JSONObject;
5 5 import com.genersoft.iot.vmp.common.StreamInfo;
6 6 import com.genersoft.iot.vmp.conf.UserSetting;
7 7 import com.genersoft.iot.vmp.conf.exception.ControllerException;
8   -import com.genersoft.iot.vmp.gb28181.bean.GbStream;
9 8 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
10 9 import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
11 10 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
12   -import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
13 11 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
14 12 import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
  13 +import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
15 14 import com.genersoft.iot.vmp.service.IGbStreamService;
16 15 import com.genersoft.iot.vmp.service.IMediaServerService;
17 16 import com.genersoft.iot.vmp.service.IMediaService;
  17 +import com.genersoft.iot.vmp.service.IStreamProxyService;
18 18 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
19 19 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
20 20 import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
21 21 import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
22 22 import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
23 23 import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
24   -import com.genersoft.iot.vmp.service.IStreamProxyService;
25 24 import com.genersoft.iot.vmp.utils.DateUtil;
26 25 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
27 26 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
... ... @@ -35,7 +34,9 @@ import org.springframework.transaction.TransactionDefinition;
35 34 import org.springframework.transaction.TransactionStatus;
36 35 import org.springframework.util.ObjectUtils;
37 36  
38   -import java.util.*;
  37 +import java.util.HashMap;
  38 +import java.util.List;
  39 +import java.util.Map;
39 40  
40 41 /**
41 42 * 视频代理业务
... ... @@ -107,7 +108,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
107 108 param.getStream() );
108 109 param.setDst_url(dstUrl);
109 110 StringBuffer resultMsg = new StringBuffer();
110   - boolean streamLive = false;
111 111 param.setMediaServerId(mediaInfo.getId());
112 112 boolean saveResult;
113 113 // 更新
... ... @@ -124,7 +124,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
124 124 if (param.isEnable()) {
125 125 JSONObject jsonObject = addStreamProxyToZlm(param);
126 126 if (jsonObject == null || jsonObject.getInteger("code") != 0) {
127   - streamLive = false;
128 127 resultMsg.append(", 但是启用失败,请检查流地址是否可用");
129 128 param.setEnable(false);
130 129 // 直接移除
... ... @@ -134,28 +133,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
134 133 updateStreamProxy(param);
135 134 }
136 135  
137   -
138 136 }else {
139   - streamLive = true;
140 137 resultForStreamInfo = mediaService.getStreamInfoByAppAndStream(
141 138 mediaInfo, param.getApp(), param.getStream(), null, null);
142 139  
143 140 }
144 141 }
145   - if ( !ObjectUtils.isEmpty(param.getPlatformGbId()) && streamLive) {
146   - List<GbStream> gbStreams = new ArrayList<>();
147   - gbStreams.add(param);
148   - if (gbStreamService.addPlatformInfo(gbStreams, param.getPlatformGbId(), param.getCatalogId())){
149   - return resultForStreamInfo;
150   - }else {
151   - resultMsg.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败");
152   - throw new ControllerException(ErrorCode.ERROR100.getCode(), resultMsg.toString());
153   - }
154   - }else {
155   - if (!streamLive) {
156   - throw new ControllerException(ErrorCode.ERROR100.getCode(), resultMsg.toString());
157   - }
158   - }
159 142 return resultForStreamInfo;
160 143 }
161 144  
... ... @@ -245,10 +228,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
245 228 }
246 229 if ("default".equals(param.getType())){
247 230 result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl(),
248   - param.isEnable_hls(), param.isEnable_mp4(), param.getRtp_type());
  231 + param.isEnable_audio(), param.isEnable_mp4(), param.getRtp_type());
249 232 }else if ("ffmpeg".equals(param.getType())) {
250 233 result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrc_url(), param.getDst_url(),
251   - param.getTimeout_ms() + "", param.isEnable_hls(), param.isEnable_mp4(),
  234 + param.getTimeout_ms() + "", param.isEnable_audio(), param.isEnable_mp4(),
252 235 param.getFfmpeg_cmd_key());
253 236 }
254 237 return result;
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java
... ... @@ -12,9 +12,9 @@ import java.util.List;
12 12 public interface StreamProxyMapper {
13 13  
14 14 @Insert("INSERT INTO stream_proxy (type, name, app, stream,mediaServerId, url, src_url, dst_url, " +
15   - "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_hls, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" +
  15 + "timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, createTime) VALUES" +
16 16 "('${type}','${name}', '${app}', '${stream}', '${mediaServerId}','${url}', '${src_url}', '${dst_url}', " +
17   - "'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_hls}, ${enable_mp4}, ${enable}, ${status}, " +
  17 + "'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_audio}, ${enable_mp4}, ${enable}, ${status}, " +
18 18 "${enable_remove_none_reader}, ${enable_disable_none_reader}, '${createTime}' )")
19 19 int add(StreamProxyItem streamProxyDto);
20 20  
... ... @@ -30,7 +30,7 @@ public interface StreamProxyMapper {
30 30 "timeout_ms=#{timeout_ms}, " +
31 31 "ffmpeg_cmd_key=#{ffmpeg_cmd_key}, " +
32 32 "rtp_type=#{rtp_type}, " +
33   - "enable_hls=#{enable_hls}, " +
  33 + "enable_audio=#{enable_audio}, " +
34 34 "enable=#{enable}, " +
35 35 "status=#{status}, " +
36 36 "enable_remove_none_reader=#{enable_remove_none_reader}, " +
... ...
web_src/src/components/StreamProxyList.vue
... ... @@ -32,7 +32,7 @@
32 32 <el-table-column label="类型" width="100" >
33 33 <template slot-scope="scope">
34 34 <div slot="reference" class="name-wrapper">
35   - <el-tag size="medium">{{scope.row.type}}</el-tag>
  35 + <el-tag size="medium">{{scope.row.type === "default"? "直接代理":"FFMPEG代理"}}</el-tag>
36 36 </div>
37 37 </template>
38 38 </el-table-column>
... ... @@ -55,15 +55,15 @@
55 55 </template>
56 56 </el-table-column>
57 57 <el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip/>
58   - <el-table-column label="转HLS" min-width="120" >
  58 + <el-table-column label="音频" min-width="120" >
59 59 <template slot-scope="scope">
60 60 <div slot="reference" class="name-wrapper">
61   - <el-tag size="medium" v-if="scope.row.enable_hls">已启用</el-tag>
62   - <el-tag size="medium" type="info" v-if="!scope.row.enable_hls">未启用</el-tag>
  61 + <el-tag size="medium" v-if="scope.row.enable_audio">已启用</el-tag>
  62 + <el-tag size="medium" type="info" v-if="!scope.row.enable_audio">未启用</el-tag>
63 63 </div>
64 64 </template>
65 65 </el-table-column>
66   - <el-table-column label="MP4录制" min-width="120" >
  66 + <el-table-column label="录制" min-width="120" >
67 67 <template slot-scope="scope">
68 68 <div slot="reference" class="name-wrapper">
69 69 <el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag>
... ... @@ -71,11 +71,12 @@
71 71 </div>
72 72 </template>
73 73 </el-table-column>
74   - <el-table-column label="无人观看自动删除" min-width="160" >
  74 + <el-table-column label="无人观看" min-width="160" >
75 75 <template slot-scope="scope">
76 76 <div slot="reference" class="name-wrapper">
77   - <el-tag size="medium" v-if="scope.row.enable_remove_none_reader">已启用</el-tag>
78   - <el-tag size="medium" type="info" v-if="!scope.row.enable_remove_none_reader">未启用</el-tag>
  77 + <el-tag size="medium" v-if="scope.row.enable_remove_none_reader">移除</el-tag>
  78 + <el-tag size="medium" v-if="scope.row.enable_disable_none_reader">停用</el-tag>
  79 + <el-tag size="medium" type="info" v-if="!scope.row.enable_remove_none_reader && !scope.row.enable_disable_none_reader">不做处理</el-tag>
79 80 </div>
80 81 </template>
81 82 </el-table-column>
... ... @@ -131,7 +132,6 @@
131 132 currentPage:1,
132 133 count:15,
133 134 total:0,
134   - getListLoading: false,
135 135 startBtnLoading: false
136 136 };
137 137 },
... ... @@ -139,7 +139,7 @@
139 139 },
140 140 mounted() {
141 141 this.initData();
142   - this.updateLooper = setInterval(this.initData, 1000);
  142 + this.startUpdateList()
143 143 },
144 144 destroyed() {
145 145 this.$destroy('videojs');
... ... @@ -149,6 +149,12 @@
149 149 initData: function() {
150 150 this.getStreamProxyList();
151 151 },
  152 + stopUpdateList: function (){
  153 + window.clearInterval(this.updateLooper)
  154 + },
  155 + startUpdateList: function (){
  156 + this.updateLooper = setInterval(this.initData, 1000);
  157 + },
152 158 currentChange: function(val){
153 159 this.currentPage = val;
154 160 this.getStreamProxyList();
... ... @@ -159,7 +165,6 @@
159 165 },
160 166 getStreamProxyList: function() {
161 167 let that = this;
162   - this.getListLoading = true;
163 168 this.$axios({
164 169 method: 'get',
165 170 url:`/api/proxy/list`,
... ... @@ -175,23 +180,18 @@
175 180 }
176 181 that.streamProxyList = res.data.data.list;
177 182 }
178   - that.getListLoading = false;
179 183 }).catch(function (error) {
180 184 console.log(error);
181   - that.getListLoading = false;
182 185 });
183 186 },
184 187 addStreamProxy: function(){
185 188 this.$refs.streamProxyEdit.openDialog(null, this.initData)
186 189 },
187 190 addOnvif: function(){
188   - this.getListLoading = true;
189   - this.getListLoading = true;
190 191 this.$axios({
191 192 method: 'get',
192 193 url:`/api/onvif/search?timeout=3000`,
193 194 }).then((res) =>{
194   - this.getListLoading = false;
195 195 if (res.data.code === 0 ){
196 196 if (res.data.data.length > 0) {
197 197 this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{
... ... @@ -208,7 +208,6 @@
208 208 }
209 209  
210 210 }).catch((error)=> {
211   - this.getListLoading = false;
212 211 this.$message.error(error.response.data.msg);
213 212 });
214 213  
... ... @@ -217,7 +216,6 @@
217 216 },
218 217 play: function(row){
219 218 let that = this;
220   - this.getListLoading = true;
221 219 this.$axios({
222 220 method: 'get',
223 221 url:`/api/push/getPlayUrl`,
... ... @@ -227,7 +225,6 @@
227 225 mediaServerId: row.mediaServerId
228 226 }
229 227 }).then(function (res) {
230   - that.getListLoading = false;
231 228 if (res.data.code === 0) {
232 229 that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
233 230 streamInfo: res.data.data,
... ... @@ -243,13 +240,11 @@
243 240  
244 241 }).catch(function (error) {
245 242 console.log(error);
246   - that.getListLoading = false;
247 243 });
248 244  
249 245 },
250 246 deleteStreamProxy: function(row){
251 247 let that = this;
252   - this.getListLoading = true;
253 248 that.$axios({
254 249 method:"delete",
255 250 url:"/api/proxy/del",
... ... @@ -258,16 +253,13 @@
258 253 stream: row.stream
259 254 }
260 255 }).then((res)=>{
261   - that.getListLoading = false;
262 256 that.initData()
263 257 }).catch(function (error) {
264 258 console.log(error);
265   - that.getListLoading = false;
266 259 });
267 260 },
268 261 start: function(row){
269   - let that = this;
270   - this.getListLoading = true;
  262 + this.stopUpdateList()
271 263 this.$set(row, 'startBtnLoading', true)
272 264 this.$axios({
273 265 method: 'get',
... ... @@ -276,28 +268,31 @@
276 268 app: row.app,
277 269 stream: row.stream
278 270 }
279   - }).then(function (res) {
280   - that.getListLoading = false;
281   - that.$set(row, 'startBtnLoading', false)
  271 + }).then((res)=> {
282 272 if (res.data.code === 0){
283   - that.initData()
  273 + this.initData()
284 274 }else {
285   - that.$message({
  275 + this.$message({
286 276 showClose: true,
287   - message: "保存失败,请检查地址是否可用!",
  277 + message: "启动失败,请检查地址是否可用!",
288 278 type: "error",
289 279 });
290 280 }
291   -
292   - }).catch(function (error) {
  281 + this.$set(row, 'startBtnLoading', false)
  282 + this.startUpdateList()
  283 + }).catch((error)=> {
293 284 console.log(error);
294   - that.getListLoading = false;
295   - that.$set(row, 'startBtnLoading', false)
  285 + this.$message({
  286 + showClose: true,
  287 + message: "启动失败,请检查地址是否可用!",
  288 + type: "error",
  289 + });
  290 + this.$set(row, 'startBtnLoading', false)
  291 + this.startUpdateList()
296 292 });
297 293 },
298 294 stop: function(row){
299 295 let that = this;
300   - this.getListLoading = true;
301 296 this.$axios({
302 297 method: 'get',
303 298 url:`/api/proxy/stop`,
... ... @@ -306,11 +301,9 @@
306 301 stream: row.stream
307 302 }
308 303 }).then(function (res) {
309   - that.getListLoading = false;
310 304 that.initData()
311 305 }).catch(function (error) {
312 306 console.log(error);
313   - that.getListLoading = false;
314 307 });
315 308 },
316 309 refresh: function (){
... ...
web_src/src/components/dialog/StreamProxyEdit.vue
... ... @@ -83,31 +83,23 @@
83 83 <el-option label="组播" value="2"></el-option>
84 84 </el-select>
85 85 </el-form-item>
86   -
87   - <el-form-item label="国标平台">
88   - <el-select
89   - v-model="proxyParam.platformGbId"
90   - style="width: 100%"
91   - placeholder="请选择国标平台"
92   - >
93   - <el-option
94   - v-for="item in platformList"
95   - :key="item.name"
96   - :label="item.name"
97   - :value="item.serverGBId">
98   - <span style="float: left">{{ item.name }}</span>
99   - <span style="float: right; color: #8492a6; font-size: 13px">{{ item.serverGBId }}</span>
100   - </el-option>
101   - </el-select>
102   - </el-form-item>
  86 + <el-form-item label="无人观看" prop="rtp_type" >
  87 + <el-select
  88 + @change="noneReaderHandler"
  89 + v-model="proxyParam.none_reader"
  90 + style="width: 100%"
  91 + placeholder="请选择无人观看的处理方式"
  92 + >
  93 + <el-option label="不做处理" value="0"></el-option>
  94 + <el-option label="停用" value="1"></el-option>
  95 + <el-option label="移除" value="2"></el-option>
  96 + </el-select>
  97 + </el-form-item>
103 98 <el-form-item label="其他选项">
104 99 <div style="float: left;">
105 100 <el-checkbox label="启用" v-model="proxyParam.enable" ></el-checkbox>
106   - <el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox>
107   - <el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
108   - <el-checkbox label="无人观看自动删除" v-model="proxyParam.enable_remove_none_reader" @change="removeNoneReader"></el-checkbox>
109   - <el-checkbox label="无人观看停止拉流" v-model="proxyParam.enable_disable_none_reader" @change="disableNoneReaderHandType"></el-checkbox>
110   -
  101 + <el-checkbox label="开启音频" v-model="proxyParam.enable_audio" ></el-checkbox>
  102 + <el-checkbox label="录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
111 103 </div>
112 104  
113 105 </el-form-item>
... ... @@ -169,10 +161,11 @@ export default {
169 161 gbId: null,
170 162 rtp_type: null,
171 163 enable: true,
172   - enable_hls: true,
  164 + enable_audio: true,
173 165 enable_mp4: false,
  166 + none_reader: null,
174 167 enable_remove_none_reader: false,
175   - enable_disable_none_reader: true,
  168 + enable_disable_none_reader: false,
176 169 platformGbId: null,
177 170 mediaServerId: null,
178 171 },
... ... @@ -196,6 +189,7 @@ export default {
196 189 this.listChangeCallback = callback;
197 190 if (proxyParam != null) {
198 191 this.proxyParam = proxyParam;
  192 + this.proxyParam.none_reader = null;
199 193 }
200 194  
201 195 let that = this;
... ... @@ -233,26 +227,26 @@ export default {
233 227 },
234 228 onSubmit: function () {
235 229 this.dialogLoading = true;
236   - var that = this;
237   - that.$axios({
  230 + this.noneReaderHandler();
  231 + this.$axios({
238 232 method: 'post',
239 233 url:`/api/proxy/save`,
240   - data: that.proxyParam
241   - }).then(function (res) {
242   - that.dialogLoading = false;
  234 + data: this.proxyParam
  235 + }).then((res)=> {
  236 + this.dialogLoading = false;
243 237 if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
244   - that.$message({
  238 + this.$message({
245 239 showClose: true,
246 240 message: res.data.msg,
247 241 type: "success",
248 242 });
249   - that.showDialog = false;
250   - if (that.listChangeCallback != null) {
251   - that.listChangeCallback();
252   - that.dialogLoading = false;
  243 + this.showDialog = false;
  244 + if (this.listChangeCallback != null) {
  245 + this.listChangeCallback();
  246 + this.dialogLoading = false;
253 247 }
254 248 }
255   - }).catch(function (error) {
  249 + }).catch((error) =>{
256 250 console.log(error);
257 251 this.dialogLoading = false;
258 252 });
... ... @@ -280,12 +274,18 @@ export default {
280 274 this.platform.expires = "300";
281 275 }
282 276 },
283   - removeNoneReader: function(checked) {
284   - this.proxyParam.enable_disable_none_reader = !checked;
  277 + noneReaderHandler: function() {
  278 + if (this.proxyParam.none_reader === null || this.proxyParam.none_reader === "0") {
  279 + this.proxyParam.enable_disable_none_reader = false;
  280 + this.proxyParam.enable_remove_none_reader = false;
  281 + }else if (this.proxyParam.none_reader === "1"){
  282 + this.proxyParam.enable_disable_none_reader = true;
  283 + this.proxyParam.enable_remove_none_reader = false;
  284 + }else if (this.proxyParam.none_reader ==="2"){
  285 + this.proxyParam.enable_disable_none_reader = false;
  286 + this.proxyParam.enable_remove_none_reader = true;
  287 + }
285 288 },
286   - disableNoneReaderHandType: function(checked) {
287   - this.proxyParam.enable_remove_none_reader = !checked;
288   - }
289 289 },
290 290 };
291 291 </script>
... ...