Fix race condition on song load

master
William Toohey 9 years ago
parent d5503f5246
commit 8ac4b81477
  1. 8
      src/js/SoundManager.js

@ -285,9 +285,11 @@ SoundManager.prototype.clampedTime = function() {
SoundManager.prototype.loadSong = function(song) { SoundManager.prototype.loadSong = function(song) {
if(song._loadPromise) { if(song._loadPromise) {
// Someone went forward then immediately back then forward again /* Caused when moving back/forwards rapidly.
// Either way, the sound is still loading. It'll come back when it's ready The sound is still loading. We reject this promise, and the already
return song._loadPromise; running decode will finish and resolve instead.
NOTE: If anything but playSong calls loadSong, this idea is broken. */
return Promise.reject("Song changed between load and play - this message can be ignored");
} }
let buffers = {loop: null, buildup: null}; let buffers = {loop: null, buildup: null};

Loading…
Cancel
Save