mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 17:45:42 +00:00
a8f32a845f
- 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.
19 lines
709 B
JavaScript
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 };
|