onvif ptz 处理
简单记录下onvif 如何集成ptz 进行控制
参考代码
const onvif = require('node-onvif');
// Create an OnvifDevice object
let device = new onvif.OnvifDevice({
xaddr: 'http://xxxxxxxxx/onvif/device_service',
user : 'xxxxx',
pass : 'xxxxxxx'
});
// Initialize the OnvifDevice object
device.init().then(() => {
// Move the camera
return device.ptzMove({
'speed': {
x: 1.0, // Speed of pan (in the range of -1.0 to 1.0)
y: 0.0, // Speed of tilt (in the range of -1.0 to 1.0)
z: 0.0 // Speed of zoom (in the range of -1.0 to 1.0)
},
'timeout': 1 // seconds
});
}).then(() => {
console.log('Done!');
}).catch((error) => {
console.error(error);
});
说明
当前支持onvif 协议的包不少都比较老,但是基本够用,同时部分可能因为一些服务升级问题,造成并不能使用了,注意取舍以及修改(比如海康onvif 处理snaoshot的)
参考资料
https://www.npmjs.com/package/node-onvif
浙公网安备 33010602011771号