From 4801a4a6f26d62e3c0aa92332805d676ee918db3 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 14 Apr 2025 17:01:41 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/drone/command-center-dashboard
---
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