实时监控jsMPEG实现实时画面

merge-requests/1/head
张鑫 5 years ago
parent 1ece3229cd
commit e20abdc33e

@ -5,7 +5,7 @@ module.exports = {
}, },
extends: [ extends: [
'plugin:vue/essential', 'plugin:vue/essential',
'eslint:recommended', // 'eslint:recommended',
], ],
parserOptions: { parserOptions: {
parser: 'babel-eslint' parser: 'babel-eslint'
@ -14,6 +14,7 @@ module.exports = {
"indent": [2, 4], "indent": [2, 4],
"no-tabs": 'off', "no-tabs": 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"no-unused-vars":'off' //冗余变量报错
} }
} }

@ -31,5 +31,13 @@
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
},
"rules": {
"generator-star-spacing": "off",
"no-tabs":"off",
"no-unused-vars":"off",
"no-console":"off",
"no-irregular-whitespace":"off",
"no-debugger": "off"
} }
} }

@ -1,4 +1,14 @@
export default { export default {
getRealTimeList: {
method: "POST",
url: "/realTime",
name: "获取实时监控列表"
},
realTimeLychee: {
method: "GET",
url: "/realTime/lychee",
name: "获取荔枝的ip"
},
getStreetList: { getStreetList: {
method: "POST", method: "POST",
url: "/street/page", url: "/street/page",

@ -53,7 +53,7 @@ export default {
clickMenu(item) { clickMenu(item) {
this.$router.push({ this.$router.push({
name: item.key name: item.key
}); },onComplete => { }, onAbort => { });
}, },
// //
setRoute() { setRoute() {

@ -62,6 +62,8 @@ export default {
method: "GET" method: "GET"
}).then(res => { }).then(res => {
window.open(res.data.url + "?action=logout", "_self"); window.open(res.data.url + "?action=logout", "_self");
}).catch(err => {
}); });
}, },
collapsedFlag(){ collapsedFlag(){

@ -7,6 +7,7 @@ import './components/index'
import './layouts/index' import './layouts/index'
import utils from './utils/index' import utils from './utils/index'
import api from './plugins/axios/index' import api from './plugins/axios/index'
import JSMpeg from './utils/jsmpeg.min'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$utils = utils Vue.prototype.$utils = utils
Vue.prototype.$api = api Vue.prototype.$api = api

@ -40,6 +40,8 @@ instance.interceptors.response.use((response) => {
method: 'GET' method: 'GET'
}).then(res => { }).then(res => {
window.open(res.data.url + '?redirect=' + location.origin, '_self') window.open(res.data.url + '?redirect=' + location.origin, '_self')
}).catch(err => {
}) })
} }
++window.once ++window.once

File diff suppressed because one or more lines are too long

@ -114,6 +114,8 @@ export default {
pagination.total = res.data.total; pagination.total = res.data.total;
this.data = res.data.list; this.data = res.data.list;
this.pagination = pagination; this.pagination = pagination;
}).catch(err => {
}); });
}, },
showModel(type,data){ showModel(type,data){
@ -144,6 +146,8 @@ export default {
this.$message.success('删除球机成功'); this.$message.success('删除球机成功');
this.handleGetCameraList() this.handleGetCameraList()
} }
}).catch(err => {
}) })
} }
}, },

@ -113,6 +113,8 @@ export default {
this.$emit('sure',false) this.$emit('sure',false)
this.$message.success('新增球机成功'); this.$message.success('新增球机成功');
} }
}).catch(err => {
}); });
}else if(this.title=='编辑球机'){ }else if(this.title=='编辑球机'){
values.id = this.id values.id = this.id
@ -123,6 +125,8 @@ export default {
this.$emit('sure',false) this.$emit('sure',false)
this.$message.success('编辑球机成功'); this.$message.success('编辑球机成功');
} }
}).catch(err => {
}); });
} }
} }

@ -43,6 +43,8 @@ export default {
res.data.url + "?redirect=" + location.origin + "#/center/edit", res.data.url + "?redirect=" + location.origin + "#/center/edit",
"_self" "_self"
); );
}).catch(err => {
}); });
// this.$api.httpApi.userCenter({ // this.$api.httpApi.userCenter({
// data: { // data: {

@ -122,6 +122,8 @@ export default {
// res.data[1].mediaPath = // res.data[1].mediaPath =
// "http://gitlab.zhehekeji.com/security_check/security_front/raw/1.0.0/src/assets/video/video2.mp4"; // "http://gitlab.zhehekeji.com/security_check/security_front/raw/1.0.0/src/assets/video/video2.mp4";
this.dataSource = res.data; this.dataSource = res.data;
}).catch(err => {
}); });
}, },
handlePopup(type, url) { handlePopup(type, url) {

@ -47,6 +47,8 @@ export default {
}) })
.then(res => { .then(res => {
console.log(res); console.log(res);
}).catch(err => {
}); });
}, },
// //
@ -106,6 +108,8 @@ export default {
res.url + "?redirect=" + location.origin, res.url + "?redirect=" + location.origin,
"_self" "_self"
); );
}).catch(err => {
}); });
}); });
return; return;
@ -133,6 +137,8 @@ export default {
res.url + "?redirect=" + location.origin, res.url + "?redirect=" + location.origin,
"_self" "_self"
); );
}).catch(err => {
}); });
}); });
} }

