Dynamic Role / Preset Change

🚧

Warning

This feature is introduced in version 0.5.7 and requires a specific permission flag, please contact us for adding the permission flag to your user roles

The core functionality is exposed as a method to the DyteParticipant and DyteSelfParticipant classes updatePreset(presetName: string).

For example if you want to update a user to host you will do

participant.updatePreset("host");

A more complete example would look like

meeting.addParticipantControl({
          label:'Make co-host',
          onClick: (peerId) => {
            const user = meeting.participants.find((p) => p.id === peerId);
            if(user){
              user.updatePreset("host");
            }
          }
  })

Similarly a preset change for example changing from a "group" video call to a "webinar" call

meeting.controlBar.addButton({
        label: "Webinar Mode",
        icon: <div>W</div>,
        position: "center",
        onClick: () => {
            meeting.participants.forEach((p) => {
               if(!p.isMe){
                   p.updatePreset("default_webinar_participant_preset");
               } else p.updatePreset("default_webinar_host_preset");
            });

 }});