浏览代码

摄像头比例与裁剪

Michael Wang 5 年之前
父节点
当前提交
1714e42c92
共有 2 个文件被更改,包括 6 次插入4 次删除
  1. 3 2
      src/components/FaceRecognition/FaceRecognition.vue
  2. 3 2
      src/features/OnlineExam/CheckComputer.vue

+ 3 - 2
src/components/FaceRecognition/FaceRecognition.vue

@@ -107,8 +107,9 @@ export default {
             video: {
               facingMode: "user",
               aspectRatio: 4 / 3,
-              // width: 400,
-              // height: this.showRecognizeButton ? 300 : 250
+              resizeMode: "crop-and-scale",
+              width: 400,
+              height: 300,
             },
           });
           if (stream) {

+ 3 - 2
src/features/OnlineExam/CheckComputer.vue

@@ -858,8 +858,9 @@ export default {
           const stream = await navigator.mediaDevices.getUserMedia({
             video: {
               facingMode: "user",
-              // width: 400,
-              // height: this.showRecognizeButton ? 300 : 250
+              resizeMode: "crop-and-scale",
+              width: 400,
+              height: 300,
             },
           });
           if (stream) {