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

140
Views
¿Cómo mostrar el video de un participante remoto en un video programable de Twilio?

Tengo una página web con el siguiente código javascript.

Mi código está escuchando el evento conectado del participante en una habitación determinada.

Cada vez que se conecta un nuevo participante, necesito mostrar su video remoto.

Aquí está mi código:

 var LastTrack; function trackSubscribed(HtmlParent, track) { LastTrack = track; console.log("the track width is : " + track.dimensions.width); console.log("the track Height is : " + track.dimensions.height); HtmlParent.appendChild(track.attach()); } function participantConnected(HtmlParent, participant) { participant.tracks.forEach(publication => { if (publication.isSubscribed) { trackSubscribed(HtmlParent, publication.track); } else { console.log('Track not subscribed'); } }); participant.on('trackSubscribed', track => trackSubscribed(HtmlParent, track)); }

Este código nunca funciona la primera vez. El video remoto no se agrega el html dom y en los registros tengo:

 the track width is : null the track height is : null

Sin embargo, si llamo manualmente (unos segundos más tarde) a la función trackSubscribed (HtmlParent, LastTrack), entonces funciona. El video se muestra como se esperaba y las dimensiones son correctas:

 the track width is : 640 the track height is : 480

Es como cuando trato de agregar la pista al dom html la primera vez, la pista no está "lista".

¿Alguien sabe qué estoy haciendo mal aquí?

Gracias. Salud,

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!