diff --git a/src/views/video/monitor.vue b/src/views/video/monitor.vue
index cd27998..3c74f71 100644
--- a/src/views/video/monitor.vue
+++ b/src/views/video/monitor.vue
@@ -30,7 +30,7 @@
components: { WebPlay, VideoTree },
data() {
return {
-
+ activeName: 'hk'
}
},
mounted() {
@@ -55,6 +55,12 @@
if (typeof camera.ip === 'undefined' || camera.ip === '') {
console.log('ip is null')
return false
+ } else {
+ if (this.activeName === 'hk') {
+ window.frames['playHK'].preview(camera.ip)
+ } else if (this.activeName === 'hk') {
+ window.frames['playNVR'].startPlayReal()
+ }
}
if (typeof camera.username === 'undefined' || camera.username === '') {
console.log('username is null')
@@ -73,5 +79,12 @@
diff --git a/src/views/video/monitor.vue b/src/views/video/monitor.vue
index cd27998..3c74f71 100644
--- a/src/views/video/monitor.vue
+++ b/src/views/video/monitor.vue
@@ -30,7 +30,7 @@
components: { WebPlay, VideoTree },
data() {
return {
-
+ activeName: 'hk'
}
},
mounted() {
@@ -55,6 +55,12 @@
if (typeof camera.ip === 'undefined' || camera.ip === '') {
console.log('ip is null')
return false
+ } else {
+ if (this.activeName === 'hk') {
+ window.frames['playHK'].preview(camera.ip)
+ } else if (this.activeName === 'hk') {
+ window.frames['playNVR'].startPlayReal()
+ }
}
if (typeof camera.username === 'undefined' || camera.username === '') {
console.log('username is null')
@@ -73,5 +79,12 @@
diff --git a/static/webCtrl/hk/demo_window_simple_preview.html b/static/webCtrl/hk/demo_window_simple_preview.html
index 8fb1c4b..9fb30e9 100644
--- a/static/webCtrl/hk/demo_window_simple_preview.html
+++ b/static/webCtrl/hk/demo_window_simple_preview.html
@@ -10,9 +10,9 @@
margin: 0;
}
.playWnd {
- margin: 30px 0 0 400px;
- width: 1000px; /*播放容器的宽和高设定*/
- height: 600px;
+ margin: 10px 0 0 10px;
+ width: 960px; /*播放容器的宽和高设定*/
+ height: 570px;
border: 1px solid red;
}
.operate {
@@ -53,7 +53,7 @@
-
+
-
-
+
+
@@ -77,7 +77,7 @@
//页面加载时创建播放实例初始化
$(window).load(function () {
- initPlugin();
+ // initPlugin();
});
//声明公用变量
@@ -89,16 +89,16 @@
oWebControl = new WebControl({
szPluginContainer: "playWnd", // 指定容器id
iServicePortStart: 15900, // 指定起止端口号,建议使用该值
- iServicePortEnd: 15909,
+ iServicePortEnd: 15909,
szClassId:"23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
- cbConnectSuccess: function () { // 创建WebControl实例成功
+ cbConnectSuccess: function () { // 创建WebControl实例成功
oWebControl.JS_StartService("window", { // WebControl实例创建成功后需要启动服务
- dllPath: "./VideoPluginConnect.dll" // 值"./VideoPluginConnect.dll"写死
+ dllPath: "./VideoPluginConnect.dll" // 值"./VideoPluginConnect.dll"写死
}).then(function () { // 启动插件服务成功
oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
cbIntegrationCallBack: cbIntegrationCallBack
});
-
+
oWebControl.JS_CreateWnd("playWnd", 1000, 600).then(function () { //JS_CreateWnd创建视频播放窗口,宽高可设定
init(); // 创建播放实例成功后初始化
});
@@ -110,7 +110,7 @@
$("#playWnd").html("插件未启动,正在尝试启动,请稍候...");
WebControl.JS_WakeUp("VideoWebPlugin://"); // 程序未启动时执行error函数,采用wakeup来启动程序
initCount ++;
- if (initCount < 3) {
+ if (initCount < 3) {
setTimeout(function () {
initPlugin();
}, 3000)
@@ -118,9 +118,9 @@
$("#playWnd").html("插件启动失败,请检查插件是否安装!");
}
},
- cbConnectClose: function (bNormalClose) {
+ cbConnectClose: function (bNormalClose) {
// 异常断开:bNormalClose = false
- // JS_Disconnect正常断开:bNormalClose = true
+ // JS_Disconnect正常断开:bNormalClose = true
console.log("cbConnectClose");
oWebControl = null;
}
@@ -138,13 +138,13 @@
function cbIntegrationCallBack(oData) {
showCBInfo(JSON.stringify(oData.responseMsg));
}
-
+
//初始化
function init()
{
getPubKey(function () {
-
- ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
+
+ ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
var appkey = "28730366"; //综合安防管理平台提供的appkey,必填
var secret = setEncrypt("HSZkCJpSJ7gSUYrO6wVi"); //综合安防管理平台提供的secret,必填
var ip = "10.19.132.75"; //综合安防管理平台IP地址,必填
@@ -205,15 +205,15 @@
encrypt.setPublicKey(pubKey);
return encrypt.encrypt(value);
}
-
+
// 监听resize事件,使插件窗口尺寸跟随DIV窗口变化
- $(window).resize(function () {
+ $(window).resize(function () {
if (oWebControl != null) {
oWebControl.JS_Resize(1000, 600);
setWndCover();
}
});
-
+
// 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
$(window).scroll(function () {
if (oWebControl != null) {
@@ -221,8 +221,8 @@
setWndCover();
}
});
-
-
+
+
// 设置窗口裁剪,当因滚动条滚动导致窗口需要被遮住的情况下需要JS_CuttingPartWindow部分窗口
function setWndCover() {
var iWidth = $(window).width();
@@ -256,44 +256,48 @@
//视频预览功能
$("#startPreview").click(function () {
- var cameraIndexCode = $("#cameraIndexCode").val(); //获取输入的监控点编号值,必填
- var streamMode = 0; //主子码流标识:0-主码流,1-子码流
- var transMode = 1; //传输协议:0-UDP,1-TCP
- var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
- var wndId = -1; //播放窗口序号(在2x2以上布局下可指定播放窗口)
-
- cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
- cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
-
- oWebControl.JS_RequestInterface({
- funcName: "startPreview",
- argument: JSON.stringify({
- cameraIndexCode:cameraIndexCode, //监控点编号
- streamMode: streamMode, //主子码流标识
- transMode: transMode, //传输协议
- gpuMode: gpuMode, //是否开启GPU硬解
- wndId:wndId //可指定播放窗口
- })
- })
+ var cameraIndexCode = $("#cameraIndexCode").val(); //获取输入的监控点编号值,必填
+ preview(cameraIndexCode)
});
+ function preview(cameraIndexCode){
+ var streamMode = 0; //主子码流标识:0-主码流,1-子码流
+ var transMode = 1; //传输协议:0-UDP,1-TCP
+ var gpuMode = 0; //是否启用GPU硬解,0-不启用,1-启用
+ var wndId = -1; //播放窗口序号(在2x2以上布局下可指定播放窗口)
+
+ cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, "");
+ cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, "");
+
+ oWebControl.JS_RequestInterface({
+ funcName: "startPreview",
+ argument: JSON.stringify({
+ cameraIndexCode:cameraIndexCode, //监控点编号
+ streamMode: streamMode, //主子码流标识
+ transMode: transMode, //传输协议
+ gpuMode: gpuMode, //是否开启GPU硬解
+ wndId:wndId //可指定播放窗口
+ })
+ })
+};
//停止全部预览
$("#stopAllPreview").click(function () {
oWebControl.JS_RequestInterface({
funcName: "stopAllPreview"
});
});
+ function stop(){};
// 标签关闭
$(window).unload(function () {
if (oWebControl != null){
- oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
+ oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
oWebControl.JS_Disconnect().then(function(){ // 断开与插件服务连接成功
- },
+ },
function() { // 断开与插件服务连接失败
});
}
});
-