Ionic - onvif

Has someone worked on it?
I want to make it work on android and ios. Where should I find some good materials to discover how it works? (I found only https://www.onvif.org/wp-content/uploads/2016/12/ONVIF_WG-APG-Application_Programmers_Guide-1.pdf)

What is it?

ONVIF is an open industry forum that provides and promotes standardized interfaces
for effective interoperability of IP-based physical security products.

sounds not very relevant…

Ok. I’m introducing my problem.
I need to make an app which can provide the image stream (mostly it’s by rtsp). But making just only putting stream in text form like (192.168.0.100:554/givemestream) - it’s ridiculous way.
I want to make the possibility to scan local web and somehow later controlling the ONVIF camera but from for example mobile web (not only local way).

I’ve never heard of this ONVIF before, but perhaps you might be interested in ionic-native/zeroconf.

Yup, I’m very familiar with ONVIF. If you are asking about how ONVIF works, there is a spec, and there is reality. Many cameras do their own thing and its a mess. If you are asking if there are implementations you can use, the closest I can think of is https://github.com/agsh/onvif for something to start on. There are also C++ libs you can choose to compile and write a cordova wrapper around.

If I want to do it on my own what you recommend? (I mean what spec or anything else?)

This really isn’t a site for ONVIF questions. https://www.onvif.org/profiles/. Start with the core specs.

(Feel free to discuss everything that is slightly related to using this “onvif” stuff in Ionic here though.)

@AceBoy Did you make it? I’m sitting over a similar requirement.

Unfortunately not :frowning:

Cool! Working on it. Will keep you posted.

I’ve made some huge progress here! Let me know if you’re interested to know.

Still interested in :slight_smile:

Please share your code.I am working on implementing live streaming of onvif camera.
Please provide some pointers on how to code on CLICK TO CONNECT Button?

Aceboy +, Sorry for the delayed response. Here’s a brief note about it:

  • Install the onvif package through npm.
  • Comment the following line of code from node_modules/onvif/lib/onvif.js. Otherwise, an error will be thrown as the dgram module won’t work in browsers.

// require(’./discovery’).Discovery

  • Import the onvif module wherever needed

import { Cam } from ‘onvif’;

  • Here’s a sample code to initialise the cam as per the onvif documentation

this.pf.ready().then(() => {
console.log(“inside platform ready!”);
new Cam({
hostname: CAM_IP,
port: CAM_PORT,
username: CAM_USERNAME,
password: CAM_PASSWORD
}, function (err) {
if (err) return console.log(err);
this.absoluteMove({ x: 1, y: 1, zoom: 1 });
this.getStreamUri({ protocol: ‘RTSP’ }, function (err, stream) {
console.log(stream);
console.log(“window.plugins”, rtspVideo);
rtspVideo.play(stream.uri, function () {
console.log(‘Done Playing.’);
}, function (e) {
console.error('Error: ’ + e);
});
});
});
});

  • You’re good to go now. Hope this helps!

Thank you so much for the reply. Appreciate it.
I am getting error in line rtspVideo. Play(screen. Uri, function () {…}

The error is’‘Cannot find name’rtspVideo’.

Please share pointers on how to solve this…

That’s just an example. rtspVideo is another third-party plugin which you need to import. Check the docs here https://www.npmjs.com/package/cordova-rtsp