Open TA2k opened 1 year ago
Thank you for the problem report and the offer of a PR. There may be a deeper problem here which I started looking at last weekend but did not have enough time.
When the library connects to the camera it calls Media1 API GetVideoSources and then matches the Tokens from with the Media2 GetProfiles.
GetVideoSources does not have an equivalent function in Media2. This could also be causing you problem. as well as the '$' from the XML parsing.
I do not know why ONVIF dropped this API, and we cannot ask them as none of us are ONVIF members.
GetVideoSources could tell you about all sources, even if there was no Profile assigned to them. But perhaps the design now is all sources will have one Profile (a profile that cannot be deleted) you can get a list of Video Sources from the list of Profiles. Or maybe we have to use Media2/GetVideoSourceConfigurations
Anyway, it may be worth looking at the GetVideoSources code too.
Here the corresponding GetVideoSources the videoSource.$.token is ''
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery"
xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex"
xmlns:wsa5="http://www.w3.org/2005/08/addressing"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2"
xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
xmlns:tdn="http://www.onvif.org/ver10/network/wsdl"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl"
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:tns1="http://www.onvif.org/ver10/topics"
xmlns:trt2="http://www.onvif.org/ver20/media/wsdl"
xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"
xmlns:ewsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
xmlns:exsd="http://www.onvifext.com/onvif/ext/ver10/schema"
xmlns:tnshik="http://www.hikvision.com/2011/event/topics"
xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema">
<SOAP-ENV:Header>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">=</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">==</wsse:Nonce>
<wsu:Created>2023-03-09T06:53:06.048Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<trt:GetVideoSourcesResponse>
<trt:VideoSources token="">
<tt:Framerate>0</tt:Framerate>
<tt:Resolution>
<tt:Width>0</tt:Width>
<tt:Height>0</tt:Height>
</tt:Resolution>
<tt:Imaging>
<tt:BacklightCompensation>
<tt:Mode>OFF</tt:Mode>
<tt:Level>0</tt:Level>
</tt:BacklightCompensation>
<tt:Brightness>50.1960793</tt:Brightness>
<tt:ColorSaturation>50.1960793</tt:ColorSaturation>
<tt:Contrast>50.1960793</tt:Contrast>
<tt:Focus>
<tt:AutoFocusMode>MANUAL</tt:AutoFocusMode>
<tt:DefaultSpeed>1</tt:DefaultSpeed>
<tt:NearLimit>1</tt:NearLimit>
<tt:FarLimit>10</tt:FarLimit>
</tt:Focus>
<tt:IrCutFilter>AUTO</tt:IrCutFilter>
<tt:Sharpness>50.1960793</tt:Sharpness>
<tt:WideDynamicRange>
<tt:Mode>ON</tt:Mode>
<tt:Level>1</tt:Level>
</tt:WideDynamicRange>
<tt:WhiteBalance>
<tt:Mode>AUTO</tt:Mode>
<tt:CrGain>128</tt:CrGain>
<tt:CbGain>128</tt:CbGain>
</tt:WhiteBalance>
</tt:Imaging>
</trt:VideoSources>
</trt:GetVideoSourcesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The attached /onvif/media2_service response from YMF52 NM223N AF leads to Error: Unrecognized configuration Because the VideoSource token not matching with the videoSource.$.token because the Name is used as Token.
Maybe we can relax the check https://github.com/agsh/onvif/blob/73f6e98122bea3eb454a4d24ffb23b480cb66cfe/lib/cam.js#L674
If the Name === Token it will also add to appropriateProfiles
PR for this https://github.com/agsh/onvif/pull/288