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 indexStore.sseConnected = false
errorCounter.value += 1 errorCounter.value += 1
if (errorCounter.value > 15) { if (errorCounter.value > 11) {
await authStore.obtainUuid() await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${ streamUrl.value = `/data/event/${configStore.configChannel[configStore.configID].id}?endpoint=playout&uuid=${
authStore.uuid authStore.uuid

View File

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

View File

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