title: Not being able to display videostream of other user using single mediastream
body: <p>So i am doing a video calling app project using node.js,peer.js,soket.io to get myself familiar with them:</p>
  <p>here is the First Method I tried:</p>
  <p>I tried to give call to peer and to answer that call using the stream from same place.
  It failed as Peer's call event didn't trigger and no answer came.(line 1)
  Hence no stream was sent in response.</p>
  <pre><code>
  const myVideo = document.createElement(&quot;video&quot;);
  myVideo.muted = true;
  var videoGrid = document.getElementById(&quot;video-grid&quot;);
  navigator.mediaDevices.getUserMedia({
      video: true,
      audio: true
  }).then((stream) =&gt; {
      addVideo(myVideo, stream);
  
  
      peer.on('call', (call) =&gt; {                                           //LINE 1
          call.answer(stream);
          const video = document.createElement(&quot;video&quot;);
          call.on('stream', (remoteStream) =&gt; {
              addVideo(video, remoteStream);
          });
      });
  
  
      socket.on('user-connected', (userId) =&gt; {
          const call = peer.call(userId,
              stream);
          const video = document.createElement(&quot;video&quot;);
          call.on('stream', function (remoteStream) {
              addVideo(video, remoteStream);
          });
      })
  
  });
  
  
  peer.on('open', id =&gt; {
      socket.emit('join-room', ROOM_ID, id);
  })
  
  const addVideo = (video, mediaStream) =&gt; {
      video.srcObject = mediaStream;
      video.addEventListener('loadedmetadata', () =&gt; {
          video.play();
      })
      videoGrid.append(video);
  }
  
  </code></pre>
  <p>In following I gave call to peer,and answered it using different streams.
  This Worked.</p>
  <pre><code>const myVideo = document.createElement(&quot;video&quot;);
  myVideo.muted = true;
  var videoGrid = document.getElementById(&quot;video-grid&quot;);
  navigator.mediaDevices.getUserMedia({
      video: true,
      audio: true
  }).then((stream) =&gt; {
      addVideo(myVideo, stream);
  });
  
  
  peer.on('call', (call) =&gt; {
      navigator.mediaDevices.getUserMedia({
          video: true,
          audio: true
      }).then((stream) =&gt; {
  
          call.answer(stream);
          const video = document.createElement(&quot;video&quot;);
          call.on('stream', (remoteStream) =&gt; {
              addVideo(video, remoteStream);
          });
      })
  });
  
  
  
  const connectToNewUser = (userId) =&gt; {
      navigator.mediaDevices.getUserMedia({
          video: true,
          audio: true
      }).then((stream) =&gt; {
          const call = peer.call(userId,
              stream);
          const video = document.createElement(&quot;video&quot;);
          call.on('stream', function (remoteStream) {
              addVideo(video, remoteStream);
          });
      })
  }
  
  
  
  </code></pre>
  <p>So why did this work?
  can streams not be used repeatedly???</p>
  <p>Also I tried to add myself in a call to have two of my videos showing side by side, I noticed that as i increase the instances of myself the streams were getting more and more laggy.
  Is this a result of multiple streams from same camera??</p>
  <p>(ONLY MAIN FUNCTION SHOWED ABOVE TO DECREASE CODE.)</p>