diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-27 19:12:06 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-27 19:12:06 -0400 |
commit | 4a91f3018f3d53708c07a62660bf97338e1503e0 (patch) | |
tree | 972973608b0d56180f8ba9e03646851ba878a176 | |
parent | c27f033f4d794e28f4a6939df87ba54336127af0 (diff) | |
download | html5ks-4a91f3018f3d53708c07a62660bf97338e1503e0.tar.xz html5ks-4a91f3018f3d53708c07a62660bf97338e1503e0.zip |
fix volume
-rw-r--r-- | www/js/api.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/www/js/api.js b/www/js/api.js index 21494a2..43692cf 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -36,12 +36,13 @@ window.html5ks.api = { html5ks.elements.audio[channel] = audio; audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]); audio.load(); - audio.volume = fade ? 0 : html5ks.persistent.settings.musicVolume; + var volume = html5ks.persistent.settings[channel + "Volume"]; + audio.volume = fade ? 0 : volume; audio.play(); audio.onplaying = function () { deferred.resolve(); if (fade) { - html5ks.api.set_volume(1, fade, channel); + html5ks.api.set_volume(volume, fade, channel); } }; audio.onerror = function () { |