Commit 918c396286c4860daa9552059ed77cdd214ca7b3
Merge branch 'perf/video-out' into 'main_dev'
fix: 流媒体播放退出当前页面调用退出播放接口 See merge request yunteng/thingskit-front!1139
Showing
1 changed file
with
11 additions
and
4 deletions
... | ... | @@ -192,15 +192,22 @@ |
192 | 192 | } |
193 | 193 | }; |
194 | 194 | |
195 | - onMounted(() => { | |
196 | - getCameraList(); | |
197 | - }); | |
198 | - onUnmounted(() => { | |
195 | + const handleVideoOut = () => { | |
199 | 196 | if (unref(cameraList).length) { |
200 | 197 | unref(cameraList).forEach((item) => { |
201 | 198 | outVideo(item.id); |
202 | 199 | }); |
203 | 200 | } |
201 | + }; | |
202 | + | |
203 | + onMounted(() => { | |
204 | + getCameraList(); | |
205 | + }); | |
206 | + onUnmounted(() => { | |
207 | + handleVideoOut(); | |
208 | + }); | |
209 | + window.addEventListener('beforeunload', function () { | |
210 | + handleVideoOut(); | |
204 | 211 | }); |
205 | 212 | |
206 | 213 | const listEl = ref(); | ... | ... |