Connect to multiple devices
See original GitHub issueHi! I recently install this plugin and im trying to use with express. I want to manipulate the camera from mobile app as client. The problem is that i need to connect multiple devices at the same time, depend of the client and available ip for his user. I want to know if it is possible and if there is some way to handle this situation. I recently was trying to return the cam instance as response, but later i cannot get uri.
var onvif = require('onvif');
var app = require('express')();
var bodyParser = require('body-parser')
var port = 3000
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
});
app.use(bodyParser.json());
app.get('/connect',(req,res)=>{
var body = req.body;
var camData = body['camData'];
return new onvif.Cam({
hostname: camData.ip,
port:camData.port,
username: camData.username,
password: camData.password
}, function(err) {
return res.send(this);
});
})
app.post('/getUri',(req,res)=>{
var body = req.body;
var cam = body['cam'];
console.log(cam);
cam.getStreamUri({}, function(err, stream) {
return res.send(stream);
})
})
app.listen(port, console.log);
Another question is, do i need to connect in every request? is the only solution? Im really noob at working with ONVIF protocol, so sorry if im not explaining well, but thank you anyway!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How To Connect Multiple Bluetooth Devices At Once: 5+1+1
Bluetooth multipoint allows a single peripheral, typically a headset, to connect to multiple primary Bluetooth devices like two smartphones. The two host ...
Read more >How to Connect Multiple Bluetooth Speakers to One Device
Go to Settings > Connections > Bluetooth. · Tap Advanced. · Turn on the Dual Audio toggle switch. · To use Dual Audio,...
Read more >How to Connect Multiple Bluetooth Speakers ... - Gadgets 360
Android users need to go to Bluetooth Settings and pair either Bluetooth headphones or speakers one by one. Once connected, tap the three-dot ......
Read more >What is Bluetooth multipoint, and why isn't it more popular?
It's a feature that allows a single Bluetooth headset to maintain simultaneous connections to at least two source devices like a laptop and ......
Read more >How to Connect Multiple Bluetooth Audio Devices on Windows
How to Connect Multiple Bluetooth Audio Devices on Windows ; Press Win + X and select Device Manager from the options. Double-click on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much @agsh . Seriously this help me a lot, i was thinking in implement something like that but i didnt know if it was right. Now i have an idea about how to face the situation! 👍
@Motoralfa you can use a Map in which you can store different cams and in the
/getUri
endpoint send also info which cam you want. Or store in the user’s session this info. Or something else… I don’t know your current case. Simple example with host-port info: