
@@ -71,13 +72,30 @@ export default {
modelData: function(newVal){
// console.log(newVal)
if(newVal.id){
- this.mdata=newVal
this.id = newVal.id
+ console.log(newVal)
// console.log('触发了watch,重新赋值')
this.$nextTick(()=>{ //this.$nextTick解决不能在表单渲染之前赋值的报错问题
- this.form.setFieldsValue({ //setFieldsValue 表示对form表单重新设置值
- ip:newVal.ip,
- rtsp:newVal.rtsp
+ console.log(newVal.rtsp)
+ this.$api.httpApi.getChannel({
+ data:{
+ "sourceUrl":newVal.rtsp,
+ "paramBefore": "-y -i",
+ "paramBehind": "-f mpegts -codec:v mpeg1video -an -s 1707*960 -b:v 1000k -r 20 -bf 0 -codec:a mp2 -ar 44100 -ac 1 -b:a 128k"
+ }
+ }).then(res => {
+ console.log(res.data)
+ var url = 'ws://192.168.66.56:9007/api/lychee/stream/live/'+res.data.channel
+ var player = new JSMpeg.Player(url, {
+ canvas: document.querySelector('.video-canvas'),
+ audio: false,
+ pauseWhenHidden: false,
+ videoBufferSize: 8 * 1024 * 1024,
+ loop:false,
+ })
+ player.play()
+ }).catch(err => {
+
})
})
}
@@ -101,41 +119,46 @@ export default {
console.log('mounted执行了')
},
methods: {
- handleOk() {
- this.confirmLoading = true;
- setTimeout(() => {
- this.form.validateFields((err, values) => {
- console.log(values)
- if (!err) {
- console.log(this.title)
- if(this.title=='新增球机'){
- this.$api.httpApi.addCamera({
- data:values
- }).then(res => {
- if(res.code==200){
- this.$emit('sure',false)
- this.$message.success('新增球机成功');
- }
- }).catch(err => {
+ leftStart(){
+ // console.log(this.id)
+ console.log('左转鼠标按下')
+ this.$axios.post('/camera/control/left/'+this.id, {
+ data: {}
+ }).then(res => {
- });
- }else if(this.title=='编辑球机'){
- values.id = this.id
- this.$api.httpApi.editCamera({
- data:values
- }).then(res => {
- if(res.code==200){
- this.$emit('sure',false)
- this.$message.success('编辑球机成功');
- }
- }).catch(err => {
+ }).catch(err => {
- });
- }
- }
- });
- this.confirmLoading = false;
- }, 500);
+ })
+ },
+ leftStop(){
+ console.log('左转鼠标抬起')
+ this.$axios.post('/camera/control/left/stop/'+this.id, {
+ data: {}
+ }).then(res => {
+
+ }).catch(err => {
+
+ })
+ },
+ rightStart(){
+ console.log('右转鼠标按下')
+ this.$axios.post('/camera/control/right/'+this.id, {
+ data: {}
+ }).then(res => {
+
+ }).catch(err => {
+
+ })
+ },
+ rightStop(){
+ console.log('左转鼠标抬起')
+ this.$axios.post('/camera/control/right/stop/'+this.id, {
+ data: {}
+ }).then(res => {
+
+ }).catch(err => {
+
+ })
},
handleCancel() {
console.log('Clicked cancel button');
@@ -158,6 +181,10 @@ export default {
right: 0;
background-color: #001529;
z-index: 9999;
+ .video-canvas{
+ width: 100vw;
+ height: 100vh;
+ }
.video-close{
position: absolute;
right: 20px;