Skip to content

Commit 94b247c

Browse files
committed
Forces a buffer refresh if sound is set to loop, and is already playing
Required to fix Firefox no longer looping #1442
1 parent 7c50da1 commit 94b247c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/howler.core.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,18 @@
14631463
if (loop) {
14641464
sound._node.bufferSource.loopStart = sound._start || 0;
14651465
sound._node.bufferSource.loopEnd = sound._stop;
1466+
1467+
if (self.playing(ids[i])) {
1468+
// Buffer needs to be refreshed if an active audio is playing as some browsers, like Firefox, will not loop otherwise
1469+
self._refreshBuffer(sound);
1470+
1471+
// Play the sound using the supported method.
1472+
if (typeof sound._node.bufferSource.start === 'undefined') {
1473+
sound._node.bufferSource.noteGrainOn(0, self.seek(ids[i]), 86400);
1474+
} else {
1475+
sound._node.bufferSource.start(0, self.seek(ids[i]), 86400);
1476+
}
1477+
}
14661478
}
14671479
}
14681480
}

0 commit comments

Comments
 (0)