关于视频监控介入的部分内容,使用的是海康H5web播放的模式

devtools/2024/9/29 7:50:09/

这是原发直接能在系统中使用。里面的样式自己修改,主要是在引入时出现黑色的框就是引入成功,需要在public文件夹中引入h5player.min.js文件就可以。

<template><div class="Shiping"><el-container><el-header><div class="cont"><div class="container"><div class="item1">水库</div><div class="item2">视频管理系统</div></div><div class="container1"><div class="ite" @click="zhuxiao">关闭</div></div></div></el-header><el-container><el-aside><el-row class="tac"><el-col :span="12"><el-menu default-active="2" @open="handleOpen" @close="handleClose" style="padding-bottom:20px"><el-submenu v-for="(item, index) in menuData" :index="String(index)" :key="item.lbname"><template slot="title"><i class="el-icon-location"></i><span>{{ item.lbname }}</span></template><el-menu-item v-for="(subItem, subIndex) in item.list" :index="String(subIndex)" :key="subItem.lbname"  @click="selectSXT1(subItem)">{{ subItem.jknm }}</el-menu-item></el-submenu></el-menu></el-col></el-row></el-aside><el-main><div class="container"><div class="top"><div id="player1"></div></div></div></el-main></el-container></el-container></div>
</template><script>
import "../../../../public/js/h5player.min.js"
import { getCameraPreview, getCameraList, futureRain,getVideoURL, getBySbSpjk,getControl,getPreset,setPreset,delPreset} from "@/api/business/srceenShow";
export default {data(){return{//videoDialog标题currentCameraInfogetHHHvideoTitle: "",//播放个数splitNum: 9,//普通模式和高级模式mode: 1,//播放对象player1: null,//图片数据存放imageData: null,//播放地址urls: {realplay: "ws://60.212.191.94:559/openUrl/gV8OTMQ",},//当前摄像头currentCameraInfo: {},//是否设置预置点位标识isSetPreset: false,//预置点位presetList: [//   {//   "presetPointName":"无",//   "presetPointIndex":0// }],volume: 30,//云台控制请求参数queryControlParam: {cameraCodeIndex: null,//默认为1  停止   0为开始action: 1,//命令command: null,//移动速度 1-100  默认为50speed: 10,// 预置点下标presetIndex: null,//预置点名称presetName: null,},//视频监控列表子项cameraList:[],dataList: [],  // 从后端获取的数据menuData: []   // 转换后的菜单数据}},created() {getCameraList().then((response) => {// 处理获取到的数据this.dataList = response.data;// 将获取到的数据转换为菜单数据结构this.transformToMenuData(this.dataList);});},mounted() {this.getList();this.createPlayer()this.arrangeWindow()// this.getHHH("9f83a4c1b0cc4542bfccdfba8adf4e5d");// setTimeout(() => {//     this.realplay()//     this.arrangeWindow()// }, 2000); // 100毫秒的延迟  改为2秒。。。},methods:{//点击列表中数据触发 获取摄像头播放地址getHHH(cameraCode) {let query = { cameraIndexCode:cameraCode };this.queryControlParam.cameraCodeIndex = cameraCodegetVideoURL(query).then(resp=>{this.urls.realplay = resp.data.urlthis.getPreset()})},//内层的点击播放视频事件selectSXT1(subItem) {      const jkcode = subItem.jkcode;this.getHHH(jkcode);setTimeout(() => {this.realplay()// this.arrangeWindow()}, 2000); // 100毫秒的延迟  改为2秒。。。this.player1.JS_SelectWnd().then(() => {console.info('JS_SelectWnd success');// do you want...},(err) => {console.info('JS_SelectWnd failed');// do you want...});},transformToMenuData(dataList) {this.menuData = dataList.map(item => {return {lbname: item.lbname,list: item.list,total: item.total};});},getList() {getCameraList().then((response) => {this.dataList = response.data;// console.log(this.dataList,"----------------------------00000000000000")// this.cameraList = this.dataList.filter(x=>x.lbname == "溢洪闸")[0].list});},zhuxiao(){this.$router.push({ path: '/index' })this.stopAllPlay()},handleOpen(key, keyPath) {// console.log(key, keyPath);},handleClose(key, keyPath) {// console.log(key, keyPath);},//-----------------------------//返回预置点位backPreset(){this.queryControlParam.presetIndex = 1this.control("GOTO_PRESET")},//查看预置点位getPreset(){getPreset(this.queryControlParam).then(resp=>{this.presetList=resp.data.list// console.log(this.presetList,resp,"预置点位")})},//设置预置点位setPreset(){//查询出最大的下标编码+1并赋值let maxIndex = this.presetList.map(i=>{return i.presetPointIndex}).reduce((a, b)=>a>b?a:b ) || 1;this.queryControlParam.presetIndex = Number(maxIndex)+1setPreset(this.queryControlParam).then(resp=>{// console.log(resp,"设置预置点位")if(resp.code=='0'){this.isSetPreset = falsethis.$message.success("设置预置点位成功")this.getPreset()}})},//删除预置点位delPreset(){// console.log(this.queryControlParam,"请求参数")delPreset(this.queryControlParam).then(resp=>{// console.log(resp,"删除预置点位")if(resp.code=='0'){this.$message.success("删除预置点位成功")this.getPreset()}})},//云台控制 开始 操作control(command) {if (this.player1.isOk) {this.$message.info("监控未打开,无法操作")return}this.queryControlParam.cameraCodeIndex = this.currentCameraInfo.jkcodethis.queryControlParam.action = 0this.queryControlParam.command = commandthis.getControl()setTimeout(() => {this.controlStop()}, 3000)},//云台控制 暂停controlStop() {if (this.player1.isOk) {this.$message.info("监控未打开,无法操作")return}// setTimeout(() => {this.queryControlParam.cameraCodeIndex = this.currentCameraInfo.jkcodethis.queryControlParam.action = 1this.getControl()// }, 3000); // 100毫秒的延迟  改为3秒。。。},//云台控制接口getControl() {if (this.queryControlParam.cameraCodeIndex == null) {this.$message.info("未获取摄像头信息,请重试")}getControl(this.queryControlParam).then(resp => {// console.log(resp)})},//控制分屏个数arrangeWindow() {let splitNum = this.splitNumthis.player1.JS_ArrangeWindow(splitNum).then(() => {//  console.log(`arrangeWindow to ${splitNum}x${splitNum} success`)},e => {console.error(e)})},//放大全屏wholeFullScreen() {this.player1.JS_FullScreenDisplay(true).then(() => {// console.log(`wholeFullScreen success`)},e => {console.error(e)})},//声音控制openSound() {this.muted = falsethis.player1.JS_OpenSound().then(() => {// console.log('openSound success')this.muted = false},e => {console.error(e)})},closeSound() {this.muted = truethis.player1.JS_CloseSound().then(() => {// console.log('closeSound success')this.muted = true},e => {console.error(e)})},setVolume(value) {let player1 = this.player1,index = player1.currentWindowIndexthis.player1.JS_SetVolume(index, value).then(() => {// console.log('setVolume success', value)},e => {console.error(e)})},init() {let iWidth = 1144let iHeight = 698this.player1.JS_Resize(iWidth, iHeight)},/*** 初始化播放器*/createPlayer() {this.player1 = new window.JSPlugin({szId: "player1",szBasePath: "/js/",iMaxSplit: 3,iCurrentSplit: 1,openDebug: true,oStyle: {borderSelect: "#FFCC00",},})// this.init()//视频是否播放标识  0 播放  1 停止this.player1.isOk = 1// 事件回调绑定this.player1.JS_SetWindowControlCallback({windowEventSelect: function (iWndIndex) {//插件选中窗口回调// console.log('windowSelect callback: ', iWndIndex);// that.$emit('getWndPk',iWndIndex) },pluginErrorHandler: function (iWndIndex, iErrorCode, oError) {//插件错误回调// console.log('pluginError callback: ', iWndIndex, iErrorCode, oError);// that.showErrror(iErrorCode,iWndIndex) },windowEventOver: function (iWndIndex) {//鼠标移过回调//console.log(iWndIndex);},windowEventOut: function (iWndIndex) {//鼠标移出回调//console.log(iWndIndex);},windowEventUp: function (iWndIndex) {//鼠标mouseup事件回调//console.log(iWndIndex);},windowFullCcreenChange: function (bFull) {//全屏切换回调// console.log('fullScreen callback: ', bFull);},firstFrameDisplay: function (iWndIndex, iWidth, iHeight) {//首帧显示回调// console.log('firstFrame loaded callback: ', iWndIndex, iWidth, iHeight);},performanceLack: function () {//性能不足回调// console.log('performanceLack callback: ');},})// console.log(this.player1,"打印player")},cancelCapture() {// this.openPlay = false;// this.player1 = nullthis.imageData = null},// 关闭所有视频stopAllPlay () {this.player1.JS_StopRealPlayAll().then(() => {this.playback.rate = 0// console.log('stopAllPlay success')this.closeVideoTree()},e => { console.error(e) })},/* 预览&对讲 */realplay() {// this.init()let { player1, mode, urls } = this,index = player1.currentWindowIndex,playURL = urls.realplay// console.log(playURL,'playURL')this.player1.JS_Play(playURL, { playURL, mode }, index).then(() => {//视频已播放this.player1.isOk = 0// console.log('realplay success')index = index + 1;if (index == this.maxSplit) { index = 0 }player1.JS_SelectWnd(index);},e => {console.error(e)})},stopPlay() {this.player1.JS_Stop().then(() => {this.player1.isOk = 1// console.log('stop realplay success')},e => {console.error(e)})this.queryControlParam = {cameraCodeIndex: null,//默认为1  停止   0为开始action: 1,//命令command: null,//移动速度 1-100  默认为50speed: 50,// 预置点下标presetIndex: null,}},}
}
</script><style lang="scss" scoped>
.Shiping{width: 70vw;// height: 80vh;background-image: url("~@/assets/images/jianjie.png");background-size: 100% 100%;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -46%);.el-header, .el-footer {// color: #ca2d2d;background: linear-gradient(-90deg, #14234B, #0C3C78);// line-height: 40px;.cont{display: flex;justify-content: space-between;.container {display: grid;grid-template-columns: auto auto; /* 指定两列 */padding: 10px;.item1 {padding: 4px;color: #fbf8f8;font-size: 26px;}.item2 {color: #f8f5f5;font-size: 16px;padding: 10px;}}.container1 {display: grid;grid-template-rows: auto;padding: 20px;.ite {color: #fbf8f8;font-size: 18px;cursor: pointer;}}}}.el-aside {background: #264f80;line-height: 190px;width: 300px;// color: #cf2626;span{font-size: 18px;color: #faf6f6;}.el-menu {width: 350px;height: 200px;background: #264f80;border-right: 0px ;::v-deep .el-submenu__title:hover {background-color: #264f80;color: #faf6f6;}::v-deep .el-menu-item-group__title {padding: 0px 0px 0px 10px;line-height: normal;font-size: 18px;color: #909399;}.el-submenu .el-menu-item {background: #264f80;color: #faf6f6;height: 40px;}}&::-webkit-scrollbar {width: 5px;height: 2px;}&::-webkit-scrollbar-track {background: #1b5689;border-radius: 10px;}&::-webkit-scrollbar-thumb {background: #70c0ff;border-radius: 10px;}}.el-main {background: #26426D;text-align: center;// line-height: 820px;// height: 860px;// padding: 10px 10px;.container {display: flex;flex-direction: column;height: 840px; /* 设置高度,方便查看效果 */.top{width: 100%;height: 100%;#player1{width: 80%;height: 100%;}}}.container > div {display: flex;justify-content: space-around;align-items: center;flex: 1;}.container > div > div {width: 480px;height: 480px;// background-color: rgb(13, 13, 13);margin: 10px;}&::-webkit-scrollbar {width: 5px;}&::-webkit-scrollbar-track {background: #1b5689;border-radius: 10px;}&::-webkit-scrollbar-thumb {background: #70c0ff;border-radius: 10px;}}
}
</style>

原文件包:海康开放平台

这是需要导入的包在bin目录下


http://www.ppmy.cn/devtools/118591.html

相关文章

ECMAScript与JavaScript的区别:深入解析

在现代网页开发中&#xff0c;JavaScript 和 ECMAScript 是两个频繁提及的术语。尽管许多人将这两个概念视为同义词&#xff0c;但它们实际上有着重要的区别。本文将深入探讨这两者的定义、关系及其在编程中的应用。 1. 定义与背景 JavaScript JavaScript 是一种高层次的、解…

Java_集合_双列集合_Map

第一章Map集合 Map是双列集合顶级接口 什么叫做双列集合:一个元素有两部分构成:key和value -> 键值对 1.1.HashMap 常用方法: V put(K key, V value) -> 添加元素,返回的是被替换的value值 V remove(Object key) ->根据key删除键值对,返回的是被删除的value…

从0开始实现es6 promise类

主要由基础实现和静态类的实现两部分组成。 1 基础实现&#xff08;不含静态类&#xff09; 1.1 使用类实现完成构造函数 实现代码如下&#xff0c;构造函数传入一个回调函数&#xff0c;定义resolve和reject函数&#xff0c;将两个函数作为参数执行回调函数。 // 1. 使用类实…

Docker数据卷有哪些常见的驱动类型?

Docker数据卷有多种驱动类型&#xff0c;以满足不同的使用场景和需求。以下是一些常见的Docker数据卷驱动类型&#xff1a; 1. Local&#xff08;本地&#xff09;驱动 这是默认的数据卷驱动&#xff0c;它将数据卷存储在Docker主机的文件系统上。这种驱动适用于大多数场景。…

Apache Iceberg 概述

Apache Iceberg概述 一、what is Apache Iceberg&#xff1f; 为了解决数据存储和计算引擎之间的适配的问题&#xff0c;Netflix开发了Iceberg&#xff0c;2018年11月16日进入Apache孵化器&#xff0c;2020 年5月19日从孵化器毕业&#xff0c;成为Apache的顶级项目。 Apache…

安全教育培训小程序系统开发制作方案

安全教育培训小程序系统是为了提高公众的安全意识&#xff0c;普及安全知识&#xff0c;通过微信小程序的方式提供安全教育培训服务&#xff0c;帮助用户了解并掌握必要的安全防范措施。 一、目标用户 企业员工&#xff1a;各岗位员工&#xff0c;特别是IT部门、财务、行政等对…

Augular 学习步骤建议

Angular 是一个由 Google 维护的开源 Web 应用框架&#xff0c;用于开发单页面客户端应用程序。以下是学习 Angular 的建议步骤&#xff1a; 1. 了解基础&#xff1a; 熟悉 HTML、CSS 和 JavaScript 的基础知识。 了解 TypeScript&#xff0c;因为 Angular 应用程序主要使用…

pytorch千问模型源码分析

# 规范化技术&#xff0c;旨在替代传统的 Layer Normalization&#xff08;LN&#xff09; # 核心思想是对输入张量的每个样本的每个特征进行规范化&#xff0c;使其均值为 0&#xff0c;方差为 1 class Qwen2RMSNorm(nn.Module): def __init__(self, hidden_size, eps1e-6…