onvif: publish with more logging

This commit is contained in:
Koushik Dutta
2022-03-03 20:58:04 -08:00
parent 41834a5c6a
commit dc4f21da0f
4 changed files with 7 additions and 12 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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";

View File

@@ -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<FFMpegInput>(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');
}