vprtwn / harp.city

collaborative drone music toy
https://harp-city.now.sh
0 stars 0 forks source link

No sound on iOS (& desktop) Safari #2

Open vprtwn opened 4 years ago

vprtwn commented 4 years ago

https://github.com/Tonejs/Tone.js/issues/406

@eltomito the solution is to invoke Tone.context.resume() from an explicit user action. There is little that a library can do to get around the Autoplay policy, it is something that each developer must do for their own application. i will add a note to the top of the README

https://github.com/Tonejs/Tone.js/issues/518

For the issue on 13.4.9, the issue is that the audio context is not started. since you've got a deferred callback which actually makes the sound, the browsers aren't able to understand that as an explicit user action starting the audio, so i think Safari won't let you play any sound until a user clicks a button followed directly by either context.resume() or something that makes sound.

For starting the context, it's enough to either call Tone.start() or sampler.context.resume() from within that button callback. I don't think you need to grab into the internal _context.

The second issue with Safari on the typescript branch is because there are no shims on that branch yet, and since Safari requires webkitAudioContext instead of AudioContext and that code isn't in there yet.

vprtwn commented 4 years ago

probably related to #4 and #1