mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
ptzwawa
This commit is contained in:
@@ -7,6 +7,7 @@ const { getMode, MODES } = require('../modeManager');
|
||||
const { isAdmin, isLockdownAdmin, getRole } = require('../roleService');
|
||||
const videoSessions = require('../videoSessions');
|
||||
const roverManager = require('../roverManager');
|
||||
const ptzCameraService = require('../ptzCameraService');
|
||||
const { loadConfig } = require('../../helpers/configLoader');
|
||||
const { getSocketIp, isLocalNetwork } = require('../../helpers/ipResolver');
|
||||
|
||||
@@ -34,6 +35,8 @@ function buildWhepUrlForSource(source) {
|
||||
const segments = [];
|
||||
if (source.type === 'room') {
|
||||
segments.push('room', encodeURIComponent(source.id));
|
||||
} else if (source.type === 'ptz') {
|
||||
segments.push('ptz', encodeURIComponent(source.id));
|
||||
} else {
|
||||
segments.push(encodeURIComponent(source.id));
|
||||
}
|
||||
@@ -81,6 +84,9 @@ function normalizeRequest(payload = {}) {
|
||||
if (payload.roomCameraId) {
|
||||
return { type: 'room', id: String(payload.roomCameraId) };
|
||||
}
|
||||
if (payload.ptzCameraId || payload.type === 'ptz') {
|
||||
return { type: 'ptz', id: String(payload.ptzCameraId || payload.id || ptzCameraService.PTZ_CAMERA_ID) };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -109,6 +115,13 @@ io.on('connection', (socket) => {
|
||||
}
|
||||
} else if (target.type === 'room') {
|
||||
throw new Error('Room cameras now use the snapshot feed');
|
||||
} else if (target.type === 'ptz') {
|
||||
if (target.id !== ptzCameraService.PTZ_CAMERA_ID) {
|
||||
throw new Error('Unknown PTZ camera');
|
||||
}
|
||||
if (!ptzCameraService.canRequestLiveVideo(socket)) {
|
||||
throw new Error('Not authorized for PTZ video');
|
||||
}
|
||||
} else {
|
||||
throw new Error('Unsupported video source');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user