From dc4f21da0fc47d92aaadcb111b72482fd8b1ca40 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 3 Mar 2022 20:58:04 -0800 Subject: [PATCH] onvif: publish with more logging --- plugins/onvif/package-lock.json | 4 ++-- plugins/onvif/package.json | 2 +- plugins/onvif/src/main.ts | 6 +----- plugins/onvif/src/onvif-intercom.ts | 7 +++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/plugins/onvif/package-lock.json b/plugins/onvif/package-lock.json index 77388dc97..382d5dd4e 100644 --- a/plugins/onvif/package-lock.json +++ b/plugins/onvif/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/onvif", - "version": "0.0.80", + "version": "0.0.81", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/onvif", - "version": "0.0.80", + "version": "0.0.81", "license": "Apache", "dependencies": { "@koush/axios-digest-auth": "^0.8.5", diff --git a/plugins/onvif/package.json b/plugins/onvif/package.json index f6f5bb2af..543441671 100644 --- a/plugins/onvif/package.json +++ b/plugins/onvif/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/onvif", - "version": "0.0.80", + "version": "0.0.81", "description": "ONVIF Camera Plugin for Scrypted", "author": "Scrypted", "license": "Apache", diff --git a/plugins/onvif/src/main.ts b/plugins/onvif/src/main.ts index 7c122464f..56c8c0ddf 100644 --- a/plugins/onvif/src/main.ts +++ b/plugins/onvif/src/main.ts @@ -1,11 +1,7 @@ -import sdk, { MediaObject, ScryptedInterface, Setting, ScryptedDeviceType, PictureOptions, VideoCamera, DeviceDiscovery, ObjectDetector, ObjectDetectionTypes, ObjectsDetected, Settings, Intercom, SettingValue, FFMpegInput, ScryptedMimeTypes } from "@scrypted/sdk"; +import sdk, { MediaObject, ScryptedInterface, Setting, ScryptedDeviceType, PictureOptions, VideoCamera, DeviceDiscovery, ObjectDetector, ObjectDetectionTypes, ObjectsDetected, Settings, Intercom, SettingValue } from "@scrypted/sdk"; import { EventEmitter, Stream } from "stream"; import { RtspSmartCamera, RtspProvider, Destroyable, UrlMediaStreamOptions } from "../../rtsp/src/rtsp"; import { connectCameraAPI, OnvifCameraAPI, OnvifEvent } from "./onvif-api"; -import { RtspClient } from "@scrypted/common/src/rtsp-server"; -import { findTrack } from "@scrypted/common/src/sdp-utils"; -import { ffmpegLogInitialOutput, safePrintFFmpegArguments } from "@scrypted/common/src/media-helpers"; -import child_process from 'child_process'; import xml2js from 'xml2js'; import onvif from 'onvif'; import { OnvifIntercom } from "./onvif-intercom"; diff --git a/plugins/onvif/src/onvif-intercom.ts b/plugins/onvif/src/onvif-intercom.ts index 8a20bcd5e..6678ee1b3 100644 --- a/plugins/onvif/src/onvif-intercom.ts +++ b/plugins/onvif/src/onvif-intercom.ts @@ -5,7 +5,7 @@ import { findTrack } from "@scrypted/common/src/sdp-utils"; import { ffmpegLogInitialOutput, safePrintFFmpegArguments } from "@scrypted/common/src/media-helpers"; import child_process from 'child_process'; -const { mediaManager, systemManager, deviceManager } = sdk; +const { mediaManager } = sdk; export class OnvifIntercom implements Intercom { intercomClient: RtspClient; @@ -29,11 +29,12 @@ export class OnvifIntercom implements Intercom { const describe = await this.intercomClient.describe({ Require, }); + this.camera.console.log('ONVIF Backchannel SDP:'); + this.camera.console.log(describe.body?.toString()); const audioBackchannel = findTrack(describe.body.toString(), 'audio', ['sendonly']); if (!audioBackchannel) throw new Error('ONVIF audio backchannel not found'); - this.camera.console.log('audio back channel track:', audioBackchannel); const rtp = Math.round(10000 + Math.random() * 30000); @@ -60,7 +61,6 @@ export class OnvifIntercom implements Intercom { const { server_port } = transportDict; const serverPorts = server_port.split('-'); const serverRtp = parseInt(serverPorts[0]); - const serverRtcp = parseInt(serverPorts[1]); const ffmpegInput = await mediaManager.convertMediaObjectToJSON(media, ScryptedMimeTypes.FFmpegInput); @@ -80,7 +80,6 @@ export class OnvifIntercom implements Intercom { ffmpegLogInitialOutput(this.camera.console, cp); - const play = await this.intercomClient.play(); this.camera.console.log('intercom playing'); }