onvif: use the proper onvif port as detected

This commit is contained in:
Koushik Dutta
2021-11-16 22:14:28 -08:00
parent d4a1cd06a8
commit f2f850a9d9
4 changed files with 10 additions and 3 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/onvif",
"version": "0.0.55",
"version": "0.0.56",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/onvif",
"version": "0.0.55",
"version": "0.0.56",
"license": "Apache",
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/onvif",
"version": "0.0.55",
"version": "0.0.56",
"description": "ONVIF Camera Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -271,7 +271,9 @@ class OnvifProvider extends RtspProvider {
interfaces: this.getInterfaces(),
});
const device = await this.getDevice(urn) as OnvifCamera;
const onvifUrl = new URL(xaddrs)
device.setIPAddress(rinfo.address);
device.setHttpPortOverride(onvifUrl.port);
this.log.a('Discovered ONVIF Camera. Complete setup by providing login credentials.');
}
);

View File

@@ -120,6 +120,7 @@ export class RtspCamera extends ScryptedDeviceBase implements Camera, VideoCamer
url.password = password;
const ret: FFMpegInput = {
url: url.toString(),
inputArguments: [
"-rtsp_transport",
"tcp",
@@ -434,6 +435,10 @@ export abstract class RtspSmartCamera extends RtspCamera {
return `${this.getIPAddress()}:${this.storage.getItem('httpPort') || 80}`;
}
setHttpPortOverride(port: string) {
this.storage.setItem('httpPort', port);
}
getRtspUrlOverride(options?: MediaStreamOptions) {
if (!this.showRtspUrlOverride())
return;