mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 02:43:55 +08:00
fix: 修复数字人摄像头展示区域裁剪的问题
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user