mirror of
https://github.com/koush/scrypted.git
synced 2026-02-11 01:32:02 +00:00
amcrest: fix initial setup bug
This commit is contained in:
4
plugins/amcrest/package-lock.json
generated
4
plugins/amcrest/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.93",
|
||||
"version": "0.0.94",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.93",
|
||||
"version": "0.0.94",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.93",
|
||||
"version": "0.0.94",
|
||||
"description": "Amcrest Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -9,7 +9,6 @@ import net from 'net';
|
||||
import { listenZero } from "@scrypted/common/src/listen-cluster";
|
||||
import { readLength } from "@scrypted/common/src/read-stream";
|
||||
import { OnvifIntercom } from "../../onvif/src/onvif-intercom";
|
||||
import { parse } from "path";
|
||||
|
||||
const { mediaManager } = sdk;
|
||||
|
||||
@@ -30,7 +29,6 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
eventStream: Stream;
|
||||
cp: ChildProcess;
|
||||
client: AmcrestCameraClient;
|
||||
maxExtraStreams: Promise<number>;
|
||||
videoStreamOptions: Promise<UrlMediaStreamOptions[]>;
|
||||
onvifIntercom = new OnvifIntercom(this);
|
||||
|
||||
@@ -265,8 +263,8 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
async getConstructedVideoStreamOptions(): Promise<UrlMediaStreamOptions[]> {
|
||||
const client = this.getClient();
|
||||
|
||||
if (!this.maxExtraStreams) {
|
||||
this.maxExtraStreams = (async () => {
|
||||
if (!this.videoStreamOptions) {
|
||||
this.videoStreamOptions = (async () => {
|
||||
let mas: string;
|
||||
try {
|
||||
const response = await client.digestAuth.request({
|
||||
@@ -280,17 +278,11 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
catch (e) {
|
||||
this.console.error('error retrieving max extra streams', e);
|
||||
mas = this.storage.getItem('maxExtraStreams');
|
||||
this.maxExtraStreams = undefined;
|
||||
}
|
||||
return parseInt(mas) || 1;
|
||||
})();
|
||||
}
|
||||
|
||||
if (!this.videoStreamOptions) {
|
||||
this.videoStreamOptions = (async () => {
|
||||
const mas = await this.maxExtraStreams;
|
||||
const maxExtraStreams = parseInt(mas) || 1;
|
||||
const channel = parseInt(this.getRtspChannel()) || 1;
|
||||
const vsos = [...Array(mas + 1).keys()].map(subtype => this.createRtspMediaStreamOptions(`rtsp://${this.getRtspAddress()}/cam/realmonitor?channel=${channel}&subtype=${subtype}`, subtype));
|
||||
const vsos = [...Array(maxExtraStreams + 1).keys()].map(subtype => this.createRtspMediaStreamOptions(`rtsp://${this.getRtspAddress()}/cam/realmonitor?channel=${channel}&subtype=${subtype}`, subtype));
|
||||
|
||||
try {
|
||||
const capResponse = await client.digestAuth.request({
|
||||
@@ -364,7 +356,7 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
}
|
||||
|
||||
this.client = undefined;
|
||||
this.maxExtraStreams = undefined;
|
||||
this.videoStreamOptions = undefined;
|
||||
|
||||
super.putSetting(key, value);
|
||||
const doorbellType = this.storage.getItem('doorbellType');
|
||||
|
||||
Reference in New Issue
Block a user