Search code examples
iosaudiosafariautoplayamazon-polly

How can a user enable audio auto play in iOS Safari, so that Amazon Polly text to speech will work as expected?


I am using Amazon Polly to generate speech, spoken in a "conversational" interaction in my web app. This involves making an API call to fetch the generated audio file, and then playing it when appropriate to respond to and interact with the user.

This works great on desktop chrome, and works fine on desktop safari, so long as I instruct the user to go to Safari > Settings for this Website > Allow all auto play.

However, in Safari on iOS (iPad), this does not work. I have not found an equivalent way for the user to modify the preferences and allow auto play. Without this, my text to speech audio is blocked from playing by Safari's default auto play settings.

Is there a way that my users can set such a preference for this website on their iPads? If not, is there a workaround which will enable me to play my speech audio files?

For the purpose of this question, let's pretend it's a fine user experience to ask the user to enable audio auto play.


Solution

  • The solution is to make sure to play all audio through one single instance. When the user first enters the site, use one of their initial clicks to play blank audio through this instance to "prime" it