海康视频WEB插件

引入相关依赖

 

index.html

<script src="/video/web-control_1.2.5.min.js"></script>
<script src="/video/jquery-1.12.4.min.js" type="text/javascript"></script>
<script src="/video/jsencrypt.min.js" type="text/javascript"></script>

全局配置参数

<script>
    window._CONFIG = {
        appKey:"XXXXXXXXX",
        secret:"XXXXXXXXXXXX",
        hikIp:'xxx.xxx.xxx.xx',
        apiPort:'XXXX',
};
</script>

页面

<div class="backWidth play_box" ref="backWidth">
	<a-row type="flex" justify="space-around" align="middle">
		<a-spin v-show="spinFlag" tip="加载中请稍后......" />
	</a-row>
	<a-row class="play_box">
		<div id="playWnd" class="playWnd" ref="barparent"></div>
	</a-row>
</div>
<script>
import {playMixin} from '@/utils/playMixinNew.js';
export default {
    mixins: [playMixin],
    data() {
        return {
            windowHeight: 0,
            curPlayMode:0,
        },
    mounted() {
        //计算窗口高度
        this.getWindowHeight();
        // 在窗口大小改变时重新获取窗口高度
        window.addEventListener('resize', this.getWindowHeight);
    },
    methods: {
        getWindowHeight() {
            this.windowHeight = window.innerHeight - 355;
        },
        // 切换实时视频和历史视频
        changePlay(value,playMode){
            if(playMode !== this.curPlayMode){
              this.closeWindow();
              setTimeout(()=>{
                this.openPlayer(value,playMode)
              },200)
            }
        },
        // 打开海康视频插件
        openPlayer(value,playMode=0){
            this.curPlayMode = playMode;
            this.$nextTick(()=>{
                this.initparam.layout = '1x1'
                this.spinFlag = true;
                this.initPlugin({playMode:this.curPlayMode});
                setTimeout(()=>{
                    if(this.curPlayMode){
                        console.log('进入视频回放')
                        this.startPlayBack(value)
                    }else{
                        console.log('进入视频预览')
                        this.startpreview(value);
                    }
                },2000)
            })
        },
    }

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-21 04:46:05       171 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-21 04:46:05       189 阅读
  3. 在Django里面运行非项目文件

    2024-07-21 04:46:05       157 阅读
  4. Python语言-面向对象

    2024-07-21 04:46:05       170 阅读

热门阅读

  1. 【LeetCode 0231】【位运算】2的N次方

    2024-07-21 04:46:05       32 阅读
  2. 【Socket 编程】基于UDP协议建立多人聊天室

    2024-07-21 04:46:05       32 阅读
  3. 会Excel就会sql?

    2024-07-21 04:46:05       34 阅读
  4. Android笔试面试题AI答之布局Layout(1)

    2024-07-21 04:46:05       33 阅读
  5. SpringBootWeb 篇-入门了解 Swagger 的具体使用

    2024-07-21 04:46:05       44 阅读