fix audio playing

This commit is contained in:
geoffrey45
2021-12-19 14:40:27 +03:00
parent 643aab1ad9
commit 847dabb9a4
3 changed files with 10 additions and 7 deletions
+7 -2
View File
@@ -1,6 +1,11 @@
const playAudio = (path) => {
const audio = new Audio("http://127.0.0.1:8901" + path);
import { ref } from "@vue/reactivity";
const audio = ref(new Audio()).value;
const playAudio = (path) => {
const full_path = "http://127.0.0.1:8901/" + encodeURIComponent(path);
audio.src = full_path;
audio.addEventListener("canplaythrough", () => {
audio.play();
});