hikvision: autoconfigure should disable vca resource

This commit is contained in:
Koushik Dutta
2024-08-11 17:58:44 -07:00
parent 43d30a91f9
commit 286aa61a18
4 changed files with 10 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/hikvision",
"version": "0.0.152",
"version": "0.0.153",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/hikvision",
"version": "0.0.152",
"version": "0.0.153",
"license": "Apache",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/hikvision",
"version": "0.0.152",
"version": "0.0.153",
"description": "Hikvision Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -19,6 +19,7 @@ export interface HikvisionAPI {
checkStreamSetup(channel: string, isOld: boolean): Promise<HikvisionCameraStreamSetup>;
jpegSnapshot(channel: string, timeout: number): Promise<Buffer>;
listenEvents(): Promise<Destroyable>;
putVcaResource(channel: string, resource: 'smart' | 'facesnap' | 'close'): Promise<boolean>;
getCodecs(camNumber: string): Promise<MediaStreamOptions[]>;
configureCodecs(camNumber: string, channelNumber: string, options: MediaStreamOptions): Promise<MediaStreamConfiguration>;
}
}

View File

@@ -9,6 +9,11 @@ export const hikvisionAutoConfigureSettings: Setting = {
};
export async function autoconfigureSettings(client: HikvisionAPI, camNumber: string) {
if (!await client.putVcaResource(camNumber + '01', 'close')) {
client.reboot();
throw new Error('Camera VCA resource was disabled to enable the third stream. Try again after the camera has completed rebooting.');
}
return ac(
() => client.getCodecs(camNumber),
(options) => {