-
确认完成自身项目环境之后,请通知后台(或海康威视技术人员)更改取流协议格式,将ws改为wss协议(更改wss协议需要海康威视技术人员给打补丁)
-
按照demo代码进行项目集成
- 将demo中的文件移至项目
- 将h5player.min.js引入index.html文件
- 页面引入
- 变量引入
注意看demo,我这里的变量很多改过,进入高级模式(普通模式播不了)
- 方法引入
// 选择时间段 查看历史监控视频
searchHistoryTime(){
if (!!!this.beginTime||!!!this.endTime){
this.KaTeX parse error: Expected 'EOF', got '}' at position 106: … return; }̲ let t1 =…message({
message: ‘开始时间不得大于结束时间!’,
type: ‘warning’
})
return;
}
if (t2-t1>=259200000){
this.$message({
message: ‘时间区间不得超过3天!’,
type: ‘warning’
})
return;
}
$get(’/device/hkdevice/info/videoPlayBack’,{
beginTime:this.beginTime,
endTime:this.endTime,
cameraIndexCode:this.cameraIndexCode
}).then(res=>{
this.monitorHistoryUrl = res.data.data.url;
this.init();
this.createPlayer();
this.playbackStart();
})
},
init() {
// 设置播放容器的宽高并监听窗口大小变化
window.addEventListener('resize', () => {
this.player.JS_Resize()
})
},
createPlayer() {
let szBasePath = '';
//因为项目配置在二级域名,所以文件需改变路径
if (process.env.NODE_ENV == "production") {
szBasePath = '/bzsv/js/'
}
else{
szBasePath = '/js/'
}
this.player = new window.JSPlugin({
szId: 'player',
szBasePath: szBasePath,
iMaxSplit: 4,
iCurrentSplit: 1,
openDebug: true,
oStyle: {
borderSelect: IS_MOVE_DEVICE ? '#000' : '#FFCC00',
}
})
// 事件回调绑定
this.player.JS_SetWindowControlCallback({
windowEventSelect: function (iWndIndex) { //插件选中窗口回调
console.log('windowSelect callback: ', iWndIndex);
},
pluginErrorHandler: function (iWndIndex, iErrorCode, oError) { //插件错误回调
console.log('pluginError callback: ', iWndIndex, iErrorCode, oError);
},
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: ');
}
});
},
/* 回放 */
playbackStart() {
最后
给大家分享一些关于HTML的面试题。