fix: do not drop WebRTC volume updates

This commit is contained in:
illusia committed 2026-09-04 19:39:45 +08:00
1 parent c38239ec35
commit cd49409800
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -925,7 +925,7 @@ async function handleCommand(
entry.webrtc?.setAccompanimentActive(command.payload.active as boolean);
} else if (command.type === "setMemberVolume") {
const clientId = command.payload.clientId as number;
if (entry.members.has(clientId)) entry.webrtc?.setMemberVolume(clientId, command.payload.volume as number);
entry.webrtc?.setMemberVolume(clientId, command.payload.volume as number);
}
if (command.requestId) sendJson({ type: "commandCompleted", requestId: command.requestId });
} catch (error: unknown) {
+2 -2
View File
@@ -1475,14 +1475,14 @@ export function useVoiceWebSocket() {
}
const gain = remoteGains.get(clientId);
if (gain) gain.gain.value = normalized * outputVolume.value;
if (webrtcActive.value) sendCmd("setMemberVolume", { clientId, volume: normalized });
if (webrtcPeer || webrtcActive.value) sendCmd("setMemberVolume", { clientId, volume: normalized });
}
function syncWebRtcMemberVolumes(): void {
if (!webrtcActive.value || ws.value?.readyState !== WebSocket.OPEN) return;
for (const [rawClientId, volume] of Object.entries(volumes)) {
const clientId = Number(rawClientId);
if (!Number.isInteger(clientId) || clientId <= 0 || volume === 1) continue;
if (!Number.isInteger(clientId) || clientId <= 0) continue;
sendCmd("setMemberVolume", { clientId, volume });
}
}