36

I want to create a WebRTC peer that's a simple listener/recorder with no "presentation" component (i.e., no HTML/CSS).

If this is possible, (with the WebRTC JavaScript APIs), please tell me what standalone JavaScript engine I can use (I'm thinking of installing a standalone V8 engine).

Thank you.

auro
  • 1,079
  • 1
  • 10
  • 22
  • 3
    that would be a capability added by the browser DOM, not by javascript. – dandavis May 07 '13 at 22:50
  • The peer I want to build has no interaction with the DOM. It does not "present" anything. – auro May 07 '13 at 23:05
  • 3
    What are you trying to accomplish? Are you looking to run WebRTC APIs with something like Phantom.js or Rhino? If you want to build a native app, take a look at the WebRTC code package (http://www.webrtc.org/reference/getting-started) and the various attempts to use Qt to build WebRTC apps. – Sam Dutton May 24 '13 at 14:35
  • Thanks, Sam Dutton. It now clear to me I have to use the native APIs. I was hoping that, if I had a stand-alone V8 (or any other JS engine) running on my machine, I could use the WebRTC JS APIs directly. My app doesn't decode audio/video and doesn't need any controls; so I don't need the web-browser's DoM. If you have any ideas on how to do this, please share. – auro May 28 '13 at 06:00
  • I'm also exploring how to do this and am wondering what solution you settled on. – Lyle Pratt Sep 20 '13 at 17:59
  • There is no solution currently. There are a bunch of commercial providers like OpenTok and a non-functional open source thing called licode. You would have to implement the ICE/STUN/TURN and SRTP RFCs and learn from all the c files at https://code.google.com/p/webrtc/source/browse/#svn%2Ftrunk%2Ftalk%2Fapp%2Fwebrtc It would take a team of good engineers years to build something that works. – Bjorn Sep 30 '13 at 15:44
  • Would running Chrome headless solve your problem? (https://gist.github.com/addyosmani/5336747) – Backpackcoder Nov 27 '13 at 03:08
  • 4
    Have you looked into the webrtc.io libraries for node.js? https://npmjs.org/package/webrtc.io – J Ellis Dec 06 '13 at 21:00
  • Possible duplicate of [Node.js WebRTC client](http://stackoverflow.com/questions/18872712/node-js-webrtc-client) – user Feb 12 '17 at 07:50

6 Answers6

14

Very late answer, but I think it's good to re-evaluate this question, because a lot has changed since this question was asked.

I assume this question was asked because there was no native support for webrtc yet at the time. But there is now. Android, iOS, Windows, Linux and OSX all support native webrtc libraries now.

The native libraries can be used to create a peerconnection and setup a stream to another client (cross-platform). If you want to create any webrtc-based client application without using a browser, the native libraries are the way to go. No silly standalone javascript engine necessary.

Read more here

Kevin
  • 2,739
  • 33
  • 57
4

You could do this with headless chrome. Chrome of course has full WebRTC support, but can be started in "headless" mode, and then interacted with via the command line or their control interface.

Eric Hanson
  • 596
  • 1
  • 5
  • 9
3

I think you could use a node.js server to do so. There's a npm package bringing webrtc capabilites to nodejs : node-webrtc.

Pierre F
  • 1,332
  • 15
  • 33
Hugo
  • 856
  • 1
  • 10
  • 30
  • 2
    That does look like the serverside part of WebRTC as well - the demo peer is still running in the browser. – Bergi Jan 16 '14 at 21:42
  • "MediaStream APIs are not supported", so you can't build a listener/recorder with this library – Pierre F Jun 09 '17 at 09:02
1

The best way to do this right now is to create a node-webkit application. The unified node + browser context gives you the best of all worlds.

ZECTBynmo
  • 3,197
  • 3
  • 25
  • 42
  • 1
    Yes, node is versatile enough to fit the bill. Why do we need a browser context? Please elaborate your thoughts if you have any. I'll accept the answer any way. – auro May 28 '14 at 23:45
  • The browser context is pre-setup with the webrtc connection primitives, so you don't have to do all the work – ZECTBynmo May 28 '14 at 23:58
0

I wanted to have a permanently running server-side "Robot" where public peers could connect to and test their connection (peer-to-peer vs relay). I was successful with the headless browser Puppeteer. The "Robot" uses basically the same code as the public peers. It runs on Windows and Unix and connected to the signaling and STUN/TURN server and the individual peer without any code changes.

Tsunamis
  • 5,870
  • 1
  • 20
  • 22
  • That's great. Do you mind sharing the puppeteer setup/files to make it work? – Amit Feb 03 '21 at 11:35
  • I don't have access to the code any more. But it's not much more than the project readme says. Just load your client code URL. You have to write your code in a way the robot accepts incoming calls automatically. But that's not in the scope of Puppeteer, but your WebRTC app. – Tsunamis Feb 04 '21 at 13:27
-1

If I got you right that you want to make WebRTC - aka primarily browser targeted feature to be used without browser:-)

I could imagine that "emulating" the browser behaviour can be done simply by implementing the necessary api via your own code, either directly inside the rhino or similar or by actually controlling the interface that handles the media streams in native code.

Thus what has to be done is implement the WebRTC api which controls capturing the A/V from input devices and sending it to the other side. As I understood it shall be no UI node, like embedded ethernet camera with mic that servers as capture A/V in conference room.

I am affraid that it could be a piece of work as the main part is the media a connection handling.

pxlinux
  • 34
  • 1
  • 2