添加推流列表和拉流代理,下一步与国标关联

This commit is contained in:
panlinlin
2021-03-30 18:46:34 +08:00
parent f8fe76add2
commit 56859d09df
37 changed files with 1417 additions and 217 deletions

View File

@@ -68,9 +68,9 @@
</template>
<script>
import platformEdit from './platformEdit.vue'
import platformEdit from './dialog/platformEdit.vue'
import uiHeader from './UiHeader.vue'
import chooseChannelDialog from './gb28181/chooseChannel.vue'
import chooseChannelDialog from './dialog/chooseChannel.vue'
export default {
name: 'app',
components: {

View File

@@ -1,5 +1,5 @@
<template>
<div id="app">
<div id="pushVideoList">
<el-container>
<el-header>
<uiHeader></uiHeader>
@@ -7,28 +7,27 @@
<el-main>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
<span style="font-size: 1rem; font-weight: bold;">推流列表</span>
<div style="position: absolute; right: 1rem; top: 0.3rem;">
<el-button icon="el-icon-refresh-right" circle size="mini" :loading="getDeviceListLoading" @click="getDeviceList()"></el-button>
</div>
</div>
<!-- <devicePlayer ref="devicePlayer"></devicePlayer> -->
<el-table :data="deviceList" border style="width: 100%" :height="winHeight">
<el-table-column prop="schema" label="协议" width="180" align="center">
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStreamProxy">添加代理</el-button>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<el-table :data="pushList" border style="width: 100%" :height="winHeight">
<el-table-column prop="app" label="APP" width="180" align="center">
</el-table-column>
<el-table-column prop="streamUrl" label="流地址" width="240" align="center">
<el-table-column prop="stream" label="流ID" width="240" align="center">
</el-table-column>
<el-table-column prop="online" label="在线人数" width="240" align="center">
<el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">
</el-table-column>
<el-table-column prop="startTime" label="开始时间" align="center">
<el-table-column prop="createStamp" label="开始时间" align="center">
</el-table-column>
<el-table-column label="操作" width="360" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh" @click="refDevice(scope.row)">刷新</el-button>
<el-button-group>
<el-button size="mini" icon="el-icon-video-play" @click="sendDevicePush(scope.row)">播放</el-button>
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopDevicePush(scope.row)">停止</el-button>
<el-button size="mini" icon="el-icon-video-play" @click="playPuhsh(scope.row)">播放</el-button>
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopPuhsh(scope.row)">停止</el-button>
</el-button-group>
</template>
</el-table-column>
@@ -43,25 +42,27 @@
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
<streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit>
</el-main>
</el-container>
</div>
</template>
<script>
import streamProxyEdit from './dialog/StreamProxyEdit.vue'
import devicePlayer from './dialog/devicePlayer.vue'
import uiHeader from './UiHeader.vue'
export default {
name: 'app',
name: 'pushVideoList',
components: {
devicePlayer,
streamProxyEdit,
uiHeader
},
data() {
return {
deviceList: [], //设备列表
currentDevice: {}, //当前操作设备对象
videoComponentList: [],
pushList: [], //设备列表
currentPusher: {}, //当前操作设备对象
updateLooper: 0, //数据刷新轮训标志
currentDeviceChannelsLenth:0,
winHeight: window.innerHeight - 200,
@@ -72,23 +73,10 @@
};
},
computed: {
getcurrentDeviceChannels: function() {
let data = this.currentDevice['channelMap'];
let channels = null;
if (data) {
channels = Object.keys(data).map(key => {
return data[key];
});
this.currentDeviceChannelsLenth = channels.length;
}
console.log("数据:" + JSON.stringify(channels));
return channels;
}
},
mounted() {
this.initData();
this.updateLooper = setInterval(this.initData, 10000);
// this.updateLooper = setInterval(this.initData, 10000);
},
destroyed() {
this.$destroy('videojs');
@@ -96,20 +84,20 @@
},
methods: {
initData: function() {
this.getDeviceList();
this.getPushList();
},
currentChange: function(val){
this.currentPage = val;
this.getDeviceList();
this.getPushList();
},
handleSizeChange: function(val){
this.count = val;
this.getDeviceList();
this.getPushList();
},
getDeviceList: function() {
getPushList: function() {
let that = this;
this.getDeviceListLoading = true;
this.$axios.get(`/api/devices`,{
this.$axios.get(`/api/media/list`,{
params: {
page: that.currentPage,
count: that.count
@@ -119,83 +107,44 @@
console.log(res);
console.log(res.data.list);
that.total = res.data.total;
that.deviceList = res.data.list;
that.pushList = res.data.list;
that.getDeviceListLoading = false;
})
.catch(function (error) {
console.log(error);
that.getDeviceListLoading = false;
});
},
showChannelList: function(row) {
console.log(JSON.stringify(row))
this.$router.push(`/channelList/${row.deviceId}/0/15/1`);
addStreamProxy: function(){
console.log(2222)
this.$refs.streamProxyEdit.openDialog(null, this.initData)
},
showDevicePosition: function(row) {
console.log(JSON.stringify(row))
this.$router.push(`/devicePosition/${row.deviceId}/0/15/1`);
saveStreamProxy: function(){
},
//gb28181平台对接
//刷新设备信息
refDevice: function(itemData) {
///api/devices/{deviceId}/sync
console.log("刷新对应设备:" + itemData.deviceId);
var that = this;
that.$refs[itemData.deviceId + 'refbtn' ].loading = true;
this.$axios({
method: 'post',
url: '/api/devices/' + itemData.deviceId + '/sync'
}).then(function(res) {
console.log("刷新设备结果:"+JSON.stringify(res));
if (!res.data.deviceId) {
that.$message({
showClose: true,
message: res.data,
type: 'error'
});
}else{
that.$message({
showClose: true,
message: '请求成功',
type: 'success'
});
playPuhsh: function(row){
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
params: {
app: row.app,
stream: row.stream
}
that.initData()
that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
}).catch(function(e) {
console.error(e)
that.$refs[itemData.deviceId + 'refbtn' ].loading = false;
});;
})
.then(function (res) {
that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data,
hasAudio: true
});
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
},
//通知设备上传媒体流
sendDevicePush: function(itemData) {
// let deviceId = this.currentDevice.deviceId;
// let channelId = itemData.channelId;
// console.log("通知设备推流1" + deviceId + " : " + channelId);
// let that = this;
// this.$axios({
// method: 'get',
// url: '/api/play/' + deviceId + '/' + channelId
// }).then(function(res) {
// let ssrc = res.data.ssrc;
// that.$refs.devicePlayer.play(ssrc,deviceId,channelId);
// }).catch(function(e) {
// });
},
transportChange: function (row) {
console.log(row);
console.log(`修改传输方式为 ${row.streamMode}${row.deviceId} `);
let that = this;
this.$axios({
method: 'get',
url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode
}).then(function(res) {
}).catch(function(e) {
});
}
stopPuhsh: function(row){
console.log(row)
}
}
};

View File

@@ -0,0 +1,297 @@
<template>
<div id="streamProxyList">
<el-container>
<el-header>
<uiHeader></uiHeader>
</el-header>
<el-main>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
<span style="font-size: 1rem; font-weight: bold;">拉流代理列表</span>
</div>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStreamProxy">添加代理</el-button>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<el-table :data="streamProxyList" border style="width: 100%" :height="winHeight">
<el-table-column prop="app" label="应用名" align="center" show-overflow-tooltip/>
<el-table-column prop="stream" label="流ID" align="center" show-overflow-tooltip/>
<el-table-column label="流地址" width="400" align="center" show-overflow-tooltip >
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.type == 'default'">
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="scope.row.url" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
{{scope.row.url}}
</el-tag>
<el-tag size="medium" v-if="scope.row.type != 'default'">
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="scope.row.src_url" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
{{scope.row.src_url}}
</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="转HLS" width="120" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.enable_hls">已启用</el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.enable_hls">未启用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="MP4录制" width="120" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.enable_mp4">未启用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="启用" width="120" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.enable">已启用</el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.enable">未启用</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="360" align="center" fixed="right">
<template slot-scope="scope">
<el-button-group>
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.enable" @click="play(scope.row)">播放</el-button>
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
<el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[15, 25, 35, 50]"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
<streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit>
</el-main>
</el-container>
</div>
</template>
<script>
import streamProxyEdit from './dialog/StreamProxyEdit.vue'
import devicePlayer from './dialog/devicePlayer.vue'
import uiHeader from './UiHeader.vue'
export default {
name: 'streamProxyList',
components: {
devicePlayer,
streamProxyEdit,
uiHeader
},
data() {
return {
streamProxyList: [],
currentPusher: {}, //当前操作设备对象
updateLooper: 0, //数据刷新轮训标志
currentDeviceChannelsLenth:0,
winHeight: window.innerHeight - 200,
currentPage:1,
count:15,
total:0,
getListLoading: false
};
},
computed: {
},
mounted() {
this.initData();
// this.updateLooper = setInterval(this.initData, 10000);
},
destroyed() {
this.$destroy('videojs');
clearTimeout(this.updateLooper);
},
methods: {
initData: function() {
this.getStreamProxyList();
},
currentChange: function(val){
this.currentPage = val;
this.getStreamProxyList();
},
handleSizeChange: function(val){
this.count = val;
this.getStreamProxyList();
},
getStreamProxyList: function() {
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/proxy/list`,{
params: {
page: that.currentPage,
count: that.count
}
} )
.then(function (res) {
console.log(res);
console.log(res.data.list);
that.total = res.data.total;
that.streamProxyList = res.data.list;
that.getListLoading = false;
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
},
addStreamProxy: function(){
this.$refs.streamProxyEdit.openDialog(null, this.initData)
},
saveStreamProxy: function(){
},
play: function(row){
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
params: {
app: row.app,
stream: row.stream
}
})
.then(function (res) {
that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data,
hasAudio: true
});
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
},
deleteStreamProxy: function(row){
console.log(1111)
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/proxy/del`,{
params: {
app: row.app,
stream: row.stream
}
})
.then(function (res) {
that.getListLoading = false;
that.initData()
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
},
start: function(row){
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/proxy/start`,{
params: {
app: row.app,
stream: row.stream
}
})
.then(function (res) {
that.getListLoading = false;
that.initData()
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
},
stop: function(row){
let that = this;
this.getListLoading = true;
this.$axios.get(`/api/proxy/stop`,{
params: {
app: row.app,
stream: row.stream
}
})
.then(function (res) {
that.getListLoading = false;
that.initData()
})
.catch(function (error) {
console.log(error);
that.getListLoading = false;
});
}
}
};
</script>
<style>
.videoList {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
}
.video-item {
position: relative;
width: 15rem;
height: 10rem;
margin-right: 1rem;
background-color: #000000;
}
.video-item-img {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 100%;
height: 100%;
}
.video-item-img:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 3rem;
height: 3rem;
background-image: url("../assets/loading.png");
background-size: cover;
background-color: #000000;
}
.video-item-title {
position: absolute;
bottom: 0;
color: #000000;
background-color: #ffffff;
line-height: 1.5rem;
padding: 0.3rem;
width: 14.4rem;
}
.cpoy-btn {
cursor: pointer;
margin-right: 10px;
}
</style>

View File

@@ -4,6 +4,7 @@
<el-menu-item index="/">控制台</el-menu-item>
<el-menu-item index="/deviceList">设备列表</el-menu-item>
<el-menu-item index="/pushVideoList">推流列表</el-menu-item>
<el-menu-item index="/streamProxyList">拉流代理</el-menu-item>
<el-menu-item index="/parentPlatformList/15/1">国标级联</el-menu-item>
<el-switch v-model="alarmNotify" active-text="报警信息推送" style="display: block float: right" @change="sseControl"></el-switch>
<el-menu-item style="float: right;" @click="loginout">退出</el-menu-item>

View File

@@ -75,7 +75,7 @@
</template>
<script>
import devicePlayer from './gb28181/devicePlayer.vue'
import devicePlayer from './dialog/devicePlayer.vue'
import uiHeader from './UiHeader.vue'
import moment from "moment";
export default {

View File

@@ -0,0 +1,186 @@
<template>
<div id="addStreamProxy" v-loading="isLoging">
<el-dialog
title="添加代理"
width="40%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
<el-form ref="streamProxy" :rules="rules" :model="proxyParam" label-width="140px">
<el-form-item label="类型" prop="type">
<el-select
v-model="proxyParam.type"
style="width: 100%"
placeholder="请选择代理类型"
>
<el-option label="默认" value="default"></el-option>
<el-option label="FFmpeg" value="ffmpeg"></el-option>
</el-select>
</el-form-item>
<el-form-item label="应用名" prop="app">
<el-input v-model="proxyParam.app" clearable></el-input>
</el-form-item>
<el-form-item label="流ID" prop="stream">
<el-input v-model="proxyParam.stream" clearable></el-input>
</el-form-item>
<el-form-item label="拉流地址" prop="url" v-if="proxyParam.type=='default'">
<el-input v-model="proxyParam.url" clearable></el-input>
</el-form-item>
<el-form-item label="拉流地址" prop="src_url" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.src_url" clearable></el-input>
</el-form-item>
<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="FFmpeg命令模板" prop="ffmpeg_cmd_key" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></el-input>
</el-form-item>
<el-form-item label="拉流方式" prop="rtp_type" v-if="proxyParam.type=='default'">
<el-select
v-model="proxyParam.rtp_type"
style="width: 100%"
placeholder="请选择拉流方式"
>
<el-option label="TCP" value="0"></el-option>
<el-option label="UDP" value="1"></el-option>
<el-option label="组播" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="其他选项">
<div style="float: left;">
<el-checkbox label="启用" v-model="proxyParam.enable" ></el-checkbox>
<el-checkbox label="转HLS" v-model="proxyParam.enable_hls" ></el-checkbox>
<el-checkbox label="MP4录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
</div>
</el-form-item>
<el-form-item>
<div style="float: right;">
<el-button type="primary" @click="onSubmit">{{onSubmit_text}}</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "streamProxyEdit",
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: "立即创建",
proxyParam: {
type: "default",
app: null,
stream: null,
url: "rtmp://58.200.131.2:1935/livetv/hunantv",
src_url: null,
timeout_ms: null,
ffmpeg_cmd_key: null,
rtp_type: null,
enable: true,
enable_hls: true,
enable_mp4: false,
},
rules: {
app: [{ required: true, message: "请输入应用名", trigger: "blur" }],
stream: [{ required: true, message: "请输入流ID", trigger: "blur" }],
url: [{ required: true, message: "请输入要代理的流", trigger: "blur" }],
src_url: [{ required: true, message: "请输入要代理的流", trigger: "blur" }],
timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }],
ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板可选", trigger: "blur" }],
},
};
},
methods: {
openDialog: function (proxyParam, callback) {
this.showDialog = true;
this.listChangeCallback = callback;
if (proxyParam != null) {
this.proxyParam = proxyParam;
this.onSubmit_text = "保存";
} else {
this.onSubmit_text = "立即创建";
}
},
onSubmit: function () {
console.log("onSubmit");
var that = this;
that.$axios
.post(`/api/proxy/save`, that.proxyParam)
.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.streamProxy.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;
},
checkExpires: function() {
if (this.platform.enable && this.platform.expires == "0") {
this.platform.expires = "300";
}
}
},
};
</script>

View File

@@ -21,7 +21,7 @@
</template>
<script>
import chooseChannelForGb from './chooseChannelForGb.vue'
import chooseChannelForGb from '../dialog/chooseChannelForGb.vue'
export default {
name: 'chooseChannel',
props: {},

View File

@@ -26,7 +26,7 @@
</div>
</el-tab-pane>
<!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
<el-tab-pane label="录像查询" name="record">
<el-tab-pane label="录像查询" name="record" v-if="showRrecord">
<el-date-picker size="mini" v-model="videoHistory.date" type="date" value-format="yyyy-MM-dd" placeholder="日期" @change="queryRecords()"></el-date-picker>
<el-table :data="videoHistory.searchHistoryResult" height="150" v-loading="recordsLoading">
<el-table-column label="名称" prop="name"></el-table-column>
@@ -42,7 +42,7 @@
</el-table>
</el-tab-pane>
<!--遥控界面-->
<el-tab-pane label="云台控制" name="control">
<el-tab-pane label="云台控制" name="control" v-if="showPtz">
<div style="display: flex; justify-content: left;">
<div class="control-wrapper">
<div class="control-btn control-top" @mousedown="ptzCamera(0, 2, 0)" @mouseup="ptzCamera(0, 0, 0)">
@@ -136,7 +136,7 @@
</template>
<script>
import player from './player.vue'
import player from '../dialog/player.vue'
export default {
name: 'devicePlayer',
props: {},
@@ -184,7 +184,9 @@ export default {
tracks: [],
coverPlaying:false,
tracksLoading: false,
recordPlay: ""
recordPlay: "",
showPtz: true,
showRrecord: true,
};
},
methods: {
@@ -230,6 +232,11 @@ export default {
this.videoHistory.date = param.date;
this.queryRecords()
break;
case "streamPlay":
this.showRrecord = false,
this.showPtz = false,
this.play(param.streamInfo, param.hasAudio)
break;
case "control":
break;
}