Leaves a channel.

abstract leaveChannelEx(
    connection: RtcConnection,
    options?: LeaveChannelOptions
  ): number;

After calling this method, the SDK terminates the audio and video interaction, leaves the current channel, and releases all resources related to the session.

After calling joinChannelEx to join a channel, you must call this method or leaveChannelEx to end the call, otherwise, the next call cannot be started.

Attention:
  • This method call is asynchronous. When this method returns, it does not necessarily mean that the user has left the channel.
  • If you call or leaveChannel, you will leave all the channels you have joined by calling , joinChannel, or joinChannelEx.

Applicable scenarios

This method can be called in scenarios involving multiple channels.

Call timing

Call this method after joinChannelEx.

Restrictions

If you call release immediately after calling this method, the SDK does not trigger the onLeaveChannel callback.

Parameters

connection
The connection information. See RtcConnection.

Returns

  • 0: Success.
  • < 0: Failure.