<template>
|
<layout-box2 :full-screen="fullScreenState">
|
<video-box :title="name" :id="id" @close="close">
|
<div class="video-box-tools" slot="videoTools">
|
<div class="lines-btn">
|
<div class="lines-btn-item"></div>
|
<div class="lines-btn-item"></div>
|
<div class="lines-btn-item last-item"></div>
|
<div class="lines-btn-list">
|
<ul>
|
<li><a href="javascript:;">设置</a></li>
|
<li><a href="javascript:;" @click="fullScreen">全屏</a></li>
|
<li><a href="javascript:;" @click="close">关闭</a></li>
|
</ul>
|
</div>
|
</div>
|
</div>
|
<div class="video-container">
|
<canvas ref="video"></canvas>
|
</div>
|
</video-box>
|
</layout-box2>
|
</template>
|
|
<script>
|
import LayoutBox2 from "@/components/LayoutBox2";
|
import VideoBox from "@/components/video-box";
|
import JSMpeg from '@/assets/js/jsmpeg';
|
export default {
|
name: "VideoWrapper",
|
components: {VideoBox, LayoutBox2},
|
props: {
|
name: {
|
type: String,
|
default: "",
|
},
|
flag: {
|
type: [String, Number],
|
default: ""
|
},
|
id: {
|
type: [String, Number],
|
default: ""
|
},
|
ip: {
|
type: String,
|
default: ""
|
}
|
},
|
data() {
|
return {
|
fullScreenState: false,
|
}
|
},
|
methods: {
|
close() {
|
this.$emit('close', this.ip);
|
},
|
fullScreen() {
|
this.fullScreenState = this.fullScreenState?false:true;
|
}
|
},
|
mounted() {
|
let canvas = this.$refs.video;
|
var url = 'ws://127.0.0.1:8093/video1?'+this.ip;
|
new JSMpeg.Player(url, {canvas: canvas});
|
},
|
destroyed: function () {
|
|
},
|
}
|
</script>
|
|
<style scoped>
|
.video-container {
|
position: absolute;
|
top: 0;
|
bottom: 0;
|
left: 0;
|
right: 0;
|
z-index: 1;
|
}
|
.video-box-tools {
|
text-align: right;
|
}
|
|
.lines-btn {
|
position: relative;
|
display: inline-block;
|
width: 20px;
|
z-index: 2;
|
cursor: pointer;
|
}
|
|
.lines-btn-item {
|
height: 2px;
|
background-color: #23dc65;
|
margin-top: 2px;
|
}
|
|
.lines-btn-item.last-item {
|
width: 50%;
|
margin-left: 50%;
|
}
|
|
.lines-btn:hover .lines-btn-list {
|
display: block;
|
}
|
|
.lines-btn-list {
|
display: none;
|
position: absolute;
|
color: #FF0000;
|
width: 200px;
|
margin-left: -110px;
|
top: 100%;
|
z-index: 3;
|
}
|
|
.lines-btn-list li {
|
text-align: center;
|
list-style: none;
|
margin-bottom: 8px;
|
}
|
|
.lines-btn-list li a {
|
display: inline-block;
|
padding: 4px;
|
border: 1px solid #236ae7;
|
text-decoration: none;
|
cursor: pointer;
|
color: #fff;
|
background-color: #061c6675;
|
}
|
|
.lines-btn-list li a:hover {
|
background-color: #236ae7;
|
}
|
</style>
|