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

136
Views
AgoraRTC no puede agregar múltiples usuarios en la página web. no puedo entender lo que salió mal

Estaba tratando de hacer un sitio web de transmisión usando Agora.io en mi JavaScript, hice una plantilla de reproductor que se agregará a mi página web cada vez que ingrese un nuevo usuario. ¡el método client.on debe detectar la llegada de un nuevo usuario y devolver la llamada a la función que debe agregar el nuevo usuario a la transmisión!

 const APP_ID = "fe45f285661941ada5ef5d451fe8f626" const CHANNEL = "main" const TOKEN = "006fe45f285661941ada5ef5d451fe8f626IABxEPnj4KCl8i4+gcrg2F7Cc+nmjmOiRWq49ICnSOHfdGTNKL8AAAAAEACXVkQu42OcYgEAAQC9Y5xi" const client = AgoraRTC.createClient({mode:"rtc",codec:"vp8"}) let localTracks = [] let remoteUsers = {} let UID let joinAndDisplayLocalStreams = async ()=> { client.on("user-published",handleUserJoined) UID = await client.join(APP_ID,CHANNEL,TOKEN,null) localTracks = await AgoraRTC.createMicrophoneAndCameraTracks() let player = ` <div class="video-container" id="user-container-${UID}"> <div class="name-wrapper"><span class="user-name">My name</span></div> <div class="video-player" id="user-${UID}"></div> </div>` document.getElementById("video-streams").insertAdjacentHTML("beforeend",player) localTracks[1].play(`user-${UID}`) await client.publish([localTracks[0],localTracks[1]]) } let handleUserJoined = async(user,mediaType)=>{ remoteUsers[user.uid]= user await client.subscribe(user,mediaType) console.log(mediaType) if(mediaType==="video"){ let player = document.getElementById(`user-container-${user.uid}`) if(player!=null){ player.remove() } player = `<div class="video-container" id="user-container-${user.uid}"> <div class="name-wrapper"><span class="user-name">My name</span></div> <div class="video-player" id="user-${user.uid}"></div> </div>` document.getElementById("video-streams").insertAdjacentElement("beforeend",player) user.videoTrack.play(`user-${user.uid}`) } if(mediaType==="audio"){ user.audioTrack.play() } } joinAndDisplayLocalStreams()
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!