jack %!s(int64=3) %!d(string=hai) anos
pai
achega
73f5ebe4d2
Modificáronse 1 ficheiros con 8 adicións e 6 borrados
  1. 8 6
      src/components/functionFan2.vue

+ 8 - 6
src/components/functionFan2.vue

@@ -108,7 +108,7 @@
 <style>
 .as {
   animation: myfirst 1s linear infinite;
-  }
+}
 
 .asn {
   transform: rotate(0deg);
@@ -231,6 +231,9 @@ export default {
       this.isCamera = true;
       let video = this.$refs["video"];
       var that = this;
+      if (this.detector == null) {
+        await this.fnInit();
+      }
       var f = window.requestAnimationFrame(function () {
         window.cancelAnimationFrame(f);
         setTimeout(function () {
@@ -290,7 +293,8 @@ export default {
         });
       } catch (e) {
         console.log(e);
-        return;
+        this.detector.dispose();
+        this.detector = null;
       }
       console.log(hands);
       if (hands.length > 0 && this.isCamera) {
@@ -413,7 +417,6 @@ export default {
         model,
         detectorConfig
       );
-      this.callCamera();
     },
     async fnsample() {
       const labeledFaceDescriptors = await Promise.all(
@@ -691,9 +694,8 @@ export default {
   },
   mounted() {
     this.blocklyInit();
-
-    this.fnInit();
-
+    await this.fnInit();
+    this.callCamera();
     this.videoEl = this.$refs.video;
     this.canvasEL = this.$refs.canvasDOM;
   },