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

streamlit-webrtc peer to peer connection #850

Closed maloreDC closed 2 years ago

maloreDC commented 2 years ago

I’m a graduating Computer Science student currently working on my thesis and I'm using your streamlit webrtc for my project. I do have some questions regarding the streamlit webrtc.

webrtc is a peer to peer connection right? It is usually used for web chatting apps like zoom (according the video I've watched). So when it comes to object detection projects where do I really connect or who is my peer if I'm sending and receiving my own video. I do know that I used a stun network provided free by google but still don't get who is the 'peer' I'm connected to

Forgive me for asking dumb questions its just that I'm new to streamlit and webrtc

whitphx commented 2 years ago

Hi,

webrtc is a peer to peer connection right and is usually used for web chatting apps like zoom.

Yes, right.

So when it comes to object detection projects where do I really connect or who is my peer if im sending and receiving my own video.

In the case of streamlit-webrtc, the peers are the frontend app on the browser and the Streamlit app on the server. Object detection runs in the Streamlit app process on the server as normal Streamlit apps.

I do know that i uses a stun network provided free by google but still dont get who is the peer im connected to

Your understanding of STUN server seems correct. It is only for preparation of the peer-to-peer connection and does not play any role after the connection is established. During the video streaming using streamlit-webrtc, only the frontend app and the Python app are working.

I think you got confused because in the case of streamlit-webrtc, the peers are the frontend and the backend, though some WebRTC app samples on the web are "frontend-to-frontend" type where 2 clients connect directly each other and there is no video processing server.


(The below is an advanced info that is may be beyond the original question)

There are many samples of the frontend-to-frontend type video chat because it's the most basic and easy to understand how WebRTC works. However, among the real-world apps, there are more variety of set-ups. For example, in the case of multi-user video chat, there are often proxy servers called SFU or MCU to reduce the total number of the connections. Apps like Zoom may be so too. Google such keywords if interested.

maloreDC commented 2 years ago

Ohh now everything is clear. Thank you for answering my question. I also know now some of the keywords I'm going to search in order to learn more about this. again thank you have a good day