Browse Source

add volume parameter to playSound()

readme-update
Simon Grim 9 years ago
parent
commit
9ac1daabf1
  1. 4
      js/mobile_abstract.js

4
js/mobile_abstract.js

@ -513,7 +513,7 @@ var MAL = function()
jQuery.MAL = new MAL; jQuery.MAL = new MAL;
function playSound(player, sound) { function playSound(player, sound, volume) {
if ($.mobile) { if ($.mobile) {
} else { } else {
var player = $('#'+player); var player = $('#'+player);
@ -526,7 +526,7 @@ function playSound(player, sound) {
else else
player.attr({type: 'audio/ogg', src: 'sound/' + sound + '.ogg'}); player.attr({type: 'audio/ogg', src: 'sound/' + sound + '.ogg'});
player[0].volume = $.Options.playerVol.val; player[0].volume = (typeof volume === 'number') ? volume : $.Options.playerVol.val;
player[0].play(); player[0].play();
} else } else
console.warn('cannot find player to play sound, selector: #'+player); console.warn('cannot find player to play sound, selector: #'+player);

Loading…
Cancel
Save