reload player on error

This commit is contained in:
jb-alvarado 2024-07-04 16:41:32 +02:00
parent e8fd6f65bf
commit 18518dd53a
3 changed files with 23 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<div class="w-full aspect-video">
<video v-if="streamExtension === 'flv'" ref="httpStreamFlv" controls />
<VideoPlayer
v-else-if="configStore.configChannel[configStore.configID]"
v-else-if="configStore.showPlayer && configStore.configChannel[configStore.configID]"
:key="configStore.configID"
class="live-player"
reference="httpStream"
@ -245,9 +245,9 @@ watch([status, error], async () => {
if (errorCounter.value > 11) {
await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${
authStore.uuid
}`
streamUrl.value = `/data/event/${
configStore.configChannel[configStore.configID].id
}?endpoint=playout&uuid=${authStore.uuid}`
errorCounter.value = 0
}
}
@ -309,7 +309,7 @@ function resetStatus() {
async function controlProcess(state: string) {
/*
Control playout systemd service (start, stop, restart)
Control playout (start, stop, restart)
*/
const channel = configStore.configChannel[configStore.configID].id

View File

@ -15,6 +15,8 @@
import videojs from 'video.js'
import 'video.js/dist/video-js.css'
const configStore = useConfig()
const player = ref()
const props = defineProps({
@ -42,6 +44,16 @@ onMounted(() => {
player.value.on('volumechange', () => {
localStorage.setItem('volume', player.value.volume())
})
player.value.on('error', () => {
setTimeout(() => {
configStore.showPlayer = false
nextTick(() => {
configStore.showPlayer = true
})
}, 2000)
})
})
onBeforeUnmount(() => {

View File

@ -15,6 +15,7 @@ export const useConfig = defineStore('config', {
configUser: {} as User,
utcOffset: 0,
onetimeInfo: true,
showPlayer: true,
}),
getters: {},