Rich-Harris/phonograph

doesn't always work in safari

Opened this issue · 5 comments

weepy commented

Hi I'm running the demo on a recent mac. The demo.html seems to work fine in chrome, but only works intermittently in safari ... clicking play causes no sound to play, although it does seem to think it's playing.

weepy commented

Debugging further it's because the audioContext is still "suspended" probably due to the fact it wasn't created from a touch... i.e. aping similar behaviour in ios. Forcing the Clip to be created in the clip handler fixes this, though unfortunately it means we can't try to preload before the click happens.

Is this lib still needed or have browsers fixed issues?

weepy commented

I think really browsers have kinda moved on from this... workarounds like this unlikely to work

Agreed, doesn't work in latest Chrome on Windows either - console warning given is The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

That's right. Console warning is observed:

Screenshot_20230124_193831