添加zlm集群支持

This commit is contained in:
64850858
2021-07-16 16:34:51 +08:00
parent 06d78575cc
commit 89a9ab4534
75 changed files with 2431 additions and 914 deletions

View File

@@ -39,6 +39,22 @@
<el-form-item label="超时时间:毫秒" prop="timeout_ms" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.timeout_ms" clearable></el-input>
</el-form-item>
<el-form-item label="节点选择" prop="rtp_type">
<el-select
v-model="proxyParam.mediaServerId"
@change="mediaServerIdChange"
style="width: 100%"
placeholder="请选择拉流节点"
>
<el-option label="自动选择" value="auto"></el-option>
<el-option
v-for="item in mediaServerList"
:key="item.id"
:label="item.id"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="FFmpeg命令模板" prop="ffmpeg_cmd_key" v-if="proxyParam.type=='ffmpeg'">
<!-- <el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></el-input>-->
<el-select
@@ -68,6 +84,7 @@
<el-option label="组播" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="国标平台">
<el-select
v-model="proxyParam.platformGbId"
@@ -106,6 +123,8 @@
</template>
<script>
import MediaServer from './../service/MediaServer'
export default {
name: "streamProxyEdit",
props: {},
@@ -134,27 +153,8 @@ export default {
isLoging: false,
dialogLoading: false,
onSubmit_text: "立即创建",
platformList: [{
id: 1,
enable: true,
name: "141",
serverGBId: "34020000002000000001",
serverGBDomain: "3402000000",
serverIP: "192.168.1.141",
serverPort: 15060,
deviceGBId: "34020000002000000001",
deviceIp: "192.168.1.20",
devicePort: "5060",
username: "34020000002000000001",
password: "12345678",
expires: "300",
keepTimeout: "60",
transport: "UDP",
characterSet: "GB2312",
ptz: false,
rtcp: false,
status: true,
}],
platformList: [],
mediaServer: new MediaServer(),
proxyParam: {
name: null,
type: "default",
@@ -170,7 +170,9 @@ export default {
enable_hls: true,
enable_mp4: false,
platformGbId: null,
mediaServerId: "auto",
},
mediaServerList:{},
ffmpegCmdList:{},
rules: {
@@ -193,7 +195,6 @@ export default {
}
let that = this;
this.$axios({
method: 'get',
url:`/api/platform/query/10000/0`
@@ -202,17 +203,28 @@ export default {
}).catch(function (error) {
console.log(error);
});
this.$axios({
method: 'get',
url:`/api/proxy/ffmpeg_cmd/list`
}).then(function (res) {
that.ffmpegCmdList = res.data.data;
}).catch(function (error) {
console.log(error);
});
this.mediaServer.getMediaServerList((data)=>{
this.mediaServerList = data;
})
},
mediaServerIdChange:function (){
let that = this;
if (that.proxyParam.mediaServerId !== "auto"){
that.$axios({
method: 'get',
url:`/api/proxy/ffmpeg_cmd/list`,
params: {
mediaServerId: that.proxyParam.mediaServerId
}
}).then(function (res) {
that.ffmpegCmdList = res.data.data;
}).catch(function (error) {
console.log(error);
});
}
},
onSubmit: function () {
console.log("onSubmit");
this.dialogLoading = true;
var that = this;
that.$axios({
@@ -239,7 +251,6 @@ export default {
});
},
close: function () {
console.log("关闭添加视频平台");
this.showDialog = false;
this.dialogLoading = false;
this.$refs.streamProxy.resetFields();

View File

@@ -181,6 +181,7 @@ export default {
showVideoDialog: false,
streamId: '',
app : '',
mediaServerId : '',
convertKey: '',
deviceId: '',
channelId: '',
@@ -218,7 +219,7 @@ export default {
if (tab.name == "codec") {
this.$axios({
method: 'get',
url: '/zlm/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtmp&app='+ this.app +'&stream='+ this.streamId
url: '/zlm/' +this.mediaServerId+ '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtmp&app='+ this.app +'&stream='+ this.streamId
}).then(function (res) {
that.tracksLoading = false;
if (res.data.code == 0 && res.data.online) {
@@ -235,12 +236,11 @@ export default {
}
},
openDialog: function (tab, deviceId, channelId, param) {
console.log("openDialog")
console.log(param)
this.tabActiveName = tab;
this.channelId = channelId;
this.deviceId = deviceId;
this.streamId = "";
this.mediaServerId = "";
this.app = "";
this.videoUrl = ""
if (!!this.$refs.videoPlayer) {
@@ -257,8 +257,8 @@ export default {
break;
case "streamPlay":
this.tabActiveName = "media";
this.showRrecord = false,
this.showPtz = false,
this.showRrecord = false;
this.showPtz = false;
this.play(param.streamInfo, param.hasAudio)
break;
case "control":
@@ -269,19 +269,17 @@ export default {
console.log(val)
},
play: function (streamInfo, hasAudio) {
this.hasAudio = hasAudio;
this.isLoging = false;
// this.videoUrl = streamInfo.rtc;
this.videoUrl = this.getUrlByStreamInfo(streamInfo);
this.streamId = streamInfo.streamId;
this.app = streamInfo.app;
this.mediaServerId = streamInfo.mediaServerId;
this.playFromStreamInfo(false, streamInfo)
},
getUrlByStreamInfo(streamInfo){
let baseZlmApi = process.env.NODE_ENV === 'development'?`${location.host}/debug/zlm`:`${location.host}/zlm`
console.log(12121212)
console.log(baseZlmApi)
// return `${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
// return `http://${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
return streamInfo.ws_flv;
@@ -430,6 +428,7 @@ export default {
var streamInfo = res.data;
that.app = streamInfo.app;
that.streamId = streamInfo.streamId;
that.mediaServerId = streamInfo.mediaServerId;
that.videoUrl = that.getUrlByStreamInfo(streamInfo);
that.recordPlay = true;
});