jinxsterz Posted February 6, 2017 Share Posted February 6, 2017 hi, i am trying to play sounds on my game, and i tried testing sounds on webpage, and webapp. webpage does play the sounds and bgm however webapp does not play any sounds(add to homescreen) this problem only seems to occur on IOSphone(tested on iphone 5 and 6) not trying to find other solution(using html5 to play sound) rather if there possible fixes Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 6, 2017 Share Posted February 6, 2017 Ping @davrous Quote Link to comment Share on other sites More sharing options...
davrous Posted February 7, 2017 Share Posted February 7, 2017 Hi, Several questions: - which iOS version is having the issue? - do you have a reproduction page somewhere? Please reference the babylon.max.js to help troubleshooting the issue - are you using our offline engine? (IndexedDB with the .manifest file) I'm not reproducing with this demo I've made: http://aka.ms/utd . When adding to the homescreen of my iPhone, the sound still works as expected in-game. David Quote Link to comment Share on other sites More sharing options...
jinxsterz Posted February 8, 2017 Author Share Posted February 8, 2017 - im using iphone 5 and 6 and their version are ios10 - Sorry but I cant show you my webpage because its company policies - i am not using the offline engine. Since I can't disclose the reproduction page, I would like to(I should have) describe the issue more precisely. - I have a background music and narrative sound played when the scene is ready, if (scene.isReady()) { bgm.play(); narrativeSound.play(); } but I am not sure if the issue is caused by iphone webapp audio restriction without user interaction. And for @davrous's demo, when I open the demo on desktop, I notice there is bullet sound when the fox shooting the tower, I can hear the sound on my android phone chrome browser too. But when I open it on iphone safari, there is no sound at all, and I am not able to open the demo in webapp mode, as when I added it to home screen and click the shortcut to open it, the demo is not opened in webapp form, but leads me back to safari browser. Quote Link to comment Share on other sites More sharing options...
jinxsterz Posted February 8, 2017 Author Share Posted February 8, 2017 btw @AB95 is working with me and she is the main programmer of this project she have more information about the internal makeup Quote Link to comment Share on other sites More sharing options...
AB95 Posted February 8, 2017 Share Posted February 8, 2017 @jinxsterz ok, I will reply on this thread from now on. Quote Link to comment Share on other sites More sharing options...
davrous Posted February 8, 2017 Share Posted February 8, 2017 I'm not sure to really understand what's going on. And if you can't share your code, please at least try to isolate a reproduction case to let us review it. I'm sorry to ask, but on your iPhone, are you sure it's not muted with the physical button on the left? Indeed, even after unlocking the web audio stack (which need at least a single user touch), you'll have no sound if the switch is set to off (even if native apps can play sounds). I don't get the problem with web app vs safari browser. What do you call the webapp mode? David AB95 1 Quote Link to comment Share on other sites More sharing options...
pixelactivity Posted February 8, 2017 Share Posted February 8, 2017 One fact is, that on IOS Sound is only played by an user action. After the sound is played, you can repeat the sound like you want (collision, backgound music). That means, if you start a game by pressing a button, you play all your sounds you need in your game for just 0.0 sec (volume=0). I use webaudio for IOS. davrous 1 Quote Link to comment Share on other sites More sharing options...
davrous Posted February 9, 2017 Share Posted February 9, 2017 Yes and the Babylon.js Sound Engine includes this check. I'm using it in the Sponza demo: http://www.babylonjs.com/demos/sponza. If you run it on iOS, you'll have a prompt to touch before starting the demo. I've explained it in this article: https://www.davrous.com/2016/02/05/discovering-sponza-by-babylon-js-and-sharing-tips-on-how-to-build-a-cross-platforms-webgl-game/ in the very last section. David Quote Link to comment Share on other sites More sharing options...
AB95 Posted February 10, 2017 Share Posted February 10, 2017 hi @davrous, sorry for the lack of information, the thing is, I am certain that the sound is on, we had the volume check before and during accessing the website, and we had already added user input to play sound, below are the results: 1. on android mobile chrome browser - no need user input, all autoplay sound play flawlessly. 2. on iphone safari browser(not webapp, I am not opening the website link on home screen) - require first tap on screen to enable sound, after that sounds played properly. 3. on iphone webapp(when I said open in web app mode, what I mean is opening the website by adding it to mobile home screen first, then tap on the website icon at home screen to enter web app mode) - no sound is played. hi @pixelactivity, we did noticed the requirement of first tap to play sound on iphone safari browser, and that works on the iphone safari browser, but when we open the website in web app form, even with user input to call myAudio.play(), no sound can be heard, and yes, we are sure the sound is on. We initialised sound using Babylon.Sound, we even try to use web audio api to create sound(yes babylon has check the availability of web audio, we do that just to check), though it works on every other platform except iphone web app. Quote Link to comment Share on other sites More sharing options...
AB95 Posted February 13, 2017 Share Posted February 13, 2017 Hi @davrous sorry for all the misleading information that I provided here, turns out I did not switch on the physical sound mode switch, I had no problem hearing the sounds now, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.