Edit in JSFiddle

const pc1 = new RTCPeerConnection(), pc2 = new RTCPeerConnection();

pc2.ontrack = e => {
  console.log('got track', e.track, e.streams);
  remoteVideo.srcObject = e.streams[0];
};

pc2.oniceconnectionstatechange = () =>
  console.log('PC2 ice state ' + pc2.iceConnectionState);

(async () => {
  const stream = await navigator.mediaDevices.getUserMedia({video: true});
  pc1.addTrack(stream.getVideoTracks()[0], stream);
  const offer = await pc1.createOffer();
  await pc1.setLocalDescription(offer);
  await pc2.setRemoteDescription(offer);
  const answer = await pc2.createAnswer();
  await pc2.setLocalDescription(answer);
  await pc1.setRemoteDescription(answer);
})();

const console = {log: msg => div.innerHTML += msg + "<br>"};
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<video id="remoteVideo" width="320" height="240" controls autoplay></video>
<div id="div"></div>