diff --git a/plugins/hikvision/package-lock.json b/plugins/hikvision/package-lock.json index ba9062c3f..36f97f83b 100644 --- a/plugins/hikvision/package-lock.json +++ b/plugins/hikvision/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/hikvision", - "version": "0.0.26", + "version": "0.0.28", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/hikvision", - "version": "0.0.26", + "version": "0.0.28", "license": "Apache", "dependencies": { "@mhoc/axios-digest-auth": "^0.7.0", diff --git a/plugins/hikvision/package.json b/plugins/hikvision/package.json index af82cdb30..9c33daac3 100644 --- a/plugins/hikvision/package.json +++ b/plugins/hikvision/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/hikvision", - "version": "0.0.26", + "version": "0.0.28", "description": "HikVision Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/hikvision/src/hikvision-camera-api.ts b/plugins/hikvision/src/hikvision-camera-api.ts index 7422a2193..688571e56 100644 --- a/plugins/hikvision/src/hikvision-camera-api.ts +++ b/plugins/hikvision/src/hikvision-camera-api.ts @@ -23,6 +23,11 @@ async function readEvent(readable: Readable): Promise { + async checkStreamSetup(): Promise { const response = await this.digestAuth.request({ method: "GET", responseType: 'text', @@ -42,7 +47,13 @@ export class HikVisionCameraAPI { // this is bad: // H.265 - return response.data.indexOf('>H.265') === -1; + const vcodec = response.data.match(/>(.*?)<\/videoCodecType>/); + const acodec = response.data.match(/>(.*?)<\/audioCompressionType>/); + + return { + videoCodecType: vcodec[1], + audioCodecType: acodec[1], + } } diff --git a/plugins/hikvision/src/main.ts b/plugins/hikvision/src/main.ts index 35c183b1d..2a29cccd8 100644 --- a/plugins/hikvision/src/main.ts +++ b/plugins/hikvision/src/main.ts @@ -42,9 +42,13 @@ class HikVisionCamera extends RtspSmartCamera implements Camera { const client = new HikVisionCameraAPI(this.getHttpAddress(), this.getUsername(), this.getPassword()); (async() => { - if (!await client.isH264Stream()) { + const streamSetup = await client.checkStreamSetup(); + if (streamSetup.videoCodecType !== 'H.264') { this.log.a('This camera is configured for H.265 on the main channel. Configuring it it for H.264 is recommended for optimal performance.'); } + if (streamSetup.audioCodecType !== 'AAC') { + this.log.a('This camera is configured for H.265 on the main channel. Configuring it it for AAC is recommended for optimal performance.'); + } })(); return client; } @@ -63,7 +67,6 @@ class HikVisionProvider extends RtspProvider { getAdditionalInterfaces() { return [ ScryptedInterface.Camera, - ScryptedInterface.AudioSensor, ScryptedInterface.MotionSensor, ]; }