onvif icon indicating copy to clipboard operation
onvif copied to clipboard

Regression: getSnapshotUri() broken in master

Open sjkummer opened this issue 2 years ago • 5 comments

After Updating to the newest master getSnapshotUri() does not work correctly anymore, but throws an exception:

18:09:06.339 [WARN]  Failed to get camera snapshot: TypeError: Cannot read property 'media' of undefined
TypeError: Cannot read property 'media' of undefined
    at Cam._request (xxx/node_modules/onvif/lib/cam.js:215:15)
    at Cam.getSnapshotUri (/xxx/node_modules/onvif/lib/media.js:1132:9)

This worked in earlier versions.

Cam: Samsung Wisenet QND-7010R ... camera is not officially onvif certified, but the null pointer because of the missing null check is probably not good.

sjkummer avatar Apr 29 '22 16:04 sjkummer

@sjkummer Hi again! Also pls send me the response from the cam. This lib was written a long time ago. I'm trying to rewrite it in typescript and modern js, but I don't have time for that: https://github.com/agsh/onvif/tree/v1

agsh avatar Apr 30 '22 05:04 agsh

I wonder if the problem is the Media2 API changes.

About 4 months ago I added support for the Media2 APIs to allow me to get H265 stream details from newer cameras. That required me to implement a Media2 API version of getSnapshotUri.

Do you know what version you had that used to work?

Thanks Roger

RogerHardiman avatar May 01 '22 09:05 RogerHardiman

Bad news. My own Samsung Hanwha Wisenet camera has not come back up after recabling. It powered on once and ODM would see it on the network but did not give me any video. The web page did not load properly. After a power cycle it is dead. So I cannot test on my Wisenet camera.

We'll need you to capture the XML traffic and send it over.

RogerHardiman avatar May 01 '22 13:05 RogerHardiman

If you can give me some remote access t the camera, I can take a closer look

RogerHardiman avatar May 01 '22 18:05 RogerHardiman

Hey there, I tried to reproduce this issue today, but the behaviour was different.

media2Support was true today for that cam. When I got that null pointer / TypeError (original description), that was set to false. (But: when looking at the code, that TypeError might still happen when this.uri is missing at https://github.com/agsh/onvif/blob/master/lib/cam.js#L215 )

I am not sure whats different, but I got a successful response when using getSnapshotUri without options.

sjkummer avatar May 02 '22 21:05 sjkummer