From 5d6ef95b0f04f61f39939b9b0decdb8a10c58abf Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 6 Dec 2025 16:37:25 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BA=95=E5=B1=82?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/hikvision.js | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js b/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js index c9e43591..93670c2a 100644 --- a/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js +++ b/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js @@ -1,8 +1,7 @@ -import { addScript } from '../BootstrapBlazor/modules/utility.js'; +import { addScript, registerBootstrapBlazorModule } from '../BootstrapBlazor/modules/utility.js'; import Data from '../BootstrapBlazor/modules/data.js'; export async function init(id) { - await addScript('./_content/BootstrapBlazor.HikVision/jsVideoPlugin-1.0.0.min.js'); await addScript('./_content/BootstrapBlazor.HikVision/webVideoCtrl.js'); if (window.$ === void 0) { @@ -26,6 +25,29 @@ export async function init(id) { return true; } +const hackJSResize = function () { + const originalResize = JSVideoPlugin.prototype.JS_Resize; + JSVideoPlugin.prototype.JS_Resize = function (e, t) { + const { szId } = this.oOptions; + if (document.getElementById(szId)) { + return originalResize.call(this, e, t); + } + } +} + +const hackJSDestroyPlugin = function () { + const originalDestroy = JSVideoPlugin.prototype.JS_DestroyPlugin; + JSVideoPlugin.prototype.JS_DestroyPlugin = function (n) { + const origianlSendRequestProxy = this.oPlugin.oRequest.oRequest.sendRequest; + this.oPlugin.oRequest.oRequest.sendRequest = function (r) { + if (this.oWebSocket && WebSocket.OPEN === this.oWebSocket.readyState) { + return origianlSendRequestProxy.call(this, r); + } + } + return this.oPlugin.JS_DestroyPlugin(true); + } +} + const initWindow = id => { const result = { inited: null, iWndIndex: -1 }; WebVideoCtrl.I_InitPlugin({ @@ -53,7 +75,9 @@ const initWindow = id => { return new Promise((resolve, reject) => { const handler = setInterval(() => { if (result.inited === false || (result.inited && result.iWndIndex !== -1)) { - clearInterval(handler) + clearInterval(handler); + hackJSResize(); + hackJSDestroyPlugin(); resolve(result); } }, 16); @@ -278,6 +302,7 @@ export function dispose(id) { if (logined === true) { logout(id); } + WebVideoCtrl.I_Stop(); WebVideoCtrl.I_DestroyPlugin(); } From 41df73a32ee839a0c044d7c1eb1655e6bbd03568 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 6 Dec 2025 16:37:59 +0800 Subject: [PATCH 2/4] chore: bump version 10.0.0 --- .../BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj index f0593360..16cdc55e 100644 --- a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj +++ b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj @@ -1,7 +1,7 @@ - 10.0.0-beta05 + 10.0.0 From aa58992e74fcb2690b8808800265db92f03ee9ba Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 6 Dec 2025 16:39:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js b/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js index 93670c2a..ae3c3b71 100644 --- a/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js +++ b/src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js @@ -302,9 +302,7 @@ export function dispose(id) { if (logined === true) { logout(id); } - WebVideoCtrl.I_Stop(); WebVideoCtrl.I_DestroyPlugin(); - } const getTagNameFirstValue = (xmlDoc, tagName, defaultValue = '0') => { From 63b48ecfcc1d5661b55d3ad36021706ca1acd7e7 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 6 Dec 2025 16:40:57 +0800 Subject: [PATCH 4/4] chore: bump version 10.0.0-beta06 --- .../BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj index 16cdc55e..96d0affd 100644 --- a/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj +++ b/src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj @@ -1,7 +1,7 @@ - 10.0.0 + 10.0.0-beta06