Audio - Strange Behaviour in Browser
Hi, i am trying to play music in my game and have Sound on/off switch. But when I open the game in a browser this does not work properly. See minimal example below. This works in the programming environment but not in the browser. In the browser music starts not from the beginning but after first click (and is played with full volume although variable volume=0) and cannot be muted although the volume variable works correctly. Does anybody have an idea? Thank you! Kristian
init = function()
volume=1
my_music=audio.playMusic("mus1",volume,true)
end
update = function()
if mouse.release then
volume=1-volume
my_music.setVolume(volume)
end
end
draw = function()
screen.clear("rgb(0,0,0)")
screen.drawText("Volume "+volume,0,0,20,"rgb(200,200,200)")
screen.drawText("Position "+my_music.getPosition(),0,-30,20,"rgb(200,200,200)")
end
