Hiyve Components - v1.0.0
    Preparing search index...

    Function useParticipantMixer

    • The local listener's mixer: per-participant playback gain in dB.

      Returns {
          gains: Record<string, number>;
          getGain: (userId: string) => number;
          resetAllGains: () => void;
          resetGain: (userId: string) => void;
          setGain: (userId: string, db: number) => void;
      }

      • gains: Record<string, number>

        Remote user id → gain in dB. Only non-zero entries are present.

      • getGain: (userId: string) => number

        A participant's gain in dB, 0 when unset.

      • resetAllGains: () => void

        Back to 0 dB for everyone.

      • resetGain: (userId: string) => void

        Back to 0 dB for one participant.

      • setGain: (userId: string, db: number) => void

        Set a participant's playback gain in dB (clamped to the supported range; 0 removes the entry).

      Local only — it changes what THIS user hears, never what is sent or recorded. A participant with no entry plays at 0 dB through the direct path; setGain to a non-zero value is what makes a tile build its Web Audio chain. Remembered per remote user when the provider has persistDeviceChanges.

      const { gains, setGain, resetGain } = useParticipantMixer();
      <Slider value={gains[userId] ?? 0} min={PARTICIPANT_GAIN_MIN_DB} max={PARTICIPANT_GAIN_MAX_DB}
      onChange={(_, db) => setGain(userId, db as number)} />