So here's the story, I'm building a WebRTC app and I have to record the stream on server.
"WebRTC is p2p dude, choose a media server"
Yes, I know, please avoid this comment ;)
But then I tought about one thing, what if I force all the stream to use the TURN server. The packets are going through the server, so I guess I can take them and save it
The question is how to do this.
Any suggestions?
For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). The common way to solve this is by using a TURN server.
The STUN, TURN, and TURNS Protocols Session Traversal Utilities for NAT (STUN) - Used to establish a direct UDP connection between two clients. Traversal Using Relay around NAT (TURN) - Used to establish a relayed UDP or TCP connection between two clients.
STUN and TURN servers are two types of WebRTC signaling servers that can be used to create your peer-to-peer (P2P) connection when you are building a real-time communication application.
Even if based on a peer-to-peer protocol, WebRTC connections can't run without a server.
TURN servers are intended to be relayed media, which means that media streams are not decrypted, mux'ed, processed, or recorded. I get that you're asking to avoid the "choose a media server" comment, but that's like saying "I need put in this screw; which hammer should I use? Please don't tell me to get a screwdriver." - The hammer isn't the right tool.
You can still use WebRTC and p2p, but the media server (like Jitsi, for example) acts as a peer in a star topology, where all streams are sent to the media server, and can be recorded, relayed, bundled, etc.
You can use a WebRTC gateway like Janus or Kurento (I assume you have figured it out by now :) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With