changeMode method
Changes the media mode of the local participant.
-The participant mode determines whether audio and video streams are produced, consumed, or used only for signaling.
Available Modes
-
Mode.SEND_AND_RECV: Both audio and video streams will be produced and consumed.
-
Mode.SIGNALLING_ONLY: Audio and video streams will neither be produced nor consumed. This mode is used only for signaling.
-
Mode.RECV_ONLY: Audio and video streams will only be consumed and not produced.
-
When the mode is successfully changed, a Events.participantModeChanged event is emitted with the
participantIdand the updatedmodeof the participant.
Parameters
requestedMode: The desired participant mode. Possible values are Mode.SEND_AND_RECV, Mode.SIGNALLING_ONLY, or Mode.RECV_ONLY.
Events associated with changeMode()
- Events.participantModeChanged with
participantIdandmode
Example
// Change participant mode to send and receive media
await room.changeMode(Mode.SEND_AND_RECV);
room.on(Events.participantModeChanged, (event) {
print(
'Participant ${event.participantId} changed mode to ${event.mode}',
);
});
Implementation
Future<void> changeMode(Mode requestedMode) => _changeMode(requestedMode);