arturomf Posted April 4, 2017 Share Posted April 4, 2017 Hi all: I'm new in community. I have been searching these great forums for a solution for days, but i had no luck. I'm developing a game with phaser (2.6.2) and all has been working until testing on ipad. I have no sounds at all, but all seems to be working ok. Sounds are working in all platforms except IOS (9.5.4). I have tested with a button on my game but it doesn't sound. It seems to be "running" but like muted... I have compiled game with phonegap and again, sound works in Android but not in IOS. All Audio Examples in https://phaser.io/examples don't work either. I have test it with mp3 file, m4a file, different bitrates but nothing works. I have been looking for a solution for days, but no one is working for me. I load sound in preload state function: game.load.audio('music_main_menu', ["assets/audio/m4a/menu_main.m4a", "assets/audio/ogg/menu_main.ogg"] this.sound = game.add.audio("music_main_menu"); and then, create a button in create function: button = game.add.button(game.world.centerX + 350, game.world.centerY + 150, 'btn_test_audio', this.actionOnClick, this, 2, 1, 0); Then, i have this in action click function: this.sound.play("",0,1,true); After loading it, that is what i see with game.sound.debugInfo on render (time is running): I'm debuuging Ipad remotely with Safari and there is no errors in console, and it is loading m4a file. Please, someone has lead with a similar problem and could help me? Thanks in advance. Link to comment Share on other sites More sharing options...
afcruzs Posted April 6, 2017 Share Posted April 6, 2017 Have you seen this?: http://phaser.io/docs/2.4.7/Phaser.SoundManager.html There seems to be issues with the iPad: "Mobile warning: There are some mobile devices (certain iPad 2 and iPad Mini revisions) that cannot play 48000 Hz audio. When they try to play the audio becomes extremely distorted and buzzes, eventually crashing the sound system. The solution is to use a lower encoding rate such as 44100 Hz. Sometimes the audio context will be created with a sampleRate of 48000. If this happens and audio distorts you should re-create the context." Link to comment Share on other sites More sharing options...
arturomf Posted April 19, 2017 Author Share Posted April 19, 2017 Thanks for the answer. All my audios are 44100Hz ogg , m4a and mp3 format. I have test with lower encoding rate but it's not a solution for me. As i said, sounds seems to be loaded and decoded correctly but there is no sound... I have only got some advance disabling web audio and playing audio after user input, but it only works using safari (not in my phonegap app) and only with sounds played in user input callback. Link to comment Share on other sites More sharing options...
Joanra Posted August 15, 2017 Share Posted August 15, 2017 Any news about this? We have the exactly same problem. Any success case about publish a phaser game in iPad with the music? Link to comment Share on other sites More sharing options...
vidifon Posted August 16, 2017 Share Posted August 16, 2017 I am having same issue with iPad. No sound Link to comment Share on other sites More sharing options...
samme Posted August 17, 2017 Share Posted August 17, 2017 @arturomf @Joanra @vidifon Can you test phaser-examples-mirror/audio/play music.html please? Link to comment Share on other sites More sharing options...
vidifon Posted August 18, 2017 Share Posted August 18, 2017 Thanks @samme, works great. I updated to 2.8.4 and it solved the issue. samme 1 Link to comment Share on other sites More sharing options...
samme Posted August 18, 2017 Share Posted August 18, 2017 I wonder what exactly fixed it. Link to comment Share on other sites More sharing options...
tokumaru Posted January 16, 2018 Share Posted January 16, 2018 Hey guys, I'm having lots of trouble on an iPad 2 running iOS 9. None of the audio examples on Phaser's website work, including the one that was posted in this thread: https://samme.github.io/phaser-examples-mirror/audio/play music.html - When I touch the screen, the debug info says the audio is not locked, but the iPad still doesn't output any sounds. Also, out of all the games I tried, only one was able to output sounds flawlessly: Salazar the Alchemist. Weirdly enough, however, it only works when run from this specific website: http://www.agame.com/game/salazar-the-alchemist - Running the game from anywhere else resulted in total silence... even opening the game's iframe from this same website in a new tab (meaning that all the game files are exactly the same) silences the game. It only works on that website, when running from inside an iframe. Really weird. During my own experiments, using Phaser 2.9.4, I was able to play sounds from inside a DragStart event handler. Sounds would then work for a while, but just a few seconds later they'd mysteriously stop for no apparent reason. The time it takes for the sounds to stop varies, but it's always less than 1 minute, and there are no other sound commands in the program besides the call to .play() in the DragStart event handler. This is just on the iPad, everything works fine on Android and PC. Does anyone have any idea of what I could do to make sounds work on this iPad 2? Is this device simply too old to work properly with Phaser? Are newer iPads and iPhones known to work OK? Thanks! Link to comment Share on other sites More sharing options...
samme Posted January 16, 2018 Share Posted January 16, 2018 I don't know about the iPad 2 in particular. When I visit https://samme.github.io/phaser-examples-mirror/audio/play music.html on iPhone, playback starts silently and there's no audio output until I tap the game. Swipe/scrolling the game doesn't do it, and tapping after swiping doesn't work either. Try playing audio only via input.onTap. Most of the examples aren't written that way. You might also add your sounds as <audio> tags and test if the iPad 2 can play them all the way through. Link to comment Share on other sites More sharing options...
tokumaru Posted January 17, 2018 Share Posted January 17, 2018 Thanks for the reply. It looks like sound on iOS is still very inconsistent, then. Unfortunately, I don't own any other iOS devices I can test on, so I guess I'll have to keep coding, trying to play sounds off of Tap events whenever possible, and hope for the best. I did try playing audio via <audio> elements before and it worked, as long as the load() or play() methods were first called from within an input event listeners. From that point on, I had full control over the <audio> element, which could be played from anywhere in the code, not only from input event listeners. Using Phaser's disableWebAudio: true doesn't work as well though... the sound plays, but it's very choppy and laggy. Link to comment Share on other sites More sharing options...
md_lasalle Posted January 22, 2018 Share Posted January 22, 2018 I have been noticing issues as well, I'm testing with an iPhone SE on iOS 11.2.2 (latest version) in Safari, and the first time I visit my game, no sound at all can be heard, if I hit reload, sounds works as expected. The issue in not present on Android with Chrome. Edit: Phaser is 2.10.0, but I have seen this issue with all releases I have tried (2.6.2 and up) Edit2: trying the approach suggested in this post ( http://www.html5gamedevs.com/topic/19156-ios-92-sound-broken/ ) I was able to fix my issue on my iPhone, but on iPad running iOS 9.3.5, I still need to reload the page to get sounds. Edit3: spoke too soon, issue still showing up randomly on my iPhone, and reload of the page always fixes the problem. Link to comment Share on other sites More sharing options...
samme Posted January 22, 2018 Share Posted January 22, 2018 3 hours ago, md_lasalle said: I'm testing with an iPhone SE on iOS 11.2.2 (latest version) in Safari, and the first time I visit my game, no sound at all can be heard, if I hit reload, sounds works as expected. Try game.debug.sound(…). Link to comment Share on other sites More sharing options...
md_lasalle Posted January 22, 2018 Share Posted January 22, 2018 18 minutes ago, samme said: Try game.debug.sound(…). This was shown after I hit the issue again : Mute on pause: true Using: Web Audio - Suspended Touch locked: false All my sounds are triggered in a button "onUp" function. It seems that after I have pressed several sounds, it starts working (Web Audio becomes running)... Link to comment Share on other sites More sharing options...
samme Posted January 22, 2018 Share Posted January 22, 2018 You can try in your onUp handlers: // [play sound …] if (game.sound.usingWebAudio && game.sound.context.state === 'suspended') { game.sound.context.resume(); } md_lasalle 1 Link to comment Share on other sites More sharing options...
md_lasalle Posted January 23, 2018 Share Posted January 23, 2018 So far so good, I’m going to keep testing on multiple iOS devices. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts