Browse Source

移除不使用的video元素

lite
453530270@qq.com 3 years ago
parent
commit
40b44a0725
  1. 561
      src/views/ty/index.vue

561
src/views/ty/index.vue

@ -217,13 +217,7 @@ export default {
};
},
created() {
// this.$nextTick DOM使DOM
this.$nextTick(() => {
this.initPlugin();
this.initPlugin2();
this.initPlugin3();
});
// do nothing
},
mounted() {
@ -261,19 +255,6 @@ export default {
this.addNumber(0, this.yearNum, 'insv3')
// });
this.getVideo()
// document.getElementById("iframe").load('https://www.js365.org.cn/pages/reserve/index')
// console.log($('iframe'));
// console.log($('iframe').children().find('a'));
// $('iframe').children().find('a').on('click', function () {
// //
// console.log('wwwwwwwwwww');S
// });
// const iframe = document.querySelector('#iframe')
// console.log(iframe);
},
methods: {
istygShowfn() {
@ -1210,546 +1191,6 @@ export default {
}
},
//
getVideo() {
let that = this
homeApi.allGetVideo().then(res => {
// get allTimeData
const tmpdata = res.data.videoData
let baseviode = this.decode(tmpdata)
let baseviodejson = this.sec_decode(baseviode)
var jsonParseJson = JSON.parse(baseviodejson);
this.videoData = jsonParseJson
});
},
//
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(''));
},
//
sec_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);
}).join(''));
},
//
initPlugin() {
let _that = this;
let oWebControl0 = new window.WebControl({
szPluginContainer: 'camera0', // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid
cbConnectSuccess() {
// console.log('WebControl1');
$('#camera0').html('创建WebControl实例成功1');
oWebControl0.JS_StartService('window', {
// WebControl
dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll"
}).then(
() => {
// //
// oWebControl0.JS_SetWindowControlCallback({
// //
// cbIntegrationCallBack: _that.cbIntegrationCallBack,
// });
oWebControl0.JS_CreateWnd('camera0').then(() => {
//JS_CreateWnd
_that.init(); //
});
},
() => {
//
console.log('启动插件服务失败');
}
)
.catch((err) => {
console.log(err);
});
},
cbConnectError() {
// WebControl
console.log('xxx');
oWebControl0 = null;
$('#camera0').html('插件未启动,正在尝试启动,请稍候...');
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup
this.initCount++;
if (this.initCount < 3) {
setTimeout(function () {
this.initPlugin();
}, 3000);
} else {
$('#camera0').html('插件启动失败,请检查插件是否安装!');
}
},
cbConnectClose(bNormalClose) {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
console.log('cbConnectClose');
oWebControl0 = null;
},
});
this.oWebControl0 = oWebControl0;
},
initPlugin2() {
let _that = this;
let oWebControl1 = new window.WebControl({
szPluginContainer: 'camera1', // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid
cbConnectSuccess() {
console.log('创建WebControl实例成功');
oWebControl1.JS_StartService('window', {
// WebControl
dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll"
})
.then(
() => {
// //
// oWebControl1.JS_SetWindowControlCallback({
// //
// cbIntegrationCallBack: _that.cbIntegrationCallBack,
// });
oWebControl1.JS_CreateWnd('camera1').then(() => {
//JS_CreateWnd
_that.init2(); //
}).catch((err) => {
console.log(err);
});;
},
() => {
//
console.log('启动插件服务失败');
}
)
.catch((err) => {
console.log(err);
});
},
cbConnectError() {
// WebControl
console.log('xxx');
oWebControl1 = null;
$('#camera1').html('插件未启动,正在尝试启动,请稍候...');
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup
this.initCount++;
if (this.initCount < 3) {
setTimeout(function () {
this.initPlugin2();
}, 3000);
} else {
$('#camera1').html('插件启动失败,请检查插件是否安装!');
}
},
cbConnectClose(bNormalClose) {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
console.log('cbConnectClose');
oWebControl1 = null;
},
});
this.oWebControl1 = oWebControl1;
},
initPlugin3() {
let _that = this;
let oWebControl2 = new window.WebControl({
szPluginContainer: 'camera2', // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15900,
szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // IE10使ActiveXclsid
cbConnectSuccess() {
// console.log('WebControl');
oWebControl2.JS_StartService('window', {
// WebControl
dllPath: './VideoPluginConnect.dll', // "./VideoPluginConnect.dll"
})
.then(
() => {
// //
// oWebControl2.JS_SetWindowControlCallback({
// //
// cbIntegrationCallBack: _that.cbIntegrationCallBack,
// });
oWebControl2.JS_CreateWnd('camera2').then(() => {
//JS_CreateWnd
_that.init3(); //
}).catch((err) => {
console.log(err);
});;
},
() => {
//
console.log('启动插件服务失败');
}
)
.catch((err) => {
console.log(err);
});
},
cbConnectError() {
// WebControl
console.log('xxx');
oWebControl2 = null;
$('#camera2').html('插件未启动,正在尝试启动,请稍候...');
window.WebControl.JS_WakeUp('VideoWebPlugin://'); // errorwakeup
this.initCount++;
if (this.initCount < 3) {
setTimeout(function () {
this.initPlugin3();
}, 3000);
} else {
$('#camera2').html('插件启动失败,请检查插件是否安装!');
}
},
cbConnectClose(bNormalClose) {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
console.log('cbConnectClose');
oWebControl2 = null;
},
});
this.oWebControl2 = oWebControl2;
},
//
init() {
console.log("i am init")
let _that = this;
_that.getPubKey(function () {
//
// console.log(typeof(_that.videoData[0].host));
var port = Number(_that.videoData[0].port)
var appkey = _that.videoData[0].appkey; //appkey
var secret = _that.setEncrypt(_that.videoData[0].secret); //secret
var ip = _that.videoData[0].host; //IP
var playMode = 0; //0-1-
var port = port; //HTTPS443
// var snapDir = ""; //
// var videoDir = "D:\\VideoDir"; //
var layout = "1x1"; //playMode
var enableHTTPS = 1; //HTTPS1
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.oWebControl0.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
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("#camera0").offsetWidth;
let height = document.querySelector("#camera0").offsetHeight;
_that.oWebControl0.JS_Resize(width, height); // resize
// console.log(oData);
// console.log(width, height);
_that.getVideoFun(_that.videoData[0].cameraIndexCode)
});
});
},
init2() {
let _that = this;
this.getPubKey2(function () {
var port = Number(_that.videoData[1].port)
//
var appkey = _that.videoData[1].appkey; //appkey
var secret = _that.setEncrypt(_that.videoData[1].secret); //secret
var ip = _that.videoData[1].host; //IP
var playMode = 0; //0-1-
var port = port; //HTTPS443
// var snapDir = ""; //
// var videoDir = "D:\\VideoDir"; //
var layout = "1x1"; //playMode
var enableHTTPS = 1; //HTTPS1
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.oWebControl1.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
// snapDir: snapDir, //
// videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs: buttonIDs, //
}),
})
.then((oData) => {
let width2 = document.querySelector("#camera1").offsetWidth;
let height2 = document.querySelector("#camera1").offsetHeight;
_that.oWebControl1.JS_Resize(width2, height2); // resize
// console.log(oData);
// console.log(width2, height2);
_that.getVideoFun2(_that.videoData[1].cameraIndexCode)
});
});
},
init3() {
let _that = this;
this.getPubKey3(function () {
var port = Number(_that.videoData[2].port)
//
var appkey = _that.videoData[2].appkey; //appkey
var secret = _that.setEncrypt(_that.videoData[2].secret); //secret
var ip = _that.videoData[2].host; //IP
var playMode = 0; //0-1-
var port = port; //HTTPS443
// var snapDir = ""; //
// var videoDir = "D:\\VideoDir"; //
var layout = "1x1"; //playMode
var enableHTTPS = 1; //HTTPS1
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: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
// snapDir: snapDir, //
// videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs: buttonIDs, //
}),
})
.then((oData) => {
let width3 = document.querySelector("#camera2").offsetWidth;
let height3 = document.querySelector("#camera2").offsetHeight;
_that.oWebControl2.JS_Resize(width3, height3); // resize
// console.log(oData);
// console.log(width3, height3);
_that.getVideoFun3(_that.videoData[2].cameraIndexCode)
});
});
},
//
setCallbacks() {
console.log(this.oWebControl);
this.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: this.cbIntegrationCallBack,
});
},
//
cbIntegrationCallBack(oData) {
//
console.log(oData);
},
//
getPubKey(callback) {
this.oWebControl0.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then((oData) => {
if (oData.responseMsg.data) {
this.pubKey0 = oData.responseMsg.data;
console.log(this.pubKey0);
callback();
}
});
},
getPubKey2(callback) {
this.oWebControl1.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then((oData) => {
if (oData.responseMsg.data) {
this.pubKey1 = oData.responseMsg.data;
console.log(this.pubKey1);
callback();
}
});
},
getPubKey3(callback) {
this.oWebControl2.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then((oData) => {
if (oData.responseMsg.data) {
this.pubKey2 = oData.responseMsg.data;
console.log(this.pubKey2);
callback();
}
});
},
//RSA
setEncrypt(value) {
var encrypt = new window.JSEncrypt();
encrypt.setPublicKey(this.pubKey0);
return encrypt.encrypt(value);
},
//
getVideoFun(Code) {
//
var cameraIndexCode = Code; //
var streamMode = 1; //0-1-
var transMode = 1; //0-UDP1-TCP
var gpuMode = 1; //GPU0-1-
var wndId = -1; //2x2
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
console.log(cameraIndexCode);
this.oWebControl0.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, //GPU
wndId: wndId, //
}),
})
.then((res) => {
//
// console.log('')
//console.log(res);
},
err => {
//console.log('')
//console.log(preUrl);
// console.info('JS_Play failed:', err)
console.info(err)
});
},
getVideoFun2(Code) {
//
var cameraIndexCode = Code; //
var streamMode = 1; //0-1-
var transMode = 1; //0-UDP1-TCP
var gpuMode = 1; //GPU0-1-
var wndId = -1; //2x2
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
console.log(cameraIndexCode);
this.oWebControl1.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, //GPU
wndId: wndId, //
}),
})
.then((res) => {
//
console.log(res);
},
err => {
// console.log(preUrl);
console.info('JS_Play failed:', err)
});
},
getVideoFun3(Code) {
//
var cameraIndexCode = Code; //
var streamMode = 1; //0-1-
var transMode = 1; //0-UDP1-TCP
var gpuMode = 1; //GPU0-1-
var wndId = -1; //2x2
cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
console.log(cameraIndexCode);
this.oWebControl2.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, //GPU
wndId: wndId, //
}),
})
.then((res) => {
//
console.log('播放成功22222222222')
console.log(res);
},
err => {
console.log('播放失败')
console.log(preUrl);
// console.info('JS_Play failed:', err)
console.info(err)
});
},
//
stopVideoFun() {
this.oWebControl0.JS_RequestInterface({
funcName: "stopAllPreview",
});
},
// ---html
// 使
//
destroyVideoDiv() {
this.oWebControl2.JS_DestroyWnd()
.then((data) => {
console.log("销毁窗口成功");
})
.catch((err) => {
console.log("销毁窗口失败");
});
},
},
};

Loading…
Cancel
Save