gradio-app / gradio

Build and share delightful machine learning apps, all in Python. šŸŒŸ Star to support our work!
http://www.gradio.app
Apache License 2.0
33.77k stars 2.56k forks source link

Audio play is silent on iOS #246

Closed drscotthawley closed 3 years ago

drscotthawley commented 3 years ago

Hi, this is more of a feature request than a bug: it would be great if your audio demos worked on iOS! šŸ™šŸ„ŗ
iOS requires a little bit of extra code (user authentication request) in order for audio to be heard.

Currently your audio demos, e.g. https://gradio.app/hub/AK391/neural-waveshaping-synthesis, are silent when I press the play button on iOS (Safari or Chrome).

This is a common problem that affects lots of websites. Hereā€™s a thread discussing this: https://stackoverflow.com/questions/31776548/why-cant-javascript-play-audio-files-on-iphone-safari. This ā€œfeatureā€ was intended by Apple to prevent auto-play, but it ends up affecting even sites like yours where the user presses a play button.

It should be pretty simple to fix, since having the user press play could be the user interaction as far as Appleā€™s requirements are concerned. But Iā€™m not sure which part of your code needs to be modified, which is why Iā€™ve created an Issue rather than a Pull Request. ;-)

aliabid94 commented 3 years ago

Taking a look, thanks for pointing this out.

abidlabs commented 3 years ago

I tested this on Hugging Face Spaces (the preferred deployment approach for Gradio demos), e.g.: