From 57a0e64f1617aabcad385b67cc6fc9fee8062a4b Mon Sep 17 00:00:00 2001
From: web <candymxq888@outlook.com>
Date: 星期六, 12 四月 2025 18:07:26 +0800
Subject: [PATCH] fix:对接监控

---
 src/components/VideoPlayer/VideoPlayer.vue |   52 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/src/components/VideoPlayer/VideoPlayer.vue b/src/components/VideoPlayer/VideoPlayer.vue
index fa912f6..ee5f2a8 100644
--- a/src/components/VideoPlayer/VideoPlayer.vue
+++ b/src/components/VideoPlayer/VideoPlayer.vue
@@ -18,6 +18,10 @@
     item: {
       type: Object,
       default: {}
+    },
+    autoPlay: {
+        type: Boolean,
+        default: false
     }
 });
 
@@ -67,32 +71,42 @@
     showPause.value = false;
 }
 
-const init = () => {
-	videojsb.value = new window.Jessibuca(
-		Object.assign({
-			container: videoRef.value,
-			isResize: true,
+// 实例化dom节点
+const initDom = async () => {
+    videojsb.value = new window.Jessibuca(
+        Object.assign({
+            container: videoRef.value,
+            isResize: true,
             isFullResize: true,
-			text: '',
+            text: '',
             videoBuffer: 2,
-			loadingText: '加载中...',
-			useMSE: true,
+            loadingText: '加载中...',
+            useMSE: true,
             useWCS: true,
             autoWasm: true,
-			// debug: true,
+            // debug: true,
             supportDblclickFullscreen: false,
-			operateBtns: {
-				fullscreen: true,
-				play: false,
-				audio: true,
-				recorder: false,
-			},
+            operateBtns: {
+                fullscreen: true,
+                play: false,
+                audio: true,
+                recorder: false,
+            },
             controlAutoHide: true,
-			forceNoOffscreen: true,
-			isNotMute: false,
+            forceNoOffscreen: true,
+            isNotMute: false,
             heartTimeoutReplay:false,
-		})
-	);
+        })
+    );
+}
+
+// 初始化
+const init = async () => {
+    await initDom()
+    // 自动播放
+    if(props.autoPlay && props.item.deviceId && props.item.channelId) {
+        handlePlayer()
+    }
 };
 
 onMounted(() => {

--
Gitblit v1.9.3