MediaSFU Shared
    Preparing search index...

    Function getParticipantMedia

    • Resolve a participant's live MediaStream from a MediaSFU parameter bag.

      This is the SDK-level counterpart of the getParticipantMedia helper that MediaSFU components publish through sourceParameters. That helper remains available for backwards compatibility; prefer this export when you drive the SDK headlessly (returnUI={false}) and only hold the parameter bag.

      Resolution order:

      1. parameters.participants matched by id, then by name.
      2. The matched participant's videoID / audioID, looked up against allVideoStreams / allAudioStreams by producerId. These collections are keyed by producer id only — a participant's id is its membership id and never matches, which is why an id-keyed lookup silently returns null.
      3. id treated directly as a producer id, for callers that already hold one.

      Parameters

      Returns Promise<MediaStream | null>

      import { getParticipantMedia } from 'mediasfu-reactjs';

      const stream = await getParticipantMedia({
      name: 'Paul',
      kind: 'video',
      parameters: sourceParameters.current,
      });
      if (stream) videoElement.srcObject = stream;