Spaces:
Running
Running
| // PEERJS - Emisor | |
| let peer; | |
| let peerId = null; | |
| function iniciarPeer() { | |
| peer = new Peer({ | |
| host: '0.peerjs.com', | |
| port: 443, | |
| secure: true | |
| }); | |
| peer.on('open', id => { | |
| peerId = id; | |
| document.getElementById('peerIdBox').textContent = 'ID: ' + id; | |
| document.getElementById('peerIdBox').style.display = 'block'; | |
| }); | |
| peer.on('call', call => { | |
| navigator.mediaDevices.getUserMedia({video: true, audio: true}) | |
| .then(stream => { | |
| call.answer(stream); | |
| agregarLog('Familiar conectado a la cámara ✓', 'info'); | |
| }); | |
| }); | |
| } | |