Skip to content

Commit

Permalink
hikvision: fix two way audio
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 2, 2024
1 parent 548ff48 commit 6766b35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/hikvision/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/hikvision/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/hikvision",
"version": "0.0.135",
"version": "0.0.136",
"description": "Hikvision Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",
Expand Down
8 changes: 7 additions & 1 deletion plugins/hikvision/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ class HikvisionCamera extends RtspSmartCamera implements Camera, Intercom, Reboo

const put = this.getClient().request({
url,
method: 'PUT',
responseType: 'readable',
headers: {
'Content-Type': 'application/octet-stream',
Expand Down Expand Up @@ -442,7 +443,12 @@ class HikvisionCamera extends RtspSmartCamera implements Camera, Intercom, Reboo
this.stopIntercom();
});

put.finally(() => forwarder.kill());
// the put request will be open until the passthrough is closed.
put.then(response => {
if (response.statusCode !== 200)
forwarder.kill();
})
.catch(() => forwarder.kill());
}

async stopIntercom(): Promise<void> {
Expand Down

0 comments on commit 6766b35

Please sign in to comment.