Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"profiles.forEach is not a function" exception #8

Closed
tosscaster opened this issue Mar 11, 2017 · 1 comment
Closed

"profiles.forEach is not a function" exception #8

tosscaster opened this issue Mar 11, 2017 · 1 comment

Comments

@tosscaster
Copy link

tosscaster commented Mar 11, 2017

OnvifDevice.prototype._mediaGetProfiles = function(callback) {

....
profiles.forEach((p) => { <== exception

events.js:163
throw er; // Unhandled 'error' event
^

TypeError: profiles.forEach is not a function
at OnvifDevice._mediaGetProfiles.callback.services.media.getProfiles (g:\Nodeproject\onvif\node-onvif\lib\modules\device.js:385:12)
at OnvifServiceMedia.getProfiles.mOnvifSoap.requestCommand (g:\Nodeproject\onvif\node-onvif\lib\modules\service-media.js:312:3)
at OnvifSoap.requestCommand.callback._request.parse (g:\Nodeproject\onvif\node-onvif\lib\modules\soap.js:71:8)
at OnvifSoap.parse.mXml2Js.parseString (g:\Nodeproject\onvif\node-onvif\lib\modules\soap.js:39:3)
at Parser. (g:\Nodeproject\onvif\node-onvif\node_modules\xml2js\lib\xml2js.js:489:18)
at emitOne (events.js:96:13)
at Parser.emit (events.js:191:7)
at SAXParser.onclosetag (g:\Nodeproject\onvif\node-onvif\node_modules\xml2js\lib\xml2js.js:447:26)
at emit (g:\Nodeproject\onvif\node-onvif\node_modules\sax\lib\sax.js:640:35)

-> looks like profiles is not array but object.

with soap message below

"
<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:chan="http://schemas.microsoft.com/ws/2005/02/duplex"
xmlns:wsa5="http://www.w3.org/2005/08/addressing" 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://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
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:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
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:tns1="http://www.onvif.org/ver10/topics"
xmlns:ter="http://www.onvif.org/ver10/error">
SOAP-ENV:Header</SOAP-ENV:Header>
SOAP-ENV:Body
trt:GetProfilesResponse
<trt:Profiles token="profile1" fixed="true">
tt:Nameprofile1</tt:Name>
<tt:VideoSourceConfiguration token="vsrc1">
tt:NameVideoSource1</tt:Name>
tt:UseCount1</tt:UseCount>
tt:SourceTokenvsrc1</tt:SourceToken>
<tt:Bounds x="0" y="0" width="1280" height="720"></tt:Bounds>
</tt:VideoSourceConfiguration>
<tt:VideoEncoderConfiguration token="venc1">
tt:NameVideoEncoder1</tt:Name>
tt:UseCount1</tt:UseCount>
tt:EncodingH264</tt:Encoding>
tt:Resolution
tt:Width1280</tt:Width>
tt:Height720</tt:Height>
</tt:Resolution>
tt:Quality50</tt:Quality>
tt:RateControl
tt:FrameRateLimit30</tt:FrameRateLimit>
tt:EncodingInterval1</tt:EncodingInterval>
tt:BitrateLimit30</tt:BitrateLimit>
</tt:RateControl>
tt:H264
tt:GovLength30</tt:GovLength>
tt:H264ProfileBaseline</tt:H264Profile>
</tt:H264>
tt:Multicast
tt:Address
tt:TypeIPv4</tt:Type>
tt:IPv4Address0.0.0.0</tt:IPv4Address>
</tt:Address>
tt:Port0</tt:Port>
tt:TTL0</tt:TTL>
tt:AutoStartfalse</tt:AutoStart>
</tt:Multicast>
tt:SessionTimeoutPT60S</tt:SessionTimeout>
</tt:VideoEncoderConfiguration>
</trt:Profiles>
</trt:GetProfilesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>"

@futomi
Copy link
Collaborator

futomi commented Mar 27, 2017

You use node v0.xx, don't you? The node-onvif supports node 4.4+ for now. In near future, the node-onvif will support only node 6+. I recommend node 6+.

@futomi futomi closed this as completed Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants