Fix firefox sync, finally!

alternate-visualiser
Will Toohey 10 years ago
parent 009206ce00
commit bf4cfe4da5
  1. 24
      js/SoundManager.js

@ -111,17 +111,19 @@ SoundManager.prototype.playSong = function(song, playBuild, callback) {
if(callback) if(callback)
callback(); callback();
if(playBuild) { // This fixes sync issues on Firefox and slow machines.
// mobile webkit requires offset, even if 0 that.context.suspend().then(function() {
that.bufSource.start(0); if(playBuild) {
that.startTime = that.context.currentTime + that.loopStart; // mobile webkit requires offset, even if 0
} else { that.bufSource.start(0);
that.bufSource.start(0, that.loopStart); that.startTime = that.context.currentTime + that.loopStart;
that.startTime = that.context.currentTime; } else {
} that.bufSource.start(0, that.loopStart);
// offset to after the build that.startTime = that.context.currentTime;
//that.startTime = that.context.currentTime + that.loopStart; }
that.playing = true; that.context.resume();
that.playing = true;
});
} }
}); });
} }

Loading…
Cancel
Save