fix adit alert, get status from playout stat

This commit is contained in:
jb-alvarado 2023-10-20 08:28:09 +02:00
parent 70e87dce04
commit 50bee93c85
4 changed files with 3967 additions and 806 deletions

View File

@ -228,8 +228,9 @@ async function status() {
- animate timers - animate timers
- when clip end is reached call API again and set new values - when clip end is reached call API again and set new values
*/ */
await playlistStore.playoutStat()
playoutStatus() playoutStatus()
playlistStore.playoutStat()
async function setStatus(resolve: any) { async function setStatus(resolve: any) {
/* /*
@ -245,8 +246,8 @@ async function status() {
return return
} else if ((playlistStore.playoutIsRunning && playlistStore.remainingSec < 0) || timeInSec % 30 === 0) { } else if ((playlistStore.playoutIsRunning && playlistStore.remainingSec < 0) || timeInSec % 30 === 0) {
// When 30 seconds a passed, get new status. // When 30 seconds a passed, get new status.
await playlistStore.playoutStat()
playoutStatus() playoutStatus()
playlistStore.playoutStat()
} else if (!playlistStore.playoutIsRunning) { } else if (!playlistStore.playoutIsRunning) {
playlistStore.remainingSec = 0 playlistStore.remainingSec = 0
} }
@ -256,28 +257,15 @@ async function status() {
return new Promise((resolve) => setStatus(resolve)) return new Promise((resolve) => setStatus(resolve))
} }
async function playoutStatus() { function playoutStatus() {
/* /*
Check if playout is running, when yes set css class. When playout is running, set css class.
*/ */
const channel = configStore.configGui[configStore.configID].id if (playlistStore.playoutIsRunning) {
isPlaying.value = 'is-playing'
await $fetch(`/api/control/${channel}/process/`, { } else {
method: 'POST', isPlaying.value = ''
headers: { ...contentType, ...authStore.authHeader }, }
body: JSON.stringify({ command: 'status' }),
})
.then((response: any) => {
if (response === 'active') {
isPlaying.value = 'is-playing'
} else {
playlistStore.playoutIsRunning = false
isPlaying.value = ''
}
})
.catch(() => {
isPlaying.value = ''
})
} }
async function controlProcess(state: string) { async function controlProcess(state: string) {
@ -292,9 +280,9 @@ async function controlProcess(state: string) {
body: JSON.stringify({ command: state }), body: JSON.stringify({ command: state }),
}) })
setTimeout(() => { setTimeout(async () => {
await playlistStore.playoutStat()
playoutStatus() playoutStatus()
playlistStore.playoutStat()
}, 1000) }, 1000)
} }
@ -313,9 +301,9 @@ async function controlPlayout(state: string) {
body: JSON.stringify({ control: state }), body: JSON.stringify({ control: state }),
}) })
setTimeout(() => { setTimeout(async () => {
await playlistStore.playoutStat()
playoutStatus() playoutStatus()
playlistStore.playoutStat()
}, 1000) }, 1000)
} }
</script> </script>

4704
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "ffplayout-frontend", "name": "ffplayout-frontend",
"version": "0.4.1", "version": "0.4.2",
"description": "Web GUI for ffplayout", "description": "Web GUI for ffplayout",
"author": "Jonathan Baecker", "author": "Jonathan Baecker",
"private": true, "private": true,
@ -14,9 +14,9 @@
}, },
"dependencies": { "dependencies": {
"@nuxt/types": "^2.17.1", "@nuxt/types": "^2.17.1",
"@pinia/nuxt": "^0.4.11", "@pinia/nuxt": "^0.5.1",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"@vueuse/core": "^10.4.1", "@vueuse/core": "^10.5.0",
"bootstrap": "^5.3.2", "bootstrap": "^5.3.2",
"bootstrap-icons": "^1.11.1", "bootstrap-icons": "^1.11.1",
"cookie-universal-nuxt": "^2.2.2", "cookie-universal-nuxt": "^2.2.2",
@ -24,26 +24,26 @@
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mpegts.js": "^1.7.3", "mpegts.js": "^1.7.3",
"pinia": "^2.1.6", "pinia": "^2.1.7",
"sortablejs": "^1.15.0", "sortablejs": "^1.15.0",
"sortablejs-vue3": "^1.2.9", "sortablejs-vue3": "^1.2.9",
"splitpanes": "^3.1.5", "splitpanes": "^3.1.5",
"video.js": "^8.5.2", "video.js": "^8.6.0",
"vuedraggable": "^4.1.0" "vuedraggable": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/eslint-config": "^12.0.0", "@nuxtjs/eslint-config": "^12.0.0",
"@types/bootstrap": "^5.2.7", "@types/bootstrap": "^5.2.8",
"@types/lodash": "^4.14.199", "@types/lodash": "^4.14.200",
"@types/splitpanes": "^2.2.2", "@types/splitpanes": "^2.2.4",
"@types/video.js": "^7.3.52", "@types/video.js": "^7.3.55",
"eslint": "^8.50.0", "eslint": "^8.51.0",
"eslint-plugin-nuxt": "^4.0.0", "eslint-plugin-nuxt": "^4.0.0",
"fibers": "^5.0.3", "fibers": "^5.0.3",
"nuxt": "3.7.4", "nuxt": "3.8.0",
"postcss": "^8.4.30", "postcss": "^8.4.31",
"postcss-loader": "^7.3.3", "postcss-loader": "^7.3.3",
"sass": "^1.68.0", "sass": "^1.69.4",
"sass-loader": "^13.3.2" "sass-loader": "^13.3.2"
} }
} }

View File

@ -25,7 +25,7 @@ export const usePlaylist = defineStore('playlist', {
currentClipOut: 0, currentClipOut: 0,
ingestRuns: false, ingestRuns: false,
remainingSec: 0, remainingSec: 0,
playoutIsRunning: true, playoutIsRunning: false,
}), }),
getters: {}, getters: {},
@ -81,6 +81,7 @@ export const usePlaylist = defineStore('playlist', {
this.currentClipDuration = data.current_media.duration this.currentClipDuration = data.current_media.duration
this.currentClipIn = data.current_media.seek this.currentClipIn = data.current_media.seek
this.currentClipOut = data.current_media.out this.currentClipOut = data.current_media.out
this.remainingSec = data.remaining_sec
this.ingestRuns = data.ingest_runs this.ingestRuns = data.ingest_runs
} }
}) })