onvif icon indicating copy to clipboard operation
onvif copied to clipboard

getStreamUri not working correctly on multi channel NVR

Open skarotech opened this issue 7 months ago • 1 comments

I have an IVSEC NVR, with multiple cameras, the connect process is showing me the multiple profile tokens (via the profiles object)

profile_0_main profile_0_sub profile_1_main profile_1_sub etc...

and when calling the getStreamUri code (my code) // Retrieve the RTSP stream URI cam.getStreamUri({ protocol: 'RTSP'}, (err, stream) => { if (err) { console.log('{"rtsp":""}'); return; } const rtspUrl = new URL(stream.uri); const rtspPath = rtspUrl.pathname + rtspUrl.search; console.log('{"rtsp":"' + rtspPath + '"}');

// Extract RTSP port
const rtspPort = rtspUrl.port || (rtspUrl.protocol === 'rtsp:' ? 554 : '');
console.log('{"rtsp_port":"' + rtspPort + '"}');

});

it returns the default camera streams {"rtsp":"/rtsp/streaming?channel=1&subtype=0"} {"rtsp_port":"80"} {"mjpeg":"/rtsp/streaming?channel=1&subtype=0"} {"mjpeg_port":"80"} {"snapshot":"/onvif/snapshot?channel=1"}

HOWEVER when I adjust the code to add in the profile token eg cam.getStreamUri({ protocol: 'RTSP' , profileToken: 'profile_1_main'}, (err, stream) => {

I get no streams returned - is this a bug or expected behaviour with the library ?

skarotech avatar Jul 16 '24 04:07 skarotech