Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to record a relayed stream on server using TURN

Tags:

webrtc

turn

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?

like image 680
Manza Avatar asked Oct 03 '14 14:10

Manza


People also ask

What is WebRTC TURN?

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.

Is TURN UDP or TCP?

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.

What is a STUN TURN server?

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.

Can I use WebRTC without TURN server?

Even if based on a peer-to-peer protocol, WebRTC connections can't run without a server.


2 Answers

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.

like image 53
xdumaine Avatar answered Oct 23 '22 14:10

xdumaine


You can use a WebRTC gateway like Janus or Kurento (I assume you have figured it out by now :) )

like image 35
lucpattyn Avatar answered Oct 23 '22 13:10

lucpattyn