Explorar el Código

fix camera logic

Michael Wang hace 6 años
padre
commit
a01a3aeea7
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  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