IOS WebAudio only works on headphones

前端 未结 4 2099
梦毁少年i
梦毁少年i 2020-12-14 05:22

I\'ve been running into an issue now for a while where on some ios devices my webaudio system only seems to work with headphones where as other devices (exact same os, model

4条回答
  •  萌比男神i
    2020-12-14 06:22

    If the iPhone mute button is down, meaning that the iPhone is muted, what is played through Web Audio Api will be muted.

    Unfortunately there is no way to check if that physical button (located on the left edge towards the top of the iPhone) is on or off through Javascript.

    This issue is completely independent from the fact that in iOS Safari the audio has to be started by a user action for it to be unmuted. There are some tricks that can be done to overcome that fact, including the one suggested by here Spencer, were you use "any action or a specific action" started by the user to "play" a silent audio file to allow subsequently playing audio files to play unmuted.

提交回复
热议问题