[ExternalAPI] Safe way to known if current user is moderator


I have a jitsi embedded in a page, using the External API.
I need to check if the user is a moderator (for letting him access to extra feature I’ve made, outside of the iFrame).

Currently, the External API only have an event that is fired when the role is assigned (from ‘none’ to ‘moderator’). But I need a way to ask with a bool method.

In the LowLevel API, there is APP.conference._room.isModerator(). Obviously, it’s not easy and not really reliable to access APP.conference._room withing the External API.
I could use the iFrame contentWindow then crawl for APP then conference etc… But this object doesn’t pop really quickly. I can maybe use a timeout to wait for it, but I really not good.

Do you know a simple method to archieve that ?

Doesn’t the participantJoined event have this information?


If you refering to the participantJoinded event of the ExternalAPI , it seems only to provide and id and displayName :

There is also participantRoleChanged which give the role, and it work well, but it’s still an event to listen to.

But it’s still and event ! So not ponctual.

Do you think I can maybe submit a pull request to add a ponctual isModerator() method to the ExternalAPI ?

We have getParticipantsInfo. I think the data should be put in there, instead of adding an extra function.

It make sense.
I’ll see if i can add it there as a PR so!
Maybe also a property ‘isMe’ or something like that.

Thanks for your insights

@saghul is getParticipantsInfo fully supported now? I tried on my own deployment (1.0.4628-1) and https://meet.jit.si/external_api.js and in both cases the array is empty (when multiple members are in the room). (related)

@corby Hmm…mm I tried it on meet.jit.si and it worked fine - listed all participants besides me.

1 Like

You mean… I actually need to have others in the room? :slight_smile:

In case this may help others: Looks like if you are using JWT / authentication, you actually need to have someone else other than yourself in the room. The “2 tabs” trick will not populate that list, even though the conference media is flowing. btw - I could also see my info in addition to others.

1 Like

That might be a bug indeed.