From bcc9be62e963dc889f3e5bd17abc33772d74486f Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 11 Aug 2024 00:58:34 -0700 Subject: [PATCH] reolink: update stream config with docs info and publish --- plugins/reolink/package-lock.json | 4 +-- plugins/reolink/package.json | 2 +- plugins/reolink/src/main.ts | 45 +++++++++++++++++++------------ plugins/reolink/tsconfig.json | 2 +- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/plugins/reolink/package-lock.json b/plugins/reolink/package-lock.json index f40e22f90..5a5d8b8b7 100644 --- a/plugins/reolink/package-lock.json +++ b/plugins/reolink/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/reolink", - "version": "0.0.91", + "version": "0.0.92", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/reolink", - "version": "0.0.91", + "version": "0.0.92", "license": "Apache", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/reolink/package.json b/plugins/reolink/package.json index 2e0097d1c..8c22285f7 100644 --- a/plugins/reolink/package.json +++ b/plugins/reolink/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/reolink", - "version": "0.0.91", + "version": "0.0.92", "description": "Reolink Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/reolink/src/main.ts b/plugins/reolink/src/main.ts index f858e29c8..8aca7255c 100644 --- a/plugins/reolink/src/main.ts +++ b/plugins/reolink/src/main.ts @@ -535,26 +535,37 @@ class ReolinkCamera extends RtspSmartCamera implements Camera, DeviceProvider, R } ]; - // this property seems to be: - // 1 (Doorbell): rtmp main, sub, ext + rtsp main, sub - // 2 (Duo 2): rtmp sub + rtsp main.sub - // 4k cams seem to be 2. - // unsure if there are other values - // update: unfortunately this property is unusable on the E1 Pro. - // However, the mainEncType property seems like a reliable marker - // const live = this.storageSettings.values.abilities?.value?.Ability?.abilityChn?.[0].live?.ver; - // if (live === 2) { - // // remove the rtmp main and ext - // streams.splice(0, 2); - // } + // abilityChn->live + // 0: not support + // 1: support main/extern/sub stream + // 2: support main/sub stream + const live = this.storageSettings.values.abilities?.value?.Ability?.abilityChn?.[0].live?.ver; + const [rtmpMain, rtmpExt, rtmpSub, rtspMain, rtspSub] = streams; + streams.splice(0, streams.length); + + // abilityChn->mainEncType + // 0: main stream enc type is H264 + // 1: main stream enc type is H265 + + // anecdotally, encoders of type h265 do not have a working RTMP main stream. const mainEncType = this.storageSettings.values.abilities?.value?.Ability?.abilityChn?.[0].mainEncType?.ver; - // 0 (Doorbell): rtmp main, sub, ext + rtsp main, sub - // 1 (Duo 2 + E1 Pro): rtmp sub + rtsp main, sub - if (mainEncType === 1) { - // remove the rtmp main and ext - streams.splice(0, 2); + + if (live === 2) { + if (mainEncType === 1) { + streams.push(rtmpSub, rtspMain, rtspSub); + } + else { + streams.push(rtmpMain, rtmpSub, rtspMain, rtspSub); + } } + else if (mainEncType === 1) { + streams.push(rtmpExt, rtmpSub, rtspMain, rtspSub); + } + else { + streams.push(rtmpMain, rtmpExt, rtmpSub, rtspMain, rtspSub); + } + if (deviceInfo?.model == "Reolink TrackMix PoE") { streams.push({ diff --git a/plugins/reolink/tsconfig.json b/plugins/reolink/tsconfig.json index 34a847ad8..ba9b4d395 100644 --- a/plugins/reolink/tsconfig.json +++ b/plugins/reolink/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "commonjs", + "module": "Node16", "target": "ES2021", "resolveJsonModule": true, "moduleResolution": "Node16",