fix infinite playback spin on servers with one single file

This commit is contained in:
ed 2023-07-23 14:52:42 +00:00
parent 8d376b854c
commit 1a658dedb7

View file

@ -2173,13 +2173,18 @@ function seek_au_sec(seek) {
} }
function song_skip(n) { function song_skip(n, dirskip) {
var tid = null; var tid = mp.au ? mp.au.tid : null,
if (mp.au) ofs = tid ? mp.order.indexOf(tid) : -1;
tid = mp.au.tid;
if (tid !== null) if (dirskip && ofs + 1 && ofs > mp.order.length - 2) {
play(mp.order.indexOf(tid) + n); toast.inf(10, L.mm_nof);
mpl.traversals = 0;
return;
}
if (tid)
play(ofs + n);
else else
play(mp.order[n == -1 ? mp.order.length - 1 : 0]); play(mp.order[n == -1 ? mp.order.length - 1 : 0]);
} }
@ -2194,8 +2199,9 @@ function next_song(e) {
function next_song_cmn(e) { function next_song_cmn(e) {
ev(e); ev(e);
if (mp.order.length) { if (mp.order.length) {
var dirskip = mpl.traversals;
mpl.traversals = 0; mpl.traversals = 0;
return song_skip(1); return song_skip(1, dirskip);
} }
if (mpl.traversals++ < 5) { if (mpl.traversals++ < 5) {
if (MOBILE && t_fchg && Date.now() - t_fchg > 30 * 1000) if (MOBILE && t_fchg && Date.now() - t_fchg > 30 * 1000)