mirror of
https://github.com/SoPat712/maisie-heardle.git
synced 2025-08-21 18:28:45 -04:00
Very carefully making skip always continue playing audio
This commit is contained in:
@@ -325,12 +325,7 @@
|
|||||||
function skipIntro() {
|
function skipIntro() {
|
||||||
if (!widgetReady || gameOver) return;
|
if (!widgetReady || gameOver) return;
|
||||||
|
|
||||||
skipInProgress = true; // guard the PAUSE handler
|
/*── 1 Record the skip attempt ──*/
|
||||||
widget.pause(); // PAUSE event will handle restart
|
|
||||||
clearTimeout(snippetTimeout);
|
|
||||||
currentPosition = 0;
|
|
||||||
|
|
||||||
// record the skip
|
|
||||||
attemptInfos = [...attemptInfos, { status: 'skip' }];
|
attemptInfos = [...attemptInfos, { status: 'skip' }];
|
||||||
attemptCount++;
|
attemptCount++;
|
||||||
userInput = '';
|
userInput = '';
|
||||||
@@ -338,8 +333,24 @@
|
|||||||
|
|
||||||
if (attemptCount >= maxAttempts) {
|
if (attemptCount >= maxAttempts) {
|
||||||
revealAnswer();
|
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() {
|
function submitGuess() {
|
||||||
|
Reference in New Issue
Block a user