ソースを参照

fix camera logic

Michael Wang 6 年 前
コミット
a01a3aeea7
1 ファイル変更3 行追加2 行削除
  1. 3 2
      src/components/FaceRecognition/FaceRecognition.vue

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

@@ -79,8 +79,9 @@ export default {
           });
           if (stream) {
             video.srcObject = stream;
-            video.play();
-            if (video.readyState !== 4 || !video.srcObject.active) {
+            try {
+              await video.play();
+            } catch (error) {
               this.$Message.error({
                 content: "摄像头没有正常启用",
                 duration: 5