mirror of
https://github.com/koush/scrypted.git
synced 2026-02-10 09:12:03 +00:00
cameras: fix project files
This commit is contained in:
2
plugins/amcrest/.vscode/launch.json
vendored
2
plugins/amcrest/.vscode/launch.json
vendored
@@ -17,7 +17,7 @@
|
||||
"sourceMaps": true,
|
||||
"localRoot": "${workspaceFolder}/out",
|
||||
"remoteRoot": "/plugin/",
|
||||
"type": "pwa-node"
|
||||
"type": "node"
|
||||
}
|
||||
]
|
||||
}
|
||||
4
plugins/amcrest/package-lock.json
generated
4
plugins/amcrest/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.106",
|
||||
"version": "0.0.107",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.106",
|
||||
"version": "0.0.107",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.106",
|
||||
"version": "0.0.107",
|
||||
"description": "Amcrest Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -248,7 +248,6 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
|
||||
async getUrlSettings() {
|
||||
return [
|
||||
...await super.getUrlSettings(),
|
||||
{
|
||||
key: 'rtspChannel',
|
||||
title: 'Channel Number Override',
|
||||
@@ -257,6 +256,7 @@ class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration,
|
||||
placeholder: '1',
|
||||
value: this.storage.getItem('rtspChannel'),
|
||||
},
|
||||
...await super.getUrlSettings(),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
3
plugins/hikvision/.vscode/launch.json
vendored
3
plugins/hikvision/.vscode/launch.json
vendored
@@ -10,13 +10,14 @@
|
||||
"port": 10081,
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"**/plugin-remote-worker.*",
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"preLaunchTask": "scrypted: deploy+debug",
|
||||
"sourceMaps": true,
|
||||
"localRoot": "${workspaceFolder}/out",
|
||||
"remoteRoot": "/plugin/",
|
||||
"type": "pwa-node"
|
||||
"type": "node"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,14 +7,18 @@ If the camera or NVR do not have motion detection, you will have to use a separa
|
||||
|
||||
## Two Way Audio
|
||||
|
||||
Two Way Audio is supported if the audio codec is set to PCM-ULAW (G.711ulaw) on the camera. This audio codec will also work with HomeKit. Using ONVIF Two Way is recommended.
|
||||
There are two options for Two Way Audio:
|
||||
* ONVIF (Recommended)
|
||||
* HikVision (Untested)
|
||||
|
||||
## Codec Settings for HomeKit
|
||||
Two Way Audio is supported if the audio codec is set to G.711ulaw on the camera, which is usually the default audio codec. This audio codec will also work with HomeKit. Changing the audio codec from G.711ulaw will cause Two Way Audio to fail on the cameras that were tested.
|
||||
|
||||
## Codec Settings
|
||||
Configure optimal codec settings (as required by HomeKit) through HikVision's configuration webpage or device interface (not Scrypted).
|
||||
|
||||
HikVision's [iVMS 4200 software](https://www.hikvision.com/en/support/tools/), or similar, may be utilized to configure device as well as create a motion detection grid (required for motion detection and hardware dependent).
|
||||
HikVision's [iVMS 4200 software](https://www.HikVision.com/en/support/tools/), or similar, may be utilized to configure device as well as create a motion detection grid (required for motion detection and hardware dependent).
|
||||
|
||||
Generally, for newer devices the main stream (Stream 1) may be incompatible with HomeKit.
|
||||
Generally, for newer devices the main stream (Stream 1) may be incompatible with HomeKit as it only outputs HEVC.
|
||||
Configure and specify a substream instead (Stream 2 or 3).
|
||||
|
||||
The optimal/reliable codec settings can be found in the documentation for the [Homekit Plugin](https://github.com/koush/scrypted/tree/main/plugins/homekit).
|
||||
|
||||
4
plugins/hikvision/package-lock.json
generated
4
plugins/hikvision/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.98",
|
||||
"version": "0.0.100",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.98",
|
||||
"version": "0.0.100",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.98",
|
||||
"version": "0.0.100",
|
||||
"description": "HikVision Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -16,25 +16,6 @@ class HikVisionCamera extends RtspSmartCamera implements Camera, Intercom {
|
||||
onvifIntercom = new OnvifIntercom(this);
|
||||
cp: ChildProcess;
|
||||
|
||||
// bad hack, but whatever.
|
||||
codecCheck = (async () => {
|
||||
while (true) {
|
||||
try {
|
||||
const streamSetup = await this.client.checkStreamSetup(this.getRtspChannel(), await this.isOld());
|
||||
if (streamSetup.videoCodecType !== 'H.264') {
|
||||
this.log.a(`This camera is configured for ${streamSetup.videoCodecType} on the main channel. Configuring it it for H.264 is recommended for optimal performance.`);
|
||||
}
|
||||
if (!this.isAudioDisabled() && streamSetup.audioCodecType && streamSetup.audioCodecType !== 'AAC') {
|
||||
this.log.a(`This camera is configured for ${streamSetup.audioCodecType} on the main channel. Configuring it for AAC is recommended for optimal performance.`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (e) {
|
||||
await sleep(60000);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
constructor(nativeId: string, provider: RtspProvider) {
|
||||
super(nativeId, provider);
|
||||
|
||||
@@ -341,25 +322,35 @@ class HikVisionCamera extends RtspSmartCamera implements Camera, Intercom {
|
||||
const socket = this.cp.stdio[3] as Readable;
|
||||
|
||||
(async () => {
|
||||
const url = `http://${this.getHttpAddress()}/ISAPI/System/TwoWayAudio/channels/${this.getRtspChannel() || '1'}/audioData`;
|
||||
this.console.log('posting audio data to', url);
|
||||
|
||||
// seems the dahua doorbells preferred 1024 chunks. should investigate adts
|
||||
// parsing and sending multipart chunks instead.
|
||||
const passthrough = new PassThrough();
|
||||
this.getClient().digestAuth.request({
|
||||
httpsAgent: hikvisionHttpsAgent,
|
||||
method: 'PUT',
|
||||
url,
|
||||
headers: {
|
||||
'Content-Type': 'Audio/G.711Mu',
|
||||
// 'Connection': 'close',
|
||||
// 'Content-Length': '9999999'
|
||||
},
|
||||
data: passthrough,
|
||||
});
|
||||
|
||||
try {
|
||||
const open = `http://${this.getHttpAddress()}/ISAPI/System/TwoWayAudio/channels/${this.getRtspChannel() || '1'}/open`;
|
||||
const {data} = await this.getClient().digestAuth.request({
|
||||
httpsAgent: hikvisionHttpsAgent,
|
||||
method: 'PUT',
|
||||
url: open,
|
||||
});
|
||||
this.console.log('two way audio opened', data);
|
||||
|
||||
const url = `http://${this.getHttpAddress()}/ISAPI/System/TwoWayAudio/channels/${this.getRtspChannel() || '1'}/audioData`;
|
||||
this.console.log('posting audio data to', url);
|
||||
|
||||
// seems the dahua doorbells preferred 1024 chunks. should investigate adts
|
||||
// parsing and sending multipart chunks instead.
|
||||
this.getClient().digestAuth.request({
|
||||
httpsAgent: hikvisionHttpsAgent,
|
||||
method: 'PUT',
|
||||
url,
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
// 'Connection': 'close',
|
||||
'Content-Length': '0'
|
||||
},
|
||||
data: passthrough,
|
||||
});
|
||||
|
||||
|
||||
while (true) {
|
||||
const data = await readLength(socket, 1024);
|
||||
passthrough.push(data);
|
||||
|
||||
3
plugins/onvif/.vscode/launch.json
vendored
3
plugins/onvif/.vscode/launch.json
vendored
@@ -10,13 +10,14 @@
|
||||
"port": 10081,
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"**/plugin-remote-worker.*",
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"preLaunchTask": "scrypted: deploy+debug",
|
||||
"sourceMaps": true,
|
||||
"localRoot": "${workspaceFolder}/out",
|
||||
"remoteRoot": "/plugin/",
|
||||
"type": "pwa-node"
|
||||
"type": "node"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -34,6 +34,24 @@ class OnvifCamera extends RtspSmartCamera implements ObjectDetector, Intercom {
|
||||
rtspMediaStreamOptions: Promise<UrlMediaStreamOptions[]>;
|
||||
intercom = new OnvifIntercom(this);
|
||||
|
||||
constructor(nativeId: string, provider: RtspProvider) {
|
||||
super(nativeId, provider);
|
||||
|
||||
this.updateManagementUrl();
|
||||
}
|
||||
|
||||
updateManagementUrl() {
|
||||
const ip = this.storage.getItem('ip');
|
||||
if (!ip)
|
||||
return;
|
||||
const info = this.info || {};
|
||||
const managementUrl = `http://${ip}`;
|
||||
if (info.managementUrl !== managementUrl) {
|
||||
info.managementUrl = managementUrl;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
getDetectionInput(detectionId: any, eventId?: any): Promise<MediaObject> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
@@ -167,8 +185,6 @@ class OnvifCamera extends RtspSmartCamera implements ObjectDetector, Intercom {
|
||||
this.console.log('listening events');
|
||||
const events = client.listenEvents();
|
||||
events.on('event', (event, className) => {
|
||||
ret.emit('data', ...arguments);
|
||||
|
||||
if (event === OnvifEvent.MotionBuggy) {
|
||||
this.motionDetected = true;
|
||||
clearTimeout(motionTimeout);
|
||||
@@ -308,6 +324,8 @@ class OnvifCamera extends RtspSmartCamera implements ObjectDetector, Intercom {
|
||||
this.client = undefined;
|
||||
this.rtspMediaStreamOptions = undefined;
|
||||
|
||||
this.updateManagementUrl();
|
||||
|
||||
if (key !== 'onvifDoorbell' && key !== 'onvifTwoWay')
|
||||
return super.putSetting(key, value);
|
||||
|
||||
|
||||
@@ -73,7 +73,9 @@ export class OnvifCameraAPI {
|
||||
const ret = new EventEmitter();
|
||||
|
||||
this.cam.on('event', (event: any, xml: string) => {
|
||||
const eventTopic = stripNamespaces(event.topic._)
|
||||
ret.emit('data', xml);
|
||||
|
||||
const eventTopic = stripNamespaces(event.topic._);
|
||||
|
||||
if (event.message.message.data && event.message.message.data.simpleItem) {
|
||||
const dataValue = event.message.message.data.simpleItem.$.Value;
|
||||
|
||||
@@ -270,7 +270,7 @@ export abstract class RtspSmartCamera extends RtspCamera {
|
||||
key: 'debug',
|
||||
title: 'Debug Events',
|
||||
description: "Log all events to the console. This will be very noisy and should not be left enabled.",
|
||||
value: !!this.storage.getItem('debug'),
|
||||
value: this.storage.getItem('debug') === 'true',
|
||||
type: 'boolean',
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user