https://github.com/patrickmichalina/onvif-rx
📹 Communicate with ONVIF devices and cameras in server and browser environments.
https://github.com/patrickmichalina/onvif-rx
camera node nodejs onvif onvif-camera onvif-client ptz rxjs typescript
Last synced: 29 days ago
JSON representation
📹 Communicate with ONVIF devices and cameras in server and browser environments.
- Host: GitHub
- URL: https://github.com/patrickmichalina/onvif-rx
- Owner: patrickmichalina
- License: mit
- Created: 2019-01-03T23:39:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T04:26:49.000Z (about 2 years ago)
- Last Synced: 2025-03-29T23:32:12.143Z (about 2 months ago)
- Topics: camera, node, nodejs, onvif, onvif-camera, onvif-client, ptz, rxjs, typescript
- Language: TypeScript
- Homepage:
- Size: 1.79 MB
- Stars: 23
- Watchers: 1
- Forks: 12
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
onvif-rx
Interact with ONVIF cameras and devices using TypeScript and RXJS.

## About
This library aims to provide an easy way to interact with ONVIF devices from within Node. It is built with TypeScript to provide IDE's easy access to
documentation and typing information.The API is generated dynamically by reading ONVIF WSDL and XSD files.
This library is very early and not garaunteed to work for evey camera. Feel free to create a Github issue if it's not working for you.
This library does not "discover" devices on the network - for that try [onvif-probe-rx](https://github.com/patrickmichalina/onvif-probe-rx)
## Docs
For more information about the TypeScript API checkout the [generated API docs](docs/README.md).## Roadmap
- [x] Generate API with typings and docs from WSDL's and XSD's
- [x] Execute simple (parameter-less) requests
- [x] Execute requests with paremeters## Node Installation
This package is designed to be run in both the browser and node environments.
```sh
npm i onvif-rx
```## Browser Installation (expiremental)
```html
```
## Usage
The library is designed to be used in 2 distinct ways.
- [Managed](#managed-usage) - you construct a manged device using service URL and username/password combo. This makes running commands painless.
- [Ad Hoc](#ad-hoc-usage) - you can call methods individually with different username/passwords if needed.### Managed Usage
```ts
import { createManagedDeviceInNode } from 'onvif-rx'const device = createManagedDeviceInNode({
deviceUrl: 'http://192.168.1.11/onvif/device_service',
password: 'admin',
username: '1234'
})device.api.Device.GetUsers()
.toPromise()
.then(res=> {
res.match({ // results are wrapped in a managed object for safer processing
ok: success => console.log(success.json), // successful response object
fail: railure => console.log(railure.status, railure.statusMessage) // request failure object
})
})
```### Ad Hoc Usage
```ts
import { Device } from 'onvif-rx'
import { maybe } from 'typescript-monads'Device.GetUsers()
.run({
system: DEFAULT_NODE_ENV,
deviceUrl: 'http://192.168.1.11/onvif/device_service',
user: maybe({ // currently requires a wrapper object, will improve in the future
username: 'admin',
password: '1234'
})
})
.toPromise()
.then(res=> {
res.match({
ok: success => console.log(success.json), // successful response object
fail: railure => console.log(railure.status, railure.statusMessage) // request failure object
})
})
```