fix(music): audio element yüklenme düzelt
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { onMount, tick } from "svelte";
|
||||
import { API, apiFetch, withToken } from "../utils/api.js";
|
||||
import { musicCount } from "../stores/musicStore.js";
|
||||
import { cleanFileName } from "../utils/filename.js";
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
|
||||
// Player functions
|
||||
function playTrack(item, index) {
|
||||
async function playTrack(item, index) {
|
||||
if (currentTrack?.id === item.id) {
|
||||
togglePlay();
|
||||
return;
|
||||
@@ -87,14 +87,14 @@
|
||||
duration = item.mediaInfo?.format?.duration || 0;
|
||||
isPlaying = true;
|
||||
|
||||
if (audioEl) {
|
||||
await tick();
|
||||
if (!audioEl) return;
|
||||
audioEl.src = streamURL(item);
|
||||
audioEl.play().catch((err) => {
|
||||
console.error("Play error:", err);
|
||||
isPlaying = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function togglePlay() {
|
||||
if (!audioEl) return;
|
||||
|
||||
Reference in New Issue
Block a user