mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
fix audio playing
This commit is contained in:
@@ -7,12 +7,12 @@ const getData = async (path, last_id) => {
|
||||
const songs = ref(null);
|
||||
const folders = ref(null);
|
||||
|
||||
path = encodeURIComponent(path.replaceAll("/", "|"));
|
||||
const encoded_path = encodeURIComponent(path.replaceAll("/", "|"));
|
||||
|
||||
if (last_id) {
|
||||
url = `${folders_uri}/f/${path}::${last_id}`;
|
||||
url = `${folders_uri}/f/${encoded_path}::${last_id}`;
|
||||
} else {
|
||||
url = url = `${folders_uri}/f/${path}`;
|
||||
url = url = `${folders_uri}/f/${encoded_path}`;
|
||||
}
|
||||
|
||||
const res = await fetch(url);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user