Lock failed on JitsiMeetExternalAPI

Can you tell if you are getting the participantRoleChanged event? Maybe do a console.log?

Hi, Thanks for the message. I am new, so, pls pardon me if I am not answering correct and pls help me to find the correct info!

Is this what you mean about in the console.log?

2020-05-09T07:39:46.658Z [conference.js] <a.>: My role changed, new role: none
Logger.js:154 2020-05-09T07:39:47.017Z [conference.js] <a.>: My role changed, new role: moderator

I also see this error in the console:

2020-05-09T07:39:46.848Z [features/room-lock] setting password failed Error: You are not moderator.
at se.lock (JitsiConference.js:1225)
at actions.js:681

Any ideas?


I’m also unable to use the participantRoleChanged API event.

I’ve tried to test with the following code:

api.addEventListener(‘participantRoleChanged’, function(event) {
if (event.role == ‘moderator’) {

But the test fails… I just updated Jitsi on Thursday so I’m not sure what is wrong.

Edit: Just noticed this pull request was merged only 5 days ago. Is this on the latest stable (2.0 4548-1) or just in the nightly?

I guess the api.EventListener fires before the waiting. Whatever. If you try it without the EventListener, and a higher timeout, it is working.

setTimeout(() => {
api.executeCommand(‘password’, yourRoomPass);
}, 2000);

lower than 2 sec gave me the lock error.

The last stable appears to be from 5/1, so I guess it’s only in the nightly (unstable) for now.

Thanks @Jim_Bullington . I figured this might have been the case. I’ll have to keep an eye out for when this gets pushed to stable :slight_smile: . Thanks for your contribution. The Jitsi community is awesome.

Hi Everyone & Marcus,

Try this functionality. This works for me. But make sure you have deployed the master version of code of jitsi-meet. As for the code to work, you need to have participantRoleChanged event enabled in the code.
The latest code is merged 6 days ago - https://github.com/jitsi/jitsi-meet/pull/6573

        var pass = 'your-room-password';
        api.addEventListener('participantRoleChanged', function(event) {
            // when host has joined the video conference 
            if (event.role == 'moderator') {
                api.executeCommand('password', pass);
            else {
                setTimeout(() => {
                // why timeout: I got some trouble calling event listeners without setting a timeout :)

                    // when local user is trying to enter in a locked room 
                    api.addEventListener('passwordRequired', () => {
                        api.executeCommand('password', pass);

                    // when local user has joined the video conference 
                    api.addEventListener('videoConferenceJoined', (response) => {
                        setTimeout(function(){ api.executeCommand('password', pass);}, 300);

                }, 10);

Hi Fared, this is working with the latest nightly build now. Well done.

I think I have to set up a development environment for myself, as I want a random password for each meeting automatically set which cannot be seen by looking at the javascript.




I found a stopgap solution for this error with BuddyMeet here:

could u pls tell me where to add this external code in jitsi-meet source code

Thanks and Regards