Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.remoteUsers not wroking #10

Closed
shreyas-jadhav opened this issue May 8, 2021 · 3 comments
Closed

client.remoteUsers not wroking #10

shreyas-jadhav opened this issue May 8, 2021 · 3 comments

Comments

@shreyas-jadhav
Copy link

Hey, I'm not using TypeScript here, but in my Next.js project, I'm constantly getting an empty array when I Array.from(client.remoteUsers).
Basically, I wanted to filter out some users by username, but I can't even access the array as I am getting client.remoteUsers as a typeof object.

I am stuck here from nearly 2 days. I don't understand what i'm doing wrong here. Console logging client.remoteUsers actually returns me an array. I cannot map / filter / Array.from() or any other operation. It's returning me an empty array.

const newA = client.remoteUsers.map((user)=>{
      return {videoTrack: user.videoTrack, audioTrack: user.audioTrack}
    });

console.log(newA) //empty even though it;s not.

setStudents(remoteUsers => Array.from(client.remoteUsers)); 

console.log(students); //empty array even though it;s not.
@yoreland
Copy link
Contributor

yoreland commented May 9, 2021

just a quick check,did you try the same on client.on("user-published") callback?

@shreyas-jadhav
Copy link
Author

Yes. When I console log only the user I get the user. But I'm not able to add it to an array, or acces it's properties like user.uid etc.

Moment I add it to an array, immediately returns an empty array.

@plutoless
Copy link
Contributor

what is the implementation of setStudents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants