I need to create a demo to test an STT Agent. I created a simple Gradio app and deployed it on EC2 instance. However, when I launch it, my browsers(Safari and Chrome) report no microphone provided. Is it possible to deploy the app in a way that allows microphone access?
I’ve included a basic example of my Gradio app, which also doesn’t work.
import gradio as gr
audio = gr.Microphone(sources=["microphone"], type="filepath")
ui = gr.Interface(
fn=lambda x: x,
inputs=audio,
outputs=audio,
allow_flagging="never"
)
if __name__ == '__main__':
ui.launch(server_name="0.0.0.0")
I tried to change port, but the results are the same. I also tried to use NGINX, but I couldn’t write a proper script.
This issue sounds tricky.
opened 03:59PM - 11 Apr 23 UTC
closed 12:38PM - 12 Apr 23 UTC
bug
needs repro
### Describe the bug
I setup the gradio app with public address. When I use saf… ari to open the url, it doesn't prompt me for microphone access. However, when I setup the gradio app with local address, it works properly. What's the problem? Thank you in advance.
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Reproduction
I setup the gradio app with public address.
I use safari to open the url, it doesn't prompt me for microphone access.
### Screenshot
_No response_
### Logs
```shell
None
```
### System Info
```shell
Ubuntu 20.04
gradio 3.25.0
```
### Severity
annoying
When I set “server.launch(share=True)”, I use this url (https://1a9b77cb89ac33f546.gradio.live ), and it is ok.
However, when I set “server.launch(server_name=“0.0.0.0”)”, I use my own public url (for example, http://101.40.163.105:7860 ), it doesn’t prompt me for microphone access.
this is not a Gradio issue but it’s actually due to the fact that modern browsers block microphone access in http environments. We have an existing issue to provide clearer error messages when this happens: #2551
Yes, it works for STT, but if I decide to play audio, the app will crash. Are there any solutions?
There are a few ways to do it, but I’m kind of a fossil, so I’m not familiar with internet-related implementations…
opened 09:57PM - 22 May 23 UTC
closed 08:47PM - 09 Aug 23 UTC
bug
svelte
pending clarification
### Describe the bug
gr.Audio() seems to be not working on the Andriod Firefo… x browser, it can't ask for audio permissions.
but, it's working fine on my PC browser (chrome and Firefox).
Note: My Firefox has the Android microphone permission enabled and the browser set audio to "Ask to Enable"
It could be caused by the incompatibility of the javascript browser API for asking for audio permission.
Please fix this bug.
Thanks.
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Reproduction
Here is just the audio field:
```python
audio = gr.Audio(source="microphone", show_label=False, type="filepath", format="mp3").style(container=False)
```
### Screenshot
_No response_
### Logs
```shell
No logs
```
### System Info
```shell
my device info:
Android version: 12
Browser: Firefox
Note: My Firefox has the Android microphone permission enabled and the browser set audio to "Ask to Enable"
```
### Severity
serious, but I can work around it
opened 09:45AM - 27 Oct 22 UTC
closed 07:31PM - 04 Oct 23 UTC
bug
svelte
🎵 Audio
### Describe the bug
## Issue.
I deployed an example of microphone testing o… n my local machine.
Knocking on http://127.0.0.1:7860/ (or http://localhost:7860/), everything works.
Knocking on http://MY_IPV4:7860/, the stop recording button does not work.
On a local machine, it doesn't matter to me which URL to use. But if you deploy it on a server (for example, in a Docker container), and access the IP of the server, then this is critical.
P.S., only the stop recording button does not work, the rest functions correctly.
## Details.
When you click the Record from microphone button in the browser console the following:

_Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getUserMedia')
at le (Audio.svelte:103:51)
at HTMLButtonElement.x (Audio.svelte:181:4)
le @ Audio.svelte:103
x @ Audio.svelte:181_
When you click the Stop recording button in the browser console, the following (this button does not work as intended):

_Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'stop')
at HTMLButtonElement.v (Audio.svelte:198:3)
v @ Audio.svelte:198_
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Reproduction
You can reproduce the error by running `main.py` with the code below.
### main.py
```python3
import gradio as gr
def test_micro(path2audio):
return path2audio
if __name__ == '__main__':
demo = gr.Interface(fn=test_micro,
inputs=gr.components.Audio(source="microphone", type="filepath", label="Speaker"),
outputs="text")
demo.launch(server_port=7860, server_name="0.0.0.0", debug=True, share=False)
```
### Screenshot
_No response_
### Logs
```shell
The Python console has standard output, there are no errors.
Running on local URL: http://0.0.0.0:7860
To create a public link, set `share=True` in `launch()`.
```
### System Info
```shell
Python version: 3.9.10.
Gradio version: 3.7.
Browser: Mozilla FireFox (102.3.0esr, 64-bit); Google Chrome (version 106.0.5249.119, 64-bit).
OS: Linux; Windows (problem everywhere).
```
### Severity
blocking all usage of gradio
How did you solve it in the end?
I am kind of having the same issue now
1 Like