title: How to get multiple streams from WebRTC PeerConnection
body: <p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/ontrack" rel="nofollow noreferrer">RTCPeerConnection.ontrack</a> documentation, &quot;ontrack&quot; event suppose to fire for each incoming streams. I have a PeerConnection with two video streams, after connection, &quot;ontrack&quot; fires two times (up to here everything is OK). But both times it sends same stream out, so I end up with two identical video, I am sure sender is sending two different streams, dimension and frame rate of them are different and I can clearly see in chrome://webrtc-internals/ that 2 video streams have different frame size/rate.</p>
  <p>Here is PeerConnection ontrack code:</p>
  <pre><code>        this.peerConnection.ontrack = function(evt) {
              console.log(&quot;PeerConnection OnTrack event: &quot;, evt.streams);
              that.emit('onRemoteStreamAdded', evt.streams);
          };
  </code></pre>
  <p>I don't assume <code>evt.streams</code> has 1 object, so I did not write <code>evt.streams[0]</code>.</p>
  <p>Here is Chrome console log:
  <a href="https://i.stack.imgur.com/XQgMO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XQgMO.png" alt="Chrome console log" /></a></p>
  <p>As it is obvious from log <code>getRemoteStreams()</code> returns only one object. How is it possible <code>ontrack</code> fires two time when it has only one stream, and why second RTCRtpTransceiver does not make a new stream?</p>