{"name":"onvif","version":"0.2.6","author":{"name":"Andrew D.Laptev","email":"a.d.laptev@gmail.com"},"description":"Client to ONVIF NVT devices, especially cameras","main":"lib/onvif.js","scripts":{"test":"istanbul cover ./node_modules/.bin/_mocha","test-on-travis":"istanbul cover ./node_modules/.bin/_mocha --report lcovonly","test-coveralls":"istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage","upload-to-coveralls":"cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"},"repository":{"type":"git","url":"https://github.com/agsh/onvif.git"},"dependencies":{"xml2js":">=0.4.4"},"keywords":["onvif","video","PTZ","camera","RTSP"],"license":"MIT","engines":{"node":">=0.6"},"devDependencies":{"coveralls":">=2.11.2","istanbul":">=0.3.5","mocha":">=2.1.0","mocha-lcov-reporter":"0.0.1"},"gitHead":"a7268e5a5677427787e44a3eb2873032ec931297","bugs":{"url":"https://github.com/agsh/onvif/issues"},"homepage":"https://github.com/agsh/onvif","_id":"onvif@0.2.6","_shasum":"fe8fe50f1f18a49478e37af9d74d217b1967328b","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"agsh","email":"a.d.laptev@gmail.com"},"maintainers":[{"name":"agsh","email":"a.d.laptev@gmail.com"}],"dist":{"shasum":"fe8fe50f1f18a49478e37af9d74d217b1967328b","tarball":"https://registry.npmmirror.com/onvif/-/onvif-0.2.6.tgz","size":56462,"integrity":"sha512-emPpldGfEHYPEPjQhFmv7QpDzNuegajE/XKLB7ipWwttPtlCkOOv01k27neO30pyU5SfJ0XFHwI874A2+gqfmQ=="},"directories":{},"_cnpmcore_publish_time":"2021-12-21T02:14:18.693Z","readme":"# ONVIF\n\n[![Build Status](https://travis-ci.org/agsh/onvif.png)](https://travis-ci.org/agsh/onvif)\n[![Coverage Status](https://img.shields.io/coveralls/agsh/onvif.svg)](https://coveralls.io/r/agsh/onvif?branch=master)\n[![NPM version](https://badge.fury.io/js/onvif.png)](http://badge.fury.io/js/onvif)\n\nONVIF Client protocol Node.js implementation.\n\nThis is a wrapper to ONVIF protocol which allows you to get information about your NVT (network video transmitter)\ndevice, its media sources, control PTZ (pan-tilt-zoom) movements and manage presets.\n\n[![ONVIF](http://www.onvif.org/Portals/_default/Skins/onvif/images/logo-new.jpg)](http://onvif.org)\n\n## Supported methods\n* GetSystemDateAndTime\n* GetCapabilities\n* GetVideoSources\n* GetProfiles\n* GetServices\n* GetDeviceInformation\n* GetStreamUri\n* GetPresets\n* GotoPreset\n* RelativeMove\n* AbsoluteMove\n* ContinuousMove\n* Stop\n* GetStatus\n\n## Installation\n`npm install onvif`\n\n## Tests\nIn the library directory run `npm run-script test`\n\n## Quick example\nThis example asks your camera to look up and starts a web server at port 3030 that distributes a web page with vlc-plugin\ncontainer which translates video from the camera.\n```javascript\nvar\n http = require('http'),\n Cam = require('onvif').Cam;\n\nnew Cam({\n hostname: CAMERA_HOST,\n username: USERNAME,\n password: PASSWORD\n}, function(err) {\n this.absoluteMove({x: 1, y: 1, zoom: 1});\n this.getStreamUri({protocol:'RTSP'}, function(err, stream) {\n http.createServer(function (req, res) {\n res.writeHead(200, {'Content-Type': 'text/html'});\n res.end('
' +\n '' +\n '');\n }).listen(3030);\n });\n});\n```\n\n## Troubleshooting\nDifferent cameras have different ONVIF implementation. I've tested this module only with a couple of devices. So if you've\nexperience different problems with this library, please let me know via e-mail. Else please just send the model of your\ncamera to me.\n\n## API\n\n```javascript\nvar Cam = require('onvif').Cam;\n```\n\n### new Cam(options, callback)\n\nOptions are:\n- hostname\n- username, password (optional, to deal with majority functions)\n- port (optional)\n\nCallback (optional) executes when the cam is initialised. Single argument for this function is possible error.\n\n#### Technical description\n\nWhen the cam object creates it automatically sends three command to the ONVIF device:\n`getCapabilities`, `getVideoSources` and `getProfiles`. After that it fills correspondent properties of an object:\n\n+ capabilities\n - device\n - events\n - imaging\n - media\n - PTZ\n - extension\n+ uri (this is a links to different NVT services)\n+ videoSources\n - $.token\n - framerate\n - resolution\n+ profiles, array of profile object\n - name\n - videoSourceConfiguration\n - videoEncoderConfiguration\n - PTZConfiguration\n+ defaultProfile (link to the first profile in profiles)\n+ activeSource (based on the default profile)\n - sourceToken\n - profileToken\n - encoding\n - width\n - height\n - fps\n - bitrate\n - ptz\n\n### connect(callback)\nConnect to the camera and fill device information properties with `getCapabilities`, `getVideoSources`, `getProfiles` methods\n\nSee more detailed information at http://www.onvif.org/ver10/media/wsdl/media.wsdl\nAfter cam initialisation we can run several ONVIF commands.\nThere are several common methods that work without credentials. Here are they: `getSystemDateAndTime`.\n\n### getSystemDateAndTime(callback)\nReturns a Date object with current camera datetime in the callback.\nWorks without credentials (passed `username` and `password` arguments).\n\n### getDeviceInformation(callback)\n*Device.* Returns a device information, such as manufacturer, model and firmware version in the callback\nWorks without credentials (passed `username` and `password` arguments).\n\n### getServices(callback)\n*Device.* Returns in callback and assigns to `#services` property an array consists of objects with properties: `namespace`, `XAddr`, `version`\n\n### getServiceCapabilities(callback)\n*Device.* Returns in callback and assigns to `#serviceCapabilities` property the capabilities of the device service (not media):\nnetwork, security and system. If your device supports some auxiliary capabilities they will be there too.\n\n### getStreamUri(options, callback)\n*Media.* Returns a URI that can be used to initiate a live media stream using RTSP as the control protocol\nThe options are:\n\n- `stream` (optional) - defines if a multicast or unicast stream is requested. Possible values are: 'RTP-Unicast' (default), 'RTP-Multicast'\n- `protocol` (optional) - defines the network protocol for streaming. Possible values are: 'UDP', 'TCP', 'RTSP' (default), 'HTTP'\n- `profileToken` (optional) - defines media profile to use and will define the configuration of the content of the stream. Default is `#activeSource.profileToken`\n\n### getPresets(options, callback)\nReturns the saved presets as an a key-value object where the key is the name of a preset and a value is a preset token.\nThis method also stores the presets information in a `#presets` property of an object.\n\nThe options are:\n\n* `profileToken` (optional) - defines media profile to use and will define the configuration of the content of the stream. Default is `#activeSource.profileToken`\n\n### gotoPreset(options, callback)\nOperation to go to a saved preset position for the PTZ node in the selected profile.\n\nThe options are:\n\n* `profileToken` (optional) - defines media profile to use and will define the configuration of the content of the stream. Default is `#activeSource.profileToken`\n* `preset` - the name of preset. List of presets you can get by `#getPresets` method or in `#presets` property.\n\n### getNodes(callback)\n*PTZ.* Returns the properties of the current PTZ node, if it exists.\nUse this function to get maximum number of presets, ranges of admitted values for x, y, zoom, iris, focus.\nSets all information into `#nodes` property.\n\n### relativeMove(options, callback)\n*PTZ.* This is a relative pan-tilt-zoom method. Options for this method is a delta between desired and current position of the camera.\n\nThe options are:\n\n- `x` Pan, number or a string within -1 to 1, optional\n- `y` Tilt, number or a string within -1 to 1, optional\n- `zoom` Zoom, number or a string within -1 to 1, optional\n- `speed` An object with properties\n * `x` Pan speed\n * `y` Tilt speed\n * `zoom` Zoom speed\n\n If the speed option is omitted, the default speed set by the PTZConfiguration will be used.\n\nCallback is optional and means essentially nothing\n\n### absoluteMove(options, callback)\n*PTZ.* This is an absolute pan-tilt-zoom method. Options for this method is an absolute position of the camera.\n\nThe options are:\n\n- `x` Pan, number or a string within -1 to 1, optional\n- `y` Tilt, number or a string within -1 to 1, optional\n- `zoom` Zoom, number or a string within -1 to 1, optional\n- `speed` An object with properties\n * `x` Pan speed\n * `y` Tilt speed\n * `zoom` Zoom speed\n\n If the speed option is omitted, the default speed set by the PTZConfiguration will be used.\n\nCallback is optional and means essentially nothing\n\n### continuousMove(options, callback)\nOperation for continuous Pan/Tilt and Zoom movements\n\nThe options are:\n\n- `x` Pan velocity, number or a string within -1 to 1, optional\n- `y` Tilt velocity, number or a string within -1 to 1, optional\n- `zoom` Zoom velocity, number or a string within -1 to 1, optional\n- `timeout` Timeout in milliseconds, number. If timeout is omitted, movement will continue until `stop` command\n\n### stop(options, callback)\n*PTZ.* Stop ongoing pan, tilt and zoom movements of absolute relative and continuous type\n\nOptions and callback are optional. The options properties are:\n\n- `profileToken` (optional) - defines media profile to use and will define the configuration of the content of the stream. Default is `#activeSource.profileToken`\n- `panTilt` (optional) - set true when we want to stop ongoing pan and tilt movements. If `panTilt` arguments are not present, this command stops these movements.\n- `zoom` (optional) - set true when we want to stop ongoing zoom movement. If `zoom` arguments are not present, this command stops ongoing zoom movement.\n\n### getStatus(options, callback)\n*PTZ.* Returns an object with the current PTZ values.\n```javascript\n{\n\tposition: {\n\t\tx: 'pan position'\n\t\t, y: 'tilt position'\n\t\t, zoom: 'zoom'\n\t}\n\t, moveStatus: {} // camera moving\n\t, utcTime: 'current camera datetime'\n}\n```\n\n### getConfigurations(callback)\n*PTZ.* Get all the existing PTZConfigurations from the device. Configurations saved into `#configurations` property\n\n### getConfigurationOptions(configurationToken, callback)\n*PTZ.* Get supported coordinate systems including their range limitations for selected configuration. Extends corresponding\nconfiguration object\n\n## Links\nWSDL schemes and docs:\n- http://www.onvif.org/onvif/ver10/tc/onvif_core_ver10.pdf\n- http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl\n- http://www.onvif.org/ver10/media/wsdl/media.wsdl\n- http://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl\n"}