Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Aplicación de chat de video multiusuario: si el segundo usuario se une al chat de video, funciona solo con un punto de interrupción y no funciona mientras ejecutamos la aplicación

Desarrollé una aplicación de chat de video multiusuario. Usé angular para el front-end, Node.js para el backend y socket.io para la comunicación cliente-servidor. El problema es que si el segundo usuario se une al chat de video, el video no se muestra, pero cuando uso el punto de interrupción para depurar, funciona perfectamente bien. No sé cuál es el problema. He adjuntado el código ts aquí.

 public myVideo: HTMLVideoElement; UserId: { chatroom: any; user: any; message: String; name: String; }; myPeer: any; constructor(private webSocket: WebSocketService, private chatRoom: ChatroomService) { this.peerConnection(); this.myVideo = document.createElement('video') this.myVideo.muted = true; this.sendingToOthers(); } ngOnInit(): void { } peerConnection() { this.myPeer = new Peer(this.chatRoom.loginId, { host: '/', port: '3001' }) this.myPeer.on('open', id => { this.webSocket.videoCallJoining(id); }) } sendingToOthers() { navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(Stream => { this.addVideoStream(this.myVideo, Stream) this.myPeer.on('call', async call => { call.answer(Stream); const video = document.createElement('video'); await call.on('stream', userVideoStream => { this.addVideoStream(video, userVideoStream); }) }) this.webSocket.socket.on('user-connected', id => { this.connectToNewUser(id, Stream) }) }) } async addVideoStream(video: HTMLVideoElement, stream: any) { video.srcObject = stream; video.addEventListener('loadedmetadata', async function () { await video.play(); }) const videoGrid = document.getElementById('videoGrid') videoGrid.append(video); } async connectToNewUser(userId: any, Stream: any) { const call = this.myPeer.call(userId, Stream); const video = document.createElement('video') await call.on('stream', async userVideoStream => { await this.addVideoStream(video, userVideoStream); }) call.on('close', () => { video.remove() }) }

Creo que es por usar el eventlistener. Se activó temprano. Sugiérame cómo arreglar esto.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!