leaveChannelEx abstract method

Future<void> leaveChannelEx({
  1. required RtcConnection connection,
  2. LeaveChannelOptions? options,
})

Sets channel options and leaves the channel.

After this method is called, the SDK stops audio and video communication, leaves the current channel, and releases all session-related resources. After successfully joining a channel by calling joinChannelEx, you must call this method to end the call; otherwise, you cannot start the next call. This method is asynchronous. When the call returns, it does not mean the channel has been actually left. If you call leaveChannel, you will leave both the channels joined by joinChannel and joinChannelEx. If you call release immediately after calling this method, the SDK will not trigger the onLeaveChannel callback.

  • connection Connection information. See RtcConnection.
  • options Options for leaving the channel. See LeaveChannelOptions. This parameter only supports setting the stopMicrophoneRecording member in LeaveChannelOptions. Setting other members has no effect.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions.

Implementation

Future<void> leaveChannelEx(
    {required RtcConnection connection, LeaveChannelOptions? options});