@ -1,15 +1,17 @@
<template> <template>
<div class="realTime bg-white"> <div class="realTime bg-white">
<div class="realTime-position"> <!-- <div class="realTime-position">-->
<div class="realTime-position-label">选择位置</div> <!-- <div class="realTime-position-label">选择位置</div>-->
<div class="realTime-position-box"> <!-- <div class="realTime-position-box">-->
<div class="realTime-position-box-btns"></div> <!-- <div class="realTime-position-box-btns"></div>-->
<div class="realTime-position-box-control" @click="handleUpDown"> <!-- <div class="realTime-position-box-control" @click="handleUpDown">-->
{{controlLabel ? '收起' : '展开'}} <!-- {{controlLabel ? '收起' : '展开'}}-->
<a-icon type="up" :class="{'anticon-rotate': !controlLabel}"></a-icon> <!-- <a-icon type="up" :class="{'anticon-rotate': !controlLabel}"></a-icon>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div>实时画面</div>
<canvas id="video-cav" width="400" height="400"></canvas>
</div> </div>
</template> </template>
@ -19,13 +21,57 @@ export default {
data() { data() {
return { return {
// true false // true false
controlLabel: true controlLabel: true,
realTimeListData:[],
url:'722e6f04-bb3c-34b1-bcc7-ae9f6cd72e68',
path:[]
}; };
}, },
mounted() {
this.getRealTimeList()
// this.realTimeLychee()
this.getVideos()
},
methods: { methods: {
// //
handleUpDown() { handleUpDown() {
this.controlLabel = !this.controlLabel; this.controlLabel = !this.controlLabel;
},
getRealTimeList(){
var that=this
this.$api.httpApi.getRealTimeList({
data: {}
}).then(res => {
console.log(res.data)
if(res.code == 200){
this.realTimeListData = res.data
res.data.map(function(item){
// console.log(item.cameras)
var $that = that
item.cameras.map(function(item){
console.log(item.rtsp)
$that.$axios.post('/lychee/stream/push', {
"sourceUrl":item.rtsp,
"paramBefore": "-i",
"paramBehind": "-f mpegts -codec:v mpeg1video -s 1080*780 -b:v 1500k -r 30 -bf 0 -codec:a mp2 -ar 44100 -ac 1 -b:a 128k"
}).then(res => {
console.log(res.data)
console.log(this.path)
}).catch(err => {
})
})
})
}
console.log(this.path)
}).catch(err => {
});
},
getVideos(){
var canvas = document.getElementById('video-cav')
var url = 'ws://192.168.66.56:9007/api/lychee/stream/live/'+this.url
var player = new JSMpeg.Player(url, {canvas: canvas}) // eslint-disable-line no-unused-vars
} }
} }
}; };
@ -62,5 +108,12 @@ export default {
} }
} }
} }
#video-cav{
position: fixed;
z-index: 999;
border: solid 1px skyblue;
width: 400px;
height: 400px;
}
} }
</style> </style>

@ -128,6 +128,8 @@ export default {
pagination.total = res.data.total; pagination.total = res.data.total;
this.data = res.data.list; this.data = res.data.list;
this.pagination = pagination; this.pagination = pagination;
}).catch(err => {
}); });
}, },
showModel(type,data){ showModel(type,data){
@ -158,6 +160,8 @@ export default {
this.$message.success('删除巷道成功'); this.$message.success('删除巷道成功');
this.handleGetStreetList() this.handleGetStreetList()
} }
}).catch(err => {
}) })
} }
}, },

@ -254,6 +254,8 @@ export default {
this.$emit('sure',false) this.$emit('sure',false)
this.$message.success('新增巷道成功'); this.$message.success('新增巷道成功');
} }
}).catch(err => {
}); });
}else if(this.title=='编辑巷道'){ }else if(this.title=='编辑巷道'){
values.id = this.id values.id = this.id
@ -280,6 +282,8 @@ export default {
this.$emit('sure',false) this.$emit('sure',false)
this.$message.success('编辑巷道成功'); this.$message.success('编辑巷道成功');
} }
}).catch(err => {
}); });
} }
} }
@ -318,6 +322,8 @@ export default {
} }
}).then(res => { }).then(res => {
this.camera1Id = res.data.list; this.camera1Id = res.data.list;
}).catch(err => {
}); });
} }
}, },

@ -10,7 +10,8 @@ module.exports = {
devServer: { devServer: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://47.99.104.87:8633', target: 'http://192.168.66.56:9007',
logLevel:'debug', //控制台终端打印代理前的真实地址
}, },
}, },
port: 8008 port: 8008

Loading…
Cancel
Save