Jump to content

Sound does not play when the page is added to home screen IOSphone


jinxsterz
 Share

Recommended Posts

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 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

- 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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...