|
|
|
@ -112,7 +112,7 @@ import $ from "jquery"; |
|
|
|
// import Video from '../../components/btgym/Video.vue' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -128,7 +128,11 @@ export default { |
|
|
|
// this.$nextTick 将回调延迟到下次DOM更新循环之后执行。在修改数据之后立即使用它,然后等待DOM更新 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.initPlugin(); |
|
|
|
this.initPlugin2(); |
|
|
|
this.initPlugin3(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
@ -145,26 +149,26 @@ export default { |
|
|
|
this.addNumber(0, 234098, 'insv') |
|
|
|
this.addNumber(0, 234098, 'insv2') |
|
|
|
this.addNumber(0, 234098, 'insv3') |
|
|
|
// this.getVideo() |
|
|
|
|
|
|
|
if (flvjs.isSupported()) { |
|
|
|
let video = this.$refs.player |
|
|
|
|
|
|
|
if (video) { |
|
|
|
this.player = flvjs.createPlayer({ |
|
|
|
type: "flv", |
|
|
|
isLive: true, |
|
|
|
url: `rtmp://58.200.131.2:1935/livetv/hunantv` |
|
|
|
}); |
|
|
|
this.player.attachMediaElement(video); |
|
|
|
try { |
|
|
|
this.player.load(); |
|
|
|
this.player.play(); |
|
|
|
} catch (error) { |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.getVideo() |
|
|
|
|
|
|
|
// if (flvjs.isSupported()) { |
|
|
|
// let video = this.$refs.player |
|
|
|
|
|
|
|
// if (video) { |
|
|
|
// this.player = flvjs.createPlayer({ |
|
|
|
// type: "flv", |
|
|
|
// isLive: true, |
|
|
|
// url: `rtmp://58.200.131.2:1935/livetv/hunantv` |
|
|
|
// }); |
|
|
|
// this.player.attachMediaElement(video); |
|
|
|
// try { |
|
|
|
// this.player.load(); |
|
|
|
// this.player.play(); |
|
|
|
// } catch (error) { |
|
|
|
// console.log(error); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
ty_bar1() { |
|
|
|
@ -696,8 +700,17 @@ export default { |
|
|
|
console.log(that); |
|
|
|
homeApi.allGetVideo().then(res => { |
|
|
|
// get allTimeData |
|
|
|
const tmpdata = res.data.returnData |
|
|
|
console.log(res); |
|
|
|
const tmpdata = res.data.videoData |
|
|
|
console.log(tmpdata); |
|
|
|
this.decode(tmpdata) |
|
|
|
console.log(this.decode(tmpdata)); |
|
|
|
let baseviode = this.decode(tmpdata) |
|
|
|
this.decode(baseviode) |
|
|
|
console.log(this.decode(baseviode)); |
|
|
|
let baseviodejson = this.decode2(baseviode) |
|
|
|
var jsonParseJson = JSON.parse(baseviodejson); |
|
|
|
console.log(jsonParseJson); |
|
|
|
// this.day_num = tmpdata.day.noRepeatInNum |
|
|
|
// this.week_num_num = tmpdata.week.noRepeatInNum |
|
|
|
// this.mon_num = tmpdata.month.noRepeatInNum |
|
|
|
@ -712,6 +725,24 @@ export default { |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
decode(str) { |
|
|
|
if (str === undefined || str === "" || str === null) { |
|
|
|
return str; |
|
|
|
} |
|
|
|
// Going backwards: from bytestream, to percent-encoding, to original string. |
|
|
|
return decodeURIComponent(atob(str).split('').map(function (c) { |
|
|
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); |
|
|
|
}).slice(0, -2).join('')); |
|
|
|
}, |
|
|
|
decode2(str) { |
|
|
|
if (str === undefined || str === "" || str === null) { |
|
|
|
return str; |
|
|
|
} |
|
|
|
// Going backwards: from bytestream, to percent-encoding, to original string. |
|
|
|
return decodeURIComponent(atob(str).split('').map(function (c) { |
|
|
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); |
|
|
|
}).join('')); |
|
|
|
}, |
|
|
|
|
|
|
|
// 创建播放实例 |
|
|
|
initPlugin() { |
|
|
|
@ -737,7 +768,7 @@ export default { |
|
|
|
oWebControl.JS_CreateWnd('playWnd').then(() => { |
|
|
|
//JS_CreateWnd创建视频播放窗口,宽高可设定 |
|
|
|
_that.init(); // 创建播放实例成功后初始化 |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
() => { |
|
|
|
@ -773,6 +804,124 @@ export default { |
|
|
|
}); |
|
|
|
this.oWebControl2 = oWebControl; |
|
|
|
}, |
|
|
|
initPlugin2() { |
|
|
|
let _that = this; |
|
|
|
const oWebControl = new window.WebControl({ |
|
|
|
szPluginContainer: 'playWnd2', // 指定容器id |
|
|
|
iServicePortStart: 15900, // 指定起止端口号,建议使用该值 |
|
|
|
iServicePortEnd: 15900, |
|
|
|
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid |
|
|
|
cbConnectSuccess() { |
|
|
|
console.log('创建WebControl实例成功'); |
|
|
|
oWebControl.JS_StartService('window', { |
|
|
|
// WebControl实例创建成功后需要启动服务 |
|
|
|
dllPath: './VideoPluginConnect.dll', // 值"./VideoPluginConnect.dll"写死 |
|
|
|
}) |
|
|
|
.then( |
|
|
|
() => { |
|
|
|
// // 启动插件服务成功 |
|
|
|
oWebControl.JS_SetWindowControlCallback({ |
|
|
|
// 设置消息回调 |
|
|
|
cbIntegrationCallBack: _that.cbIntegrationCallBack, |
|
|
|
}); |
|
|
|
oWebControl.JS_CreateWnd('playWnd2').then(() => { |
|
|
|
//JS_CreateWnd创建视频播放窗口,宽高可设定 |
|
|
|
_that.init2(); // 创建播放实例成功后初始化 |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
() => { |
|
|
|
// 启动插件服务失败 |
|
|
|
console.log('启动插件服务失败'); |
|
|
|
} |
|
|
|
) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
cbConnectError() { |
|
|
|
// 创建WebControl实例失败 |
|
|
|
console.log('xxx'); |
|
|
|
oWebControl = null; |
|
|
|
$('#playWnd2').html('插件未启动,正在尝试启动,请稍候...'); |
|
|
|
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // 程序未启动时执行error函数,采用wakeup来启动程序 |
|
|
|
this.initCount++; |
|
|
|
if (this.initCount < 3) { |
|
|
|
setTimeout(function () { |
|
|
|
this.initPlugin(); |
|
|
|
}, 3000); |
|
|
|
} else { |
|
|
|
$('#playWnd2').html('插件启动失败,请检查插件是否安装!'); |
|
|
|
} |
|
|
|
}, |
|
|
|
cbConnectClose(bNormalClose) { |
|
|
|
// 异常断开:bNormalClose = false |
|
|
|
// JS_Disconnect正常断开:bNormalClose = true |
|
|
|
console.log('cbConnectClose'); |
|
|
|
oWebControl = null; |
|
|
|
}, |
|
|
|
}); |
|
|
|
this.oWebControl2 = oWebControl; |
|
|
|
}, |
|
|
|
initPlugin3() { |
|
|
|
let _that = this; |
|
|
|
const oWebControl = new window.WebControl({ |
|
|
|
szPluginContainer: 'playWnd3', // 指定容器id |
|
|
|
iServicePortStart: 15900, // 指定起止端口号,建议使用该值 |
|
|
|
iServicePortEnd: 15900, |
|
|
|
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid |
|
|
|
cbConnectSuccess() { |
|
|
|
console.log('创建WebControl实例成功'); |
|
|
|
oWebControl.JS_StartService('window', { |
|
|
|
// WebControl实例创建成功后需要启动服务 |
|
|
|
dllPath: './VideoPluginConnect.dll', // 值"./VideoPluginConnect.dll"写死 |
|
|
|
}) |
|
|
|
.then( |
|
|
|
() => { |
|
|
|
// // 启动插件服务成功 |
|
|
|
oWebControl.JS_SetWindowControlCallback({ |
|
|
|
// 设置消息回调 |
|
|
|
cbIntegrationCallBack: _that.cbIntegrationCallBack, |
|
|
|
}); |
|
|
|
oWebControl.JS_CreateWnd('playWnd3').then(() => { |
|
|
|
//JS_CreateWnd创建视频播放窗口,宽高可设定 |
|
|
|
_that.init3(); // 创建播放实例成功后初始化 |
|
|
|
|
|
|
|
}); |
|
|
|
}, |
|
|
|
() => { |
|
|
|
// 启动插件服务失败 |
|
|
|
console.log('启动插件服务失败'); |
|
|
|
} |
|
|
|
) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
cbConnectError() { |
|
|
|
// 创建WebControl实例失败 |
|
|
|
console.log('xxx'); |
|
|
|
oWebControl = null; |
|
|
|
$('#playWnd3').html('插件未启动,正在尝试启动,请稍候...'); |
|
|
|
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // 程序未启动时执行error函数,采用wakeup来启动程序 |
|
|
|
this.initCount++; |
|
|
|
if (this.initCount < 3) { |
|
|
|
setTimeout(function () { |
|
|
|
this.initPlugin(); |
|
|
|
}, 3000); |
|
|
|
} else { |
|
|
|
$('#playWnd3').html('插件启动失败,请检查插件是否安装!'); |
|
|
|
} |
|
|
|
}, |
|
|
|
cbConnectClose(bNormalClose) { |
|
|
|
// 异常断开:bNormalClose = false |
|
|
|
// JS_Disconnect正常断开:bNormalClose = true |
|
|
|
console.log('cbConnectClose'); |
|
|
|
oWebControl = null; |
|
|
|
}, |
|
|
|
}); |
|
|
|
this.oWebControl2 = oWebControl; |
|
|
|
}, |
|
|
|
//初始化 |
|
|
|
init() { |
|
|
|
let _that = this; |
|
|
|
@ -819,6 +968,96 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
init2() { |
|
|
|
let _that = this; |
|
|
|
this.getPubKey(function () { |
|
|
|
// 请自行修改以下变量值 |
|
|
|
var appkey = "29940726"; //综合安防管理平台提供的appkey,必填 |
|
|
|
var secret = _that.setEncrypt("SkTCnQdFbNW4Z2suNj8P"); //综合安防管理平台提供的secret,必填 |
|
|
|
var ip = "192.168.66.13"; //综合安防管理平台IP地址,必填 |
|
|
|
var playMode = 0; //初始播放模式:0-预览,1-回放 |
|
|
|
var port = 443; //综合安防管理平台端口,若启用HTTPS协议,默认443 |
|
|
|
// var snapDir = ""; //抓图存储路径 |
|
|
|
// var videoDir = "D:\\VideoDir"; //紧急录像或录像剪辑存储路径 |
|
|
|
var layout = "1x1"; //playMode指定模式的布局 |
|
|
|
var enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1 |
|
|
|
var encryptedFields = "secret"; //加密字段,默认加密领域为secret |
|
|
|
var showToolbar = 0; //是否显示工具栏,0-不显示,非0-显示 |
|
|
|
var showSmart = 1; //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示 |
|
|
|
var buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //自定义工具条按钮 |
|
|
|
// 请自行修改以上变量值 |
|
|
|
_that.oWebControl2.JS_RequestInterface({ |
|
|
|
funcName: "init2", |
|
|
|
argument: JSON.stringify({ |
|
|
|
appkey: appkey, //API网关提供的appkey |
|
|
|
secret: secret, //API网关提供的secret |
|
|
|
ip: ip, //API网关IP地址 |
|
|
|
playMode: playMode, //播放模式(决定显示预览还是回放界面) |
|
|
|
port: port, //端口 |
|
|
|
// snapDir: snapDir, //抓图存储路径 |
|
|
|
// videoDir: videoDir, //紧急录像或录像剪辑存储路径 |
|
|
|
layout: layout, //布局 |
|
|
|
enableHTTPS: enableHTTPS, //是否启用HTTPS协议 |
|
|
|
encryptedFields: encryptedFields, //加密字段 |
|
|
|
showToolbar: showToolbar, //是否显示工具栏 |
|
|
|
showSmart: showSmart, //是否显示智能信息 |
|
|
|
buttonIDs: buttonIDs, //自定义工具条按钮 |
|
|
|
}), |
|
|
|
}) |
|
|
|
.then((oData) => { |
|
|
|
let width = document.querySelector("#playWnd2").offsetWidth; |
|
|
|
let height = document.querySelector("#playWnd2").offsetHeight; |
|
|
|
_that.oWebControl2.JS_Resize(width, height); // 初始化后resize一次,能和盒子大小一致。 |
|
|
|
console.log(oData); |
|
|
|
_that.getVideoFun('05edddc148b141c5930301af43154942') |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
init3() { |
|
|
|
let _that = this; |
|
|
|
this.getPubKey(function () { |
|
|
|
// 请自行修改以下变量值 |
|
|
|
var appkey = "29940726"; //综合安防管理平台提供的appkey,必填 |
|
|
|
var secret = _that.setEncrypt("SkTCnQdFbNW4Z2suNj8P"); //综合安防管理平台提供的secret,必填 |
|
|
|
var ip = "192.168.66.13"; //综合安防管理平台IP地址,必填 |
|
|
|
var playMode = 0; //初始播放模式:0-预览,1-回放 |
|
|
|
var port = 443; //综合安防管理平台端口,若启用HTTPS协议,默认443 |
|
|
|
// var snapDir = ""; //抓图存储路径 |
|
|
|
// var videoDir = "D:\\VideoDir"; //紧急录像或录像剪辑存储路径 |
|
|
|
var layout = "1x1"; //playMode指定模式的布局 |
|
|
|
var enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1 |
|
|
|
var encryptedFields = "secret"; //加密字段,默认加密领域为secret |
|
|
|
var showToolbar = 0; //是否显示工具栏,0-不显示,非0-显示 |
|
|
|
var showSmart = 1; //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示 |
|
|
|
var buttonIDs = "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //自定义工具条按钮 |
|
|
|
// 请自行修改以上变量值 |
|
|
|
_that.oWebControl2.JS_RequestInterface({ |
|
|
|
funcName: "init3", |
|
|
|
argument: JSON.stringify({ |
|
|
|
appkey: appkey, //API网关提供的appkey |
|
|
|
secret: secret, //API网关提供的secret |
|
|
|
ip: ip, //API网关IP地址 |
|
|
|
playMode: playMode, //播放模式(决定显示预览还是回放界面) |
|
|
|
port: port, //端口 |
|
|
|
// snapDir: snapDir, //抓图存储路径 |
|
|
|
// videoDir: videoDir, //紧急录像或录像剪辑存储路径 |
|
|
|
layout: layout, //布局 |
|
|
|
enableHTTPS: enableHTTPS, //是否启用HTTPS协议 |
|
|
|
encryptedFields: encryptedFields, //加密字段 |
|
|
|
showToolbar: showToolbar, //是否显示工具栏 |
|
|
|
showSmart: showSmart, //是否显示智能信息 |
|
|
|
buttonIDs: buttonIDs, //自定义工具条按钮 |
|
|
|
}), |
|
|
|
}) |
|
|
|
.then((oData) => { |
|
|
|
let width = document.querySelector("#playWnd3").offsetWidth; |
|
|
|
let height = document.querySelector("#playWnd3").offsetHeight; |
|
|
|
_that.oWebControl2.JS_Resize(width, height); // 初始化后resize一次,能和盒子大小一致。 |
|
|
|
console.log(oData); |
|
|
|
_that.getVideoFun('05edddc148b141c5930301af43154942') |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 设置窗口控制回调 |
|
|
|
setCallbacks() { |
|
|
|
this.oWebControl.JS_SetWindowControlCallback({ |
|
|
|
|