New Component: streamlit-webrtc, a new way to deal with real-time media streams

I got an invitation to Streamlit Sharing then deployed the sample app there: https://share.streamlit.io/whitphx/streamlit-webrtc-example/main/app.py
but it didn’t work with a “permission denied” error when the app requires capturing video or audio from user’s device.

It means many interesting applications of this component, including real-time object detection and image transformation, cannot be used on Streamlit Sharing…
The only page of the sample app that works is the third one, where the app plays video and audio files on server-side and transmit them to the client.

This is because, on Streamlit Sharing, the app is running inside iframe.
getUserMedia, which is used to get access to user’s device, requires Feature Policy when called inside iframe.
Details are here: MediaDevices.getUserMedia() - Web APIs | MDN

This is out of my control :crying_cat_face:

EDIT: This problem has also been stated in Sharing blocks custom webcam component due to featurePolicy

5 Likes