leaveChannelEx abstract method

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

Sets channel options and leaves the channel.

This method lets the user leave the channel, for example, by hanging up or exiting the call. After calling joinChannelEx to join the channel, this method must be called to end the call before starting the next call. This method can be called whether or not a call is currently in progress. This method releases all resources related to the session. This method call is asynchronous. When this method returns, it does not necessarily mean that the user has left the channel. After you leave the channel, the SDK triggers the onLeaveChannel callback. After actually leaving the channel, the local user triggers the onLeaveChannel callback; after the user in the communication scenario and the host in the live streaming scenario leave the channel, the remote user triggers the onUserOffline callback. If you call release immediately after calling this method, the SDK does not trigger the onLeaveChannel callback. If you want to leave the channels that you joined by calling joinChannel and joinChannelEx, call the leaveChannel method.

  • connection The connection information. See RtcConnection.
  • options The options for leaving the channel. See LeaveChannelOptions. This parameter only supports the stopMicrophoneRecording member in the LeaveChannelOptions settings; setting other members does not take 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.

Implementation

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