https://github.com/patrickmichalina/onvif-rx-angular
A thin wrapper around onvif-rx to communicate with ONVIF devices and cameras in Angular applications.
https://github.com/patrickmichalina/onvif-rx-angular
angular camera ipcamera onvif ptz typescript
Last synced: about 1 month ago
JSON representation
A thin wrapper around onvif-rx to communicate with ONVIF devices and cameras in Angular applications.
- Host: GitHub
- URL: https://github.com/patrickmichalina/onvif-rx-angular
- Owner: patrickmichalina
- Created: 2019-03-06T19:01:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T08:05:44.000Z (over 2 years ago)
- Last Synced: 2024-05-28T15:30:07.765Z (12 months ago)
- Topics: angular, camera, ipcamera, onvif, ptz, typescript
- Language: TypeScript
- Homepage:
- Size: 1.93 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
onvif-rx-angular
A thin wrapper around onvif-rx to communicate with ONVIF devices and cameras in Angular applications.
### Installation
`npm i onvif-rx-angular onvif-rx stream`
```js
import { NgModule } from '@angular/core';
import { ONVIFModule } from 'onvif-rx-angular';@NgModule({
...
imports: [
...,
ONVIFModule,
...
],
...
})
export class AppModule { }
```You will also need to somehow expose a global object for the Buffer polyfill. You can do this by adding
`(window as any).global = window;` to your `polyfills.ts` file.### Example Usage
```js
import { Component } from '@angular/core';
import { ONVIFService } from 'onvif-rx-angular';@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(private onvif: ONVIFService) { }device = this.onvif.createManagedDevice({
deviceUrl: 'http://192.168.1.142:80/onvif/device_service',
password: 'admin',
username: '123456'
});getSomeInfo = () =>
this.device.api.Media
.GetServiceCapabilities()
.toPromise()
.then(response => {
response.match({
fail: console.log,
ok: d => console.log(d.json)
});
})
}
```### Important
- Your device must return CORS headers otherwise browsers will reject the responses. You can either run this in Electron or setup a proxy server that appends response headers.