Expo9 Posted July 14, 2015 Share Posted July 14, 2015 Hi I'm trying to put music in my game but there is a really weird problem this.music=this.add.sound('Music',1,false);this.music.addMarker('Stage1',0,75);this.music.addMarker('Stage2',75,154,1,true);I created some Markers and then play the music in another js filethis.game.music.play('Stage1');The weird thing is that when I start the game the music doesn't sound at any moment, but when I change to another tab in the browser (Im using Google Chrome) and wait awhile ,then come back, the music sounds normally. I don't know what cause this Link to comment Share on other sites More sharing options...
rich Posted July 14, 2015 Share Posted July 14, 2015 Using an mp3 by any chance? Link to comment Share on other sites More sharing options...
rhllor Posted July 14, 2015 Share Posted July 14, 2015 Try this.add.audio This should work rhllor 1 Link to comment Share on other sites More sharing options...
Expo9 Posted July 14, 2015 Author Share Posted July 14, 2015 No I'm using .ogg this.load.audio('Music','Assets/music.ogg'); Link to comment Share on other sites More sharing options...
Expo9 Posted July 14, 2015 Author Share Posted July 14, 2015 Try this.add.audio This should workThanks rhllor now is working, but now the music starts after 3 seconds Link to comment Share on other sites More sharing options...
Expo9 Posted July 14, 2015 Author Share Posted July 14, 2015 Never mind I found the problem The music hasn't finished decoding. Thanks anyway Link to comment Share on other sites More sharing options...
rich Posted July 14, 2015 Share Posted July 14, 2015 There's an event you can wait for specifically to tell when audio is decoded. Link to comment Share on other sites More sharing options...
rhllor Posted July 15, 2015 Share Posted July 15, 2015 you're welcome Expo9 Link to comment Share on other sites More sharing options...
Recommended Posts