@apocaliss92/scrypted-reolink-native 0.3.14 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.nodejs.js +1 -1
- package/dist/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/baichuan-base.ts +26 -1
- package/src/camera.ts +11 -0
package/dist/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/baichuan-base.ts
CHANGED
|
@@ -307,7 +307,7 @@ export abstract class BaseBaichuanClass extends ScryptedDeviceBase {
|
|
|
307
307
|
|
|
308
308
|
// Start ping and auto-renewal for TCP connections
|
|
309
309
|
if (this.transport === 'tcp') {
|
|
310
|
-
this.startConnectionMaintenance(api);
|
|
310
|
+
// this.startConnectionMaintenance(api);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// Start event check for all connections
|
|
@@ -823,6 +823,31 @@ export abstract class BaseBaichuanClass extends ScryptedDeviceBase {
|
|
|
823
823
|
return api;
|
|
824
824
|
}
|
|
825
825
|
|
|
826
|
+
/**
|
|
827
|
+
* Teardown a single stream client by streamKey.
|
|
828
|
+
*
|
|
829
|
+
* This is useful for non-stream features (e.g. intercom) that still use createStreamClient()
|
|
830
|
+
* and need to ensure the underlying Baichuan session is torn down at the end of the operation.
|
|
831
|
+
*/
|
|
832
|
+
async teardownStreamClient(streamKey: string, options?: { timeoutMs?: number }): Promise<void> {
|
|
833
|
+
const api = this.streamClients.get(streamKey);
|
|
834
|
+
// Remove first to avoid re-use while closing (and to ensure teardown even if close hangs).
|
|
835
|
+
this.streamClients.delete(streamKey);
|
|
836
|
+
if (!api) return;
|
|
837
|
+
|
|
838
|
+
const timeoutMs = options?.timeoutMs ?? 2000;
|
|
839
|
+
const sleepMs = async (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
840
|
+
|
|
841
|
+
try {
|
|
842
|
+
await Promise.race([
|
|
843
|
+
api.close({ reason: `teardownStreamClient:${streamKey}` }),
|
|
844
|
+
sleepMs(timeoutMs),
|
|
845
|
+
]);
|
|
846
|
+
} catch {
|
|
847
|
+
// ignore
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
826
851
|
/**
|
|
827
852
|
* Cleanup all stream clients (called during device cleanup)
|
|
828
853
|
*/
|
package/src/camera.ts
CHANGED
|
@@ -2794,11 +2794,22 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
|
|
|
2794
2794
|
this.storageSettings.settings.username.defaultValue = parentDevice.storageSettings.values.username;
|
|
2795
2795
|
this.storageSettings.settings.password.defaultValue = parentDevice.storageSettings.values.password;
|
|
2796
2796
|
this.storageSettings.settings.ipAddress.defaultValue = parentDevice.storageSettings.values.ipAddress;
|
|
2797
|
+
} else {
|
|
2798
|
+
this.storageSettings.settings.username.hide = false;
|
|
2799
|
+
this.storageSettings.settings.password.hide = false;
|
|
2800
|
+
this.storageSettings.settings.ipAddress.hide = false;
|
|
2801
|
+
this.storageSettings.settings.uid.hide = false;
|
|
2797
2802
|
}
|
|
2798
2803
|
|
|
2799
2804
|
this.updateVideoClipsAutoLoad();
|
|
2800
2805
|
|
|
2801
2806
|
this.onDeviceEvent(ScryptedInterface.Settings, '');
|
|
2807
|
+
|
|
2808
|
+
try {
|
|
2809
|
+
await this.getVideoStreamOptions();
|
|
2810
|
+
} catch (e) {
|
|
2811
|
+
logger.error('Failed to get video stream options in init', e?.message || String(e));
|
|
2812
|
+
}
|
|
2802
2813
|
}
|
|
2803
2814
|
|
|
2804
2815
|
async updateSleepingState(sleepStatus: SleepStatus): Promise<void> {
|