MediaSFU Shared
    Preparing search index...

    Function getMediaPermissions

    • Can this user turn their mic, camera or screen share on right now?

      MediaSFU decides this inside clickAudio / clickVideo / clickScreenShare, which return void and report a refusal only through showAlert. That means a headless surface finds out a control was blocked after the user pressed it — the button looks broken. This evaluates the same gates up front so you can disable the control and say why instead.

      The branches mirror the SDK's own order: audio-only rooms, host recording locks, adminRestrictSetting, focus-mode panelist restrictions, and the allow / approval / disallow settings. Host (islevel === '2') bypasses the participant-level gates, exactly as the controls do.

      Note this cannot predict two cases: room capacity checks, which the SDK resolves by asking the server (checkProduce), and OS-level device permission, which only surfaces when capture is attempted. Treat a false here as authoritative and a true as "nothing known blocks it".

      Parameters

      Returns MediaPermissions

      const perms = getMediaPermissions({ parameters });