javascriptwebwebrtcpeerjsrfc5766turnserver

Streaming with Peerjs and turnserver


I am trying to create a web application that allows a users desktop to be shared to others via desktop capture and peerjs. So far I am able to share the screen when both devices are connected to the same NAT. But when I try two symmetric NATs the connection does not go through. So I did some research and I figured out I need a TURN Server. For this I am using www.turnservers.com. I am having some trouble with the syntax for sending the servers to the new peer object. I keep getting the error Peer is not defined. Here is what I have so far...

window.turnserversDotComAPI.iceServers(function(data) {
    var peer = new Peer(makeid(),{
        key: '**************', 
        config: {'iceServers': data} }
        );
});

Both API's...

http://www.turnservers.com/docs

http://peerjs.com/docs/


Solution

  • You can try installing the peerjs module npm install peerjs and then require it in your javascript file var peerjs = require('peerjs');

    I think that should fix your problem.