cannot use WebRTC-Streamer to establish a direct P2P connection between internal networks via an external STUN server
xiaoxingQAQ opened this issue · 1 comments
To enable video stream transmission between devices in different internal networks, I designed a theoretically viable solution. This solution involves using webrtc-streamer to convert RTSP video streams into WebRTC-compatible formats and achieve cross-network video transmission. In this setup, webrtc-streamer is deployed within an internal network, handling the conversion from RTSP to WebRTC. A proxy program named streamer-proxy is also deployed within the same internal network.
The streamer-proxy interacts with webrtc-streamer via HTTP and establishes a connection with a public signaling server using WebSocket. This proxy program forwards requests from the public signaling server to webrtc-streamer and then returns the responses back to the public network. This design ensures that webrtc-streamer's source code remains unmodified while enabling WebRTC signaling communication between internal network devices and the external network, facilitating real-time video stream transmission across different network environments.
However, despite extensive debugging, webrtc-streamer and a web browser in another LAN consistently fail to establish a direct P2P connection via STUN servers. The connection can only be established through TURN server relays.
I solved the problem by starting the docker container with this command: 'docker run --net=host -it mpromonet/webrtc-streamer.'
I replaced -p 8000:8000 with --net=host.