Attach/Detach Participants Stream


This section discusses how to attach and detach the participants in the provided view.

attachParticipantToView

Use the attachParticipantToView() method to attach a remote participant's video to your HTMLDivElement (view). This method renders the video stream and displays it in the specified view (Ref. attachParticipantToView).

By attaching a participant’s video to a view, the video stream is rendered in the provided view. You can only attach one participant at a time to one view.

  • Attaching a new participant to the view will implicitly detach any existing participant from that view.
  • Use the attachedViewsForParticipantIds property of the VideoStreamService object to check the views for every participant's video stream that has been attached using the attachParticipantToView method.
  • You can check the videoStreams property if the corresponding stream is available for a participant (See. Video Stream).
webClientSDK.meetingService.videoStreamService.attachParticipantToView(participantGuid: string, view: HTMLDivElement);

If the value AttachParticipantToViewResult.success is true, then you can start seeing the remote participant's video feed inside your HTMLDivElement and if the value AttachParticipantToViewResult.success is false, see the following error code, and fix it before you continue.

Parameters

Description

participantGuid The unique identifier of the participant whose video you want to attach.
HTMLDivElement

This is the div element that will be used to render the remote participant’s video.

Note

The view would be used as a container for rendering video. Make sure that the view has height and width and no other elements inside it.

 

The response error codes of an AttachParticipantToViewResult object are returned if the remote participant’s video was not successfully attached to the provided view.

Response Codes

Description

NOT_USING_CUSTOM_LAYOUTS A custom layout must be selected before attachParticipantToView() can be called.
NO_PARTICIPANTS_WITH_IDS The input configuration you provided is an invalid participantGuid. 
NO_STREAM_FOR_PARTICIPANT_ID

There isn't a video stream available for this participantGuid

UNKNOWN Unknown runtime error

Note

Whenever you create a new HTMLDivElement, you need to add its height and width. You can also use the HTMLDivElement for video stream styles.

detachParticipantFromView

You can use the detachParticipantFromView method to detach a remote participant's video from a view. This method removes the participant's video stream and stops rendering the video from the view.

webClientSDK.meetingService.videoStreamService.detachParticipantFromView(participantGuid: string);

If the value DetachParticipantToViewResult.success is true, then you successfully detach the participant from the view, and if the value DetachParticipantToViewResult.success is false, see the following error code, and fix it before you continue.

Parameters

Description

participantGuid The unique identifier of the participant whose video you want to detach.

 

The response error codes of the DetachParticipantToViewResult object are returned if the remote participant’s video was not successfully detached from the provided view.

Response Codes

Description

OBJECT_NOT_ATTACHED There is no participantGuid object attached to the provided view.
UNKNOWN Unknown runtime error