Browse Source

fix: clear media live session when leaving live tab

Same-route tab switches do not unmount MediaView, so drop active
play state, heartbeat, and viewer lease when leaving 直播中心.
main
xiaosi 2 weeks ago
parent
commit
ebf9dd129e
  1. 13
      src/views/MediaView/MediaView.vue

13
src/views/MediaView/MediaView.vue

@ -89,6 +89,7 @@ watch(
(v) => { if (v) view.value = v }
)
function setView(v) {
if (!v || route.query.view === v) return
router.push({ name: 'media', query: { view: v } })
@ -268,6 +269,18 @@ async function download(v) {
}
}
// tab //viewer lease
watch(view, async (next, prev) => {
if (prev === 'live' && next !== 'live') {
openSeq += 1
await closeActiveLive()
return
}
if (next === 'live' && prev && prev !== 'live') {
await load()
}
})
onMounted(load)
onBeforeUnmount(() => {
openSeq += 1

Loading…
Cancel
Save