[IFrame API] Sets the password for the room


I’m currently trying to add a password to my room using the IFrame API. My code is below

           <script src="https://meet.jit.si/external_api.js"></script>
            var domain = "meet.jit.si";
            var options = {
                roomName: "xxxx",
                width: '100%',
                height: '100%',
                parentNode: undefined,
                interfaceConfigOverwrite: {
                    TOOLBAR_BUTTONS: [
        'microphone', 'camera', 'closedcaptions', 'desktop', 'fullscreen',
        'fodeviceselection', 'hangup', 'profile', 'chat', 'recording',
        'livestreaming', 'etherpad', 'sharedvideo', 'settings', 'raisehand',
        'videoquality', 'filmstrip', 'invite', 'feedback', 'stats', 'shortcuts',
        'tileview', 'videobackgroundblur', 'download', 'help', 'mute-everyone'
            var api = new JitsiMeetExternalAPI(domain, options);
            api.executeCommand('password', 'The Password');

It doesn’t work, there is no pwd.

I read on an other post that I need to execute the password command after joining.
I tried that :

api.addEventListener('videoConferenceJoined', afterJoining());

function afterJoining(){
   alert('I Joined the conference!');
   api.executeCommand('password', 'MyPwd');

But still not working. Someone know What should I do?

Thanks in advance!


Not sure if you have found a solution, but based on the documentation you should check you are the moderator before setting the password.

Check the example “// set new password for channel” here https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe