leaveChannel method
Allows a user to leave a channel.
After joining a channel, the user must call this method to end the call before joining another channel. This method returns 0 if the user leaves the channel and releases all resources related to the call. This method call is asynchronous, and the user has not exited the channel when the method call returns. Once the user leaves the channel, the SDK triggers the RtcEngineEventHandler.leaveChannel callback. A successful method call triggers the following callbacks:
- The local client: RtcEngineEventHandler.leaveChannel.
- The remote client: RtcEngineEventHandler.userOffline, if the user leaving the channel is in the ChannelProfile.Communication profile, or is a ClientRole.Broadcaster in the ChannelProfile.LiveBroadcasting profile.
Note
- If you call the RtcEngine.destroy method immediately after calling this method, the
leaveChannel
process interrupts, and the SDK does not trigger the RtcEngineEventHandler.leaveChannel callback. - If you call this method during CDN live streaming, the SDK triggers the RtcEngine.removePublishStreamUrl method.
Implementation
@override
Future<void> leaveChannel() {
return _invokeMethod('leaveChannel');
}