javascript - iOS ringer switch mutes web audio - Stack Overflow

In a project I'm working on I noticed that, on iOS, the sounds are muted when the ringer switch is

In a project I'm working on I noticed that, on iOS, the sounds are muted when the ringer switch is turned off. The project is based on CreateJS and the sounds are managed by SoundJS.

Frustratingly, other websites that use sounds/media (youtube, facebook, soundhound, spotify, etc) seem unaffected by the ringer switch.

I tested on a few different iPhones with iOS versions ranging from 9.2 to 10.1.1: all presented the same issue.

What could be reason of this behaviour? Is there any documentation around that might explain how to fix it?

In a project I'm working on I noticed that, on iOS, the sounds are muted when the ringer switch is turned off. The project is based on CreateJS and the sounds are managed by SoundJS.

Frustratingly, other websites that use sounds/media (youtube, facebook, soundhound, spotify, etc) seem unaffected by the ringer switch.

I tested on a few different iPhones with iOS versions ranging from 9.2 to 10.1.1: all presented the same issue.

What could be reason of this behaviour? Is there any documentation around that might explain how to fix it?

Share Improve this question asked Nov 24, 2016 at 14:39 alebiancoalebianco 2,55520 silver badges25 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Old thread, but I have hit this before and answered a question on SO previously.

Basically, iOS will play web audio on the ringer category. I plays HTML audio on the media category (as expected). You can force BOTH to play on the media category by playing a silent looping html sound in the background. This does have one side effect- you'll now be given the option to airplay the game audio and toggle play/pause on the notifications view & lock screen if the screen is switched off while safari is open. The solution linked to below isn't a super robust solution (ie that side effect), but it definitely obtains the behavior you're looking for. Hope this helps!

See my answer here- https://stackoverflow./a/46839941/2103488

I'm not sure if this is why your sounds won't play with the ringer switch on, but there is a limitation to autoplaying sounds in Mobile Safari - they must be triggered by touch events (http://www.ibm./developerworks/library/wa-ioshtml5/)

I assume you are making a webapp and not using something like Phonegap or a browser view inside an app. If the latter, you might try looking into AVAudioSession categories which dictate things like your app's audio mixing with others and being silenced/not silenced by the ringer switch.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744301249a4567512.html

相关推荐

  • javascript - iOS ringer switch mutes web audio - Stack Overflow

    In a project I'm working on I noticed that, on iOS, the sounds are muted when the ringer switch is

    7天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信