zhgdyunapp/pages/videoManage/playVideo.vue

349 lines
7.8 KiB
Vue
Raw Normal View History

2022-06-08 15:48:09 +08:00
<template>
<view class="fullHeight">
<headers :showBack="true">
<view class="headerName">
视频播放
</view>
</headers>
2024-04-30 11:38:32 +08:00
<!-- <video class="videoBox" id="myVideo" :custom-cache="false" :src="url" controls autoplay></video> -->
2024-04-30 13:09:26 +08:00
<!-- 外网IP地址访问视频监控 -->
2024-05-16 18:20:59 +08:00
<video class="videoBox" id="myVideo" :custom-cache="false" :src="playUrlFilter" controls autoplay></video>
2022-06-08 15:48:09 +08:00
<view class="videoName">
{{videoInfo.videoName}}
<button v-if="videoInfo.videoType==3" type="primary" class="changeBtn btn" @click="changeStreamFn">{{streamType==1?'切换到主码流':'切换到子码流'}}</button>
</view>
<view class="videoOperateBox">
<view class="box">
2024-05-16 09:29:51 +08:00
<image src="../../static/videoControlIcon/bg.png" class="bg"></image>
2022-06-08 15:48:09 +08:00
<view class="pic top" @click="controlVideoFn(0,0.2,0,'UP')"></view>
<view class="pic left" @click="controlVideoFn(-0.2,0,0,'LEFT')"></view>
<view class="pic bottom" @click="controlVideoFn(0,-0.2,0,'DOWN')"></view>
<view class="pic right" @click="controlVideoFn(0.2,0,0,'RIGHT')"></view>
<!-- <view class="pic center" @click="stop()"></view> -->
</view>
<view class="box2">
<view class="zoom zoomin" @click="controlVideoFn(0,0,0.2,'ZOOM_IN')"></view>
<view class="zoom zoomout" @click="controlVideoFn(0,0,-0.2,'ZOOM_OUT')"></view>
</view>
</view>
2024-05-24 00:47:36 +08:00
<view class="video-playback" @click="toBackList">
2024-05-16 09:29:51 +08:00
视频回放
2024-05-24 00:47:36 +08:00
</view>
2022-06-08 15:48:09 +08:00
</view>
</template>
<script>
import headers from '../../components/headers/headers.vue'
export default {
components:{headers},
data() {
return {
url:'',//rtsp://admin:jxj12345@192.168.0.64:554/h264/ch1/main/av_stream
videoInfo:{videoName:'',videoType:null},
streamType: 1, //1是子码流 2是主码流
2024-05-16 18:20:59 +08:00
videoResponseInfo: {}
2022-06-08 15:48:09 +08:00
};
},
onLoad(options) {
//videoType 1萤石云2乐橙3ISC4大华5宇视6国标
// this.url = options.url
this.videoInfo=uni.getStorageSync('videoInfo')
if(this.videoInfo.videoType==2){
this.url= this.videoInfo.liveRadioUrl
}else{
this.getPlayUrl()
}
},
2024-05-16 18:20:59 +08:00
computed: {
playUrlFilter(){
2024-05-22 01:32:19 +08:00
return this.url?'rtsp://42.180.188.17'+this.url.substring(20):""
2024-05-16 18:20:59 +08:00
}
},
2022-06-08 15:48:09 +08:00
methods:{
2024-05-16 10:39:22 +08:00
// 跳转到录像回放列表
toBackList(){
uni.navigateTo({
2024-05-18 18:04:01 +08:00
url: './playBackList?obj=' + JSON.stringify({...this.videoResponseInfo,...this.videoInfo})
2024-05-16 10:39:22 +08:00
})
},
2022-06-08 15:48:09 +08:00
changeStreamFn(){
if(this.streamType==1){
this.streamType=2
}else{
this.streamType=1
}
this.getPlayUrl()
},
getPlayUrl(){
var that = this
var json ={itemId:this.videoInfo.itemId}
if(this.videoInfo.videoType==3){
json.streamType=this.streamType
json.type='rtsp' //rtsp或者hls
}
this.sendRequest({
url: "xmgl/videoItem/getVideoItemInfo",
data: json,
method: "post",
success(res){
switch (that.videoInfo.videoType){
case 1:
that.url=res.result.videoInfo.hdFlvAddress
break;
default:
that.url=res.result.videoInfo.url
break;
}
2024-05-16 18:20:59 +08:00
that.videoResponseInfo = {...res.result.projectVideoConfig,...res.result.videoInfo};
for(let i in that.videoResponseInfo){
if(!that.videoResponseInfo[i]){
delete that.videoResponseInfo[i]
}
}
2022-06-08 15:48:09 +08:00
}
})
},
controlVideoFn(pan, tilt, zoom,opType){
if(this.videoInfo.deviceType!=2){
uni.showToast({
title:'该设备不是球机,不支持此操作',
icon:'none'
})
return false
}
switch (this.videoInfo.videoType){
case 3:
this.controlVideoFn_isc(opType)
break;
case 4:
this.controlVideoFn_dh(pan, tilt, zoom)
break;
default:
uni.showToast({
title:'暂不支持',
icon:'none'
})
break;
}
},
controlVideoFn_isc(opType){
let json = {
// cameraId: this.videoInfo.deviceSerial,
itemId:this.videoInfo.itemId,
opType: opType,
2023-10-30 14:07:43 +08:00
opSize: 20,
2022-06-08 15:48:09 +08:00
opCode: 1
};
var that = this
this.sendRequest({
url: "xmgl/videoItem/getHikPtzControl",
data: json,
method: "post",
success(res){
uni.showToast({
title:'控制成功',
icon:'none'
})
}
})
},
controlVideoFn_dh(pan, tilt, zoom){
var code = '';
var jsonStr = {
pan: pan,
tilt: tilt,
zoom: zoom,
duration: 100
};
let json = {
ip: this.videoInfo.ip,
port: this.videoInfo.port,
username: this.videoInfo.username,
password: this.videoInfo.password,
chnnelcode: this.videoInfo.chnnelcode,
jsonStr: JSON.stringify(jsonStr),
data: new Date()
};
var that = this
this.sendRequest({
url: "xmgl/video/putPTZ",
data: json,
method: "get",
success(res){
uni.showToast({
title:'控制成功',
icon:'none'
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
2024-05-16 16:54:56 +08:00
/* #ifdef H5 */
2024-05-16 09:29:51 +08:00
.fullHeight{
background-color: #F4F5FD;
2024-05-16 16:54:56 +08:00
height: 100vh;
2024-05-16 09:29:51 +08:00
}
2024-05-16 16:54:56 +08:00
/* #endif */
/* #ifdef MP-WEIXIN */
.fullHeight{
background-color: #F4F5FD;
height: 100vh;
}
/* #endif */
/* #ifdef APP-PLUS */
.fullHeight{
background-color: #F4F5FD;
height: auto;
2024-05-24 00:47:36 +08:00
padding-bottom: 60rpx;
2024-05-16 16:54:56 +08:00
}
/* #endif */
2022-06-08 15:48:09 +08:00
.videoBox{
width: 100%;
}
.videoName{
font-size: 16px;
color: $uni-text-color;
font-weight: bold;
margin: 10px 15px;
position: relative;
.changeBtn{
position: absolute;
right: 0;
top: 0;
font-size: 12px;
}
}
2024-05-16 09:29:51 +08:00
.video-playback{
width: 454rpx;
height: 108rpx;
background: #FFFFFF;
border-radius: 31rpx;
text-align: center;
line-height: 108rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 40rpx;
color: #8D8D8D;
2024-05-16 16:54:56 +08:00
margin: 0 auto;
margin-top: 80rpx;
// position: fixed;
// bottom: 80rpx;
// left: 145rpx;
2024-05-16 09:29:51 +08:00
}
2022-06-08 15:48:09 +08:00
.videoOperateBox {
text-align: center;
padding-top: 10px;
.bg{
width: 220px;
height: 220px;
}
}
.videoOperateBox .box {
position: relative;
display: inline-block;
margin: auto;
height: 220px;
}
.videoOperateBox .pic {
position: absolute;
cursor: pointer;
}
.videoOperateBox .zoom {
width: 106px;
height: 69px;
display: inline-block;
cursor: pointer;
}
.videoOperateBox .zoomin:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/4.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .zoomout:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/2.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .zoomin {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/3.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .zoomout {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/1.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .left {
width: 28px;
height: 33px;
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/left.png");
2022-06-08 15:48:09 +08:00
left: 25px;
top: 50%;
margin-top: -16px;
}
.videoOperateBox .left:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/left-active.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .right:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/right-active.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .top:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/top-active.png");
2022-06-08 15:48:09 +08:00
}
.videoOperateBox .bottom:hover {
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/bottom-active.png");
2022-06-08 15:48:09 +08:00
}
// .videoOperateBox .center:hover {
2024-05-16 09:29:51 +08:00
// background: url("../../static/videoControlIcon/center-active.png");
2022-06-08 15:48:09 +08:00
// }
.videoOperateBox .right {
width: 28px;
height: 33px;
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/right.png");
2022-06-08 15:48:09 +08:00
right: 25px;
top: 50%;
margin-top: -16px;
}
.videoOperateBox .top {
width: 33px;
height: 28px;
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/top.png");
2022-06-08 15:48:09 +08:00
top: 25px;
left: 50%;
margin-left: -16px;
}
.videoOperateBox .bottom {
width: 33px;
height: 28px;
2024-05-16 09:29:51 +08:00
background: url("../../static/videoControlIcon/bottom.png");
2022-06-08 15:48:09 +08:00
bottom: 25px;
left: 50%;
margin-left: -16px;
}
// .videoOperateBox .center {
// width: 44px;
// height: 40px;
2024-05-16 09:29:51 +08:00
// background: url("../../static/videoControlIcon/center.png");
2022-06-08 15:48:09 +08:00
// left: 50%;
// top: 50%;
// margin-top: -20px;
// margin-left: -22px;
// }
</style>