Tone.js not playing audio on iOS

I tried StackOverflow, but couldn’t get any responses. So I thought I’d try here.

I have a meteor application that uses Tone.js, and I use the GrainPlayer object specifically. It works perfectly fine on different browsers across different OS and devices… except for iOS. I personally don’t have an iOS device, but clients are showing me that iOS isn’t playing the audio. It’s also not restricted to safari; other browsers on their device also won’t play the audio.

I know it’s a Tone.js-specific issue here, because I also use Howler.js for a few of the sounds that don’t require the Tone GrainPlayer class, and those work. It’s also not an AudioContext issue in general, because I have the following code:

Tone.setContext(Howler.ctx);

Which ensures the AudioContext for Tone is routed through the AudioContext for Howler.

Is there a way to get it to play? I need to keep using GrainPlayer because of its unique properties and functions, so switching out will not work for me as a solution unfortunately. I have no way of diagnosing it from a developer standpoint because again I don’t have an iOS device, and even then they don’t have a way to pull up a developer console… But it seems to not break code or anything, just seems like it ‘ignores’ the sound playing, and moves on.

The sounds in question are created as such:

standardChord[0] = new Tone.GrainPlayer(’/A.flac’).connect(Howler.masterGain);

And then when they need to be played:

standardChord[0].start();

Which like I said works fine on other devices.

Have you tried posting in tone.js github?

I have not yet, good idea.

I just thought I’d try here since it is a meteor application after all, curious of any insights.

iOS has a couple stipulations: audio can only play from a user interaction and also if it’s on low power mode it won’t play. Here is a test example you can try to help debug this.