-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat(HikVision): add IsOpenSound parameter #867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -425,6 +425,7 @@ export async function capturePicture(id) { | |||||
| } | ||||||
| } | ||||||
| catch (ex) { | ||||||
| console.log(ex); | ||||||
| return null; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -462,8 +463,88 @@ export async function capturePictureAndDownload(id) { | |||||
| } | ||||||
| } | ||||||
| catch (ex) { | ||||||
| console.log(ex); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| export async function startRecord(id) { | ||||||
| const vision = Data.get(id); | ||||||
| const { realPlaying } = vision; | ||||||
|
|
||||||
| if (realPlaying !== true) { | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| let completed = false; | ||||||
| let error = null; | ||||||
| try { | ||||||
| WebVideoCtrl.I_StartRecord(`record_${new Date().getTime()}`, { | ||||||
| success: function () { | ||||||
| completed = true; | ||||||
| }, | ||||||
| error: function (oError) { | ||||||
| completed = true; | ||||||
| error = oError; | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
| catch (ex) { | ||||||
| console.log(ex); | ||||||
| } | ||||||
|
|
||||||
| return new Promise((resolve, reject) => { | ||||||
| const handler = setInterval(() => { | ||||||
| if (completed) { | ||||||
| clearTimeout(handler); | ||||||
| if (error === null) { | ||||||
| resolve(true); | ||||||
| } | ||||||
| else { | ||||||
| reject(error); | ||||||
| } | ||||||
| } | ||||||
| }, 16); | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| export async function stopRecord(id) { | ||||||
| const vision = Data.get(id); | ||||||
| const { realPlaying } = vision; | ||||||
|
|
||||||
| if (realPlaying !== true) { | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| let completed = false; | ||||||
| let error = null; | ||||||
| try { | ||||||
| WebVideoCtrl.I_StopRecord({ | ||||||
| success: function () { | ||||||
| completed = true; | ||||||
| }, | ||||||
| error: function (oError) { | ||||||
| completed = true; | ||||||
| error = oError; | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
| catch (ex) { | ||||||
|
|
||||||
|
||||||
| console.error('Error while stopping record:', ex); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using clearTimeout with a setInterval handler is incorrect. The handler is created by setInterval on line 536, so it should be cleared using clearInterval, not clearTimeout.
| clearTimeout(handler); | |
| clearInterval(handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using clearTimeout with a setInterval handler is incorrect. The handler is created by setInterval on line 496, so it should be cleared using clearInterval, not clearTimeout.