I have seen several examples of native to browser WebRTC applications, like for streaming video files stored on a server to one or more browsers, but is it possible to do the reverse ? I.e. streaming the webcam from the browser to a server, written in C, C++, Java or other ?
-
It is possible, you can use a gateway(like [Janus](https://github.com/meetecho/janus-gateway) or [Licode](https://github.com/ging/licode), or the [native API](https://code.google.com/p/webrtc/). What specific issues are you having in your implementation or foresee? – Benjamin Trent Aug 05 '14 at 13:16
-
Actually, I'm currently using Janus, but I am wondering if it is mature enough as I have many issues in my application. Mostly latency issue, even when both the server and the browser are run from the same WiFi network. Besides, even when running the echo test example for more than 5 continuous minutes, the images become distorded and even freezes. I wanted to see if I met the same issues with another methode / gateway. I haven't figured out how to use Licode yet. I'd like to try implementing something with the native API, but this is so huge I have no idea where to start. – nschoe Aug 05 '14 at 13:34
-
1About the native API, how do you suggest I proceed in order to write a small server with it ? Because just in the [https://code.google.com/p/webrtc/source/browse/#svn%2Ftrunk%2Ftalk%2Fapp%2Fwebrtc%253Fstate%253Dclosed](webrtc part), there 100+ files, and I have absolutely no idea how to use any of them to create a server. I'm completely lost. From what I see, this all SVN repo is like a whole, huge package, but there is no way I need all those 100+ MB of code to write a simple server that can receive video frames from the browser, via WebRTC. So do could you explain where I should start ? – nschoe Aug 05 '14 at 13:39
-
1The Erizo endpoint is in its early stages as well. The API is a monster that is for sure but working with the Peerconnection example should show you what is needed in the bare minimum and you can toss the rest(use your own media stack). You could also just create your own endpoint, the only hard parts would be handling the DTLS exchange and the ICE gathering. Examples of doing both of this in simple C or C++ are in the two gateways I mentioned. – Benjamin Trent Aug 05 '14 at 14:38
-
Yeah the API _is_ a monster indeed! I will look _again_ at the Peerconnection example, but I can't understand what the "server" is for : is it only for signalling ? I will take a look at ICE gathering and DTLS exchange. Regarding the API, what is the relation between WebRTC and libjingle ? Is libjingle *only* WebRTC or is WebRTC just a subset of what libjingle can do ? Besides, what do you mean by "use my own media stack" ? I don't know where to start : I see no functions that give me a starting route, like "incoming_rtp()" does in Janus : jhere I know I have a hand on a RTP packet. – nschoe Aug 05 '14 at 14:44
-
1For the API, it is pretty well self contained and grabbing the RTP from it will take some hacking(you may be able to use [this part of the API](http://www.webrtc.org/reference/webrtc-internals/voertp_rtcp)...I am not a fan of it myself and there are no really good explanations on how to use it but I know it is possible. LibJingle is what WebRTC used to be called it is deprecated. The server is pretty much JUST signalling server for two clients to use. – Benjamin Trent Aug 05 '14 at 16:03
-
Yeah you're right, doesn't seem like a good idea to hack that part of the API... So libjingle is now deprecated ? What replaced it? I mean what is the official WebRTC implementation ? Is there one ? By the way, how come the WebRTC site still refers to libjingle's svn then ? So what is actually the "right" way to implement one's WebRTC server ? Is it reading the RFC and specs and then implement the specs directly in C (like perform the DTLS-exchange, etc) ? – nschoe Aug 06 '14 at 09:33
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58796/discussion-between-benjamin-trent-and-nschoe). – Benjamin Trent Aug 06 '14 at 14:28
-
LibJingle was Google's attempt at making media negotiations (for audio / video chats) capable over XMPP. It would gather the capabilities of the device the program was on and format that into an XMPP stanza, and then send that out to the other device via XMPP server(s). The PeerConnection Client / Server example in LibJingle does NOT use XMPP. It instead uses SDP being sent over HTTP to the PeerConnection Server. – AeroBuffalo Aug 06 '14 at 15:02
-
1From the sounds of it, what you need is the PeerConnection Client running on the server and a medium to send the negotiations through. (can be the same server). If I remember correctly the example uses long polling for the client-"exchange" server connection. I have implemented both the original example and an XMPP version in such a configuration before, let me know if you have specific questions. As for the capture part. I have done that as well on a server, and had to hack WebRTC a bit to get it. I can point you to where you need to go, depending on what format you want to capture. – AeroBuffalo Aug 06 '14 at 15:10
-
@BenjaminTrent, would you be interested to answer this question: [How to integrate part of WebRTC as a static / dynamic library with the existing C++ code?](https://stackoverflow.com/questions/71107066/how-to-integrate-part-of-webrtc-as-a-static-dynamic-library-with-the-existing). My primary interest to decrypt the voip date, as asked in [this question](https://stackoverflow.com/q/71028698). However, considering the complexity of DTLS-SRTP, I thought of going the C++ API way of WebRTC. It will be of great help, if you can put some insight. Thanks. – iammilind Feb 15 '22 at 04:14
1 Answers
It is possible.
WebRTC is using open standards to stream content over the network. You can find all the details in the following RFCs: http://tools.ietf.org/wg/rtcweb/
If you want to write your own native application that will receive (and even send) WebRTC media you can either get the WebRTC native code from here: http://www.webrtc.org/webrtc-native-code-package and build it into your solution or alternatively use one of the existing SDKs that can provide you this functionality (depending on which platform you want your native application to run on).
If you want to connect WebRTC to existing hardware like a SIP desk phone, you will need to have some sort of a gateway that will have one leg that will communicate with WebRTC on the browser and the other leg that will communicate with your SIP phone.
There are a lot of commercial solutions already out there, but eventually it all comes down to what your needs are.

- 176
- 1
- 5
-
Thanks, I'll look into that. But damn, how did I miss that page (the one with all the RFCs). I have been looking for that for a long time. Thanks. – nschoe Oct 01 '14 at 17:50
-
Would you be interested to answer this question: [How to integrate part of WebRTC as a static / dynamic library with the existing C++ code?](https://stackoverflow.com/q/71107066). My primary interest to decrypt the voip date, as asked in [this question](https://stackoverflow.com/q/71028698). However, considering the complexity of DTLS-SRTP, I thought of going the C++ API way of WebRTC. It will be of great help, if you can put some insight. Thanks. @nschoe – iammilind Feb 15 '22 at 04:21
-