
committed by
GitHub

36 changed files with 1193 additions and 781 deletions
@ -0,0 +1,90 @@ |
|||
package com.genersoft.iot.vmp.media.zlm; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.genersoft.iot.vmp.common.StreamInfo; |
|||
import com.genersoft.iot.vmp.conf.MediaServerConfig; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
|||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.ConcurrentReferenceHashMap; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.math.BigInteger; |
|||
import java.text.DecimalFormat; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.concurrent.ConcurrentHashMap; |
|||
|
|||
/** |
|||
* @Description:针对 ZLMediaServer的hook事件订阅 |
|||
* @author: pan |
|||
* @date: 2020年12月2日 21:17:32 |
|||
*/ |
|||
@Component |
|||
public class ZLMHttpHookSubscribe { |
|||
|
|||
private final static Logger logger = LoggerFactory.getLogger(ZLMHttpHookSubscribe.class); |
|||
|
|||
public enum HookType{ |
|||
on_flow_report, |
|||
on_http_access, |
|||
on_play, |
|||
on_publish, |
|||
on_record_mp4, |
|||
on_rtsp_auth, |
|||
on_rtsp_realm, |
|||
on_shell_login, |
|||
on_stream_changed, |
|||
on_stream_none_reader, |
|||
on_stream_not_found, |
|||
on_server_started |
|||
} |
|||
|
|||
public interface Event{ |
|||
void response(JSONObject response); |
|||
} |
|||
|
|||
private Map<HookType, Map<JSONObject, ZLMHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>(); |
|||
|
|||
public void addSubscribe(HookType type, JSONObject hookResponse, ZLMHttpHookSubscribe.Event event) { |
|||
Map<JSONObject, Event> eventMap = allSubscribes.get(type); |
|||
if (eventMap == null) { |
|||
eventMap = new HashMap<JSONObject, Event>(); |
|||
allSubscribes.put(type,eventMap); |
|||
} |
|||
eventMap.put(hookResponse, event); |
|||
} |
|||
|
|||
public ZLMHttpHookSubscribe.Event getSubscribe(HookType type, JSONObject hookResponse) { |
|||
ZLMHttpHookSubscribe.Event event= null; |
|||
Map<JSONObject, Event> eventMap = allSubscribes.get(type); |
|||
if (eventMap == null) { |
|||
return null; |
|||
} |
|||
for (JSONObject key : eventMap.keySet()) { |
|||
Boolean result = null; |
|||
for (String s : key.keySet()) { |
|||
String string = hookResponse.getString(s); |
|||
String string1 = key.getString(s); |
|||
if (result == null) { |
|||
result = key.getString(s).equals(hookResponse.getString(s)); |
|||
}else { |
|||
result = result && key.getString(s).equals(hookResponse.getString(s)); |
|||
} |
|||
|
|||
} |
|||
if (result) { |
|||
event = eventMap.get(key); |
|||
} |
|||
} |
|||
return event; |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.genersoft.iot.vmp.vmanager.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.genersoft.iot.vmp.common.StreamInfo; |
|||
|
|||
/** |
|||
* 点播处理 |
|||
*/ |
|||
public interface IPlayService { |
|||
|
|||
void onPublishHandlerForPlayBack(JSONObject resonse, String deviceId, String channelId, String uuid); |
|||
void onPublishHandlerForPlay(JSONObject resonse, String deviceId, String channelId, String uuid); |
|||
} |
@ -0,0 +1,90 @@ |
|||
package com.genersoft.iot.vmp.vmanager.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.genersoft.iot.vmp.common.StreamInfo; |
|||
import com.genersoft.iot.vmp.conf.MediaServerConfig; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
|||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
|||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
|||
import com.genersoft.iot.vmp.vmanager.play.PlayController; |
|||
import com.genersoft.iot.vmp.vmanager.service.IPlayService; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.text.DecimalFormat; |
|||
|
|||
@Service |
|||
public class PlayServiceImpl implements IPlayService { |
|||
|
|||
private final static Logger logger = LoggerFactory.getLogger(PlayServiceImpl.class); |
|||
|
|||
@Autowired |
|||
private IVideoManagerStorager storager; |
|||
|
|||
@Autowired |
|||
private DeferredResultHolder resultHolder; |
|||
|
|||
@Override |
|||
public void onPublishHandlerForPlay(JSONObject resonse, String deviceId, String channelId, String uuid) { |
|||
RequestMessage msg = new RequestMessage(); |
|||
msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); |
|||
StreamInfo streamInfo = onPublishHandler(resonse, deviceId, channelId, uuid); |
|||
if (streamInfo != null) { |
|||
storager.startPlay(streamInfo); |
|||
msg.setData(JSON.toJSONString(streamInfo)); |
|||
resultHolder.invokeResult(msg); |
|||
} else { |
|||
logger.warn("设备预览API调用失败!"); |
|||
msg.setData("设备预览API调用失败!"); |
|||
resultHolder.invokeResult(msg); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onPublishHandlerForPlayBack(JSONObject resonse, String deviceId, String channelId, String uuid) { |
|||
RequestMessage msg = new RequestMessage(); |
|||
msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); |
|||
StreamInfo streamInfo = onPublishHandler(resonse, deviceId, channelId, uuid); |
|||
if (streamInfo != null) { |
|||
storager.startPlayback(streamInfo); |
|||
msg.setData(JSON.toJSONString(streamInfo)); |
|||
resultHolder.invokeResult(msg); |
|||
} else { |
|||
logger.warn("设备预览API调用失败!"); |
|||
msg.setData("设备预览API调用失败!"); |
|||
resultHolder.invokeResult(msg); |
|||
} |
|||
} |
|||
|
|||
public StreamInfo onPublishHandler(JSONObject resonse, String deviceId, String channelId, String uuid) { |
|||
String streamId = resonse.getString("id"); |
|||
String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16)); |
|||
StreamInfo streamInfo = new StreamInfo(); |
|||
streamInfo.setSsrc(ssrc); |
|||
streamInfo.setStreamId(streamId); |
|||
streamInfo.setDeviceID(deviceId); |
|||
streamInfo.setCahnnelId(channelId); |
|||
MediaServerConfig mediaServerConfig = storager.getMediaInfo(); |
|||
|
|||
streamInfo.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
streamInfo.setWs_flv(String.format("ws://%s:%s/rtp/%s.flv", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
|
|||
streamInfo.setFmp4(String.format("http://%s:%s/rtp/%s.live.mp4", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
streamInfo.setWs_fmp4(String.format("ws://%s:%s/rtp/%s.live.mp4", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
|
|||
streamInfo.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
streamInfo.setWs_hls(String.format("ws://%s:%s/rtp/%s/hls.m3u8", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
|
|||
streamInfo.setTs(String.format("http://%s:%s/rtp/%s.live.ts", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
streamInfo.setWs_ts(String.format("ws://%s:%s/rtp/%s.live.ts", mediaServerConfig.getWanIp(), mediaServerConfig.getHttpPort(), streamId)); |
|||
|
|||
streamInfo.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaServerConfig.getWanIp(), mediaServerConfig.getRtmpPort(), streamId)); |
|||
streamInfo.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaServerConfig.getWanIp(), mediaServerConfig.getRtspPort(), streamId)); |
|||
|
|||
return streamInfo; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
spring: |
|||
# [不需要改] |
|||
application: |
|||
name: iot-vmp-vmanager |
|||
# [不需要改] 影子数据存储方式,支持redis、jdbc,暂不支持mysql, |
|||
database: redis |
|||
# [不需要改] 通信方式,支持kafka、http |
|||
communicate: http |
|||
# REDIS数据库配置 |
|||
redis: |
|||
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 |
|||
host: 127.0.0.1 |
|||
# [必须修改] 端口号 |
|||
port: 6379 |
|||
# [可选] 数据库 DB |
|||
database: 6 |
|||
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 |
|||
password: |
|||
# [可选] 超时时间 |
|||
timeout: 10000 |
|||
# [不可用] jdbc数据库配置, 暂不支持 |
|||
datasource: |
|||
name: eiot |
|||
url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true |
|||
username: |
|||
password: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
driver-class-name: com.mysql.jdbc.Driver |
|||
|
|||
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 |
|||
server: |
|||
port: 18080 |
|||
|
|||
# 作为28181服务器的配置 |
|||
sip: |
|||
# [必须修改] 本机的IP, 必须是网卡上的IP |
|||
ip: 192.168.0.100 |
|||
# [可选] 28181服务监听的端口 |
|||
port: 5060 |
|||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) |
|||
# 后两位为行业编码,定义参照附录D.3 |
|||
# 3701020049标识山东济南历下区 信息行业接入 |
|||
# [可选] |
|||
domain: 4401020049 |
|||
# [可选] |
|||
id: 44010200492000000001 |
|||
# [可选] 默认设备认证密码,后续扩展使用设备单独密码 |
|||
password: admin123 |
|||
|
|||
# 登陆的用户名密码 |
|||
auth: |
|||
# [可选] 用户名 |
|||
username: admin |
|||
# [可选] 密码, 默认为admin |
|||
password: 21232f297a57a5a743894a0e4a801fc3 |
|||
|
|||
#zlm服务器配置 |
|||
media: |
|||
# [必须修改] zlm服务器的内网IP |
|||
ip: 192.168.0.100 |
|||
# [可选] zlm服务器的公网IP, 内网部署置空即可 |
|||
wanIp: |
|||
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip |
|||
hookIp: |
|||
# [必须修改] zlm服务器的http.port |
|||
port: 80 |
|||
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改 |
|||
autoConfig: true |
|||
# [可选] zlm服务器的hook.admin_params=secret |
|||
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc |
|||
# [可选] zlm服务器的general.streamNoneReaderDelayMS |
|||
streamNoneReaderDelayMS: 18000 # 无人观看多久自动关闭流 |
|||
# [可选] 关闭等待收到流编码信息后在返回, |
|||
# 设为false可以获得更好的兼容性,保证返回后流就可以播放, |
|||
# 设为true可以快速打开播放窗口,可以获得更好的体验 |
|||
closeWaitRTPInfo: false |
|||
# 启用udp多端口模式 |
|||
rtp: |
|||
# [可选] 是否启用udp多端口模式, 开启后会在udpPortRange范围内选择端口用于媒体流传输 |
|||
enable: true |
|||
# [可选] 在此范围内选择端口用于媒体流传输, 不只是udp, 使用TCP被动传输模式时,也是从这个范围内选择端口 |
|||
udpPortRange: 30000,30500 # 端口范围 |
|||
|
|||
# [可选] 日志配置, 一般不需要改 |
|||
logging: |
|||
file: |
|||
name: logs/wvp.log |
|||
max-history: 30 |
|||
max-size: 10MB |
|||
total-size-cap: 300MB |
|||
level: |
|||
com: |
|||
genersoft: |
|||
iot: debug |
@ -1,64 +1,3 @@ |
|||
spring: |
|||
application: |
|||
name: iot-vmp-vmanager |
|||
# 影子数据存储方式,支持redis、jdbc,暂不支持mysql |
|||
database: redis |
|||
# 通信方式,支持kafka、http |
|||
communicate: http |
|||
redis: |
|||
# Redis服务器IP |
|||
host: 192.168.1.141 |
|||
#端口号 |
|||
port: 6379 |
|||
database: 6 |
|||
#访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 |
|||
password: 4767cb971b40a1300fa09b7f87b09d1c |
|||
#超时时间 |
|||
timeout: 10000 |
|||
datasource: |
|||
name: eiot |
|||
url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true |
|||
username: |
|||
password: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
driver-class-name: com.mysql.jdbc.Driver |
|||
server: |
|||
port: 18080 |
|||
sip: |
|||
ip: 192.168.1.20 |
|||
port: 5060 |
|||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) |
|||
# 后两位为行业编码,定义参照附录D.3 |
|||
# 3701020049标识山东济南历下区 信息行业接入 |
|||
domain: 3402000000 |
|||
id: 34020000002000000001 |
|||
# 默认设备认证密码,后续扩展使用设备单独密码 |
|||
password: 12345678 |
|||
|
|||
auth: #32位小写md5加密(默认密码为admin) |
|||
username: admin |
|||
password: 21232f297a57a5a743894a0e4a801fc3 |
|||
|
|||
media: #zlm服务器的ip与http端口, 重点: 这是http端口 |
|||
ip: 127.0.0.1 |
|||
wanIp: 192.168.1.20 |
|||
port: 6080 |
|||
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc |
|||
streamNoneReaderDelayMS: 600000 # 无人观看多久自动关闭流 |
|||
# 关闭等待收到流编码信息后在返回, |
|||
# 设为false可以获得更好的兼容性,保证返回后流就可以播放, |
|||
# 设为true可以快速打开播放窗口,可以获得更好的体验 |
|||
closeWaitRTPInfo: true |
|||
rtp: # 启用udp多端口模式 |
|||
enable: true |
|||
udpPortRange: 30000,30500 # 端口范围 |
|||
logging: |
|||
file: |
|||
name: logs/wvp.log |
|||
max-history: 30 |
|||
max-size: 10MB |
|||
total-size-cap: 300MB |
|||
level: |
|||
com: |
|||
genersoft: |
|||
iot: debug |
|||
profiles: |
|||
active: dev |
@ -0,0 +1,57 @@ |
|||
<template> |
|||
<div id="player"> |
|||
<div id="easyplayer"></div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'player', |
|||
data() { |
|||
return { |
|||
easyPlayer: null |
|||
}; |
|||
}, |
|||
props: ['videoUrl', 'error', 'hasaudio'], |
|||
mounted () { |
|||
this.$nextTick(() =>{ |
|||
console.log("初始化时的地址为: " + this.videoUrl) |
|||
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK) |
|||
this.easyPlayer.play(this.videoUrl, 1) |
|||
}) |
|||
}, |
|||
watch:{ |
|||
videoUrl(newData, oldData){ |
|||
this.easyPlayer.destroy() |
|||
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK) |
|||
this.easyPlayer.play(newData, 1) |
|||
}, |
|||
immediate:true |
|||
}, |
|||
methods: { |
|||
play: function (url) { |
|||
this.easyPlayer = new WasmPlayer(null, 'easyplayer', this.eventcallbacK) |
|||
this.easyPlayer.play(url, 1) |
|||
}, |
|||
pause: function () { |
|||
this.easyPlayer.destroy(); |
|||
}, |
|||
eventcallbacK: function(type, message) { |
|||
console.log("player 事件回调") |
|||
console.log(type) |
|||
console.log(message) |
|||
} |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.LodingTitle { |
|||
min-width: 70px; |
|||
} |
|||
/* 隐藏logo */ |
|||
/* .iconqingxiLOGO { |
|||
display: none !important; |
|||
} */ |
|||
|
|||
</style> |
@ -1,410 +1,418 @@ |
|||
<template> |
|||
<div id="addlatform" v-loading="isLoging"> |
|||
<el-dialog title="添加平台" width="70%" top="2rem" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()"> |
|||
<div id="shared" style="text-align: right; margin-top: 1rem;"> |
|||
|
|||
<el-row :gutter="24"> |
|||
<el-col :span="11"> |
|||
<el-form ref="platform1" :rules="rules" :model="platform" label-width="160px" > |
|||
<el-form-item label="名称" prop="name"> |
|||
<el-input v-model="platform.name"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务国标编码" prop="serverGBId"> |
|||
<el-input v-model="platform.serverGBId" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务国标域" prop="serverGBDomain"> |
|||
<el-input v-model="platform.serverGBDomain" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务IP" prop="serverIP"> |
|||
<el-input v-model="platform.serverIP" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务端口" prop="serverPort"> |
|||
<el-input v-model="platform.serverPort" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备国标编号" prop="deviceGBId"> |
|||
<el-input v-model="platform.deviceGBId" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="本地IP" prop="deviceIp"> |
|||
<el-input v-model="platform.deviceIp" :disabled="true"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="本地端口" prop="devicePort"> |
|||
<el-input v-model="platform.devicePort" :disabled="true"></el-input> |
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form ref="platform2" :rules="rules" :model="platform" label-width="160px"> |
|||
<el-form-item label="SIP认证用户名" prop="username"> |
|||
<el-input v-model="platform.username"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP认证密码" prop="password"> |
|||
<el-input v-model="platform.password" type="password"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="注册周期(秒)" prop="expires"> |
|||
<el-input v-model="platform.expires"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="心跳周期(秒)" prop="keepTimeout"> |
|||
<el-input v-model="platform.keepTimeout"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="信令传输" prop="transport"> |
|||
<el-select v-model="platform.transport" style="width:100%" placeholder="请选择信令传输方式"> |
|||
<el-option label="UDP" value="UDP"></el-option> |
|||
<el-option label="TCP" value="TCP"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="字符集" prop="characterSet"> |
|||
<el-select v-model="platform.characterSet" style="width:100%" placeholder="请选择字符集"> |
|||
<el-option label="GB2312" value="GB2312"></el-option> |
|||
<el-option label="UTF-8" value="UTF-8"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="其他选项" > |
|||
<el-checkbox label="启用" v-model="platform.enable" ></el-checkbox> |
|||
<el-checkbox label="云台控制" v-model="platform.PTZEnable"></el-checkbox> |
|||
<el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button> |
|||
<el-button @click="close">取消</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
<div id="addlatform" v-loading="isLoging"> |
|||
<el-dialog |
|||
title="添加平台" |
|||
width="70%" |
|||
top="2rem" |
|||
:close-on-click-modal="false" |
|||
:visible.sync="showDialog" |
|||
:destroy-on-close="true" |
|||
@close="close()" |
|||
> |
|||
<div id="shared" style="text-align: right; margin-top: 1rem"> |
|||
<el-row :gutter="24"> |
|||
<el-col :span="11"> |
|||
<el-form ref="platform1" :rules="rules" :model="platform" label-width="160px"> |
|||
<el-form-item label="名称" prop="name"> |
|||
<el-input v-model="platform.name"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务国标编码" prop="serverGBId"> |
|||
<el-input v-model="platform.serverGBId" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务国标域" prop="serverGBDomain"> |
|||
<el-input v-model="platform.serverGBDomain" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务IP" prop="serverIP"> |
|||
<el-input v-model="platform.serverIP" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP服务端口" prop="serverPort"> |
|||
<el-input v-model="platform.serverPort" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="设备国标编号" prop="deviceGBId"> |
|||
<el-input v-model="platform.deviceGBId" clearable></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="本地IP" prop="deviceIp"> |
|||
<el-input v-model="platform.deviceIp" :disabled="true"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="本地端口" prop="devicePort"> |
|||
<el-input v-model="platform.devicePort" :disabled="true"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<el-form ref="platform2" :rules="rules" :model="platform" label-width="160px"> |
|||
<el-form-item label="SIP认证用户名" prop="username"> |
|||
<el-input v-model="platform.username"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="SIP认证密码" prop="password"> |
|||
<el-input v-model="platform.password" type="password"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="注册周期(秒)" prop="expires"> |
|||
<el-input v-model="platform.expires"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="心跳周期(秒)" prop="keepTimeout"> |
|||
<el-input v-model="platform.keepTimeout"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="信令传输" prop="transport"> |
|||
<el-select |
|||
v-model="platform.transport" |
|||
style="width: 100%" |
|||
placeholder="请选择信令传输方式" |
|||
> |
|||
<el-option label="UDP" value="UDP"></el-option> |
|||
<el-option label="TCP" value="TCP"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="字符集" prop="characterSet"> |
|||
<el-select |
|||
v-model="platform.characterSet" |
|||
style="width: 100%" |
|||
placeholder="请选择字符集" |
|||
> |
|||
<el-option label="GB2312" value="GB2312"></el-option> |
|||
<el-option label="UTF-8" value="UTF-8"></el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="其他选项"> |
|||
<el-checkbox label="启用" v-model="platform.enable"></el-checkbox> |
|||
<el-checkbox label="云台控制" v-model="platform.PTZEnable"></el-checkbox> |
|||
<el-checkbox label="RTCP保活" v-model="platform.rtcp"></el-checkbox> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="onSubmit">{{ |
|||
onSubmit_text |
|||
}}</el-button> |
|||
<el-button @click="close">取消</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'platformEdit', |
|||
props: {}, |
|||
computed: { |
|||
|
|||
name: "platformEdit", |
|||
props: {}, |
|||
computed: {}, |
|||
created() {}, |
|||
data() { |
|||
var deviceGBIdRules = async (rule, value, callback) => { |
|||
console.log(value); |
|||
if (value === "") { |
|||
callback(new Error("请输入设备国标编号")); |
|||
} else { |
|||
var exit = await this.deviceGBIdExit(value); |
|||
console.log(exit); |
|||
console.log(exit == "true"); |
|||
console.log(exit === "true"); |
|||
if (exit) { |
|||
callback(new Error("设备国标编号已存在")); |
|||
} else { |
|||
callback(); |
|||
} |
|||
} |
|||
}; |
|||
return { |
|||
listChangeCallback: null, |
|||
showDialog: false, |
|||
isLoging: false, |
|||
onSubmit_text: "立即创建", |
|||
// platform: { |
|||
// enable: false, |
|||
// PTZEnable: true, |
|||
// rtcp: false, |
|||
// name: null, |
|||
// serverGBId: null, |
|||
// serverGBDomain: null, |
|||
// serverIP: null, |
|||
// serverPort: null, |
|||
// deviceGBId: null, |
|||
// deviceIp: null, |
|||
// devicePort: null, |
|||
// username: null, |
|||
// password: null, |
|||
// expires: 300, |
|||
// keepTimeout: 60, |
|||
// transport: "UDP", |
|||
// characterSet: "GB2312", |
|||
// }, |
|||
platform: { |
|||
enable: true, |
|||
PTZEnable: true, |
|||
rtcp: false, |
|||
name: "测试001", |
|||
serverGBId: "34020000002000000001", |
|||
serverGBDomain: "3402000000", |
|||
serverIP: "192.168.1.141", |
|||
serverPort: "5060", |
|||
deviceGBId: "34020000001320001101", |
|||
deviceIp: "192.168.1.20", |
|||
devicePort: "5060", |
|||
username: "34020000001320001101", |
|||
password: "12345678", |
|||
expires: 300, |
|||
keepTimeout: 60, |
|||
transport: "UDP", |
|||
characterSet: "GB2312", |
|||
}, |
|||
rules: { |
|||
name: [{ required: true, message: "请输入平台名称", trigger: "blur" }], |
|||
serverGBId: [ |
|||
{ required: true, message: "请输入SIP服务国标编码", trigger: "blur" }, |
|||
], |
|||
serverGBDomain: [ |
|||
{ required: true, message: "请输入SIP服务国标域", trigger: "blur" }, |
|||
], |
|||
serverIP: [{ required: true, message: "请输入SIP服务IP", trigger: "blur" }], |
|||
serverPort: [{ required: true, message: "请输入SIP服务端口", trigger: "blur" }], |
|||
deviceGBId: [{ validator: deviceGBIdRules, trigger: "blur" }], |
|||
username: [{ required: false, message: "请输入SIP认证用户名", trigger: "blur" }], |
|||
password: [{ required: false, message: "请输入SIP认证密码", trigger: "blur" }], |
|||
expires: [{ required: true, message: "请输入注册周期", trigger: "blur" }], |
|||
keepTimeout: [{ required: true, message: "请输入心跳周期", trigger: "blur" }], |
|||
transport: [{ required: true, message: "请选择信令传输", trigger: "blur" }], |
|||
characterSet: [{ required: true, message: "请选择编码字符集", trigger: "blur" }], |
|||
}, |
|||
}; |
|||
}, |
|||
methods: { |
|||
openDialog: function (platform, callback) { |
|||
var that = this; |
|||
this.$axios |
|||
.get(`/api/platforms/serverconfig`) |
|||
.then(function (res) { |
|||
console.log(res); |
|||
that.platform.deviceGBId = res.data.username; |
|||
that.platform.deviceIp = res.data.deviceIp; |
|||
that.platform.devicePort = res.data.devicePort; |
|||
that.platform.username = res.data.username; |
|||
that.platform.password = res.data.password; |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}); |
|||
this.showDialog = true; |
|||
this.listChangeCallback = callback; |
|||
if (platform != null) { |
|||
this.platform = platform; |
|||
this.onSubmit_text = "保存"; |
|||
} else { |
|||
} |
|||
}, |
|||
created() {}, |
|||
data() { |
|||
var deviceGBIdRules = async (rule, value, callback) => { |
|||
console.log(value) |
|||
if (value === '') { |
|||
callback(new Error('请输入设备国标编号')); |
|||
} else { |
|||
var exit = await this.deviceGBIdExit(value); |
|||
console.log(exit) |
|||
console.log(exit == "true") |
|||
console.log(exit === "true") |
|||
if (exit) { |
|||
callback(new Error('设备国标编号已存在')); |
|||
}else { |
|||
callback(); |
|||
onSubmit: function () { |
|||
console.log("onSubmit"); |
|||
var that = this; |
|||
that.$axios |
|||
.post(`/api/platforms/save`, that.platform) |
|||
.then(function (res) { |
|||
console.log(res); |
|||
console.log(res.data == "success"); |
|||
if (res.data == "success") { |
|||
that.$message({ |
|||
showClose: true, |
|||
message: "保存成功", |
|||
type: "success", |
|||
}); |
|||
that.showDialog = false; |
|||
if (that.listChangeCallback != null) { |
|||
that.listChangeCallback(); |
|||
} |
|||
} |
|||
}; |
|||
return { |
|||
listChangeCallback: null, |
|||
showDialog: false, |
|||
isLoging: false, |
|||
onSubmit_text:"立即创建", |
|||
// platform: { |
|||
// enable: false, |
|||
// PTZEnable: true, |
|||
// rtcp: false, |
|||
// name: null, |
|||
// serverGBId: null, |
|||
// serverGBDomain: null, |
|||
// serverIP: null, |
|||
// serverPort: null, |
|||
// deviceGBId: null, |
|||
// deviceIp: null, |
|||
// devicePort: null, |
|||
// username: null, |
|||
// password: null, |
|||
// expires: 300, |
|||
// keepTimeout: 60, |
|||
// transport: "UDP", |
|||
// characterSet: "GB2312", |
|||
// }, |
|||
platform: { |
|||
enable: true, |
|||
PTZEnable: true, |
|||
rtcp: false, |
|||
name: "测试001", |
|||
serverGBId: "34020000002000000001", |
|||
serverGBDomain: "3402000000", |
|||
serverIP: "192.168.1.141", |
|||
serverPort: "5060", |
|||
deviceGBId: "34020000001320001101", |
|||
deviceIp: "192.168.1.20", |
|||
devicePort: "5060", |
|||
username: "34020000001320001101", |
|||
password: "12345678", |
|||
expires: 300, |
|||
keepTimeout: 60, |
|||
transport: "UDP", |
|||
characterSet: "GB2312", |
|||
}, |
|||
rules: { |
|||
name: [ |
|||
{ required: true, message:"请输入平台名称", trigger: 'blur' } |
|||
], |
|||
serverGBId: [ |
|||
{ required: true, message:"请输入SIP服务国标编码", trigger: 'blur' } |
|||
], |
|||
serverGBDomain: [ |
|||
{ required: true, message:"请输入SIP服务国标域", trigger: 'blur' } |
|||
], |
|||
serverIP: [ |
|||
{ required: true, message:"请输入SIP服务IP", trigger: 'blur' } |
|||
], |
|||
serverPort: [ |
|||
{ required: true, message:"请输入SIP服务端口", trigger: 'blur' } |
|||
], |
|||
deviceGBId: [ |
|||
{validator: deviceGBIdRules, trigger: 'blur' } |
|||
], |
|||
username: [ |
|||
{ required: false, message:"请输入SIP认证用户名", trigger: 'blur' } |
|||
], |
|||
password: [ |
|||
{ required: false, message:"请输入SIP认证密码", trigger: 'blur' } |
|||
], |
|||
expires: [ |
|||
{ required: true, message:"请输入注册周期", trigger: 'blur' } |
|||
], |
|||
keepTimeout: [ |
|||
{ required: true, message:"请输入心跳周期", trigger: 'blur' } |
|||
], |
|||
transport: [ |
|||
{ required: true, message:"请选择信令传输", trigger: 'blur' } |
|||
], |
|||
characterSet: [ |
|||
{ required: true, message:"请选择编码字符集", trigger: 'blur' } |
|||
] |
|||
} |
|||
}; |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}); |
|||
}, |
|||
methods: { |
|||
openDialog: function (platform, callback) { |
|||
this.showDialog = true; |
|||
this.listChangeCallback = callback; |
|||
if (platform != null) { |
|||
this.platform = platform; |
|||
this.onSubmit_text = "保存" |
|||
} |
|||
|
|||
}, |
|||
onSubmit: function () { |
|||
console.log('onSubmit'); |
|||
var that = this; |
|||
that.$axios.post(`/api/platforms/save`, that.platform) |
|||
.then(function (res) { |
|||
console.log(res) |
|||
console.log(res.data == "success") |
|||
if (res.data == "success") { |
|||
that.$message({ |
|||
showClose: true, |
|||
message: '保存成功', |
|||
type: 'success' |
|||
}); |
|||
that.showDialog = false; |
|||
if (that.listChangeCallback != null) { |
|||
that.listChangeCallback() |
|||
} |
|||
} |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}); |
|||
}, |
|||
close: function () { |
|||
console.log('关闭添加视频平台'); |
|||
this.showDialog = false; |
|||
this.$refs.platform1.resetFields(); |
|||
this.$refs.platform2.resetFields(); |
|||
}, |
|||
deviceGBIdExit: async function (deviceGbId) { |
|||
var result = false; |
|||
var that = this |
|||
await that.$axios.post(`/api/platforms/exit/${deviceGbId}`) |
|||
.then(function (res) { |
|||
result = res.data; |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}); |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
|||
close: function () { |
|||
console.log("关闭添加视频平台"); |
|||
this.showDialog = false; |
|||
this.$refs.platform1.resetFields(); |
|||
this.$refs.platform2.resetFields(); |
|||
}, |
|||
deviceGBIdExit: async function (deviceGbId) { |
|||
var result = false; |
|||
var that = this; |
|||
await that.$axios |
|||
.post(`/api/platforms/exit/${deviceGbId}`) |
|||
.then(function (res) { |
|||
result = res.data; |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}); |
|||
return result; |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style> |
|||
.control-wrapper { |
|||
position: relative; |
|||
width: 6.25rem; |
|||
height: 6.25rem; |
|||
max-width: 6.25rem; |
|||
max-height: 6.25rem; |
|||
border-radius: 100%; |
|||
margin-top: 2.5rem; |
|||
margin-left: 0.5rem; |
|||
float: left; |
|||
position: relative; |
|||
width: 6.25rem; |
|||
height: 6.25rem; |
|||
max-width: 6.25rem; |
|||
max-height: 6.25rem; |
|||
border-radius: 100%; |
|||
margin-top: 2.5rem; |
|||
margin-left: 0.5rem; |
|||
float: left; |
|||
} |
|||
|
|||
.control-panel { |
|||
position: relative; |
|||
top: 0; |
|||
left: 5rem; |
|||
height: 11rem; |
|||
max-height: 11rem; |
|||
position: relative; |
|||
top: 0; |
|||
left: 5rem; |
|||
height: 11rem; |
|||
max-height: 11rem; |
|||
} |
|||
|
|||
.control-btn { |
|||
display: flex; |
|||
justify-content: center; |
|||
position: absolute; |
|||
width: 44%; |
|||
height: 44%; |
|||
border-radius: 5px; |
|||
border: 1px solid #78aee4; |
|||
box-sizing: border-box; |
|||
transition: all 0.3s linear; |
|||
display: flex; |
|||
justify-content: center; |
|||
position: absolute; |
|||
width: 44%; |
|||
height: 44%; |
|||
border-radius: 5px; |
|||
border: 1px solid #78aee4; |
|||
box-sizing: border-box; |
|||
transition: all 0.3s linear; |
|||
} |
|||
|
|||
.control-btn i { |
|||
font-size: 20px; |
|||
color: #78aee4; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
font-size: 20px; |
|||
color: #78aee4; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
|
|||
.control-round { |
|||
position: absolute; |
|||
top: 21%; |
|||
left: 21%; |
|||
width: 58%; |
|||
height: 58%; |
|||
background: #fff; |
|||
border-radius: 100%; |
|||
position: absolute; |
|||
top: 21%; |
|||
left: 21%; |
|||
width: 58%; |
|||
height: 58%; |
|||
background: #fff; |
|||
border-radius: 100%; |
|||
} |
|||
|
|||
.control-round-inner { |
|||
position: absolute; |
|||
left: 13%; |
|||
top: 13%; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 70%; |
|||
height: 70%; |
|||
font-size: 40px; |
|||
color: #78aee4; |
|||
border: 1px solid #78aee4; |
|||
border-radius: 100%; |
|||
transition: all 0.3s linear; |
|||
position: absolute; |
|||
left: 13%; |
|||
top: 13%; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 70%; |
|||
height: 70%; |
|||
font-size: 40px; |
|||
color: #78aee4; |
|||
border: 1px solid #78aee4; |
|||
border-radius: 100%; |
|||
transition: all 0.3s linear; |
|||
} |
|||
|
|||
.control-inner-btn { |
|||
position: absolute; |
|||
width: 60%; |
|||
height: 60%; |
|||
background: #fafafa; |
|||
position: absolute; |
|||
width: 60%; |
|||
height: 60%; |
|||
background: #fafafa; |
|||
} |
|||
|
|||
.control-top { |
|||
top: -8%; |
|||
left: 27%; |
|||
transform: rotate(-45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
top: -8%; |
|||
left: 27%; |
|||
transform: rotate(-45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
} |
|||
|
|||
.control-top i { |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
} |
|||
|
|||
.control-top .control-inner { |
|||
left: -1px; |
|||
bottom: 0; |
|||
border-top: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 100% 0 0; |
|||
left: -1px; |
|||
bottom: 0; |
|||
border-top: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 100% 0 0; |
|||
} |
|||
|
|||
.control-top .fa { |
|||
transform: rotate(45deg) translateY(-7px); |
|||
transform: rotate(45deg) translateY(-7px); |
|||
} |
|||
|
|||
.control-left { |
|||
top: 27%; |
|||
left: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 0 5px 100%; |
|||
top: 27%; |
|||
left: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 0 5px 100%; |
|||
} |
|||
|
|||
.control-left i { |
|||
transform: rotate(-45deg); |
|||
transform: rotate(-45deg); |
|||
} |
|||
|
|||
.control-left .control-inner { |
|||
right: -1px; |
|||
top: -1px; |
|||
border-bottom: 1px solid #78aee4; |
|||
border-left: 1px solid #78aee4; |
|||
border-radius: 0 0 0 100%; |
|||
right: -1px; |
|||
top: -1px; |
|||
border-bottom: 1px solid #78aee4; |
|||
border-left: 1px solid #78aee4; |
|||
border-radius: 0 0 0 100%; |
|||
} |
|||
|
|||
.control-left .fa { |
|||
transform: rotate(-45deg) translateX(-7px); |
|||
transform: rotate(-45deg) translateX(-7px); |
|||
} |
|||
|
|||
.control-right { |
|||
top: 27%; |
|||
right: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
top: 27%; |
|||
right: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 5px 100% 5px 0; |
|||
} |
|||
|
|||
.control-right i { |
|||
transform: rotate(-45deg); |
|||
transform: rotate(-45deg); |
|||
} |
|||
|
|||
.control-right .control-inner { |
|||
left: -1px; |
|||
bottom: -1px; |
|||
border-top: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 100% 0 0; |
|||
left: -1px; |
|||
bottom: -1px; |
|||
border-top: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 100% 0 0; |
|||
} |
|||
|
|||
.control-right .fa { |
|||
transform: rotate(-45deg) translateX(7px); |
|||
transform: rotate(-45deg) translateX(7px); |
|||
} |
|||
|
|||
.control-bottom { |
|||
left: 27%; |
|||
bottom: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 0 5px 100% 5px; |
|||
left: 27%; |
|||
bottom: -8%; |
|||
transform: rotate(45deg); |
|||
border-radius: 0 5px 100% 5px; |
|||
} |
|||
|
|||
.control-bottom i { |
|||
transform: rotate(-45deg); |
|||
transform: rotate(-45deg); |
|||
} |
|||
|
|||
.control-bottom .control-inner { |
|||
top: -1px; |
|||
left: -1px; |
|||
border-bottom: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 0 100% 0; |
|||
top: -1px; |
|||
left: -1px; |
|||
border-bottom: 1px solid #78aee4; |
|||
border-right: 1px solid #78aee4; |
|||
border-radius: 0 0 100% 0; |
|||
} |
|||
|
|||
.control-bottom .fa { |
|||
transform: rotate(-45deg) translateY(7px); |
|||
transform: rotate(-45deg) translateY(7px); |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue