Make participants start muted based on pre-configured settings for specific meeting

We have a setup where each meeting is configured according to that meeting’s requirements, so I can’t place the startWithAudioMuted and startWithVideoMuted in Jitsi config, and don’t want to place them in URL either as they can be removed.

In order to do it programatically, I fetch the config and then dispatch following actions based on received data, but none seem to have worked so far.

if(isLocalParticipantModerator(state)) {
    dispatch(setStartMutedPolicy(
        /* startAudioMuted */true,
        /* startVideoMuted */true
    ));
}

dispatch(updateConfig({
    startWithVideoMuted: true,
    startWithAudioMuted: true
}));

dispatch(setAudioMuted(true));
dispatch(setVideoMuted(true));
dispatch(muteLocal(true, MEDIA_TYPE.AUDIO));
dispatch(muteLocal(true, MEDIA_TYPE.VIDEO));
if (APP) {
    APP.UI.emitEvent(UIEvents.VIDEO_MUTED, true, true);
    // APP.UI.setVideoMuted();
}

Emitting UI muted event works though if I fire it from browser console, so not sure what could I be missing.

I looked at the logs and noticed that video is being disabled, but is later re-enabled. Will need to trace it somehow. Unfortunately the Redux Devtools crashes whenever I use it with Jitsi.