From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 20 七月 2022 15:05:58 +0800
Subject: [PATCH] 修复国标配置的bug

---
 src/components/wasmPlayer/index.vue |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/components/wasmPlayer/index.vue b/src/components/wasmPlayer/index.vue
index 43aca2c..ece0f02 100644
--- a/src/components/wasmPlayer/index.vue
+++ b/src/components/wasmPlayer/index.vue
@@ -12,7 +12,9 @@
       </div>
 
       <transition name="fade">
-        <div class="popuptext" id="myPopup" v-if="fullScreenNotice">璧勬簮涓嬭浇涓�,璇风◢鍚�...</div>
+        <div class="popuptext" id="myPopup" v-if="fullScreenNotice">
+          璧勬簮涓嬭浇涓�,璇风◢鍚�...
+        </div>
       </transition>
 
       <!-- 鎺у埗鏉� -->
@@ -58,7 +60,7 @@
 
         <!-- 鎾斁澶辫触 -->
         <span class="video-error" v-show="playerStatus == -1">
-          <i class="el-icon-warning-outline" style="font-size:40px"></i>
+          <i class="el-icon-warning-outline" style="font-size: 40px"></i>
           <br />
           瑙嗛鍔犺浇澶辫触 鏃犳晥鐨勮棰戝湴鍧�
         </span>
@@ -135,7 +137,7 @@
     return {
       player: null,
       playerId: 0,
-      Camera: new VideoRuleData(),
+      Camera: new VideoRuleData(this.cameraID, this.isGb),
       showCanvas: true,
       canvasData: {
         line: [],
@@ -172,6 +174,17 @@
           !!this.algoDataSocket && this.algoDataSocket.close()
         }
         this.$nextTick(() => {
+          this.playVideo()
+        })
+      }
+    },
+    videoUrl: function(newVal, oldVal) {
+      if (newVal !== oldVal) {
+        if (this.player) {
+          this.player.stop()
+        }
+        this.$nextTick(() => {
+          this.player.preloadFlag = 0
           this.playVideo()
         })
       }
@@ -247,9 +260,10 @@
         _this.canvas.style.cursor = "default"
       })
       _this.canvasData.polygon.forEach(function(v, i) {
-        if (v.location.length === 0) {
+        if (v.location && v.location.length === 0) {
           return
         }
+
         _this.ctx.strokeStyle = "yellow"
         _this.ctx.beginPath()
         _this.ctx.moveTo(v.location[0].x / _this.showProportion, v.location[0].y / _this.showProportionY)
@@ -406,7 +420,8 @@
     },
     setPlayerStatus(stat) {
       this.videoLoading = false
-      this.playerStatus = 1
+      // 鎺у埗鍔犺浇鍚庣殑鎾斁鎸夐挳鐘舵�侊紝瀹炴椂娴佷负鑷姩鎾斁锛岃棰戜负preload
+      this.playerStatus = this.isStream ? 1 : 0
     },
     stopVideo() {
       if (this.player.hPlayer == 0) return
@@ -498,7 +513,9 @@
   width: 100%;
   height: 100%;
 }
-
+#area-canvas {
+  z-index: 1;
+}
 video {
   object-fit: fill;
   width: 100%;

--
Gitblit v1.8.0