mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-07 03:35:35 +00:00
fix audio playing
This commit is contained in:
parent
643aab1ad9
commit
847dabb9a4
@ -244,11 +244,9 @@ def getArtistData():
|
||||
def getFolderTree(folder: str = None):
|
||||
if folder == "$home":
|
||||
requested_dir = home_dir
|
||||
|
||||
else:
|
||||
try:
|
||||
req_dir, last_id = folder.split('::')
|
||||
print(req_dir)
|
||||
except (ValueError):
|
||||
req_dir = folder
|
||||
last_id = None
|
||||
|
@ -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();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user