mirror of
https://github.com/SoPat712/maisie-heardle.git
synced 2025-08-21 10:18:45 -04:00
Very carefully making skip always continue playing audio
This commit is contained in:
@@ -325,12 +325,7 @@
|
||||
function skipIntro() {
|
||||
if (!widgetReady || gameOver) return;
|
||||
|
||||
skipInProgress = true; // guard the PAUSE handler
|
||||
widget.pause(); // PAUSE event will handle restart
|
||||
clearTimeout(snippetTimeout);
|
||||
currentPosition = 0;
|
||||
|
||||
// record the skip
|
||||
/*── 1 Record the skip attempt ──*/
|
||||
attemptInfos = [...attemptInfos, { status: 'skip' }];
|
||||
attemptCount++;
|
||||
userInput = '';
|
||||
@@ -338,8 +333,24 @@
|
||||
|
||||
if (attemptCount >= maxAttempts) {
|
||||
revealAnswer();
|
||||
return; // nothing more to do
|
||||
}
|
||||
|
||||
/*── 2 Decide how to advance ──*/
|
||||
if (isPlaying) {
|
||||
/* The usual case: we’re in the middle of a snippet.
|
||||
Guard PAUSE → playSegment() hand‑off exactly as before. */
|
||||
skipInProgress = true;
|
||||
clearTimeout(snippetTimeout);
|
||||
widget.pause(); // PAUSE handler will launch the next snippet
|
||||
} else {
|
||||
/* Player is already paused (or hasn’t started yet).
|
||||
Start the next snippet right away. */
|
||||
stopAllTimers(); // just in case something is still polling
|
||||
currentPosition = 0;
|
||||
/* No need for skipInProgress here – we’re bypassing the PAUSE pathway */
|
||||
playSegment();
|
||||
}
|
||||
// no playSegment() call here – PAUSE handler restarts next snippet
|
||||
}
|
||||
|
||||
function submitGuess() {
|
||||
|
Reference in New Issue
Block a user