Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it still work with current iOS versions? #10

Open
dlymann opened this issue May 17, 2021 · 8 comments
Open

Does it still work with current iOS versions? #10

dlymann opened this issue May 17, 2021 · 8 comments

Comments

@dlymann
Copy link

dlymann commented May 17, 2021

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.

@chrisguttandin
Copy link
Collaborator

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());

@dlymann
Copy link
Author

dlymann commented May 18, 2021

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()

@searls
Copy link

searls commented May 31, 2021

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

@searls
Copy link

searls commented May 31, 2021

For example, here's the patch I just did to workaround my own need: searls@8fc05cd

@martijnmichel
Copy link

so, how to make this work on iOS 14.5+ ?

@freshlySqueezedBananas
Copy link

+1 looking for a workaround. Tried @searls approach, but doesn't seem to work on my end.

@Seanitzel
Copy link

https://github.com/swevans/unmute

This works on IOS 14.5 +

@numerized
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants