From 55a011b9c1c275193aa58f2f5c8f495d53db7708 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 23 Jun 2024 01:59:02 +0200 Subject: [PATCH] fix jank when trying to play a corrupt audio file if a song fails to play for some reason (network loss, corrupt file), a timer plays the next track after 5s the timer was not cancelled if the user started another track in the meantime --- copyparty/web/browser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index e2054ab2..1ce9d8ee 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -3061,6 +3061,7 @@ var afilt = (function () { // plays the tid'th audio file on the page function play(tid, is_ev, seek) { + clearTimeout(mpl.t_eplay); if (mp.order.length == 0) return console.log('no audio found wait what'); @@ -3193,7 +3194,7 @@ function play(tid, is_ev, seek) { toast.err(0, esc(L.mm_playerr + basenames(ex))); } clmod(ebi(oid), 'act'); - setTimeout(next_song, 5000); + mpl.t_eplay = setTimeout(next_song, 5000); } @@ -3271,7 +3272,7 @@ function evau_error(e) { return; } - setTimeout(next_song, 15000); + mpl.t_eplay = setTimeout(next_song, 15000); }