简化zlm节点接入逻辑
parent
a1398a56cc
commit
2a1f979651
|
@ -0,0 +1,16 @@
|
|||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
/**
|
||||
* 定时向zlm同步媒体流状态
|
||||
*/
|
||||
public class MediaStatusTimerTask {
|
||||
|
||||
|
||||
@Scheduled(fixedRate = 2 * 1000) //每3秒执行一次
|
||||
public void execute(){
|
||||
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import org.springframework.util.StringUtils;
|
|||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
|
||||
|
@ -126,8 +127,12 @@ public class ProxyServletConfig {
|
|||
MediaServerItem getMediaInfoByUri(String uri){
|
||||
String[] split = uri.split("/");
|
||||
String mediaServerId = split[2];
|
||||
if ("default".equals(mediaServerId)) {
|
||||
return mediaServerService.getDefaultMediaServer();
|
||||
}else {
|
||||
return mediaServerService.getOne(mediaServerId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉url中的标志信息
|
||||
|
@ -140,13 +145,13 @@ public class ProxyServletConfig {
|
|||
if (mediaInfo == null) {
|
||||
return url;
|
||||
}
|
||||
return url.replace(mediaInfo.getId() + "/", "");
|
||||
return url.replace(mediaInfo.getId() + "/", "").replace("default/", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean recordServletRegistrationBean(){
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new RecordProxySerlet(),"/record_proxy/*");
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new RecordProxyServlet(),"/record_proxy/*");
|
||||
servletRegistrationBean.setName("record_proxy");
|
||||
servletRegistrationBean.addInitParameter("targetUri", "http://127.0.0.1:18081");
|
||||
servletRegistrationBean.addUrlMappings();
|
||||
|
@ -156,8 +161,22 @@ public class ProxyServletConfig {
|
|||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
class RecordProxySerlet extends ProxyServlet{
|
||||
class RecordProxyServlet extends ProxyServlet{
|
||||
|
||||
@Override
|
||||
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
|
||||
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
|
||||
MediaServerItem mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
|
||||
String remoteHost = String.format("http://%s:%s", mediaInfo.getIp(), mediaInfo.getHttpPort());
|
||||
if (mediaInfo != null) {
|
||||
if (!StringUtils.isEmpty(queryStr)) {
|
||||
queryStr += "&remoteHost=" + remoteHost;
|
||||
}else {
|
||||
queryStr = "remoteHost=" + remoteHost;
|
||||
}
|
||||
}
|
||||
return queryStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
|
@ -222,9 +241,14 @@ public class ProxyServletConfig {
|
|||
MediaServerItem getMediaInfoByUri(String uri){
|
||||
String[] split = uri.split("/");
|
||||
String mediaServerId = split[2];
|
||||
if ("default".equals(mediaServerId)) {
|
||||
return mediaServerService.getDefaultMediaServer();
|
||||
}else {
|
||||
return mediaServerService.getOne(mediaServerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉url中的标志信息
|
||||
*/
|
||||
|
@ -236,7 +260,7 @@ public class ProxyServletConfig {
|
|||
if (mediaInfo == null) {
|
||||
return url;
|
||||
}
|
||||
return url.replace(mediaInfo.getId() + "/", "");
|
||||
return url.replace(mediaInfo.getId() + "/", "").replace("default/", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ThreadPoolTaskConfig {
|
|||
/**
|
||||
* 线程池名前缀
|
||||
*/
|
||||
private static final String threadNamePrefix = "wvp-sip-handle-";
|
||||
private static final String threadNamePrefix = "wvp-sip-";
|
||||
|
||||
@Bean("taskExecutor") // bean的名称,默认为首字母小写的方法名
|
||||
public ThreadPoolTaskExecutor taskExecutor() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.genersoft.iot.vmp.conf;
|
||||
package com.genersoft.iot.vmp.conf.runner;
|
||||
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
|
@ -70,6 +70,7 @@ public class SipLayer{
|
|||
try {
|
||||
tcpListeningPoint = sipStack.createListeningPoint(sipConfig.getMonitorIp(), sipConfig.getPort(), "TCP");
|
||||
tcpSipProvider = (SipProviderImpl)sipStack.createSipProvider(tcpListeningPoint);
|
||||
tcpSipProvider.setDialogErrorsAutomaticallyHandled();
|
||||
tcpSipProvider.addSipListener(sipProcessorObserver);
|
||||
logger.info("Sip Server TCP 启动成功 port {" + sipConfig.getMonitorIp() + ":" + sipConfig.getPort() + "}");
|
||||
} catch (TransportNotSupportedException e) {
|
||||
|
|
|
@ -4,12 +4,11 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
|||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.response.ISIPResponseProcessor;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.*;
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.media.zlm;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
|
@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -41,22 +43,9 @@ public class ZLMRunner implements CommandLineRunner {
|
|||
|
||||
@Override
|
||||
public void run(String... strings) throws Exception {
|
||||
// 清楚redis缓存的在线zlm信息
|
||||
mediaServerService.clearMediaServerForOnline();
|
||||
|
||||
// 将配置文件的meida配置写入数据库
|
||||
// MediaServerItem presetMediaServer = mediaServerService.getOneByHostAndPort(
|
||||
// mediaConfig.getIp(), mediaConfig.getHttpPort());
|
||||
// if (presetMediaServer != null) {
|
||||
// MediaServerItem mediaSerItem = mediaConfig.getMediaSerItem();
|
||||
// mediaSerItem.setId(presetMediaServer.getId());
|
||||
// mediaServerService.update(mediaSerItem);
|
||||
// }else {
|
||||
// if (mediaConfig.getId() != null) {
|
||||
// MediaServerItem mediaSerItem = mediaConfig.getMediaSerItem();
|
||||
// mediaServerService.add(mediaSerItem);
|
||||
// }
|
||||
// }
|
||||
if (mediaServerService.getDefaultMediaServer() == null) {
|
||||
mediaServerService.addToDatabase(mediaConfig.getMediaSerItem());
|
||||
}
|
||||
|
||||
// 订阅 zlm启动事件, 新的zlm也会从这里进入系统
|
||||
hookSubscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_server_started,null,
|
||||
|
@ -65,7 +54,6 @@ public class ZLMRunner implements CommandLineRunner {
|
|||
if (zlmServerConfig !=null ) {
|
||||
startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId());
|
||||
mediaServerService.handLeZLMServerConfig(zlmServerConfig);
|
||||
// zLmRunning(zlmServerConfig);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -80,17 +68,7 @@ public class ZLMRunner implements CommandLineRunner {
|
|||
for (MediaServerItem mediaServerItem : all) {
|
||||
if (startGetMedia == null) startGetMedia = new HashMap<>();
|
||||
startGetMedia.put(mediaServerItem.getId(), true);
|
||||
new Thread(() -> {
|
||||
|
||||
ZLMServerConfig zlmServerConfig = getMediaServerConfig(mediaServerItem);
|
||||
if (zlmServerConfig != null) {
|
||||
zlmServerConfig.setIp(mediaServerItem.getIp());
|
||||
zlmServerConfig.setHttpPort(mediaServerItem.getHttpPort());
|
||||
startGetMedia.remove(mediaServerItem.getId());
|
||||
mediaServerService.handLeZLMServerConfig(zlmServerConfig);
|
||||
}
|
||||
|
||||
}).start();
|
||||
connectZlmServer(mediaServerItem);
|
||||
}
|
||||
Timer timer = new Timer();
|
||||
// 2分钟后未连接到则不再去主动连接, TODO 并对重启前使用此在zlm的通道发送bye
|
||||
|
@ -109,6 +87,17 @@ public class ZLMRunner implements CommandLineRunner {
|
|||
}, 60 * 1000 * 2);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void connectZlmServer(MediaServerItem mediaServerItem){
|
||||
ZLMServerConfig zlmServerConfig = getMediaServerConfig(mediaServerItem);
|
||||
if (zlmServerConfig != null) {
|
||||
zlmServerConfig.setIp(mediaServerItem.getIp());
|
||||
zlmServerConfig.setHttpPort(mediaServerItem.getHttpPort());
|
||||
startGetMedia.remove(mediaServerItem.getId());
|
||||
mediaServerService.handLeZLMServerConfig(zlmServerConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public ZLMServerConfig getMediaServerConfig(MediaServerItem mediaServerItem) {
|
||||
if (startGetMedia == null) { return null;}
|
||||
if (!mediaServerItem.isDefaultServer() && mediaServerService.getOne(mediaServerItem.getId()) == null) {
|
||||
|
|
|
@ -54,6 +54,8 @@ public interface IMediaServerService {
|
|||
|
||||
WVPResult<String> add(MediaServerItem mediaSerItem);
|
||||
|
||||
int addToDatabase(MediaServerItem mediaSerItem);
|
||||
|
||||
void resetOnlineServerItem(MediaServerItem serverItem);
|
||||
|
||||
WVPResult<MediaServerItem> checkMediaServer(String ip, int port, String secret);
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
@ -80,6 +81,9 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
|||
logger.info("Media Server 缓存初始化");
|
||||
List<MediaServerItem> mediaServerItemList = mediaServerMapper.queryAll();
|
||||
for (MediaServerItem mediaServerItem : mediaServerItemList) {
|
||||
if (StringUtils.isEmpty(mediaServerItem.getId())) {
|
||||
continue;
|
||||
}
|
||||
// 更新
|
||||
if (mediaServerItem.getSsrcConfig() == null) {
|
||||
SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain());
|
||||
|
@ -283,6 +287,11 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToDatabase(MediaServerItem mediaSerItem) {
|
||||
return mediaServerMapper.add(mediaSerItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理zlm上线
|
||||
* @param zlmServerConfig zlm上线携带的参数
|
||||
|
@ -296,69 +305,84 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
|||
if (serverItem == null) {
|
||||
serverItem = mediaServerMapper.queryOneByHostAndPort(zlmServerConfig.getIp(), zlmServerConfig.getHttpPort());
|
||||
}
|
||||
if (zlmServerConfig.getGeneralMediaServerId().equals(mediaConfig.getId())
|
||||
|| (zlmServerConfig.getIp().equals(mediaConfig.getIp()) && zlmServerConfig.getHttpPort() == mediaConfig.getHttpPort())) {
|
||||
// 配置文件的zlm
|
||||
// 如果是配置文件中的zlm。 也就是默认zlm。 一切以配置文件内容为准
|
||||
// docker部署不会使用zlm配置的端口号不是默认的则不做更新, 配置修改需要自行修改server配置;
|
||||
MediaServerItem serverItemFromConfig = mediaConfig.getMediaSerItem();
|
||||
serverItemFromConfig.setId(zlmServerConfig.getGeneralMediaServerId());
|
||||
if (mediaConfig.getHttpPort() == 0) {
|
||||
serverItemFromConfig.setHttpPort(zlmServerConfig.getHttpPort());
|
||||
}
|
||||
if (mediaConfig.getHttpSSlPort() == 0) {
|
||||
serverItemFromConfig.setHttpSSlPort(zlmServerConfig.getHttpSSLport());
|
||||
}
|
||||
if (mediaConfig.getRtmpPort() == 0) {
|
||||
serverItemFromConfig.setRtmpPort(zlmServerConfig.getRtmpPort());
|
||||
}
|
||||
if (mediaConfig.getRtmpSSlPort() == 0) {
|
||||
serverItemFromConfig.setRtmpSSlPort(zlmServerConfig.getRtmpSslPort());
|
||||
}
|
||||
if (mediaConfig.getRtspPort() == 0) {
|
||||
serverItemFromConfig.setRtspPort(zlmServerConfig.getRtspPort());
|
||||
}
|
||||
if (mediaConfig.getRtspSSLPort() == 0) {
|
||||
serverItemFromConfig.setRtspSSLPort(zlmServerConfig.getRtspSSlport());
|
||||
}
|
||||
if (mediaConfig.getRtpProxyPort() == 0) {
|
||||
serverItemFromConfig.setRtpProxyPort(zlmServerConfig.getRtpProxyPort());
|
||||
}
|
||||
if (serverItem != null){
|
||||
mediaServerMapper.delDefault();
|
||||
mediaServerMapper.add(serverItemFromConfig);
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItemFromConfig.getId();
|
||||
MediaServerItem serverItemInRedis = (MediaServerItem)redisUtil.get(key);
|
||||
if (serverItemInRedis != null) {
|
||||
serverItemFromConfig.setSsrcConfig(serverItemInRedis.getSsrcConfig());
|
||||
}else {
|
||||
serverItemFromConfig.setSsrcConfig(new SsrcConfig(serverItemFromConfig.getId(), null, sipConfig.getDomain()));
|
||||
}
|
||||
redisUtil.set(key, serverItemFromConfig);
|
||||
}else {
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItemFromConfig.getId();
|
||||
serverItemFromConfig.setSsrcConfig(new SsrcConfig(serverItemFromConfig.getId(), null, sipConfig.getDomain()));
|
||||
redisUtil.set(key, serverItemFromConfig);
|
||||
mediaServerMapper.add(serverItemFromConfig);
|
||||
}
|
||||
resetOnlineServerItem(serverItemFromConfig);
|
||||
setZLMConfig(serverItemFromConfig);
|
||||
}else {
|
||||
String now = this.format.format(System.currentTimeMillis());
|
||||
if (serverItem == null) {
|
||||
// 一个新的zlm接入wvp
|
||||
serverItem = new MediaServerItem(zlmServerConfig, sipConfig.getIp());
|
||||
serverItem.setCreateTime(now);
|
||||
serverItem.setUpdateTime(now);
|
||||
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId();
|
||||
serverItem.setSsrcConfig(new SsrcConfig(serverItem.getId(), null, sipConfig.getDomain()));
|
||||
redisUtil.set(key, serverItem);
|
||||
// 存入数据库
|
||||
mediaServerMapper.add(serverItem);
|
||||
setZLMConfig(serverItem);
|
||||
logger.warn("[未注册的zlm] 拒接接入:来自{}:{}", zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() );
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(serverItem.getId())) {
|
||||
serverItem.setId(zlmServerConfig.getGeneralMediaServerId());
|
||||
redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId(), serverItem);
|
||||
}
|
||||
serverItem.setStatus(true);
|
||||
mediaServerMapper.update(serverItem);
|
||||
resetOnlineServerItem(serverItem);
|
||||
}
|
||||
setZLMConfig(serverItem);
|
||||
|
||||
// if (zlmServerConfig.getGeneralMediaServerId().equals(mediaConfig.getId())
|
||||
// || (zlmServerConfig.getIp().equals(mediaConfig.getIp()) && zlmServerConfig.getHttpPort() == mediaConfig.getHttpPort())) {
|
||||
// // 配置文件的zlm
|
||||
// // 如果是配置文件中的zlm。 也就是默认zlm。 一切以配置文件内容为准
|
||||
// // wvp互惠修改zlm的端口,需要自行配置。
|
||||
// MediaServerItem serverItemFromConfig = mediaConfig.getMediaSerItem();
|
||||
// serverItemFromConfig.setId(zlmServerConfig.getGeneralMediaServerId());
|
||||
// if (mediaConfig.getHttpPort() == 0) {
|
||||
// serverItemFromConfig.setHttpPort(zlmServerConfig.getHttpPort());
|
||||
// }
|
||||
// if (mediaConfig.getHttpSSlPort() == 0) {
|
||||
// serverItemFromConfig.setHttpSSlPort(zlmServerConfig.getHttpSSLport());
|
||||
// }
|
||||
// if (mediaConfig.getRtmpPort() == 0) {
|
||||
// serverItemFromConfig.setRtmpPort(zlmServerConfig.getRtmpPort());
|
||||
// }
|
||||
// if (mediaConfig.getRtmpSSlPort() == 0) {
|
||||
// serverItemFromConfig.setRtmpSSlPort(zlmServerConfig.getRtmpSslPort());
|
||||
// }
|
||||
// if (mediaConfig.getRtspPort() == 0) {
|
||||
// serverItemFromConfig.setRtspPort(zlmServerConfig.getRtspPort());
|
||||
// }
|
||||
// if (mediaConfig.getRtspSSLPort() == 0) {
|
||||
// serverItemFromConfig.setRtspSSLPort(zlmServerConfig.getRtspSSlport());
|
||||
// }
|
||||
// if (mediaConfig.getRtpProxyPort() == 0) {
|
||||
// serverItemFromConfig.setRtpProxyPort(zlmServerConfig.getRtpProxyPort());
|
||||
// }
|
||||
// if (serverItem != null){
|
||||
// mediaServerMapper.delDefault();
|
||||
// mediaServerMapper.add(serverItemFromConfig);
|
||||
// String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItemFromConfig.getId();
|
||||
// MediaServerItem serverItemInRedis = (MediaServerItem)redisUtil.get(key);
|
||||
// if (serverItemInRedis != null) {
|
||||
// serverItemFromConfig.setSsrcConfig(serverItemInRedis.getSsrcConfig());
|
||||
// }else {
|
||||
// serverItemFromConfig.setSsrcConfig(new SsrcConfig(serverItemFromConfig.getId(), null, sipConfig.getDomain()));
|
||||
// }
|
||||
// redisUtil.set(key, serverItemFromConfig);
|
||||
// }else {
|
||||
// String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItemFromConfig.getId();
|
||||
// serverItemFromConfig.setSsrcConfig(new SsrcConfig(serverItemFromConfig.getId(), null, sipConfig.getDomain()));
|
||||
// redisUtil.set(key, serverItemFromConfig);
|
||||
// mediaServerMapper.add(serverItemFromConfig);
|
||||
// }
|
||||
// resetOnlineServerItem(serverItemFromConfig);
|
||||
// setZLMConfig(serverItemFromConfig);
|
||||
// }
|
||||
// 移除未添加的zlm的接入,所有的zlm必须先添加后才可以加入使用
|
||||
// else {
|
||||
// String now = this.format.format(System.currentTimeMillis());
|
||||
// if (serverItem == null){
|
||||
// // 一个新的zlm接入wvp
|
||||
// serverItem = new MediaServerItem(zlmServerConfig, sipConfig.getIp());
|
||||
// serverItem.setCreateTime(now);
|
||||
// serverItem.setUpdateTime(now);
|
||||
// String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId();
|
||||
// serverItem.setSsrcConfig(new SsrcConfig(serverItem.getId(), null, sipConfig.getDomain()));
|
||||
// redisUtil.set(key, serverItem);
|
||||
// // 存入数据库
|
||||
// mediaServerMapper.add(serverItem);
|
||||
// setZLMConfig(serverItem);
|
||||
// }
|
||||
// resetOnlineServerItem(serverItem);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<div class="card-img-zlm"></div>
|
||||
<div style="padding: 14px;text-align: left">
|
||||
<span style="font-size: 16px">{{item.id}}</span>
|
||||
<el-button icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">编辑</el-button>
|
||||
<el-button v-if="!item.defaultServer" icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">编辑</el-button>
|
||||
<el-button v-if="item.defaultServer" icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">查看</el-button>
|
||||
<el-button icon="el-icon-delete" style="margin-right: 10px;padding: 0;float: right;" type="text" @click="del(item)">移除</el-button>
|
||||
<div style="margin-top: 13px; line-height: 12px; ">
|
||||
<span style="font-size: 14px; color: #999; margin-top: 5px; ">{{item.ip}}</span>
|
||||
|
@ -27,6 +28,7 @@
|
|||
</div>
|
||||
<i v-if="item.status" class="iconfont icon-online server-card-status-online" title="在线"></i>
|
||||
<i v-if="!item.status" class="iconfont icon-online server-card-status-offline" title="离线"></i>
|
||||
<i v-if="item.defaultServer" class="server-card-default" >默认</i>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -172,6 +174,13 @@
|
|||
top: 20px;
|
||||
color: #808080;
|
||||
font-size: 18px;
|
||||
}
|
||||
.server-card-default{
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
top: 20px;
|
||||
color: #808080;
|
||||
font-size: 18px;
|
||||
}
|
||||
.server-card:hover {
|
||||
border: 1px solid #adadad;
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
<div id="formStep" style="margin-top: 1rem; margin-right: 20px;">
|
||||
<el-form v-if="currentStep == 1" ref="mediaServerForm" :rules="rules" :model="mediaServerForm" label-width="140px" >
|
||||
<el-form-item label="IP" prop="ip">
|
||||
<el-input v-model="mediaServerForm.ip" placeholder="媒体服务IP" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.ip" placeholder="媒体服务IP" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="HTTP端口" prop="httpPort">
|
||||
<el-input v-model="mediaServerForm.httpPort" placeholder="媒体服务HTTP端口" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.httpPort" placeholder="媒体服务HTTP端口" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="SECRET" prop="secret">
|
||||
<el-input v-model="mediaServerForm.secret" placeholder="媒体服务SECRET" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.secret" placeholder="媒体服务SECRET" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
|
@ -34,34 +34,34 @@
|
|||
<el-col :span="12">
|
||||
<el-form v-if="currentStep === 2 || currentStep === 3" ref="mediaServerForm1" :rules="rules" :model="mediaServerForm" label-width="140px" >
|
||||
<el-form-item label="IP" prop="ip">
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.ip" disabled></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.ip"></el-input>
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.ip" disabled :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.ip" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="HTTP端口" prop="httpPort">
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.httpPort" disabled></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.httpPort"></el-input>
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.httpPort" disabled :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.httpPort" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="SECRET" prop="secret">
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.secret" disabled></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.secret"></el-input>
|
||||
<el-input v-if="currentStep === 2" v-model="mediaServerForm.secret" disabled :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
<el-input v-if="currentStep === 3" v-model="mediaServerForm.secret" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="HOOK IP" prop="ip">
|
||||
<el-input v-model="mediaServerForm.hookIp" placeholder="媒体服务HOOK_IP" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.hookIp" placeholder="媒体服务HOOK_IP" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="SDP IP" prop="ip">
|
||||
<el-input v-model="mediaServerForm.sdpIp" placeholder="媒体服务SDP_IP" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.sdpIp" placeholder="媒体服务SDP_IP" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="流IP" prop="ip">
|
||||
<el-input v-model="mediaServerForm.streamIp" placeholder="媒体服务流IP" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.streamIp" placeholder="媒体服务流IP" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="HTTPS PORT" prop="httpSSlPort">
|
||||
<el-input v-model="mediaServerForm.httpSSlPort" placeholder="媒体服务HTTPS_PORT" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.httpSSlPort" placeholder="媒体服务HTTPS_PORT" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="RTSP PORT" prop="rtspPort">
|
||||
<el-input v-model="mediaServerForm.rtspPort" placeholder="媒体服务RTSP_PORT" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.rtspPort" placeholder="媒体服务RTSP_PORT" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="RTSPS PORT" prop="rtspSSLPort">
|
||||
<el-input v-model="mediaServerForm.rtspSSLPort" placeholder="媒体服务RTSPS_PORT" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.rtspSSLPort" placeholder="媒体服务RTSPS_PORT" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
@ -69,36 +69,36 @@
|
|||
<el-col :span="12">
|
||||
<el-form v-if="currentStep === 2 || currentStep === 3" ref="mediaServerForm2" :rules="rules" :model="mediaServerForm" label-width="180px" >
|
||||
<el-form-item label="RTMP PORT" prop="rtmpPort">
|
||||
<el-input v-model="mediaServerForm.rtmpPort" placeholder="媒体服务RTMP_PORT" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.rtmpPort" placeholder="媒体服务RTMP_PORT" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="RTMPS PORT" prop="rtmpSSlPort">
|
||||
<el-input v-model="mediaServerForm.rtmpSSlPort" placeholder="媒体服务RTMPS_PORT" clearable></el-input>
|
||||
<el-input v-model="mediaServerForm.rtmpSSlPort" placeholder="媒体服务RTMPS_PORT" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="自动配置媒体服务" >
|
||||
<el-switch v-model="mediaServerForm.autoConfig"></el-switch>
|
||||
<el-switch v-model="mediaServerForm.autoConfig" :disabled="mediaServerForm.defaultServer"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="收流端口模式" >
|
||||
<el-switch active-text="多端口" inactive-text="单端口" v-model="mediaServerForm.rtpEnable"></el-switch>
|
||||
<el-switch active-text="多端口" inactive-text="单端口" v-model="mediaServerForm.rtpEnable" :disabled="mediaServerForm.defaultServer"></el-switch>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="!mediaServerForm.rtpEnable" label="收流端口" prop="rtpProxyPort">
|
||||
<el-input v-model.number="mediaServerForm.rtpProxyPort" clearable></el-input>
|
||||
<el-input v-model.number="mediaServerForm.rtpProxyPort" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="mediaServerForm.rtpEnable" label="收流端口" >
|
||||
<el-input v-model="rtpPortRange1" placeholder="起始" @change="portRangeChange" clearable style="width: 100px" prop="rtpPortRange1"></el-input>
|
||||
<el-input v-model="rtpPortRange1" placeholder="起始" @change="portRangeChange" clearable style="width: 100px" prop="rtpPortRange1" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
-
|
||||
<el-input v-model="rtpPortRange2" placeholder="终止" @change="portRangeChange" clearable style="width: 100px" prop="rtpPortRange2"></el-input>
|
||||
<el-input v-model="rtpPortRange2" placeholder="终止" @change="portRangeChange" clearable style="width: 100px" prop="rtpPortRange2" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="推流端口" prop="sendRtpPortRange1">
|
||||
<el-input v-model="sendRtpPortRange1" placeholder="起始" @change="portRangeChange" clearable style="width: 100px" prop="sendRtpPortRange1"></el-input>
|
||||
<el-input v-model="sendRtpPortRange1" placeholder="起始" @change="portRangeChange" clearable style="width: 100px" prop="sendRtpPortRange1" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
-
|
||||
<el-input v-model="sendRtpPortRange2" placeholder="终止" @change="portRangeChange" clearable style="width: 100px" prop="sendRtpPortRange2"></el-input>
|
||||
<el-input v-model="sendRtpPortRange2" placeholder="终止" @change="portRangeChange" clearable style="width: 100px" prop="sendRtpPortRange2" :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="无人观看多久后停止拉流" >
|
||||
<el-input v-model.number="mediaServerForm.streamNoneReaderDelayMS" clearable></el-input>
|
||||
<el-input v-model.number="mediaServerForm.streamNoneReaderDelayMS" clearable :disabled="mediaServerForm.defaultServer"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="录像管理服务端口" prop="recordAssistPort">
|
||||
<el-input v-model.number="mediaServerForm.recordAssistPort">
|
||||
<el-input v-model.number="mediaServerForm.recordAssistPort" :disabled="mediaServerForm.defaultServer">
|
||||
<!-- <el-button v-if="mediaServerForm.recordAssistPort > 0" slot="append" type="primary" @click="checkRecordServer">测试</el-button>-->
|
||||
<el-button v-if="mediaServerForm.recordAssistPort > 0" class="el-icon-check" slot="append" type="primary" @click="checkRecordServer"></el-button>
|
||||
</el-input>
|
||||
|
@ -108,8 +108,9 @@
|
|||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
<el-button type="primary" @click="onSubmit" >提交</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button v-if="!mediaServerForm.defaultServer" type="primary" @click="onSubmit" >提交</el-button>
|
||||
<el-button v-if="!mediaServerForm.defaultServer" @click="close">取消</el-button>
|
||||
<el-button v-if="mediaServerForm.defaultServer" @click="close">关闭</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
|
Loading…
Reference in New Issue