unmute-ios-audio
unmute-ios-audio copied to clipboard
Does it still work with current iOS versions?
We've been using that package for a while and it worked well. However, with current iOS versions it doesn't seem to work anymore. At least with our application.
Version 3.1.0 works with old versions of iOS like 12.5.3 (on an iPhone 6). Version 3.2 and 3.3 do not work there as well.
On newer iOS 14.5 or iPad Os etc. our app suddenly doesn't work together with this package using any version of it. Can you confirm, that it still should basically work (... and that the issue may be the setup in our project)?
Thank you very much.
Hi @dleumann, the library uses the prefixed webkitAudioContext
to detect Safari. Sadly (or luckily) that doesn't work anymore since Safari now removed the prefix.
I'm not sure though what should be used instead now. @feross what do you think?
I had a quick look at the expectation tests that I maintain for standardized-audio-context. The following works today but might break with the next release.
const isSafariWithModernWebAudioImplementation = () => {
try {
new AudioContext({ sampleRate: 0 });
} catch (err) {
return err.code === 12;
}
}
console.log(isSafariWithModernWebAudioImplementation());
Hello and thanks for the update. For the time being I trigger a very short silence file when the user touches the screen. This seems to activate the sound even if the sound is muted on the device.
e.g. new Audio('workarounds/silence.mp3').play()
Just chiming in to say that iOS 14.5 changed quite a few arcane Audio API tidbits, and this one also bit me. Since the detection method won't be quite as easy going forward, it'd be really nice to at least have an argument to the default export function to force it to continue (even if detection fails), since a lot of apps will be doing their own iOS-specific detection
For example, here's the patch I just did to workaround my own need: https://github.com/searls/unmute-ios-audio/commit/8fc05cdb0d0f63167e0d6047ed1932555b3c9491
so, how to make this work on iOS 14.5+ ?
+1 looking for a workaround. Tried @searls approach, but doesn't seem to work on my end.
https://github.com/swevans/unmute
This works on IOS 14.5 +
https://github.com/swevans/unmute
This works on IOS 14.5 +
I use this one too it's awesome
You can find alternative version where the audio stays playing when switching tabs or view https://spencer-evans.com/share/github/unmute-no-pause/
It even works in a webview cordova and capacitor, with background mode as well so that webaudio can play in the background.