-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
39 lines (35 loc) · 894 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Created by Andrew D.Laptev<a.d.laptev@gmail.com> on 1/21/15.
*/
var CAMERA_HOST = '192.168.68.111',
USERNAME = 'admin',
PASSWORD = '9999',
PORT = 80;
var http = require('http'),
Cam = require('./lib/onvif').Cam;
new Cam({
hostname: CAMERA_HOST,
username: USERNAME,
password: PASSWORD,
port: PORT
}, function(err) {
if (err) {
console.log('Connection Failed for ' + CAMERA_HOST + ' Port: ' + PORT + ' Username: ' + USERNAME + ' Password: ' + PASSWORD);
return;
}
console.log('CONNECTED');
this.absoluteMove({
x: 1
, y: 1
, zoom: 1
});
this.getStreamUri({protocol:'RTSP'}, function(err, stream) {
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(
'<html><body>' +
'<embed type="application/x-vlc-plugin" target="' + stream.uri + '"></embed>' +
'</boby></html>');
}).listen(3030);
});
});