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
This commit is contained in:
ed 2024-06-23 01:59:02 +02:00
parent 27aff12a1e
commit 55a011b9c1

View file

@ -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);
}