问题
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?
回答1:
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.
回答2:
You can use a WebRTC gateway like Janus or Kurento (I assume you have figured it out by now :) )
来源:https://stackoverflow.com/questions/26181441/how-to-record-a-relayed-stream-on-server-using-turn