I have made a website that plays audio after a user does the mousePressed(). The site works fine on all the platforms like, desktop Internet browser and Android’s browser but, not in iPhone’s Safari and Chrome. My audio has three lines: two lines are mp3 and one is the synthesized sound from code using Tone.js. All of them stop() at the beginning.
Although at first the audio works, some of my user interface are broken. so I tried to fix that. I worked with html DOM element instead of position my mouseX and Y to find a location on canvas for clicking. Now, that the visual works nicely my audio suddenly stop working on iPhone. I don’t think my edited UI code is related to the issue, and thinking that it’s an Apple’s privacy more because this project can run on all my testing device.
Here’are what I have done in so many ways and on many lines of codes but none works:
- audioContext() and suspended method and etc. to make sure the audio is stopped at very beginning. I put it in setup(). [Should I do audioContext thing on preload() ?]
- Convert one of the mp3 to aac and ogg for testing. Nothing played.
- I have checked the console of my iPhone using safari connection. No error. The program seems like it found the audio file.
what else can I do? I am not sure what part of my code should be pasted here honestly but maybe someone here have done audio work with current iPhone/iPad version can help me please.