@scrypted/amcrest
Advanced tools
Comparing version 0.0.117 to 0.0.118
{ | ||
"name": "@scrypted/amcrest", | ||
"version": "0.0.117", | ||
"version": "0.0.118", | ||
"description": "Amcrest Plugin for Scrypted", | ||
@@ -5,0 +5,0 @@ "author": "Scrypted", |
@@ -35,2 +35,12 @@ import AxiosDigestAuth from '@koush/axios-digest-auth'; | ||
async checkTwoWayAudio() { | ||
const response = await this.digestAuth.request({ | ||
httpsAgent: amcrestHttpsAgent, | ||
method: "GET", | ||
responseType: 'text', | ||
url: `http://${this.ip}/cgi-bin/devAudioOutput.cgi?action=getCollect`, | ||
}); | ||
return (response.data as string).includes('result=1'); | ||
} | ||
// appAutoStart=true | ||
@@ -37,0 +47,0 @@ // deviceType=IP4M-1041B |
@@ -548,5 +548,6 @@ import { ffmpegLogInitialOutput } from '@scrypted/common/src/media-helpers'; | ||
const skipValidate = settings.skipValidate === 'true'; | ||
let twoWayAudio: string; | ||
if (!skipValidate) { | ||
const api = new AmcrestCameraClient(httpAddress, username, password, this.console); | ||
try { | ||
const api = new AmcrestCameraClient(httpAddress, username, password, this.console); | ||
const deviceInfo = await api.getDeviceInfo(); | ||
@@ -562,2 +563,12 @@ | ||
} | ||
try { | ||
if (await api.checkTwoWayAudio()) { | ||
// onvif seems to work better than Amcrest, except for AD110. | ||
twoWayAudio = 'ONVIF'; | ||
} | ||
} | ||
catch (e) { | ||
this.console.warn('Error probing two way audio', e); | ||
} | ||
} | ||
@@ -574,2 +585,4 @@ settings.newCamera ||= 'Hikvision Camera'; | ||
device.setHttpPortOverride(settings.httpPort?.toString()); | ||
if (twoWayAudio) | ||
device.putSetting('twoWayAudio', twoWayAudio); | ||
return nativeId; | ||
@@ -576,0 +589,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
384927
1331