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>
|
<script setup>
|
||||||
import Button from "@/components/input/Button.vue";
|
import Button from "@/components/input/Button.vue";
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, useTemplateRef, onMounted, nextTick } from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const streamUrl = ref("");
|
const streamUrl = ref("");
|
||||||
const streamLive = ref(false);
|
const streamLive = ref(false);
|
||||||
const audio = ref(null);
|
const audio = useTemplateRef("audio");
|
||||||
|
|
||||||
async function checkStream() {
|
async function checkStream() {
|
||||||
try {
|
try {
|
||||||
await axios.head("/radio/stream");
|
await axios.head("/radio/stream");
|
||||||
|
if (!streamLive.value) {
|
||||||
streamLive.value = true;
|
streamLive.value = true;
|
||||||
streamUrl.value = "/radio/stream";
|
streamUrl.value = "/radio/stream";
|
||||||
|
await nextTick();
|
||||||
if (audio.value) {
|
if (audio.value) {
|
||||||
audio.value.load();
|
audio.value.load();
|
||||||
audio.value.volume = 0.2;
|
audio.value.volume = 0.2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
streamLive.value = false;
|
streamLive.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user