Can Javascript detect if a mobile device is muted?

后端 未结 1 1439
南旧
南旧 2021-01-15 23:31

My website is currently playing sounds when the user answers a question right/wrong. But I notice that on my tablet (iPad) and mobile (iPhone) it plays the sounds even thoug

相关标签:
1条回答
  • 2021-01-16 00:29

    The simple answer to your question is no. Web pages don't have access to that kind of information about the client. More info here: Javascript: Can you read the systems volume? Furthermore, it is important to note that iOS has different volume settings for ringers and for media, according to Macworld:

    The key to mastering volume adjustment is understanding that most of the sounds on your device fall into one of two categories. General audio includes music and other media, and the voice volume on the iPhone and for FaceTime on all devices. The “ringers and alerts” category includes not only the iPhone ringer, but also: FaceTime rings; Clock app alarms; notifications and individual app alerts; keyboard clicks; and miscellaneous app sounds like the whoosh of sending Mail.

    In other words, if a user wants to mute audio coming from web pages, they should mute the media volume. Ringer volume has nothing to do with web pages, so putting your phone in "silent" mode is only meant to affect the ringer volume. If you need help changing your device's volume settings, check out How can I lower the media volume on my iPhone when no media are playing? on the Apple Stack Exchange.

    0 讨论(0)
提交回复
热议问题