Files
BetterDesk/web-nodejs/lib/sessionMediaSync.js
T
UNITRONIX a8f32a845f feat: enhance multi-session viewer functionality
- Added session management features to synchronize media capture and input handling across active tabs.
- Updated audio handling to respect session activity and mute states.
- Improved clipboard functionality to only allow copying to local clipboard from the active session.
- Refactored input capture logic to ensure it only activates for the active viewer tab.
- Introduced a new `syncSessionMediaCapture` function to manage media input across sessions.
2026-06-14 10:09:59 +02:00

19 lines
709 B
JavaScript

'use strict';
/**
* Scope keyboard/mouse capture, inbound clipboard, and audio to the active
* streaming tab. Used by remote.js and unit tests.
*
* @param {Map<string, { deviceId: string, state: string, client?: { setSessionActive?: Function } }>} sessions
* @param {string|null} activeSessionId
*/
function syncSessionMediaCapture(sessions, activeSessionId) {
for (const session of sessions.values()) {
if (!session.client || typeof session.client.setSessionActive !== 'function') continue;
const active = session.deviceId === activeSessionId && session.state === 'streaming';
session.client.setSessionActive(active);
}
}
module.exports = { syncSessionMediaCapture };