As soon as you initiate gr.Microphone, it triggers microphone permission, and starts using the microphone source for the entire session even if you click stop.
This creates a problem on iOS because when the microphone is actively being used, it goes into a audio playback mode with lower quality. I'm not sure why, but I suspect maybe it does in order to run echo cancelation, noise reduction, etc.
Once you have gr.Microphone in your code, and if you try to play a stereo audio, it plays in mono with lower quality even if when it's not recording.
Try running this example on an iPhone twice: one with mic off and one with mic on.
https://huggingface.co/spaces/chibop/mic_test
First, test with microphone off. Open the page, and click cancel when it asks for mic permission. Then click play music. Notice the music plays in stereo with full quality.
This time, test with microphone on. Refresh the page, and allow microphone permission. Record something and click stop. Then click "Play Music", (not the play button to play the audio you just recorded). Notice the music plays in mono with poor quality.
Another related bug is that you can't replay the music using the html audio player control. I can only trigger the playback with autoplay for some reason.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
If you want to try the script below locally, generate ssl keys and add the following to launch parameter. IOS doesn't seem to let you use microphone without ssl.
Describe the bug
As soon as you initiate gr.Microphone, it triggers microphone permission, and starts using the microphone source for the entire session even if you click stop. This creates a problem on iOS because when the microphone is actively being used, it goes into a audio playback mode with lower quality. I'm not sure why, but I suspect maybe it does in order to run echo cancelation, noise reduction, etc. Once you have gr.Microphone in your code, and if you try to play a stereo audio, it plays in mono with lower quality even if when it's not recording. Try running this example on an iPhone twice: one with mic off and one with mic on. https://huggingface.co/spaces/chibop/mic_test
First, test with microphone off. Open the page, and click cancel when it asks for mic permission. Then click play music. Notice the music plays in stereo with full quality.
This time, test with microphone on. Refresh the page, and allow microphone permission. Record something and click stop. Then click "Play Music", (not the play button to play the audio you just recorded). Notice the music plays in mono with poor quality.
Another related bug is that you can't replay the music using the html audio player control. I can only trigger the playback with autoplay for some reason.
Have you searched existing issues? 🔎
Reproduction
If you want to try the script below locally, generate ssl keys and add the following to launch parameter. IOS doesn't seem to let you use microphone without ssl.
server_name="0.0.0.0", ssl_certfile="host.cert", ssl_keyfile="host.key", ssl_verify=False
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it