mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 08:42:19 +00:00
pam-diff: fix session abruptly ending
This commit is contained in:
4
plugins/pam-diff/package-lock.json
generated
4
plugins/pam-diff/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/pam-diff",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/pam-diff",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@types/node": "^16.6.1",
|
||||
|
||||
@@ -43,5 +43,5 @@
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
},
|
||||
"version": "0.0.8"
|
||||
"version": "0.0.9"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FFmpegInput, MediaObject, ObjectDetection, ObjectDetectionModel, ObjectDetectionSession, ObjectsDetected, ScryptedDeviceBase, ScryptedInterface, ScryptedMimeTypes } from '@scrypted/sdk';
|
||||
import { FFmpegInput, MediaObject, ObjectDetection, ObjectDetectionCallbacks, ObjectDetectionModel, ObjectDetectionSession, ObjectsDetected, ScryptedDeviceBase, ScryptedInterface, ScryptedMimeTypes } from '@scrypted/sdk';
|
||||
import sdk from '@scrypted/sdk';
|
||||
import { ffmpegLogInitialOutput } from "../../../common/src/media-helpers";
|
||||
|
||||
@@ -39,16 +39,15 @@ class PamDiff extends ScryptedDeviceBase implements ObjectDetection {
|
||||
pds.timeout = setTimeout(() => this.endSession(pds), duration);
|
||||
}
|
||||
|
||||
async detectObjects(mediaObject: MediaObject, session?: ObjectDetectionSession): Promise<ObjectsDetected> {
|
||||
async detectObjects(mediaObject: MediaObject, session?: ObjectDetectionSession, callbacks?: ObjectDetectionCallbacks): Promise<ObjectsDetected> {
|
||||
if (mediaObject && mediaObject.mimeType?.startsWith('image/'))
|
||||
throw new Error('can not run motion detection on image')
|
||||
|
||||
let { detectionId } = session;
|
||||
let pds = this.sessions.get(detectionId);
|
||||
if (!mediaObject) {
|
||||
if (pds) {
|
||||
if (!session?.duration || !pds) {
|
||||
if (pds)
|
||||
this.endSession(pds);
|
||||
}
|
||||
return {
|
||||
detectionId,
|
||||
running: false,
|
||||
|
||||
Reference in New Issue
Block a user