zuzzuz Posted June 11, 2014 Share Posted June 11, 2014 Hi i have problem with music on my webapp.I define a icon for play and pause the music in the menu'this is the code:BasicGame.Preloader.prototype = { preload: function () { this.game.load.audio('musica', 'Audio/bodenstaendig_2000_in_rock_4bit.mp3'); this.game.load.spritesheet('soundicons', 'assets/soundicons.png', 63, 63); // x, y of sprite images};create: function () { // Once the load has finished we disable the crop because we're going to sit in the update loop for a short while as the music decodes music = this.add.audio('musica'); music.play('', 0, 1, true); musicFlag=true; }, update: function () { if (this.cache.isSoundDecoded('musica') && this.ready == false) { this.ready = true; this.state.start('MainMenu'); } }};BasicGame.MainMenu.prototype = { create: function () { if(musicFlag==false) { music.play('', 0, 1, true); } this.soundSwitch = this.game.add.button(955, 5, 'soundicons', this.switchSound, this); //soundswitch} update : function() { // turning music on or off switchSound: function() { if (this.soundSwitch.frame === 0) { this.soundSwitch.frame = 1; music.pause(); // music is global so it will stay off } else { this.soundSwitch.frame = 0; music.resume(); } }};this is a part of my code where i use music. If i use it on pc with chrome, or firefox all works good, when i click on musicIcon the music play and resume, if i use on tablet or phone or internet explorer if i click music stop and start again from begin.Someone can help me? Link to comment Share on other sites More sharing options...
lrodriguez Posted June 21, 2014 Share Posted June 21, 2014 I have the same problem Link to comment Share on other sites More sharing options...
Videlais Posted June 22, 2014 Share Posted June 22, 2014 If i use it on pc with chrome, or firefox all works good, when i click on musicIcon the music play and resume, if i use on tablet or phone or internet explorer if i click music stop and start again from begin.Someone can help me? As the start to helping with this, are you using other file formats? Depending on the operating system and device, MP3 is not necessarily the best. Often, and this is especially true of Android devices, OGG works well as either a primary choice or a fallback for when MP3 is not working. To clarify, though, are you writing that it doesn't work as you think it should in Internet Explorer on a PC? Is that right? And for the tablet and phone, what operating system do they run? Is it iOS or Android -- or something Windows based? I ask because my first guess is that the underlining code in Internet Explorer doesn't support the pause and resume functionality. That is, it reads as if the code only works in Firefox and Chrome on the PC. In which case, it might mean trying something different. Link to comment Share on other sites More sharing options...
lrodriguez Posted June 22, 2014 Share Posted June 22, 2014 Thanks for your reply, in windows works fine in android is where the problem is, I have mp3 and ogg, I spent part of my code game.load.audio('blud', ['assets/sound/blud.mp3', 'assets/sound/blud.ogg']); game.load.audio('plam', ['assets/sound/64119_atari66_beeps.mp3', 'assets/sound/64119__atari66__beeps.ogg']); and a link where I see all the code https://github.com/luisrodriguezmartinez/Phaser-primer-Juego-.git Link to comment Share on other sites More sharing options...
Videlais Posted June 24, 2014 Share Posted June 24, 2014 Hi, zuzzuz. I know it has been many days since you posted this, but I just want to point you at a new post within the "Common Phaser + CocoonJS Issues" thread that should help with the sound problem. It should also already be fixed in the dev branch of Phaser too. The next version, once it comes out in a few weeks, shouldn't have this problem anymore. Link to comment Share on other sites More sharing options...
zuzzuz Posted July 13, 2014 Author Share Posted July 13, 2014 thanks Link to comment Share on other sites More sharing options...
Anh Nguyen Posted October 2, 2014 Share Posted October 2, 2014 It's really hard to work on Windows phone Link to comment Share on other sites More sharing options...
Recommended Posts