const path = require('path'); const express = require('express'); const router = express.Router(); const db = require(path.resolve(__dirname, '../_helpers/db.js')); const Camera = db.Camera; const { proxy, scriptUrl } = require('rtsp-relay')(router); console.log(`Connecting to camera: rtsp://${Camera.rtsp}`); const handler = proxy({ url: `rtsp://10.0.1.3:554/1`, // if your RTSP stream need credentials, include them in the URL as above verbose: false, additionalFlags: ['-q', '1'] }); router.ws('/', handler); module.exports = router;