|
@ -1,16 +1,18 @@ |
|
|
<template> |
|
|
<template> |
|
|
<el-dialog :close-on-click-modal="false" :visible="openVideoVisible" :before-close="handleClose" :title="videoTitle"> |
|
|
|
|
|
|
|
|
<el-dialog :close-on-click-modal="false" :visible="openVideoVisible" :before-close="handleClose" :title="videoTitle" @opened="opened"> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-right-top" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<span class="dialog-left-bottom" /> |
|
|
<div class="setting-dialog"> |
|
|
<div class="setting-dialog"> |
|
|
<!-- :src="videoSrc" controls--> |
|
|
<!-- :src="videoSrc" controls--> |
|
|
<canvas id="canvas" width="100%" /> |
|
|
|
|
|
|
|
|
<div ref="canvas-wrap" /> |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import JSMpeg from '@/components/jsmpeg' |
|
|
import JSMpeg from '@/components/jsmpeg' |
|
|
|
|
|
import axios from 'axios' |
|
|
|
|
|
import qs from 'qs' |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
@ -20,30 +22,60 @@ export default { |
|
|
player: null |
|
|
player: null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
computed: { |
|
|
|
|
|
rtspUrl: function() { |
|
|
|
|
|
return 'rtsp://' + this.camConfig.deviceInfo.deviceAccount + ':' + this.camConfig.deviceInfo.devicePassword + '@' + this.camConfig.deviceInfo.deviceIp + ':' + this.camConfig.deviceInfo.devicePort + '/' + this.camConfig.deviceInfo.videoRoute + '/1' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
handleClose(done) { |
|
|
handleClose(done) { |
|
|
this.openVideoVisible = false |
|
|
this.openVideoVisible = false |
|
|
// this.myVideo = document.getElementById('canvas') |
|
|
// this.myVideo = document.getElementById('canvas') |
|
|
// this.myVideo.pause() |
|
|
// this.myVideo.pause() |
|
|
// $.post('http://127.0.0.1:3000/cameras/close/', { rtspUrl: $('#rtsp').val() }, function(result) { |
|
|
// $.post('http://127.0.0.1:3000/cameras/close/', { rtspUrl: $('#rtsp').val() }, function(result) { |
|
|
this.player.destroy() |
|
|
|
|
|
// }) |
|
|
|
|
|
done() |
|
|
|
|
|
|
|
|
const data = { rtspUrl: this.rtspUrl } |
|
|
|
|
|
axios.post('http://127.0.0.1:3000/cameras/close/', qs.stringify(data), |
|
|
|
|
|
{ |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
).then(res => { |
|
|
|
|
|
this.player?.stop() |
|
|
|
|
|
this.player?.destroy() |
|
|
|
|
|
this.player = null |
|
|
|
|
|
// }) |
|
|
|
|
|
done() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
opened() { |
|
|
|
|
|
// this.play() |
|
|
}, |
|
|
}, |
|
|
play() { |
|
|
play() { |
|
|
// const rtspUrl = 'rtsp://' + this.camConfig.deviceInfo.deviceAccount + ':' + this.camConfig.deviceInfo.devicePassword + '@' + this.camConfig.deviceInfo.deviceIp + ':' + this.camConfig.deviceInfo.devicePort + '/' + this.camConfig.deviceInfo.videoRoute + '/1' |
|
|
|
|
|
// const data = { rtspUrl: rtspUrl, size: '1024*768' } |
|
|
|
|
|
const url = 'ws://127.0.0.1:3151' |
|
|
|
|
|
var canvas = document.getElementById('canvas') |
|
|
|
|
|
const opt = { |
|
|
|
|
|
canvas: canvas, |
|
|
|
|
|
poster: '0.jpg' |
|
|
|
|
|
} |
|
|
|
|
|
this.player = new JSMpeg.Player(url, opt) |
|
|
|
|
|
|
|
|
const data = { rtspUrl: this.rtspUrl, size: '1024*768' } |
|
|
|
|
|
axios.post('http://127.0.0.1:3000/cameras/', qs.stringify(data), |
|
|
|
|
|
{ |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
).then(res => { |
|
|
|
|
|
// res.data.port |
|
|
|
|
|
const url = 'ws://127.0.0.1:' + res.data.port |
|
|
|
|
|
// var canvas = document.getElementById('canvas') |
|
|
|
|
|
const opt = { |
|
|
|
|
|
contianer: this.$refs['canvas-wrap'], |
|
|
|
|
|
poster: '0.jpg' |
|
|
|
|
|
} |
|
|
|
|
|
this.player = new JSMpeg.Player(url, opt) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped> |
|
|
<style rel="stylesheet/scss" lang="scss" scoped> |
|
|
|
|
|
::v-deep .el-dialog { |
|
|
|
|
|
width: auto; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |