feross / unmute-ios-audio

Enable/unmute WebAudio on iOS, even while mute switch is on

Home Page:https://bitmidi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS detection issue

jfrancos opened this issue · comments

Hi Feross,

Thanks for making this utility which makes it so easy to solve the annoying ringer mute problem! I seem to be affected by one small issue with it:

I'm using an iPhone Xs running iOS 13.7 and navigator.userAgent returns Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15. Thus it doesn't seem to work (no errors, but still muted), until I replace
const isIos = /iPhone|iPad|iPod/.test(navigator.userAgent) && AudioContext != null
with
const isIos = AudioContext != null
then, it works great.

Is the latter not a sufficient check, and/or are there practical consequences for running the full body of unmuteIosAudio when it isn't needed?

Apparently the new iOS Safari pretends to be a desktop mac by default. I created a PR to add a check for the maxTouchPoints property which is usually 0 on a desktop.

Without this check unmute-ios-audio would also run on a desktop.

Hi @chrisguttandin, thanks for taking care of that!

Fixed in 3.2.0