getParticipantMedia

Retrieves the media stream of a participant by ID or name.

This function searches for a participant's media stream (video or audio) using either their producer ID or participant name.

Parameters:

  • id (String): The producer ID of the participant. Default is empty string.

  • name (String): The name of the participant. Default is empty string.

  • kind (String): The type of media stream to retrieve:

  • 'video': Video stream

  • 'audio': Audio stream Default is 'video'.

  • parameters (GetParticipantMediaParameters): Parameters containing:

  • allVideoStreams: List of all video streams

  • allAudioStreams: List of all audio streams

  • participants: List of all participants

Returns:

  • MediaStream?: The media stream if found, otherwise null.

Example:

// Get video stream by producer ID
val videoStream = getParticipantMedia(
GetParticipantMediaOptions(
id = "producer-id-123",
name = "",
kind = "video",
parameters = parameters
)
)

// Get audio stream by participant name
val audioStream = getParticipantMedia(
GetParticipantMediaOptions(
id = "",
name = "John Doe",
kind = "audio",
parameters = parameters
)
)