whitphx / streamlit-webrtc

Real-time video and audio processing on Streamlit
https://discuss.streamlit.io/t/new-component-streamlit-webrtc-a-new-way-to-deal-with-real-time-media-streams/8669
MIT License
1.36k stars 182 forks source link

Device not available #622

Closed Bojne closed 2 years ago

Bojne commented 2 years ago

Hi @Tsuchiya, I try to set up this simple app on my Mac:

from streamlit_webrtc import webrtc_streamer

webrtc_streamer(key="sample")

But I got this error

image

But I image

I don't have too much clue on how to start debugging this. Can you ping point some direction?

whitphx commented 2 years ago

hmm, that's weird. As written in https://github.com/whitphx/streamlit-webrtc#https, the browser is not allowed to access the media devices in insecure contexts and the error you encountered indicates it, but http://localhost should be considered as a secure context where the access is allowed.

Locally-delivered resources such as those with http://127.0.0.1 URLs, http://localhost and http://*.localhost URLs (e.g. http://dev.whatever.localhost/), and file:// URLs are also considered to have been delivered securely. https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts

How would you like to search bugs, edge cases, or any reasons that make localhost be considered as an insecure context?

Bojne commented 2 years ago

Hi! I tested again yesterday and I think I figured it out - I was using my monitor and closed my laptop. Although I think the audio will still work, but it actually does not. This gets fixed as I open my main laptop. Thank you!