Webcam HTML component

Hey everyone, I’m attempting to use a custom html component to access the webcam in a streamlit app.

I have the webcam html/js from this codepen, which I’ve refactored into a single html file webcam2.html, and this works fine in the browser (once you have accepted the permissions).

Then using streamlit.components.v1.html I am displaying the same html/js inside a streamlit app called webcam.py.

And the app running,

Streamlit gets pretty close to rendering the whole thing(!) but once you start the camera (with the get video button), an error occurs saying “webcam not working”. It seems to me the media permissions are not being requested/communicated through the embedded html? Would be great to have some help on this because webcam access would be absolutely killer.