ID Playing reset on stop - corrected

Corrected the ID playing from resetting when the Stop button is pressed.
This commit is contained in:
erew123 authored and GitHub committed 2024-03-17 12:51:41 +00:00
1 parent 47001203cd
commit ea551d3a84
1 file changed
+12 -12
@@ -1240,7 +1240,7 @@
} else { } else {
// In chunk mode, toggle the chunk play/pause // In chunk mode, toggle the chunk play/pause
if (isPlaying && currentlyPlayingIndex > 0) { if (isPlaying && currentlyPlayingIndex > 0) {
let currentSound = audioQueue[currentlyPlayingIndex - 1]; let currentSound = audioQueue[currentlyPlayingIndex - 3];
if (currentSound.playing()) { if (currentSound.playing()) {
currentSound.pause(); currentSound.pause();
} else { } else {
@@ -1268,14 +1268,14 @@
} }
function stopPlayback() { // function stopPlayback() {
Howler.stop(); // Howler.stop();
audioQueue = []; // audioQueue = [];
// Unload each sound in the queue // // Unload each sound in the queue
audioQueue.forEach(sound => sound.unload()); // audioQueue.forEach(sound => sound.unload());
currentlyPlayingIndex = 0; // //currentlyPlayingIndex = 0;
isPlaying = false; // isPlaying = false;
} // }
function updatePlaybackButton() { function updatePlaybackButton() {
const playbackButton = document.querySelector(".toggle-playback"); const playbackButton = document.querySelector(".toggle-playback");
@@ -1663,10 +1663,10 @@
function stopPlayback() { function stopPlayback() {
Howler.stop(); Howler.stop();
audioQueue = []; audioQueue = [];
currentlyPlayingIndex = 0; //currentlyPlayingIndex = 0;
isPlaying = false; isPlaying = false;
highlightPlaying(null); //highlightPlaying(null);
document.getElementById('startFromId').value = '1'; // Reset the startFromId input to 1 //document.getElementById('startFromId').value = '1'; // Reset the startFromId input to 1
} }
function displayOutput(result) { function displayOutput(result) {