function testThroughWebRTC(stream) {
  captureStream = stream;
  console.log("Testing through webrtc.");
  var sender = new RTCPeerConnection();
  var receiver = new RTCPeerConnection();
  sender.onicecandidate = function (event) {
    if (event.candidate) {
      receiver.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
  };
  receiver.onicecandidate = function (event) {
    if (event.candidate) {
      sender.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
  };
  receiver.onaddstream = function (event) {
    connectToVideoAndRunTest(event.stream);
  };
  sender.addStream(stream);
  sender.createOffer(function (sender_description) {
    sender.setLocalDescription(sender_description);
    receiver.setRemoteDescription(sender_description);
    receiver.createAnswer(function (receiver_description) {
      receiver.setLocalDescription(receiver_description);
      sender.setRemoteDescription(receiver_description);
    }, function() {
    });
  }, function() {
  });
}
// Set up a WebRTC connection and pipe |stream| through it.
Set up a WebRTC connection and pipe |stream| through it.
Set up a WebRTC connection and pipe |stream| through it .
function testThroughWebRTC(stream) {
  captureStream = stream;
  console.log("Testing through webrtc.");
  var sender = new RTCPeerConnection();
  var receiver = new RTCPeerConnection();
  sender.onicecandidate = function (event) {
    if (event.candidate) {
      receiver.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
  };
  receiver.onicecandidate = function (event) {
    if (event.candidate) {
      sender.addIceCandidate(new RTCIceCandidate(event.candidate));
    }
  };
  receiver.onaddstream = function (event) {
    connectToVideoAndRunTest(event.stream);
  };
  sender.addStream(stream);
  sender.createOffer(function (sender_description) {
    sender.setLocalDescription(sender_description);
    receiver.setRemoteDescription(sender_description);
    receiver.createAnswer(function (receiver_description) {
      receiver.setLocalDescription(receiver_description);
      sender.setRemoteDescription(receiver_description);
    }, function() {
    });
  }, function() {
  });
}
function testThroughWebRTC ( stream ) { captureStream = stream ; console . log ( "Testing through webrtc." ) ; var sender = new RTCPeerConnection ( ) ; var receiver = new RTCPeerConnection ( ) ; sender . onicecandidate = function ( event ) { if ( event . candidate ) { receiver . addIceCandidate ( new RTCIceCandidate ( event . candidate ) ) ; } } ; receiver . onicecandidate = function ( event ) { if ( event . candidate ) { sender . addIceCandidate ( new RTCIceCandidate ( event . candidate ) ) ; } } ; receiver . onaddstream = function ( event ) { connectToVideoAndRunTest ( event . stream ) ; } ; sender . addStream ( stream ) ; sender . createOffer ( function ( sender_description ) { sender . setLocalDescription ( sender_description ) ; receiver . setRemoteDescription ( sender_description ) ; receiver . createAnswer ( function ( receiver_description ) { receiver . setLocalDescription ( receiver_description ) ; sender . setRemoteDescription ( receiver_description ) ; } , function ( ) { } ) ; } , function ( ) { } ) ; }
Set up a WebRTC connection and pipe |stream| through it.
Set up a WebRTC connection and pipe |stream| through it .