fix: 修复数字人摄像头展示区域裁剪的问题

This commit is contained in:
zhuoqinglian
2026-03-31 10:34:38 +08:00
parent fd93116d69
commit 3c31231781
+2 -2
View File
@@ -192,7 +192,7 @@ class App {
} }
log('正在请求摄像头权限...', 'info'); log('正在请求摄像头权限...', 'info');
this.cameraStream = await navigator.mediaDevices.getUserMedia({ this.cameraStream = await navigator.mediaDevices.getUserMedia({
video: { width: 320, height: 240, facingMode: this.currentFacingMode }, video: { width: 180, height: 240, facingMode: this.currentFacingMode },
audio: false audio: false
}); });
cameraVideo.srcObject = this.cameraStream; cameraVideo.srcObject = this.cameraStream;
@@ -274,7 +274,7 @@ class App {
return; return;
} }
canvas.width = video.videoWidth || 320; canvas.width = video.videoWidth || 180;
canvas.height = video.videoHeight || 240; canvas.height = video.videoHeight || 240;
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, canvas.width, canvas.height); ctx.drawImage(video, 0, 0, canvas.width, canvas.height);