New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error when mic/webcam are not accessible in HTTP environment #2551
Comments
Same here. Stop Recording button works with public url and HF spaces, but not with the server ip + port. Any suggestions please @abidlabs ? |
I found the solution One solution is to create ssl by yourself and add the certfile at launch method, and block method and lastly, I am not sure if this would pose a problem or not, but I have to pass this certfile to requests Line 1324 in fd31726
to requests.get(f"{self.local_url}startup-events", verify=ssl_certfile)
|
@darwinharianto is correct. You need to be either running with HTTPS or localhost (browsers make exceptions for localhost) in order to use mic/camera. We'll add a better error to clarify this |
@darwinharianto's solution works fine for me, thanks! :)
should not be merged into mainline? |
Using this method, an error was reported as |
I also get the same issue when I pass the cert and pem file created in demo .launch certificate verify failed: self signed certificate (_ssl.c:1131)'))) |
demo.launch(share=False, server_name="0.0.0.0",server_port=7000,ssl_verify=False, ssl_certfile="cert.pem", ssl_keyfile="key.pem") I am using this command, and my version are I have used openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes But I get this error again and again Any help or solutions would be helpful. |
I successfully resolved the issue related to accessing the microphone and webcam in an HTTP environment. When using Gradio on a local server, I encountered an HTTPS problem. Below is the solution I implemented:
With the above steps in place, I was able to resolve the problem and achieve seamless access. Please make sure to replace |
Try the method from @Kedreamix . I also solved the problem using this method last week, although it has security issues. |
Can you please tell the python and gradio version that you used for your case. It would be helpful. |
HI @Kedreamix can you please let me know the gradio version and python version for this one. |
I tried the suggested method but I still face the same error as before. ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131) During handling of the above exception, another exception occurred: requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=7000): Max retries exceeded with url: /startup-events (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)'))) Can you please let me know if there is any version specific installation that I need to do for it to work. |
My gradio==3.35.2, you can also try using tools such as mkcert to generate security certificates. |
simple solution ask chrome browser to treat gradio url as secure as mentioned here restart browser |
This doesn't work for my chrome (both windows11 and andorid) and edge browser, my brosower still says "Your connection to this site is not secure" for my
|
@Kedreamix Thank you for your suggestion but it does not work with no reason I created Also the
environment:
|
there is a easy method to solve this problem. |
Describe the bug
Issue.
I deployed an example of microphone testing on 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?
Reproduction
You can reproduce the error by running
main.py
with the code below.main.py
Screenshot
No response
Logs
System Info
Severity
blocking all usage of gradio
The text was updated successfully, but these errors were encountered: