diff --git a/plugins/snapshot/package-lock.json b/plugins/snapshot/package-lock.json index ff50af1e6..075461137 100644 --- a/plugins/snapshot/package-lock.json +++ b/plugins/snapshot/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/snapshot", - "version": "0.0.12", + "version": "0.0.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/snapshot", - "version": "0.0.12", + "version": "0.0.13", "dependencies": { "@koush/axios-digest-auth": "^0.8.5", "@types/node": "^16.6.1", diff --git a/plugins/snapshot/package.json b/plugins/snapshot/package.json index beef8b31d..67fd17983 100644 --- a/plugins/snapshot/package.json +++ b/plugins/snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/snapshot", - "version": "0.0.12", + "version": "0.0.13", "description": "Snapshot Plugin for Scrypted", "scripts": { "prepublishOnly": "NODE_ENV=production scrypted-webpack", diff --git a/plugins/snapshot/src/main.ts b/plugins/snapshot/src/main.ts index b5c98f5c9..02672d8c9 100644 --- a/plugins/snapshot/src/main.ts +++ b/plugins/snapshot/src/main.ts @@ -100,17 +100,23 @@ class SnapshotMixin extends SettingsMixinDeviceBase implements Camera { } if (!takePicture) { - if (!this.storageSettings.values.snapshotUrl && this.mixinDeviceInterfaces.includes(ScryptedInterface.Camera)) { - takePicture = async () => { - // if operating in full resolution mode, nuke any picture options containing - // the requested dimensions that are sent. - if (this.storageSettings.values.snapshotResolution === 'Full Resolution' && options) - options.picture = undefined; - return this.mixinDevice.takePicture(options).then(mo => mediaManager.convertMediaObjectToBuffer(mo, 'image/jpeg')) - }; + if (!this.storageSettings.values.snapshotUrl) { + if (this.mixinDeviceInterfaces.includes(ScryptedInterface.Camera)) { + takePicture = async () => { + // if operating in full resolution mode, nuke any picture options containing + // the requested dimensions that are sent. + if (this.storageSettings.values.snapshotResolution === 'Full Resolution' && options) + options.picture = undefined; + return this.mixinDevice.takePicture(options).then(mo => mediaManager.convertMediaObjectToBuffer(mo, 'image/jpeg')) + }; + } + else { + takePicture = () => { + throw new Error('Snapshot Unavailable (snapshotUrl empty, and prebuffer not available or enabled)'); + } + } } else { - if (!this.axiosClient) { let username: string; let password: string;