var WebRTC = require('../');

//WebRTC.setDebug(true);

var capturer = new WebRTC.MediaSource('webcam');
var renderer = new WebRTC.MediaSource('window');

setTimeout(function() {
  console.log('Closing...');
  
  capturer.end();
  renderer.end();
}, 5000);
@@ -27,10 +27,8 @@
 );%0A%0A
-//
 WebR
@@ -51,21 +51,21 @@
 );%0A%0Avar 
-captu
+rende
 rer = ne
@@ -91,21 +91,21 @@
 e('w
-ebcam
+indow
 ');%0Avar 
 rend
@@ -96,29 +96,29 @@
 ndow');%0Avar 
-rende
+captu
 rer = new We
@@ -136,23 +136,138 @@
 ource('w
-indow')
+ebcam');%0A%0Acapturer.onend = function() %7B%0A  renderer.end();%0A%7D;%0A%0Acapturer.ondata = function(data) %7B%0A  renderer.write(data);%0A%7D
 ;%0A%0AsetTi
@@ -335,34 +335,16 @@
 .end();%0A
-  renderer.end();%0A
 %7D, 5000)

Update test