fix: restart skip grace period on isPlaying:true to suppress multi-fire buffering during seek

This commit is contained in:
Honey committed 2026-05-13 12:44:27 +02:00
1 parent d87abd2e9e
commit a1a4416bb6
1 file changed
+11 -3
+11 -3
View File
@@ -98,9 +98,17 @@ window.NSPlayer = {
onPlaybackStateChanged(stateJson) {
try {
const state = JSON.parse(stateJson);
if (state.isPlaying) { _skipping = false; clearTimeout(_skipTimer); }
// Suppress the transient isPlaying:false emitted by the native player during track transitions.
if (!state.isPlaying && _skipping) return;
if (_skipping) {
if (state.isPlaying) {
// isPlaying:true during skip/seek — restart grace period instead of clearing immediately,
// so a follow-up buffering false event is also suppressed.
clearTimeout(_skipTimer);
_skipTimer = setTimeout(() => { _skipping = false; }, 600);
} else {
// Suppress transient isPlaying:false during track transitions / seeks.
return;
}
}
const prev = _nativePlaying;
_nativePlaying = state.isPlaying;
if (state.isPlaying !== prev) {