Skip to content

Commit 3e1cb20

Browse files
committed
Simplify fix for looping in Firefox
1 parent cf485cc commit 3e1cb20

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/howler.core.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,21 +1466,10 @@
14661466
sound._node.bufferSource.loopStart = sound._start || 0;
14671467
sound._node.bufferSource.loopEnd = sound._stop;
14681468

1469+
// If playing, restart playback to ensure looping updates.
14691470
if (self.playing(ids[i])) {
1470-
// Buffer needs to be refreshed if an active audio is playing as some browsers, like Firefox, will not loop otherwise
1471-
if (typeof sound._node.bufferSource.stop === 'undefined') {
1472-
sound._node.bufferSource.noteOff(0);
1473-
} else {
1474-
sound._node.bufferSource.stop(0);
1475-
}
1476-
1477-
self._refreshBuffer(sound);
1478-
1479-
if (typeof sound._node.bufferSource.start === 'undefined') {
1480-
sound._node.bufferSource.noteGrainOn(0, self.seek(ids[i]), 86400);
1481-
} else {
1482-
sound._node.bufferSource.start(0, self.seek(ids[i]), 86400);
1483-
}
1471+
self.pause(ids[i], true);
1472+
self.play(ids[i], true);
14841473
}
14851474
}
14861475
}

0 commit comments

Comments
 (0)