From a7e6761ba0cfccdf33ed552eb2d3b783c8e4ab4a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 16 Apr 2025 20:49:12 +0800
Subject: [PATCH] feat:事件弹窗显示调整

---
 src/components/LiveVideo.vue |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/components/LiveVideo.vue b/src/components/LiveVideo.vue
index 77a7c5d..be0c852 100644
--- a/src/components/LiveVideo.vue
+++ b/src/components/LiveVideo.vue
@@ -20,6 +20,7 @@
 let liveVideoRef = ref(null);
 
 const play = (url) => {
+	pause();
   webrtcPlayer = new window.ZLMRTCClient.Endpoint({
     element: liveVideoRef.value, // video 标签
     debug: true, // 是否打印日志
@@ -73,6 +74,7 @@
     )
 };
 
+// 销毁
 const pause = () => {
   if (webrtcPlayer) {
     webrtcPlayer.close();
@@ -84,7 +86,6 @@
   (newValue) => {
     if (!newValue) return;
     nextTick(() => {
-      pause();
       play(newValue);
     });
   },
@@ -92,6 +93,10 @@
     immediate: true
   }
 );
+
+onBeforeUnmount(() => {
+	pause()
+})
 
 onMounted(() => {
   if (props.videoUrl) {
@@ -113,4 +118,4 @@
     object-fit: cover;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3