Compatibility tweak

alternate-visualiser
William Toohey 10 years ago
parent 9f675e7241
commit 6f3b9552cc
  1. 14
      js/SoundManager.js

@ -113,6 +113,7 @@ SoundManager.prototype.playSong = function(song, playBuild, callback) {
that.bufSource.connect(that.gainNode); that.bufSource.connect(that.gainNode);
// This fixes sync issues on Firefox and slow machines. // This fixes sync issues on Firefox and slow machines.
if(that.context.suspend && that.context.resume) {
that.context.suspend().then(function() { that.context.suspend().then(function() {
if(playBuild) { if(playBuild) {
// mobile webkit requires offset, even if 0 // mobile webkit requires offset, even if 0
@ -128,6 +129,19 @@ SoundManager.prototype.playSong = function(song, playBuild, callback) {
that.playing = true; that.playing = true;
}); });
}); });
} else {
if(playBuild) {
// mobile webkit requires offset, even if 0
that.bufSource.start(0);
that.startTime = that.context.currentTime + that.loopStart;
} else {
that.bufSource.start(0, that.loopStart);
that.startTime = that.context.currentTime;
}
if(callback)
callback();
that.playing = true;
}
} }
}); });
} }

Loading…
Cancel
Save