Fix checkStream function and useTemplateRef instead of implicit
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m35s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m35s
This commit is contained in:
@@ -17,23 +17,25 @@
|
||||
<script setup>
|
||||
import Button from "@/components/input/Button.vue";
|
||||
import Header from "@/components/text/Header.vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, useTemplateRef, onMounted, nextTick } from "vue";
|
||||
import axios from "axios";
|
||||
|
||||
const streamUrl = ref("");
|
||||
const streamLive = ref(false);
|
||||
const audio = ref(null);
|
||||
const audio = useTemplateRef("audio");
|
||||
|
||||
async function checkStream() {
|
||||
try {
|
||||
await axios.head("/radio/stream");
|
||||
if (!streamLive.value) {
|
||||
streamLive.value = true;
|
||||
streamUrl.value = "/radio/stream";
|
||||
|
||||
await nextTick();
|
||||
if (audio.value) {
|
||||
audio.value.load();
|
||||
audio.value.volume = 0.2;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
streamLive.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user