not check for service as much

This commit is contained in:
2025-11-26 22:29:51 +00:00
parent 137a47808b
commit 43a130877e

View File

@@ -3,6 +3,7 @@
<audio v-if="streamLive" controls :src="streamUrl" ref="audio"></audio> <audio v-if="streamLive" controls :src="streamUrl" ref="audio"></audio>
<p v-else>Stream is currently offline.</p> <p v-else>Stream is currently offline.</p>
</div> </div>
<button @click="checkStream()" />
</template> </template>
<script setup> <script setup>
@@ -13,7 +14,7 @@ const streamUrl = ref("");
const streamLive = ref(false); const streamLive = ref(false);
const audio = ref(null); const audio = ref(null);
const checkStream = async () => { async function checkStream() {
try { try {
const res = await fetch("/radio/status-json.xsl"); // Icecast JSON status const res = await fetch("/radio/status-json.xsl"); // Icecast JSON status
const data = await res.json(); const data = await res.json();
@@ -29,14 +30,7 @@ const checkStream = async () => {
} catch (err) { } catch (err) {
streamLive.value = false; streamLive.value = false;
} }
}; }
// Check on mount
onMounted(() => {
checkStream();
// Poll every 10 seconds
setInterval(checkStream, 10000);
});
</script> </script>
<style scoped></style> <style scoped></style>