【m】增加画质选择

This commit is contained in:
2026-04-25 21:55:47 +08:00
parent d48ce78c03
commit fd06063d83
5 changed files with 331 additions and 32 deletions

View File

@@ -206,6 +206,10 @@ class UIRenderer {
// participant离开 - 更新UI但房间仍然存在
this.renderParticipantLeft(changes.connectionId);
break;
case 'RESOLUTION_CHANGED':
// 分辨率变化 - 更新UI中的分辨率选中状态
this.renderResolutionChanged(changes.resolution);
break;
}
}
@@ -254,6 +258,28 @@ class UIRenderer {
}
}
// 渲染分辨率变化
renderResolutionChanged(resolution) {
if (!resolution) return;
// 更新分辨率选项的选中状态
const options = document.querySelectorAll('.resolution-option');
options.forEach(btn => {
const btnRes = btn.dataset.resolution;
const isActive = (resolution.height >= 1440 && btnRes === '1440') ||
(resolution.height >= 1080 && resolution.height < 1440 && btnRes === '1080') ||
(resolution.height >= 720 && resolution.height < 1080 && btnRes === '720') ||
(resolution.height < 720 && btnRes === '480');
btn.classList.toggle('active', isActive);
});
// 更新当前分辨率文本
const currentResText = document.getElementById('currentResolutionText');
if (currentResText) {
currentResText.textContent = `当前: ${resolution.label}`;
}
}
// 渲染远端视频
renderRemoteVideo(remoteUser) {
// 同步更新侧边栏用户列表