Search code examples
webkitwebrtcvideochatpeer

WebRTC HowTo PeerConnection via LAN with 2 Browsers


since few days I'm trying to build a basic webRTC Videochat. I've got some Demos running localy, even via LAN. But now I want to build one by my one at the really basics without so much overload some Demos come with.

But I still don't get a complete peer connection.

Eg. this example seems to be broken, because I can't "createSignalingChannel();" w3.org/TR/webrtc/#simple-example

Some other examples (https://webrtc-experiment.appspot.com/) want me to link their scripts, but I wont do this, because I want to understand the magic of the peer connection and how to get a handshake between 2 browsers.

I also explored examples with the Google App Engine but thats not what I want.

I want to run it in really easy JS and HTML just on the minimum of what is neccessary.

Here is my code: https://github.com/mexx91/basicVideoRTC EDIT: Should work now

So what will I have to add to get an handshake and peer connection, so that I can send eg. the mediaStream to eachother.

Thanks a lot!


Solution

  • createSignalingChannel() is only pseudo-code to illustrate the existence of a separate channel. You need for the initial connection handling a separate message channel.

    You can achieve that with hosted services like Pusher, Brightcontext or PubNub, or you can host your own backend with open-source projects like socket.io or SignalR.

    Then you just need to send the offers, answers and iceCandidates through your separate channel.

    List of Realtime Services: http://www.leggetter.co.uk/real-time-web-technologies-guide