feat: enable looping for audio tracks
Ensure audio tracks loop continuously to improve user experience by maintaining audio ambiance without interruption. This change prevents abrupt stops when audio files reach their end, enhancing the seamlessness of sound playbacks.
This commit is contained in:
parent
efa5d905fe
commit
b2ec8b62cb
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,10 @@ const audioFiles = {
|
|||
rain: new Audio('audio/rain.mp3'),
|
||||
};
|
||||
|
||||
for (const audio in audioFiles) {
|
||||
audioFiles[audio].loop = true;
|
||||
}
|
||||
|
||||
function toggleSound() {
|
||||
if (!playing) {
|
||||
for (const audio in audioFiles) {
|
||||
|
|
Loading…
Reference in a new issue