Skip to content

Commit 7a3aebd

Browse files
authored
feat(HikVision): improve dispose performance (#803)
* refactor: 增加异步支持 * refactor: 优化销毁逻辑 * chore: bump version 10.0.3
1 parent d522b6f commit 7a3aebd

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>10.0.2</Version>
4+
<Version>10.0.3</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ const hackJSDestroyPlugin = function () {
8686
JSVideoPlugin = null;
8787
delete window.JSVideoPlugin;
8888
removePlugin();
89+
90+
return new Promise((resolve, reject) => {
91+
resolve();
92+
});
8993
}
9094
}
9195

@@ -345,19 +349,21 @@ export function stopRealPlay(id) {
345349

346350
export function dispose(id) {
347351
const vision = Data.get(id);
348-
Data.remove(id);
349-
350352
const { realPlaying, logined, observer } = vision;
351353
if (observer) {
352354
observer.disconnect();
353355
}
356+
WebVideoCtrl.I_HidPlugin();
357+
354358
if (realPlaying === true) {
355359
stopRealPlay(id);
356360
}
357361
if (logined === true) {
358362
logout(id);
359363
}
360364
WebVideoCtrl.I_DestroyPlugin();
365+
366+
Data.remove(id);
361367
}
362368

363369
const getTagNameFirstValue = (xmlDoc, tagName, defaultValue = '0') => {

0 commit comments

Comments
 (0)