-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathHikVision.razor.js
More file actions
45 lines (40 loc) · 1.42 KB
/
HikVision.razor.js
File metadata and controls
45 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { init as initVision, login, logout, startRealPlay, stopRealPlay, dispose as disposeVision } from '../hikvision.js';
import EventHandler from '../../BootstrapBlazor/modules/event-handler.js';
export async function init(id) {
const el = document.getElementById(id);
if (el === null) {
return;
}
const previewId = `${id}_preview`;
await initVision(previewId);
const controls = el.querySelector('.bb-hik-controls');
if (controls) {
EventHandler.on(controls, 'click', '.bb-hik-login', async e => {
console.log('login');
await login(previewId, '47.121.113.151', 9980, 'admin', 'vhbn8888', 1)
});
EventHandler.on(controls, 'click', '.bb-hik-logout', e => {
console.log('logout');
logout(previewId);
});
EventHandler.on(controls, 'click', '.bb-hik-start', e => {
console.log('start');
startRealPlay(previewId);
});
EventHandler.on(controls, 'click', '.bb-hik-stop', e => {
console.log('stop');
stopRealPlay(previewId);
});
}
}
export function dispose(id) {
const el = document.getElementById(id);
if (el !== null) {
const controls = el.querySelector('.bb-hik-controls');
if (controls) {
EventHandler.off(controls, 'click');
}
}
const previewId = `${id}_preview`;
disposeVision(previewId);
}