slightly better remote desktop
This commit is contained in:
@@ -25,6 +25,7 @@ import { encodeMsgpack, decodeMsgpack } from "./msgpack-helpers.js";
|
||||
const kbdCtrl = document.getElementById("kbdCtrl");
|
||||
const cursorCtrl = document.getElementById("cursorCtrl");
|
||||
const duplicationCtrl = document.getElementById("duplicationCtrl");
|
||||
const resolutionSelect = document.getElementById("resolutionSelect");
|
||||
const smoothingSlider = document.getElementById("smoothingSlider");
|
||||
const smoothingValue = document.getElementById("smoothingValue");
|
||||
const qualitySlider = document.getElementById("qualitySlider");
|
||||
@@ -348,6 +349,20 @@ import { encodeMsgpack, decodeMsgpack } from "./msgpack-helpers.js";
|
||||
});
|
||||
}
|
||||
|
||||
function pushResolution() {
|
||||
if (resolutionSelect) {
|
||||
const maxHeight = parseInt(resolutionSelect.value, 10);
|
||||
console.debug("rd: pushResolution maxHeight=", maxHeight);
|
||||
sendCmd("desktop_set_resolution", { maxHeight: maxHeight });
|
||||
}
|
||||
}
|
||||
|
||||
if (resolutionSelect) {
|
||||
resolutionSelect.addEventListener("change", function () {
|
||||
pushResolution();
|
||||
});
|
||||
}
|
||||
|
||||
displaySelect.addEventListener("change", function () {
|
||||
console.debug("rd: select display", displaySelect.value);
|
||||
sendCmd("desktop_select_display", {
|
||||
@@ -364,6 +379,7 @@ import { encodeMsgpack, decodeMsgpack } from "./msgpack-helpers.js";
|
||||
if (qualitySlider) {
|
||||
pushQuality(qualitySlider.value);
|
||||
}
|
||||
pushResolution();
|
||||
desiredStreaming = true;
|
||||
lastFrameAt = 0;
|
||||
resetH264SessionState();
|
||||
|
||||
@@ -59,6 +59,20 @@
|
||||
>95%</span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
class="bg-slate-900/70 border border-slate-800 rounded-lg px-3 py-2 flex items-center gap-3 text-sm text-slate-300"
|
||||
>
|
||||
<label for="resolutionSelect" class="text-slate-200">Resolution</label>
|
||||
<select
|
||||
id="resolutionSelect"
|
||||
class="bg-slate-800 border border-slate-700 rounded px-2 py-1 text-slate-100"
|
||||
>
|
||||
<option value="720">720p</option>
|
||||
<option value="1080" selected>1080p</option>
|
||||
<option value="1440">1440p</option>
|
||||
<option value="-1">Native</option>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
class="bg-slate-900/70 border border-slate-800 rounded-lg px-3 py-2 flex items-center gap-3 text-sm text-slate-300"
|
||||
>
|
||||
|
||||
@@ -154,6 +154,7 @@ export const rdStreamingState = new Map<string, {
|
||||
quality: number;
|
||||
codec: string;
|
||||
duplication: boolean;
|
||||
maxHeight: number;
|
||||
}>();
|
||||
const rdInputPending = new Map<string, { clientId: string; sentAt: number; kind: string }>();
|
||||
const RD_INPUT_TTL_MS = 10_000;
|
||||
@@ -370,6 +371,16 @@ export function handleRemoteDesktopViewerMessage(ws: ServerWebSocket<SocketData>
|
||||
case "desktop_enable_cursor":
|
||||
sendDesktopCommand(target, "desktop_enable_cursor", { enabled: !!payload.enabled });
|
||||
break;
|
||||
case "desktop_set_resolution": {
|
||||
const newMaxHeight = Number(payload.maxHeight) || 0;
|
||||
if (state.maxHeight !== newMaxHeight) {
|
||||
sendDesktopCommand(target, "desktop_set_resolution", { maxHeight: newMaxHeight });
|
||||
state.maxHeight = newMaxHeight;
|
||||
rdStreamingState.set(clientId, state);
|
||||
logger.debug(`[rd] set max resolution height=${newMaxHeight}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "desktop_set_duplication": {
|
||||
const enabled = !!payload.enabled;
|
||||
if (state.duplication !== enabled) {
|
||||
|
||||
Reference in New Issue
Block a user