下载依赖
npm install ezuikit-js --save
完整代码
html
<template>
<div class="home">
<div id="video-container"></div>
</div>
</template>
<script>
import EZUIKit from "ezuikit-js";
export default {
name: "home",
data() {
return {
ezvizPlay: null,
};
},
components: {},
props: {},
watch: {},
computed: {},
mounted() {
this.$nextTick(()=>{
this.initVideo()
})
},
methods: {
initVideo(){
if (this.ezvizPlay !== null) {
return;
}
//获取萤石token
this.ezvizPlay = new EZUIKit.EZUIKitPlayer({
autoplay: true, // 默认播放
//视频播放包裹元素
id: "video-container",
//萤石token
accessToken:"----",
// ezopen://open.ys7.com/${设备序列号}/{通道号}.live
url: "ezopen://------.live", // 播放地址
template: "simple", // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版;
// header: ['capturePicture', 'zoom'], // 如果templete参数不为simple,该字段将被覆盖
plugin: ['talk'], // 加载插件,talk-对讲
// 视频下方底部控件
// footer: ["talk", "broadcast", "hd", "fullScreen"], // 如果template参数不为simple,该字段将被覆盖
footer: ['talk', 'hd', 'fullScreen'], // 如果template参数不为simple,该字段将被覆盖
audio: 0, // 是否默认开启声音 0 - 关闭 1 - 开启
// openSoundCallBack: data => console.log("开启声音回调", data),
// closeSoundCallBack: data => console.log("关闭声音回调", data),
// startSaveCallBack: data => console.log("开始录像回调", data),
// stopSaveCallBack: data => console.log("录像回调", data),
// capturePictureCallBack: data => console.log("截图成功回调", data),
// fullScreenCallBack: data => console.log("全屏回调", data),
// getOSDTimeCallBack: data => console.log("获取OSDTime回调", data),
width: 800,//元素宽度
height: 600,//视频元素高度
})
},
}
};
</script>
<style lang="scss" scoped>
</style>