switch playlist on channel change

This commit is contained in:
jb-alvarado 2024-06-24 07:51:50 +02:00
parent 0094b05957
commit 821ea78fd4
3 changed files with 15 additions and 3 deletions

View File

@ -243,7 +243,7 @@ watch([status, error], async () => {
indexStore.sseConnected = false
errorCounter.value += 1
if (errorCounter.value > 15) {
if (errorCounter.value > 11) {
await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${
authStore.uuid

View File

@ -137,6 +137,7 @@ const { processPlaylist, genUID } = playlistOperations()
const playlistContainer = ref()
const sortContainer = ref()
const todayDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const { configID } = storeToRefs(useConfig())
const { currentClipIndex, listDate } = storeToRefs(usePlaylist())
const playlistSortOptions = {
@ -164,8 +165,11 @@ onMounted(() => {
getPlaylist()
})
watch([listDate], () => {
watch([listDate, configID], () => {
getPlaylist()
setTimeout(() => {
getPlaylist()
}, 800)
})
defineExpose({

View File

@ -26,6 +26,7 @@ export const usePlaylist = defineStore('playlist', {
elapsedSec: 0,
shift: 0,
playoutIsRunning: false,
last_channel: 0,
}),
getters: {},
@ -46,6 +47,7 @@ export const usePlaylist = defineStore('playlist', {
const programData = processPlaylist(date, data.program, false)
if (
channel === this.last_channel &&
this.playlist.length > 0 &&
programData.length > 0 &&
(this.playlist[0].date === date || configStore.playout.playlist.infinit) &&
@ -64,12 +66,18 @@ export const usePlaylist = defineStore('playlist', {
indexStore.msgAlert('error', e.data, 5)
} else if (e.status >= 400) {
indexStore.msgAlert('error', e.data, 5)
} else if (this.playlist.length > 0 && this.playlist[0].date === date) {
} else if (
channel === this.last_channel &&
this.playlist.length > 0 &&
this.playlist[0].date === date
) {
indexStore.msgAlert('warning', $i18n.t('player.unsavedProgram'), 3)
} else {
this.playlist = []
}
})
this.last_channel = channel
},
setStatus(item: PlayoutStatus) {