Skip to content

Commit

Permalink
🐛 FIX: ios
Browse files Browse the repository at this point in the history
  • Loading branch information
yoanbernabeu committed Sep 22, 2024
1 parent 41956ab commit d36b448
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,23 @@ <h1>Le Cristal des Rêves - Minuteur</h1>
const easierModeCheckbox = document.getElementById('easierMode');
const endButton = document.getElementById('endButton');

startButton.addEventListener('click', startTimer);
addTimeButton.addEventListener('click', addOneMinute);
endButton.addEventListener('click', endGame);
startButton.addEventListener('click', () => {
// Initialiser le contexte audio lors du premier clic de l'utilisateur
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
startTimer();
});

endButton.addEventListener('click', () => {
// Vérifier si le contexte audio est initialisé avant de l'utiliser
if (audioContext) {
// Arrêter le contexte audio si nécessaire
audioContext.close();
audioContext = null;
}
endGame();
});

function startTimer() {
totalTime = parseInt(durationInput.value) * 60;
Expand All @@ -143,11 +157,6 @@ <h1>Le Cristal des Rêves - Minuteur</h1>
remainingTime = totalTime;
displayTime(remainingTime);

// Initialiser le contexte audio lors du premier clic de l'utilisateur
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}

loadAudioFiles().then(() => {
calculateSongSegments();
playAllSongs();
Expand Down

0 comments on commit d36b448

Please sign in to comment.