Skip to content

Commit

Permalink
remove audio preload
Browse files Browse the repository at this point in the history
  • Loading branch information
orsi committed Oct 13, 2020
1 parent af34686 commit 817dece
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions script/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ var AudioEngine = {
_initialized: false,
init: function () {
AudioEngine._initAudioContext();
// AudioEngine._preloadAudio(); // removed to save bandwidth
AudioEngine._initialized = true;
},
_preloadAudio: function () {
// start loading music and events early
// ** could be used later if we specify a better set of
// audio files to preload -- i.e. we probably don't need to load
// the later villages or events audio, and esp. not the ending
for (var key in AudioLibrary) {
if (
if (
key.toString().indexOf('MUSIC_') > -1 ||
key.toString().indexOf('EVENT_') > -1) {
AudioEngine.loadAudioFile(AudioLibrary[key]);
AudioEngine.loadAudioFile(AudioLibrary[key]);
}
}
AudioEngine._initialized = true;
},
_initAudioContext: function () {
AudioEngine._audioContext = new (window.AudioContext || window.webkitAudioContext);
Expand Down

0 comments on commit 817dece

Please sign in to comment.