My peer’s stream doesn’t appear, what am I doing wrong? [WebRTC]

I’m trying to receive my partner’s stream but it’s not working, I don’t know if I’m misimplementing the example given by WebRTC website and I can’t understand it well because I’m new to this.

That I have to do?


const connection = new RTCPeerConnection({ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] });


async function start() {

const localStream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});

localStream.getTracks().forEach(track => {
    connection.addTrack(track, localStream);
});

    }
    
    
    const remoteVideo = document.querySelector('.remote-video');

connection.addEventListener('track', async (event) => {
    const remoteStream = event.streams[0];
    remoteVideo.srcObject = remoteStream;
    
    connection.addTrack(event.track);
    
});