Reputation: 7405
I am a newbie to WebRTC and PeerJS. My aim is to share Computer A local media stream to Computer B. I have successfully do this with the use of the cloud PeerJS server. However, I want to setup my server in local network.
Computer A is responsible for capturing the local media stream and I have the following code written.
var peer = new Peer('mycustomid1', {host: 'localhost', port: 9000});
Computer B is responsible for displaying the stream received from Computer A.
var peer = new Peer('mycustomid2', {host: 'Computer A's ipv4 address', port: 9000});
And I start my server with the code:
node peerjs --port 9000
Is my code correct? P.S. I can access Computer A localhost in a web browser on Computer B.
Thanks in advance.
Upvotes: 0
Views: 1387
Reputation: 61
I also struggled a bit with setting up a peerserver. Try adding the key peerjs when you start the server. From the github page:
peerjs --port 9000 --key peerjs
I think the key gets defaulted to 'peerjs' when you don't supply it when making a peer. Not to sure about this.
Also, try adding the default path when creating the peers.
var peer = new Peer('mycustomid2', {host: 'Computer A's ipv4 address', port: 9000, path: '/'});
Do this on both peers. Hope it helps
Upvotes: 1